##// END OF EJS Templates
Prepend page title to anchor in single page wiki HTML export to make links more unique....
Prepend page title to anchor in single page wiki HTML export to make links more unique. git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@7562 e93f8b46-1217-0410-a6f0-8f06a7374b81

File last commit:

r6373:a8bcfc5c7a9e
r7442:8bb90f87fb73
Show More
projects_helper.rb
108 lines | 5.1 KiB | text/x-ruby | RubyLexer
/ app / helpers / projects_helper.rb
Toshi MARUYAMA
remove trailing white-spaces from projects helper source....
r5729 # Redmine - project management software
# Copyright (C) 2006-2011 Jean-Philippe Lang
Jean-Philippe Lang
added svn:eol-style native property on /app files...
r330 #
# 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.
Toshi MARUYAMA
remove trailing white-spaces from projects helper source....
r5729 #
Jean-Philippe Lang
added svn:eol-style native property on /app files...
r330 # 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.
Toshi MARUYAMA
remove trailing white-spaces from projects helper source....
r5729 #
Jean-Philippe Lang
added svn:eol-style native property on /app files...
r330 # 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
Jean-Philippe Lang
Added an option to see all versions in the roadmap view (including completed ones)....
r513 def link_to_version(version, options = {})
return '' unless version && version.is_a?(Version)
Jean-Philippe Lang
Version sharing (#465) + optional inclusion of subprojects in the roadmap view (#2666)....
r3009 link_to_if version.visible?, format_version_name(version), { :controller => 'versions', :action => 'show', :id => version }, options
Jean-Philippe Lang
Added an option to see all versions in the roadmap view (including completed ones)....
r513 end
Toshi MARUYAMA
remove trailing white-spaces from projects helper source....
r5729
Jean-Philippe Lang
Added project module concept....
r714 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},
Eric Davis
Added a Activities tab to Project Settings...
r2835 {:name => 'boards', :action => :manage_boards, :partial => 'projects/settings/boards', :label => :label_board_plural},
{:name => 'activities', :action => :manage_project_activities, :partial => 'projects/settings/activities', :label => :enumeration_activities}
Jean-Philippe Lang
Added project module concept....
r714 ]
Toshi MARUYAMA
remove trailing white-spaces from projects helper source....
r5729 tabs.select {|tab| User.current.allowed_to?(tab[:action], @project)}
Jean-Philippe Lang
Added project module concept....
r714 end
Toshi MARUYAMA
remove trailing white-spaces from projects helper source....
r5729
Jean-Philippe Lang
Merged nested projects branch. Removes limit on subproject nesting (#594)....
r2302 def parent_project_select_tag(project)
Jean-Philippe Lang
Adds a 'Add subprojects' permission....
r3124 selected = project.parent
# retrieve the requested parent project
parent_id = (params[:project] && params[:project][:parent_id]) || params[:parent_id]
if parent_id
selected = (parent_id.blank? ? nil : Project.find(parent_id))
end
Toshi MARUYAMA
remove trailing white-spaces from projects helper source....
r5729
Jean-Philippe Lang
Adds a 'Add subprojects' permission....
r3124 options = ''
options << "<option value=''></option>" if project.allowed_parents.include?(nil)
options << project_tree_options_for_select(project.allowed_parents.compact, :selected => selected)
Toshi MARUYAMA
Rails3: use String#html_safe for parent_project_select_tag() at ProjectsHelper....
r6372 content_tag('select', options.html_safe, :name => 'project[parent_id]', :id => 'project_parent_id')
Jean-Philippe Lang
Merged nested projects branch. Removes limit on subproject nesting (#594)....
r2302 end
Toshi MARUYAMA
remove trailing white-spaces from projects helper source....
r5729
Jean-Philippe Lang
Merged nested projects branch. Removes limit on subproject nesting (#594)....
r2302 # Renders a tree of projects as a nested set of unordered lists
# The given collection may be a subset of the whole project tree
# (eg. some intermediate nodes are private and can not be seen)
def render_project_hierarchy(projects)
s = ''
if projects.any?
ancestors = []
Eric Davis
Set @project so macros will work on the welcome and project list. #5781...
r3710 original_project = @project
Jean-Philippe Lang
Merged nested projects branch. Removes limit on subproject nesting (#594)....
r2302 projects.each do |project|
Eric Davis
Set @project so macros will work on the welcome and project list. #5781...
r3710 # set the project environment to please macros.
@project = project
Jean-Philippe Lang
Merged nested projects branch. Removes limit on subproject nesting (#594)....
r2302 if (ancestors.empty? || project.is_descendant_of?(ancestors.last))
s << "<ul class='projects #{ ancestors.empty? ? 'root' : nil}'>\n"
else
ancestors.pop
s << "</li>"
Toshi MARUYAMA
remove trailing white-spaces from projects helper source....
r5729 while (ancestors.any? && !project.is_descendant_of?(ancestors.last))
Jean-Philippe Lang
Merged nested projects branch. Removes limit on subproject nesting (#594)....
r2302 ancestors.pop
s << "</ul></li>\n"
end
end
classes = (ancestors.empty? ? 'root' : 'child')
s << "<li class='#{classes}'><div class='#{classes}'>" +
Jean-Baptiste Barth
Refactor: added link_to_project helper to handle links to projects...
r3810 link_to_project(project, {}, :class => "project #{User.current.member_of?(project) ? 'my-project' : nil}")
Jean-Philippe Lang
Merged nested projects branch. Removes limit on subproject nesting (#594)....
r2302 s << "<div class='wiki description'>#{textilizable(project.short_description, :project => project)}</div>" unless project.description.blank?
s << "</div>\n"
ancestors << project
end
s << ("</li></ul>\n" * ancestors.size)
Eric Davis
Set @project so macros will work on the welcome and project list. #5781...
r3710 @project = original_project
Jean-Philippe Lang
Merged nested projects branch. Removes limit on subproject nesting (#594)....
r2302 end
Toshi MARUYAMA
Rails3: use String#html_safe for render_project_hierarchy() at ProjectsHelper....
r6373 s.html_safe
Jean-Philippe Lang
Merged nested projects branch. Removes limit on subproject nesting (#594)....
r2302 end
Jean-Philippe Lang
Version sharing (#465) + optional inclusion of subprojects in the roadmap view (#2666)....
r3009
# Returns a set of options for a select field, grouped by project.
def version_options_for_select(versions, selected=nil)
grouped = Hash.new {|h,k| h[k] = []}
versions.each do |version|
Jean-Philippe Lang
Remove invalid escaping in version field (#4460)....
r3116 grouped[version.project.name] << [version.name, version.id]
Jean-Philippe Lang
Version sharing (#465) + optional inclusion of subprojects in the roadmap view (#2666)....
r3009 end
# Add in the selected
if selected && !versions.include?(selected)
Jean-Philippe Lang
Remove invalid escaping in version field (#4460)....
r3116 grouped[selected.project.name] << [selected.name, selected.id]
Jean-Philippe Lang
Version sharing (#465) + optional inclusion of subprojects in the roadmap view (#2666)....
r3009 end
Toshi MARUYAMA
remove trailing white-spaces from projects helper source....
r5729
Jean-Philippe Lang
Version sharing (#465) + optional inclusion of subprojects in the roadmap view (#2666)....
r3009 if grouped.keys.size > 1
grouped_options_for_select(grouped, selected && selected.id)
else
Jean-Philippe Lang
Fixed: Bulk edit of issues throws 500 if no versions are defined on the project (#4366)....
r3026 options_for_select((grouped.values.first || []), selected && selected.id)
Jean-Philippe Lang
Version sharing (#465) + optional inclusion of subprojects in the roadmap view (#2666)....
r3009 end
end
def format_version_sharing(sharing)
sharing = 'none' unless Version::VERSION_SHARINGS.include?(sharing)
l("label_version_sharing_#{sharing}")
end
Jean-Philippe Lang
Initial commit...
r2 end