Commit 41654267 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Restyle and refactor milestones filter

parent 560e717f
...@@ -11,7 +11,7 @@ class Projects::MilestonesController < Projects::ApplicationController ...@@ -11,7 +11,7 @@ class Projects::MilestonesController < Projects::ApplicationController
respond_to :html respond_to :html
def index def index
@milestones = case params[:f] @milestones = case params[:state]
when 'all'; @project.milestones.order("state, due_date DESC") when 'all'; @project.milestones.order("state, due_date DESC")
when 'closed'; @project.milestones.closed.order("due_date DESC") when 'closed'; @project.milestones.closed.order("due_date DESC")
else @project.milestones.active.order("due_date ASC") else @project.milestones.active.order("due_date ASC")
......
...@@ -33,18 +33,6 @@ module GroupsHelper ...@@ -33,18 +33,6 @@ module GroupsHelper
title title
end end
def group_filter_path(entity, options={})
exist_opts = {
status: params[:status]
}
options = exist_opts.merge(options)
path = request.path
path << "?#{options.to_param}"
path
end
def group_settings_page? def group_settings_page?
if current_controller?('groups') if current_controller?('groups')
current_action?('edit') || current_action?('projects') current_action?('edit') || current_action?('projects')
......
module MilestonesHelper
def milestones_filter_path(opts = {})
if @project
project_milestones_path(@project, opts)
elsif @group
group_milestones_path(@group, opts)
end
end
end
= form_tag group_filter_path(entity), method: 'get' do
%fieldset
%ul.nav.nav-pills.nav-stacked
%li{class: ("active" if (params[:status] == 'active' || !params[:status]))}
= link_to group_filter_path(entity, status: 'active') do
Active
%li{class: ("active" if params[:status] == 'closed')}
= link_to group_filter_path(entity, status: 'closed') do
Closed
%li{class: ("active" if params[:status] == 'all')}
= link_to group_filter_path(entity, status: 'all') do
All
...@@ -9,42 +9,38 @@ ...@@ -9,42 +9,38 @@
%hr %hr
.row = render 'shared/milestones_filter'
.fixed.sidebar-expand-button.hidden-lg.hidden-md .milestones
%i.fa.fa-list.fa-2x .panel.panel-default
.col-md-3.responsive-side %ul.well-list
= render 'groups/filter', entity: 'milestone' - if @group_milestones.blank?
.col-md-9 %li
.panel.panel-default .nothing-here-block No milestones to show
%ul.well-list - else
- if @group_milestones.blank? - @group_milestones.each do |milestone|
%li %li{class: "milestone milestone-#{milestone.closed? ? 'closed' : 'open'}", id: dom_id(milestone.milestones.first) }
.nothing-here-block No milestones to show .pull-right
- else - if can?(current_user, :manage_group, @group)
- @group_milestones.each do |milestone| - if milestone.closed?
%li{class: "milestone milestone-#{milestone.closed? ? 'closed' : 'open'}", id: dom_id(milestone.milestones.first) } = link_to 'Reopen Milestone', group_milestone_path(@group, milestone.safe_title, title: milestone.title, milestone: {state_event: :activate }), method: :put, class: "btn btn-small btn-grouped btn-reopen"
.pull-right - else
- if can?(current_user, :manage_group, @group) = link_to 'Close Milestone', group_milestone_path(@group, milestone.safe_title, title: milestone.title, milestone: {state_event: :close }), method: :put, class: "btn btn-small btn-close"
- if milestone.closed? %h4
= link_to 'Reopen Milestone', group_milestone_path(@group, milestone.safe_title, title: milestone.title, milestone: {state_event: :activate }), method: :put, class: "btn btn-small btn-grouped btn-reopen" = link_to_gfm truncate(milestone.title, length: 100), group_milestone_path(@group, milestone.safe_title, title: milestone.title)
- else %div
= link_to 'Close Milestone', group_milestone_path(@group, milestone.safe_title, title: milestone.title, milestone: {state_event: :close }), method: :put, class: "btn btn-small btn-close"
%h4
= link_to_gfm truncate(milestone.title, length: 100), group_milestone_path(@group, milestone.safe_title, title: milestone.title)
%div %div
%div = link_to group_milestone_path(@group, milestone.safe_title, title: milestone.title) do
= link_to group_milestone_path(@group, milestone.safe_title, title: milestone.title) do = pluralize milestone.issue_count, 'Issue'
= pluralize milestone.issue_count, 'Issue' &nbsp;
&nbsp; = link_to group_milestone_path(@group, milestone.safe_title, title: milestone.title) do
= link_to group_milestone_path(@group, milestone.safe_title, title: milestone.title) do = pluralize milestone.merge_requests_count, 'Merge Request'
= pluralize milestone.merge_requests_count, 'Merge Request' &nbsp;
&nbsp; %span.light #{milestone.percent_complete}% complete
%span.light #{milestone.percent_complete}% complete .progress.progress-info
.progress.progress-info .progress-bar{style: "width: #{milestone.percent_complete}%;"}
.progress-bar{style: "width: #{milestone.percent_complete}%;"} %div
%div %br
%br - milestone.projects.each do |project|
- milestone.projects.each do |project| %span.label.label-default
%span.label.label-default = project.name
= project.name = paginate @group_milestones, theme: "gitlab"
= paginate @group_milestones, theme: "gitlab"
...@@ -7,27 +7,15 @@ ...@@ -7,27 +7,15 @@
%i.fa.fa-plus %i.fa.fa-plus
New Milestone New Milestone
.row = render 'shared/milestones_filter'
.fixed.sidebar-expand-button.hidden-lg.hidden-md.hidden-xs
%i.fa.fa-list.fa-2x
.col-md-3.responsive-side
%ul.nav.nav-pills.nav-stacked
%li{class: ("active" if (params[:f] == "active" || !params[:f]))}
= link_to project_milestones_path(@project, f: "active") do
Active
%li{class: ("active" if params[:f] == "closed")}
= link_to project_milestones_path(@project, f: "closed") do
Closed
%li{class: ("active" if params[:f] == "all")}
= link_to project_milestones_path(@project, f: "all") do
All
.col-md-9
.panel.panel-default
%ul.well-list
= render @milestones
- if @milestones.blank? .milestones
%li .panel.panel-default
.nothing-here-block No milestones to show %ul.well-list
= render @milestones
= paginate @milestones, theme: "gitlab" - if @milestones.blank?
%li
.nothing-here-block No milestones to show
= paginate @milestones, theme: "gitlab"
.fixed.sidebar-expand-button.hidden-lg.hidden-md
%i.fa.fa-list.fa-2x
.responsive-side.milestones-filters.append-bottom-10
%ul.nav.nav-pills.nav-compact
%li{class: ("active" if params[:state].blank? || params[:state] == 'opened')}
= link_to milestones_filter_path(state: 'opened') do
%i.fa.fa-exclamation-circle
Open
%li{class: ("active" if params[:state] == 'closed')}
= link_to milestones_filter_path(state: 'closed') do
%i.fa.fa-check-circle
Closed
%li{class: ("active" if params[:state] == 'all')}
= link_to milestones_filter_path(state: 'all') do
%i.fa.fa-compass
All
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