diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index c8754b314..ad2309f9a 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -55,5 +55,33 @@ module ApplicationHelper render :partial => partial, :object => new_object, :locals => {:f => f} end end + + def active_for_controllers(*controller_names) + controller_names.include?(controller.controller_name) ? 'active' : nil + end + + def visible_for_controllers(*controller_names) + controller_names.include?(controller.controller_name) ? '' : 'hide' + end + + def active_for_action(controller_name, action_name) + (controller.controller_name.eql?(controller_name) && controller.action_name.eql?(action_name)) ? 'active' : nil + end + + def sortable(column) + direction = (column == params[:sort] && params[:direction] == "asc") ? "desc" : "asc" + {:sort => column, :direction => direction} + end + + def add_filter(param_name, value) + filter = params[:filter] rescue nil + if filter && filter.has_key(param_name) + filter[param_name] << value + elsif filter + filter.merge({param_name => [value]}) + else + {param_name => [value]} + end + end end diff --git a/app/views/layouts/_orbit_bar.html.erb b/app/views/layouts/_orbit_bar.html.erb index 469ddc8f5..f4f8feef7 100644 --- a/app/views/layouts/_orbit_bar.html.erb +++ b/app/views/layouts/_orbit_bar.html.erb @@ -15,7 +15,6 @@