diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2013-01-13 19:24:29 +0400 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2013-01-13 19:25:18 +0400 |
commit | 68bfcd0521020d9f0154ffe767aa1e327e93ca24 (patch) | |
tree | 60b9f4c814d9583073de40785a94ff446124f6ed | |
parent | 122acb2254c94823bd7b7b64aa1bd953df5fdf66 (diff) |
Add public filter to admin projects
-rw-r--r-- | app/assets/stylesheets/application.scss | 1 | ||||
-rw-r--r-- | app/assets/stylesheets/sections/admin.scss | 5 | ||||
-rw-r--r-- | app/controllers/admin/projects_controller.rb | 1 | ||||
-rw-r--r-- | app/controllers/public/projects_controller.rb | 1 | ||||
-rw-r--r-- | app/views/admin/projects/index.html.haml | 75 | ||||
-rw-r--r-- | app/views/help/index.html.haml | 2 | ||||
-rw-r--r-- | app/views/help/public_area.html.haml | 16 | ||||
-rw-r--r-- | app/views/layouts/application.html.haml | 2 | ||||
-rw-r--r-- | app/views/public/projects/index.html.haml | 3 | ||||
-rw-r--r-- | config/routes.rb | 1 |
10 files changed, 73 insertions, 34 deletions
diff --git a/app/assets/stylesheets/application.scss b/app/assets/stylesheets/application.scss index 54690e73f81..0e951e7f68c 100644 --- a/app/assets/stylesheets/application.scss +++ b/app/assets/stylesheets/application.scss @@ -32,6 +32,7 @@ @import "sections/profile.scss"; @import "sections/login.scss"; @import "sections/editor.scss"; +@import "sections/admin.scss"; @import "highlight/white.scss"; @import "highlight/dark.scss"; diff --git a/app/assets/stylesheets/sections/admin.scss b/app/assets/stylesheets/sections/admin.scss new file mode 100644 index 00000000000..18b102d7022 --- /dev/null +++ b/app/assets/stylesheets/sections/admin.scss @@ -0,0 +1,5 @@ +.admin-filter form { + label { width: 110px; } + .controls { margin-left: 130px; } + .form-actions { padding-left: 130px; background: #fff } +} diff --git a/app/controllers/admin/projects_controller.rb b/app/controllers/admin/projects_controller.rb index d5e6f3cdc0e..aa9e2f69a04 100644 --- a/app/controllers/admin/projects_controller.rb +++ b/app/controllers/admin/projects_controller.rb @@ -4,6 +4,7 @@ class Admin::ProjectsController < AdminController def index @projects = Project.scoped @projects = @projects.where(namespace_id: params[:namespace_id]) if params[:namespace_id].present? + @projects = @projects.where(public: true) if params[:public_only].present? @projects = @projects.where(namespace_id: nil) if params[:namespace_id] == Namespace.global_id @projects = @projects.search(params[:name]) if params[:name].present? @projects = @projects.includes(:namespace).order("namespaces.path, projects.name ASC").page(params[:page]).per(20) diff --git a/app/controllers/public/projects_controller.rb b/app/controllers/public/projects_controller.rb index 28f46c6f239..4108fe5f363 100644 --- a/app/controllers/public/projects_controller.rb +++ b/app/controllers/public/projects_controller.rb @@ -7,5 +7,6 @@ class Public::ProjectsController < ApplicationController def index @projects = Project.public + @projects = @projects.includes(:namespace).order("namespaces.path, projects.name ASC").page(params[:page]).per(20) end end diff --git a/app/views/admin/projects/index.html.haml b/app/views/admin/projects/index.html.haml index 1f5b31eca5f..5a5c63ce6ad 100644 --- a/app/views/admin/projects/index.html.haml +++ b/app/views/admin/projects/index.html.haml @@ -1,38 +1,47 @@ %h3.page_title - Projects (#{Project.count}) + Projects = link_to 'New Project', new_project_path, class: "btn small right" -%br -= form_tag admin_projects_path, method: :get, class: 'form-inline' do - = select_tag :namespace_id, namespaces_options(params[:namespace_id], :all), class: "chosen xlarge", prompt: "Project namespace" - = text_field_tag :name, params[:name], class: "xlarge" - = submit_tag "Search", class: "btn submit primary" -%table - %thead - %tr - %th - Name - %i.icon-sort-down - %th Path - %th Team Members - %th Owner - %th Last Commit - %th Edit - %th.cred Danger Zone! +%hr - - @projects.each do |project| - %tr - %td - = link_to project.name_with_namespace, [:admin, project] - %td - %span.monospace= project.path_with_namespace + ".git" - %td= project.users_projects.count - %td - - if project.owner - = link_to project.owner.name, [:admin, project.owner] +.row + .span4 + .admin-filter + = form_tag admin_projects_path, method: :get, class: 'form-inline' do + .control-group + = label_tag :name, 'Name:', class: 'control-label' + .controls + = text_field_tag :name, params[:name], class: "span2" + + .control-group + = label_tag :namespace_id, 'Namespace:', class: 'control-label' + .controls + = select_tag :namespace_id, namespaces_options(params[:namespace_id], :all), class: "chosen span2", prompt: "Any" + .control-group + = label_tag :public_only, 'Public Only', class: 'control-label' + .controls + = check_box_tag :public_only, 1, params[:public_only] + + .form-actions + = submit_tag "Search", class: "btn submit primary" + = link_to "Reset", admin_projects_path, class: "btn" + .span8 + .ui-box + %h5.title + Projects (#{@projects.total_count}) + %ul.well-list + - @projects.each do |project| + %li + - if project.public + %i.icon-unlock.cred + - else + %i.icon-lock.cgreen + = link_to project.name_with_namespace, [:admin, project] + .right + = link_to 'Edit', edit_admin_project_path(project), id: "edit_#{dom_id(project)}", class: "btn small" + = link_to 'Destroy', [:admin, project], confirm: "REMOVE #{project.name}? Are you sure?", method: :delete, class: "btn small danger" + - if @projects.blank? + %p.nothing_here_message 0 projects matches - else - (deleted) - %td= last_commit(project) - %td= link_to 'Edit', edit_admin_project_path(project), id: "edit_#{dom_id(project)}", class: "btn small" - %td.bgred= link_to 'Destroy', [:admin, project], confirm: "REMOVE #{project.name}? Are you sure?", method: :delete, class: "btn small danger" -= paginate @projects, theme: "admin" + %li.bottom + = paginate @projects, theme: "admin" diff --git a/app/views/help/index.html.haml b/app/views/help/index.html.haml index dc22b672cb7..cadf6c9d6e7 100644 --- a/app/views/help/index.html.haml +++ b/app/views/help/index.html.haml @@ -47,3 +47,5 @@ %li %span= link_to "System Hooks", help_system_hooks_path + %li + %span= link_to "Public Area", help_public_area_path diff --git a/app/views/help/public_area.html.haml b/app/views/help/public_area.html.haml new file mode 100644 index 00000000000..a7a86e92396 --- /dev/null +++ b/app/views/help/public_area.html.haml @@ -0,0 +1,16 @@ +%h3.page_title Public Area +.back_link + = link_to help_path do + ← to index +%hr + +%p + Public area - is part of application with public access. + %br + It used to list all projects with public read-only access. + %br + If you enable public http access to the project - it will appears there + %br + + Follow #{link_to "this link", public_root_path} to visit Public Area + diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml index a197de38749..88da5c98c78 100644 --- a/app/views/layouts/application.html.haml +++ b/app/views/layouts/application.html.haml @@ -18,7 +18,7 @@ %span.count= current_user.cared_merge_requests.opened.count = nav_link(path: 'search#show') do = link_to "Search", search_path - = nav_link(path: 'help#index') do + = nav_link(controller: :help) do = link_to "Help", help_path .content= yield diff --git a/app/views/public/projects/index.html.haml b/app/views/public/projects/index.html.haml index fceb4817210..f60a0898821 100644 --- a/app/views/public/projects/index.html.haml +++ b/app/views/public/projects/index.html.haml @@ -12,3 +12,6 @@ .right %span.monospace.tiny git clone #{project.http_url_to_repo} + + += paginate @projects, theme: "admin" diff --git a/config/routes.rb b/config/routes.rb index eeba31d5ae4..ee6dfe6d3e6 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -35,6 +35,7 @@ Gitlab::Application.routes.draw do get 'help/markdown' => 'help#markdown' get 'help/ssh' => 'help#ssh' get 'help/raketasks' => 'help#raketasks' + get 'help/public_area' => 'help#public_area' # # Public namespace |