summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorArinde Eniola <eniolaarinde1@gmail.com>2016-04-15 18:18:31 +0100
committerArinde Eniola <eniolaarinde1@gmail.com>2016-04-15 18:18:31 +0100
commita0a423fee76d8cbc50cdb2478b05ccb751bc2be8 (patch)
treec35280565b39011f26d40391373ae88703bc2fb2 /app
parentd0ad566972dc5c47390df1720cdee8088fda6c73 (diff)
downloadgitlab-ce-a0a423fee76d8cbc50cdb2478b05ccb751bc2be8.tar.gz
fix failing tests
Diffstat (limited to 'app')
-rw-r--r--app/assets/javascripts/issues.js.coffee27
-rw-r--r--app/helpers/application_helper.rb9
-rw-r--r--app/views/shared/issuable/_nav.html.haml10
3 files changed, 36 insertions, 10 deletions
diff --git a/app/assets/javascripts/issues.js.coffee b/app/assets/javascripts/issues.js.coffee
index 320b92d2a60..1148531c068 100644
--- a/app/assets/javascripts/issues.js.coffee
+++ b/app/assets/javascripts/issues.js.coffee
@@ -36,19 +36,37 @@
$(".selected_issue").bind "change", Issues.checkChanged
+ getLabelsQueryString: ->
+ pageURL = decodeURIComponent(window.location.search.substring(1))
+ urlVariables = pageURL.split('&')
+ labelParams = (
+ variables for variables in urlVariables when variables.indexOf('label_name[]') > -1
+ ).join('&')
+
+ removeLabelsQueryString: (url) ->
+ pageURL = decodeURIComponent(url)
+ urlVariables = pageURL.split('&')
+ Params = (
+ variables for variables in urlVariables when variables.indexOf('label_name[]') is -1
+ ).join('&')
+
# Update state filters if present in page
updateStateFilters: ->
stateFilters = $('.issues-state-filters')
newParams = {}
- paramKeys = ['author_id', 'label_name', 'milestone_title', 'assignee_id', 'issue_search']
+ paramKeys = ['author_id', 'milestone_title', 'assignee_id', 'issue_search']
for paramKey in paramKeys
newParams[paramKey] = gl.utils.getUrlParameter(paramKey) or ''
if stateFilters.length
stateFilters.find('a').each ->
- initialUrl = $(this).attr 'href'
- $(this).attr 'href', gl.utils.mergeUrlParams(newParams, initialUrl)
+ initialUrl = Issues.removeLabelsQueryString($(this).attr 'href')
+ if Issues.getLabelsQueryString()
+ newUrl = "#{gl.utils.mergeUrlParams(newParams, initialUrl)}&#{Issues.getLabelsQueryString()}"
+ else
+ newUrl = gl.utils.mergeUrlParams(newParams, initialUrl)
+ $(this).attr 'href', newUrl
# Make sure we trigger ajax request only after user stop typing
initSearch: ->
@@ -91,7 +109,8 @@
opacity: 0
}
}).then( ->
- $filteredLabels.html(Issue.labelRow(data))
+ if typeof Issue.labelRow is 'function'
+ $filteredLabels.html(Issue.labelRow(data))
$spans = $filteredLabels.find('span')
$spans.css('opacity',0)
return gl.animate.animateEach($spans, 'fadeInUp', 20, {
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index 16e5b8ac223..3e0074da394 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -254,11 +254,11 @@ module ApplicationHelper
def page_filter_path(options = {})
without = options.delete(:without)
+ add_label = options.delete(:label)
exist_opts = {
state: params[:state],
scope: params[:scope],
- label_name: params[:label_name],
milestone_title: params[:milestone_title],
assignee_id: params[:assignee_id],
author_id: params[:author_id],
@@ -275,6 +275,13 @@ module ApplicationHelper
path = request.path
path << "?#{options.to_param}"
+ if add_label
+ if params[:label_name].present? and params[:label_name].respond_to?('any?')
+ params[:label_name].each do |label|
+ path << "&label_name[]=#{label}"
+ end
+ end
+ end
path
end
diff --git a/app/views/shared/issuable/_nav.html.haml b/app/views/shared/issuable/_nav.html.haml
index a6970b7eebb..1d9b09a5ef1 100644
--- a/app/views/shared/issuable/_nav.html.haml
+++ b/app/views/shared/issuable/_nav.html.haml
@@ -4,22 +4,22 @@
- else
- page_context_word = 'issues'
%li{class: ("active" if params[:state] == 'opened')}
- = link_to page_filter_path(state: 'opened'), title: "Filter by #{page_context_word} that are currently opened." do
+ = link_to page_filter_path(state: 'opened', label: true), title: "Filter by #{page_context_word} that are currently opened." do
#{state_filters_text_for(:opened, @project)}
- if defined?(type) && type == :merge_requests
%li{class: ("active" if params[:state] == 'merged')}
- = link_to page_filter_path(state: 'merged'), title: 'Filter by merge requests that are currently merged.' do
+ = link_to page_filter_path(state: 'merged', label: true), title: 'Filter by merge requests that are currently merged.' do
#{state_filters_text_for(:merged, @project)}
%li{class: ("active" if params[:state] == 'closed')}
- = link_to page_filter_path(state: 'closed'), title: 'Filter by merge requests that are currently closed and unmerged.' do
+ = link_to page_filter_path(state: 'closed', label: true), title: 'Filter by merge requests that are currently closed and unmerged.' do
#{state_filters_text_for(:closed, @project)}
- else
%li{class: ("active" if params[:state] == 'closed')}
- = link_to page_filter_path(state: 'closed'), title: 'Filter by issues that are currently closed.' do
+ = link_to page_filter_path(state: 'closed', label: true), title: 'Filter by issues that are currently closed.' do
#{state_filters_text_for(:closed, @project)}
%li{class: ("active" if params[:state] == 'all')}
- = link_to page_filter_path(state: 'all'), title: "Show all #{page_context_word}." do
+ = link_to page_filter_path(state: 'all', label: true), title: "Show all #{page_context_word}." do
#{state_filters_text_for(:all, @project)}