Commit 72094eaa authored by alexandre's avatar alexandre

styles and tags

parent d4f733af
......@@ -29,8 +29,7 @@ class Score(models.Model):
stage_set = models.TextField(blank=True)
duration = models.TextField(blank=True)
genre = models.TextField(blank=True)
tags = models.TextField(blank=True)
tags = TaggableManager()
tags = TaggableManager(blank=True)
mainline = JSONField(blank=True)
language = models.TextField(blank=True)
......
......@@ -54,7 +54,7 @@ class PermissionSerializer(serializers.Serializer):
class ScoreSerializer(TaggitSerializer, serializers.HyperlinkedModelSerializer):
id = serializers.ReadOnlyField()
tags = TagListSerializerField()
tags = TagListSerializerField(required=False)
permissions = PermissionSerializer(source="*", many=True)
is_editable = serializers.SerializerMethodField()
......
......@@ -1719,7 +1719,7 @@ ol {
.btn-filter {
color: var(--text-color);
border: none;
padding: .3em 1em .2em 1em;
padding: .3em .3em .3em .3em;
background: transparent;
margin-top: .15em;
}
......@@ -1825,6 +1825,8 @@ ol {
.scores__content { flex: 1; overflow: auto; }
.scores__heading { font-weight: bold; }
.scores__filters {
height: 100vh;
}
......
......@@ -1681,6 +1681,10 @@ window.W = window.W || {};
e.stopImmediatePropagation();
e.preventDefault();
// Cast tag value into a list
var tags = this.fieldVal('tags').trim();
tags = (tags == true) ? tags.split(/\s*,\s*/) : [];
var data = {
title: this.fieldVal('title'),
score_type: parseInt(this.fieldVal('score_type')),
......@@ -1690,7 +1694,7 @@ window.W = window.W || {};
effectif: this.getChildView('effectif').value(),
stage_set: this.fieldVal('stage_set'),
duration: this.fieldVal('duration'),
tags: this.fieldVal('tags').trim().split(/\s*,\s*/),
tags: tags,
language: this.fieldVal('language')
};
......@@ -2319,15 +2323,15 @@ window.W = window.W || {};
collection: this.collection
});
var myAppliedFiltersView = new W.AppliedFiltersView({
collection: this.collection
});
// var myAppliedFiltersView = new W.AppliedFiltersView({
// collection: this.collection
// });
var languageCollection = new W.ChoiceCollection([], {action: "language", syncWith: this.collection});
var languageChoiceListView = new W.ChoiceListView({collection: languageCollection, syncWith: this.collection, title: t('langue')});
var scoreTypeCollection = new W.ChoiceCollection([], {action: "score_type", syncWith: this.collection})
var scoreTypeChoiceListView = new W.ChoiceListView({collection: scoreTypeCollection, syncWith: this.collection, title: t('type de partition')})
var scoreTypeChoiceListView = new W.ChoiceListView({collection: scoreTypeCollection, syncWith: this.collection, title: t('type')})
var TagCollection = new W.ChoiceCollection([], {action: "tags", syncWith: this.collection})
var TagChoiceListView = new W.ChoiceListView({collection: TagCollection, syncWith: this.collection, title: t('tags')})
......@@ -2337,7 +2341,7 @@ window.W = window.W || {};
this.showChildView('languageFilter', languageChoiceListView);
this.showChildView('scoreTypeFilter', scoreTypeChoiceListView);
this.showChildView('tagFilter', TagChoiceListView);
this.showChildView('appliedFilters', myAppliedFiltersView);
// this.showChildView('appliedFilters', myAppliedFiltersView);
},
initialize: function() {
......@@ -2377,7 +2381,7 @@ window.W = window.W || {};
childViewContainer: 'ol',
template: _.template('<h1 class="scores__heading"><%- title %></h1><ol class="scores__list"></ol>'),
template: _.template('<% if (title) { %><h1 class="scores__heading"><%- title %></h1><% } %><ol class="scores__list"></ol>'),
// getTemplate() {
// if (this.collection.length == 0) {
......@@ -2395,7 +2399,7 @@ window.W = window.W || {};
initialize: function (options) {
this.listenTo(this.collection, 'sync', this.render);
this.title = options.title || 'untitled section';
this.title = options.title || null;
}
});
......@@ -2414,11 +2418,16 @@ window.W = window.W || {};
el: '#search-panel',
replaceElement: true
},
foo: {
el: '#foo',
replaceElement: true
}
},
onRender: function () {
document.title = 'Notation W';
var scoreCollection = new W.ScoreCollection([], {
// All the `state` and `queryParams` key value pairs are merged with
// the defaults too.
......@@ -2433,11 +2442,18 @@ window.W = window.W || {};
var myListView = new W.ScoreListFooView({
collection: scoreCollection,
title: "Partitions existantes"
// title: "Partitions existantes"
});
var mySearchPanelView = new W.SearchPanelView({collection: scoreCollection});
var myAppliedFiltersView = new W.AppliedFiltersView({
collection: scoreCollection
});
this.showChildView('foo', myAppliedFiltersView);
this.showChildView('list', myListView);
this.showChildView('panel', mySearchPanelView);
......@@ -2663,20 +2679,22 @@ window.W = window.W || {};
state: {
pageSize: 5,
sortKey: "updated_at",
order: -1
order: 1
}
});
collection2.queryParams.shared_with = true;
var view2 = new W.ScoreListFooView({
title: _("Mes partitions"),
collection: collection2,
title: _("Mes partitions"),
});
view2.collection.fetch({
success: (function () {
this.showChildView('user_scores', view);
success: (function (collection, response, options) {
if (collection.length) {
this.showChildView('user_scores', view2);
}
}).bind(this)
});
},
......
<% if (search) { %>
Résultats pour: <%- search %>
Résultats pour: <span class="btn-filter" data-filter="search" data-value="<% search %>"><span class="btn-filter__label"><%- ('terme') %></span>:<%- search %> [x]</span>
<% } %>
<% if (language) { %>
<span class="btn-filter" data-filter="language" data-value="<%- language %>"><span class="btn-filter__label"><%- ('Langue') %></span>:<%- language %> [x]</span>
<span class="btn-filter" data-filter="language" data-value="<%- language %>"><span class="btn-filter__label"><%- ('langue') %></span>:<%- language %> [x]</span>
<% } if (score_type) { %>
<span class="btn-filter" data-filter="score_type" data-value="<%- score_type %>"><span class="btn-filter__label"><%- ('Type de partition') %></span>:
<span class="btn-filter" data-filter="score_type" data-value="<%- score_type %>"><span class="btn-filter__label"><%- ('type') %></span>:
<% if (score_type === 1) { %>
<%- t('Transcription') %>
<%- t('transcription') %>
<% } else if (score_type === 2) { %>
<%- t('Prescription') %>
<%- t('prescription') %>
<% } else if (score_type === 3) { %>
<%- t('Traduction') %>
<%- t('traduction') %>
<% } %>
[x]
</span>
<% } if (tags) { %>
<span class="btn-filter" data-filter="tags" data-value="<%- tags %>"><span class="btn-filter__label"><%- ('Tags') %></span>:<%- tags %> [x]</span>
<span class="btn-filter" data-filter="tags" data-value="<%- tags %>"><span class="btn-filter__label"><%- ('tags') %></span>:<%- tags %> [x]</span>
<% } %>
<div class="scores__content content">
<h1 class="scores__heading"><%- t("Partitions existantes") %></h1>
<div id="foo"></div>
<div id="list"></div>
</div>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment