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,5 +1,7 @@
# 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
@ -31,8 +33,12 @@ class ProjectsController < ApplicationController
helper :custom_fields
helper :issues
helper :queries
include QueriesHelper
helper :projects_queries
include ProjectsQueriesHelper
helper :repositories
helper :members
helper :trackers
# Lists visible projects
def index
@ -41,14 +47,19 @@ class ProjectsController < ApplicationController
return
end
scope = Project.visible.sorted
retrieve_project_query
scope = project_scope
respond_to do |format|
format.html {
unless params[:closed]
scope = scope.active
# TODO: see what to do with the board view and pagination
if @query.display_type == 'board'
@entries = scope.to_a
else
@entry_count = scope.count
@entry_pages = Paginator.new @entry_count, per_page_option, params['page']
@entries = scope.offset(@entry_pages.offset).limit(@entry_pages.per_page).to_a
end
@projects = scope.to_a
}
format.api {
@offset, @limit = api_offset_and_limit
@ -59,6 +70,11 @@ class ProjectsController < ApplicationController
projects = scope.reorder(:created_on => :desc).limit(Setting.feeds_limit.to_i).to_a
render_feed(projects, :title => "#{Setting.app_title}: #{l(:label_project_latest)}")
}
format.csv {
# Export all entries
@entries = scope.to_a
send_data(query_to_csv(@entries, @query, params), :type => 'text/csv; header=present', :filename => 'projects.csv')
}
end
end
@ -158,6 +174,7 @@ class ProjectsController < ApplicationController
if User.current.allowed_to_view_all_time_entries?(@project)
@total_hours = TimeEntry.visible.where(cond).sum(:hours).to_f
@total_estimated_hours = Issue.visible.where(cond).sum(:estimated_hours).to_f
end
@key = User.current.rss_key
@ -176,8 +193,7 @@ class ProjectsController < ApplicationController
@version_status = params[:version_status] || 'open'
@version_name = params[:version_name]
@versions = @project.shared_versions.status(@version_status).like(@version_name)
@wiki ||= @project.wiki || Wiki.new(:project => @project)
@versions = @project.shared_versions.status(@version_status).like(@version_name).sorted
end
def edit
@ -189,7 +205,7 @@ class ProjectsController < ApplicationController
respond_to do |format|
format.html {
flash[:notice] = l(:notice_successful_update)
redirect_to settings_project_path(@project)
redirect_to settings_project_path(@project, params[:tab])
}
format.api { render_api_ok }
end
@ -204,12 +220,6 @@ class ProjectsController < ApplicationController
end
end
def modules
@project.enabled_module_names = params[:enabled_module_names]
flash[:notice] = l(:notice_successful_update)
redirect_to settings_project_path(@project, :tab => 'modules')
end
def archive
unless @project.archive
flash[:error] = l(:error_can_not_archive_project)
@ -224,6 +234,19 @@ class ProjectsController < ApplicationController
redirect_to_referer_or admin_projects_path(:status => params[:status])
end
def bookmark
jump_box = Redmine::ProjectJumpBox.new User.current
if request.delete?
jump_box.delete_project_bookmark @project
elsif request.post?
jump_box.bookmark_project @project
end
respond_to do |format|
format.js
format.html { redirect_to project_path(@project) }
end
end
def close
@project.close
redirect_to project_path(@project)
@ -247,4 +270,15 @@ class ProjectsController < ApplicationController
# hide project in layout
@project = nil
end
private
# Returns the ProjectEntry scope for index
def project_scope(options={})
@query.results_scope(options)
end
def retrieve_project_query
retrieve_query(ProjectQuery, false, :defaults => @default_columns_names)
end
end