Commit 120dca0f authored by Josh Frye's avatar Josh Frye

MR feedback

parent 8b4e9720
class @ProjectsList class @ProjectsList
constructor: -> constructor: ->
$("#project-filter-form-field").off('keyup')
$(".projects-list .js-expand").on 'click', (e) -> $(".projects-list .js-expand").on 'click', (e) ->
e.preventDefault() e.preventDefault()
list = $(this).closest('.projects-list') list = $(this).closest('.projects-list')
$("#filter_projects").on 'keyup', -> $("#filter_projects").on 'keyup', ->
ProjectsList.filter_results($("#filter_projects")) ProjectsList.filter_results($("#filter_projects"))
$("#project-filter-form-field").on 'keyup', ->
ProjectsList.filter_results($("#project-filter-form-field"))
@filter_results: ($element) -> @filter_results: ($element) ->
terms = $element.val() terms = $element.val()
filterSelector = $element.data('filter-selector') || 'span.filter-title' filterSelector = $element.data('filter-selector') || 'span.filter-title'
if not terms if not terms
$("ul.projects-list li").show() $(".projects-list li").show()
$('.gl-pagination').show() $('.gl-pagination').show()
else else
$("ul.projects-list li").each (index) -> $(".projects-list li").each (index) ->
$this = $(this) $this = $(this)
name = $this.find(filterSelector).text() name = $this.find(filterSelector).text()
......
...@@ -12,7 +12,7 @@ class Dashboard::ProjectsController < Dashboard::ApplicationController ...@@ -12,7 +12,7 @@ class Dashboard::ProjectsController < Dashboard::ApplicationController
@projects = @projects.search(terms) @projects = @projects.search(terms)
end end
@projects = @projects.page(params[:page]).per(PER_PAGE) if !terms.present? @projects = @projects.page(params[:page]).per(PER_PAGE) if terms.blank?
@last_push = current_user.recent_push @last_push = current_user.recent_push
respond_to do |format| respond_to do |format|
...@@ -41,7 +41,7 @@ class Dashboard::ProjectsController < Dashboard::ApplicationController ...@@ -41,7 +41,7 @@ class Dashboard::ProjectsController < Dashboard::ApplicationController
@projects = @projects.search(terms) @projects = @projects.search(terms)
end end
@projects = @projects.page(params[:page]).per(PER_PAGE) if !terms.present? @projects = @projects.page(params[:page]).per(PER_PAGE) if terms.blank?
@last_push = current_user.recent_push @last_push = current_user.recent_push
@groups = [] @groups = []
......
...@@ -8,7 +8,7 @@ class Explore::ProjectsController < Explore::ApplicationController ...@@ -8,7 +8,7 @@ class Explore::ProjectsController < Explore::ApplicationController
@projects = @projects.search(params[:search]) if params[:search].present? @projects = @projects.search(params[:search]) if params[:search].present?
@projects = @projects.search(params[:filter_projects]) if params[:filter_projects].present? @projects = @projects.search(params[:filter_projects]) if params[:filter_projects].present?
@projects = @projects.sort(@sort = params[:sort]) @projects = @projects.sort(@sort = params[:sort])
@projects = @projects.includes(:namespace).page(params[:page]).per(PER_PAGE) if !params[:filter_projects].present? @projects = @projects.includes(:namespace).page(params[:page]).per(PER_PAGE) if params[:filter_projects].blank?
respond_to do |format| respond_to do |format|
format.html format.html
...@@ -24,7 +24,7 @@ class Explore::ProjectsController < Explore::ApplicationController ...@@ -24,7 +24,7 @@ class Explore::ProjectsController < Explore::ApplicationController
@projects = TrendingProjectsFinder.new.execute(current_user) @projects = TrendingProjectsFinder.new.execute(current_user)
@projects = @projects.non_archived @projects = @projects.non_archived
@projects = @projects.search(params[:filter_projects]) if params[:filter_projects].present? @projects = @projects.search(params[:filter_projects]) if params[:filter_projects].present?
@projects = @projects.page(params[:page]).per(PER_PAGE) if !params[:filter_projects].present? @projects = @projects.page(params[:page]).per(PER_PAGE) if params[:filter_projects].blank?
respond_to do |format| respond_to do |format|
format.html format.html
...@@ -40,7 +40,7 @@ class Explore::ProjectsController < Explore::ApplicationController ...@@ -40,7 +40,7 @@ class Explore::ProjectsController < Explore::ApplicationController
@projects = ProjectsFinder.new.execute(current_user) @projects = ProjectsFinder.new.execute(current_user)
@projects = @projects.search(params[:filter_projects]) if params[:filter_projects].present? @projects = @projects.search(params[:filter_projects]) if params[:filter_projects].present?
@projects = @projects.reorder('star_count DESC') @projects = @projects.reorder('star_count DESC')
@projects = @projects.page(params[:page]).per(PER_PAGE) if !params[:filter_projects].present? @projects = @projects.page(params[:page]).per(PER_PAGE) if params[:filter_projects].blank?
respond_to do |format| respond_to do |format|
format.html format.html
......
...@@ -42,7 +42,7 @@ class GroupsController < Groups::ApplicationController ...@@ -42,7 +42,7 @@ class GroupsController < Groups::ApplicationController
@last_push = current_user.recent_push if current_user @last_push = current_user.recent_push if current_user
@projects = @projects.includes(:namespace) @projects = @projects.includes(:namespace)
@projects = @projects.search(params[:filter_projects]) if params[:filter_projects].present? @projects = @projects.search(params[:filter_projects]) if params[:filter_projects].present?
@projects = @projects.page(params[:page]).per(PER_PAGE) if !params[:filter_projects].present? @projects = @projects.page(params[:page]).per(PER_PAGE) if params[:filter_projects].blank?
respond_to do |format| respond_to do |format|
format.html format.html
......
...@@ -47,7 +47,7 @@ ...@@ -47,7 +47,7 @@
= render 'shared/event_filter' = render 'shared/event_filter'
.content_list{:"data-href" => events_group_path} .content_list{data: {href: events_group_path}}
= spinner = spinner
.tab-pane#projects .tab-pane#projects
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment