From 6bbbf30d94bd292a51e9ceb8434584092ec89760 Mon Sep 17 00:00:00 2001 From: FinnStutzenstein Date: Mon, 12 Dec 2016 16:15:04 +0100 Subject: [PATCH] rename mediafiles private flag to hidden --- openslides/core/static/css/app.css | 2 +- openslides/mediafiles/access_permissions.py | 2 +- .../migrations/0004_auto_20161212_1612.py | 31 +++++++++++++++++++ openslides/mediafiles/models.py | 6 ++-- openslides/mediafiles/serializers.py | 2 +- .../mediafiles/static/js/mediafiles/site.js | 16 +++++----- .../templates/mediafiles/mediafile-form.html | 13 +++++--- .../templates/mediafiles/mediafile-list.html | 10 +++--- openslides/users/signals.py | 4 +-- openslides/users/static/js/users/site.js | 2 +- 10 files changed, 61 insertions(+), 27 deletions(-) create mode 100644 openslides/mediafiles/migrations/0004_auto_20161212_1612.py diff --git a/openslides/core/static/css/app.css b/openslides/core/static/css/app.css index 48c05dd92..16fcfa8b4 100644 --- a/openslides/core/static/css/app.css +++ b/openslides/core/static/css/app.css @@ -1012,7 +1012,7 @@ img { } .os-table .title { - font-size: 115%; + font-size: 120%; margin-right: 3px; padding: 0; background-color: transparent; diff --git a/openslides/mediafiles/access_permissions.py b/openslides/mediafiles/access_permissions.py index 948b807c3..cb97c1fdb 100644 --- a/openslides/mediafiles/access_permissions.py +++ b/openslides/mediafiles/access_permissions.py @@ -24,7 +24,7 @@ class MediafileAccessPermissions(BaseAccessPermissions): Returns the restricted serialized data for the instance prepared for the user. """ - if (not full_data['private'] or user.has_perm('mediafiles.can_see_private')): + if (not full_data['hidden'] or user.has_perm('mediafiles.can_see_hidden')): data = full_data else: data = None diff --git a/openslides/mediafiles/migrations/0004_auto_20161212_1612.py b/openslides/mediafiles/migrations/0004_auto_20161212_1612.py new file mode 100644 index 000000000..2d5b04366 --- /dev/null +++ b/openslides/mediafiles/migrations/0004_auto_20161212_1612.py @@ -0,0 +1,31 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.10.4 on 2016-12-12 15:12 +from __future__ import unicode_literals + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('mediafiles', '0003_auto_20160514_1347'), + ] + + operations = [ + migrations.AlterModelOptions( + name='mediafile', + options={ + 'default_permissions': (), + 'ordering': ['title'], + 'permissions': ( + ('can_see', 'Can see the list of files'), + ('can_see_hidden', 'Can see hidden files'), + ('can_upload', 'Can upload files'), + ('can_manage', 'Can manage files'))}, + ), + migrations.RenameField( + model_name='mediafile', + old_name='private', + new_name='hidden', + ), + ] diff --git a/openslides/mediafiles/models.py b/openslides/mediafiles/models.py index 5a664288e..60d7424bb 100644 --- a/openslides/mediafiles/models.py +++ b/openslides/mediafiles/models.py @@ -30,8 +30,8 @@ class Mediafile(RESTModelMixin, models.Model): blank=True) """A user – the uploader of a file.""" - private = models.BooleanField(default=False) - """Whether or not this mediafile should be listed as private""" + hidden = models.BooleanField(default=False) + """Whether or not this mediafile should be marked as hidden""" timestamp = models.DateTimeField(auto_now_add=True) """A DateTimeField to save the upload date and time.""" @@ -44,7 +44,7 @@ class Mediafile(RESTModelMixin, models.Model): default_permissions = () permissions = ( ('can_see', 'Can see the list of files'), - ('can_see_private', 'Can see private files'), + ('can_see_hidden', 'Can see hidden files'), ('can_upload', 'Can upload files'), ('can_manage', 'Can manage files')) diff --git a/openslides/mediafiles/serializers.py b/openslides/mediafiles/serializers.py index 3eacc057b..e2f12680f 100644 --- a/openslides/mediafiles/serializers.py +++ b/openslides/mediafiles/serializers.py @@ -63,7 +63,7 @@ class MediafileSerializer(ModelSerializer): 'media_url_prefix', 'uploader', 'filesize', - 'private', + 'hidden', 'timestamp',) def get_filesize(self, mediafile): diff --git a/openslides/mediafiles/static/js/mediafiles/site.js b/openslides/mediafiles/static/js/mediafiles/site.js index 4bc78eaec..8a42a526e 100644 --- a/openslides/mediafiles/static/js/mediafiles/site.js +++ b/openslides/mediafiles/static/js/mediafiles/site.js @@ -107,11 +107,11 @@ angular.module('OpenSlidesApp.mediafiles.site', ['ngFileUpload', 'OpenSlidesApp. if (!$scope.filter.existsStorageEntry()) { $scope.filter.booleanFilters = { - isPrivate: { + isHidden: { value: undefined, - displayName: gettext('Private'), - choiceYes: gettext('Is private'), - choiceNo: gettext('Is not private'), + displayName: gettext('Hidden'), + choiceYes: gettext('Is hidden'), + choiceNo: gettext('Is not hidden'), needExtraPermission: true, }, isPdf: { @@ -403,7 +403,7 @@ angular.module('OpenSlidesApp.mediafiles.site', ['ngFileUpload', 'OpenSlidesApp. return Upload.upload({ url: '/rest/mediafiles/mediafile/', method: 'POST', - data: {mediafile: mediafile.newFile, title: mediafile.title, uploader_id: mediafile.uploader_id, private: mediafile.private} + data: {mediafile: mediafile.newFile, title: mediafile.title, uploader_id: mediafile.uploader_id, hidden: mediafile.hidden} }); } @@ -411,16 +411,16 @@ angular.module('OpenSlidesApp.mediafiles.site', ['ngFileUpload', 'OpenSlidesApp. } ]) -.filter('privateFilter', [ +.filter('hiddenFilter', [ '$filter', 'operator', function ($filter, operator) { return function (array) { - if (operator.hasPerms('mediafiles.can_see_private')) { + if (operator.hasPerms('mediafiles.can_see_hidden')) { return array; } return Array.prototype.filter.call(array, function (item) { - return !item.private; + return !item.hidden; }); }; } diff --git a/openslides/mediafiles/static/templates/mediafiles/mediafile-form.html b/openslides/mediafiles/static/templates/mediafiles/mediafile-form.html index 167979d84..53d829f5a 100644 --- a/openslides/mediafiles/static/templates/mediafiles/mediafile-form.html +++ b/openslides/mediafiles/static/templates/mediafiles/mediafile-form.html @@ -21,12 +21,15 @@ - -
-