Fix destroy problem and add section area explanation
This commit is contained in:
@@ -59,9 +59,9 @@
|
||||
if @get('model.isValid')
|
||||
@get('model').save().then @save_success.bind(@), @save_error.bind(@)
|
||||
#@send 'closeModal' unless @preventClose
|
||||
destroy: ->
|
||||
destroyRecord: ->
|
||||
my_scope = @
|
||||
destroy_callback = @get('modal_options.destroy')
|
||||
destroy_callback = @get('modal_options.destroy_callback')
|
||||
@modal 'confirm',
|
||||
title_path: @get('modal_options.destroy_text_path') || 'general.destroy.text'
|
||||
model: @get('model')
|
||||
|
||||
@@ -11,4 +11,4 @@ App.ScheduleController = Ember.ArrayController.extend
|
||||
destroy_text_path: 'employee_shift.modal.destroy_confirmation'
|
||||
model: employee_shift
|
||||
save: -> callbacks.save.call(@, employee_shift) if callbacks.save
|
||||
destroy: -> callbacks.destroy.call(@, employee_shift) if callbacks.destroy
|
||||
destroy_callback: -> callbacks.destroy.call(@, employee_shift) if callbacks.destroy
|
||||
|
||||
@@ -37,10 +37,16 @@ App.SectionController = Ember.ObjectController.extend
|
||||
addSectionArea: ->
|
||||
section_area = @store.createRecord('section-area')
|
||||
section_area.set 'section', @get('model')
|
||||
@set 'editmode', true
|
||||
@modal 'section_area',
|
||||
title_path: 'section_area.add_button'
|
||||
model: section_area
|
||||
ok: => @send 'makeEditable'
|
||||
close: =>
|
||||
if section_area.get('isNew')
|
||||
section_area.deleteRecord()
|
||||
else
|
||||
section_area.rollback()
|
||||
removeSectionElement: (section_element)-> section_element.destroyRecord()
|
||||
textures: ['wood1', 'wood2']
|
||||
|
||||
|
||||
@@ -11,5 +11,5 @@ hr
|
||||
button.modal-close{action "close"}=t 'employee_shift.modal.close_button'
|
||||
button.modal-confirm.right{action "save"} disabled=model.isInvalid
|
||||
=t 'employee_shift.modal.save_button'
|
||||
button.modal-destroy.right{action "destroy"}
|
||||
button.modal-destroy.right{action "destroyRecord"}
|
||||
=t 'employee_shift.modal.destroy_button'
|
||||
|
||||
@@ -3,4 +3,4 @@ p=t 'product_category.modal.edit.body_header'
|
||||
hr
|
||||
button.modal-close{action "close"}=t 'product_category.modal.edit.close_button'
|
||||
button.modal-save.right{action "save"}=t 'product_category.modal.edit.save_button'
|
||||
button.modal-destroy.right{action "destroy"}=t 'product_category.modal.edit.destroy_button'
|
||||
button.modal-destroy.right{action "destroyRecord"}=t 'product_category.modal.edit.destroy_button'
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
p= t 'section_area.modal.explanation'
|
||||
.form-row.title
|
||||
.form-label=t 'attributes.section_area.title'
|
||||
.form-field
|
||||
@@ -18,4 +19,4 @@ hr
|
||||
button.modal-close{action "close"}=t 'section_area.modal.close_button'
|
||||
button.modal-confirm.right{action "save"} disabled=model.isInvalid
|
||||
=t 'section_area.modal.save_button'
|
||||
button.modal-destroy.right{action "destroy"}= t 'section_area.modal.destroy_button'
|
||||
button.modal-destroy.right{action "destroyRecord"}= t 'section_area.modal.destroy_button'
|
||||
|
||||
@@ -23,7 +23,6 @@ $.extend($translations.en, <%= I18n.t('supplier', locale: :en).to_json %>);
|
||||
$.extend($translations.nl, <%= I18n.t('supplier', locale: :nl).to_json %>);
|
||||
|
||||
String.prototype.capitalize = function() { return this.charAt(0).toUpperCase() + this.slice(1); }
|
||||
|
||||
window.time_zones = <%= ActiveSupport::TimeZone.all.map{|tz| {name: tz.name, formatted: "GMT#{tz.formatted_offset} #{tz.name}"}}.to_json.html_safe %>;
|
||||
window.countries = <%= IsoCountryCodes.all.map{|cc| {name: cc.name}}.to_json.html_safe %>;
|
||||
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
return "" unless minutes
|
||||
[("0" + Math.floor(minutes/60)).substr(-2,2), ("0" + Math.floor(minutes%60)).substr(-2,2)].join(":")
|
||||
|
||||
|
||||
@ttry = (path, vars={})->
|
||||
@t(path, $.extend(vars, emptyWhenNotFound: true))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user