diff options
author | Eric Davis <edavis@littlestreamsoftware.com> | 2010-09-10 23:07:10 +0000 |
---|---|---|
committer | Eric Davis <edavis@littlestreamsoftware.com> | 2010-09-10 23:07:10 +0000 |
commit | 878bb555227628d983997d96320a99ebb53adc7b (patch) | |
tree | 50d730a5813e5aed9d6a51f1e7f0ca07e0e67834 /app | |
parent | d36700eeee57dcd5da0078bf891b8186d30eb382 (diff) | |
download | redmine-878bb555227628d983997d96320a99ebb53adc7b.tar.gz redmine-878bb555227628d983997d96320a99ebb53adc7b.zip |
Refactor: move method to Project#css_classes
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@4080 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app')
-rw-r--r-- | app/helpers/admin_helper.rb | 8 | ||||
-rw-r--r-- | app/models/project.rb | 8 | ||||
-rw-r--r-- | app/views/admin/projects.rhtml | 2 |
3 files changed, 9 insertions, 9 deletions
diff --git a/app/helpers/admin_helper.rb b/app/helpers/admin_helper.rb index b49a5674c..8f81f66ba 100644 --- a/app/helpers/admin_helper.rb +++ b/app/helpers/admin_helper.rb @@ -20,12 +20,4 @@ module AdminHelper options_for_select([[l(:label_all), ''], [l(:status_active), 1]], selected) 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 diff --git a/app/models/project.rb b/app/models/project.rb index 5ef7915de..40898a34e 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -413,6 +413,14 @@ class Project < ActiveRecord::Base description.gsub(/^(.{#{length}}[^\n\r]*).*$/m, '\1...').strip if description 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 def start_date if module_enabled?(:issue_tracking) diff --git a/app/views/admin/projects.rhtml b/app/views/admin/projects.rhtml index 6cf933d11..47a2d0583 100644 --- a/app/views/admin/projects.rhtml +++ b/app/views/admin/projects.rhtml @@ -26,7 +26,7 @@ </tr></thead> <tbody> <% 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><%= textilizable project.short_description, :project => project %></td> <td align="center"><%= checked_image project.is_public? %></td> |