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,4 +259,14 @@ class Project < ActiveRecord::Base | ||
259 | save! | 259 | save! |
260 | end | 260 | end |
261 | end | 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 | end | 272 | end |
app/views/admin/projects/index.html.haml
@@ -4,14 +4,14 @@ | @@ -4,14 +4,14 @@ | ||
4 | = link_to 'New Project', new_project_path, class: "btn small right" | 4 | = link_to 'New Project', new_project_path, class: "btn small right" |
5 | %br | 5 | %br |
6 | = form_tag admin_projects_path, method: :get, class: 'form-inline' do | 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 | = text_field_tag :name, params[:name], class: "xlarge" | 8 | = text_field_tag :name, params[:name], class: "xlarge" |
9 | = submit_tag "Search", class: "btn submit primary" | 9 | = submit_tag "Search", class: "btn submit primary" |
10 | 10 | ||
11 | %table | 11 | %table |
12 | %thead | 12 | %thead |
13 | %th Name | 13 | %th Name |
14 | - %th Project | 14 | + %th Path |
15 | %th Team Members | 15 | %th Team Members |
16 | %th Last Commit | 16 | %th Last Commit |
17 | %th Edit | 17 | %th Edit |
@@ -20,10 +20,7 @@ | @@ -20,10 +20,7 @@ | ||
20 | - @projects.each do |project| | 20 | - @projects.each do |project| |
21 | %tr | 21 | %tr |
22 | %td | 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 | %td | 24 | %td |
28 | %span.monospace= project.path_with_namespace + ".git" | 25 | %span.monospace= project.path_with_namespace + ".git" |
29 | %td= project.users_projects.count | 26 | %td= project.users_projects.count |
app/views/admin/projects/show.html.haml
1 | = render 'admin/shared/projects_head' | 1 | = render 'admin/shared/projects_head' |
2 | %h3.page_title | 2 | %h3.page_title |
3 | - Project: #{@project.name} | 3 | + Project: #{@project.name_with_namespace} |
4 | = link_to edit_admin_project_path(@project), class: "btn right" do | 4 | = link_to edit_admin_project_path(@project), class: "btn right" do |
5 | %i.icon-edit | 5 | %i.icon-edit |
6 | Edit | 6 | Edit |