diff options
author | Josh Frye <joshfng@gmail.com> | 2016-02-06 12:36:46 -0500 |
---|---|---|
committer | Josh Frye <joshfng@gmail.com> | 2016-02-09 10:10:41 -0500 |
commit | 8b4e9720d948d0f0fe61ba7344158560e639393f (patch) | |
tree | 933c37ed98f5f505054c1f5a27c484ac4e386e95 /app | |
parent | 30e022a2feec7450c4173038d3fdfef0d6242953 (diff) | |
download | gitlab-ce-8b4e9720d948d0f0fe61ba7344158560e639393f.tar.gz |
Extract events rendering to own action.
Diffstat (limited to 'app')
-rw-r--r-- | app/controllers/dashboard/projects_controller.rb | 4 | ||||
-rw-r--r-- | app/controllers/explore/projects_controller.rb | 6 | ||||
-rw-r--r-- | app/controllers/groups_controller.rb | 24 | ||||
-rw-r--r-- | app/views/groups/show.html.haml | 2 | ||||
-rw-r--r-- | app/views/shared/projects/_list.html.haml | 2 |
5 files changed, 21 insertions, 17 deletions
diff --git a/app/controllers/dashboard/projects_controller.rb b/app/controllers/dashboard/projects_controller.rb index 0bcc78a8bc7..2413680a4b0 100644 --- a/app/controllers/dashboard/projects_controller.rb +++ b/app/controllers/dashboard/projects_controller.rb @@ -12,7 +12,7 @@ class Dashboard::ProjectsController < Dashboard::ApplicationController @projects = @projects.search(terms) end - @projects = @projects.page(params[:page]).per(PER_PAGE) + @projects = @projects.page(params[:page]).per(PER_PAGE) if !terms.present? @last_push = current_user.recent_push respond_to do |format| @@ -41,7 +41,7 @@ class Dashboard::ProjectsController < Dashboard::ApplicationController @projects = @projects.search(terms) end - @projects = @projects.page(params[:page]).per(PER_PAGE) + @projects = @projects.page(params[:page]).per(PER_PAGE) if !terms.present? @last_push = current_user.recent_push @groups = [] diff --git a/app/controllers/explore/projects_controller.rb b/app/controllers/explore/projects_controller.rb index 317ad835006..1afa77bb02b 100644 --- a/app/controllers/explore/projects_controller.rb +++ b/app/controllers/explore/projects_controller.rb @@ -8,7 +8,7 @@ class Explore::ProjectsController < Explore::ApplicationController @projects = @projects.search(params[:search]) if params[:search].present? @projects = @projects.search(params[:filter_projects]) if params[:filter_projects].present? @projects = @projects.sort(@sort = params[:sort]) - @projects = @projects.includes(:namespace).page(params[:page]).per(PER_PAGE) + @projects = @projects.includes(:namespace).page(params[:page]).per(PER_PAGE) if !params[:filter_projects].present? respond_to do |format| format.html @@ -24,7 +24,7 @@ class Explore::ProjectsController < Explore::ApplicationController @projects = TrendingProjectsFinder.new.execute(current_user) @projects = @projects.non_archived @projects = @projects.search(params[:filter_projects]) if params[:filter_projects].present? - @projects = @projects.page(params[:page]).per(PER_PAGE) + @projects = @projects.page(params[:page]).per(PER_PAGE) if !params[:filter_projects].present? respond_to do |format| format.html @@ -40,7 +40,7 @@ class Explore::ProjectsController < Explore::ApplicationController @projects = ProjectsFinder.new.execute(current_user) @projects = @projects.search(params[:filter_projects]) if params[:filter_projects].present? @projects = @projects.reorder('star_count DESC') - @projects = @projects.page(params[:page]).per(PER_PAGE) + @projects = @projects.page(params[:page]).per(PER_PAGE) if !params[:filter_projects].present? respond_to do |format| format.html diff --git a/app/controllers/groups_controller.rb b/app/controllers/groups_controller.rb index b4dd0021ed7..99d38615c08 100644 --- a/app/controllers/groups_controller.rb +++ b/app/controllers/groups_controller.rb @@ -14,7 +14,7 @@ class GroupsController < Groups::ApplicationController # Load group projects before_action :load_projects, except: [:index, :new, :create, :projects, :edit, :update, :autocomplete] - before_action :event_filter, only: :show + before_action :event_filter, only: [:show, :events] layout :determine_layout @@ -42,20 +42,15 @@ class GroupsController < Groups::ApplicationController @last_push = current_user.recent_push if current_user @projects = @projects.includes(:namespace) @projects = @projects.search(params[:filter_projects]) if params[:filter_projects].present? - @projects = @projects.page(params[:page]).per(PER_PAGE) + @projects = @projects.page(params[:page]).per(PER_PAGE) if !params[:filter_projects].present? respond_to do |format| format.html format.json do - if params[:filter_projects] - render json: { - html: view_to_html_string("dashboard/projects/_projects", locals: { projects: @projects }) - } - else - load_events - pager_json("events/_events", @events.count) - end + render json: { + html: view_to_html_string("dashboard/projects/_projects", locals: { projects: @projects }) + } end format.atom do @@ -65,6 +60,15 @@ class GroupsController < Groups::ApplicationController end end + def events + respond_to do |format| + format.json do + load_events + pager_json("events/_events", @events.count) + end + end + end + def edit end diff --git a/app/views/groups/show.html.haml b/app/views/groups/show.html.haml index ebb3df7dca3..52db77e3adb 100644 --- a/app/views/groups/show.html.haml +++ b/app/views/groups/show.html.haml @@ -47,7 +47,7 @@ = render 'shared/event_filter' - .content_list + .content_list{:"data-href" => events_group_path} = spinner .tab-pane#projects diff --git a/app/views/shared/projects/_list.html.haml b/app/views/shared/projects/_list.html.haml index 4787502fbc2..75684b972f1 100644 --- a/app/views/shared/projects/_list.html.haml +++ b/app/views/shared/projects/_list.html.haml @@ -21,7 +21,7 @@ #{projects_limit} of #{pluralize(projects.count, 'project')} displayed. = link_to '#', class: 'js-expand' do Show all - = paginate projects, theme: "gitlab" if !projects.kind_of?(Array) + = paginate projects, theme: "gitlab" if projects.respond_to? :total_pages - else %h3 No projects found |