From c2920407bbb760b66649ab722b12c8520431f83d Mon Sep 17 00:00:00 2001 From: Emanuel Schuetze Date: Wed, 24 Jun 2015 15:04:40 +0200 Subject: [PATCH] Template improvements - Activate slides for users, customslides, motions, assignments. - Add delete confirm message. - Fixed required form fields. - Added version template. - Improved user import. Updated csv files. --- extras/csv-examples/participants-demo_de.csv | 86 ++++++++-------- extras/csv-examples/participants-demo_en.csv | 85 ++++++++-------- .../static/templates/agenda/item-form.html | 2 +- .../static/templates/agenda/item-import.html | 2 +- .../static/templates/agenda/item-list.html | 2 +- .../static/js/assignments/assignments.js | 38 +++++-- .../assignments/assignment-list.html | 14 ++- .../assignments/slide_assignment.html | 4 + openslides/core/static/css/projector.css | 1 - openslides/core/static/js/app.js | 4 +- openslides/core/static/js/core.js | 18 +++- .../templates/core/customslide-list.html | 8 +- .../static/templates/core/slide_clock.html | 2 +- .../templates/core/slide_customslide.html | 2 +- openslides/core/static/templates/index.html | 2 +- openslides/core/static/templates/version.html | 12 +++ .../templates/mediafiles/mediafile-form.html | 2 +- openslides/motions/projector.py | 11 ++- .../motions/static/js/motions/motions.js | 42 +++++--- .../templates/motions/category-list.html | 6 +- .../static/templates/motions/motion-list.html | 21 ++-- .../templates/motions/slide_motion.html | 4 + openslides/users/static/js/users/users.js | 65 ++++++++---- .../static/templates/users/group-form.html | 4 +- .../static/templates/users/group-list.html | 4 +- .../static/templates/users/slide_user.html | 4 +- .../templates/users/user-csv-import.html | 53 ---------- .../static/templates/users/user-form.html | 2 +- .../static/templates/users/user-import.html | 98 +++++++++++++++++++ .../static/templates/users/user-list.html | 55 ++++------- openslides/users/urls.py | 4 +- 31 files changed, 397 insertions(+), 260 deletions(-) create mode 100644 openslides/assignments/static/templates/assignments/slide_assignment.html create mode 100644 openslides/core/static/templates/version.html create mode 100644 openslides/motions/static/templates/motions/slide_motion.html delete mode 100644 openslides/users/static/templates/users/user-csv-import.html create mode 100644 openslides/users/static/templates/users/user-import.html diff --git a/extras/csv-examples/participants-demo_de.csv b/extras/csv-examples/participants-demo_de.csv index d50b9fdc1..ac1b3b17c 100644 --- a/extras/csv-examples/participants-demo_de.csv +++ b/extras/csv-examples/participants-demo_de.csv @@ -1,44 +1,44 @@ -"Titel";"Vorname";"Nachname";"Geschlecht";"E-Mail";"Gruppen-ID";"Gliederungsebene";"Amt";"Über mich";"Kommentar";"Aktiviert" -;"Fred";"Nurk";"male";;3;"Australien";;;;1 -;"Jan";"Jansen";"male";;3;"Belgien";;;;1 -;"Juan";"Pérez";"male";;3;"Chile";;;;1 -"Dr.";"Max";"Mustermann";"male";"max@example.com";4;"Deutschland";"Versammlungsleitung";"Lorem ipsum dolor sit amet, consectetuer adipiscing elit. -Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus.";"Demo-Account +title,first_name,last_name,structure_level,groups,comment,is_active +,Fred,Nurk,Australien,3,,1 +,Jan,Jansen,Belgien,3,,1 +,Juan,Pérez,Chile,3,,1 +Dr.,Max,Mustermann,Deutschland,4,"Demo-Account -Teilnehmer/innen-Namen aus http://de.wikipedia.org/wiki/Otto_Normalverbraucher";1 -;"Otto";"Normalverbraucher";"male";"otto@example.com";3;"Deutschland";"Haushaltsausschuss";;"Demo-Account";1 -;"Erika";"Mustermann";"female";"erika@example.com";;"Deutschland";;;;0 -;"Morten";"Meinigmand";"male";;3;"Dänemark";;;;1 -;"Juan";"Piguabe";"male";;3;"Ecuador";;;;1 -;"Tädi";"Maali";"female";;3;"Estland";;;;1 -;"Maija";"Maikäläinen";"female";;3;"Finnland";;;;1 -;"Jean";"Dupont";"male";;3;"Frankreich";;;;1 -;"Paul";"Martin";"male";;"3,4";"Frankreich";"Versammlungsleitung";;;1 -;"Fred";"Bloggs";"male";;3;"Großbritanien";;;;0 -;"John";"Smith";"male";;4;"Großbritanien";"Versammlungsleitung";;;1 -;"Ashok";"Kumar";"male";;3;"Indien";;;;1 -;"Si";"Polan";"male";;;"Indonesien";;;;1 -;"Seán";"Citizen";"male";;3;"Irland";;;;1 -;"Jóna";"Jónsson";"female";;3;"Island";;;;1 -;"Israel";"Israeli";"male";;3;"Israel";;;;1 -;"Mario";"Rossi";"male";;3;"Italien";;;;1 -;"Jos";"Bleau";"male";;3;"Kanada";;;;1 -;"Fulano";"de Tal";"male";;3;"Kolumbien";;;;1 -;"Jenni";"a Menni";"female";;3;"Luxemburg";;;;1 -;"Joe";"Borg";"male";;3;"Malta";;;;1 -;"Bob";"Smith";"male";;;"Neuseeland";;;;1 -;"Harry";"Holland";"male";;3;"Niederlande";;;;1 -"Prof.";"Hans";"Maier";"male";;3;"Österreich";;;;1 -;"Jan";"Kowalski";"male";;3;"Polen";;;;1 -;"Manuel";"Dos Santos";"male";;3;"Portugal";;;;1 -;"Cutare";"Cutărică";"male";;3;"Rumänien";;;;1 -;"Nils";"Holgersson";"male";;3;"Schweden";;;;1 -;"Max";"Schweizer";"male";;;"Schweiz";;;;1 -;"Janez";"Novak";"male";;3;"Slowenien";;;;1 -;"Koos";"van der Merwe";"male";;3;"Südafrika";;;;1 -;"Jan";"Novák";"male";;3;"Tschechien";;;;1 -;"Sade";"Vatandaş";"male";;3;"Türkei";;;;1 -;"Gipsz";"Jakab";"male";;3;"Ungarn";;;;1 -;"John";"Doe";"male";"john@example.com";3;"USA";;;;1 -;"Jane";"Doe";"female";;;"USA";;;;0 -;"Nguoi";"La";"male";;3;"Vietnam";;;;0 +Teilnehmer/innen-Namen aus +http://de.wikipedia.org/wiki/Otto_Normalverbraucher",1 +,Otto,Normalverbraucher,Deutschland,3,Demo-Account,1 +,Erika,Mustermann,Deutschland,,,0 +,Morten,Meinigmand,Dänemark,3,,1 +,Juan,Piguabe,Ecuador,3,,1 +,Tädi,Maali,Estland,3,,1 +,Maija,Maikäläinen,Finnland,3,,1 +,Jean,Dupont,Frankreich,3,,1 +,Paul,Martin,Frankreich,"3,4",,1 +,Fred,Bloggs,Großbritanien,3,,0 +,John,Smith,Großbritanien,4,,1 +,Ashok,Kumar,Indien,3,,1 +,Si,Polan,Indonesien,,,1 +,Seán,Citizen,Irland,3,,1 +,Jóna,Jónsson,Island,3,,1 +,Israel,Israeli,Israel,3,,1 +,Mario,Rossi,Italien,3,,1 +,Jos,Bleau,Kanada,3,,1 +,Fulano,de Tal,Kolumbien,3,,1 +,Jenni,a Menni,Luxemburg,3,,1 +,Joe,Borg,Malta,3,,1 +,Bob,Smith,Neuseeland,,,1 +,Harry,Holland,Niederlande,3,,1 +Prof.,Hans,Maier,Österreich,3,,1 +,Jan,Kowalski,Polen,3,,1 +,Manuel,Dos Santos,Portugal,3,,1 +,Cutare,Cutărică,Rumänien,3,,1 +,Nils,Holgersson,Schweden,3,,1 +,Max,Schweizer,Schweiz,,,1 +,Janez,Novak,Slowenien,3,,1 +,Koos,van der Merwe,Südafrika,3,,1 +,Jan,Novák,Tschechien,3,,1 +,Sade,Vatandaş,Türkei,3,,1 +,Gipsz,Jakab,Ungarn,3,,1 +,John,Doe,USA,3,,1 +,Jane,Doe,USA,,,0 +,Nguoi,La,Vietnam,3,,0 diff --git a/extras/csv-examples/participants-demo_en.csv b/extras/csv-examples/participants-demo_en.csv index 7814202bc..409f77378 100644 --- a/extras/csv-examples/participants-demo_en.csv +++ b/extras/csv-examples/participants-demo_en.csv @@ -1,44 +1,43 @@ -"Title";"First Name";"Last Name";"Gender";"Email";"Group id";"Structure Level";"Committee";"About me";"Comment";"Is active" -;"Fred";"Nurk";"male";;3;"Australia";;;;1 -;"Jan";"Jansen";"male";;3;"Belgium";;;;1 -;"Juan";"Pérez";"male";;3;"Chile";;;;1 -"Dr.";"Max";"Mustermann";"male";"max@example.com";4;"Germany";"Leadership of the assembly";"Lorem ipsum dolor sit amet, consectetuer adipiscing elit. -Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus.";"Demo account +title,first_name,last_name,structure_level,groups,comment,is_active +,Fred,Nurk,Australia,3,,1 +,Jan,Jansen,Belgium,3,,1 +,Juan,Pérez,Chile,3,,1 +Dr.,Max,Mustermann,Germany,4,"Demo account -Names from http:///en.wikipedia.org/wiki/Otto_Normalverbraucher";1 -;"Otto";"Normalverbraucher";"male";"otto@example.com";3;"Germany";"Budget committee";;"Demo account";1 -;"Erika";"Mustermann";"female";"erika@example.com";;"Germany";;;;0 -;"Morten";"Meinigmand";"male";;3;"Denmark";;;;1 -;"Juan";"Piguabe";"male";;3;"Ecuador";;;;1 -;"Tädi";"Maali";"female";;3;"Estonia";;;;1 -;"Maija";"Maikäläinen";"female";;3;"Finland";;;;1 -;"Jean";"Dupont";"male";;3;"France";;;;1 -;"Paul";"Martin";"female";;4;"France";"Leadership of the assembly";;;1 -;"Fred";"Bloggs";"male";;3;"United Kingdom";;;;0 -;"John";"Smith";"male";;4;"United Kingdom";"Leadership of the assembly";;;1 -;"Ashok";"Kumar";"male";;3;"India";;;;1 -;"Si";"Polan";"male";;;"Indonesia";;;;1 -;"Seán";"Citizen";"male";;3;"Ireland";;;;1 -;"Jóna";"Jónsson";"female";;3;"Ireland";;;;1 -;"Israel";"Israeli";"male";;3;"Israel";;;;1 -;"Mario";"Rossi";"male";;3;"Italy";;;;1 -;"Jos";"Bleau";"male";;3;"Canada";;;;1 -;"Fulano";"de Tal";"male";;3;"Colombia";;;;1 -;"Jenni";"a Menni";"female";;3;"Luxembourg";;;;1 -;"Joe";"Borg";"male";;3;"Malta";;;;1 -;"Bob";"Smith";"male";;;"New Zealand";;;;1 -;"Harry";"Holland";"male";;3;"Netherlands";;;;1 -"Prof.";"Hans";"Maier";"male";;3;"Austria";;;;1 -;"Jan";"Kowalski";"male";;3;"Poland";;;;1 -;"Manuel";"Dos Santos";"male";;3;"Portugal";;;;1 -;"Cutare";"Cutărică";"male";;3;"Rumania";;;;1 -;"Nils";"Holgersson";"male";;3;"Sweden";;;;1 -;"Max";"Schweizer";"male";;;"Switzerland";;;;1 -;"Janez";"Novak";"male";;3;"Slovenia";;;;1 -;"Koos";"van der Merwe";"male";;3;"South Africa";;;;1 -;"Jan";"Novák";"male";;3;"Czech Republic";;;;1 -;"Sade";"Vatandaş";"male";;3;"Turkey";;;;1 -;"Gipsz";"Jakab";"male";;3;"Hungary";;;;1 -;"John";"Doe";"male";"john@example.com";3;"USA";;;;1 -;"Jane";"Doe";"female";;;"USA";;;;0 -;"Nguoi";"La";"male";;3;"Vietnam";;;;0 +Names from http:///en.wikipedia.org/wiki/Otto_Normalverbraucher",1 +,Otto,Normalverbraucher,Germany,3,Demo account,1 +,Erika,Mustermann,Germany,,,0 +,Morten,Meinigmand,Denmark,3,,1 +,Juan,Piguabe,Ecuador,3,,1 +,Tädi,Maali,Estonia,3,,1 +,Maija,Maikäläinen,Finland,3,,1 +,Jean,Dupont,France,3,,1 +,Paul,Martin,France,4,,1 +,Fred,Bloggs,United Kingdom,3,,0 +,John,Smith,United Kingdom,4,,1 +,Ashok,Kumar,India,3,,1 +,Si,Polan,Indonesia,,,1 +,Seán,Citizen,Ireland,3,,1 +,Jóna,Jónsson,Ireland,3,,1 +,Israel,Israeli,Israel,3,,1 +,Mario,Rossi,Italy,3,,1 +,Jos,Bleau,Canada,3,,1 +,Fulano,de Tal,Colombia,3,,1 +,Jenni,a Menni,Luxembourg,3,,1 +,Joe,Borg,Malta,3,,1 +,Bob,Smith,New Zealand,,,1 +,Harry,Holland,Netherlands,3,,1 +Prof.,Hans,Maier,Austria,3,,1 +,Jan,Kowalski,Poland,3,,1 +,Manuel,Dos Santos,Portugal,3,,1 +,Cutare,Cutărică,Rumania,3,,1 +,Nils,Holgersson,Sweden,3,,1 +,Max,Schweizer,Switzerland,,,1 +,Janez,Novak,Slovenia,3,,1 +,Koos,van der Merwe,South Africa,3,,1 +,Jan,Novák,Czech Republic,3,,1 +,Sade,Vatandaş,Turkey,3,,1 +,Gipsz,Jakab,Hungary,3,,1 +,John,Doe,USA,3,,1 +,Jane,Doe,USA,,,0 +,Nguoi,La,Vietnam,3,,0 diff --git a/openslides/agenda/static/templates/agenda/item-form.html b/openslides/agenda/static/templates/agenda/item-form.html index c34dc158b..39ebfafd2 100644 --- a/openslides/agenda/static/templates/agenda/item-form.html +++ b/openslides/agenda/static/templates/agenda/item-form.html @@ -32,7 +32,7 @@
diff --git a/openslides/agenda/static/templates/agenda/item-import.html b/openslides/agenda/static/templates/agenda/item-import.html index c6e87ee2f..1ccfd14fb 100644 --- a/openslides/agenda/static/templates/agenda/item-import.html +++ b/openslides/agenda/static/templates/agenda/item-import.html @@ -36,7 +36,7 @@ Keep each item in a single line.

  • Required comma separated values:
    'title, text, duration'
  • Text and duration are optional and may be empty. -
  • The first line (header) is ignored. +
  • The header in first line is required.
  • Required CSV file encoding is UTF-8.
  • Use the CSV example file from OpenSlides Wiki. diff --git a/openslides/agenda/static/templates/agenda/item-list.html b/openslides/agenda/static/templates/agenda/item-list.html index 75a2832e7..cd3fcab3e 100644 --- a/openslides/agenda/static/templates/agenda/item-list.html +++ b/openslides/agenda/static/templates/agenda/item-list.html @@ -77,7 +77,7 @@ {{ (items | filter: {id: node.id})[0].title }}?" ng-bootbox-confirm-action="delete(node.id)" title="{{ 'Delete' | translate }}"> diff --git a/openslides/assignments/static/js/assignments/assignments.js b/openslides/assignments/static/js/assignments/assignments.js index d24389b1e..970b402a4 100644 --- a/openslides/assignments/static/js/assignments/assignments.js +++ b/openslides/assignments/static/js/assignments/assignments.js @@ -1,9 +1,16 @@ angular.module('OpenSlidesApp.assignments', []) -.factory('Assignment', function(DS) { +.factory('Assignment', function(DS, jsDataModel) { + var name = 'assignments/assignment' return DS.defineResource({ - name: 'assignments/assignment', - endpoint: '/rest/assignments/assignment/' + name: name, + endpoint: '/rest/assignments/assignment/', + useClass: jsDataModel, + methods: { + getResourceName: function () { + return name; + } + } }); }) @@ -66,14 +73,9 @@ angular.module('OpenSlidesApp.assignments.site', ['OpenSlidesApp.assignments']) $scope.sortColumn = column; }; - // delete assignment + // delete selected assignment $scope.delete = function (assignment) { - //TODO: add confirm message - Assignment.destroy(assignment.id).then( - function(success) { - //TODO: success message - } - ); + Assignment.destroy(assignment.id); }; }) @@ -104,3 +106,19 @@ angular.module('OpenSlidesApp.assignments.site', ['OpenSlidesApp.assignments']) }; }); +angular.module('OpenSlidesApp.assignments.projector', ['OpenSlidesApp.assignments']) + +.config(function(slidesProvider) { + slidesProvider.registerSlide('assignments/assignment', { + template: 'static/templates/assignments/slide_assignment.html', + }); +}) + +.controller('SlideAssignmentCtrl', function($scope, Assignment) { + // Attention! Each object that is used here has to be dealt on server side. + // Add it to the coresponding get_requirements method of the ProjectorElement + // class. + var id = $scope.element.context.id; + Assignment.find(id); + Assignment.bindOne(id, $scope, 'assignment'); +}); diff --git a/openslides/assignments/static/templates/assignments/assignment-list.html b/openslides/assignments/static/templates/assignments/assignment-list.html index 9a5acd83f..52b02d6bf 100644 --- a/openslides/assignments/static/templates/assignments/assignment-list.html +++ b/openslides/assignments/static/templates/assignments/assignment-list.html @@ -47,7 +47,7 @@ Actions + orderBy: sortColumn:reverse" ng-class="{ 'activeline': assignment.isProjected() }"> {{ assignment.title }} {{ assignment.open_posts }} @@ -57,9 +57,11 @@ {{ phases[assignment.phase].display_name }} - - + + @@ -69,7 +71,9 @@ - diff --git a/openslides/assignments/static/templates/assignments/slide_assignment.html b/openslides/assignments/static/templates/assignments/slide_assignment.html new file mode 100644 index 000000000..4818aabd1 --- /dev/null +++ b/openslides/assignments/static/templates/assignments/slide_assignment.html @@ -0,0 +1,4 @@ +
    +

    {{ assignment.title }}

    + {{ assignment.description }} +
    diff --git a/openslides/core/static/css/projector.css b/openslides/core/static/css/projector.css index 19a709120..10281a52c 100644 --- a/openslides/core/static/css/projector.css +++ b/openslides/core/static/css/projector.css @@ -50,7 +50,6 @@ body{ top:110px; right:40px; padding-left:30px; - background: url(../img/glyphicons_054_clock_big.png) no-repeat scroll 0px 0px; } /*** CONTENT with base style elements ***/ diff --git a/openslides/core/static/js/app.js b/openslides/core/static/js/app.js index fc65c1f37..71dcf1fbb 100644 --- a/openslides/core/static/js/app.js +++ b/openslides/core/static/js/app.js @@ -11,8 +11,8 @@ angular.module('OpenSlidesApp.projector', [ 'OpenSlidesApp', 'OpenSlidesApp.core.projector', 'OpenSlidesApp.agenda', - 'OpenSlidesApp.motions', - 'OpenSlidesApp.assignments', + 'OpenSlidesApp.motions.projector', + 'OpenSlidesApp.assignments.projector', 'OpenSlidesApp.users.projector', 'OpenSlidesApp.mediafiles', ]); diff --git a/openslides/core/static/js/core.js b/openslides/core/static/js/core.js index 6cda0b444..5e141407d 100644 --- a/openslides/core/static/js/core.js +++ b/openslides/core/static/js/core.js @@ -94,6 +94,7 @@ angular.module('OpenSlidesApp.core', []) // Returns true if there is a projector element with the same // name and the same id. var projector = Projector.get(id=1); + if (typeof projector === 'undefined') return false; var self = this; return _.findIndex(projector.elements, function(element) { return element.name == self.getResourceName() && @@ -109,6 +110,7 @@ angular.module('OpenSlidesApp.core', []) return DS.defineResource({ name: name, endpoint: '/rest/core/customslide/', + useClass: jsDataModel, methods: { getResourceName: function () { return name; @@ -237,6 +239,10 @@ angular.module('OpenSlidesApp.core.site', ['OpenSlidesApp.core']) abstract: true, template: "", }) + .state('version', { + url: '/version', + controller: 'VersionCtrl', + }) // customslide .state('core.customslide', { url: '/customslide', @@ -373,6 +379,14 @@ angular.module('OpenSlidesApp.core.site', ['OpenSlidesApp.core']) }; }) +// Version Controller +.controller('VersionCtrl', function($scope, $http) { + $http.get('/core/version/').success(function(data) { + $scope.core_version = data.openslides_version; + $scope.plugins = data.plugins; + }); +}) + // Customslide Controller .controller('CustomslideListCtrl', function($scope, Customslide) { Customslide.bindAll({}, $scope, 'customslides'); @@ -552,7 +566,7 @@ angular.module('OpenSlidesApp.core.projector', ['OpenSlidesApp.core']) }); }) -.controller('SlideCustomSlideCtr', function($scope, Customslide) { +.controller('SlideCustomSlideCtrl', function($scope, Customslide) { // Attention! Each object that is used here has to be dealt on server side. // Add it to the coresponding get_requirements method of the ProjectorElement // class. @@ -561,7 +575,7 @@ angular.module('OpenSlidesApp.core.projector', ['OpenSlidesApp.core']) Customslide.bindOne(id, $scope, 'customslide'); }) -.controller('SlideClockCtr', function($scope) { +.controller('SlideClockCtrl', function($scope) { // Attention! Each object that is used here has to be dealt on server side. // Add it to the coresponding get_requirements method of the ProjectorElement // class. diff --git a/openslides/core/static/templates/core/customslide-list.html b/openslides/core/static/templates/core/customslide-list.html index 7ff75f29b..d871b5a0d 100644 --- a/openslides/core/static/templates/core/customslide-list.html +++ b/openslides/core/static/templates/core/customslide-list.html @@ -25,9 +25,15 @@ Actions + orderBy: sortColumn:reverse" ng-class="{ 'activeline': customslide.isProjected() }"> {{ customslide.title }} + + + + +
    {{ serverOffset | osServertime | date:'HH:mm' }}
    diff --git a/openslides/core/static/templates/core/slide_customslide.html b/openslides/core/static/templates/core/slide_customslide.html index 91776f576..2601287c3 100644 --- a/openslides/core/static/templates/core/slide_customslide.html +++ b/openslides/core/static/templates/core/slide_customslide.html @@ -1,4 +1,4 @@ -
    diff --git a/openslides/core/static/templates/version.html b/openslides/core/static/templates/version.html new file mode 100644 index 000000000..987c0b67d --- /dev/null +++ b/openslides/core/static/templates/version.html @@ -0,0 +1,12 @@ +

    Version

    + +

    OpenSlides Version {{ core_version }} + +

    +

    Installed plugins:

    +
      +
    1. + {{ plugin.verbose_name }}: {{ plugin.version }} +
    +
    + diff --git a/openslides/mediafiles/static/templates/mediafiles/mediafile-form.html b/openslides/mediafiles/static/templates/mediafiles/mediafile-form.html index c40ebe6bc..1b979171a 100644 --- a/openslides/mediafiles/static/templates/mediafiles/mediafile-form.html +++ b/openslides/mediafiles/static/templates/mediafiles/mediafile-form.html @@ -14,7 +14,7 @@
  • -
    +
    diff --git a/openslides/motions/projector.py b/openslides/motions/projector.py index aaf7c81dd..7b16aeb18 100644 --- a/openslides/motions/projector.py +++ b/openslides/motions/projector.py @@ -33,14 +33,15 @@ class MotionDetailSlide(ProjectorElement): view_class=MotionViewSet, view_action='retrieve', pk=str(motion.pk)) - yield ProjectorRequirement( - view_class=CategoryViewSet, - view_action='retrieve', - pk=str(motion.category.pk)) + if motion.category: + yield ProjectorRequirement( + view_class=CategoryViewSet, + view_action='retrieve', + pk=str(motion.category.pk)) yield ProjectorRequirement( view_class=WorkflowViewSet, view_action='retrieve', - pk=str(motion.workflow.pk)) + pk=str(motion.workflow)) for submitter in motion.submitters.all(): yield ProjectorRequirement( view_class=submitter.get_view_class(), diff --git a/openslides/motions/static/js/motions/motions.js b/openslides/motions/static/js/motions/motions.js index cb5e281d2..e095c235b 100644 --- a/openslides/motions/static/js/motions/motions.js +++ b/openslides/motions/static/js/motions/motions.js @@ -1,10 +1,15 @@ angular.module('OpenSlidesApp.motions', []) -.factory('Motion', function(DS) { +.factory('Motion', function(DS, jsDataModel) { + var name = 'motions/motion' return DS.defineResource({ - name: 'motions/motion', + name: name, endpoint: '/rest/motions/motion/', + useClass: jsDataModel, methods: { + getResourceName: function () { + return name; + }, getVersion: function(versionId) { versionId = versionId || this.active_version; if (versionId == -1) { @@ -183,13 +188,9 @@ angular.module('OpenSlidesApp.motions.site', ['OpenSlidesApp.motions']) $scope.save = function (motion) { Motion.save(motion); }; + // delete selected motion $scope.delete = function (motion) { - //TODO: add confirm message - Motion.destroy(motion.id).then( - function(success) { - //TODO: success message - } - ); + Motion.destroy(motion.id); }; }) @@ -256,13 +257,9 @@ angular.module('OpenSlidesApp.motions.site', ['OpenSlidesApp.motions']) .controller('CategoryListCtrl', function($scope, Category) { Category.bindAll({}, $scope, 'categories'); + // delete selected category $scope.delete = function (category) { - //TODO: add confirm message - Category.destroy(category.id).then( - function(success) { - //TODO: success message - } - ); + Category.destroy(category.id); }; }) @@ -291,3 +288,20 @@ angular.module('OpenSlidesApp.motions.site', ['OpenSlidesApp.motions']) ); }; }); + +angular.module('OpenSlidesApp.motions.projector', ['OpenSlidesApp.motions']) + +.config(function(slidesProvider) { + slidesProvider.registerSlide('motions/motion', { + template: 'static/templates/motions/slide_motion.html', + }); +}) + +.controller('SlideMotionCtrl', function($scope, Motion) { + // Attention! Each object that is used here has to be dealt on server side. + // Add it to the coresponding get_requirements method of the ProjectorElement + // class. + var id = $scope.element.context.id; + Motion.find(id); + Motion.bindOne(id, $scope, 'motion'); +}); diff --git a/openslides/motions/static/templates/motions/category-list.html b/openslides/motions/static/templates/motions/category-list.html index dfaa0cdc9..d446bb0cf 100644 --- a/openslides/motions/static/templates/motions/category-list.html +++ b/openslides/motions/static/templates/motions/category-list.html @@ -1,7 +1,7 @@

    Categories