diff --git a/app/views/profile_editor/edit.rhtml b/app/views/profile_editor/edit.rhtml index d43eb79..046ce39 100644 --- a/app/views/profile_editor/edit.rhtml +++ b/app/views/profile_editor/edit.rhtml @@ -4,6 +4,10 @@ <% labelled_form_for :profile_data, @profile, :html => { :id => 'profile-data', :multipart => true } do |f| %> + <% if user.has_permission?('manage_environment_templates', profile.environment) %> + <%= labelled_form_field check_box(:profile_data, :is_template) + _('Is a template?'), '' %> + <% end %> + <%= render :partial => partial_for_class(@profile.class), :locals => { :f => f } %> <% unless @profile.person? && @environment.active_person_fields.include?('image') %> diff --git a/test/functional/profile_editor_controller_test.rb b/test/functional/profile_editor_controller_test.rb index d831548..be63c73 100644 --- a/test/functional/profile_editor_controller_test.rb +++ b/test/functional/profile_editor_controller_test.rb @@ -949,4 +949,17 @@ class ProfileEditorControllerTest < ActionController::TestCase assert_tag :tag => 'strong', :content => 'Plugin2 text' end + should 'see is_template check_box' do + give_permission(profile, 'manage_environment_templates', profile.environment) + get :edit, :profile => profile.identifier + assert_tag :tag => 'input', :attributes => {:name => 'profile_data[is_template]'} + end + + should 'not see is_template check_box' do + another_user = create_user('another_user').person + login_as('another_user') + get :edit, :profile => profile.identifier + assert_no_tag :tag => 'input', :attributes => {:name => 'profile_data[is_template]'} + end + end -- libgit2 0.21.2