pull/5981/head
Jens Ulferts 7 years ago
parent fd93d6c1f8
commit 64c3256bd6
No known key found for this signature in database
GPG Key ID: 3CAA4B1182CF5308
  1. 35
      app/controllers/projects_controller.rb
  2. 2
      app/helpers/projects_helper.rb

@ -60,15 +60,13 @@ class ProjectsController < ApplicationController
sort_init 'lft'
sort_update %w(lft name is_public created_on required_disk_space latest_activity_at)
unless @projects = get_all_projects_for_overview_page
if @projects = get_all_projects_for_overview_page
@custom_fields = ProjectCustomField.visible(User.current)
else
redirect_back(fallback_location: projects_path)
return
end
@custom_fields = ProjectCustomField.visible(User.current)
end
current_menu_item :index do
:list_projects
end
@ -138,8 +136,7 @@ class ProjectsController < ApplicationController
@altered_project ||= @project
end
def edit
end
def edit; end
def update
@altered_project = Project.find(@project.id)
@ -309,13 +306,13 @@ class ProjectsController < ApplicationController
# TODO: Use our query-based orders and pagination, instead of using this second version here.
projects = @query
.results
.with_required_storage
.with_latest_activity
.includes(:custom_values, :enabled_modules)
.order(sort_clause)
.page(page_param)
.per_page(per_page_param)
.results
.with_required_storage
.with_latest_activity
.includes(:custom_values, :enabled_modules)
.order(sort_clause)
.page(page_param)
.per_page(per_page_param)
filter_projects_by_permission projects
else
@ -337,11 +334,11 @@ class ProjectsController < ApplicationController
protected
def determine_base
if params[:project_type_id]
@base = ProjectType.find(params[:project_type_id]).projects
else
@base = Project
end
@base = if params[:project_type_id]
ProjectType.find(params[:project_type_id]).projects
else
Project
end
end
# Validates parent_id param according to user's permissions

@ -161,7 +161,7 @@ module ProjectsHelper
(User.current.admin? ||
project.copy_allowed? ||
User.current.allowed_to?(:add_subprojects, project) ||
User.current.allowed_to?({controller: :projects, action: :settings}, project))
User.current.allowed_to?({ controller: :projects, action: :settings }, project))
end
def shorten_text(text, length)

Loading…
Cancel
Save