Commit b8deafd0 authored by Luke "Jared" Bennett's avatar Luke "Jared" Bennett

Removed merge_request/issue state_event param parent and removed issuable_path...

Removed merge_request/issue state_event param parent and removed issuable_path helpers in favour of issuable_url helpers
parent 001c904f
...@@ -271,7 +271,7 @@ class Projects::IssuesController < Projects::ApplicationController ...@@ -271,7 +271,7 @@ class Projects::IssuesController < Projects::ApplicationController
end end
def issue_params def issue_params
params.require(:issue).permit(*issue_params_attributes) params.permit(*issue_params_attributes)
end end
def issue_params_attributes def issue_params_attributes
......
...@@ -17,8 +17,7 @@ class Projects::MergeRequests::ApplicationController < Projects::ApplicationCont ...@@ -17,8 +17,7 @@ class Projects::MergeRequests::ApplicationController < Projects::ApplicationCont
end end
def merge_request_params def merge_request_params
params.require(:merge_request) params.permit(merge_request_params_attributes)
.permit(merge_request_params_attributes)
end end
def merge_request_params_attributes def merge_request_params_attributes
......
...@@ -245,36 +245,30 @@ module IssuablesHelper ...@@ -245,36 +245,30 @@ module IssuablesHelper
@counts[cache_key][state] @counts[cache_key][state]
end end
def close_issuable_path(issuable) def close_issuable_url(issuable)
params = state_event_hash(issuable, :close) params = {}
params[:format] = 'json' if issuable.is_a?(Issue) params[:state_event] = :close
params[:format] = :json if issuable.is_a?(Issue)
issuable_path(issuable, params) issuable_url(issuable, params)
end end
def reopen_issuable_path(issuable) def reopen_issuable_url(issuable)
params = state_event_hash(issuable, :reopen) params = {}
params[:format] = 'json' if issuable.is_a?(Issue) params[:state_event] = :reopen
params[:format] = :json if issuable.is_a?(Issue)
issuable_path(issuable, params) issuable_url(issuable, params)
end end
def close_reopen_issuable_path(issuable) def close_reopen_issuable_url(issuable)
issuable.closed? ? reopen_issuable_path(issuable) : close_issuable_path(issuable) issuable.closed? ? reopen_issuable_url(issuable) : close_issuable_url(issuable)
end end
def issuable_path(issuable, *path_options) def issuable_url(issuable, *options)
case issuable case issuable
when Issue then issue_path(issuable, *path_options) when Issue then issue_url(issuable, *options)
when MergeRequest then merge_request_path(issuable, *path_options) when MergeRequest then merge_request_url(issuable, *options)
else raise 'unknown issuable type'
end
end
def issuable_url(issuable, *path_options)
case issuable
when Issue then issue_url(issuable, *path_options)
when MergeRequest then merge_request_url(issuable, *path_options)
else raise 'unknown issuable type' else raise 'unknown issuable type'
end end
end end
...@@ -335,11 +329,4 @@ module IssuablesHelper ...@@ -335,11 +329,4 @@ module IssuablesHelper
container: (is_collapsed ? 'body' : nil) container: (is_collapsed ? 'body' : nil)
} }
end end
def state_event_hash(issuable, event_symbol)
event_hash = {}
event_hash[:"#{issuable.class.to_s.underscore}"] = { state_event: event_symbol }
event_hash
end
end end
...@@ -7,13 +7,13 @@ ...@@ -7,13 +7,13 @@
- button_method = issuable.is_a?(MergeRequest) ? 'put' : '' - button_method = issuable.is_a?(MergeRequest) ? 'put' : ''
.pull-left.btn-group.prepend-left-10.issuable-close-dropdown.droplab-dropdown.js-issuable-close-dropdown .pull-left.btn-group.prepend-left-10.issuable-close-dropdown.droplab-dropdown.js-issuable-close-dropdown
= link_to "#{display_button_action} #{display_issuable_type}", close_reopen_issuable_path(issuable), { method: button_method.to_s, class: "#{button_class} btn-#{button_action}", title: "#{display_button_action} #{display_issuable_type}" } = link_to "#{display_button_action} #{display_issuable_type}", close_reopen_issuable_url(issuable), { method: button_method.to_s, class: "#{button_class} btn-#{button_action}", title: "#{display_button_action} #{display_issuable_type}" }
= button_tag type: 'button', class: "#{toggle_class} btn-#{button_action}-color", data: { 'dropdown-trigger' => '#issuable-close-menu' }, 'aria-label' => 'Toggle dropdown' do = button_tag type: 'button', class: "#{toggle_class} btn-#{button_action}-color", data: { 'dropdown-trigger' => '#issuable-close-menu' }, 'aria-label' => 'Toggle dropdown' do
= icon('caret-down', class: 'toggle-icon icon') = icon('caret-down', class: 'toggle-icon icon')
%ul#issuable-close-menu.js-issuable-close-menu.dropdown-menu{ class: button_responsive_class, data: { dropdown: true } } %ul#issuable-close-menu.js-issuable-close-menu.dropdown-menu{ class: button_responsive_class, data: { dropdown: true } }
%li.close-item{ class: "#{issuable.closed? ? 'hidden' : 'droplab-item-selected'}", data: { text: "Close #{display_issuable_type}", url: close_issuable_path(issuable), button_class: "#{button_class} btn-close", toggle_class: "#{toggle_class} btn-close-color", method: button_method } } %li.close-item{ class: "#{issuable.closed? ? 'hidden' : 'droplab-item-selected'}", data: { text: "Close #{display_issuable_type}", url: close_issuable_url(issuable), button_class: "#{button_class} btn-close", toggle_class: "#{toggle_class} btn-close-color", method: button_method } }
%button.btn.btn-transparent %button.btn.btn-transparent
= icon('check', class: 'icon') = icon('check', class: 'icon')
.description .description
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
= display_issuable_type = display_issuable_type
%p %p
%li.reopen-item{ class: "#{issuable.closed? ? 'droplab-item-selected' : 'hidden'}", data: { text: "Reopen #{display_issuable_type}", url: reopen_issuable_path(issuable), button_class: "#{button_class} btn-reopen", toggle_class: "#{toggle_class} btn-reopen-color", method: button_method } } %li.reopen-item{ class: "#{issuable.closed? ? 'droplab-item-selected' : 'hidden'}", data: { text: "Reopen #{display_issuable_type}", url: reopen_issuable_url(issuable), button_class: "#{button_class} btn-reopen", toggle_class: "#{toggle_class} btn-reopen-color", method: button_method } }
%button.btn.btn-transparent %button.btn.btn-transparent
= icon('check', class: 'icon') = icon('check', class: 'icon')
.description .description
......
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