Commit 0b85c9500f4301c1114c1a0334764ed26f17d1fb
Committed by
Daniela Feitosa
1 parent
00dacfc2
Exists in
master
and in
28 other branches
[multiple-templates] Listing available templates on profile creation
(ActionItem2378)
Showing
5 changed files
with
46 additions
and
0 deletions
Show diff stats
app/helpers/application_helper.rb
| @@ -1331,4 +1331,20 @@ module ApplicationHelper | @@ -1331,4 +1331,20 @@ module ApplicationHelper | ||
| 1331 | _("Are you sure that you want to remove the item \"#{article.name}\"?") | 1331 | _("Are you sure that you want to remove the item \"#{article.name}\"?") |
| 1332 | end | 1332 | end |
| 1333 | end | 1333 | end |
| 1334 | + | ||
| 1335 | + def template_options(klass, field_name) | ||
| 1336 | + return hidden_field_tag("#{field_name}[template_id]", klass.templates.first) if klass.templates.count == 1 | ||
| 1337 | + | ||
| 1338 | + counter = 0 | ||
| 1339 | + radios = klass.templates.map do |template| | ||
| 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)) | ||
| 1342 | + end.join("\n") | ||
| 1343 | + | ||
| 1344 | + content_tag('div', content_tag('span', _('Template:')) + | ||
| 1345 | + content_tag('ul', radios, :style => 'list-style: none; padding-left: 0; margin-top: 0.5em;'), | ||
| 1346 | + :id => 'template-options', | ||
| 1347 | + :style => 'margin-top: 1em' | ||
| 1348 | + ) | ||
| 1349 | + end | ||
| 1334 | end | 1350 | end |
app/views/account/_signup_form.rhtml
| @@ -69,6 +69,8 @@ | @@ -69,6 +69,8 @@ | ||
| 69 | 69 | ||
| 70 | <div id="signup-form-profile"> | 70 | <div id="signup-form-profile"> |
| 71 | 71 | ||
| 72 | + <%= template_options(Person, 'profile_data') %> | ||
| 73 | + | ||
| 72 | <% labelled_fields_for :profile_data, @person do |f| %> | 74 | <% labelled_fields_for :profile_data, @person do |f| %> |
| 73 | <%= render :partial => 'profile_editor/person_form', :locals => {:f => f} %> | 75 | <%= render :partial => 'profile_editor/person_form', :locals => {:f => f} %> |
| 74 | <% end %> | 76 | <% end %> |
app/views/enterprise_registration/basic_information.rhtml
| @@ -28,6 +28,8 @@ | @@ -28,6 +28,8 @@ | ||
| 28 | <%= hidden_field_tag 'create_enterprise[target_id]', environment.id %> | 28 | <%= hidden_field_tag 'create_enterprise[target_id]', environment.id %> |
| 29 | <% end %> | 29 | <% end %> |
| 30 | 30 | ||
| 31 | + <%= template_options(Enterprise, 'create_enterprise')%> | ||
| 32 | + | ||
| 31 | <% button_bar do %> | 33 | <% button_bar do %> |
| 32 | <%= submit_button('next', _('Next'), :cancel => {:profile => current_user.person.identifier, :action=>"enterprises", :controller=>"profile"}) %> | 34 | <%= submit_button('next', _('Next'), :cancel => {:profile => current_user.person.identifier, :action=>"enterprises", :controller=>"profile"}) %> |
| 33 | <% end %> | 35 | <% end %> |
app/views/memberships/new_community.rhtml
| @@ -38,6 +38,8 @@ | @@ -38,6 +38,8 @@ | ||
| 38 | </div> | 38 | </div> |
| 39 | </div> | 39 | </div> |
| 40 | 40 | ||
| 41 | + <%= template_options(Community, 'community')%> | ||
| 42 | + | ||
| 41 | <% button_bar do %> | 43 | <% button_bar do %> |
| 42 | <%= submit_button(:save, _('Create')) %> | 44 | <%= submit_button(:save, _('Create')) %> |
| 43 | <%= button(:cancel, _('Cancel'), :action => 'index') %> | 45 | <%= button(:cancel, _('Cancel'), :action => 'index') %> |
public/stylesheets/application.css
| @@ -5675,8 +5675,32 @@ h1#agenda-title { | @@ -5675,8 +5675,32 @@ h1#agenda-title { | ||
| 5675 | 5675 | ||
| 5676 | #signup-form .fieldgroup { | 5676 | #signup-form .fieldgroup { |
| 5677 | margin: 5px 10px; | 5677 | margin: 5px 10px; |
| 5678 | + | ||
| 5679 | +} | ||
| 5680 | + | ||
| 5681 | + | ||
| 5682 | +#signup-form #template-options a, | ||
| 5683 | +#signup-form #template-options label, | ||
| 5684 | +#signup-form #template-options span { | ||
| 5685 | + color: #6D786E; | ||
| 5686 | + font-size: 20px; | ||
| 5687 | + font-family: droidserif; | ||
| 5688 | +} | ||
| 5689 | + | ||
| 5690 | +#signup-form #template-options span { | ||
| 5691 | + color: #4A4A4A; | ||
| 5692 | +} | ||
| 5693 | + | ||
| 5694 | +#signup-form #template-options label { | ||
| 5695 | + display: inline; | ||
| 5696 | + margin-left: 8px; | ||
| 5678 | } | 5697 | } |
| 5679 | 5698 | ||
| 5699 | +#signup-form #template-options input { | ||
| 5700 | + width: auto; | ||
| 5701 | +} | ||
| 5702 | + | ||
| 5703 | + | ||
| 5680 | #signup-form label[for=profile_data_sex_female], | 5704 | #signup-form label[for=profile_data_sex_female], |
| 5681 | #signup-form label[for=profile_data_sex_male] { | 5705 | #signup-form label[for=profile_data_sex_male] { |
| 5682 | color: #6d786e; | 5706 | color: #6d786e; |