Commit 8657a206fcd0ef14064393896720e7dd49ede44d

Authored by Rodrigo Souto
Committed by Daniela Feitosa
1 parent 0b85c950

[multiple-templates] Checkbox on profile to mark it as a template

(ActionItem2378)
app/views/profile_editor/edit.rhtml
... ... @@ -4,6 +4,10 @@
4 4  
5 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 11 <%= render :partial => partial_for_class(@profile.class), :locals => { :f => f } %>
8 12  
9 13 <% unless @profile.person? && @environment.active_person_fields.include?('image') %>
... ...
test/functional/profile_editor_controller_test.rb
... ... @@ -949,4 +949,17 @@ class ProfileEditorControllerTest &lt; ActionController::TestCase
949 949 assert_tag :tag => 'strong', :content => 'Plugin2 text'
950 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 965 end
... ...