Commit 8657a206fcd0ef14064393896720e7dd49ede44d
Committed by
Daniela Feitosa
1 parent
0b85c950
Exists in
master
and in
29 other branches
[multiple-templates] Checkbox on profile to mark it as a template
(ActionItem2378)
Showing
2 changed files
with
17 additions
and
0 deletions
Show diff stats
app/views/profile_editor/edit.rhtml
@@ -4,6 +4,10 @@ | @@ -4,6 +4,10 @@ | ||
4 | 4 | ||
5 | <% labelled_form_for :profile_data, @profile, :html => { :id => 'profile-data', :multipart => true } do |f| %> | 5 | <% labelled_form_for :profile_data, @profile, :html => { :id => 'profile-data', :multipart => true } do |f| %> |
6 | 6 | ||
7 | + <% if user.has_permission?('manage_environment_templates', profile.environment) %> | ||
8 | + <%= labelled_form_field check_box(:profile_data, :is_template) + _('Is a template?'), '' %> | ||
9 | + <% end %> | ||
10 | + | ||
7 | <%= render :partial => partial_for_class(@profile.class), :locals => { :f => f } %> | 11 | <%= render :partial => partial_for_class(@profile.class), :locals => { :f => f } %> |
8 | 12 | ||
9 | <% unless @profile.person? && @environment.active_person_fields.include?('image') %> | 13 | <% unless @profile.person? && @environment.active_person_fields.include?('image') %> |
test/functional/profile_editor_controller_test.rb
@@ -949,4 +949,17 @@ class ProfileEditorControllerTest < ActionController::TestCase | @@ -949,4 +949,17 @@ class ProfileEditorControllerTest < ActionController::TestCase | ||
949 | assert_tag :tag => 'strong', :content => 'Plugin2 text' | 949 | assert_tag :tag => 'strong', :content => 'Plugin2 text' |
950 | end | 950 | end |
951 | 951 | ||
952 | + should 'see is_template check_box' do | ||
953 | + give_permission(profile, 'manage_environment_templates', profile.environment) | ||
954 | + get :edit, :profile => profile.identifier | ||
955 | + assert_tag :tag => 'input', :attributes => {:name => 'profile_data[is_template]'} | ||
956 | + end | ||
957 | + | ||
958 | + should 'not see is_template check_box' do | ||
959 | + another_user = create_user('another_user').person | ||
960 | + login_as('another_user') | ||
961 | + get :edit, :profile => profile.identifier | ||
962 | + assert_no_tag :tag => 'input', :attributes => {:name => 'profile_data[is_template]'} | ||
963 | + end | ||
964 | + | ||
952 | end | 965 | end |