2012-01-30 20:39:34 +00:00
|
|
|
# -*- encoding : utf-8 -*-
|
2011-03-09 13:13:36 +00:00
|
|
|
module ApplicationHelper
|
2012-02-29 14:04:04 +00:00
|
|
|
def layout_class
|
|
|
|
case
|
2012-05-02 10:18:07 +01:00
|
|
|
when controller_name == 'issues' && action_name == 'new'
|
2012-03-01 17:33:46 +00:00
|
|
|
'right nopadding'
|
2012-05-02 10:18:07 +01:00
|
|
|
when controller_name == 'build_lists' && action_name == 'index'
|
2012-03-01 17:33:46 +00:00
|
|
|
'right slim'
|
2012-05-02 10:18:07 +01:00
|
|
|
when controller_name == 'build_lists' && ['new', 'create'].include?(action_name)
|
2012-02-29 14:04:04 +00:00
|
|
|
nil
|
2012-05-25 16:56:26 +01:00
|
|
|
when controller_name == 'platforms' && ['build_all', 'mass_builds'].include?(action_name)
|
2012-05-28 11:28:19 +01:00
|
|
|
'right slim'
|
2012-05-02 10:18:07 +01:00
|
|
|
when controller_name == 'platforms' && action_name == 'show'
|
2012-03-11 23:08:50 +00:00
|
|
|
'right bigpadding'
|
2012-05-02 10:18:07 +01:00
|
|
|
when controller_name == 'platforms' && action_name == 'clone'
|
2012-03-13 15:05:33 +00:00
|
|
|
'right middlepadding'
|
2012-07-20 17:06:31 +01:00
|
|
|
when controller_name == 'contacts' && action_name == 'sended'
|
|
|
|
'all feedback_sended'
|
2012-03-01 17:33:46 +00:00
|
|
|
else
|
|
|
|
content_for?(:sidebar) ? 'right' : 'all'
|
2012-02-29 14:04:04 +00:00
|
|
|
end
|
|
|
|
end
|
2012-03-29 19:34:45 +01:00
|
|
|
|
2012-05-05 17:15:49 +01:00
|
|
|
def top_menu_class(base)
|
|
|
|
(controller_name.include?('build_lists') ? controller_name : params[:controller]).include?(base.to_s) ? 'active' : nil
|
|
|
|
end
|
|
|
|
|
2012-03-30 13:30:39 +01:00
|
|
|
def title_object object
|
2012-05-10 16:15:50 +01:00
|
|
|
return object.advisory_id if object.class == Advisory
|
2012-03-30 13:30:39 +01:00
|
|
|
name = object.class == Group ? object.uname : object.name
|
|
|
|
object_name = t "activerecord.models.#{object.class.name.downcase}"
|
|
|
|
case object.class.name
|
|
|
|
when 'Project', 'Platform'
|
|
|
|
"#{object_name} #{object.owner.uname}/#{object.name}"
|
|
|
|
when 'Repository', 'Product'
|
|
|
|
"#{object_name} #{object.name} - #{title_object object.platform}"
|
|
|
|
when 'Group'
|
|
|
|
"#{object_name} #{object.uname}"
|
|
|
|
else object.class.name
|
|
|
|
end
|
|
|
|
end
|
2011-03-09 13:13:36 +00:00
|
|
|
end
|