2015-09-11 14:41:01 +05:30
|
|
|
class Explore::ProjectsController < Explore::ApplicationController
|
2016-06-02 11:05:42 +05:30
|
|
|
include FilterProjects
|
|
|
|
|
2014-09-02 18:07:02 +05:30
|
|
|
def index
|
|
|
|
@projects = ProjectsFinder.new.execute(current_user)
|
2015-04-26 12:48:37 +05:30
|
|
|
@tags = @projects.tags_on(:tags)
|
|
|
|
@projects = @projects.tagged_with(params[:tag]) if params[:tag].present?
|
|
|
|
@projects = @projects.where(visibility_level: params[:visibility_level]) if params[:visibility_level].present?
|
2016-06-02 11:05:42 +05:30
|
|
|
@projects = filter_projects(@projects)
|
2014-09-02 18:07:02 +05:30
|
|
|
@projects = @projects.sort(@sort = params[:sort])
|
2016-06-02 11:05:42 +05:30
|
|
|
@projects = @projects.includes(:namespace).page(params[:page])
|
2016-04-02 18:10:28 +05:30
|
|
|
|
|
|
|
respond_to do |format|
|
|
|
|
format.html
|
|
|
|
format.json do
|
|
|
|
render json: {
|
|
|
|
html: view_to_html_string("dashboard/projects/_projects", locals: { projects: @projects })
|
|
|
|
}
|
|
|
|
end
|
|
|
|
end
|
2014-09-02 18:07:02 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
def trending
|
2016-04-02 18:10:28 +05:30
|
|
|
@projects = TrendingProjectsFinder.new.execute(current_user)
|
2016-06-02 11:05:42 +05:30
|
|
|
@projects = filter_projects(@projects)
|
|
|
|
@projects = @projects.page(params[:page])
|
2016-04-02 18:10:28 +05:30
|
|
|
|
|
|
|
respond_to do |format|
|
|
|
|
format.html
|
|
|
|
format.json do
|
|
|
|
render json: {
|
|
|
|
html: view_to_html_string("dashboard/projects/_projects", locals: { projects: @projects })
|
|
|
|
}
|
|
|
|
end
|
|
|
|
end
|
2014-09-02 18:07:02 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
def starred
|
2016-04-02 18:10:28 +05:30
|
|
|
@projects = ProjectsFinder.new.execute(current_user)
|
2016-06-02 11:05:42 +05:30
|
|
|
@projects = filter_projects(@projects)
|
2016-04-02 18:10:28 +05:30
|
|
|
@projects = @projects.reorder('star_count DESC')
|
2016-06-02 11:05:42 +05:30
|
|
|
@projects = @projects.page(params[:page])
|
2016-04-02 18:10:28 +05:30
|
|
|
|
|
|
|
respond_to do |format|
|
|
|
|
format.html
|
|
|
|
format.json do
|
|
|
|
render json: {
|
|
|
|
html: view_to_html_string("dashboard/projects/_projects", locals: { projects: @projects })
|
|
|
|
}
|
|
|
|
end
|
|
|
|
end
|
2014-09-02 18:07:02 +05:30
|
|
|
end
|
|
|
|
end
|