ref: master
plugins/delivery/views/delivery_plugin/admin_method/_edit.html.slim
= form_for delivery_method, as: :delivery_method, url: request.GET.merge(controller: delivery_context, action: delivery_method.new_record? ? :new : :edit, id: delivery_method.id), html: {onsubmit: 'return delivery.method.save(this)'} do |f| = error_messages_for :delivery_method = labelled_field f, :delivery_type, t('delivery_plugin.models.method.delivery_type'), f.select(:delivery_type, DeliveryPlugin::Method::Types.map{ |t| [t("delivery_plugin.models.method.#{t}"), t] }, onchange: 'delivery.method.changeType(this)', onkeyup: 'this.onchange()'), help: t('delivery_plugin.models.method.delivery_type_help').html_safe = labelled_field f, :name, t('delivery_plugin.models.method.name'), f.text_field(:name), help: t('delivery_plugin.models.method.name_help').html_safe = labelled_field f, :description, t('delivery_plugin.models.method.instructions'), f.text_area(:description, rows: 5, class: current_editor('simple')), help: t('delivery_plugin.models.method.instructions_help').html_safe fieldset legend= t'delivery_plugin.models.method.costs_legend' = labelled_field f, :fixed_cost, t('delivery_plugin.models.method.fixed_cost'), input_group_addon(environment.currency_unit){ f.text_field :fixed_cost, type: :number, step: 'any', value: number_with_precision(delivery_method.fixed_cost, precision: 2, locale: :en)} = labelled_field f, :free_over_price, t('delivery_plugin.models.method.free_over_price'), input_group_addon(environment.currency_unit){ f.text_field :free_over_price, type: :number, step: 'any', value: number_with_precision(delivery_method.free_over_price, precision: 2, locale: :en)} fieldset legend= t'delivery_plugin.models.method.distribution_legend' = labelled_field f, :distribution_margin_percentage, t('delivery_plugin.models.method.distribution_margin_percentage'), input_group_addon('%'){ f.text_field :distribution_margin_percentage, type: :number, step: 'any', value: number_with_precision(delivery_method.distribution_margin_percentage, precision: 2, locale: :en)} = labelled_field f, :distribution_margin_fixed, t('delivery_plugin.models.method.distribution_margin_fixed'), input_group_addon(environment.currency_unit){ f.text_field :distribution_margin_fixed, type: :number, step: 'any', value: number_with_precision(delivery_method.distribution_margin_fixed, precision: 2, locale: :en)} div = submit_button :save, if delivery_method.new_record? then t('delivery_plugin.views.method.edit.add') else t('delivery_plugin.views.method.edit.save') end = link_to_function t('delivery_plugin.views.method.edit.back'), "delivery.method.view.toggle()"