Merge branch 'develop' of github.com:martini/zammad into develop

This commit is contained in:
Martin Edenhofer 2016-02-09 21:01:14 +01:00
commit 6ede7e5365
5 changed files with 33 additions and 18 deletions

View file

@ -1521,7 +1521,7 @@ class InputsRef extends App.ControllerContent
attribute: attribute:
name: 'company-name' name: 'company-name'
id: 'company-name-12345' 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'}] 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'}]
@$('.columnSelectPlaceholder').replaceWith( columnSelectObject.element() ) @$('.columnSelectPlaceholder').replaceWith( columnSelectObject.element() )
App.Config.set( 'layout_ref/inputs', InputsRef, 'Routes' ) App.Config.set( 'layout_ref/inputs', InputsRef, 'Routes' )

View file

@ -68,7 +68,7 @@ class App.ColumnSelect extends Spine.Controller
@poolOptions.each (i, el) -> @poolOptions.each (i, el) ->
return if $(el).hasClass('is-hidden') return if $(el).hasClass('is-hidden')
if $(el).text().indexOf(filter) > -1 if $(el).text().toLowerCase().indexOf(filter.toLowerCase()) > -1
$(el).removeClass 'is-filtered' $(el).removeClass 'is-filtered'
else else
$(el).addClass 'is-filtered' $(el).addClass 'is-filtered'

View file

@ -3,6 +3,7 @@ class App.SearchableSelect extends Spine.Controller
events: events:
'input .js-input': 'onInput' 'input .js-input': 'onInput'
'blur .js-input': 'onBlur' 'blur .js-input': 'onBlur'
'focus .js-input': 'onFocus'
'click .js-option': 'selectItem' 'click .js-option': 'selectItem'
'mouseenter .js-option': 'highlightItem' 'mouseenter .js-option': 'highlightItem'
'shown.bs.dropdown': 'onDropdownShown' 'shown.bs.dropdown': 'onDropdownShown'
@ -97,14 +98,16 @@ class App.SearchableSelect extends Spine.Controller
caretPosition = @invisiblePart.text().length + 1 caretPosition = @invisiblePart.text().length + 1
@input.val @suggestion @input.val @suggestion
@shadowInput.val @suggestionValue
@clearAutocomplete() @clearAutocomplete()
@toggle() @toggle()
@input.prop('selectionStart', caretPosition) @input.prop('selectionStart', caretPosition)
@input.prop('selectionEnd', caretPosition) @input.prop('selectionEnd', caretPosition)
autocomplete: (text) -> autocomplete: (value, text) ->
@suggestion = text @suggestion = text
@suggestionValue = value
startIndex = text.indexOf(@query) startIndex = text.indexOf(@query)
if !@query or startIndex != 0 if !@query or startIndex != 0
@ -146,7 +149,12 @@ class App.SearchableSelect extends Spine.Controller
@toggle() @toggle()
onBlur: -> onBlur: ->
# @clearAutocomplete() @clearAutocomplete()
onFocus: ->
textEnd = @input.val().length
@input.prop('selectionStart', textEnd)
@input.prop('selectionEnd', textEnd)
onInput: (event) => onInput: (event) =>
@toggle() if not @isOpen @toggle() if not @isOpen
@ -163,12 +171,14 @@ class App.SearchableSelect extends Spine.Controller
@textContent.match(regex) @textContent.match(regex)
.removeClass 'is-hidden' .removeClass 'is-hidden'
@highlightFirst() @highlightFirst(true)
highlightFirst: -> highlightFirst: (autocomplete) ->
first = @option_items.removeClass('is-active').not('.is-hidden').first() first = @option_items.removeClass('is-active').not('.is-hidden').first()
first.addClass 'is-active' first.addClass 'is-active'
@autocomplete first.text().trim()
if autocomplete
@autocomplete first.attr('data-value'), first.text().trim()
highlightItem: (event) => highlightItem: (event) =>
@option_items.removeClass('is-active') @option_items.removeClass('is-active')

View file

@ -12,7 +12,7 @@
<% end %> <% end %>
</select> </select>
<div class="columnSelect-column columnSelect-column--selected js-selected"> <div class="columnSelect-column columnSelect-column--selected js-selected">
<div class="u-placeholder js-placeholder"><%- @T('Nothing selected') %></div> <div class="u-placeholder u-unselectable js-placeholder"><%- @T('Nothing selected') %></div>
<% for option in @options: %> <% for option in @options: %>
<div class="columnSelect-option is-hidden js-remove js-option" data-value="<%= option.value %>"><%= option.name %></div> <div class="columnSelect-option is-hidden js-remove js-option" data-value="<%= option.value %>"><%= option.name %></div>
<% end %> <% end %>
@ -29,7 +29,7 @@
<% end %> <% end %>
<div class="columnSelect-pool js-pool"> <div class="columnSelect-pool js-pool">
<% for option in @options: %> <% for option in @options: %>
<div class="columnSelect-option js-select js-option" data-value="<%= option.value %>"><%= option.name %></div> <div class="columnSelect-option js-select js-option" data-value="<%= option.value %>" title="<%= option.name %>"><%= option.name %></div>
<% end %> <% end %>
</div> </div>
</div> </div>

View file

@ -123,6 +123,11 @@ blockquote {
user-select: none; user-select: none;
} }
.u-unselectable {
pointer-events: none;
user-select: none;
}
.u-textTruncate { .u-textTruncate {
white-space: nowrap; white-space: nowrap;
overflow: hidden; overflow: hidden;
@ -7036,7 +7041,7 @@ output {
.searchableSelect-autocomplete { .searchableSelect-autocomplete {
position: absolute; position: absolute;
left: 13px; left: 13px;
top: 10px; top: 11px;
right: 37px; right: 37px;
white-space: nowrap; white-space: nowrap;
overflow: hidden; overflow: hidden;
@ -7791,12 +7796,9 @@ output {
} }
} }
.columnSelect { .columnSelect {
height: 234px;
display: flex; display: flex;
height: auto;
line-height: 25px;
max-height: 300px;
padding: 0; padding: 0;
line-height: 22px; line-height: 22px;
@ -7804,9 +7806,8 @@ output {
display: none; display: none;
} }
.columnSelect-column--selected { .columnSelect-column--selected {
flex-basis: 66%; flex: 1 1 66%;
flex-grow: 1;
overflow: auto; overflow: auto;
padding: 7px; padding: 7px;
} }
@ -7817,10 +7818,11 @@ output {
border-left: 1px dotted hsl(0,0%,90%); border-left: 1px dotted hsl(0,0%,90%);
display: flex; display: flex;
flex-direction: column; flex-direction: column;
min-width: 0;
} }
.columnSelect-pool { .columnSelect-pool {
flex: 1; flex: 1 1 auto;
overflow: auto; overflow: auto;
padding: 7px; padding: 7px;
} }
@ -7830,6 +7832,9 @@ output {
user-select: none; user-select: none;
padding: 0 5px; padding: 0 5px;
border-radius: 1px; border-radius: 1px;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
&:hover { &:hover {
background: hsl(0,0%,96%); background: hsl(0,0%,96%);