summaryrefslogtreecommitdiff
path: root/app/helpers
diff options
context:
space:
mode:
authorLuke "Jared" Bennett <lbennett@gitlab.com>2017-07-04 14:41:26 +0100
committerLuke "Jared" Bennett <lbennett@gitlab.com>2017-07-07 14:57:28 +0100
commitd7c383a0ee2ec71e5ef941ccec1de0aaf1ecc8b6 (patch)
treebf3bf9a14b729df53c7cb379a638c190475705a1 /app/helpers
parentc53f2d8ebc64ef59f67265ae7c6b96a3c127cea7 (diff)
downloadgitlab-ce-d7c383a0ee2ec71e5ef941ccec1de0aaf1ecc8b6.tar.gz
Fixed MR single button submit failure and attempted to tidy up close_reopen partials using issuable_helpers and setDisable will use true as default bool
Diffstat (limited to 'app/helpers')
-rw-r--r--app/helpers/issuables_helper.rb38
1 files changed, 26 insertions, 12 deletions
diff --git a/app/helpers/issuables_helper.rb b/app/helpers/issuables_helper.rb
index 64a64958691..04133196700 100644
--- a/app/helpers/issuables_helper.rb
+++ b/app/helpers/issuables_helper.rb
@@ -246,21 +246,11 @@ module IssuablesHelper
end
def close_issuable_url(issuable)
- params = {}
- params[issuable.model_name.to_s.underscore] = {}
- params[issuable.model_name.to_s.underscore][:state_event] = :close
- params[:format] = :json if issuable.is_a?(Issue)
-
- issuable_url(issuable, params)
+ issuable_url(issuable, close_reopen_params(issuable, :close))
end
def reopen_issuable_url(issuable)
- params = {}
- params[issuable.model_name.to_s.underscore] = {}
- params[issuable.model_name.to_s.underscore][:state_event] = :reopen
- params[:format] = :json if issuable.is_a?(Issue)
-
- issuable_url(issuable, params)
+ issuable_url(issuable, close_reopen_params(issuable, :reopen))
end
def close_reopen_issuable_url(issuable, should_inverse = false)
@@ -278,6 +268,22 @@ module IssuablesHelper
end
end
+ def issuable_button_visibility(issuable, closed)
+ case issuable
+ when Issue then issue_button_visibility(issuable, closed)
+ when MergeRequest then merge_request_button_visibility(issuable, closed)
+ else raise 'unknown issuable type'
+ end
+ end
+
+ def issuable_close_reopen_button_method(issuable)
+ case issuable
+ when Issue then ''
+ when MergeRequest then 'put'
+ else raise 'unknown issuable type'
+ end
+ end
+
private
def sidebar_gutter_collapsed?
@@ -334,4 +340,12 @@ module IssuablesHelper
container: (is_collapsed ? 'body' : nil)
}
end
+
+ def close_reopen_params(issuable, action)
+ params = {}
+ params[issuable.model_name.to_s.underscore] = {}
+ params[issuable.model_name.to_s.underscore][:state_event] = action
+ params[:format] = :json if issuable.is_a?(Issue)
+ params
+ end
end