Commit 7c51138ce73c5aab63c1558543ffc2f817514dc1
1 parent
0ce0492c
Exists in
master
and in
29 other branches
ActionItem70: extracting the color selection into a helper
git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@541 3f533792-8f58-4932-b0fe-aaf55b0a4547
Showing
2 changed files
with
19 additions
and
12 deletions
Show diff stats
| ... | ... | @@ -0,0 +1,17 @@ |
| 1 | +module CategoriesHelper | |
| 2 | + def select_color_for_category | |
| 3 | + if @category.top_level? | |
| 4 | + options = [ | |
| 5 | + [ _('Do not display at the menu'), nil ], | |
| 6 | + [ _('Blue'), 1 ], | |
| 7 | + [ _('Red'), 2 ], | |
| 8 | + [ _('Green'), 3 ], | |
| 9 | + [ _('Orange'), 4 ], | |
| 10 | + ] | |
| 11 | + labelled_form_field(_('Display at the menu?'), select('category', 'display_color', options)) | |
| 12 | + else | |
| 13 | + "" | |
| 14 | + end | |
| 15 | + end | |
| 16 | + | |
| 17 | +end | ... | ... |
app/views/categories/_form.rhtml
| ... | ... | @@ -5,19 +5,9 @@ |
| 5 | 5 | <%= hidden_field_tag('parent_id', @category.parent.id) %> |
| 6 | 6 | <% end %> |
| 7 | 7 | |
| 8 | - <% if @category.top_level? %> | |
| 9 | - <% | |
| 10 | - options = [ | |
| 11 | - [ _('Do not display at the menu'), nil ], | |
| 12 | - [ _('Blue'), 1 ], | |
| 13 | - [ _('Red'), 2 ], | |
| 14 | - [ _('Green'), 3 ], | |
| 15 | - [ _('Orange'), 4 ], | |
| 16 | - ] | |
| 17 | - %> | |
| 18 | - <%= labelled_form_field(_('Display at the menu?'), f.select('display_color', options)) %> | |
| 19 | - <% end %> | |
| 8 | + <%= select_color_for_category %> | |
| 20 | 9 | |
| 21 | 10 | <%= f.text_field 'name' %> |
| 22 | 11 | <%= submit_tag _('Save') %> |
| 12 | + <%= link_to _('Cancel'), :action => 'index' %> | |
| 23 | 13 | <% end %> | ... | ... |