-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #230 from UUDigitalHumanitieslab/feature/frontend-…
…collections Basic frontend collection management
- Loading branch information
Showing
38 changed files
with
484 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# EditorConfig helps developers define and maintain consistent | ||
# coding styles between different editors and IDEs | ||
# editorconfig.org | ||
|
||
root = true | ||
|
||
|
||
[*] | ||
|
||
indent_style = space | ||
indent_size = 4 | ||
charset = utf-8 | ||
insert_final_newline = true | ||
trim_trailing_whitespace = true | ||
|
||
[**/package.json] | ||
indent_size = 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,4 +17,9 @@ db* | |
/frontend/vre/*bundle*.js* | ||
|
||
# Visual Studio Code | ||
.vscode/ | ||
.vscode/ | ||
|
||
# emacs | ||
.\#* | ||
*~ | ||
\#*\# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,8 @@ | ||
<div class="page-header" id="title-collection"> | ||
<h2>Search or browse {{description}}</h2> | ||
<h2>Collection {{name}} <small> | ||
{{summary}} | ||
<button type=button class="btn btn-default btn-sm" aria-label="Edit summary"> | ||
<span class="glyphicon glyphicon-pencil" aria-hidden=true></span> | ||
</button> | ||
</small></h2> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import { View } from '../core/view.js'; | ||
import editSummaryTemplate from './edit-summary.view.mustache'; | ||
|
||
export var EditSummaryView = View.extend({ | ||
tagName: 'form', | ||
className: 'form-inline inline-editor', | ||
template: editSummaryTemplate, | ||
|
||
events: { | ||
submit: 'submit', | ||
reset: 'reset', | ||
}, | ||
|
||
initialize: function() { | ||
this.render(); | ||
}, | ||
|
||
render: function() { | ||
this.$el.html(this.template(this)); | ||
this.fillValue(); | ||
return this; | ||
}, | ||
|
||
fillValue: function() { | ||
this.$('input').val(this.model.get('summary')); | ||
}, | ||
|
||
submit: function(event) { | ||
event.preventDefault(); | ||
var payload = { | ||
summary: this.$('input').val(), | ||
}; | ||
this.trigger('submit', payload); | ||
this.model.save(payload, {wait: true}); | ||
}, | ||
|
||
reset: function(event) { | ||
event.preventDefault(); | ||
this.trigger('reset').fillValue(); | ||
}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<div class="form-group"> | ||
<label | ||
for=summary-{{&cid}} | ||
class="sr-only" | ||
>Collection summary</label> | ||
<input | ||
type=text | ||
name=summary | ||
placeholder="Collection summary" | ||
id=summary-{{&cid}} | ||
class="form-control" | ||
> | ||
</div> | ||
<button | ||
type=submit | ||
class="btn btn-primary" | ||
>Save</button> | ||
<button | ||
type=reset | ||
class="btn btn-default" | ||
>Cancel</button> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
<a href="/collection/{{id}}/" id="{{id}}">{{description}}</a> | ||
<a href="/collection/{{name}}/" id="{{name}}">{{name}}</a> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,24 @@ | ||
<a href="" class="dropdown-toggle" data-toggle="dropdown" | ||
id="collection-menu-title" aria-haspopup="true" aria-expanded="false">Collections <span class="caret"></span> | ||
</a> | ||
<ul class="dropdown-menu"></ul> | ||
<ul class="dropdown-menu"> | ||
<li role=separator class="divider"></li> | ||
<li> | ||
<form class="form-inline"> | ||
<div class="form-group"> | ||
<label for=collection-name-{{&cid}} class="sr-only"> | ||
Name | ||
</label> | ||
<input | ||
type=text | ||
id=collection-name-{{&cid}} | ||
placeholder="Name" | ||
class="form-control" | ||
> | ||
</div> | ||
<button type=submit class="btn btn-primary btn-sm" aria-label="Create"> | ||
<span class="glyphicon glyphicon-plus" aria-hidden=true></span> | ||
</button> | ||
</form> | ||
</li> | ||
</ul> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import _ from 'lodash'; | ||
import { View as BBView } from 'backbone'; | ||
import { CompositeView as FComposite, CollectionView } from 'backbone-fractal'; | ||
import { getAltClickMixin } from '@uu-cdh/backbone-util'; | ||
|
||
function mix(Base) { | ||
return Base.extend(_.extend(getAltClickMixin(), { | ||
constructor: function(options) { | ||
Base.call(this, options); | ||
this.enableAltClick(); | ||
}, | ||
|
||
remove: function() { | ||
this.$el.off('click'); | ||
return Base.prototype.remove.call(this); | ||
}, | ||
})); | ||
} | ||
|
||
/** | ||
* Common base classes for all of our views. | ||
* Among other things, they enable alt-click debugging. | ||
*/ | ||
|
||
/** @class */ | ||
export var View = mix(BBView); | ||
/** @class */ | ||
export var CompositeView = mix(FComposite); | ||
/** @class */ | ||
export var AggregateView = mix(CollectionView); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.