mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-24 20:36:49 +00:00
DRY up code
Slightly. If we upgrade to Ruby 3.1 with hash value omission, this would be neater. If we could set a scope in the controller (https://stackoverflow.com/questions/6137960/rails-i18n-default-scope) it would be even neater.
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
.row
|
||||
.three.columns.alpha
|
||||
= f.label :name, t('admin.enterprises.form.primary_details.name')
|
||||
= f.label :name, t('primary_details.name', scope: scope)
|
||||
%span.required *
|
||||
.nine.columns.omega
|
||||
= f.text_field :name, { placeholder: t('admin.enterprises.form.primary_details.name_placeholder'), class: "fullwidth" }
|
||||
= f.text_field :name, { placeholder: t('primary_details.name_placeholder', scope: scope), class: "fullwidth" }
|
||||
|
||||
- if spree_current_user.admin?
|
||||
.row
|
||||
@@ -17,8 +17,8 @@
|
||||
= f.hidden_field :owner_id, class: "select2 fullwidth", 'user-select' => 'Enterprise.owner'
|
||||
.row
|
||||
.three.columns.alpha
|
||||
%label= t('admin.enterprises.form.primary_details.primary_producer')
|
||||
%div{'ofn-with-tip' => t('admin.enterprises.form.primary_details.primary_producer_tip')}
|
||||
%label= t('primary_details.primary_producer', scope: scope)
|
||||
%div{'ofn-with-tip' => t('primary_details.primary_producer_tip', scope: scope)}
|
||||
%a= t('admin.whats_this')
|
||||
.five.columns.omega
|
||||
= f.check_box :is_primary_producer, 'ng-model' => 'Enterprise.is_primary_producer'
|
||||
@@ -28,42 +28,42 @@
|
||||
.row
|
||||
.alpha.eleven.columns
|
||||
.three.columns.alpha
|
||||
= f.label :sells, t('admin.enterprises.form.primary_details.sells')
|
||||
%div{'ofn-with-tip' => t('admin.enterprises.form.primary_details.sells_tip')}
|
||||
= f.label :sells, t('primary_details.sells', scope: scope)
|
||||
%div{'ofn-with-tip' => t('primary_details.sells_tip', scope: scope)}
|
||||
%a What's this?
|
||||
.two.columns
|
||||
= f.radio_button :sells, "none", 'ng-model' => 'Enterprise.sells'
|
||||
|
||||
= f.label :sells, t('admin.enterprises.form.primary_details.none'), value: "none"
|
||||
= f.label :sells, t('primary_details.none', scope: scope), value: "none"
|
||||
.two.columns
|
||||
= f.radio_button :sells, "own", 'ng-model' => 'Enterprise.sells'
|
||||
|
||||
= f.label :sells, t('admin.enterprises.form.primary_details.own'), value: "own"
|
||||
= f.label :sells, t('primary_details.own', scope: scope), value: "own"
|
||||
.four.columns.omega
|
||||
= f.radio_button :sells, "any", 'ng-model' => 'Enterprise.sells'
|
||||
|
||||
= f.label :sells, t('admin.enterprises.form.primary_details.any'), value: "any"
|
||||
= f.label :sells, t('primary_details.any', scope: scope), value: "any"
|
||||
|
||||
.row
|
||||
.alpha.three.columns
|
||||
= f.label :contact_name, t('.contact_name')
|
||||
.omega.nine.columns
|
||||
= f.text_field :contact_name, { placeholder: t('admin.enterprises.form.contact.name_placeholder')}
|
||||
= f.text_field :contact_name, { placeholder: t('contact.name_placeholder', scope: scope)}
|
||||
.row
|
||||
.alpha.three.columns
|
||||
= f.label :email_address, t('admin.enterprises.form.contact.email_address')
|
||||
= f.label :email_address, t('contact.email_address', scope: scope)
|
||||
.omega.nine.columns
|
||||
= f.text_field :email_address, { placeholder: t('admin.enterprises.form.contact.email_address_placeholder'), "ng-model" => "Enterprise.email_address" }
|
||||
= f.text_field :email_address, { placeholder: t('contact.email_address_placeholder', scope: scope), "ng-model" => "Enterprise.email_address" }
|
||||
.row
|
||||
.alpha.three.columns
|
||||
= f.label :phone, t('admin.enterprises.form.contact.phone')
|
||||
= f.label :phone, t('contact.phone', scope: scope)
|
||||
.omega.nine.columns
|
||||
= f.text_field :phone, { placeholder: t('admin.enterprises.form.contact.phone_placeholder')}
|
||||
= f.text_field :phone, { placeholder: t('contact.phone_placeholder', scope: scope)}
|
||||
.row
|
||||
.alpha.three.columns
|
||||
= f.label :website, t('admin.enterprises.form.contact.website')
|
||||
= f.label :website, t('contact.website', scope: scope)
|
||||
.omega.nine.columns
|
||||
= f.text_field :website, { placeholder: t('admin.enterprises.form.contact.website_placeholder')}
|
||||
= f.text_field :website, { placeholder: t('contact.website_placeholder', scope: scope)}
|
||||
|
||||
= f.fields_for :address do |af|
|
||||
.row
|
||||
|
||||
@@ -17,4 +17,4 @@
|
||||
= form_for [main_app, :admin, @enterprise], html: { "nav-check" => '', "nav-callback" => '' } do |f|
|
||||
.row
|
||||
.twelve.columns.fullwidth_inputs{ ng: { controller: "NewEnterpriseController" } }
|
||||
= render 'new_form', f: f
|
||||
= render 'new_form', f: f, scope: 'admin.enterprises.form'
|
||||
|
||||
Reference in New Issue
Block a user