diff --git a/app/assets/javascripts/app/controllers/layout_ref.coffee b/app/assets/javascripts/app/controllers/layout_ref.coffee index 226395d90..276209ee0 100644 --- a/app/assets/javascripts/app/controllers/layout_ref.coffee +++ b/app/assets/javascripts/app/controllers/layout_ref.coffee @@ -1474,7 +1474,25 @@ class InputsRef extends App.ControllerContent name: 'project-name' id: 'project-name-123' placeholder: 'Enter Project Name' - options: [{value:0,name:'Apple',selected:true},{value:1,name:'Microsoft',selected:true},{value:2,name:'Google'},{value:3,name:'Deutsche Bahn'},{value:4,name:'Sparkasse'},{value:5,name:'Deutsche Post'},{value:6,name:'Mitfahrzentrale'},{value:7,name:'Starbucks'},{value:8,name:'Mac Donalds'},{value:9,name:'Flixbus'},{value:10,name:'Betahaus'},{value:11,name:'Bruno Banani'},{value:12,name:'Alpina'},{value:13,name:'Samsung'},{value:14,name:'ChariTea'},{value:15,name:'fritz-kola'},{value:16,name:'Vitamin Water'},{value:17,name:'Znuny'},{value:18,name:'Max & Moritz'}] + options: [{value:0,name:'Apple',selected:true}, + {value:1,name:'Microsoft',selected:true}, + {value:2,name:'Google'}, + {value:3,name:'Deutsche Bahn'}, + {value:4,name:'Sparkasse'}, + {value:5,name:'Deutsche Post'}, + {value:6,name:'Mitfahrzentrale'}, + {value:7,name:'Starbucks'}, + {value:8,name:'Mac Donalds'}, + {value:9,name:'Flixbus'}, + {value:10,name:'Betahaus'}, + {value:11,name:'Bruno Banani'}, + {value:12,name:'Alpina'}, + {value:13,name:'Samsung'}, + {value:14,name:'ChariTea'}, + {value:15,name:'fritz-kola'}, + {value:16,name:'Vitamin Water'}, + {value:17,name:'Znuny'}, + {value:18,name:'Max & Moritz'}] @$('.searchableSelectPlaceholder').replaceWith( searchableSelectObject.element() ) # selectable search @@ -1535,7 +1553,32 @@ class InputsRef extends App.ControllerContent attribute: name: 'company-name' id: 'company-name-12345' - options: [{value:0,name:'Apple'},{value:1,name:'Microsoft',selected:true},{value:2,name:'Google'},{value:3,name:'Deutsche Bahn'},{value:4,name:'Sparkasse'},{value:5,name:'Deutsche Post'},{value:6,name:'Mitfahrzentrale'},{value:7,name:'Starbucks'},{value:8,name:'Mac Donalds'},{value:9,name:'Flixbus'},{value:10,name:'Betahaus'},{value:11,name:'Bruno Banani'},{value:12,name:'Alpina'},{value:13,name:'Samsung'},{value:14,name:'ChariTea'},{value:15,name:'fritz-kola'},{value:16,name:'Vitamin Water'},{value:17,name:'Znuny'},{value:18,name:'Max & Moritz'},{value:19,name:'Telefónica Deutschland Holding GmbH'}] + options: [ + {label:'Group A', group: [ + {value:0,name:'Apple'}, + {value:1,name:'Microsoft',selected:true}, + {value:2,name:'Google'}, + {value:3,name:'Deutsche Bahn'}, + {value:4,name:'Sparkasse'}, + {value:5,name:'Deutsche Post'}, + {value:6,name:'Mitfahrzentrale'} + ]}, + {label:'Group B', group: [ + {value:7,name:'Starbucks'}, + {value:8,name:'Mac Donalds'}, + {value:9,name:'Flixbus'}, + {value:10,name:'Betahaus'}, + {value:11,name:'Bruno Banani'}, + {value:12,name:'Alpina'}, + {value:13,name:'Samsung'}, + {value:14,name:'ChariTea'}, + {value:15,name:'fritz-kola'}, + {value:16,name:'Vitamin Water'}, + {value:17,name:'Znuny'}, + {value:18,name:'Max & Moritz'}, + {value:19,name:'Telefónica Deutschland Holding GmbH'} + ]} + ] @$('.columnSelectPlaceholder').replaceWith( columnSelectObject.element() ) App.Config.set( 'layout_ref/inputs', InputsRef, 'Routes' ) diff --git a/app/assets/javascripts/app/lib/app_post/column_select.coffee b/app/assets/javascripts/app/lib/app_post/column_select.coffee index a38cca006..c1a38c777 100644 --- a/app/assets/javascripts/app/lib/app_post/column_select.coffee +++ b/app/assets/javascripts/app/lib/app_post/column_select.coffee @@ -42,22 +42,37 @@ class App.ColumnSelect extends Spine.Controller if !_.isEmpty(@attribute.seperator) values = [] if @attribute.value - values = @attribute.value.split(';') + values = @attribute.value.split(@attribute.seperator) else if @attribute.default - values = @attribute.default.split(';') + values = @attribute.default.split(@attribute.seperator) for value in values for option in @options.attribute.options - if option.value is value + # is grouped + if option.group is not undefined + for o in option.group + if o.value is value + o.selected = true + else if option.value is value option.selected = true @values = [] + allOptions = [] _.each @options.attribute.options, (option) => - if option.selected - @values.push option.value.toString() + # is grouped + if option.group != undefined + for o in option.group + allOptions.push(o) + if o.selected + @values.push o.value.toString() + else + allOptions.push(option) + if option.selected + @values.push option.value.toString() @html App.view('generic/column_select')( attribute: @options.attribute + allOptions: allOptions values: @values ) diff --git a/app/assets/javascripts/app/views/generic/column_select.jst.eco b/app/assets/javascripts/app/views/generic/column_select.jst.eco index 196bcb833..e5a29f295 100644 --- a/app/assets/javascripts/app/views/generic/column_select.jst.eco +++ b/app/assets/javascripts/app/views/generic/column_select.jst.eco @@ -10,19 +10,19 @@ value="<%= @attribute.value %>" multiple > - <% for option in @attribute.options: %> + <% for option in @allOptions: %> <% end %> <% end %>
<%- @T('Nothing selected') %>
- <% for option in @attribute.options: %> + <% for option in @allOptions: %>
<%= option.name %>
<% end %>
- <% if @attribute.options.length > 10: %> + <% if @allOptions.length > 10: %> \ No newline at end of file diff --git a/app/assets/stylesheets/zammad.scss b/app/assets/stylesheets/zammad.scss index 35579edfe..5e5d86eb9 100644 --- a/app/assets/stylesheets/zammad.scss +++ b/app/assets/stylesheets/zammad.scss @@ -10045,17 +10045,17 @@ output { padding: 0; line-height: 22px; - .columnSelect-shadow { + &-shadow { display: none; } - .columnSelect-column--selected { + &-column--selected { flex: 1 1 66%; overflow: auto; padding: 7px; } - .columnSelect-column--sidebar { + &-column--sidebar { flex-basis: 33%; flex-shrink: 1; border-left: 1px solid hsl(198,4%,90%); @@ -10069,13 +10069,13 @@ output { } } - .columnSelect-pool { + &-pool { flex: 1 1 auto; overflow: auto; padding: 7px; } - .columnSelect-option { + &-option { @extend %clickable; padding: 0 5px; border-radius: 1px; @@ -10088,41 +10088,49 @@ output { } } + &-divider { + opacity: 0.5; + + ~ .columnSelect-option { + padding-left: 10px; + } + } + .is-hidden, .is-filtered { display: none; } -} -.columnSelect-search { - position: relative; + &-search { + position: relative; - .icon { - fill: hsl(198,4%,85%); - } + .icon { + fill: hsl(198,4%,85%); + } - .icon-magnifier { - left: 7px; - top: 5px; - position: absolute; - } + .icon-magnifier { + left: 7px; + top: 5px; + position: absolute; + } - .columnSelect-search-clear { - position: absolute; - right: 0; - top: 0; - padding: 5px 7px; - @extend %clickable; - line-height: 1; - } + &-clear { + position: absolute; + right: 0; + top: 0; + padding: 5px 7px; + @extend %clickable; + line-height: 1; + } - input { - width: 100%; - padding: 2px 30px 1px; - border: none; - outline: none; - border-bottom: 1px solid hsl(198,4%,90%); - background: none; + input { + width: 100%; + padding: 2px 30px 1px; + border: none; + outline: none; + border-bottom: 1px solid hsl(198,4%,90%); + background: none; + } } }