@projects = @projects.where(namespace_id: Group.find_by_name(params[:group])) if params[:group].present?
@projects = @projects.where(visibility_level: params[:visibility_level]) if params[:visibility_level].present?
- @projects = @projects.includes(:namespace).sorted_by_activity
+ @projects = @projects.includes(:namespace)
+ @projects = @projects.tagged_with(params[:label]) if params[:label].present?
+ @projects = @projects.sort(@sort = params[:sort])
+ @projects = @projects.page(params[:page]).per(30)
@labels = current_user.authorized_projects.tags_on(:labels)
@groups = current_user.authorized_groups
-
- @projects = @projects.tagged_with(params[:label]) if params[:label].present?
- @projects = @projects.page(params[:page]).per(30)
end
def merge_requests
def index
@projects = Project.public_or_internal_only(current_user)
@projects = @projects.search(params[:search]) if params[:search].present?
- @sort = params[:sort]
- @projects = case @sort
- when 'newest' then @projects.order('created_at DESC')
- when 'oldest' then @projects.order('created_at ASC')
- when 'recently_updated' then @projects.order('updated_at DESC')
- when 'last_updated' then @projects.order('updated_at ASC')
- else @projects.order("namespaces.path, projects.name ASC")
- end
+ @projects = @projects.sort(@sort = params[:sort])
@projects = @projects.includes(:namespace).page(params[:page]).per(20)
end
end
-%h3.page-title My Projects
+%h3.page-title
+ 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
+ Newest
+ = link_to projects_dashboard_filter_path(sort: 'oldest') do
+ Oldest
+ = link_to projects_dashboard_filter_path(sort: 'recently_updated') do
+ Recently updated
+ = link_to projects_dashboard_filter_path(sort: 'last_updated') do
+ Last updated
%p.light
All projects you have access to are listed here. Public projects are not included here unless you are a member
%hr
.span3
%ul.nav.nav-pills.nav-stacked
= nav_tab :scope, nil do
- = link_to projects_dashboard_path do
+ = link_to projects_dashboard_filter_path(scope: nil) do
All
%span.pull-right
= current_user.authorized_projects.count
= nav_tab :scope, 'personal' do
- = link_to projects_dashboard_path(scope: 'personal') do
+ = link_to projects_dashboard_filter_path(scope: 'personal') do
Personal
%span.pull-right
= current_user.personal_projects.count
= nav_tab :scope, 'joined' do
- = link_to projects_dashboard_path(scope: 'joined') do
+ = link_to projects_dashboard_filter_path(scope: 'joined') do
Joined
%span.pull-right
= current_user.authorized_projects.joined(current_user).count
= nav_tab :scope, 'owned' do
- = link_to projects_dashboard_path(scope: 'owned') do
+ = link_to projects_dashboard_filter_path(scope: 'owned') do
Owned
%span.pull-right
= current_user.owned_projects.count
%ul.bordered-list.visibility-filter
- Gitlab::VisibilityLevel.values.each do |level|
%li{ class: (level.to_s == params[:visibility_level]) ? 'active' : 'light' }
- = link_to projects_dashboard_path(visibility_level: level) do
+ = link_to projects_dashboard_filter_path(visibility_level: level) do
= visibility_level_icon(level)
= visibility_level_label(level)
%ul.bordered-list
- @groups.each do |group|
%li{ class: (group.name == params[:group]) ? 'active' : 'light' }
- = link_to projects_dashboard_path(group: group.name) do
+ = link_to projects_dashboard_filter_path(group: group.name) do
%i.icon-folder-close-alt
= group.name
%small.pull-right
%ul.bordered-list
- @labels.each do |label|
%li{ class: (label.name == params[:label]) ? 'active' : 'light' }
- = link_to projects_dashboard_path(scope: params[:scope], label: label.name) do
+ = link_to projects_dashboard_filter_path(scope: params[:scope], label: label.name) do
%i.icon-tag
= label.name