Commit 0eecc214 authored by Phil Hughes's avatar Phil Hughes

Updated controller with before_action

Fixed other issues based on feedback
parent d847db79
...@@ -3,7 +3,7 @@ class DashboardController < Dashboard::ApplicationController ...@@ -3,7 +3,7 @@ class DashboardController < Dashboard::ApplicationController
include MergeRequestsAction include MergeRequestsAction
before_action :event_filter, only: :activity before_action :event_filter, only: :activity
before_action :projects, only: [:issues, :merge_requests] before_action :projects, only: [:issues, :merge_requests, :labels, :milestones]
respond_to :html respond_to :html
...@@ -23,7 +23,6 @@ class DashboardController < Dashboard::ApplicationController ...@@ -23,7 +23,6 @@ class DashboardController < Dashboard::ApplicationController
def labels def labels
respond_to do |format| respond_to do |format|
format.json do format.json do
projects
render json: view_context.projects_labels_options render json: view_context.projects_labels_options
end end
end end
...@@ -32,7 +31,6 @@ class DashboardController < Dashboard::ApplicationController ...@@ -32,7 +31,6 @@ class DashboardController < Dashboard::ApplicationController
def milestones def milestones
respond_to do |format| respond_to do |format|
format.json do format.json do
projects
render json: view_context.projects_milestones_options render json: view_context.projects_milestones_options
end end
end end
......
...@@ -19,13 +19,13 @@ class Projects::MilestonesController < Projects::ApplicationController ...@@ -19,13 +19,13 @@ class Projects::MilestonesController < Projects::ApplicationController
end end
@milestones = @milestones.includes(:project) @milestones = @milestones.includes(:project)
@milestones_all = @milestones
@milestones = @milestones.page(params[:page]).per(PER_PAGE)
respond_to do |format| respond_to do |format|
format.html format.html do
@milestones = @milestones.page(params[:page]).per(PER_PAGE)
end
format.json do format.json do
render json: @milestones_all.to_json render json: @milestones_all
end end
end end
end end
......
...@@ -24,7 +24,7 @@ module DropdownsHelper ...@@ -24,7 +24,7 @@ module DropdownsHelper
capture(&block) if block && !options.has_key?(:footer_content) capture(&block) if block && !options.has_key?(:footer_content)
end end
if block && options.has_key?(:footer_content) if block && options[:footer_content]
output << content_tag(:div, class: "dropdown-footer") do output << content_tag(:div, class: "dropdown-footer") do
capture(&block) capture(&block)
end end
......
- if params[:label_name] - if params[:label_name]
= hidden_field_tag(:label_name, params[:label_name]) = hidden_field_tag(:label_name, params[:label_name])
.dropdown .dropdown
%button.dropdown-menu-toggle.js-label-select.js-filter-submit{type: "button", data: {toggle: "dropdown", field_name: "label_name", show_no: "true", show_any: "true", selected: params[:label_name], project_id: (@project.id if @project), labels: labels_filter_path}} %button.dropdown-menu-toggle.js-label-select.js-filter-submit{type: "button", data: {toggle: "dropdown", field_name: "label_name", show_no: "true", show_any: "true", selected: params[:label_name], project_id: @project.try(:id), labels: labels_filter_path}}
%span.dropdown-toggle-text %span.dropdown-toggle-text
= h(params[:label_name] || "Label") = h(params[:label_name] || "Label")
= icon('chevron-down') = icon('chevron-down')
......
- if params[:milestone_title] - if params[:milestone_title]
= hidden_field_tag(:milestone_title, params[:milestone_title]) = hidden_field_tag(:milestone_title, params[:milestone_title])
= dropdown_tag(h(params[:milestone_name] || "Milestone"), options: { title: "Filter by milestone", toggle_class: 'js-milestone-select js-filter-submit', filter: true, dropdown_class: "dropdown-menu-selectable", = dropdown_tag(h(params[:milestone_name] || "Milestone"), options: { title: "Filter by milestone", toggle_class: 'js-milestone-select js-filter-submit', filter: true, dropdown_class: "dropdown-menu-selectable",
placeholder: "Search milestones", footer_content: true, data: { show_no: true, show_any: true, field_name: "milestone_title", selected: params[:milestone_title], project_id: (@project.id if @project), milestones: milestones_filter_dropdown_path } }) do placeholder: "Search milestones", footer_content: @project.present?, data: { show_no: true, show_any: true, field_name: "milestone_title", selected: params[:milestone_title], project_id: @project.try(:id), milestones: milestones_filter_dropdown_path } }) do
- if @project - if @project
%ul.dropdown-footer-list %ul.dropdown-footer-list
- if can? current_user, :admin_milestone, @project - if can? current_user, :admin_milestone, @project
......
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