Files
openfoodnetwork/app/views/admin/order_cycles/edit.html.haml
2016-05-25 08:10:20 +10:00

41 lines
1.7 KiB
Plaintext

- content_for :page_actions do
:javascript
function toggleSettings(){
if( $('#advanced_settings').is(":visible") ){
$('button#toggle_settings i').switchClass("icon-chevron-up","icon-chevron-down")
}
else {
$('button#toggle_settings i').switchClass("icon-chevron-down","icon-chevron-up")
}
$("#advanced_settings").slideToggle()
}
- if can? :notify_producers, @order_cycle
%li
= button_to "Notify producers", main_app.notify_producers_admin_order_cycle_path, :id => 'admin_notify_producers', :confirm => 'Are you sure?'
%li
%button#toggle_settings{ onClick: 'toggleSettings()' }
Advanced Settings
%i.icon-chevron-down
#advanced_settings{ hidden: true }
= render partial: "/admin/order_cycles/advanced_settings"
%h1
= t :edit_order_cycle
- ng_controller = order_cycles_simple_form ? 'AdminSimpleEditOrderCycleCtrl' : 'AdminEditOrderCycleCtrl'
= form_for [main_app, :admin, @order_cycle], :url => '', :html => {:class => 'ng order_cycle', 'ng-app' => 'admin.orderCycles', 'ng-controller' => ng_controller, name: 'order_cycle_form'} do |f|
%save-bar{ dirty: "order_cycle_form.$dirty", persist: "true" }
%input.red{ type: "button", value: "Update", ng: { click: "submit($event, null)", disabled: "!order_cycle_form.$dirty" } }
%input.red{ type: "button", value: "Update and Close", ng: { click: "submit($event, '#{main_app.admin_order_cycles_path}')", disabled: "!order_cycle_form.$dirty" } }
%input{ type: "button", ng: { value: "order_cycle_form.$dirty ? 'Cancel' : 'Close'", click: "cancel('#{main_app.admin_order_cycles_path}')" } }
- if order_cycles_simple_form
= render 'simple_form', f: f
- else
= render 'form', f: f