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
|
|
|
|
when params[:controller] == 'issues' && params[:action] == 'new'
|
2012-03-01 17:33:46 +00:00
|
|
|
'right nopadding'
|
|
|
|
when params[:controller] == 'build_lists' && params[:action] == 'index'
|
|
|
|
'right slim'
|
|
|
|
when params[:controller] == 'build_lists' && ['new', 'create'].include?(params[:action])
|
2012-02-29 14:04:04 +00:00
|
|
|
nil
|
2012-03-11 23:08:50 +00:00
|
|
|
when params[:controller] == 'platforms' && params[:action] == 'show'
|
|
|
|
'right bigpadding'
|
2012-03-13 15:05:33 +00:00
|
|
|
when params[:controller] == 'platforms' && params[:action] == 'clone'
|
|
|
|
'right middlepadding'
|
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-03-30 13:30:39 +01:00
|
|
|
def title_object object
|
|
|
|
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
|