Commit bd5cf3a66186e2fa9df3bf544566da7257d5e516
1 parent
11dfb86b
Exists in
master
and in
27 other branches
Abstract core to use standard and replaceable helpers
Showing
22 changed files
with
58 additions
and
44 deletions
Show diff stats
app/helpers/application_helper.rb
@@ -592,7 +592,7 @@ module ApplicationHelper | @@ -592,7 +592,7 @@ module ApplicationHelper | ||
592 | extra_info = extra_info.nil? ? '' : content_tag( 'span', extra_info, :class => 'extra_info' ) | 592 | extra_info = extra_info.nil? ? '' : content_tag( 'span', extra_info, :class => 'extra_info' ) |
593 | links = links_for_balloon(profile) | 593 | links = links_for_balloon(profile) |
594 | content_tag('div', content_tag(tag, | 594 | content_tag('div', content_tag(tag, |
595 | - (environment.enabled?(:show_balloon_with_profile_links_when_clicked) ? link_to( content_tag( 'span', _('Profile links')), '#', :onclick => "toggleSubmenu(this, '#{profile.short_name}', #{CGI::escapeHTML(links.to_json)}); return false", :class => "menu-submenu-trigger #{trigger_class}", :url => url) : "") + | 595 | + (environment.enabled?(:show_balloon_with_profile_links_when_clicked) ? popover_menu(_('Profile links'),profile.short_name,links,{:class => trigger_class, :url => url}) : "") + |
596 | link_to( | 596 | link_to( |
597 | content_tag( 'span', profile_image( profile, size ), :class => 'profile-image' ) + | 597 | content_tag( 'span', profile_image( profile, size ), :class => 'profile-image' ) + |
598 | content_tag( 'span', h(name), :class => ( profile.class == Person ? 'fn' : 'org' ) ) + | 598 | content_tag( 'span', h(name), :class => ( profile.class == Person ? 'fn' : 'org' ) ) + |
@@ -604,6 +604,14 @@ module ApplicationHelper | @@ -604,6 +604,14 @@ module ApplicationHelper | ||
604 | :class => 'vcard'), :class => 'common-profile-list-block') | 604 | :class => 'vcard'), :class => 'common-profile-list-block') |
605 | end | 605 | end |
606 | 606 | ||
607 | + def popover_menu(title,menu_title,links,html_options={}) | ||
608 | + html_options[:class] = "" unless html_options[:class] | ||
609 | + html_options[:class] << " menu-submenu-trigger" | ||
610 | + html_options[:onclick] = "toggleSubmenu(this, '#{menu_title}', #{CGI::escapeHTML(links.to_json)}); return false" | ||
611 | + | ||
612 | + link_to(content_tag(:span, title), '#', html_options) | ||
613 | + end | ||
614 | + | ||
607 | def gravatar_default | 615 | def gravatar_default |
608 | (respond_to?(:theme_option) && theme_option.present? && theme_option['gravatar']) || NOOSFERO_CONF['gravatar'] || 'mm' | 616 | (respond_to?(:theme_option) && theme_option.present? && theme_option['gravatar']) || NOOSFERO_CONF['gravatar'] || 'mm' |
609 | end | 617 | end |
@@ -718,7 +726,7 @@ module ApplicationHelper | @@ -718,7 +726,7 @@ module ApplicationHelper | ||
718 | class NoosferoFormBuilder < ActionView::Helpers::FormBuilder | 726 | class NoosferoFormBuilder < ActionView::Helpers::FormBuilder |
719 | extend ActionView::Helpers::TagHelper | 727 | extend ActionView::Helpers::TagHelper |
720 | 728 | ||
721 | - def self.output_field(text, field_html, field_id = nil) | 729 | + def self.output_field(text, field_html, field_id = nil, options = {}) |
722 | # try to guess an id if none given | 730 | # try to guess an id if none given |
723 | if field_id.nil? | 731 | if field_id.nil? |
724 | field_html =~ /id=['"]([^'"]*)['"]/ | 732 | field_html =~ /id=['"]([^'"]*)['"]/ |
@@ -1050,7 +1058,7 @@ module ApplicationHelper | @@ -1050,7 +1058,7 @@ module ApplicationHelper | ||
1050 | end | 1058 | end |
1051 | 1059 | ||
1052 | link_to(content_tag(:span, _('Contents'), :class => 'icon-menu-articles'), {:controller => "search", :action => 'contents', :category_path => nil}, :id => 'submenu-contents') + | 1060 | link_to(content_tag(:span, _('Contents'), :class => 'icon-menu-articles'), {:controller => "search", :action => 'contents', :category_path => nil}, :id => 'submenu-contents') + |
1053 | - link_to(content_tag(:span, _('Contents menu')), '#', :onclick => "toggleSubmenu(this,'',#{CGI::escapeHTML(links.to_json)}); return false", :class => 'menu-submenu-trigger up', :id => 'submenu-contents-trigger') | 1061 | + popover_menu(_('Contents menu'),'',links,:class => 'up', :id => 'submenu-contents-trigger') |
1054 | end | 1062 | end |
1055 | alias :browse_contents_menu :search_contents_menu | 1063 | alias :browse_contents_menu :search_contents_menu |
1056 | 1064 | ||
@@ -1066,7 +1074,7 @@ module ApplicationHelper | @@ -1066,7 +1074,7 @@ module ApplicationHelper | ||
1066 | end | 1074 | end |
1067 | 1075 | ||
1068 | link_to(content_tag(:span, _('People'), :class => 'icon-menu-people'), {:controller => "search", :action => 'people', :category_path => ''}, :id => 'submenu-people') + | 1076 | link_to(content_tag(:span, _('People'), :class => 'icon-menu-people'), {:controller => "search", :action => 'people', :category_path => ''}, :id => 'submenu-people') + |
1069 | - link_to(content_tag(:span, _('People menu')), '#', :onclick => "toggleSubmenu(this,'',#{CGI::escapeHTML(links.to_json)}); return false", :class => 'menu-submenu-trigger up', :id => 'submenu-people-trigger') | 1077 | + popover_menu(_('People menu'),'',links,:class => 'up', :id => 'submenu-people-trigger') |
1070 | end | 1078 | end |
1071 | alias :browse_people_menu :search_people_menu | 1079 | alias :browse_people_menu :search_people_menu |
1072 | 1080 | ||
@@ -1082,7 +1090,7 @@ module ApplicationHelper | @@ -1082,7 +1090,7 @@ module ApplicationHelper | ||
1082 | end | 1090 | end |
1083 | 1091 | ||
1084 | link_to(content_tag(:span, _('Communities'), :class => 'icon-menu-community'), {:controller => "search", :action => 'communities'}, :id => 'submenu-communities') + | 1092 | link_to(content_tag(:span, _('Communities'), :class => 'icon-menu-community'), {:controller => "search", :action => 'communities'}, :id => 'submenu-communities') + |
1085 | - link_to(content_tag(:span, _('Communities menu')), '#', :onclick => "toggleSubmenu(this,'',#{CGI::escapeHTML(links.to_json)}); return false", :class => 'menu-submenu-trigger up', :id => 'submenu-communities-trigger') | 1093 | + popover_menu(_('Communities menu'),'',links,:class => 'up', :id => 'submenu-communities-trigger') |
1086 | end | 1094 | end |
1087 | alias :browse_communities_menu :search_communities_menu | 1095 | alias :browse_communities_menu :search_communities_menu |
1088 | 1096 |
app/helpers/block_helper.rb
@@ -19,7 +19,7 @@ module BlockHelper | @@ -19,7 +19,7 @@ module BlockHelper | ||
19 | content_tag('span', _('Title')) + | 19 | content_tag('span', _('Title')) + |
20 | text_field_tag('block[images][][title]', image[:title], :class => 'highlight-title', :size => 45) | 20 | text_field_tag('block[images][][title]', image[:title], :class => 'highlight-title', :size => 45) |
21 | }</label></td> | 21 | }</label></td> |
22 | - <td>#{link_to '', '#', :class=>'button icon-button icon-delete delete-highlight', :confirm=>_('Are you sure you want to remove this highlight')}</td> | 22 | + <td>#{button_without_text(:delete, _('Remove'), '#', class: 'delete-highlight', :confirm=>_('Are you sure you want to remove this highlight'))}</td> |
23 | </tr> | 23 | </tr> |
24 | " | 24 | " |
25 | end | 25 | end |
app/helpers/categories_helper.rb
@@ -25,10 +25,13 @@ module CategoriesHelper | @@ -25,10 +25,13 @@ module CategoriesHelper | ||
25 | ) | 25 | ) |
26 | end | 26 | end |
27 | 27 | ||
28 | - def update_categories_link(body, category_id=nil, html_options={}) | 28 | + #TODO: remove this function and, in views, use existing basic buttons |
29 | + def update_categories_link(type, body, category_id=nil, html_options={}) | ||
30 | + html_class = 'select-subcategory-link' | ||
31 | + html_class = " icon-#{type} btn btn-primary btn-xs" if type.present? | ||
29 | link_to body, | 32 | link_to body, |
30 | { :action => "update_categories", :category_id => category_id, :id => @object }, | 33 | { :action => "update_categories", :category_id => category_id, :id => @object }, |
31 | - {:id => category_id ? "select-category-#{category_id}-link" : nil, :remote => true, :class => 'select-subcategory-link'}.merge(html_options) | 34 | + {:id => category_id ? "select-category-#{category_id}-link" : nil, :remote => true, :class => html_class}.merge(html_options) |
32 | end | 35 | end |
33 | 36 | ||
34 | end | 37 | end |
app/helpers/language_helper.rb
1 | module LanguageHelper | 1 | module LanguageHelper |
2 | def language | 2 | def language |
3 | - locale | 3 | + locale.to_s |
4 | end | 4 | end |
5 | 5 | ||
6 | def tinymce_language | 6 | def tinymce_language |
@@ -20,7 +20,7 @@ module LanguageHelper | @@ -20,7 +20,7 @@ module LanguageHelper | ||
20 | separator = options[:separator] || ' — ' | 20 | separator = options[:separator] || ' — ' |
21 | 21 | ||
22 | if options[:element] == 'dropdown' | 22 | if options[:element] == 'dropdown' |
23 | - select_tag('lang', | 23 | + select_tag('lang', |
24 | options_for_select(locales.map{|code,name| [name, code]}, current), | 24 | options_for_select(locales.map{|code,name| [name, code]}, current), |
25 | :onchange => "document.location.href= #{url_for(params.merge(:lang => 'LANGUAGE'))}.replace(/LANGUAGE/, this.value) ;", | 25 | :onchange => "document.location.href= #{url_for(params.merge(:lang => 'LANGUAGE'))}.replace(/LANGUAGE/, this.value) ;", |
26 | :help => _('The language you choose here is the language used for options, buttons, etc. It does not affect the language of the content created by other users.') | 26 | :help => _('The language you choose here is the language used for options, buttons, etc. It does not affect the language of the content created by other users.') |
app/helpers/layout_helper.rb
@@ -31,12 +31,12 @@ module LayoutHelper | @@ -31,12 +31,12 @@ module LayoutHelper | ||
31 | plugins_javascripts = @plugins.map { |plugin| [plugin.js_files].flatten.map { |js| plugin.class.public_path(js) } }.flatten | 31 | plugins_javascripts = @plugins.map { |plugin| [plugin.js_files].flatten.map { |js| plugin.class.public_path(js) } }.flatten |
32 | 32 | ||
33 | output = '' | 33 | output = '' |
34 | - output += render :file => 'layouts/_javascript' | ||
35 | - output += javascript_tag 'render_all_jquery_ui_widgets()' | 34 | + output += render 'layouts/javascript' |
36 | unless plugins_javascripts.empty? | 35 | unless plugins_javascripts.empty? |
37 | output += javascript_include_tag plugins_javascripts, :cache => "cache/plugins-#{Digest::MD5.hexdigest plugins_javascripts.to_s}" | 36 | output += javascript_include_tag plugins_javascripts, :cache => "cache/plugins-#{Digest::MD5.hexdigest plugins_javascripts.to_s}" |
38 | end | 37 | end |
39 | output += theme_javascript_ng.to_s | 38 | output += theme_javascript_ng.to_s |
39 | + output += javascript_tag 'render_all_jquery_ui_widgets()' | ||
40 | 40 | ||
41 | output | 41 | output |
42 | end | 42 | end |
@@ -85,6 +85,7 @@ module LayoutHelper | @@ -85,6 +85,7 @@ module LayoutHelper | ||
85 | end | 85 | end |
86 | end | 86 | end |
87 | 87 | ||
88 | + | ||
88 | def icon_theme_stylesheet_path | 89 | def icon_theme_stylesheet_path |
89 | icon_themes = [] | 90 | icon_themes = [] |
90 | theme_icon_themes = theme_option(:icon_theme) || [] | 91 | theme_icon_themes = theme_option(:icon_theme) || [] |
app/views/account/login.html.erb
@@ -7,7 +7,7 @@ | @@ -7,7 +7,7 @@ | ||
7 | 7 | ||
8 | <%= @message %> | 8 | <%= @message %> |
9 | 9 | ||
10 | -<%= labelled_form_for :user, :url => login_url do |f| %> | 10 | +<%= labelled_form_for :user, :url => login_url, :horizontal => true do |f| %> |
11 | 11 | ||
12 | <%= f.text_field :login, :id => 'main_user_login', :onchange => 'this.value = convToValidLogin( this.value )', :value => params[:userlogin] %> | 12 | <%= f.text_field :login, :id => 'main_user_login', :onchange => 'this.value = convToValidLogin( this.value )', :value => params[:userlogin] %> |
13 | 13 |
app/views/account/login_block.html.erb
@@ -20,9 +20,7 @@ | @@ -20,9 +20,7 @@ | ||
20 | <% button_bar do %> | 20 | <% button_bar do %> |
21 | <%= submit_button( 'login', _('Log in') )%> | 21 | <%= submit_button( 'login', _('Log in') )%> |
22 | <% unless @plugins.dispatch(:allow_user_registration).include?(false) %> | 22 | <% unless @plugins.dispatch(:allow_user_registration).include?(false) %> |
23 | - <%= link_to content_tag( 'span', _('New user') ), | ||
24 | - { :controller => 'account', :action => 'signup' }, | ||
25 | - :class => 'button with-text icon-add' %> | 23 | + <%= button(:add, _('New user'), { :controller => 'account', :action => 'signup' }) %> |
26 | <% end %> | 24 | <% end %> |
27 | <% end %> | 25 | <% end %> |
28 | 26 |
app/views/blocks/login_block.html.erb
@@ -6,7 +6,7 @@ | @@ -6,7 +6,7 @@ | ||
6 | <li><%= link_to _('Homepage'), user.public_profile_url %></li> | 6 | <li><%= link_to _('Homepage'), user.public_profile_url %></li> |
7 | </ul> | 7 | </ul> |
8 | <div class="user-actions"> | 8 | <div class="user-actions"> |
9 | - <%= link_to content_tag('span', _('Logout')), { :controller => 'account', :action => 'logout' }, :class => 'button with-text icon-menu-logout' %> | 9 | + <%= button(:'menu-logout', _('Logout'), :controller => 'account', :action => 'logout') %> |
10 | </div> | 10 | </div> |
11 | </div> | 11 | </div> |
12 | <% else %> | 12 | <% else %> |
app/views/blocks/profile_info_actions/_community.html.erb
@@ -5,11 +5,11 @@ | @@ -5,11 +5,11 @@ | ||
5 | <% if logged_in? %> | 5 | <% if logged_in? %> |
6 | <% if profile.enable_contact? %> | 6 | <% if profile.enable_contact? %> |
7 | <li> | 7 | <li> |
8 | - <%= link_to content_tag('span', _('Send an e-mail')), | ||
9 | - { :profile => profile.identifier, | ||
10 | - :controller => 'contact', | ||
11 | - :action => 'new' }, | ||
12 | - {:class => 'button with-text icon-menu-mail', :title => _('Send an e-mail to the administrators')} %> | 8 | + <%= button(:'menu-mail', _('Send an e-mail'), |
9 | + { :profile => profile.identifier, | ||
10 | + :controller => 'contact', | ||
11 | + :action => 'new' }, | ||
12 | + { :title => _('Send an e-mail to the administrators')}) %> | ||
13 | </li> | 13 | </li> |
14 | <% end %> | 14 | <% end %> |
15 | 15 |
app/views/blocks/profile_info_actions/_enterprise.html.erb
1 | <ul> | 1 | <ul> |
2 | <%if logged_in? %> | 2 | <%if logged_in? %> |
3 | <%if !user.favorite_enterprises.include?(profile) %> | 3 | <%if !user.favorite_enterprises.include?(profile) %> |
4 | - <li><%= link_to content_tag('span', _('Add as favorite')), { :profile => user.identifier, :controller => 'favorite_enterprises', :action => 'add', :id => profile.id }, :class => 'button with-text icon-add', :title => _('Add enterprise as favorite') %></li> | 4 | + <li><%= button(:add, _('Add as favorite'), { :profile => user.identifier, :controller => 'favorite_enterprises', :action => 'add', :id => profile.id }, :title => _('Add enterprise as favorite')) %></li> |
5 | <% end %> | 5 | <% end %> |
6 | <% end %> | 6 | <% end %> |
7 | <% if profile.enable_contact? %> | 7 | <% if profile.enable_contact? %> |
8 | - <li> <%= link_to content_tag('span', _('Send an e-mail')), {:profile => profile.identifier, :controller => 'contact', :action => 'new'}, {:id => 'enterprise-contact-button', :class => 'button with-text icon-menu-mail'} %> </li> | 8 | + <li><%= button(:'menu-mail', _('Send an e-mail'), {:profile => profile.identifier, :controller => 'contact', :action => 'new'}, {:id => 'enterprise-contact-button'} ) %></li> |
9 | <% end %> | 9 | <% end %> |
10 | 10 | ||
11 | <li><%= report_abuse(profile, :button) %></li> | 11 | <li><%= report_abuse(profile, :button) %></li> |
app/views/blocks/profile_info_actions/_join_leave_community.html.erb
@@ -22,8 +22,6 @@ | @@ -22,8 +22,6 @@ | ||
22 | <% end %> | 22 | <% end %> |
23 | <% end %> | 23 | <% end %> |
24 | <% else %> | 24 | <% else %> |
25 | - <%= link_to content_tag('span', _('Join')), profile.join_not_logged_url, | ||
26 | - :class => 'button with-text icon-add', | ||
27 | - :title => _('Join this community') %> | 25 | + <%= button(:add, _('Join'), profile.join_not_logged_url, :title => _('Join this community')) %> |
28 | <% end %> | 26 | <% end %> |
29 | </div> | 27 | </div> |
app/views/blocks/profile_info_actions/_person.html.erb
@@ -8,7 +8,7 @@ | @@ -8,7 +8,7 @@ | ||
8 | <% end %> | 8 | <% end %> |
9 | 9 | ||
10 | <% if user.is_a_friend?(profile) && profile.enable_contact? %> | 10 | <% if user.is_a_friend?(profile) && profile.enable_contact? %> |
11 | - <li> <%= link_to content_tag('span', _('Send an e-mail')), {:profile => profile.identifier, :controller => 'contact', :action => 'new'}, :class => 'button with-text icon-menu-mail' %> </li> | 11 | + <li><%= button(:back, _('Send an e-mail'), {:profile => profile.identifier, :controller => 'contact', :action => 'new'}) %></li> |
12 | <% end %> | 12 | <% end %> |
13 | 13 | ||
14 | <li><%= report_abuse(profile, :button) %></li> | 14 | <li><%= report_abuse(profile, :button) %></li> |
app/views/box_organizer/_highlights_block.html.erb
@@ -15,7 +15,7 @@ | @@ -15,7 +15,7 @@ | ||
15 | </tbody> | 15 | </tbody> |
16 | </table> | 16 | </table> |
17 | 17 | ||
18 | -<%= link_to(_('New highlight'), '#', :class => 'button icon-add with-text new-highlight-button')%> | 18 | +<%= button(:add, _('New highlight'), '#', class: 'new-highlight-button') %> |
19 | 19 | ||
20 | <%= labelled_form_field _('Image transition:'), select('block', 'interval', [[_('No automatic transition'), 0]] + [1, 2, 3, 4, 5, 10, 20, 30, 60].map {|item| [n_('Every 1 second', 'Every %d seconds', item) % item, item]}) %> | 20 | <%= labelled_form_field _('Image transition:'), select('block', 'interval', [[_('No automatic transition'), 0]] + [1, 2, 3, 4, 5, 10, 20, 30, 60].map {|item| [n_('Every 1 second', 'Every %d seconds', item) % item, item]}) %> |
21 | 21 |
app/views/comment/_comment_actions.html.erb
@@ -2,7 +2,7 @@ | @@ -2,7 +2,7 @@ | ||
2 | <% if !links_submenu.empty? %> | 2 | <% if !links_submenu.empty? %> |
3 | <div class="comment-actions"> | 3 | <div class="comment-actions"> |
4 | <li class="vcard"> | 4 | <li class="vcard"> |
5 | - <%= link_to(content_tag(:span, _('Contents menu')), '#', :onclick => "toggleSubmenu(this,'',#{CGI::escapeHTML(links_submenu.to_json)}); return false", :class => 'menu-submenu-trigger comment-trigger', :url => url) %> | 5 | + <%= popover_menu(_('Contents menu'),'',links_submenu,:class => 'comment-trigger', :url => url) %> |
6 | </li> | 6 | </li> |
7 | </div> | 7 | </div> |
8 | <% end %> | 8 | <% end %> |
app/views/favorite_enterprises/index.html.erb
@@ -9,10 +9,7 @@ | @@ -9,10 +9,7 @@ | ||
9 | enterprise.identifier, :class => 'profile-link' %> | 9 | enterprise.identifier, :class => 'profile-link' %> |
10 | <%# profile_image_link enterprise, :portrait, 'div' %> | 10 | <%# profile_image_link enterprise, :portrait, 'div' %> |
11 | <div class="controll"> | 11 | <div class="controll"> |
12 | - <%= link_to content_tag('span',_('remove')), | ||
13 | - { :action => 'remove', :id => enterprise.id }, | ||
14 | - :class => 'button icon-delete', | ||
15 | - :title => _('remove') %> | 12 | + <%= button(:delete, _('remove'), { :action => 'remove', :id => enterprise.id },:title => _('remove')) %> |
16 | </div><!-- end class="controll" --> | 13 | </div><!-- end class="controll" --> |
17 | </li> | 14 | </li> |
18 | <% end %> | 15 | <% end %> |
app/views/search/_sellers_form.html.erb
app/views/shared/_change_image.html.erb
1 | <%= i.file_field( :uploaded_data, { :onchange => 'updateImg(this.value)' } ) %> | 1 | <%= i.file_field( :uploaded_data, { :onchange => 'updateImg(this.value)' } ) %> |
2 | - <%= link_to_function(_('Cancel'), "jQuery('#change-image-link').show(); jQuery('#change-image').html('')", :id => 'cancel-change-image-link', :class => 'button icon-cancel with-text', :style => 'display: none') %> | 2 | + <%= button_to_function(:cancel,_('Cancel'),"jQuery('#change-image-link').show(); jQuery('#change-image').html('')", :id => 'cancel-change-image-link', :style => 'display: none')%> |
app/views/shared/_select_categories.html.erb
@@ -4,12 +4,12 @@ | @@ -4,12 +4,12 @@ | ||
4 | <%= hidden_field_tag "#{object_name}[#{object_name}_category_id]", @current_category.id unless multiple %> | 4 | <%= hidden_field_tag "#{object_name}[#{object_name}_category_id]", @current_category.id unless multiple %> |
5 | <%= hidden_field_tag "#{object_name}[category_ids][]", @current_category.id if multiple %> | 5 | <%= hidden_field_tag "#{object_name}[category_ids][]", @current_category.id if multiple %> |
6 | 6 | ||
7 | - <%= update_categories_link("", nil, :id => "cancel-category-button", :class => "button icon-back") %> | 7 | + <%= update_categories_link(:back, "", nil, :id => "cancel-category-button") %> |
8 | <% | 8 | <% |
9 | categories = [@current_category] | 9 | categories = [@current_category] |
10 | categories.push(@current_category) while @current_category = @current_category.parent | 10 | categories.push(@current_category) while @current_category = @current_category.parent |
11 | %> | 11 | %> |
12 | - <%= categories.compact.reverse.map{|i| update_categories_link(i.name, i.id)}.join %> | 12 | + <%= categories.compact.reverse.map{|i| update_categories_link(nil,i.name, i.id)}.join %> |
13 | 13 | ||
14 | <script> | 14 | <script> |
15 | function add_category() { | 15 | function add_category() { |
app/views/shared/_select_subcategories.html.erb
@@ -3,6 +3,6 @@ | @@ -3,6 +3,6 @@ | ||
3 | <div class="category-helper-label"><%= _('Click to select a category') %></div> | 3 | <div class="category-helper-label"><%= _('Click to select a category') %></div> |
4 | 4 | ||
5 | <% categories.select{|i| @object.accept_category?(i)}.each do |category| %> | 5 | <% categories.select{|i| @object.accept_category?(i)}.each do |category| %> |
6 | - <%= update_categories_link(category.name, category.id) %> | 6 | + <%= update_categories_link(nil,category.name, category.id) %> |
7 | <% end %> | 7 | <% end %> |
8 | <% end %> | 8 | <% end %> |
app/views/shared/_show_thumbnail.html.erb
@@ -2,7 +2,7 @@ | @@ -2,7 +2,7 @@ | ||
2 | 2 | ||
3 | <br/> | 3 | <br/> |
4 | 4 | ||
5 | - <%= link_to_function(_('Change image'), 'display_change_image()', :id => 'change-image-link', :class => 'button icon-photos with-text') %> | 5 | + <%= button_to_function(:photos, _('Change image'), 'display_change_image()', :id => 'change-image-link' ) %> |
6 | 6 | ||
7 | <script> | 7 | <script> |
8 | function display_change_image() { | 8 | function display_change_image() { |
app/views/tasks/index.html.erb
@@ -23,7 +23,7 @@ | @@ -23,7 +23,7 @@ | ||
23 | 23 | ||
24 | <% if @tasks.empty? %> | 24 | <% if @tasks.empty? %> |
25 | <p> | 25 | <p> |
26 | - <%= labelled_select(_('Filter')+': ', :filter_type, :first, :last, @filter, type_collection, :onchange => 'document.location.href = "?filter_type="+this.value')%> | 26 | + <%= labelled_select(_('Filter')+': ', :filter_type, :first, :last, @filter, type_collection, :onchange => "document.location.href = '?filter_type='+this.value")%> |
27 | </p> | 27 | </p> |
28 | <em><%= _('No pending tasks for %s') % profile.name %></em> | 28 | <em><%= _('No pending tasks for %s') % profile.name %></em> |
29 | <% else %> | 29 | <% else %> |
test/test_helper.rb
@@ -140,9 +140,18 @@ class ActiveSupport::TestCase | @@ -140,9 +140,18 @@ class ActiveSupport::TestCase | ||
140 | end | 140 | end |
141 | 141 | ||
142 | # For models that render views (blocks, articles, ...) | 142 | # For models that render views (blocks, articles, ...) |
143 | - def render(*args) | ||
144 | - view_paths = @explicit_view_paths || ActionController::Base.view_paths | ||
145 | - ActionView::Base.new(view_paths, {}).render(*args) | 143 | + def self.action_view |
144 | + @action_view ||= begin | ||
145 | + view_paths = ActionController::Base.view_paths | ||
146 | + action_view = ActionView::Base.new view_paths, {} | ||
147 | + # for using Noosfero helpers inside render calls | ||
148 | + action_view.extend ApplicationHelper | ||
149 | + action_view | ||
150 | + end | ||
151 | + end | ||
152 | + | ||
153 | + def render *args | ||
154 | + self.class.action_view.render(*args) | ||
146 | end | 155 | end |
147 | 156 | ||
148 | private | 157 | private |