Refactor: move method to Project#css_classes

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@4080 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Eric Davis 2010-09-10 23:07:10 +00:00
parent d36700eeee
commit 878bb55522
3 changed files with 9 additions and 9 deletions

View File

@ -20,12 +20,4 @@ module AdminHelper
options_for_select([[l(:label_all), ''], options_for_select([[l(:label_all), ''],
[l(:status_active), 1]], selected) [l(:status_active), 1]], selected)
end end
def css_project_classes(project)
s = 'project'
s << ' root' if project.root?
s << ' child' if project.child?
s << (project.leaf? ? ' leaf' : ' parent')
s
end
end end

View File

@ -413,6 +413,14 @@ class Project < ActiveRecord::Base
description.gsub(/^(.{#{length}}[^\n\r]*).*$/m, '\1...').strip if description description.gsub(/^(.{#{length}}[^\n\r]*).*$/m, '\1...').strip if description
end end
def css_classes
s = 'project'
s << ' root' if root?
s << ' child' if child?
s << (leaf? ? ' leaf' : ' parent')
s
end
# The earliest start date of a project, based on it's issues and versions # The earliest start date of a project, based on it's issues and versions
def start_date def start_date
if module_enabled?(:issue_tracking) if module_enabled?(:issue_tracking)

View File

@ -26,7 +26,7 @@
</tr></thead> </tr></thead>
<tbody> <tbody>
<% project_tree(@projects) do |project, level| %> <% project_tree(@projects) do |project, level| %>
<tr class="<%= cycle("odd", "even") %> <%= css_project_classes(project) %> <%= level > 0 ? "idnt idnt-#{level}" : nil %>"> <tr class="<%= cycle("odd", "even") %> <%= project.css_classes %> <%= level > 0 ? "idnt idnt-#{level}" : nil %>">
<td class="name"><%= link_to_project(project, :action => 'settings') %></td> <td class="name"><%= link_to_project(project, :action => 'settings') %></td>
<td><%= textilizable project.short_description, :project => project %></td> <td><%= textilizable project.short_description, :project => project %></td>
<td align="center"><%= checked_image project.is_public? %></td> <td align="center"><%= checked_image project.is_public? %></td>