diff --git a/bower.json b/bower.json index 6f7e3adde..1f9d474fb 100644 --- a/bower.json +++ b/bower.json @@ -7,15 +7,11 @@ "jquery.cookie": "~1.4.1", "bootstrap": "~3.3.1", "datatables-bootstrap3-plugin": "~0.2.0", - "angular": "~1.3.11", + "angular": "~1.3.13", "angular-ui-router": "~0.2.13", + "angular-gettext": "~2.0.2", "js-data-angular": "~2.1.0", "sockjs": "~0.3.4", - "jed": "~1.1.0" - }, - "overrides": { - "jed": { - "main": "jed.js" - } + "font-awesome-bower": "4.3.0" } } diff --git a/gulpfile.js b/gulpfile.js index 2cdd0723e..7a69a1ed4 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -16,6 +16,7 @@ var argv = require('yargs').argv, gulp = require('gulp'), concat = require('gulp-concat'), gulpif = require('gulp-if'), + gettext = require('gulp-angular-gettext'), mainBowerFiles = require('main-bower-files'), minifyCSS = require('gulp-minify-css'), path = require('path'), @@ -54,5 +55,24 @@ gulp.task('fonts', function() { .pipe(gulp.dest(path.join(output_directory, 'fonts'))); }); +// Extracts translatable strings using angular-gettext and saves them in file +// openslides/locale/angular-gettext/template-en.pot. +gulp.task('pot', function () { + return gulp.src(['openslides/*/static/templates/*/*.html', + 'openslides/*/static/js/*/*.js']) + .pipe(gettext.extract('template-en.pot', {})) + .pipe(gulp.dest('openslides/locale/angular-gettext/')); +}); + +// Compiles translation files (*.po) to *.json and saves them in the directory +// openslides/static/i18n/. +gulp.task('translations', function () { + return gulp.src('openslides/locale/angular-gettext/*.po') + .pipe(gettext.compile({ + format: 'json' + })) + .pipe(gulp.dest(path.join(output_directory, 'i18n'))); +}); + // Gulp default task. Runs all other tasks before. gulp.task('default', ['js', 'css', 'fonts'], function() {}); diff --git a/openslides/core/static/css/app.css b/openslides/core/static/css/app.css index ce7c324b3..64854327d 100644 --- a/openslides/core/static/css/app.css +++ b/openslides/core/static/css/app.css @@ -22,7 +22,14 @@ body { padding: 7px 20px 0; position: relative; } -#header .logo img { +.navbar-brand { + padding: 2px; + height: 40px; +} +.navbar-text { + margin-top: 9px; +} +#logo { height: 30px; padding-left: 3px; } @@ -46,6 +53,13 @@ h1 { margin: 0px 0 30px; padding-bottom: 9px; } +#submenu { + float: right; + font-size: 85%; + position: absolute; + top: 0; + right: 15px; +} a:hover { text-decoration: none; } @@ -118,6 +132,7 @@ tr.total td { .user_details label { font-weight: bold; margin: 10px 0 0 0; + display: block; } .user_details label:after { content: ":"; @@ -129,29 +144,11 @@ tr.total td { } /** Forms **/ -input, textarea { - width: 320px; -} -.small-form input { - width: 55px; -} -.normal-form input { - width: 320px; -} -textarea { - height: 100px; -} -.help-inline { - font-size: 11px; -} -.errorlist{ - margin: 0; -} -.errorlist li { - list-style: none outside none; -} -form .required label:after { - content: " *"; + +/* Fix the top position by using fa-icons + * in bootstrap's form elements with form-control-feedback */ +.has-feedback i.form-control-feedback { + top: 35px; } legend + .control-group { margin-top: 0px !important; diff --git a/openslides/core/static/js/app.js b/openslides/core/static/js/app.js index f8ef10063..1fe78a0bc 100644 --- a/openslides/core/static/js/app.js +++ b/openslides/core/static/js/app.js @@ -1,6 +1,7 @@ angular.module('OpenSlidesApp', [ 'ui.router', 'js-data', + 'gettext', 'OpenSlidesApp.core', 'OpenSlidesApp.agenda', 'OpenSlidesApp.assignments', diff --git a/openslides/core/static/js/core.js b/openslides/core/static/js/core.js index b4d13eb73..58d5d49db 100644 --- a/openslides/core/static/js/core.js +++ b/openslides/core/static/js/core.js @@ -115,16 +115,6 @@ angular.module('OpenSlidesApp.core', []) }); }) -.run(function($rootScope, i18n) { - // Puts the gettext methods into each scope. - // Uses the methods that are known by xgettext by default. - methods = ['gettext', 'dgettext', 'dcgettext', 'ngettext', 'dngettext', - 'pgettext', 'dpgettext']; - _.forEach(methods, function(method) { - $rootScope[method] = _.bind(i18n[method], i18n); - }); -}) - .run(function($rootScope, Config) { // Puts the config object into each scope. // TODO: maybe rootscope.config has to set before findAll() is finished @@ -164,25 +154,39 @@ angular.module('OpenSlidesApp.core', []) return Autoupdate; }) -.factory('i18n', function($http) { - // TODO: there is a bug(?) in jed. I had to call val_idx++; in line 285 - // TODO: make the language variable and changeable at runtime - var i18n = new Jed({ - 'domain': 'de', - 'locale_data': {'de': {"": {}}}, - }); // TODO: use promise here - $http.get('/static/i18n/de.json') - .success(function(data) { - // TODO: check data. - i18n.options.locale_data['de'] = data; - }); - return i18n; -}) - .factory('Config', function(DS) { return DS.defineResource({ name: 'config/config', idAttribute: 'key', endpoint: '/rest/config/config/' }); +}) + +.controller("LanguageCtrl", function ($scope, gettextCatalog) { + // controller to switch app language + // TODO: detect browser language for default language + gettextCatalog.setCurrentLanguage('en'); + //TODO: for debug only! (helps to find untranslated strings by adding "[MISSING]:") + gettextCatalog.debug = true; + $scope.switchLanguage = function (lang) { + gettextCatalog.setCurrentLanguage(lang); + if (lang != 'en') { + gettextCatalog.loadRemote("static/i18n/" + lang + ".json"); + } + } +}) + +.directive('osFocusMe', function ($timeout) { + return { + link: function (scope, element, attrs, model) { + $timeout(function () { + element[0].focus(); + }); + } + }; +}); + +// some general JavaScript functions used in all OpenSlides apps +$(function () { + $('[data-toggle="tooltip"]').tooltip({'placement': 'bottom'}) }); diff --git a/openslides/core/static/templates/dashboard.html b/openslides/core/static/templates/dashboard.html index 24c08a0ea..af2eeeb59 100644 --- a/openslides/core/static/templates/dashboard.html +++ b/openslides/core/static/templates/dashboard.html @@ -1,4 +1,6 @@

Dashboard

-Assignments -Agenda -User + diff --git a/openslides/core/static/templates/index.html b/openslides/core/static/templates/index.html index 10ae6ee69..093686ba0 100644 --- a/openslides/core/static/templates/index.html +++ b/openslides/core/static/templates/index.html @@ -3,109 +3,162 @@ - - - - - OpenSlides - - - - - - - - - - - + +
+
+ + +
+
+
+
+
+
+
+ +
+
+
- - - - - - - + + + + + diff --git a/openslides/locale/angular-gettext/de.po b/openslides/locale/angular-gettext/de.po new file mode 100644 index 000000000..6146267ff --- /dev/null +++ b/openslides/locale/angular-gettext/de.po @@ -0,0 +1,50 @@ +# Language file of OpenSlides used by transifex: +# https://www.transifex.com/projects/p/openslides/ +# Copyright (C) 2011–2013 by OpenSlides team, see AUTHORS. +# This file is distributed under the same license as the OpenSlides package. +# Translators: +# emanuel , 2013 +# Emanuel Schütze , 2013 +# Emanuel Schütze , 2013 +# emanuel , 2013 +# Emanuel Schütze , 2013 +# Emanuel Schütze , 2013-2015 +# Oskar Hahn , 2012 +# Norman Jäckel , 2013-2014 +# Norman Jäckel , 2013 +# Oskar Hahn , 2012-2013 +# Oskar Hahn , 2012 +msgid "" +msgstr "" +"Project-Id-Version: OpenSlides\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2015-01-16 14:24+0100\n" +"PO-Revision-Date: 2015-01-20 08:09+0000\n" +"Last-Translator: Emanuel Schütze \n" +"Language-Team: German (http://www.transifex.com/projects/p/openslides/language/de/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: de\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#: index.html:74 +msgid "English" +msgstr "Englisch" + +#: index.html:86 +msgid "French" +msgstr "Französisch" + +#: index.html:80 +msgid "German" +msgstr "Deutsch" + +#: user-list.html:26 +msgid "Groups" +msgstr "Gruppen" + +#: user-list.html:1 +msgid "Participants" +msgstr "Teilnehmer" + diff --git a/openslides/locale/angular-gettext/fr.po b/openslides/locale/angular-gettext/fr.po new file mode 100644 index 000000000..97ecc3643 --- /dev/null +++ b/openslides/locale/angular-gettext/fr.po @@ -0,0 +1,26 @@ +msgid "" +msgstr "" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Project-Id-Version: \n" +"Language: fr\n" + +#: index.html:74 +msgid "English" +msgstr "Anglais" + +#: index.html:86 +msgid "French" +msgstr "Français" + +#: index.html:80 +msgid "German" +msgstr "Allemand" + +#: user-list.html:26 +msgid "Groups" +msgstr "Groupe" + +#: user-list.html:1 +msgid "Participants" +msgstr "Participants" diff --git a/openslides/locale/angular-gettext/template-en.pot b/openslides/locale/angular-gettext/template-en.pot new file mode 100644 index 000000000..2f0134e19 --- /dev/null +++ b/openslides/locale/angular-gettext/template-en.pot @@ -0,0 +1,446 @@ +msgid "" +msgstr "" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Project-Id-Version: \n" + +#: users/static/templates/users/user-csv-import.html:15 +msgid "" +"'title, first name, last name, gender, email, group id, structure level,\n" +" committee, about me, comment, is active'" +msgstr "" + +#: users/static/templates/users/user-detail.html:18 +#: users/static/templates/users/user-form.html:60 +msgid "About me" +msgstr "" + +#: users/static/templates/users/group-list.html:32 +#: users/static/templates/users/user-list.html:94 +msgid "Actions" +msgstr "" + +#: users/static/templates/users/user-detail.html:23 +msgid "Administrative data" +msgstr "" + +#: core/static/js/jquery/datepicker-config.js:13 +msgid "Apr" +msgstr "" + +#: core/static/js/jquery/datepicker-config.js:7 +msgid "April" +msgstr "" + +#: users/static/templates/users/user-csv-import.html:20 +msgid "" +"At least first name or last name have to be filled in. All\n" +" other fields are optional and may be empty." +msgstr "" + +#: core/static/js/jquery/datepicker-config.js:14 +msgid "Aug" +msgstr "" + +#: core/static/js/jquery/datepicker-config.js:8 +msgid "August" +msgstr "" + +#: users/static/templates/users/group-detail.html:6 +#: users/static/templates/users/group-form.html:7 +#: users/static/templates/users/group-list.html:10 +#: users/static/templates/users/user-csv-import.html:6 +#: users/static/templates/users/user-detail.html:6 +#: users/static/templates/users/user-form.html:7 +msgid "Back to overview" +msgstr "" + +#: users/static/templates/users/user-csv-import.html:32 +msgid "CSV file:" +msgstr "" + +#: users/static/templates/users/group-form.html:26 +#: users/static/templates/users/user-csv-import.html:41 +#: users/static/templates/users/user-form.html:79 +msgid "Cancel" +msgstr "" + +#: core/static/js/jquery/datepicker-config.js:42 +msgid "Close" +msgstr "" + +#: users/static/templates/users/user-detail.html:26 +#: users/static/templates/users/user-form.html:56 +#: users/static/templates/users/user-list.html:87 +msgid "Comment" +msgstr "" + +#: core/static/js/jquery/datepicker-config.js:41 +msgid "Current time" +msgstr "" + +#: core/static/js/jquery/datepicker-config.js:15 +msgid "Dec" +msgstr "" + +#: core/static/js/jquery/datepicker-config.js:9 +msgid "December" +msgstr "" + +#: users/static/templates/users/user-csv-import.html:17 +msgid "Default groups" +msgstr "" + +#: users/static/templates/users/user-form.html:51 +msgid "Default password" +msgstr "" + +#: users/static/templates/users/user-csv-import.html:18 +msgid "Delegate" +msgstr "" + +#: users/static/templates/users/group-list.html:51 +#: users/static/templates/users/user-list.html:118 +msgid "Delete" +msgstr "" + +#: users/static/templates/users/group-list.html:46 +#: users/static/templates/users/user-list.html:113 +msgid "Edit" +msgstr "" + +#: users/static/templates/users/user-form.html:1 +msgid "Edit participant" +msgstr "" + +#: core/static/js/jquery/datepicker-config.js:12 +msgid "Feb" +msgstr "" + +#: core/static/js/jquery/datepicker-config.js:6 +msgid "February" +msgstr "" + +#: users/static/templates/users/group-list.html:17 +#: users/static/templates/users/user-list.html:63 +msgid "Filter" +msgstr "" + +#: users/static/templates/users/user-form.html:29 +msgid "First name" +msgstr "" + +#: core/static/js/jquery/datepicker-config.js:23 +#: core/static/js/jquery/datepicker-config.js:27 +msgid "Fr" +msgstr "" + +#: core/static/js/jquery/datepicker-config.js:19 +msgid "Friday" +msgstr "" + +#: users/static/templates/users/user-list.html:83 +msgid "Group" +msgstr "" + +#: users/static/templates/users/user-form.html:46 +msgid "Group is required." +msgstr "" + +#: users/static/templates/users/group-list.html:1 +#: users/static/templates/users/user-detail.html:15 +#: users/static/templates/users/user-form.html:42 +#: users/static/templates/users/user-list.html:25 +msgid "Groups" +msgstr "" + +#: core/static/js/jquery/datepicker-config.js:39 +msgid "Hour" +msgstr "" + +#: users/static/templates/users/group-list.html:25 +msgid "ID" +msgstr "" + +#: users/static/templates/users/user-csv-import.html:38 +#: users/static/templates/users/user-list.html:29 +msgid "Import" +msgstr "" + +#: users/static/templates/users/user-csv-import.html:1 +msgid "Import participants" +msgstr "" + +#: users/static/templates/users/user-form.html:72 +msgid "Is active" +msgstr "" + +#: users/static/templates/users/user-form.html:66 +#: users/static/templates/users/user-list.html:59 +msgid "Is present" +msgstr "" + +#: core/static/js/jquery/datepicker-config.js:12 +msgid "Jan" +msgstr "" + +#: core/static/js/jquery/datepicker-config.js:6 +msgid "January" +msgstr "" + +#: core/static/js/jquery/datepicker-config.js:14 +msgid "Jul" +msgstr "" + +#: core/static/js/jquery/datepicker-config.js:8 +msgid "July" +msgstr "" + +#: core/static/js/jquery/datepicker-config.js:13 +msgid "Jun" +msgstr "" + +#: core/static/js/jquery/datepicker-config.js:7 +msgid "June" +msgstr "" + +#: users/static/templates/users/user-list.html:91 +msgid "Last Login" +msgstr "" + +#: users/static/templates/users/user-detail.html:28 +msgid "Last login" +msgstr "" + +#: users/static/templates/users/user-form.html:33 +msgid "Last name" +msgstr "" + +#: users/static/templates/users/user-list.html:50 +msgid "List of access data" +msgstr "" + +#: users/static/templates/users/user-list.html:45 +msgid "List of participants" +msgstr "" + +#: core/static/js/jquery/datepicker-config.js:12 +msgid "Mar" +msgstr "" + +#: core/static/js/jquery/datepicker-config.js:6 +msgid "March" +msgstr "" + +#: core/static/js/jquery/datepicker-config.js:13 +#: core/static/js/jquery/datepicker-config.js:7 +msgid "May" +msgstr "" + +#: core/static/js/jquery/datepicker-config.js:40 +msgid "Minute" +msgstr "" + +#: core/static/js/jquery/datepicker-config.js:22 +#: core/static/js/jquery/datepicker-config.js:26 +msgid "Mo" +msgstr "" + +#: core/static/js/jquery/datepicker-config.js:18 +msgid "Monday" +msgstr "" + +#: users/static/templates/users/user-list.html:19 +msgid "Multiple participants" +msgstr "" + +#: users/static/templates/users/group-form.html:13 +#: users/static/templates/users/group-list.html:29 +#: users/static/templates/users/user-list.html:75 +msgid "Name" +msgstr "" + +#: users/static/templates/users/group-list.html:6 +#: users/static/templates/users/user-list.html:7 +msgid "New" +msgstr "" + +#: users/static/templates/users/user-form.html:2 +msgid "New participant" +msgstr "" + +#: core/static/js/jquery/datepicker-config.js:15 +msgid "Nov" +msgstr "" + +#: core/static/js/jquery/datepicker-config.js:9 +msgid "November" +msgstr "" + +#: core/static/js/jquery/datepicker-config.js:15 +msgid "Oct" +msgstr "" + +#: core/static/js/jquery/datepicker-config.js:9 +msgid "October" +msgstr "" + +#: users/static/templates/users/user-list.html:35 +msgid "PDF" +msgstr "" + +#: users/static/templates/users/user-list.html:1 +msgid "Participants" +msgstr "" + +#: users/static/templates/users/group-form.html:17 +msgid "Permissions" +msgstr "" + +#: users/static/templates/users/group-detail.html:11 +msgid "Permissions:" +msgstr "" + +#: users/static/templates/users/user-detail.html:12 +msgid "Personal data" +msgstr "" + +#: users/static/templates/users/user-csv-import.html:12 +msgid "Please note:" +msgstr "" + +#: users/static/templates/users/user-list.html:71 +msgid "Present" +msgstr "" + +#: users/static/templates/users/user-csv-import.html:23 +msgid "Required CSV file encoding is UTF-8." +msgstr "" + +#: users/static/templates/users/user-csv-import.html:14 +msgid "Required comma separated values" +msgstr "" + +#: core/static/js/jquery/datepicker-config.js:23 +#: core/static/js/jquery/datepicker-config.js:27 +msgid "Sa" +msgstr "" + +#: core/static/js/jquery/datepicker-config.js:19 +msgid "Saturday" +msgstr "" + +#: users/static/templates/users/group-form.html:23 +#: users/static/templates/users/user-form.html:76 +msgid "Save" +msgstr "" + +#: users/static/templates/users/user-csv-import.html:10 +msgid "Select a CSV file to import users!" +msgstr "" + +#: core/static/js/jquery/datepicker-config.js:14 +msgid "Sep" +msgstr "" + +#: core/static/js/jquery/datepicker-config.js:8 +msgid "September" +msgstr "" + +#: users/static/templates/users/group-list.html:40 +#: users/static/templates/users/user-list.html:107 +msgid "Show" +msgstr "" + +#: users/static/templates/users/user-list.html:15 +msgid "Single participant" +msgstr "" + +#: users/static/templates/users/user-csv-import.html:19 +msgid "Staff" +msgstr "" + +#: users/static/templates/users/user-detail.html:13 +#: users/static/templates/users/user-form.html:38 +#: users/static/templates/users/user-list.html:79 +msgid "Structure level" +msgstr "" + +#: core/static/js/jquery/datepicker-config.js:22 +#: core/static/js/jquery/datepicker-config.js:26 +msgid "Su" +msgstr "" + +#: core/static/js/jquery/datepicker-config.js:18 +msgid "Sunday" +msgstr "" + +#: core/static/js/jquery/datepicker-config.js:23 +#: core/static/js/jquery/datepicker-config.js:27 +msgid "Th" +msgstr "" + +#: users/static/templates/users/user-csv-import.html:34 +msgid "The file has to be encoded in UTF-8." +msgstr "" + +#: users/static/templates/users/user-csv-import.html:22 +msgid "The first line (header) is ignored." +msgstr "" + +#: core/static/js/jquery/datepicker-config.js:19 +msgid "Thursday" +msgstr "" + +#: core/static/js/jquery/datepicker-config.js:38 +msgid "Time" +msgstr "" + +#. academic degree +#: users/static/templates/users/user-form.html:25 +msgid "Title" +msgstr "" + +#: core/static/js/jquery/datepicker-config.js:22 +#: core/static/js/jquery/datepicker-config.js:26 +msgid "Tu" +msgstr "" + +#: core/static/js/jquery/datepicker-config.js:18 +msgid "Tuesday" +msgstr "" + +#: users/static/templates/users/user-csv-import.html:24 +msgid "Use the CSV example file from OpenSlides Wiki." +msgstr "" + +#: users/static/templates/users/user-detail.html:24 +#: users/static/templates/users/user-form.html:14 +msgid "Username" +msgstr "" + +#: users/static/templates/users/user-form.html:19 +msgid "Username is required." +msgstr "" + +#: core/static/js/jquery/datepicker-config.js:22 +#: core/static/js/jquery/datepicker-config.js:26 +msgid "We" +msgstr "" + +#: core/static/js/jquery/datepicker-config.js:18 +msgid "Wednesday" +msgstr "" + +#: core/static/js/jquery/datepicker-config.js:2 +#: core/static/js/jquery/datepicker-config.js:32 +msgid "en" +msgstr "" + +#: core/static/js/jquery/datepicker-config.js:4 +msgid "next month" +msgstr "" + +#: core/static/js/jquery/datepicker-config.js:3 +msgid "previous month" +msgstr "" diff --git a/openslides/locale/de/javascript.po b/openslides/locale/de/javascript.po deleted file mode 100644 index e517fab8c..000000000 --- a/openslides/locale/de/javascript.po +++ /dev/null @@ -1,220 +0,0 @@ -# Language file of OpenSlides used by transifex: -# https://www.transifex.com/projects/p/openslides/ - -msgid "" -msgstr "" -"Project-Id-Version: 2.0\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2015-02-01 11:55+0100\n" -"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" -"Last-Translator: FULL NAME \n" -"Language-Team: LANGUAGE \n" -"Language: \n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=CHARSET\n" -"Content-Transfer-Encoding: 8bit\n" -"plural_forms: nplurals=2; plural=(n != 1);" - -#: openslides/agenda/static/js/agenda/agenda.js:51 -msgid "test" -msgid_plural "tests" -msgstr[0] "test-de" -msgstr[1] "tests-de" - -#: openslides/agenda/static/js/agenda.js:14 -#, javascript-format -msgid ", of which %s are hidden." -msgstr "" - -#: openslides/agenda/static/templates/agenda/item-list.html:7 -msgid "New" -msgstr "Neu" - -#: openslides/core/static/js/jquery/datepicker-config.js:2 -#: openslides/core/static/js/jquery/datepicker-config.js:32 -msgid "en" -msgstr "" - -#: openslides/core/static/js/jquery/datepicker-config.js:3 -msgid "previous month" -msgstr "" - -#: openslides/core/static/js/jquery/datepicker-config.js:4 -msgid "next month" -msgstr "" - -#: openslides/core/static/js/jquery/datepicker-config.js:6 -msgid "January" -msgstr "" - -#: openslides/core/static/js/jquery/datepicker-config.js:6 -msgid "February" -msgstr "" - -#: openslides/core/static/js/jquery/datepicker-config.js:6 -msgid "March" -msgstr "" - -#: openslides/core/static/js/jquery/datepicker-config.js:7 -msgid "April" -msgstr "" - -#: openslides/core/static/js/jquery/datepicker-config.js:7 -#: openslides/core/static/js/jquery/datepicker-config.js:13 -msgid "May" -msgstr "" - -#: openslides/core/static/js/jquery/datepicker-config.js:7 -msgid "June" -msgstr "" - -#: openslides/core/static/js/jquery/datepicker-config.js:8 -msgid "July" -msgstr "" - -#: openslides/core/static/js/jquery/datepicker-config.js:8 -msgid "August" -msgstr "" - -#: openslides/core/static/js/jquery/datepicker-config.js:8 -msgid "September" -msgstr "" - -#: openslides/core/static/js/jquery/datepicker-config.js:9 -msgid "October" -msgstr "" - -#: openslides/core/static/js/jquery/datepicker-config.js:9 -msgid "November" -msgstr "" - -#: openslides/core/static/js/jquery/datepicker-config.js:9 -msgid "December" -msgstr "" - -#: openslides/core/static/js/jquery/datepicker-config.js:12 -msgid "Jan" -msgstr "" - -#: openslides/core/static/js/jquery/datepicker-config.js:12 -msgid "Feb" -msgstr "" - -#: openslides/core/static/js/jquery/datepicker-config.js:12 -msgid "Mar" -msgstr "" - -#: openslides/core/static/js/jquery/datepicker-config.js:13 -msgid "Apr" -msgstr "" - -#: openslides/core/static/js/jquery/datepicker-config.js:13 -msgid "Jun" -msgstr "" - -#: openslides/core/static/js/jquery/datepicker-config.js:14 -msgid "Jul" -msgstr "" - -#: openslides/core/static/js/jquery/datepicker-config.js:14 -msgid "Aug" -msgstr "" - -#: openslides/core/static/js/jquery/datepicker-config.js:14 -msgid "Sep" -msgstr "" - -#: openslides/core/static/js/jquery/datepicker-config.js:15 -msgid "Oct" -msgstr "" - -#: openslides/core/static/js/jquery/datepicker-config.js:15 -msgid "Nov" -msgstr "" - -#: openslides/core/static/js/jquery/datepicker-config.js:15 -msgid "Dec" -msgstr "" - -#: openslides/core/static/js/jquery/datepicker-config.js:18 -msgid "Sunday" -msgstr "" - -#: openslides/core/static/js/jquery/datepicker-config.js:18 -msgid "Monday" -msgstr "" - -#: openslides/core/static/js/jquery/datepicker-config.js:18 -msgid "Tuesday" -msgstr "" - -#: openslides/core/static/js/jquery/datepicker-config.js:18 -msgid "Wednesday" -msgstr "" - -#: openslides/core/static/js/jquery/datepicker-config.js:19 -msgid "Thursday" -msgstr "" - -#: openslides/core/static/js/jquery/datepicker-config.js:19 -msgid "Friday" -msgstr "" - -#: openslides/core/static/js/jquery/datepicker-config.js:19 -msgid "Saturday" -msgstr "" - -#: openslides/core/static/js/jquery/datepicker-config.js:22 -#: openslides/core/static/js/jquery/datepicker-config.js:26 -msgid "Su" -msgstr "" - -#: openslides/core/static/js/jquery/datepicker-config.js:22 -#: openslides/core/static/js/jquery/datepicker-config.js:26 -msgid "Mo" -msgstr "" - -#: openslides/core/static/js/jquery/datepicker-config.js:22 -#: openslides/core/static/js/jquery/datepicker-config.js:26 -msgid "Tu" -msgstr "" - -#: openslides/core/static/js/jquery/datepicker-config.js:22 -#: openslides/core/static/js/jquery/datepicker-config.js:26 -msgid "We" -msgstr "" - -#: openslides/core/static/js/jquery/datepicker-config.js:23 -#: openslides/core/static/js/jquery/datepicker-config.js:27 -msgid "Th" -msgstr "" - -#: openslides/core/static/js/jquery/datepicker-config.js:23 -#: openslides/core/static/js/jquery/datepicker-config.js:27 -msgid "Fr" -msgstr "" - -#: openslides/core/static/js/jquery/datepicker-config.js:23 -#: openslides/core/static/js/jquery/datepicker-config.js:27 -msgid "Sa" -msgstr "" - -#: openslides/core/static/js/jquery/datepicker-config.js:38 -msgid "Time" -msgstr "" - -#: openslides/core/static/js/jquery/datepicker-config.js:39 -msgid "Hour" -msgstr "" - -#: openslides/core/static/js/jquery/datepicker-config.js:40 -msgid "Minute" -msgstr "" - -#: openslides/core/static/js/jquery/datepicker-config.js:41 -msgid "Current time" -msgstr "" - -#: openslides/core/static/js/jquery/datepicker-config.js:42 -msgid "Close" -msgstr "" diff --git a/openslides/locale/en/javascript.po b/openslides/locale/en/javascript.po deleted file mode 100644 index 18c00c475..000000000 --- a/openslides/locale/en/javascript.po +++ /dev/null @@ -1,220 +0,0 @@ -# Language file of OpenSlides used by transifex: -# https://www.transifex.com/projects/p/openslides/ - -msgid "" -msgstr "" -"Project-Id-Version: 2.0\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2015-02-01 11:55+0100\n" -"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" -"Last-Translator: FULL NAME \n" -"Language-Team: LANGUAGE \n" -"Language: \n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=CHARSET\n" -"Content-Transfer-Encoding: 8bit\n" -"plural_forms: nplurals=2; plural=(n != 1);" - -#: openslides/agenda/static/js/agenda/agenda.js:51 -msgid "test" -msgid_plural "tests" -msgstr[0] "" -msgstr[1] "" - -#: openslides/agenda/static/js/agenda.js:14 -#, javascript-format -msgid ", of which %s are hidden." -msgstr "" - -#: openslides/agenda/static/templates/agenda/item-list.html:7 -msgid "New" -msgstr "" - -#: openslides/core/static/js/jquery/datepicker-config.js:2 -#: openslides/core/static/js/jquery/datepicker-config.js:32 -msgid "en" -msgstr "" - -#: openslides/core/static/js/jquery/datepicker-config.js:3 -msgid "previous month" -msgstr "" - -#: openslides/core/static/js/jquery/datepicker-config.js:4 -msgid "next month" -msgstr "" - -#: openslides/core/static/js/jquery/datepicker-config.js:6 -msgid "January" -msgstr "" - -#: openslides/core/static/js/jquery/datepicker-config.js:6 -msgid "February" -msgstr "" - -#: openslides/core/static/js/jquery/datepicker-config.js:6 -msgid "March" -msgstr "" - -#: openslides/core/static/js/jquery/datepicker-config.js:7 -msgid "April" -msgstr "" - -#: openslides/core/static/js/jquery/datepicker-config.js:7 -#: openslides/core/static/js/jquery/datepicker-config.js:13 -msgid "May" -msgstr "" - -#: openslides/core/static/js/jquery/datepicker-config.js:7 -msgid "June" -msgstr "" - -#: openslides/core/static/js/jquery/datepicker-config.js:8 -msgid "July" -msgstr "" - -#: openslides/core/static/js/jquery/datepicker-config.js:8 -msgid "August" -msgstr "" - -#: openslides/core/static/js/jquery/datepicker-config.js:8 -msgid "September" -msgstr "" - -#: openslides/core/static/js/jquery/datepicker-config.js:9 -msgid "October" -msgstr "" - -#: openslides/core/static/js/jquery/datepicker-config.js:9 -msgid "November" -msgstr "" - -#: openslides/core/static/js/jquery/datepicker-config.js:9 -msgid "December" -msgstr "" - -#: openslides/core/static/js/jquery/datepicker-config.js:12 -msgid "Jan" -msgstr "" - -#: openslides/core/static/js/jquery/datepicker-config.js:12 -msgid "Feb" -msgstr "" - -#: openslides/core/static/js/jquery/datepicker-config.js:12 -msgid "Mar" -msgstr "" - -#: openslides/core/static/js/jquery/datepicker-config.js:13 -msgid "Apr" -msgstr "" - -#: openslides/core/static/js/jquery/datepicker-config.js:13 -msgid "Jun" -msgstr "" - -#: openslides/core/static/js/jquery/datepicker-config.js:14 -msgid "Jul" -msgstr "" - -#: openslides/core/static/js/jquery/datepicker-config.js:14 -msgid "Aug" -msgstr "" - -#: openslides/core/static/js/jquery/datepicker-config.js:14 -msgid "Sep" -msgstr "" - -#: openslides/core/static/js/jquery/datepicker-config.js:15 -msgid "Oct" -msgstr "" - -#: openslides/core/static/js/jquery/datepicker-config.js:15 -msgid "Nov" -msgstr "" - -#: openslides/core/static/js/jquery/datepicker-config.js:15 -msgid "Dec" -msgstr "" - -#: openslides/core/static/js/jquery/datepicker-config.js:18 -msgid "Sunday" -msgstr "" - -#: openslides/core/static/js/jquery/datepicker-config.js:18 -msgid "Monday" -msgstr "" - -#: openslides/core/static/js/jquery/datepicker-config.js:18 -msgid "Tuesday" -msgstr "" - -#: openslides/core/static/js/jquery/datepicker-config.js:18 -msgid "Wednesday" -msgstr "" - -#: openslides/core/static/js/jquery/datepicker-config.js:19 -msgid "Thursday" -msgstr "" - -#: openslides/core/static/js/jquery/datepicker-config.js:19 -msgid "Friday" -msgstr "" - -#: openslides/core/static/js/jquery/datepicker-config.js:19 -msgid "Saturday" -msgstr "" - -#: openslides/core/static/js/jquery/datepicker-config.js:22 -#: openslides/core/static/js/jquery/datepicker-config.js:26 -msgid "Su" -msgstr "" - -#: openslides/core/static/js/jquery/datepicker-config.js:22 -#: openslides/core/static/js/jquery/datepicker-config.js:26 -msgid "Mo" -msgstr "" - -#: openslides/core/static/js/jquery/datepicker-config.js:22 -#: openslides/core/static/js/jquery/datepicker-config.js:26 -msgid "Tu" -msgstr "" - -#: openslides/core/static/js/jquery/datepicker-config.js:22 -#: openslides/core/static/js/jquery/datepicker-config.js:26 -msgid "We" -msgstr "" - -#: openslides/core/static/js/jquery/datepicker-config.js:23 -#: openslides/core/static/js/jquery/datepicker-config.js:27 -msgid "Th" -msgstr "" - -#: openslides/core/static/js/jquery/datepicker-config.js:23 -#: openslides/core/static/js/jquery/datepicker-config.js:27 -msgid "Fr" -msgstr "" - -#: openslides/core/static/js/jquery/datepicker-config.js:23 -#: openslides/core/static/js/jquery/datepicker-config.js:27 -msgid "Sa" -msgstr "" - -#: openslides/core/static/js/jquery/datepicker-config.js:38 -msgid "Time" -msgstr "" - -#: openslides/core/static/js/jquery/datepicker-config.js:39 -msgid "Hour" -msgstr "" - -#: openslides/core/static/js/jquery/datepicker-config.js:40 -msgid "Minute" -msgstr "" - -#: openslides/core/static/js/jquery/datepicker-config.js:41 -msgid "Current time" -msgstr "" - -#: openslides/core/static/js/jquery/datepicker-config.js:42 -msgid "Close" -msgstr "" diff --git a/openslides/users/static/js/users/users.js b/openslides/users/static/js/users/users.js index 03cb5a3dd..37d0bd77d 100644 --- a/openslides/users/static/js/users/users.js +++ b/openslides/users/static/js/users/users.js @@ -18,7 +18,13 @@ angular.module('OpenSlidesApp.users', []) } } }) - .state('users.user.create', {}) + .state('users.user.create', { + resolve: { + groups: function(Group) { + return Group.findAll(); + } + } + }) .state('users.user.detail', { resolve: { user: function(User, $stateParams) { @@ -29,6 +35,47 @@ angular.module('OpenSlidesApp.users', []) .state('users.user.detail.update', { views: { '@users.user': {} + }, + resolve: { + groups: function(Group) { + return Group.findAll(); + } + } + }) + .state('users.user.csv-import', { + url: '/csv-import', + controller: 'UserCSVImportCtrl', + }) + // groups + .state('users.group', { + url: '/groups', + abstract: true, + template: "", + }) + .state('users.group.list', { + resolve: { + groups: function(Group) { + return Group.findAll(); + } + } + }) + .state('users.group.create', { + resolve: { + groups: function(Group) { + return Group.findAll(); + } + } + }) + .state('users.group.detail', { + resolve: { + group: function(Group, $stateParams) { + return Group.find($stateParams.id); + } + } + }) + .state('users.group.detail.update', { + views: { + '@users.group': {} } }); }) @@ -187,30 +234,99 @@ angular.module('OpenSlidesApp.users', []) }; }]) -.controller('UserListCtrl', function($scope, User, i18n) { +.controller('UserListCtrl', function($scope, User) { User.bindAll({}, $scope, 'users'); + $scope.sortby = 'first_name'; + $scope.reverse = false; + $scope.filterPresent = ''; + + $scope.togglePresent = function (user) { + //the value was changed by the template (checkbox) + User.save(user); + }; + + $scope.delete = function (user) { + //TODO: add confirm message + User.destroy(user.id).then( + function(success) { + //TODO: success message + } + ); + }; }) .controller('UserDetailCtrl', function($scope, User, user) { User.bindOne(user.id, $scope, 'user'); }) -.controller('UserCreateCtrl', function($scope, User) { +.controller('UserCreateCtrl', function($scope, $state, User, Group) { + Group.bindAll({where: {id: {'>': 2}}}, $scope, 'groups'); $scope.user = {}; $scope.save = function (user) { - User.create(user); - // TODO: redirect to list-view + User.create(user).then( + function(success) { + $state.go('users.user.list'); + } + ); }; }) -.controller('UserUpdateCtrl', function($scope, User, user) { - $scope.user = user; // do not use Agenda.binOne(...) so autoupdate is not activated - $scope.save = function(user) { - User.save(user); - // TODO: redirect to list-view +.controller('UserUpdateCtrl', function($scope, $state, User, user, Group) { + Group.bindAll({where: {id: {'>': 2}}}, $scope, 'groups'); + $scope.user = user; // autoupdate is not activated + $scope.save = function (user) { + User.save(user).then( + function(success) { + $state.go('users.user.list'); + } + ); }; }) +.controller('UserCSVImportCtrl', function($scope, User) { + // TODO +}) + +.controller('GroupListCtrl', function($scope, Group) { + Group.bindAll({}, $scope, 'groups'); + + $scope.delete = function (group) { + //TODO: add confirm message + Group.destroy(group.id).then( + function(success) { + //TODO: success message + } + ); + }; +}) + +.controller('GroupCreateCtrl', function($scope, $state, Group) { + //TODO: permissions Group.bindAll({}, $scope, 'groups'); + $scope.group = {}; + $scope.save = function (group) { + Group.create(group).then( + function(success) { + $state.go('^'); + } + ); + }; +}) + +.controller('GroupUpdateCtrl', function($scope, $state, Group, group) { + $scope.group = group; // autoupdate is not activated + $scope.save = function (group) { + Group.save(group).then( + function(success) { + $state.go('users.group.list'); + } + ); + }; +}) + +.controller('GroupDetailCtrl', function($scope, Group, group) { + Group.bindOne(group.id, $scope, 'group'); +}) + .controller('userMenu', function($scope, $http, DS, User, operator) { $scope.logout = function() { $http.post('/users/logout/').success(function(data) { @@ -225,8 +341,12 @@ angular.module('OpenSlidesApp.users', []) '/users/login/', {'username': username, 'password': password} ).success(function(data) { - operator.setUser(data.user_id); - $scope.showLoginForm = false; + if (data.success) { + operator.setUser(data.user_id); + $scope.loginFailed = false; + } else { + $scope.loginFailed = true; + } }); }; }); diff --git a/openslides/users/static/templates/users/group-detail.html b/openslides/users/static/templates/users/group-detail.html new file mode 100644 index 000000000..380c0c069 --- /dev/null +++ b/openslides/users/static/templates/users/group-detail.html @@ -0,0 +1,14 @@ +

{{ group.name }}

+ + + + +Permissions: +
    +
  • {{ perm }} +
diff --git a/openslides/users/static/templates/users/group-form.html b/openslides/users/static/templates/users/group-form.html new file mode 100644 index 000000000..7f1aed62a --- /dev/null +++ b/openslides/users/static/templates/users/group-form.html @@ -0,0 +1,29 @@ +

Edit group

+

New group

+ + + +
+
+ + +
+
+ + +
+ + + +
diff --git a/openslides/users/static/templates/users/group-list.html b/openslides/users/static/templates/users/group-list.html new file mode 100644 index 000000000..620048831 --- /dev/null +++ b/openslides/users/static/templates/users/group-list.html @@ -0,0 +1,54 @@ +

Groups

+ + + +
+
+ +
+
+ + + + + + + +
+ ID + + + Name + + Actions
{{ group.id }} + {{ group.name }} + + + + + + + + + + + + + +
diff --git a/openslides/users/static/templates/users/user-csv-import.html b/openslides/users/static/templates/users/user-csv-import.html new file mode 100644 index 000000000..fde90284b --- /dev/null +++ b/openslides/users/static/templates/users/user-csv-import.html @@ -0,0 +1,44 @@ +

Import participants

+ + + +

Select a CSV file to import users! + +

Please note:

+
    +
  • Required comma separated values:
    + 'title, first name, last name, gender, email, group id, structure level, + committee, about me, comment, is active' +
  • Default groups: + Delegate 3, + Staff 4 +
  • At least first name or last name have to be filled in. All + other fields are optional and may be empty. +
  • The first line (header) is ignored. +
  • Required CSV file encoding is UTF-8. +
  • + Use the CSV example file from OpenSlides Wiki. + +
+ + +
+
+ + +

The file has to be encoded in UTF-8. +

+ + + + +
diff --git a/openslides/users/static/templates/users/user-detail.html b/openslides/users/static/templates/users/user-detail.html index 37cf64918..fb11a0ae9 100644 --- a/openslides/users/static/templates/users/user-detail.html +++ b/openslides/users/static/templates/users/user-detail.html @@ -1,2 +1,31 @@ -

Persönliche Daten

-{{ user.get_short_name() }} +

{{ user.get_short_name() }}

+ + + +
+
+ Personal data + + {{ user.structure_level }} + + {{ user.groups }} + + + {{ user.about_me }} +
+ +
+ Administrative data + + {{ user.username }} + + {{ user.comment }} + + {{ user.last_login }} +
+
diff --git a/openslides/users/static/templates/users/user-form.html b/openslides/users/static/templates/users/user-form.html index dc6afa301..18a1d57be 100644 --- a/openslides/users/static/templates/users/user-form.html +++ b/openslides/users/static/templates/users/user-form.html @@ -1,8 +1,82 @@ -

{{ user.get_short_name() }}

-

{{ gettext("New User") }}

+

Edit participant

+

New participant

-
- firstname:
- lastname:
- + + + +
+ + + +

+ Username is required. +

+
+
+ + +
+
+ + +
+
+ + +
+
+
+ + +
+
+ + +

+ Group is required. +

+
+
+ + +
+
+
+ +