Commit 2b4290406599224001f9a0be8d035817f215a5a7

Authored by Daniela Feitosa
1 parent bac11992

Removed link from templates option

The templates are not visible, so new user won't be able to see them
Also styling the checkbox "is_template" on profile edition

(ActionItem2378)
app/helpers/application_helper.rb
@@ -1338,7 +1338,7 @@ module ApplicationHelper @@ -1338,7 +1338,7 @@ module ApplicationHelper
1338 counter = 0 1338 counter = 0
1339 radios = klass.templates.map do |template| 1339 radios = klass.templates.map do |template|
1340 counter += 1 1340 counter += 1
1341 - content_tag('li', labelled_radio_button(link_to(template.name, template.url, :target => '_blank'), "#{field_name}[template_id]", template.id, counter==1)) 1341 + content_tag('li', labelled_radio_button(template.name, "#{field_name}[template_id]", template.id, counter==1))
1342 end.join("\n") 1342 end.join("\n")
1343 1343
1344 content_tag('div', content_tag('span', _('Template:')) + 1344 content_tag('div', content_tag('span', _('Template:')) +
app/models/profile.rb
@@ -281,7 +281,7 @@ class Profile < ActiveRecord::Base @@ -281,7 +281,7 @@ class Profile < ActiveRecord::Base
281 281
282 def valid_template 282 def valid_template
283 if template_id.present? and !template.is_template 283 if template_id.present? and !template.is_template
284 - errors.add(:template, _('%{fn} is not a template.').fix_i18n) 284 + errors.add(:template, _('is not a template.'))
285 end 285 end
286 end 286 end
287 287
app/views/profile_editor/edit.rhtml
@@ -5,7 +5,9 @@ @@ -5,7 +5,9 @@
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) %> 7 <% if user.has_permission?('manage_environment_templates', profile.environment) %>
8 - <%= labelled_form_field check_box(:profile_data, :is_template) + _('Is a template?'), '' %> 8 + <div id="profile-is-template">
  9 + <%= labelled_check_box(_('This profile is a template'), 'profile_data[is_template]', true, @profile.is_template) %>
  10 + </div>
9 <% end %> 11 <% end %>
10 12
11 <%= render :partial => partial_for_class(@profile.class), :locals => { :f => f } %> 13 <%= render :partial => partial_for_class(@profile.class), :locals => { :f => f } %>
public/stylesheets/application.css
@@ -2298,6 +2298,15 @@ div#activation_enterprise label, div#activation_enterprise input, div#activation @@ -2298,6 +2298,15 @@ div#activation_enterprise label, div#activation_enterprise input, div#activation
2298 #profile_change_picture img { 2298 #profile_change_picture img {
2299 margin-left: 10px; 2299 margin-left: 10px;
2300 } 2300 }
  2301 +
  2302 +#profile-is-template {
  2303 + background-color: #E6E6E6;
  2304 + border: 1px solid #CCC;
  2305 + padding: 5px;
  2306 + border-radius: 5px;
  2307 + -moz-border-radius: 5px;
  2308 + -webkit-border-radius: 5px;
  2309 +}
2301 /*** REQUIRED FIELDS ***/ 2310 /*** REQUIRED FIELDS ***/
2302 2311
2303 .required-field label { 2312 .required-field label {