##// END OF EJS Templates
Don't add the inclusion error when tracker is not set, the blank error is enough....
Don't add the inclusion error when tracker is not set, the blank error is enough. git-svn-id: http://svn.redmine.org/redmine/trunk@15492 e93f8b46-1217-0410-a6f0-8f06a7374b81

File last commit:

r14955:fb6b565a1ec9
r15110:90d14b71b365
Show More
projects_helper.rb
136 lines | 5.8 KiB | text/x-ruby | RubyLexer
/ app / helpers / projects_helper.rb
Jean-Philippe Lang
Added encoding comment to helpers (#9792)....
r8090 # encoding: utf-8
#
Toshi MARUYAMA
remove trailing white-spaces from projects helper source....
r5729 # Redmine - project management software
Jean-Philippe Lang
Updates copyright for 2016....
r14856 # Copyright (C) 2006-2016 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 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},
Jean-Philippe Lang
Set tab caption to plural....
r8535 {:name => 'repositories', :action => :manage_repository, :partial => 'projects/settings/repositories', :label => :label_repository_plural},
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 = ''
Jean-Philippe Lang
Replaces <option value=""></option> which is not HTML5 valid (#15191)....
r12007 options << "<option value=''>&nbsp;</option>" if project.allowed_parents.include?(nil)
Jean-Philippe Lang
Adds a 'Add subprojects' permission....
r3124 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
Extract code to render project context links to helper (#16381)....
r12711 def render_project_action_links
links = []
Jean-Philippe Lang
Use named routes....
r12723 if User.current.allowed_to?(:add_project, nil, :global => true)
links << link_to(l(:label_project_new), new_project_path, :class => 'icon icon-add')
end
if User.current.allowed_to?(:view_issues, nil, :global => true)
links << link_to(l(:label_issue_view_all), issues_path)
end
if User.current.allowed_to?(:view_time_entries, nil, :global => true)
links << link_to(l(:label_overall_spent_time), time_entries_path)
end
links << link_to(l(:label_overall_activity), activity_path)
Jean-Philippe Lang
Extract code to render project context links to helper (#16381)....
r12711 links.join(" | ").html_safe
end
Jean-Philippe Lang
Extract code to render nested listed of projects in an helper (#11539)....
r10005 # Renders the projects index
Jean-Philippe Lang
Merged nested projects branch. Removes limit on subproject nesting (#594)....
r2302 def render_project_hierarchy(projects)
Jean-Philippe Lang
Extract code to render nested listed of projects in an helper (#11539)....
r10005 render_project_nested_lists(projects) do |project|
s = link_to_project(project, {}, :class => "#{project.css_classes} #{User.current.member_of?(project) ? 'my-project' : nil}")
if project.description.present?
s << content_tag('div', textilizable(project.short_description, :project => project), :class => 'wiki description')
Jean-Philippe Lang
Merged nested projects branch. Removes limit on subproject nesting (#594)....
r2302 end
Jean-Philippe Lang
Extract code to render nested listed of projects in an helper (#11539)....
r10005 s
Jean-Philippe Lang
Merged nested projects branch. Removes limit on subproject nesting (#594)....
r2302 end
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
Toshi MARUYAMA
remove trailing white-spaces from projects helper source....
r5729
Jean-Philippe Lang
Preserve field values on bulk edit failure (#13943)....
r11557 selected = selected.is_a?(Version) ? selected.id : selected
Jean-Philippe Lang
Version sharing (#465) + optional inclusion of subprojects in the roadmap view (#2666)....
r3009 if grouped.keys.size > 1
Jean-Philippe Lang
Preserve field values on bulk edit failure (#13943)....
r11557 grouped_options_for_select(grouped, selected)
Jean-Philippe Lang
Version sharing (#465) + optional inclusion of subprojects in the roadmap view (#2666)....
r3009 else
Jean-Philippe Lang
Preserve field values on bulk edit failure (#13943)....
r11557 options_for_select((grouped.values.first || []), selected)
Jean-Philippe Lang
Version sharing (#465) + optional inclusion of subprojects in the roadmap view (#2666)....
r3009 end
end
Jean-Philippe Lang
Default target version for new issues (#1828)....
r14404 def project_default_version_options(project)
versions = project.shared_versions.open.to_a
if project.default_version && !versions.include?(project.default_version)
versions << project.default_version
end
version_options_for_select(versions, project.default_version)
end
Jean-Philippe Lang
Version sharing (#465) + optional inclusion of subprojects in the roadmap view (#2666)....
r3009 def format_version_sharing(sharing)
sharing = 'none' unless Version::VERSION_SHARINGS.include?(sharing)
l("label_version_sharing_#{sharing}")
end
Jean-Baptiste Barth
Include enabled modules in projects API (#17602)....
r13009
Jean-Philippe Lang
Forum list can be reordered with drag and drop (#12909)....
r14955 def render_boards_tree(boards, parent=nil, level=0, &block)
selection = boards.select {|b| b.parent == parent}
return '' if selection.empty?
s = ''.html_safe
selection.each do |board|
node = capture(board, level, &block)
node << render_boards_tree(boards, board, level+1, &block)
s << content_tag('div', node)
end
content_tag('div', s, :class => 'sort-level')
end
Jean-Baptiste Barth
Include enabled modules in projects API (#17602)....
r13009 def render_api_includes(project, api)
api.array :trackers do
project.trackers.each do |tracker|
api.tracker(:id => tracker.id, :name => tracker.name)
end
end if include_in_api_response?('trackers')
api.array :issue_categories do
project.issue_categories.each do |category|
api.issue_category(:id => category.id, :name => category.name)
end
end if include_in_api_response?('issue_categories')
api.array :enabled_modules do
project.enabled_modules.each do |enabled_module|
api.enabled_module(:id => enabled_module.id, :name => enabled_module.name)
end
end if include_in_api_response?('enabled_modules')
end
Jean-Philippe Lang
Initial commit...
r2 end