2007-03-12 20:59:02 +03:00
|
|
|
# redMine - project management software
|
|
|
|
# Copyright (C) 2006 Jean-Philippe Lang
|
|
|
|
#
|
|
|
|
# This program is free software; you can redistribute it and/or
|
|
|
|
# modify it under the terms of the GNU General Public License
|
|
|
|
# as published by the Free Software Foundation; either version 2
|
|
|
|
# of the License, or (at your option) any later version.
|
|
|
|
#
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with this program; if not, write to the Free Software
|
|
|
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
|
|
|
|
module ProjectsHelper
|
2007-05-07 20:54:26 +04:00
|
|
|
def link_to_version(version, options = {})
|
|
|
|
return '' unless version && version.is_a?(Version)
|
2008-03-08 14:17:03 +03:00
|
|
|
link_to h(version.name), { :controller => 'versions', :action => 'show', :id => version }, options
|
2007-05-07 20:54:26 +04:00
|
|
|
end
|
2007-08-26 11:55:57 +04:00
|
|
|
|
2008-06-04 22:13:14 +04:00
|
|
|
def format_activity_title(text)
|
|
|
|
h(truncate_single_line(text, 100))
|
|
|
|
end
|
|
|
|
|
2008-03-05 16:44:08 +03:00
|
|
|
def format_activity_day(date)
|
|
|
|
date == Date.today ? l(:label_today).titleize : format_date(date)
|
|
|
|
end
|
|
|
|
|
2008-02-04 22:37:23 +03:00
|
|
|
def format_activity_description(text)
|
2008-06-24 20:52:41 +04:00
|
|
|
h(truncate(text.to_s, 250).gsub(%r{<(pre|code)>.*$}m, '...'))
|
2008-02-04 22:37:23 +03:00
|
|
|
end
|
|
|
|
|
2007-09-14 15:34:08 +04:00
|
|
|
def project_settings_tabs
|
|
|
|
tabs = [{:name => 'info', :action => :edit_project, :partial => 'projects/edit', :label => :label_information_plural},
|
|
|
|
{:name => 'modules', :action => :select_project_modules, :partial => 'projects/settings/modules', :label => :label_module_plural},
|
|
|
|
{:name => 'members', :action => :manage_members, :partial => 'projects/settings/members', :label => :label_member_plural},
|
|
|
|
{:name => 'versions', :action => :manage_versions, :partial => 'projects/settings/versions', :label => :label_version_plural},
|
|
|
|
{:name => 'categories', :action => :manage_categories, :partial => 'projects/settings/issue_categories', :label => :label_issue_category_plural},
|
|
|
|
{:name => 'wiki', :action => :manage_wiki, :partial => 'projects/settings/wiki', :label => :label_wiki},
|
|
|
|
{:name => 'repository', :action => :manage_repository, :partial => 'projects/settings/repository', :label => :label_repository},
|
|
|
|
{:name => 'boards', :action => :manage_boards, :partial => 'projects/settings/boards', :label => :label_board_plural}
|
|
|
|
]
|
|
|
|
tabs.select {|tab| User.current.allowed_to?(tab[:action], @project)}
|
|
|
|
end
|
2006-06-28 22:11:03 +04:00
|
|
|
end
|