Commit aebf22f6 authored by Ezekiel Kigbo's avatar Ezekiel Kigbo

Ensure we dont apply changes to admin/projects

The changes introduced for the project filter bar should
not apply to the admin projects screen.

Remove "Owned by me", "Owned by anyone" options

Update the dropdown option Last created -> Created date.
Introduces fixes for spacing and minor styling across breakpoints.
parent c1f5205d
...@@ -1470,10 +1470,6 @@ pre.light-well { ...@@ -1470,10 +1470,6 @@ pre.light-well {
} }
} }
.filter-with-icon {
border-radius: 3px 0 0 3px;
}
.filtered-search-wrapper { .filtered-search-wrapper {
flex-wrap: nowrap; flex-wrap: nowrap;
flex-direction: row; flex-direction: row;
...@@ -1494,9 +1490,9 @@ pre.light-well { ...@@ -1494,9 +1490,9 @@ pre.light-well {
} }
.filtered-search-dropdown-label { .filtered-search-dropdown-label {
padding: 0 8px 0 16px; padding: 0 0 0 16px;
font-weight: bold; font-weight: bold;
min-width: 76px; min-width: 68px;
} }
.filtered-search { .filtered-search {
...@@ -1525,6 +1521,10 @@ pre.light-well { ...@@ -1525,6 +1521,10 @@ pre.light-well {
border-radius: 3px 0 0 3px; border-radius: 3px 0 0 3px;
} }
.dropdown-menu-toggle {
margin-left: 8px;
}
@include media-breakpoint-down(lg) { @include media-breakpoint-down(lg) {
.filtered-search { .filtered-search {
min-width: 15%; min-width: 15%;
...@@ -1534,18 +1534,23 @@ pre.light-well { ...@@ -1534,18 +1534,23 @@ pre.light-well {
} }
} }
.extended-filtered-search.filtered-search { .extended-filtered-search-box {
margin-left: 0; margin: 0;
min-width: 65%; min-width: 45%;
} }
} }
@include media-breakpoint-down(md) { @include media-breakpoint-down(md) {
.filtered-search { .filtered-search:not(.extended-filtered-search-box) {
margin: 0 0 8px 16px; margin: 0 0 8px 16px;
min-width: 30%; min-width: 30%;
} }
.extended-filtered-search-box {
margin: 0 0 8px;
min-width: 55%;
}
.filtered-search-nav { .filtered-search-nav {
margin: 0 0 8px; margin: 0 0 8px;
} }
...@@ -1586,6 +1591,7 @@ pre.light-well { ...@@ -1586,6 +1591,7 @@ pre.light-well {
width: 100%; width: 100%;
} }
.filtered-search:not(.extended-filtered-search-box),
.filtered-search { .filtered-search {
margin-left: 0; margin-left: 0;
} }
...@@ -1600,14 +1606,16 @@ pre.light-well { ...@@ -1600,14 +1606,16 @@ pre.light-well {
.filtered-search-dropdown { .filtered-search-dropdown {
margin: 0 0 8px; margin: 0 0 8px;
&:last-of-type {
margin: 0;
}
} }
.filtered-search-dropdown-label { .filtered-search-dropdown-label {
padding-left: 0; padding: 0;
min-width: 60px;
} }
} }
} }
...@@ -29,30 +29,40 @@ module SortingHelper ...@@ -29,30 +29,40 @@ module SortingHelper
} }
end end
# TODO: stars_asc doesnt seem to work
def projects_sort_options_hash def projects_sort_options_hash
is_admin = current_controller?('admin/projects')
options = { options = {
sort_value_latest_activity => sort_title_latest_activity, sort_value_latest_activity => sort_title_latest_activity,
sort_value_recently_created => sort_title_recently_created,
sort_value_name => sort_title_name, sort_value_name => sort_title_name,
sort_value_most_stars => sort_title_stars sort_value_oldest_activity => sort_title_oldest_activity,
sort_value_oldest_created => sort_title_oldest_created,
sort_value_recently_created => sort_title_recently_created,
sort_value_most_stars => sort_title_most_stars
} }
if current_controller?('admin/projects') if is_admin
options[sort_value_largest_repo] = sort_title_largest_repo options[sort_value_largest_repo] = sort_title_largest_repo
end end
options search_bar_options = {
sort_value_latest_activity => sort_title_latest_activity,
sort_value_recently_created => sort_title_created_date,
sort_value_name => sort_title_name,
sort_value_most_stars => sort_title_stars
}
Feature.enabled?(:project_list_filter_bar) && !is_admin ? search_bar_options : options
end end
def projects_sort_option_titles def projects_sort_option_titles
{ {
sort_value_latest_activity => sort_title_latest_activity, sort_value_latest_activity => sort_title_latest_activity,
sort_value_recently_created => sort_title_recently_created, sort_value_recently_created => sort_title_created_date,
sort_value_name => sort_title_name, sort_value_name => sort_title_name,
sort_value_most_stars => sort_title_stars, sort_value_most_stars => sort_title_stars,
sort_value_oldest_activity => sort_title_latest_activity, sort_value_oldest_activity => sort_title_latest_activity,
sort_value_oldest_created => sort_title_recently_created, sort_value_oldest_created => sort_title_created_date,
sort_value_name_desc => sort_title_name, sort_value_name_desc => sort_title_name,
sort_value_most_stars_asc => sort_title_stars sort_value_most_stars_asc => sort_title_stars
} }
......
- is_explore = local_assigns.fetch(:is_explore, false) - is_explore = local_assigns.fetch(:is_explore, false)
- is_explore_trending = local_assigns.fetch(:is_explore_trending, false) - is_explore_trending = local_assigns.fetch(:is_explore_trending, false)
- without_tabs = local_assigns.fetch(:without_tabs, false) - without_tabs = local_assigns.fetch(:without_tabs, false)
- feature_project_list_filter_bar = Feature.enabled?(:project_list_filter_bar)
= content_for :flash_message do = content_for :flash_message do
= render 'shared/project_limit' = render 'shared/project_limit'
...@@ -14,7 +15,7 @@ ...@@ -14,7 +15,7 @@
.top-area.scrolling-tabs-container.inner-page-scroll-tabs .top-area.scrolling-tabs-container.inner-page-scroll-tabs
.fade-left= icon('angle-left') .fade-left= icon('angle-left')
.fade-right= icon('angle-right') .fade-right= icon('angle-right')
%ul.nav-links.scrolling-tabs.mobile-separator.nav.nav-tabs.border-0 %ul.nav-links.scrolling-tabs.mobile-separator.nav.nav-tabs{ class: feature_project_list_filter_bar ? "border-0" : "" }
= nav_link(page: [dashboard_projects_path, root_path]) do = nav_link(page: [dashboard_projects_path, root_path]) do
= link_to dashboard_projects_path, class: 'shortcuts-activity', data: {placement: 'right'} do = link_to dashboard_projects_path, class: 'shortcuts-activity', data: {placement: 'right'} do
= _("Your projects") = _("Your projects")
...@@ -26,10 +27,10 @@ ...@@ -26,10 +27,10 @@
= nav_link(page: [explore_root_path, trending_explore_projects_path, starred_explore_projects_path, explore_projects_path]) do = nav_link(page: [explore_root_path, trending_explore_projects_path, starred_explore_projects_path, explore_projects_path]) do
= link_to explore_root_path, data: {placement: 'right'} do = link_to explore_root_path, data: {placement: 'right'} do
= _("Explore projects") = _("Explore projects")
- unless Feature.enabled?(:project_list_filter_bar) - unless feature_project_list_filter_bar
.nav-controls .nav-controls
= render 'shared/projects/search_form' = render 'shared/projects/search_form'
= render 'shared/projects/dropdown' = render 'shared/projects/dropdown'
- if Feature.enabled?(:project_list_filter_bar) - if feature_project_list_filter_bar
.project-filters .project-filters
= render 'shared/projects/search_bar', is_explore: is_explore, is_explore_trending: is_explore_trending, without_tabs: without_tabs = render 'shared/projects/search_bar', is_explore: is_explore, is_explore_trending: is_explore_trending, without_tabs: without_tabs
- has_label = local_assigns[:has_label] ? local_assigns[:has_label] : false - has_label = local_assigns[:has_label] ? local_assigns[:has_label] : false
- if current_user - if current_user
.dropdown .dropdown.js-project-filter-dropdown-wrap
%button.dropdown-menu-toggle{ href: '#', "data-toggle" => "dropdown", 'data-display' => 'static' } %button.dropdown-menu-toggle{ href: '#', "data-toggle" => "dropdown", 'data-display' => 'static' }
- if !has_label - if !has_label
= icon('globe', class: 'mt-1') = icon('globe', class: 'mt-1')
......
- @sort ||= sort_value_latest_activity - @sort ||= sort_value_latest_activity
.btn-group{ role: "group" } .dropdown.js-project-filter-dropdown-wrap
.btn-group.dropdown.js-project-filter-dropdown-wrap.filter-with-icon{ role: "group" } - toggle_text = projects_sort_options_hash[@sort]
- toggle_text = projects_sort_option_titles[@sort] = dropdown_toggle(toggle_text, { toggle: 'dropdown', display: 'static' }, { id: 'sort-projects-dropdown' })
%button.dropdown-menu-toggle{ id: 'sort-projects-dropdown', type: 'button', data: { toggle: 'dropdown', display: 'static' }, class: 'btn btn-default' } %ul.dropdown-menu.dropdown-menu-right.dropdown-menu-selectable
= toggle_text %li.dropdown-header
= icon('chevron-down') Sort by
%ul.dropdown-menu.dropdown-menu-right.dropdown-menu-selectable - projects_sort_options_hash.each do |value, title|
%li.dropdown-header %li
Sort by = link_to filter_projects_path(sort: value), class: ("is-active" if @sort == value) do
- projects_sort_options_hash.each do |value, title| = title
%li
= link_to filter_projects_path(sort: value), class: ("is-active" if projects_sort_option_titles[@sort] == title) do
= title
%li.divider
%li
= link_to filter_projects_path(archived: nil), class: ("is-active" unless params[:archived].present?) do
Hide archived projects
%li
= link_to filter_projects_path(archived: true), class: ("is-active" if Gitlab::Utils.to_boolean(params[:archived])) do
Show archived projects
%li
= link_to filter_projects_path(archived: 'only'), class: ("is-active" if params[:archived] == 'only') do
Show archived projects only
- if current_user
%li.divider %li.divider
%li %li
= link_to filter_projects_path(archived: nil), class: ("is-active" unless params[:archived].present?) do = link_to filter_projects_path(personal: nil), class: ("is-active" unless params[:personal].present?) do
Hide archived projects Owned by anyone
%li
= link_to filter_projects_path(archived: true), class: ("is-active" if Gitlab::Utils.to_boolean(params[:archived])) do
Show archived projects
%li %li
= link_to filter_projects_path(archived: 'only'), class: ("is-active" if params[:archived] == 'only') do = link_to filter_projects_path(personal: true), class: ("is-active" if params[:personal].present?) do
Show archived projects only Owned by me
- if current_user - if @group && @group.shared_projects.present?
%li.divider %li.divider
%li %li
= link_to filter_projects_path(personal: nil), class: ("is-active" unless params[:personal].present?) do = link_to filter_projects_path(shared: nil), class: ("is-active" unless params[:shared].present?) do
Owned by anyone All projects
%li %li
= link_to filter_projects_path(personal: true), class: ("is-active" if params[:personal].present?) do = link_to filter_projects_path(shared: 0), class: ("is-active" if params[:shared] == '0') do
Owned by me Hide shared projects
- if @group && @group.shared_projects.present? %li
%li.divider = link_to filter_projects_path(shared: 1), class: ("is-active" if params[:shared] == '1') do
%li Hide group projects
= link_to filter_projects_path(shared: nil), class: ("is-active" unless params[:shared].present?) do
All projects
%li
= link_to filter_projects_path(shared: 0), class: ("is-active" if params[:shared] == '0') do
Hide shared projects
%li
= link_to filter_projects_path(shared: 1), class: ("is-active" if params[:shared] == '1') do
Hide group projects
= project_sort_direction_button(@sort)
...@@ -3,29 +3,28 @@ ...@@ -3,29 +3,28 @@
- is_explore_trending = local_assigns.fetch(:is_explore_trending, false) - is_explore_trending = local_assigns.fetch(:is_explore_trending, false)
- without_tabs = local_assigns.fetch(:without_tabs, false) - without_tabs = local_assigns.fetch(:without_tabs, false)
.filtered-search-block.row-content-block .filtered-search-block.row-content-block
.filtered-search-wrapper.d-flex.mt-2.mt-lg-0 .filtered-search-wrapper.d-flex
- unless without_tabs - unless without_tabs
.filtered-search-nav .filtered-search-nav
= render 'dashboard/projects/nav', is_explore: is_explore, is_explore_trending: is_explore_trending = render 'dashboard/projects/nav', is_explore: is_explore, is_explore_trending: is_explore_trending
.filtered-search.field-with-icon .filtered-search{ class: without_tabs ? "extended-filtered-search-box" : "" }
.btn-group{ role: "group" } .btn-group{ role: "group" }
.btn-group{ role: "group" } .btn-group{ role: "group" }
.filtered-search-box{ class: without_tabs ? "extended-filtered-search-box" : "" } .filtered-search-box
.filtered-search-box-input-container.pl-2 .filtered-search-box-input-container.pl-2
= render 'shared/projects/search_form', admin_view: false, search_form_placeholder: _("Search projects...") = render 'shared/projects/search_form', admin_view: false, search_form_placeholder: _("Search projects...")
-# TODO: since we are no longer triggering search when we type -# TODO: since we are no longer triggering search when we type
-# we might be able to remove the `js-projects-list-filter` -# we might be able to safely remove app/assets/javascripts/projects_list.js
%button.btn.btn-secondary{ type: 'submit', form: 'project-filter-form' } %button.btn.btn-secondary{ type: 'submit', form: 'project-filter-form' }
= sprite_icon('search', size: 16, css_class: 'search-icon ') = sprite_icon('search', size: 16, css_class: 'search-icon ')
.filtered-search-dropdown .filtered-search-dropdown
.filtered-search-dropdown-label .filtered-search-dropdown-label
%span %span
= _("Visibility") = _("Visibility")
.dropdown.js-project-filter-dropdown-wrap.inline-md = render 'explore/projects/filter', has_label: true
= render 'explore/projects/filter', has_label: true
.filtered-search-dropdown .filtered-search-dropdown
.filtered-search-dropdown-label .filtered-search-dropdown-label
%span %span
= _("Sort by") = _("Sort by")
= render 'shared/projects/dropdown' = render 'shared/projects/sort_dropdown'
- @sort ||= sort_value_latest_activity
.btn-group{ role: "group" }
.btn-group.dropdown.js-project-filter-dropdown-wrap{ role: "group" }
- toggle_text = projects_sort_option_titles[@sort]
%button.dropdown-menu-toggle{ id: 'sort-projects-dropdown', type: 'button', data: { toggle: 'dropdown', display: 'static' }, class: 'btn btn-default' }
= toggle_text
= icon('chevron-down')
%ul.dropdown-menu.dropdown-menu-right.dropdown-menu-selectable
%li.dropdown-header
Sort by
- projects_sort_options_hash.each do |value, title|
%li
= link_to filter_projects_path(sort: value), class: ("is-active" if projects_sort_option_titles[@sort] == title) do
= title
%li.divider
%li
= link_to filter_projects_path(archived: nil), class: ("is-active" unless params[:archived].present?) do
Hide archived projects
%li
= link_to filter_projects_path(archived: true), class: ("is-active" if Gitlab::Utils.to_boolean(params[:archived])) do
Show archived projects
%li
= link_to filter_projects_path(archived: 'only'), class: ("is-active" if params[:archived] == 'only') do
Show archived projects only
- if current_user && @group && @group.shared_projects.present?
%li.divider
%li
= link_to filter_projects_path(shared: nil), class: ("is-active" unless params[:shared].present?) do
All projects
%li
= link_to filter_projects_path(shared: 0), class: ("is-active" if params[:shared] == '0') do
Hide shared projects
%li
= link_to filter_projects_path(shared: 1), class: ("is-active" if params[:shared] == '1') do
Hide group projects
= project_sort_direction_button(@sort)
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