Commit 1d857aae17a2f7a3bc759707f0fb642943d9569e
1 parent
ae282f63
Exists in
master
and in
4 other branches
project admin area - show project name with namespace
Showing
3 changed files
with
14 additions
and
7 deletions
Show diff stats
app/models/project.rb
| ... | ... | @@ -259,4 +259,14 @@ class Project < ActiveRecord::Base |
| 259 | 259 | save! |
| 260 | 260 | end |
| 261 | 261 | end |
| 262 | + | |
| 263 | + def name_with_namespace | |
| 264 | + @name_with_namespace ||= begin | |
| 265 | + if namespace | |
| 266 | + namespace.human_name + " / " + name | |
| 267 | + else | |
| 268 | + name | |
| 269 | + end | |
| 270 | + end | |
| 271 | + end | |
| 262 | 272 | end | ... | ... |
app/views/admin/projects/index.html.haml
| ... | ... | @@ -4,14 +4,14 @@ |
| 4 | 4 | = link_to 'New Project', new_project_path, class: "btn small right" |
| 5 | 5 | %br |
| 6 | 6 | = form_tag admin_projects_path, method: :get, class: 'form-inline' do |
| 7 | - = select_tag :namespace_id, namespaces_options(params[:namespace_id], :all), class: "chosen xlarge", include_blank: true | |
| 7 | + = select_tag :namespace_id, namespaces_options(params[:namespace_id], :all), class: "chosen xlarge", prompt: "Project namespace" | |
| 8 | 8 | = text_field_tag :name, params[:name], class: "xlarge" |
| 9 | 9 | = submit_tag "Search", class: "btn submit primary" |
| 10 | 10 | |
| 11 | 11 | %table |
| 12 | 12 | %thead |
| 13 | 13 | %th Name |
| 14 | - %th Project | |
| 14 | + %th Path | |
| 15 | 15 | %th Team Members |
| 16 | 16 | %th Last Commit |
| 17 | 17 | %th Edit |
| ... | ... | @@ -20,10 +20,7 @@ |
| 20 | 20 | - @projects.each do |project| |
| 21 | 21 | %tr |
| 22 | 22 | %td |
| 23 | - - if project.namespace | |
| 24 | - = link_to project.namespace.human_name, [:admin, project] | |
| 25 | - → | |
| 26 | - = link_to project.name, [:admin, project] | |
| 23 | + = link_to project.name_with_namespace, [:admin, project] | |
| 27 | 24 | %td |
| 28 | 25 | %span.monospace= project.path_with_namespace + ".git" |
| 29 | 26 | %td= project.users_projects.count | ... | ... |
app/views/admin/projects/show.html.haml