Commit 842f9e03 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Merge branch 'ui-improvements' into 'master'

UI improvements

Improve filtering UI for next pages:

* dashboard projects page
* group milestones page
* project milestones page

See merge request !1370
parents 560e717f b8f48bf4
...@@ -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")
......
...@@ -4,6 +4,8 @@ module DashboardHelper ...@@ -4,6 +4,8 @@ module DashboardHelper
sort: params[:sort], sort: params[:sort],
scope: params[:scope], scope: params[:scope],
group: params[:group], group: params[:group],
tag: params[:tag],
visibility_level: params[:visibility_level],
} }
options = exist_opts.merge(options) options = exist_opts.merge(options)
......
...@@ -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
%fieldset .dash-projects-filters.append-bottom-20
%ul.nav.nav-pills.nav-stacked .pull-left.append-right-20
= nav_tab :scope, nil do %ul.nav.nav-pills.nav-compact
= link_to projects_dashboard_filter_path(scope: nil) do = nav_tab :scope, nil do
All = link_to projects_dashboard_filter_path(scope: nil) do
%span.pull-right All
= current_user.authorized_projects.count = nav_tab :scope, 'personal' do
= nav_tab :scope, 'personal' do = link_to projects_dashboard_filter_path(scope: 'personal') do
= link_to projects_dashboard_filter_path(scope: 'personal') do Personal
Personal = nav_tab :scope, 'joined' do
%span.pull-right = link_to projects_dashboard_filter_path(scope: 'joined') do
= current_user.personal_projects.count Joined
= nav_tab :scope, 'joined' do = nav_tab :scope, 'owned' do
= link_to projects_dashboard_filter_path(scope: 'joined') do = link_to projects_dashboard_filter_path(scope: 'owned') do
Joined Owned
%span.pull-right
= current_user.authorized_projects.joined(current_user).count
= nav_tab :scope, 'owned' do
= link_to projects_dashboard_filter_path(scope: 'owned') do
Owned
%span.pull-right
= current_user.owned_projects.count
%fieldset .dropdown.inline.append-right-10
%legend Visibility %a.dropdown-toggle.btn{href: '#', "data-toggle" => "dropdown"}
%ul.nav.nav-pills.nav-stacked.nav-small.visibility-filter %i.fa.fa-globe
- Gitlab::VisibilityLevel.values.each do |level| %span.light Visibility:
%li{ class: (level.to_s == params[:visibility_level]) ? 'active' : 'light' } - if params[:visibility_level].present?
= link_to projects_dashboard_filter_path(visibility_level: level) do = visibility_level_label(params[:visibility_level].to_i)
= visibility_level_icon(level) - else
= visibility_level_label(level) Any
%b.caret
%ul.dropdown-menu
%li
= link_to projects_dashboard_filter_path(visibility_level: nil) do
Any
- Gitlab::VisibilityLevel.values.each do |level|
%li{ class: (level.to_s == params[:visibility_level]) ? 'active' : 'light' }
= link_to projects_dashboard_filter_path(visibility_level: level) do
= visibility_level_icon(level)
= visibility_level_label(level)
- if @groups.present? - if @groups.present?
%fieldset .dropdown.inline.append-right-10
%legend Groups %a.dropdown-toggle.btn{href: '#', "data-toggle" => "dropdown"}
%ul.nav.nav-pills.nav-stacked.nav-small %i.fa.fa-group
- @groups.each do |group| %span.light Group:
%li{ class: (group.name == params[:group]) ? 'active' : 'light' } - if params[:group].present?
= link_to projects_dashboard_filter_path(group: group.name) do = Group.find_by(name: params[:group]).name
%i.fa.fa-folder-o - else
= group.name Any
%small.pull-right %b.caret
= group.projects.count %ul.dropdown-menu
%li
= link_to projects_dashboard_filter_path(group: nil) do
Any
- @groups.each do |group|
%li{ class: (group.name == params[:group]) ? 'active' : 'light' }
= link_to projects_dashboard_filter_path(group: group.name) do
= group.name
%small.pull-right
= group.projects.count
- if @tags.present? - if @tags.present?
%fieldset .dropdown.inline.append-right-10
%legend Tags %a.dropdown-toggle.btn{href: '#', "data-toggle" => "dropdown"}
%ul.nav.nav-pills.nav-stacked.nav-small %i.fa.fa-tags
- @tags.each do |tag| %span.light Tags:
%li{ class: (tag.name == params[:tag]) ? 'active' : 'light' } - if params[:tag].present?
= link_to projects_dashboard_filter_path(scope: params[:scope], tag: tag.name) do = params[:tag]
%i.fa.fa-tag - else
= tag.name Any
%b.caret
%ul.dropdown-menu
%li
= link_to projects_dashboard_filter_path(tag: nil) do
Any
- @tags.each do |tag|
%li{ class: (tag.name == params[:tag]) ? 'active' : 'light' }
= link_to projects_dashboard_filter_path(tag: tag.name) do
%i.fa.fa-tag
= tag.name
.pull-right
.dropdown.inline
%a.dropdown-toggle.btn{href: '#', "data-toggle" => "dropdown"}
%span.light sort:
- if @sort.present?
= @sort.humanize
- else
Name
%b.caret
%ul.dropdown-menu
%li
= link_to projects_dashboard_filter_path(sort: nil) do
Name
= link_to projects_dashboard_filter_path(sort: 'newest') do
= sort_title_recently_created
= link_to projects_dashboard_filter_path(sort: 'oldest') do
= sort_title_oldest_created
= link_to projects_dashboard_filter_path(sort: 'recently_updated') do
= sort_title_recently_updated
= link_to projects_dashboard_filter_path(sort: 'last_updated') do
= sort_title_oldest_updated
%h3.page-title %h3.page-title
My Projects My Projects
.pull-right
.dropdown.inline
%a.dropdown-toggle.btn.btn-small{href: '#', "data-toggle" => "dropdown"}
%span.light sort:
- if @sort.present?
= @sort.humanize
- else
Name
%b.caret
%ul.dropdown-menu
%li
= link_to projects_dashboard_filter_path(sort: nil) do
Name
= link_to projects_dashboard_filter_path(sort: 'newest') do
= sort_title_recently_created
= link_to projects_dashboard_filter_path(sort: 'oldest') do
= sort_title_oldest_created
= link_to projects_dashboard_filter_path(sort: 'recently_updated') do
= sort_title_recently_updated
= link_to projects_dashboard_filter_path(sort: 'last_updated') do
= sort_title_oldest_updated
%p.light %p.light
All projects you have access to are listed here. Public projects are not included here unless you are a member All projects you have access to are listed here. Public projects are not included here unless you are a member
%hr %hr
.row .side-filters
.col-md-3.hidden-sm.hidden-xs.side-filters = render "projects_filter"
= render "projects_filter" .dash-projects
.col-md-9 %ul.bordered-list.my-projects.top-list
%ul.bordered-list.my-projects.top-list - @projects.each do |project|
- @projects.each do |project| %li.my-project-row
%li.my-project-row %h4.project-title
%h4.project-title .project-access-icon
.project-access-icon = visibility_level_icon(project.visibility_level)
= visibility_level_icon(project.visibility_level) = link_to project_path(project), class: dom_class(project) do
= link_to project_path(project), class: dom_class(project) do = project.name_with_namespace
= project.name_with_namespace
- if project.forked_from_project - if project.forked_from_project
&nbsp; &nbsp;
%small %small
%i.fa.fa-code-fork %i.fa.fa-code-fork
Forked from: Forked from:
= link_to project.forked_from_project.name_with_namespace, project_path(project.forked_from_project) = link_to project.forked_from_project.name_with_namespace, project_path(project.forked_from_project)
- if current_user.can_leave_project?(project) - if current_user.can_leave_project?(project)
.pull-right
= link_to leave_project_team_members_path(project), data: { confirm: "Leave project?"}, method: :delete, remote: true, class: "btn-tiny btn remove-row", title: 'Leave project' do
%i.fa.fa-sign-out
Leave
.project-info
.pull-right .pull-right
- if project.archived? = link_to leave_project_team_members_path(project), data: { confirm: "Leave project?"}, method: :delete, remote: true, class: "btn-tiny btn remove-row", title: 'Leave project' do
%span.label %i.fa.fa-sign-out
%i.fa.fa-archive Leave
Archived
- project.tags.each do |tag| .project-info
%span.label.label-info .pull-right
%i.fa.fa-tag - if project.archived?
= tag.name %span.label
- if project.description.present? %i.fa.fa-archive
%p= truncate project.description, length: 100 Archived
.last-activity - project.tags.each do |tag|
%span.light Last activity: %span.label.label-info
%span.date= project_last_activity(project) %i.fa.fa-tag
= tag.name
- if project.description.present?
%p= truncate project.description, length: 100
.last-activity
%span.light Last activity:
%span.date= project_last_activity(project)
- if @projects.blank? - if @projects.blank?
%li %li
.nothing-here-block There are no projects here. .nothing-here-block There are no projects here.
.bottom .bottom
= paginate @projects, theme: "gitlab" = paginate @projects, theme: "gitlab"
= 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