Fixed #159 - attachment lost with no text. Introduced small modals for alerts.

This commit is contained in:
Martin Edenhofer 2015-12-09 16:14:43 +01:00
parent dcc6f60b26
commit 4e6e03a494
4 changed files with 34 additions and 16 deletions

View file

@ -590,12 +590,14 @@ class App.ControllerModalNice extends App.Controller
backdrop: true backdrop: true
keyboard: true keyboard: true
large: false large: false
small: false
head: '?' head: '?'
container: null container: null
buttonClass: 'btn--success' buttonClass: 'btn--success'
centerButtons: [] centerButtons: []
buttonClose: true buttonClose: true
buttonCancel: false buttonCancel: false
buttonCancelClass: 'btn--text btn--subtle'
buttonSubmit: true buttonSubmit: true
headPrefix: '' headPrefix: ''
shown: true shown: true
@ -609,7 +611,6 @@ class App.ControllerModalNice extends App.Controller
className: 'modal fade' className: 'modal fade'
constructor: -> constructor: ->
@className += ' modal--large' if @large
super super
# rerender view, e. g. on langauge change # rerender view, e. g. on langauge change
@ -637,6 +638,7 @@ class App.ControllerModalNice extends App.Controller
detail: @detail detail: @detail
buttonClose: @buttonClose buttonClose: @buttonClose
buttonCancel: @buttonCancel buttonCancel: @buttonCancel
buttonCancelClass: @buttonCancelClass
buttonSubmit: @buttonSubmit buttonSubmit: @buttonSubmit
buttonClass: @buttonClass buttonClass: @buttonClass
centerButtons: @centerButtons centerButtons: @centerButtons
@ -662,6 +664,10 @@ class App.ControllerModalNice extends App.Controller
if @container if @container
@el.addClass('modal--local') @el.addClass('modal--local')
if @large
@el.addClass('modal--large')
if @small
@el.addClass('modal--small')
@el.modal @el.modal
keyboard: @keyboard keyboard: @keyboard

View file

@ -571,7 +571,16 @@ class App.TicketZoom extends App.Controller
# check if attachment exists but no body # check if attachment exists but no body
attachmentCount = @$('.article-add .textBubble .attachments .attachment').length attachmentCount = @$('.article-add .textBubble .attachments .attachment').length
if !articleParams['body'] && attachmentCount > 0 if !articleParams['body'] && attachmentCount > 0
if !confirm( App.i18n.translateContent('Please fill also some text in!') ) new App.ControllerModalNice(
head: 'Text missing'
buttonCancel: 'Cancel'
buttonCancelClass: 'btn--danger'
buttonSubmit: false
message: 'Please fill also some text in!'
shown: true
small: true
container: @el.closest('.content')
)
@formEnable(e) @formEnable(e)
@autosaveStart() @autosaveStart()
return return

View file

@ -15,7 +15,7 @@
<div class="modal-footer"> <div class="modal-footer">
<% if @buttonCancel: %> <% if @buttonCancel: %>
<div class="modal-leftFooter"> <div class="modal-leftFooter">
<a class="btn btn--text btn--subtle js-cancel align-left" href="#/"><%- @T(@buttonCancel) %></a> <a class="btn <%= @buttonCancelClass %> js-cancel align-left" href="#/"><%- @T(@buttonCancel) %></a>
</div> </div>
<% end %> <% end %>
<% for button in @centerButtons: %> <% for button in @centerButtons: %>

View file

@ -5275,6 +5275,9 @@ footer {
.modal--large .modal-dialog { .modal--large .modal-dialog {
max-width: 740px; max-width: 740px;
} }
.modal--small .modal-dialog {
max-width: 440px;
}
.modal-dialog.wizard { .modal-dialog.wizard {
max-width: 460px; max-width: 460px;
} }