Commit a7fab42b9cd34ddd44ff2ab0837691f57428b8e4
1 parent
cb86cf84
Exists in
master
and in
4 other branches
Public area: Project#show page prototype
Showing
6 changed files
with
87 additions
and
16 deletions
Show diff stats
app/assets/stylesheets/sections/projects.scss
@@ -81,9 +81,11 @@ ul.nav.nav-projects-tabs { | @@ -81,9 +81,11 @@ ul.nav.nav-projects-tabs { | ||
81 | 81 | ||
82 | .public-projects { | 82 | .public-projects { |
83 | li { | 83 | li { |
84 | - margin-top: 8px; | ||
85 | - margin-bottom: 5px; | ||
86 | - border-bottom: 1px solid #eee; | 84 | + .project-title { |
85 | + font-size: 14px; | ||
86 | + line-height: 2; | ||
87 | + font-weight: normal; | ||
88 | + } | ||
87 | 89 | ||
88 | .description { | 90 | .description { |
89 | margin-left: 15px; | 91 | margin-left: 15px; |
@@ -92,6 +94,14 @@ ul.nav.nav-projects-tabs { | @@ -92,6 +94,14 @@ ul.nav.nav-projects-tabs { | ||
92 | } | 94 | } |
93 | } | 95 | } |
94 | 96 | ||
97 | +.public-clone { | ||
98 | + background: #333; | ||
99 | + color: #f5f5f5; | ||
100 | + padding: 5px 10px; | ||
101 | + margin: 1px; | ||
102 | + font-weight: normal; | ||
103 | +} | ||
104 | + | ||
95 | .new-tag-btn { | 105 | .new-tag-btn { |
96 | position: relative; | 106 | position: relative; |
97 | top: -5px; | 107 | top: -5px; |
app/controllers/public/projects_controller.rb
@@ -10,4 +10,12 @@ class Public::ProjectsController < ApplicationController | @@ -10,4 +10,12 @@ class Public::ProjectsController < ApplicationController | ||
10 | @projects = @projects.search(params[:search]) if params[:search].present? | 10 | @projects = @projects.search(params[:search]) if params[:search].present? |
11 | @projects = @projects.includes(:namespace).order("namespaces.path, projects.name ASC").page(params[:page]).per(20) | 11 | @projects = @projects.includes(:namespace).order("namespaces.path, projects.name ASC").page(params[:page]).per(20) |
12 | end | 12 | end |
13 | + | ||
14 | + def show | ||
15 | + @project = Project.public_only.find_with_namespace(params[:id]) | ||
16 | + render_404 and return unless @project | ||
17 | + | ||
18 | + @repository = @project.repository | ||
19 | + @recent_tags = @repository.tags.first(10) | ||
20 | + end | ||
13 | end | 21 | end |
app/views/layouts/public.html.haml
@@ -10,10 +10,16 @@ | @@ -10,10 +10,16 @@ | ||
10 | .container | 10 | .container |
11 | %div.app_logo | 11 | %div.app_logo |
12 | %span.separator | 12 | %span.separator |
13 | - = link_to root_path, class: "home" do | 13 | + = link_to public_root_path, class: "home" do |
14 | %h1 GITLAB | 14 | %h1 GITLAB |
15 | %span.separator | 15 | %span.separator |
16 | %h1.project_name Public Projects | 16 | %h1.project_name Public Projects |
17 | + %ul.nav | ||
18 | + %li | ||
19 | + %a | ||
20 | + %div.hide.turbolink-spinner | ||
21 | + %i.icon-refresh.icon-spin | ||
22 | + Loading... | ||
17 | 23 | ||
18 | .container.navless-container | 24 | .container.navless-container |
19 | .content | 25 | .content |
app/views/public/projects/index.html.haml
@@ -11,22 +11,20 @@ | @@ -11,22 +11,20 @@ | ||
11 | = search_field_tag :search, params[:search], placeholder: "gitlab-ci", class: "span3 search-text-input", id: "projects_search" | 11 | = search_field_tag :search, params[:search], placeholder: "gitlab-ci", class: "span3 search-text-input", id: "projects_search" |
12 | = submit_tag 'Search', class: "btn btn-primary wide" | 12 | = submit_tag 'Search', class: "btn btn-primary wide" |
13 | 13 | ||
14 | -%hr | ||
15 | - | ||
16 | .public-projects | 14 | .public-projects |
17 | - %ul.unstyled | 15 | + %ul.bordered-list |
18 | - @projects.each do |project| | 16 | - @projects.each do |project| |
19 | - %li.clearfix | ||
20 | - %div | ||
21 | - %i.icon-share | ||
22 | - - if current_user | ||
23 | - = link_to_project project | ||
24 | - - else | 17 | + %li |
18 | + .project-title | ||
19 | + %i.icon-share.cgray | ||
20 | + = link_to public_project_path(project) do | ||
25 | = project.name_with_namespace | 21 | = project.name_with_namespace |
26 | .pull-right | 22 | .pull-right |
27 | - %pre.dark.tiny git clone #{project.http_url_to_repo} | ||
28 | - %div.description | ||
29 | - = project.description | 23 | + %pre.public-clone git clone #{project.http_url_to_repo} |
24 | + | ||
25 | + - if project.description.present? | ||
26 | + %div.description | ||
27 | + = project.description | ||
30 | - unless @projects.present? | 28 | - unless @projects.present? |
31 | %h3.nothing_here_message No public projects | 29 | %h3.nothing_here_message No public projects |
32 | 30 |
@@ -0,0 +1,47 @@ | @@ -0,0 +1,47 @@ | ||
1 | +%h3.page-title | ||
2 | + = @project.name_with_namespace | ||
3 | + .pull-right | ||
4 | + %pre.public-clone git clone #{@project.http_url_to_repo} | ||
5 | + .pull-right | ||
6 | + - if current_user | ||
7 | + = link_to 'Browse project', @project, class: 'btn btn-create append-right-10' | ||
8 | + | ||
9 | + | ||
10 | +%div | ||
11 | + = link_to public_root_path do | ||
12 | + ← To projects list | ||
13 | + .pull-right | ||
14 | + %span.light= @project.description | ||
15 | + | ||
16 | +%br | ||
17 | +.row | ||
18 | + .span9 | ||
19 | + .light-well | ||
20 | + %h3.nothing_here_message Some awesome stuff here | ||
21 | + .span3 | ||
22 | + %h5 Repository: | ||
23 | + %div | ||
24 | + %p | ||
25 | + %span.light Bare size is | ||
26 | + #{@project.repository.size} MB | ||
27 | + | ||
28 | + %p | ||
29 | + = pluralize(@repository.round_commit_count, 'commit') | ||
30 | + %p | ||
31 | + = pluralize(@repository.branch_names.count, 'branch') | ||
32 | + %p | ||
33 | + = pluralize(@repository.tag_names.count, 'tag') | ||
34 | + | ||
35 | + - if @recent_tags.present? | ||
36 | + %hr | ||
37 | + %h5 Most Recent Tags: | ||
38 | + %ul.unstyled | ||
39 | + - @recent_tags.each do |tag| | ||
40 | + %li | ||
41 | + %p | ||
42 | + %i.icon-tag | ||
43 | + %strong= tag.name | ||
44 | + %small.light.pull-right | ||
45 | + %i.icon-calendar | ||
46 | + = time_ago_in_words(tag.commit.committed_date) | ||
47 | + ago |
config/routes.rb
@@ -55,6 +55,8 @@ Gitlab::Application.routes.draw do | @@ -55,6 +55,8 @@ Gitlab::Application.routes.draw do | ||
55 | # | 55 | # |
56 | namespace :public do | 56 | namespace :public do |
57 | resources :projects, only: [:index] | 57 | resources :projects, only: [:index] |
58 | + resources :projects, constraints: { id: /[a-zA-Z.\/0-9_\-]+/ }, only: [:show] | ||
59 | + | ||
58 | root to: "projects#index" | 60 | root to: "projects#index" |
59 | end | 61 | end |
60 | 62 |