Commit 4fabf8d7 authored by alexandre's avatar alexandre

First set of changes

parent ab0e5ee2
...@@ -143,7 +143,7 @@ REST_FRAMEWORK = { ...@@ -143,7 +143,7 @@ REST_FRAMEWORK = {
# Django Compressor setup # Django Compressor setup
COMPRESS_PRECOMPILERS = ( COMPRESS_PRECOMPILERS = (
('text/css', './node_modules/.bin/postcss {infile} --use postcss-cssnext --use postcss-import'), ('text/css', './node_modules/.bin/postcss {infile} --use postcss-cssnext --use postcss-import --use postcss-selector-matches'),
) )
COMPRESS_ENABLED = False COMPRESS_ENABLED = False
...@@ -159,11 +159,11 @@ ACCOUNT_EMAIL_CONFIRMATION_AUTHENTICATED_REDIRECT_URL = "/compte" ...@@ -159,11 +159,11 @@ ACCOUNT_EMAIL_CONFIRMATION_AUTHENTICATED_REDIRECT_URL = "/compte"
CKEDITOR_CONFIGS = { CKEDITOR_CONFIGS = {
'default': { 'default': {
'extraPlugins': ','.join([ 'extraPlugins': ','.join([
'codesnippet', 'codesnippet', 'detail',
]), ]),
'toolbar': 'Custom', 'toolbar': 'Custom',
'toolbar_Custom': [ 'toolbar_Custom': [
['Format'], ['Format', 'Detail'],
# ['Pull-out', 'Sidebar', 'Footer'], # ['Pull-out', 'Sidebar', 'Footer'],
['Bold', 'Italic', '-', 'Subscript', 'Superscript'], ['Bold', 'Italic', '-', 'Subscript', 'Superscript'],
['CodeSnippet'], ['CodeSnippet'],
......
...@@ -4,11 +4,11 @@ ...@@ -4,11 +4,11 @@
<head> <head>
<title>{{ flatpage.title }}</title> <title>{{ flatpage.title }}</title>
<link rel="stylesheet" href="{% static 'playground/vendors/reset.css' %}"> <link rel="stylesheet" href="{% static 'playground/vendors/reset.css' %}">
<link rel="stylesheet" type="text/css" href="{% static 'playground/css/styles.css' %}">
{% compress css %} {% compress css %}
<link rel="stylesheet" type="text/css" href="{% static 'playground/css/styles.css' %}">
{% endcompress %} {% endcompress %}
</head> </head>
<body class="help__content"> <body class="help__content content">
{% load flatpages %} {% load flatpages %}
{% get_flatpages as flatpages %} {% get_flatpages as flatpages %}
<ul> <ul>
......
Copyright (c) 2018 Ayhan Akilli
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is furnished
to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
# Details Widget
This widget handles details elements (`<details>` and `<summary>`). No configuration necessary.
## Example
You can see this plugin in action @ https://akilli.github.io/rte/ck4/
'use strict';
(function (CKEDITOR) {
CKEDITOR.plugins.setLang('detail', 'de', {
title: 'Details'
});
})(CKEDITOR);
'use strict';
(function (CKEDITOR) {
CKEDITOR.plugins.setLang('detail', 'en', {
title: 'Details'
});
})(CKEDITOR);
'use strict';
(function (CKEDITOR) {
CKEDITOR.dtd['$editable']['summary'] = 1;
CKEDITOR.plugins.add('detail', {
requires: 'widget',
icons: 'detail',
hidpi: true,
lang: 'de,en',
init: function (editor) {
editor.widgets.add('detail', {
button: editor.lang.detail.title,
template: '<details><summary>Summary</summary><div class="details-content"></div></details>',
editables: {
summary: {
selector: 'summary',
allowedContent: {}
},
content: {
selector: '.details-content'
}
},
allowedContent: 'details summary',
requiredContent: 'details; summary',
upcast: function (el) {
if (el.name !== 'details') {
return false;
}
var summary = el.getFirst('summary');
var content = new CKEDITOR.htmlParser.element('div', {'class': 'details-content'});
if (!!summary && summary.children.length > 0 && summary.children[0].type === CKEDITOR.NODE_ELEMENT) {
summary.setHtml(summary.children[0].getHtml());
} else if (!!summary && summary.children.length > 0 && summary.children[0].type === CKEDITOR.NODE_TEXT) {
summary.setHtml(summary.children[0].value);
} else if (!!summary) {
summary.setHtml('Summary');
} else {
summary = new CKEDITOR.htmlParser.element('summary');
summary.setHtml('Summary');
el.add(summary, 0);
}
el.add(content, 1);
if (el.children.length > 2) {
content.children = el.children.slice(2);
el.children = el.children.slice(0, 2);
}
return true;
},
downcast: function (el) {
el.attributes = [];
el.children = el.children.slice(0, 1);
el.setHtml(el.getHtml() + this.editables.content.getData());
},
init: function () {
var summary = this.element.getChild(0);
summary.on('keyup', function (ev) {
if (ev.data['$'].keyCode === 32) {
ev.data['$'].preventDefault();
editor.insertText(' ');
}
});
}
});
}
});
})(CKEDITOR);
...@@ -132,8 +132,7 @@ textarea { ...@@ -132,8 +132,7 @@ textarea {
button, button,
input { input {
font-family: 'GothicA1', sans-serif; font-family: 'GothicA1', sans-serif;
/* font-size: 19px; */ font-size: inherit;
/* font-size: 90%; */
line-height: 21px; line-height: 21px;
font-weight: 500; font-weight: 500;
} }
...@@ -225,6 +224,7 @@ section.hidden { display: none; } ...@@ -225,6 +224,7 @@ section.hidden { display: none; }
.modal__title { margin-bottom: 1em; } .modal__title { margin-bottom: 1em; }
/* TODO: Bemize */
.modal label { display: none; } .modal label { display: none; }
.modal input[type="email"], .modal input[type="email"],
...@@ -274,15 +274,13 @@ section.hidden { display: none; } ...@@ -274,15 +274,13 @@ section.hidden { display: none; }
/* Main menu (sidebar) /* Main menu (sidebar)
========================================================================== */ ========================================================================== */
.main-header .content {
/* width: 300px; */
padding: 30px;
}
.main-header { width: 300px; } .main-header { width: 300px; }
.main-header.is-collapsed { margin-left: -300px; } .main-header.is-collapsed { margin-left: -300px; }
.logo { margin: 21px 0 42px 0; } .main-header__logo {
margin-top: 21px;
margin-bottom: 42px;
}
.logo__name { .logo__name {
font-size: 3em; font-size: 3em;
...@@ -1097,7 +1095,7 @@ li .icon--tag { color: white } */ ...@@ -1097,7 +1095,7 @@ li .icon--tag { color: white } */
color: rgb(202, 027, 027); color: rgb(202, 027, 027);
} }
#create { margin-bottom: 1em;} /* #create { margin-top: 1em;} */
.create-form { display: none; } .create-form { display: none; }
#create:hover .create-form { display: flex; } #create:hover .create-form { display: flex; }
...@@ -1132,6 +1130,8 @@ li .icon--tag { color: white } */ ...@@ -1132,6 +1130,8 @@ li .icon--tag { color: white } */
border-bottom: 2px solid; border-bottom: 2px solid;
padding-bottom: 6px; padding-bottom: 6px;
/* margin-bottom: 18px; */ /* margin-bottom: 18px; */
flex: 1 1 100px;
width: 100px;
} }
.create-form input[type="text"]::placeholder { /* Most modern browsers support this now. */ .create-form input[type="text"]::placeholder { /* Most modern browsers support this now. */
...@@ -1147,28 +1147,31 @@ li .icon--tag { color: white } */ ...@@ -1147,28 +1147,31 @@ li .icon--tag { color: white } */
Help Help
========================================================================== */ ========================================================================== */
.page__help { width: 500px; }
.page__help.is-collapsed { margin-right: -500px; }
.help__frame { .help__frame {
overflow: auto; width: 100%;
width: 500px;
height: 100%; height: 100%;
transition: all .2s;
} }
.help { width: 500px; }
.help.is-collapsed { margin-right: -500px; }
.help__content { .help__content {
color: #173a42; color: #173a42;
background-color: white; background-color: white;
padding: 30px; font-size: 85%;
line-height: 1.35;
} }
.help__content h2 { margin-top: 28pt; text-align: center; margin-bottom: 14pt; } .help__content h2 { margin-top: 28pt; text-align: center; margin-bottom: 14pt; }
.help__content p + p { margin-top: 14pt; } .help__content :matches(p, ul, ol, pre) + :matches(p, ul, ol, pre) { margin-top: 14pt; }
.help__content :matches(ul, ol) { margin-left: 2em; text-indent: -.75em; }
.help__content li:before { content: "– "; } .help__content li:before { content: "– "; }
.help__content code { color: darkgrey; margin-left: 1.25em; font-size: 75%}
...@@ -1231,7 +1234,6 @@ li .icon--tag { color: white } */ ...@@ -1231,7 +1234,6 @@ li .icon--tag { color: white } */
.panel__toggle { .panel__toggle {
box-sizing: border-box; box-sizing: border-box;
line-height: 30px; line-height: 30px;
/* outline: 1px solid white; */
padding-right: 30px; padding-right: 30px;
position: absolute; position: absolute;
text-align: right; text-align: right;
...@@ -1292,6 +1294,31 @@ li .icon--tag { color: white } */ ...@@ -1292,6 +1294,31 @@ li .icon--tag { color: white } */
} }
.btn {
font-size: 85% !important;
color: var(--text-color);
border: none;
padding: .3em 1em .2em 1em;
background: transparent;
margin-top: .15em;
font-family: 'GothicA1', sans-serif;
font-size: inherit;
line-height: 21px;
font-weight: 500;
}
.btn:hover {
background-color: var(--background-color-button);
}
.search__form {
display: flex;
}
.search__textfield { width: 30px; flex: 1 1 30px;
}
.search__submit {
}
...@@ -2006,12 +2006,14 @@ window.W = window.W || {}; ...@@ -2006,12 +2006,14 @@ window.W = window.W || {};
template: '#search-template', template: '#search-template',
triggers: { triggers: {
'click .search': 'search', 'submit form': 'search'
}, },
onSearch: function (view, event) { onSearch: function (view, event) {
this.collection.queryParams.search = this.$el.find('.search-input').val(); this.collection.queryParams.search = this.$el.find('.search-input').val();
this.collection.fetch(); this.collection.fetch();
return false;
}, },
}); });
...@@ -2466,7 +2468,8 @@ window.W = window.W || {}; ...@@ -2466,7 +2468,8 @@ window.W = window.W || {};
template: '#home-template', template: '#home-template',
regions: { regions: {
latest_updated: '#latest_updated' latest_updated: '#latest_updated',
user_scores: '#user_scores'
}, },
attributes: { attributes: {
...@@ -2479,9 +2482,9 @@ window.W = window.W || {}; ...@@ -2479,9 +2482,9 @@ window.W = window.W || {};
document.title = 'Notation W'; document.title = 'Notation W';
var scoreCollection = new W.ScoreCollection([], { var scoreCollection = new W.ScoreCollection([], {
url: '/test', // url: '/test',
state: { state: {
// pageSize: 10, pageSize: 5,
// firstPage: 1, // firstPage: 1,
// currentPage: 1, // currentPage: 1,
sortKey: "updated_at", sortKey: "updated_at",
...@@ -2501,6 +2504,31 @@ window.W = window.W || {}; ...@@ -2501,6 +2504,31 @@ window.W = window.W || {};
that.showChildView('latest_updated', myListView); that.showChildView('latest_updated', myListView);
} }
}); });
var scoreCollection2 = new W.ScoreCollection([], {
// All the `state` and `queryParams` key value pairs are merged with
// the defaults too.
state: {
pageSize: 5,
firstPage: 1,
currentPage: 1,
sortKey: "updated_at",
order: -1
}
});
scoreCollection2.queryParams.shared_with=true;
var myListView2 = new Backgrid.Grid({
columns: columns,
collection: scoreCollection2
});
myListView2.collection.fetch({
success: function () {
that.showChildView('user_scores', myListView2);
}
});
} }
}); });
...@@ -2509,7 +2537,7 @@ window.W = window.W || {}; ...@@ -2509,7 +2537,7 @@ window.W = window.W || {};
template: '#help-template', template: '#help-template',
attributes: { attributes: {
class: 'help is-collapsed panel panel--right' class: 'page__help help is-collapsed panel panel--right'
}, },
ui: { ui: {
...@@ -2534,10 +2562,10 @@ window.W = window.W || {}; ...@@ -2534,10 +2562,10 @@ window.W = window.W || {};
ui: { ui: {
'toggle': '.js-toggle', 'toggle': '.js-toggle',
'login': '.btn-login', 'login': '.js-login',
'logout': '.btn-logout', 'logout': '.js-logout',
'register': '.btn-register', 'register': '.js-register',
'lang': '.btn-lang', 'lang': '.js-lang',
}, },
triggers: { triggers: {
......
...@@ -11,8 +11,9 @@ ...@@ -11,8 +11,9 @@
<link rel="stylesheet" href="{% static 'playground/vendors/backgrid.css' %}"> <link rel="stylesheet" href="{% static 'playground/vendors/backgrid.css' %}">
<link rel="stylesheet" href="{% static 'playground/vendors/backgrid-paginator.min.css' %}"> <link rel="stylesheet" href="{% static 'playground/vendors/backgrid-paginator.min.css' %}">
<link rel="stylesheet" href="{% static 'playground/vendors/backbone.autocomplete.css' %}"> <link rel="stylesheet" href="{% static 'playground/vendors/backbone.autocomplete.css' %}">
<link rel="stylesheet" type="text/css" href="{% static 'playground/css/styles.css' %}">
{% compress css %} {% compress css %}
<link rel="stylesheet" type="text/css" href="{% static 'playground/css/styles.css' %}">
{% endcompress %} {% endcompress %}
<script id="about-template" type="text/template"> <script id="about-template" type="text/template">
......
<section> <a href="#"><%- t('Créer une nouvelle partition') %></a>
<h1><%- t('Créer une nouvelle partition') %></h1>
<form class="create-form" action="" method="post"> <form class="create-form" action="" method="post">
<input type="text" name="title" placeholder="<%- t('Titre') %>" required> <input type="text" name="title" placeholder="<%- t('Titre') %>" required>
<input type="submit" name="submit" value="<%- t('Créer') %>"> <input type="submit" name="submit" value="<%- t('Créer') %>">
</form> </form>
</section>
<div class="panel__toggle js-toggle">menu</div> <div class="panel__toggle js-toggle">menu</div>
<div class="content"> <div class="content">
<nav> <nav class="main-header__user">
<% if (username) { %> <% if (username) { %>
<%- t('Bienvenue') %> <a href="/compte"><%- username %></a> <%- t('Bienvenue') %> <a href="/compte"><%- username %></a>
<% } %> <% } %>
<ul> <ul>
<% if (username) { %> <% if (username) { %>
<li><a href="#" class="btn-logout"><%- t('Se déconnecter') %></a></li> <li><a href="#" class="js-logout"><%- t('Se déconnecter') %></a></li>
<% } else { %> <% } else { %>
<li><a href="#" class="btn-login"><%- t('Se connecter') %></a> <a href="#" class="btn-register"><%- t('S’inscrire') %></a></li> <li><a href="#" class="js-login"><%- t('Se connecter') %></a> <a href="#" class="js-register"><%- t('S’inscrire') %></a></li>
<% } %> <% } %>
<!-- <li><a href="#" class="btn-lang" data-lang="en">en</a> <a href="#" class="btn-lang" data-lang="fr">fr</a></li> -->
</ul> </ul>
</nav> </nav>
<div class="logo"> <div class="main-header__logo logo">
<h1 class="logo__name"><a href="/" class="logo_link">Organon</a></h1> <h1 class="logo__name"><a href="/" class="logo_link">Organon</a></h1>
<p class="logo__tagline"><%- t('Un logiciel pour noter l’action performée, développé par W.') %></p> <p class="logo__tagline"><%- t('Un logiciel pour noter l’action performée.') %></p>
</div> </div>
<div id="create"></div> <nav class="main-header__menu">
<nav>
<ul> <ul>
<li><a href="/apropos/"><%- t('À propos') %></a></li> <li><a href="/apropos/"><%- t('La notation W') %></a></li>
<li><a href="/partitions/"><%- t('Partitions') %></a></li> <li><a href="/partitions/"><%- t('Repertoire de partitions') %></a></li>
<li id="create"></li>
<li><a href="#" class="js-lang" data-lang="en">en</a> <a href="#" class="js-lang" data-lang="fr">fr</a></li>
<li><a href="#"><%- t('Crédits') %></a></li>
<li><a href="#"><%- t('Site W') %></a></li>
</ul> </ul>
</nav> </nav>
</div> </div>
<div class="body-text body-text--about"> <div class="body-text body-text--about">
<p>La notation W est un système de notation de l’action performée. La notation W permet aussi bien de transcrire une performance qui a déjà eu lieu (dans le cas d’une passation de rôle, par exemple, ou de la constitution d’un répertoire) que d’élaborer la partition générale d’un spectacle à venir. Dans tous les cas, elle se veut un instrument de partage et de clarification des enjeux d’un travail collectif, matérialisés et objectivés par la partition.</p> <p>La notation W est un système de notation de l’action performée. La notation W permet aussi bien de transcrire une performance qui a déjà eu lieu (dans le cas d’une passation de rôle, par exemple, ou de la constitution d’un répertoire) que d’élaborer la partition générale d’un spectacle à venir. Dans tous les cas, elle se veut un instrument de partage et de clarification des enjeux d’un travail collectif, matérialisés et objectivés par la partition.</p>
<p><a href="/apropos/"><%- t('En savoir plus') %></a></p> <p><a href="/partitions/"><%- t('Répertoire des partitions existantes') %></a></p>
</div> </div>
<section> <section>
<h1><%- t('Sélection de partitions') %></h1> <h1><%- t('Le choix de W') %></h1>
<div id="latest_updated"></div> <div id="latest_updated"></div>
<h1><%- t('Mes partitions') %></h1>
<div id="user_scores"></div>
</section> </section>
...@@ -6,12 +6,7 @@ ...@@ -6,12 +6,7 @@
<div class="filters"> <div class="filters">
<div class="filters__filter"> <div class="filters__filter">
<p><%- t('langue') %></p> <!-- <p><%- t('type de partition') %></p> -->
<div id="language-filter"></div>
</div>
<div class="filters__filter">
<p><%- t('type de partition') %></p>
<div id="score-type-filter"></div> <div id="score-type-filter"></div>
</div> </div>
...@@ -19,6 +14,11 @@ ...@@ -19,6 +14,11 @@
<p><%- t('tags') %></p> <p><%- t('tags') %></p>
<div id="tag-filter"></div> <div id="tag-filter"></div>
</div> </div>
<div class="filters__filter">
<!-- <p><%- t('langue') %></p> -->
<div id="language-filter"></div>
</div>
</div> </div>
</div> </div>
<input type="text" placeholder="<%- t('Titre') %>" class="search-input"> <form class="search__form" action="search_submit" method="get" accept-charset="utf-8">
<button class="search"><%- t('rechercher') %></button> <input class="search__textfield search-input" type="text" placeholder="<%- t('Titre ou auteur') %>">
<br> <button class="search"><%- t('rechercher') %></button>
<br> </form>
...@@ -110,7 +110,7 @@ class ScoreViewSet(viewsets.ModelViewSet): ...@@ -110,7 +110,7 @@ class ScoreViewSet(viewsets.ModelViewSet):
filter_backends = (DjangoFilterBackend, OrderingFilter, SearchFilter, DjangoObjectPermissionsFilter) filter_backends = (DjangoFilterBackend, OrderingFilter, SearchFilter, DjangoObjectPermissionsFilter)
authentication_classes = (ScoreAuthentication,) authentication_classes = (ScoreAuthentication,)
permission_classes = (ScorePermissions,) permission_classes = (ScorePermissions,)
search_fields = ('title',) search_fields = ('title', 'score_author', 'performance_author')
# filter_fields = ('title', 'score_type') # filter_fields = ('title', 'score_type')
filter_class = ScoreFilter filter_class = ScoreFilter
...@@ -153,7 +153,7 @@ class ScoreViewSet(viewsets.ModelViewSet): ...@@ -153,7 +153,7 @@ class ScoreViewSet(viewsets.ModelViewSet):
is_featured = self.request.query_params.get('is_featured', None) is_featured = self.request.query_params.get('is_featured', None)
if is_featured is not None: if is_featured is not None:
ids = FeaturedScore.objects.all().values_list("score__id", flat=True) ids = FeaturedScore.objects.all().order_by('-order').values_list("score__id", flat=True)
queryset = queryset.filter(id__in=ids) queryset = queryset.filter(id__in=ids)
return queryset return queryset
......
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