From 1d857aae17a2f7a3bc759707f0fb642943d9569e Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Sun, 25 Nov 2012 18:52:12 +0200 Subject: [PATCH] project admin area - show project name with namespace --- app/models/project.rb | 10 ++++++++++ app/views/admin/projects/index.html.haml | 9 +++------ app/views/admin/projects/show.html.haml | 2 +- 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/app/models/project.rb b/app/models/project.rb index 680633f0..0da1c93d 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -259,4 +259,14 @@ class Project < ActiveRecord::Base save! end end + + def name_with_namespace + @name_with_namespace ||= begin + if namespace + namespace.human_name + " / " + name + else + name + end + end + end end diff --git a/app/views/admin/projects/index.html.haml b/app/views/admin/projects/index.html.haml index ffe3cde5..a9ecabff 100644 --- a/app/views/admin/projects/index.html.haml +++ b/app/views/admin/projects/index.html.haml @@ -4,14 +4,14 @@ = 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", include_blank: true + = 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 %th Name - %th Project + %th Path %th Team Members %th Last Commit %th Edit @@ -20,10 +20,7 @@ - @projects.each do |project| %tr %td - - if project.namespace - = link_to project.namespace.human_name, [:admin, project] - → - = link_to project.name, [:admin, project] + = link_to project.name_with_namespace, [:admin, project] %td %span.monospace= project.path_with_namespace + ".git" %td= project.users_projects.count diff --git a/app/views/admin/projects/show.html.haml b/app/views/admin/projects/show.html.haml index 7e4fe3fb..92bf0ff0 100644 --- a/app/views/admin/projects/show.html.haml +++ b/app/views/admin/projects/show.html.haml @@ -1,6 +1,6 @@ = render 'admin/shared/projects_head' %h3.page_title - Project: #{@project.name} + Project: #{@project.name_with_namespace} = link_to edit_admin_project_path(@project), class: "btn right" do %i.icon-edit Edit