Browse Source

修改公开/私有项目的状态

tags/v1
sylor_huang@126.com 6 years ago
parent
commit
c7f7f13630
2 changed files with 6 additions and 6 deletions
  1. +1
    -2
      app/controllers/users_controller.rb
  2. +5
    -4
      app/queries/projects/list_my_query.rb

+ 1
- 2
app/controllers/users_controller.rb View File

@@ -113,10 +113,9 @@ class UsersController < ApplicationController
end
def projects
scope = Projects::ListMyQuery.call(params.merge(category: params[:category]), current_user)
scope = Projects::ListMyQuery.call(params.merge(category: params[:category],is_public: params[:status]), current_user)
@total_count = scope.size
@projects = paginate(scope)
end
private


+ 5
- 4
app/queries/projects/list_my_query.rb View File

@@ -17,10 +17,11 @@ class Projects::ListMyQuery < ApplicationQuery
else
projects = Project.where.not(user_id: current_user.id).joins(:members).where(members: { user_id: current_user.id })
end
scope = projects.includes(:members,:issues,:project_category, :project_language, owner: :user_extension).like(params[:search])
.with_project_type(params[:project_type])
.with_project_category(params[:category_id])
.with_project_language(params[:language_id])
unless params[:is_public].blank?
projects = projects.where(is_public: params[:is_public])
end

scope = projects.includes(:members,:issues,:project_category, :project_language, owner: :user_extension)

sort = params[:sort_by] || "updated_on"
sort_direction = params[:sort_direction] || "desc"


Loading…
Cancel
Save