From 780df6bfe061f1deaad43c793fe48dc9ca56e8c4 Mon Sep 17 00:00:00 2001 From: Rob H Date: Fri, 5 Sep 2014 18:38:43 +1000 Subject: [PATCH] Hide 'profile type' form element for non super-admin users --- app/views/admin/enterprises/_form.html.haml | 37 +++++++++++---------- spec/features/admin/enterprises_spec.rb | 2 +- 2 files changed, 20 insertions(+), 19 deletions(-) diff --git a/app/views/admin/enterprises/_form.html.haml b/app/views/admin/enterprises/_form.html.haml index 07be41dd6e..dbf986c7aa 100644 --- a/app/views/admin/enterprises/_form.html.haml +++ b/app/views/admin/enterprises/_form.html.haml @@ -36,24 +36,25 @@ = f.check_box :is_primary_producer, 'ng-model' => 'Enterprise.is_primary_producer'   = f.label :is_primary_producer, 'Producer' - .row - .alpha.eleven.columns - .three.columns.alpha - = f.label :type, 'Profile type' - .with-tip{'data-powertip' => "Full - enterprise may have products and relationships.
Single - enterprise may have products but no relationships.
Profile - enterprise has a profile but no products or relationships.
"} - %a What's this? - .two.columns - = f.radio_button :type, "full" -   - = f.label :type, "Full", value: "full" - .two.columns - = f.radio_button :type, "single" -   - = f.label :type, "Single", value: "single" - .four.columns.omega - = f.radio_button :type, "profile" -   - = f.label :type, "Profile", value: "profile" + - if spree_current_user.admin? + .row + .alpha.eleven.columns + .three.columns.alpha + = f.label :type, 'Profile type' + .with-tip{'data-powertip' => "Full - enterprise may have products and relationships.
Single - enterprise may have products but no relationships.
Profile - enterprise has a profile but no products or relationships.
"} + %a What's this? + .two.columns + = f.radio_button :type, "full" +   + = f.label :type, "Full", value: "full" + .two.columns + = f.radio_button :type, "single" +   + = f.label :type, "Single", value: "single" + .four.columns.omega + = f.radio_button :type, "profile" +   + = f.label :type, "Profile", value: "profile" .row .three.columns.alpha %label Visible in search? diff --git a/spec/features/admin/enterprises_spec.rb b/spec/features/admin/enterprises_spec.rb index da32f92681..08bae3aec5 100644 --- a/spec/features/admin/enterprises_spec.rb +++ b/spec/features/admin/enterprises_spec.rb @@ -127,7 +127,7 @@ feature %q{ choose 'Single' fill_in 'enterprise_description', :with => 'Connecting farmers and eaters' fill_in 'enterprise_long_description', :with => 'Zombie ipsum reversus ab viral inferno, nam rick grimes malum cerebro.' - + # Check Angularjs switching of sidebar elements uncheck 'enterprise_is_primary_producer' uncheck 'enterprise_is_distributor'