From f58219eb3d39423431c97db465beb32e42b05cbd Mon Sep 17 00:00:00 2001 From: Rohan Mitchell Date: Fri, 20 Feb 2015 11:36:30 +1100 Subject: [PATCH] Split inputs into separate partials for each fieldset --- .../admin/enterprise_groups/_form.html.haml | 6 +- .../enterprise_groups/_form_about.html.haml | 6 + .../enterprise_groups/_form_address.html.haml | 36 +++++ .../enterprise_groups/_form_images.html.haml | 18 +++ .../_form_primary_details.html.haml | 30 +++++ .../enterprise_groups/_form_web.html.haml | 32 +++++ .../admin/enterprise_groups/_inputs.html.haml | 127 ------------------ 7 files changed, 127 insertions(+), 128 deletions(-) create mode 100644 app/views/admin/enterprise_groups/_form_about.html.haml create mode 100644 app/views/admin/enterprise_groups/_form_address.html.haml create mode 100644 app/views/admin/enterprise_groups/_form_images.html.haml create mode 100644 app/views/admin/enterprise_groups/_form_primary_details.html.haml create mode 100644 app/views/admin/enterprise_groups/_form_web.html.haml delete mode 100644 app/views/admin/enterprise_groups/_inputs.html.haml diff --git a/app/views/admin/enterprise_groups/_form.html.haml b/app/views/admin/enterprise_groups/_form.html.haml index c72c566e46..1b96909d3e 100644 --- a/app/views/admin/enterprise_groups/_form.html.haml +++ b/app/views/admin/enterprise_groups/_form.html.haml @@ -7,5 +7,9 @@ = render 'admin/shared/side_menu' .one.column   .eleven.columns.omega.fullwidth_inputs - = render 'inputs', f: f + = render 'form_primary_details', f: f + = render 'form_about', f: f + = render 'form_images', f: f + = render 'form_address', f: f + = render 'form_web', f: f = render "spree/admin/shared/#{action}_resource_links" diff --git a/app/views/admin/enterprise_groups/_form_about.html.haml b/app/views/admin/enterprise_groups/_form_about.html.haml new file mode 100644 index 0000000000..60d7276094 --- /dev/null +++ b/app/views/admin/enterprise_groups/_form_about.html.haml @@ -0,0 +1,6 @@ +%fieldset.alpha.no-border-bottom{ ng: { show: "menu.selected.name=='About'" } } + %legend About + = f.field_container :long_description do + = f.label :long_description + %br/ + = f.text_area :long_description diff --git a/app/views/admin/enterprise_groups/_form_address.html.haml b/app/views/admin/enterprise_groups/_form_address.html.haml new file mode 100644 index 0000000000..081af7110e --- /dev/null +++ b/app/views/admin/enterprise_groups/_form_address.html.haml @@ -0,0 +1,36 @@ += f.fields_for :address do |af| + %fieldset.alpha.no-border-bottom{ ng: { show: "menu.selected.name=='Contact'" } } + %legend Contact + .row + .alpha.three.columns + = af.label :phone + .omega.eight.columns + = af.text_field :phone, { placeholder: "eg. 98 7654 3210"} + .row + .three.columns.alpha + = af.label :address1 + .eight.columns.omega + = af.text_field :address1, { placeholder: "eg. 123 High Street"} + .row + .alpha.three.columns + = af.label :address2 + .eight.columns.omega + = af.text_field :address2 + .row + .three.columns.alpha + = af.label :city, 'Suburb' + \/ + = af.label :zipcode, 'Postcode' + .four.columns + = af.text_field :city, { placeholder: "eg. Northcote"} + .four.columns.omega + = af.text_field :zipcode, { placeholder: "eg. 3070"} + .row + .three.columns.alpha + = af.label :state_id, 'State' + \/ + = af.label :country_id, 'Country' + .four.columns + = af.collection_select :state_id, af.object.country.states, :id, :name, {}, :class => "select2 fullwidth" + .four.columns.omega + = af.collection_select :country_id, available_countries, :id, :name, {}, :class => "select2 fullwidth" diff --git a/app/views/admin/enterprise_groups/_form_images.html.haml b/app/views/admin/enterprise_groups/_form_images.html.haml new file mode 100644 index 0000000000..49169851c3 --- /dev/null +++ b/app/views/admin/enterprise_groups/_form_images.html.haml @@ -0,0 +1,18 @@ +%fieldset.alpha.no-border-bottom{ ng: { show: "menu.selected.name=='Images'" } } + %legend Images + .row + .alpha.three.columns + = f.label :logo, class: 'with-tip', 'data-powertip' => 'This is the logo' + .with-tip{'data-powertip' => 'This is the logo'} + %a What's this? + .omega.eight.columns + = image_tag @object.logo.url if @object.logo.present? + = f.file_field :logo + .row + .alpha.three.columns + = f.label :promo_image, class: 'with-tip', 'data-powertip' => 'This image is displayed at the top of the Group profile' + .with-tip{'data-powertip' => 'This image is displayed at the top of the Group profile'} + %a What's this? + .omega.eight.columns + = image_tag @object.promo_image.url if @object.promo_image.present? + = f.file_field :promo_image diff --git a/app/views/admin/enterprise_groups/_form_primary_details.html.haml b/app/views/admin/enterprise_groups/_form_primary_details.html.haml new file mode 100644 index 0000000000..27dec0701c --- /dev/null +++ b/app/views/admin/enterprise_groups/_form_primary_details.html.haml @@ -0,0 +1,30 @@ +%fieldset.alpha.no-border-bottom{ ng: { show: "menu.selected.name=='Primary Details'" } } + %legend Primary Details + = f.field_container :name do + = f.label :name + %br/ + = f.text_field :name + + = f.field_container :description do + = f.label :description + %br/ + = f.text_field :description + + - if spree_current_user.admin? + .row + .three.columns.alpha + =f.label :owner_id, 'Owner' + .with-tip{'data-powertip' => "The primary user responsible for this group."} + %a What's this? + .eight.columns.omega + = f.hidden_field :owner_id, class: "select2 fullwidth", 'ofn-user-autocomplete' => true, email: @owner_email + + = f.field_container :on_front_page do + = f.label :on_front_page, 'On front page?' + %br/ + = f.check_box :on_front_page + + = f.field_container :enterprise_ids do + = f.label :enterprise_ids, 'Enterprises' + %br/ + = f.collection_select :enterprise_ids, @enterprises, :id, :name, {}, {class: "select2 fullwidth", multiple: true} diff --git a/app/views/admin/enterprise_groups/_form_web.html.haml b/app/views/admin/enterprise_groups/_form_web.html.haml new file mode 100644 index 0000000000..ea985259c3 --- /dev/null +++ b/app/views/admin/enterprise_groups/_form_web.html.haml @@ -0,0 +1,32 @@ +%fieldset.alpha.no-border-bottom{ ng: { show: "menu.selected.name=='Web'" } } + %legend Web Resources + .row + .alpha.three.columns + = f.label :website + .omega.eight.columns + = f.text_field :website, { placeholder: "eg. www.truffles.com"} + .row + .alpha.three.columns + = f.label :email + .omega.eight.columns + = f.text_field :email + .row + .alpha.three.columns + = f.label :facebook, 'Facebook' + .omega.eight.columns + = f.text_field :facebook + .row + .alpha.three.columns + = f.label :instagram, 'Instagram' + .omega.eight.columns + = f.text_field :instagram + .row + .alpha.three.columns + = f.label :linkedin, 'LinkedIn' + .omega.eight.columns + = f.text_field :linkedin + .row + .alpha.three.columns + = f.label :twitter + .omega.eight.columns + = f.text_field :twitter, { placeholder: "eg. @the_prof" } diff --git a/app/views/admin/enterprise_groups/_inputs.html.haml b/app/views/admin/enterprise_groups/_inputs.html.haml deleted file mode 100644 index dbf8606af6..0000000000 --- a/app/views/admin/enterprise_groups/_inputs.html.haml +++ /dev/null @@ -1,127 +0,0 @@ -%fieldset.alpha.no-border-bottom{ ng: { show: "menu.selected.name=='Primary Details'" } } - %legend Primary Details - = f.field_container :name do - = f.label :name - %br/ - = f.text_field :name - - = f.field_container :description do - = f.label :description - %br/ - = f.text_field :description - - - if spree_current_user.admin? - .row - .three.columns.alpha - =f.label :owner_id, 'Owner' - .with-tip{'data-powertip' => "The primary user responsible for this group."} - %a What's this? - .eight.columns.omega - = f.hidden_field :owner_id, class: "select2 fullwidth", 'ofn-user-autocomplete' => true, email: @owner_email - - = f.field_container :on_front_page do - = f.label :on_front_page, 'On front page?' - %br/ - = f.check_box :on_front_page - - = f.field_container :enterprise_ids do - = f.label :enterprise_ids, 'Enterprises' - %br/ - = f.collection_select :enterprise_ids, @enterprises, :id, :name, {}, {class: "select2 fullwidth", multiple: true} - -%fieldset.alpha.no-border-bottom{ ng: { show: "menu.selected.name=='About'" } } - %legend About - = f.field_container :long_description do - = f.label :long_description - %br/ - = f.text_area :long_description - - -%fieldset.alpha.no-border-bottom{ ng: { show: "menu.selected.name=='Images'" } } - %legend Images - .row - .alpha.three.columns - = f.label :logo, class: 'with-tip', 'data-powertip' => 'This is the logo' - .with-tip{'data-powertip' => 'This is the logo'} - %a What's this? - .omega.eight.columns - = image_tag @object.logo.url if @object.logo.present? - = f.file_field :logo - .row - .alpha.three.columns - = f.label :promo_image, class: 'with-tip', 'data-powertip' => 'This image is displayed at the top of the Group profile' - .with-tip{'data-powertip' => 'This image is displayed at the top of the Group profile'} - %a What's this? - .omega.eight.columns - = image_tag @object.promo_image.url if @object.promo_image.present? - = f.file_field :promo_image - -= f.fields_for :address do |af| - %fieldset.alpha.no-border-bottom{ ng: { show: "menu.selected.name=='Contact'" } } - %legend Contact - .row - .alpha.three.columns - = af.label :phone - .omega.eight.columns - = af.text_field :phone, { placeholder: "eg. 98 7654 3210"} - .row - .three.columns.alpha - = af.label :address1 - .eight.columns.omega - = af.text_field :address1, { placeholder: "eg. 123 High Street"} - .row - .alpha.three.columns - = af.label :address2 - .eight.columns.omega - = af.text_field :address2 - .row - .three.columns.alpha - = af.label :city, 'Suburb' - \/ - = af.label :zipcode, 'Postcode' - .four.columns - = af.text_field :city, { placeholder: "eg. Northcote"} - .four.columns.omega - = af.text_field :zipcode, { placeholder: "eg. 3070"} - .row - .three.columns.alpha - = af.label :state_id, 'State' - \/ - = af.label :country_id, 'Country' - .four.columns - = af.collection_select :state_id, af.object.country.states, :id, :name, {}, :class => "select2 fullwidth" - .four.columns.omega - = af.collection_select :country_id, available_countries, :id, :name, {}, :class => "select2 fullwidth" - -%fieldset.alpha.no-border-bottom{ ng: { show: "menu.selected.name=='Web'" } } - %legend Web Resources - .row - .alpha.three.columns - = f.label :website - .omega.eight.columns - = f.text_field :website, { placeholder: "eg. www.truffles.com"} - .row - .alpha.three.columns - = f.label :email - .omega.eight.columns - = f.text_field :email - .row - .alpha.three.columns - = f.label :facebook, 'Facebook' - .omega.eight.columns - = f.text_field :facebook - .row - .alpha.three.columns - = f.label :instagram, 'Instagram' - .omega.eight.columns - = f.text_field :instagram - .row - .alpha.three.columns - = f.label :linkedin, 'LinkedIn' - .omega.eight.columns - = f.text_field :linkedin - .row - .alpha.three.columns - = f.label :twitter - .omega.eight.columns - = f.text_field :twitter, { placeholder: "eg. @the_prof" }