Fix destroy problem and add section area explanation

This commit is contained in:
2015-03-24 17:35:43 +01:00
parent 7fb2a0f08c
commit c5d6252c7a
14 changed files with 33 additions and 21 deletions
@@ -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))
+4 -1
View File
@@ -16,4 +16,7 @@
= link_to t("helpers.links.destroy"), [:admin, svg_element], method: :delete, data: {confirm: are_you_sure? }, class: 'table-destroy-button'
- else
= no_content_given model_class
= link_to t("helpers.links.new"), new_admin_svg_element_path, class: 'record-new-button'
/= link_to t("helpers.links.new"), new_admin_svg_element_path, class: 'record-new-button'
- content_for :page_links do
ul
li= link_to link_to_new_content(SvgElement), main_app.new_admin_svg_element_path, class: 'record-new-button'
+8 -12
View File
@@ -1,16 +1,12 @@
- model_class = SvgElement
.page-header= title :show, @svg_element
- title :show, @svg_element
dl.dl-horizontal.show-list
dt= model_class.human_attribute_name(:number)
dd= @svg_element.number
- if @svg_element.supplier.present?
dt= Supplier.model_name.human
dd= link_to @svg_element.supplier.name, [:admin, @svg_element.supplier]
dt= model_class.human_attribute_name(:name)
dd= @svg_element.name
.form-actions
= link_to t("helpers.links.back"), admin_svg_elements_path, class: 'btn'
'
= link_to t('helpers.links.edit'), [:edit, :admin, @svg_element], class: 'btn'
'
= link_to t("helpers.links.destroy"), [:admin, @svg_element], method: :delete, data: {confirm: are_you_sure? }, class: 'btn btn-danger'
- content_for :page_links do
ul
li=link_to link_to_index_content(SvgElement), main_app.admin_svg_elements_path, class: 'to-index-button'
li=link_to link_to_edit_content(@svg_element), main_app.edit_admin_svg_element_path(@svg_element), class: 'record-edit-button'
li= link_to link_to_destroy_content(@svg_element), [:admin, @svg_element], method: :delete, data: {confirm: are_you_sure?}, class: 'record-destroy-button'