Order attachments by title

This commit is contained in:
FinnStutzenstein 2018-04-11 12:56:34 +02:00
parent 2497969864
commit 30b307d309
3 changed files with 8 additions and 6 deletions

View File

@ -354,6 +354,7 @@ angular.module('OpenSlidesApp.motions.site', [
// Service for generic motion form (create and update) // Service for generic motion form (create and update)
.factory('MotionForm', [ .factory('MotionForm', [
'$filter',
'gettextCatalog', 'gettextCatalog',
'operator', 'operator',
'Editor', 'Editor',
@ -367,8 +368,8 @@ angular.module('OpenSlidesApp.motions.site', [
'Workflow', 'Workflow',
'Agenda', 'Agenda',
'AgendaTree', 'AgendaTree',
function (gettextCatalog, operator, Editor, MotionComment, Category, Config, Mediafile, MotionBlock, function ($filter, gettextCatalog, operator, Editor, MotionComment, Category,
Tag, User, Workflow, Agenda, AgendaTree) { Config, Mediafile, MotionBlock, Tag, User, Workflow, Agenda, AgendaTree) {
return { return {
// ngDialog for motion form // ngDialog for motion form
getDialog: function (motion) { getDialog: function (motion) {
@ -498,7 +499,7 @@ angular.module('OpenSlidesApp.motions.site', [
type: 'select-multiple', type: 'select-multiple',
templateOptions: { templateOptions: {
label: gettextCatalog.getString('Attachment'), label: gettextCatalog.getString('Attachment'),
options: Mediafile.getAll(), options: $filter('orderBy')(Mediafile.getAll(), 'title_or_filename'),
ngOptions: 'option.id as option.title_or_filename for option in to.options', ngOptions: 'option.id as option.title_or_filename for option in to.options',
placeholder: gettextCatalog.getString('Select or search an attachment ...') placeholder: gettextCatalog.getString('Select or search an attachment ...')
}, },

View File

@ -61,13 +61,14 @@ angular.module('OpenSlidesApp.topics.site', ['OpenSlidesApp.topics', 'OpenSlides
]) ])
.factory('TopicForm', [ .factory('TopicForm', [
'$filter',
'gettextCatalog', 'gettextCatalog',
'operator', 'operator',
'Editor', 'Editor',
'Mediafile', 'Mediafile',
'Agenda', 'Agenda',
'AgendaTree', 'AgendaTree',
function (gettextCatalog, operator, Editor, Mediafile, Agenda, AgendaTree) { function ($filter, gettextCatalog, operator, Editor, Mediafile, Agenda, AgendaTree) {
return { return {
// ngDialog for topic form // ngDialog for topic form
getDialog: function (topic) { getDialog: function (topic) {
@ -110,7 +111,7 @@ angular.module('OpenSlidesApp.topics.site', ['OpenSlidesApp.topics', 'OpenSlides
type: 'select-multiple', type: 'select-multiple',
templateOptions: { templateOptions: {
label: gettextCatalog.getString('Attachment'), label: gettextCatalog.getString('Attachment'),
options: Mediafile.getAll(), options: $filter('orderBy')(Mediafile.getAll(), 'title_or_filename'),
ngOptions: 'option.id as option.title_or_filename for option in to.options', ngOptions: 'option.id as option.title_or_filename for option in to.options',
placeholder: gettextCatalog.getString('Select or search an attachment ...') placeholder: gettextCatalog.getString('Select or search an attachment ...')
} }

View File

@ -30,7 +30,7 @@
<div ng-bind-html="topic.text | trusted" class="topictext"></div> <div ng-bind-html="topic.text | trusted" class="topictext"></div>
<h3 ng-if="topic.attachments.length > 0" translate>Attachments</h3> <h3 ng-if="topic.attachments.length > 0" translate>Attachments</h3>
<ul> <ul>
<li ng-repeat="attachment in topic.attachments"> <li ng-repeat="attachment in topic.attachments | orderBy: 'title_or_filename'">
<a href="{{ attachment.mediafileUrl }}" target="_blank"> <a href="{{ attachment.mediafileUrl }}" target="_blank">
{{ attachment.title_or_filename }} {{ attachment.title_or_filename }}
</a> </a>