Dedicated new enterprise form

This commit is contained in:
Rob Harrington
2014-12-19 12:57:56 +11:00
parent 24cf3dee74
commit a810fc88ac
6 changed files with 123 additions and 30 deletions

View File

@@ -28,3 +28,10 @@ show_flash_error = function(message) {
}
}
}
$(document).ready(function(){
$('a.close').click(function(event){
event.preventDefault();
$(this).parent().slideUp(250);
});
});

View File

@@ -1,6 +1,7 @@
@import ../darkswarm/mixins
.alert-box
position: relative
display: block
background-color: #eff5dc
border: 1px solid #9fc820
@@ -11,7 +12,10 @@
transition: opacity 300ms ease-out
padding: 0.77778em 1.33333em 0.77778em 0.77778em
a.close
float: right
position: absolute
right: 5px
top: 0px
font-size: 1.5em
.dashboard_item.single-ent

View File

@@ -0,0 +1,105 @@
.row
.three.columns.alpha
= f.label :name
.nine.columns.omega
= f.text_field :name, { placeholder: "eg. Professor Plum's Biodynamic Truffles", class: "fullwidth" }
- if spree_current_user.admin?
.row{ ng: { app: "admin.users" } }
.three.columns.alpha
=f.label :owner_id, 'Owner'
.with-tip{'data-powertip' => "The primary user responsible for this enterprise."}
%a What's this?
.nine.columns.omega
- owner_email = @enterprise.andand.owner.andand.email || ""
= f.hidden_field :owner_id, class: "select2 fullwidth", 'ofn-user-autocomplete' => true, email: owner_email
.row
.three.columns.alpha
%label Primary Producer?
.with-tip{'data-powertip' => "Select 'Producer' if you are a primary producer of food."}
%a What's this?
.five.columns.omega
= f.check_box :is_primary_producer, 'ng-model' => 'Enterprise.is_primary_producer'
 
= f.label :is_primary_producer, 'I am a Producer'
- if spree_current_user.admin?
.row
.alpha.eleven.columns
.three.columns.alpha
= f.label :sells, 'Sells'
.with-tip{'data-powertip' => "None - enterprise does not sell to customers directly.<br />Own - Enterprise sells own products to customers.<br />Any - Enterprise can sell own or other enterprises products.<br />"}
%a What's this?
.two.columns
= f.radio_button :sells, "none", 'ng-model' => 'Enterprise.sells'
&nbsp;
= f.label :sells, "None", value: "none"
.two.columns
= f.radio_button :sells, "own", 'ng-model' => 'Enterprise.sells'
&nbsp;
= f.label :sells, "Own", value: "own"
.four.columns.omega
= f.radio_button :sells, "any", 'ng-model' => 'Enterprise.sells'
&nbsp;
= f.label :sells, "Any", value: "any"
.row
.alpha.three.columns
= f.label :contact, 'Contact Name'
.omega.nine.columns
= f.text_field :contact, { placeholder: "eg. Gustav Plum"}
.row
.alpha.three.columns
= f.label :email
.omega.nine.columns
= f.text_field :email, { placeholder: "eg. gustav@truffles.com", "ng-model" => "Enterprise.email" }
.alert-box
%i.icon-info-sign
If we don't recognise this email address we'll send you a confirmation email to make sure it belongs to you. You'll need to use the link in the email we send to fully activate your new enterprise.
%a.close{ href: "" } ×
.row
.alpha.three.columns
= f.label :phone
.omega.nine.columns
= f.text_field :phone, { placeholder: "eg. 98 7654 3210"}
.row
.alpha.three.columns
= f.label :website
.omega.nine.columns
= f.text_field :website, { placeholder: "eg. www.truffles.com"}
= f.fields_for :address do |af|
.row
.three.columns.alpha
= af.label :address1
.nine.columns.omega
= af.text_field :address1, { placeholder: "eg. 123 High Street"}
.row
.alpha.three.columns
= af.label :address2
.nine.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"}
.five.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"
.five.columns.omega
= af.collection_select :country_id, available_countries, :id, :name, {}, :class => "select2 fullwidth"
.row
.twelve.columns.alpha
&nbsp;
.row
.twelve.columns.alpha
= render partial: "spree/admin/shared/new_resource_links"

View File

@@ -6,6 +6,10 @@
- content_for :page_actions do
%li= button_link_to "Back to enterprises list", main_app.admin_enterprises_path, icon: 'icon-arrow-left'
= render 'admin/enterprises/form_data'
= render 'admin/enterprises/ng_form', action: 'new'
-# Form
= form_for [main_app, :admin, @enterprise], html: { "nav-check" => '', "nav-callback" => '' } do |f|
.row
.twelve.columns.fullwidth_inputs
= render 'new_form', f: f

View File

@@ -40,11 +40,6 @@
%strong= "Manage #{@enterprise.name}."
%a.close{ href: "#" } ×
:javascript
$('a.close').click(function(){
$(this).parent().slideUp(250);
});
.row
.alpha.seven.columns.dashboard_item.single-ent#map
.header

View File

@@ -131,40 +131,18 @@ feature %q{
select2_search admin.email, from: 'Owner'
select2_search admin.email, from: 'Owner'
choose 'Any'
select2_search eg1.name, from: 'Groups'
click_link "Payment Methods"
check "enterprise_payment_method_ids_#{payment_method.id}"
click_link "Shipping Methods"
check "enterprise_shipping_method_ids_#{shipping_method.id}"
click_link "Contact"
fill_in 'enterprise_contact', :with => 'Kirsten or Ren'
fill_in 'enterprise_phone', :with => '0413 897 321'
fill_in 'enterprise_email', :with => 'info@eaterprises.com.au'
fill_in 'enterprise_website', :with => 'http://eaterprises.com.au'
click_link "Social"
fill_in 'enterprise_twitter', :with => '@eaterprises'
fill_in 'enterprise_facebook', :with => 'facebook.com/eaterprises'
fill_in 'enterprise_instagram', :with => 'eaterprises'
click_link "Business Details"
fill_in 'enterprise_abn', :with => '09812309823'
fill_in 'enterprise_acn', :with => ''
click_link "Address"
fill_in 'enterprise_address_attributes_address1', :with => '35 Ballantyne St'
fill_in 'enterprise_address_attributes_city', :with => 'Thornbury'
fill_in 'enterprise_address_attributes_zipcode', :with => '3072'
select2_search 'Australia', :from => 'Country'
select2_search 'Victoria', :from => 'State'
click_link "About"
long_description = find :css, "text-angular div.ta-scroll-window div.ta-bind"
long_description.set 'Connecting farmers and eaters'
click_button 'Create'
flash_message.should == 'Enterprise "Eaterprises" has been successfully created!'
end