Renaming 'Override Variant Details' permission to 'Add Products To Inventory'

Style changes to make enterprise relationships page more useable
This commit is contained in:
Rob Harrington
2016-02-26 00:17:36 +11:00
parent 4bf27982f4
commit 3f466e86b6
5 changed files with 18 additions and 12 deletions

View File

@@ -29,4 +29,4 @@ angular.module("ofn.admin").factory 'EnterpriseRelationships', ($http, enterpris
when "add_to_order_cycle" then "add to order cycle"
when "manage_products" then "manage products"
when "edit_profile" then "edit profile"
when "create_variant_overrides" then "override variant details"
when "create_variant_overrides" then "add products to inventory"

View File

@@ -1,11 +1,11 @@
%tr
%td
%select{name: "enterprise_relationship_parent_id", "ng-model" => "parent_id", "ng-options" => "e.id as e.name for e in Enterprises.my_enterprises"}
%select.select2.fullwidth{id: "enterprise_relationship_parent_id", "ng-model" => "parent_id", "ng-options" => "e.id as e.name for e in Enterprises.my_enterprises"}
%td
permits
%td
%select{name: "enterprise_relationship_child_id", "ng-model" => "child_id", "ng-options" => "e.id as e.name for e in Enterprises.all_enterprises"}
%select.select2.fullwidth{id: "enterprise_relationship_child_id", "ng-model" => "child_id", "ng-options" => "e.id as e.name for e in Enterprises.all_enterprises"}
%td
%label
%input{type: "checkbox", ng: {checked: "allPermissionsChecked()", click: "checkAllPermissions()"}}

View File

@@ -9,6 +9,12 @@
= render 'search_input'
%table#enterprise-relationships
%colgroup
%col{ style: "width: 30%" }
%col{ style: "width: 5%" }
%col{ style: "width: 30%" }
%col{ style: "width: 30%" }
%col{ style: "width: 5%" }
%tbody
= render 'form'
= render 'enterprise_relationship'

View File

@@ -37,17 +37,17 @@ feature %q{
e2 = create(:enterprise, name: 'Two')
visit admin_enterprise_relationships_path
select 'One', from: 'enterprise_relationship_parent_id'
select2_select 'One', from: 'enterprise_relationship_parent_id'
check 'to add to order cycle'
check 'to manage products'
uncheck 'to manage products'
check 'to edit profile'
check 'to override variant details'
select 'Two', from: 'enterprise_relationship_child_id'
check 'to add products to inventory'
select2_select 'Two', from: 'enterprise_relationship_child_id'
click_button 'Create'
page.should have_relationship e1, e2, ['to add to order cycle', 'to override variant details', 'to edit profile']
page.should have_relationship e1, e2, ['to add to order cycle', 'to add products to inventory', 'to edit profile']
er = EnterpriseRelationship.where(parent_id: e1, child_id: e2).first
er.should be_present
er.permissions.map(&:name).should match_array ['add_to_order_cycle', 'edit_profile', 'create_variant_overrides']
@@ -62,8 +62,8 @@ feature %q{
expect do
# When I attempt to create a duplicate relationship
visit admin_enterprise_relationships_path
select 'One', from: 'enterprise_relationship_parent_id'
select 'Two', from: 'enterprise_relationship_child_id'
select2_select 'One', from: 'enterprise_relationship_parent_id'
select2_select 'Two', from: 'enterprise_relationship_child_id'
click_button 'Create'
# Then I should see an error message
@@ -110,8 +110,8 @@ feature %q{
scenario "enterprise user can only add their own enterprises as parent" do
visit admin_enterprise_relationships_path
page.should have_select 'enterprise_relationship_parent_id', options: ['', d1.name]
page.should have_select 'enterprise_relationship_child_id', options: ['', d1.name, d2.name, d3.name]
page.should have_select2 'enterprise_relationship_parent_id', options: ['', d1.name]
page.should have_select2 'enterprise_relationship_child_id', options: ['', d1.name, d2.name, d3.name]
end
end

View File

@@ -15,4 +15,4 @@ describe "enterprise relationships", ->
expect(EnterpriseRelationships.permission_presentation("add_to_order_cycle")).toEqual "add to order cycle"
expect(EnterpriseRelationships.permission_presentation("manage_products")).toEqual "manage products"
expect(EnterpriseRelationships.permission_presentation("edit_profile")).toEqual "edit profile"
expect(EnterpriseRelationships.permission_presentation("create_variant_overrides")).toEqual "override variant details"
expect(EnterpriseRelationships.permission_presentation("create_variant_overrides")).toEqual "add products to inventory"