Commit 57b935ed authored by gijs's avatar gijs

Merge branch 'master' of gitlab.constantvzw.org:osp/work.w

parents b8ddfedb 2b2d3696
......@@ -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)
......
......@@ -52,11 +52,11 @@ class PermissionSerializer(serializers.Serializer):
list_serializer_class = PermissionListSerializer
class ScoreSerializer(TaggitSerializer, serializers.HyperlinkedModelSerializer):
id = serializers.ReadOnlyField()
tags = TagListSerializerField()
tags = TagListSerializerField(required=False)
permissions = PermissionSerializer(source="*", many=True)
is_editable = serializers.SerializerMethodField()
class Meta:
model = Score
......@@ -68,6 +68,9 @@ class ScoreSerializer(TaggitSerializer, serializers.HyperlinkedModelSerializer):
assign_perm("view_score", self.context['request'].user, instance)
return instance
def get_is_editable(self, obj):
return self.context['request'].user.has_perm('change_score', obj)
def update(self, instance, validated_data):
instance = super(ScoreSerializer, self).update(instance, validated_data)
......
......@@ -12,8 +12,8 @@
--color-01: rgb(73,53,246);/*#353df6;*/ /* rgb(235, 53, 1); */
--color-02: rgb(0,144,136);/*#006ae2;*/ /* rgb(255, 109, 35); */
--color-03: rgb(91,184,8);/*#008890;*/ /* rgb(160, 168, 13); */
--color-04: rgb(255,136,3);/*#159e2b;*/ /* rgb( 74, 158, 21); */
--color-04: rgb(91,184,8);/*#008890;*/ /* rgb(160, 168, 13); */
--color-03: rgb(255,136,3);/*#159e2b;*/ /* rgb( 74, 158, 21); */
--color-05: rgb(226,47,32);/*#63b808;*/ /* rgb( 0, 136, 144); */
--color-06: rgb(176,38,188);/*#a5ae07;*/ /* rgb( 43, 95, 227); */
--color-07: rgb(0,106,226);/*#ff8803;*/ /* rgb(124, 59, 225); */
......@@ -23,8 +23,8 @@
--color-11: rgb(200,41,107);/*#b026bc;*/
--color-12: rgb(171,29,255);/*#871dff;*/
--row-indent: 50px;
--axis-line-offset: 25px;
--row-indent: 70px;
--axis-line-offset: 35px;
--axis-line-width: 2px;
--axis-bottom-padding: 1em;
--axis-tag-size: 1.8em;
......@@ -70,7 +70,7 @@
@font-face {
font-family: 'GothicA1';
src: url("../fonts/GothicA1/GothicA1-Medium.ttf");
font-weight: normal;
font-weight: 500;
}
@font-face {
......@@ -104,7 +104,12 @@ body {
a {
color: inherit;
text-decoration-skip: ink;
text-decoration: none;
}
a:hover {
color: var(--background-color);
filter: brightness(200%);
}
sub,
......@@ -299,13 +304,20 @@ section.hidden { display: none; }
========================================================================== */
.main-header { width: 300px; }
.main-header.is-collapsed { margin-left: -300px; }
.main-header__logo {
margin-top: 21px;
margin-bottom: 42px;
.main-header__content {
display: flex;
flex-direction: column;
min-height: 100%;
box-sizing: border-box;
}
.main-header__create { flex-grow: 1; }
.main-header__logo { margin-bottom: 42px; }
.logo__name {
font-size: 3em;
line-height: 1em;
......@@ -314,6 +326,51 @@ section.hidden { display: none; }
.logo_link { text-decoration: none; }
.panel-form { display: flex; }
.panel-form__textfield,
.panel-form__submit {
padding: 0;
margin: 0;
font-size: inherit;
font-family: inherit;
background: none;
border: none;
color: inherit;
}
.panel-form__submit {
margin-left: 10px;
border: 2px solid white;
padding: 0 4px;
background-color: white;
color: #183a42;
}
.panel-form__submit:hover {
color: white;
background-color: #183a42;
cursor: pointer;
}
.panel-form__textfield {
border-bottom: 2px solid;
padding-bottom: 6px;
flex: 1 1 100px;
min-width: 0px; /* Fixes Firefox issue with flex-box */
}
.panel-form__textfield::placeholder { /* Most modern browsers support this now. */
color: #173a42;
filter: brightness(200%);
}
.create__form--inactive { display: none; }
.menu--inline .menu__item {
display: inline;
margin-right: 1em;
}
......@@ -369,7 +426,7 @@ section.hidden { display: none; }
#score article {
padding: 30px;
/* padding: 0 30px; */
flex: 1 0;
overflow: auto;
}
......@@ -431,37 +488,37 @@ section.hidden { display: none; }
top: calc(30px + 1.25em);
}
.read-only .score-edit {
display: none;
}
#sidebar {
position: relative;
position: sticky;
top: 0;
left: 0;
width: 100%;
font-size: 85%;
/* background: linear-gradient(to bottom, var(--background-color) 90%, transparent 100%); */
background: var(--background-color);
/* background-color: red; */
z-index: 999;
width: 100%;
display: flex;
padding: 30px;
box-sizing: border-box;
height: 5.6rem;
}
#score h1 {
font-size: 2em;
line-height: 1em;
}
/*
#sidebar h1#title:after {
font-size: 50%;
display: inline-block;
padding-left: 10px;
content: "◀";
position: relative;
top: -3px;
}
#sidebar[data-expanded="true"] h1#title:after { content: "▼"; } */
flex: 1;
.score-meta dt {
margin-top: .5em;
font-weight: bold;
break-after: avoid;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.score-meta dd {
margin-left: 0em;
break-before: avoid;
}
/*
#permissions { display: none; }
......@@ -486,12 +543,19 @@ section.hidden { display: none; }
/* Score actions
========================================================================== */
.score-actions {
position: absolute;
top: 1.25em;
right: 0;
z-index: 3;
display: inline-block;
}
.read-only .score-actions { display: none; }
/* .score-actions { */
/* position: absolute; */
/* top: 1.25em; */
/* right: 0; */
/* z-index: 3; */
/* } */
/*
.score-actions button {
background: none;
......@@ -546,7 +610,7 @@ section.hidden { display: none; }
/* Score main area
========================================================================== */
#main-area { position: relative; }
#main-area { position: relative; padding: 0 30px; box-sizing: border-box; }
......@@ -557,15 +621,17 @@ section.hidden { display: none; }
.expand-level {
position: sticky;
top: 0.5em;
top: 5.6rem;
margin-bottom: 1em;
white-space: nowrap;
z-index: 1;
line-height: 0;
}
.expand-level-option {
display: inline-block;
width: var(--row-indent);
height: .75em;
height: 2em;
position: relative;
}
......@@ -864,7 +930,13 @@ ol ol::after {
margin-left: .5em;
}
.icon--handle:before { content: "\f80e"; }
/* [1] Makes sure we load the font with the glyphs */
.icon--handle:before {
/* font-weight: 500; /1* [1] *1/ */
font-weight: lighter;
content: "\f80e";
/* content: "\2593"; */
}
.axis-row .icon--handle {
cursor: ns-resize; /* move; */
......@@ -967,23 +1039,25 @@ ol ol > li:first-child {
padding-top: 4px;
border-radius: calc(var(--axis-tag-size) / 2);
position: sticky;
top: .25em;
top: 5.75em;
text-align: center;
z-index: 1;
margin-left: -50%;
font-weight: lighter;
}
[data-tag=""] > .metadata .tag:before { content: "\f8a6"; }
[data-tag=""] > .metadata .tag:before,
[data-tag=">"] > .metadata .tag:before { content: "\f8a6"; }
[data-tag="|"] > .metadata .tag:before { content: "\f8a7"; }
[data-tag="//"] > .metadata .tag:before { content: "\f809"; }
[data-tag=">"] > .metadata .tag:before { content: "\f8a9"; }
[data-tag="≥"] > .metadata .tag:before { content: "\f8a9"; }
[data-tag="||"] > .metadata .tag:before { content: "\f8a8"; }
[data-tag="//"] > .metadata .tag:before { content: "\f89a"; }
[data-tag="≥"] > .metadata .tag:before { content: "\f8a9"; }
[data-alternative] > .metadata .alternative {
display: inline-block;
position: sticky;
top: 3em;
top: 10.2em;
right: calc(100% - .75em);
font-size: var(--font-size--small);
line-height: 1.5;
......@@ -1037,6 +1111,7 @@ li + li .alt-symbol { display: none; }
/* .view_tag { color: black; } */
/* is it still used? */
.icon--tag {
text-align: center;
background-color: var(--row-color);
......@@ -1218,6 +1293,7 @@ li + li .alt-symbol { display: none; }
}
.axis-row:hover .axis-row--actions { display: inline-block; }
.read-only .axis-row:hover .axis-row--actions { display: none; }
.axis-actions [name="toggle"] {
position: absolute;
......@@ -1527,49 +1603,6 @@ ol {
color: rgb(202, 027, 027);
}
/* #create { margin-top: 1em;} */
.create-form { display: none; }
#create:hover .create-form { display: flex; }
.create-form input[type="text"],
.create-form input[type="submit"] {
padding: 0;
margin: 0;
font-size: inherit;
font-family: inherit;
background: none;
border: none;
color: inherit;
}
.create-form input[type="submit"] {
/* text-decoration: underline; */
margin-left: 10px;
border: 2px solid white;
padding: 0 4px;
background-color: white;
color: #183a42;
}
.create-form input[type="submit"]:hover {
color: white;
background-color: #183a42;
cursor: pointer;
}
.create-form input[type="text"] {
border-bottom: 2px solid;
padding-bottom: 6px;
/* margin-bottom: 18px; */
flex: 1 1 100px;
width: 100px;
}
.create-form input[type="text"]::placeholder { /* Most modern browsers support this now. */
color: #173a42;
filter: brightness(200%);
}
......@@ -1638,7 +1671,7 @@ ol {
}
.help__inner h3,
.help__inner .help__inner { margin-left: 3em; }
.help__inner .help__inner { margin-left: 1.5em; }
.help__toc {
/* position: sticky; */
......@@ -1686,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;
}
......@@ -1705,6 +1738,23 @@ ol {
color: var(--button-color-disabled);
}
.filter__item {
display: inline-block;
/* background-color: #24788a; */
/* padding: 4px; */
margin-right: 14px;
}
.filter__item:hover {
cursor: pointer;
}
#tag-filter .filter__item + .filter__item:before {
content: ", ";
}
.search__heading { font-weight: bold; }
......@@ -1771,25 +1821,40 @@ ol {
padding: 30px;
}
.score-list { display: flex; }
.scores { display: flex; overflow-x: hidden; }
.scores__content { flex: 1; overflow: auto; }
.scores__heading { font-weight: bold; }
.scores { flex: 1; overflow: auto; }
.score-filters {
.scores__filters {
height: 100vh;
}
.score-filters .content {
.scores__filters .content {
width: 300px;
transition: all .2s;
}
.score-filters.is-collapsed .content {
.scores__filters.is-collapsed .content {
margin-right: -360px;
}
.scores__search {
margin-bottom: 28px;
}
.scores__filter {
margin-bottom: 14px;
}
.filter__heading {
font-weight: bold;
}
.btn {
font-size: 85% !important;
......@@ -1809,25 +1874,58 @@ ol {
}
.scores__item {
margin-top: 10.5px;
}
.item__title {
font-weight: bold;
}
.search__form {
display: flex;
.item__meta {
font-size: 85%;
}
.search__textfield { width: 30px; flex: 1 1 30px;
.js-help {
text-decoration: underline dotted;
}
.search__submit {
/* inline metadata */
/* publié le */
/* modifié le */
.score-meta__term {
display: inline-block;
margin-top: .5em;
font-weight: bold;
break-after: avoid;
}
.score-list-foo li + li {
margin-top: 10.5px;
.score-meta__term::after {
content: " :";
}
.score-list-foo__meta {
font-size: 85%;
.score-meta dd {
display: inline;
margin: 0;
margin-left: 0em;
break-before: avoid;
}
.js-help {
text-decoration: underline dotted;
.score-meta dd:after{
display: block;
content: '';
}
.score-meta__term--inline { font-weight: inherit; }
.score-meta__term--inline::after { content: " "; }
.score-meta__tag-item { display: inline; margin-right: 1em; }
#permissions,
.score-meta + .score-meta {
border-top: 2px solid white;
margin-top: 1em;
padding-top: 1em;
}
......@@ -6,23 +6,33 @@ window.W = window.W || {};
(function(undefined) {
'use strict';
function is_external_link(el) {
return ('external' in el.dataset);
}
W.ScoreApp = new Marionette.Application({
W.ScoreApp = Marionette.Application.extend({
region: 'body',
triggers: {
keydown: 'keydown'
},
channelName:'user',
onStart: function(options) {
var userAuthModel = new W.UserAuthModel();
var baseView = new W.BaseView({model: userAuthModel});
var channel = this.getChannel();
var radio = this.getChannel();
this.model = new W.UserAuthModel();
// this.listenTo(this.model, 'change', function() { radio.trigger('change', this.model); });
// this.listenTo(this.model, 'change', function() {
// var view = this.getView();
// // console.log(view);
// // view.destroy();
// // var baseView = new W.BaseView({model: this.model});
// // this.showView(baseView);
// });
var baseView = new W.BaseView({model: this.model});
this.showView(baseView);
userAuthModel.fetch();
baseView.model.fetch();
// hide modals when typing escape
$(document).on("keydown", function(event) {
if (event.keyCode == 27) {
......@@ -34,7 +44,7 @@ window.W = window.W || {};
$(document).on("click", "a", function(e) {
// Do not interfere with Backbone Paginator.
if (! e.isDefaultPrevented() && !is_external_link(e.target)) {
if (! e.isDefaultPrevented() && ! W.utils.is_external_link(e.target)) {
e.preventDefault(); // This is important
var href = $(e.currentTarget).attr('href');
......
;
window.W = window.W || {};
(function (undefined) {
'use strict';
W.ToggableBehavior = Marionette.Behavior.extend({
ui: {
'toggle': '.panel__toggle',
},
triggers: {
'click @ui.toggle': 'toggle',
},
onShow: function () {
this.$el.removeClass('is-collapsed');
},
onHide: function () {
// console.log("hiding");
this.$el.addClass('is-collapsed');
},
onToggle: function () {
this.$el.toggleClass('is-collapsed');
},
});
W.ModalBehavior = Marionette.Behavior.extend({
ui: {
'close': '.btn-close',
'submit': '.btn-submit',
'register': '.js-register',
},
triggers: {
'click @ui.close': 'hide:modal',
'click @ui.submit': 'submit',
'click @ui.register': 'show:register',
},
});
})();
......@@ -8,6 +8,8 @@ window.W = window.W || {};
W.ScoreController = Marionette.MnObject.extend({
home: function () {
document.title = 'Organon';
var baseView = this.getOption('application').getView();
var view = new W.HomeView();
baseView.showChildView('main', view);
......@@ -17,6 +19,8 @@ window.W = window.W || {};
about: function () {
document.title = 'Organon: La notation W';
var baseView = this.getOption('application').getView();
var view = new W.AboutView();
baseView.showChildView('main', view);
......@@ -25,6 +29,8 @@ window.W = window.W || {};
userList: function () {
document.title = 'Organon: liste des utilisateurs';
var baseView = this.getOption('application').getView();
var view = new W.UserListView();
baseView.showChildView('main', view);
......@@ -34,6 +40,8 @@ window.W = window.W || {};
userDetail: function () {
document.title = 'Organon: liste des partitions de l\'utilisateur';
var baseView = this.getOption('application').getView();
var view = new W.UserDetailView();
baseView.showChildView('main', view);
......@@ -43,16 +51,20 @@ window.W = window.W || {};
scoreList: function () {
document.title = 'Organon: liste des partitions';
var baseView = this.getOption('application').getView();
var view = new W.ScoreListView();
baseView.showChildView('main', view);
baseView.getChildView('help').triggerMethod("hide");
baseView.getChildView('header').triggerMethod("hide");
// baseView.getChildView('header').triggerMethod("show");
},
scoreDetail: function (id) {
document.title = 'Organon: partition';
var baseView = this.getOption('application').getView();
// Backbone relational refuse to instantiate more than one model
......
......@@ -32,5 +32,6 @@ window.W = window.W || {};
W.config.lang = W.utils.getUserLanguage();
var scoreApp = W.ScoreApp.start();
var scoreApp = new W.ScoreApp();
scoreApp.start();
})();
......@@ -205,7 +205,6 @@ window.W = window.W || {};
// console.log(data);
return data;
},
});
......@@ -279,6 +278,16 @@ window.W = window.W || {};
return 1;
},
getEditable: function () {
var parent = this.get('parent');
if (parent && parent.getEditable) {
return parent.getEditable();
}
return this.get("score").get("is_editable");