Redmine 4.1.1

This commit is contained in:
Manuel Cillero 2020-11-22 21:20:06 +01:00
parent 33e7b881a5
commit 3d976f1b3b
1593 changed files with 36180 additions and 19489 deletions

View file

@ -1,7 +1,7 @@
# encoding: utf-8
#
# frozen_string_literal: true
# Redmine - project management software
# Copyright (C) 2006-2017 Jean-Philippe Lang
# Copyright (C) 2006-2019 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
@ -19,18 +19,31 @@
module ProjectsHelper
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,
:url => {:tab => 'versions', :version_status => params[:version_status], :version_name => params[:version_name]}},
{: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 => 'repositories', :action => :manage_repository, :partial => 'projects/settings/repositories', :label => :label_repository_plural},
{: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}
]
tabs.select {|tab| User.current.allowed_to?(tab[:action], @project)}
tabs =
[
{:name => 'info', :action => :edit_project,
:partial => 'projects/edit', :label => :label_project},
{:name => 'members', :action => :manage_members,
:partial => 'projects/settings/members', :label => :label_member_plural},
{:name => 'issues', :action => :edit_project, :module => :issue_tracking,
:partial => 'projects/settings/issues', :label => :label_issue_tracking},
{:name => 'versions', :action => :manage_versions,
:partial => 'projects/settings/versions', :label => :label_version_plural,
:url => {:tab => 'versions', :version_status => params[:version_status],
:version_name => params[:version_name]}},
{:name => 'categories', :action => :manage_categories,
:partial => 'projects/settings/issue_categories',
:label => :label_issue_category_plural},
{:name => 'repositories', :action => :manage_repository,
:partial => 'projects/settings/repositories', :label => :label_repository_plural},
{:name => 'boards', :action => :manage_boards,
:partial => 'projects/settings/boards', :label => :label_board_plural},
{:name => 'activities', :action => :manage_project_activities,
:partial => 'projects/settings/activities', :label => :label_time_tracking}
]
tabs.
select {|tab| User.current.allowed_to?(tab[:action], @project)}.
select {|tab| tab[:module].nil? || @project.module_enabled?(tab[:module])}
end
def parent_project_select_tag(project)
@ -41,24 +54,27 @@ module ProjectsHelper
selected = (parent_id.blank? ? nil : Project.find(parent_id))
end
options = ''
options = +''
options << "<option value=''>&nbsp;</option>" if project.allowed_parents.include?(nil)
options << project_tree_options_for_select(project.allowed_parents.compact, :selected => selected)
content_tag('select', options.html_safe, :name => 'project[parent_id]', :id => 'project_parent_id')
end
def render_project_action_links
links = "".html_safe
links = (+"").html_safe
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.admin?
links << link_to(l(:label_administration), admin_projects_path, :class => 'icon icon-settings')
end
links
end
# Renders the projects index
def render_project_hierarchy(projects)
render_project_nested_lists(projects) do |project|
s = link_to_project(project, {}, :class => "#{project.css_classes} #{User.current.member_of?(project) ? 'icon icon-fav my-project' : nil}")
s = link_to_project(project, {}, :class => "#{project.css_classes} #{User.current.member_of?(project) ? 'icon icon-user my-project' : nil}")
if project.description.present?
s << content_tag('div', textilizable(project.short_description, :project => project), :class => 'wiki description')
end
@ -137,4 +153,33 @@ module ProjectsHelper
end
end if include_in_api_response?('enabled_modules')
end
def bookmark_link(project, user = User.current)
return '' unless user && user.logged?
@jump_box ||= Redmine::ProjectJumpBox.new user
bookmarked = @jump_box.bookmark?(project)
css = +"icon bookmark "
if bookmarked
css << "icon-bookmark"
method = "delete"
text = l(:button_project_bookmark_delete)
else
css << "icon-bookmark-off"
method = "post"
text = l(:button_project_bookmark)
end
url = bookmark_project_path(project)
link_to text, url, remote: true, method: method, class: css
end
def grouped_project_list(projects, query, &block)
ancestors = []
grouped_query_results(projects, query) do |project, group_name, group_count, group_totals|
ancestors.pop while ancestors.any? && !project.is_descendant_of?(ancestors.last)
yield project, ancestors.size, group_name, group_count, group_totals
ancestors << project unless project.leaf?
end
end
end