Commit 4d89322d6785580e9a77e2536b8f2a7db8482664

Authored by Dmitriy Zaporozhets
1 parent 3d77183c

Snippets - fixed after bootstrap

Project - restyled show page, removed info page
Repository - restyled show page, added download option
Tags - added download options
app/assets/javascripts/pager.js 0 → 100644
@@ -0,0 +1,44 @@ @@ -0,0 +1,44 @@
  1 +var Pager = {
  2 + ref:null,
  3 + limit:0,
  4 + offset:0,
  5 +
  6 + init:
  7 + function(ref, limit) {
  8 + this.ref=ref;
  9 + this.limit=limit;
  10 + this.offset=limit;
  11 + this.initLoadMore();
  12 + $('.loading').show();
  13 + },
  14 +
  15 + getOld:
  16 + function() {
  17 + $('.loading').show();
  18 + $.ajax({
  19 + type: "GET",
  20 + url: location.href,
  21 + data: "limit=" + this.limit + "&offset=" + this.offset,
  22 + complete: function(){ $('.loading').hide()},
  23 + dataType: "script"});
  24 + },
  25 +
  26 + append:
  27 + function(count, html) {
  28 + $(".content_list").append(html);
  29 + if(count > 0) {
  30 + this.offset += count;
  31 + this.initLoadMore();
  32 + }
  33 + },
  34 +
  35 + initLoadMore:
  36 + function() {
  37 + $(window).bind('scroll', function(){
  38 + if($(window).scrollTop() == $(document).height() - $(window).height()){
  39 + $(window).unbind('scroll');
  40 + Pager.getOld();
  41 + }
  42 + });
  43 + }
  44 +}
app/assets/stylesheets/common.scss
@@ -97,7 +97,7 @@ $blue_link: "#2fa0bb"; @@ -97,7 +97,7 @@ $blue_link: "#2fa0bb";
97 min-width:$min_app_width; 97 min-width:$min_app_width;
98 max-width:$max_app_width; 98 max-width:$max_app_width;
99 margin:auto; 99 margin:auto;
100 - margin-top:51px; 100 + margin-top:52px;
101 } 101 }
102 102
103 .container-fluid > .sidebar { 103 .container-fluid > .sidebar {
@@ -113,7 +113,7 @@ $blue_link: "#2fa0bb"; @@ -113,7 +113,7 @@ $blue_link: "#2fa0bb";
113 aside a { 113 aside a {
114 display:block; 114 display:block;
115 position:relative; 115 position:relative;
116 - padding:15px 10px; 116 + padding:12px 10px;
117 margin:10px 0 0 0; 117 margin:10px 0 0 0;
118 font-size:13px; 118 font-size:13px;
119 font-weight:bold; 119 font-weight:bold;
@@ -169,6 +169,7 @@ img.lil_av { @@ -169,6 +169,7 @@ img.lil_av {
169 p { padding-top:5px;} 169 p { padding-top:5px;}
170 } 170 }
171 171
  172 +.visible_link,
172 .author_link { 173 .author_link {
173 color: $active_link_color; 174 color: $active_link_color;
174 } 175 }
app/assets/stylesheets/highlight.css.scss
@@ -17,6 +17,7 @@ td.code, @@ -17,6 +17,7 @@ td.code,
17 td.linenos{ 17 td.linenos{
18 padding:0; 18 padding:0;
19 margin:0; 19 margin:0;
  20 + border-top:0;
20 vertical-align:top; 21 vertical-align:top;
21 } 22 }
22 23
app/assets/stylesheets/projects.css.scss
@@ -191,3 +191,13 @@ a.project-update.titled { @@ -191,3 +191,13 @@ a.project-update.titled {
191 } 191 }
192 } 192 }
193 193
  194 +
  195 +input.git_clone_url {
  196 + width:475px;
  197 +}
  198 +
  199 +.team_member_row {
  200 + img {
  201 + width:60px;
  202 + }
  203 +}
app/assets/stylesheets/top_panel.scss
@@ -3,7 +3,7 @@ body header { @@ -3,7 +3,7 @@ body header {
3 width:100%; 3 width:100%;
4 padding:0; 4 padding:0;
5 margin:0; 5 margin:0;
6 - top:0; 6 + top:1px;
7 left:0; 7 left:0;
8 background: #F1F1F1; /* for non-css3 browsers */ 8 background: #F1F1F1; /* for non-css3 browsers */
9 border-bottom: 1px solid #ccc; 9 border-bottom: 1px solid #ccc;
@@ -23,12 +23,13 @@ body header { @@ -23,12 +23,13 @@ body header {
23 23
24 .project_name { 24 .project_name {
25 float:left; 25 float:left;
26 - width:235px; 26 + width:400px;
27 margin-right:30px; 27 margin-right:30px;
28 font-size:16px; 28 font-size:16px;
29 font-weight:bold; 29 font-weight:bold;
30 padding:8px; 30 padding:8px;
31 color:#333; 31 color:#333;
  32 + text-shadow: 0 1px 1px #FFF;
32 } 33 }
33 34
34 .git_url_wrapper { 35 .git_url_wrapper {
app/controllers/projects_controller.rb
@@ -57,7 +57,7 @@ class ProjectsController < ApplicationController @@ -57,7 +57,7 @@ class ProjectsController < ApplicationController
57 def update 57 def update
58 respond_to do |format| 58 respond_to do |format|
59 if project.update_attributes(params[:project]) 59 if project.update_attributes(params[:project])
60 - format.html { redirect_to info_project_path(project), :notice => 'Project was successfully updated.' } 60 + format.html { redirect_to edit_project_path(project), :notice => 'Project was successfully updated.' }
61 format.js 61 format.js
62 else 62 else
63 format.html { render action: "edit" } 63 format.html { render action: "edit" }
@@ -69,17 +69,13 @@ class ProjectsController < ApplicationController @@ -69,17 +69,13 @@ class ProjectsController < ApplicationController
69 def show 69 def show
70 return render "projects/empty" unless @project.repo_exists? && @project.has_commits? 70 return render "projects/empty" unless @project.repo_exists? && @project.has_commits?
71 limit = (params[:limit] || 10).to_i 71 limit = (params[:limit] || 10).to_i
72 -  
73 - @activities = @project.activities(limit)#updates_wo_repo(limit) 72 + @activities = @project.activities(limit)
74 end 73 end
75 74
76 def files 75 def files
77 @notes = @project.notes.where("attachment != 'NULL'").order("created_at DESC").limit(100) 76 @notes = @project.notes.where("attachment != 'NULL'").order("created_at DESC").limit(100)
78 end 77 end
79 78
80 - def info  
81 - end  
82 -  
83 # 79 #
84 # Wall 80 # Wall
85 # 81 #
app/controllers/repositories_controller.rb
@@ -19,4 +19,28 @@ class RepositoriesController < ApplicationController @@ -19,4 +19,28 @@ class RepositoriesController < ApplicationController
19 def tags 19 def tags
20 @tags = @project.repo.tags.sort_by(&:name).reverse 20 @tags = @project.repo.tags.sort_by(&:name).reverse
21 end 21 end
  22 +
  23 + def archive
  24 + unless can?(current_user, :download_code, @project)
  25 + render_404 and return
  26 + end
  27 +
  28 + ref = params[:ref] || @project.root_ref
  29 + commit = @project.commit(ref)
  30 + render_404 and return unless commit
  31 +
  32 + # Build file path
  33 + file_name = @project.code + "-" + commit.id.to_s + ".tar.gz"
  34 + storage_path = File.join(Rails.root, "tmp", "repositories", @project.code)
  35 + file_path = File.join(storage_path, file_name)
  36 +
  37 + # Create file if not exists
  38 + unless File.exists?(file_path)
  39 + FileUtils.mkdir_p storage_path
  40 + file = @project.repo.archive_to_file(ref, nil, file_path)
  41 + end
  42 +
  43 + # Send file to user
  44 + send_file file_path
  45 + end
22 end 46 end
app/controllers/snippets_controller.rb
@@ -59,6 +59,7 @@ class SnippetsController < ApplicationController @@ -59,6 +59,7 @@ class SnippetsController < ApplicationController
59 @snippet = @project.snippets.find(params[:id]) 59 @snippet = @project.snippets.find(params[:id])
60 @notes = @snippet.notes 60 @notes = @snippet.notes
61 @note = @project.notes.new(:noteable => @snippet) 61 @note = @project.notes.new(:noteable => @snippet)
  62 + render_full_content
62 end 63 end
63 64
64 def destroy 65 def destroy
app/helpers/projects_helper.rb
@@ -17,7 +17,7 @@ module ProjectsHelper @@ -17,7 +17,7 @@ module ProjectsHelper
17 end 17 end
18 18
19 def project_tab_class 19 def project_tab_class
20 - [:show, :files, :team, :edit, :update, :info].each do |action| 20 + [:show, :files, :team, :edit, :update].each do |action|
21 return "current" if current_page?(:controller => "projects", :action => action, :id => @project) 21 return "current" if current_page?(:controller => "projects", :action => action, :id => @project)
22 end 22 end
23 23
app/models/ability.rb
@@ -40,6 +40,10 @@ class Ability @@ -40,6 +40,10 @@ class Ability
40 :admin_note 40 :admin_note
41 ] if project.allow_admin_for?(user) 41 ] if project.allow_admin_for?(user)
42 42
  43 + rules << [
  44 + :download_code,
  45 + ] if project.allow_pull_for?(user)
  46 +
43 rules.flatten 47 rules.flatten
44 end 48 end
45 49
app/models/project.rb
@@ -233,6 +233,10 @@ class Project &lt; ActiveRecord::Base @@ -233,6 +233,10 @@ class Project &lt; ActiveRecord::Base
233 !users_projects.where(:user_id => user.id, :project_access => [PROJECT_RWA]).empty? || owner_id == user.id 233 !users_projects.where(:user_id => user.id, :project_access => [PROJECT_RWA]).empty? || owner_id == user.id
234 end 234 end
235 235
  236 + def allow_pull_for?(user)
  237 + !users_projects.where(:user_id => user.id, :repo_access => [Repository::REPO_R, Repository::REPO_RW]).empty?
  238 + end
  239 +
236 def root_ref 240 def root_ref
237 default_branch || "master" 241 default_branch || "master"
238 end 242 end
app/views/commits/_commit.html.haml
1 %li.entry 1 %li.entry
2 = link_to project_commit_path(@project, :id => commit.id) do 2 = link_to project_commit_path(@project, :id => commit.id) do
3 %div 3 %div
4 - %strong  
5 - = truncate commit.id.to_s, :length => 10 4 + %code= commit.id.to_s[0..10]
6 &ndash; 5 &ndash;
7 = image_tag gravatar_icon(commit.author_email), :class => "", :width => 16 6 = image_tag gravatar_icon(commit.author_email), :class => "", :width => 16
8 = truncate(commit.safe_message, :length => 50) 7 = truncate(commit.safe_message, :length => 50)
app/views/commits/_index.html.haml
@@ -1,9 +0,0 @@ @@ -1,9 +0,0 @@
1 -= form_tag project_commits_path(@project), :method => :get do  
2 - %h3  
3 - = @project.name  
4 - [ #{select_tag "branch", options_for_select(@repo.heads.map(&:name), @branch), :onchange => "this.form.submit();", :class => "small"} ]  
5 -= link_to 'Back', project_path(@project), :class => "button"  
6 -%h1 Listing commits  
7 -%div{:id => dom_id(@project)}  
8 - = render "commits"  
9 -%br/  
app/views/commits/show.html.haml
1 .commit 1 .commit
2 - %span.commit-info  
3 - = link_to tree_project_ref_path(@project, @commit.id), :class => "btn right" do  
4 - Browse Code »  
5 - - if @commit.author_email  
6 - = image_tag gravatar_icon(@commit.author_email), :class => "left", :width => 40, :style => "padding-right:5px;"  
7 - - else  
8 - = image_tag "no_avatar.png", :class => "left", :width => 40, :style => "padding-right:5px;"  
9 - %span.commit-title  
10 - %strong  
11 - = truncate(@commit.id.to_s, :length => 60)  
12 - %span.commit-author  
13 - %strong= @commit.author_name  
14 - = @commit.created_at.stamp("Aug 21, 2011 9:23pm") 2 + = link_to tree_project_ref_path(@project, @commit.id), :class => "btn right small" do
  3 + Browse Code »
  4 + = image_tag gravatar_icon(@commit.author_email), :class => "avatar"
  5 + %code= @commit.id.to_s
  6 + %h5
  7 + = @commit.author_name
  8 + %small= @commit.created_at.stamp("Aug 21, 2011 9:23pm")
15 9
16 %hr 10 %hr
17 %pre.commit_message 11 %pre.commit_message
app/views/layouts/_head_panel.html.haml
@@ -8,9 +8,7 @@ @@ -8,9 +8,7 @@
8 8
9 - if project_layout 9 - if project_layout
10 .project_name 10 .project_name
11 - = truncate @project.name, :length => 28  
12 - .git_url_wrapper  
13 - %input.git-url.text{:id => "", :name => "", :readonly => "", :type => "text", :value => @project.url_to_repo, :class => "one_click_select"} 11 + = truncate @project.name, :length => 35
14 12
15 13
16 .account-box 14 .account-box
app/views/layouts/_project_side.html.haml
@@ -6,8 +6,12 @@ @@ -6,8 +6,12 @@
6 6
7 - if @project.repo_exists? 7 - if @project.repo_exists?
8 = link_to "Repository", project_repository_path(@project), :class => repository_tab_class 8 = link_to "Repository", project_repository_path(@project), :class => repository_tab_class
9 - = link_to "Code", tree_project_ref_path(@project, @project.root_ref), :class => tree_tab_class  
10 - = link_to "Commits", project_commits_path(@project), :class => (controller.controller_name == "commits") ? "current" : nil 9 + %ul
  10 + %li
  11 + = link_to "Code", tree_project_ref_path(@project, @project.root_ref), :class => tree_tab_class
  12 + %li
  13 + = link_to "Commits", project_commits_path(@project), :class => (controller.controller_name == "commits") ? "current" : nil
  14 +
11 = link_to "Network", graph_project_path(@project), :class => current_page?(:controller => "projects", :action => "graph", :id => @project) ? "current" : nil 15 = link_to "Network", graph_project_path(@project), :class => current_page?(:controller => "projects", :action => "graph", :id => @project) ? "current" : nil
12 - if @project.issues_enabled 16 - if @project.issues_enabled
13 = link_to project_issues_filter_path(@project), :class => (controller.controller_name == "issues") ? "current" : nil do 17 = link_to project_issues_filter_path(@project), :class => (controller.controller_name == "issues") ? "current" : nil do
app/views/projects/_feed.html.haml
1 -%li.wll  
2 - .row  
3 - .span9  
4 - = image_tag gravatar_icon(update.author_email), :class => "avatar thumb"  
5 - %p  
6 - %strong.author= update.author_name  
7 - %span 1 +- @activities.each do |update|
  2 + .entry
  3 + = link_to dashboard_feed_path(@project, update) do
  4 + - if update.kind_of? Note
  5 + %p
  6 + %strong
  7 + - if update.target
  8 + = update.target.class.name.titleize
  9 + = truncate update.target.id.to_s, :length => 10
  10 + commented
  11 + - else
  12 + Project wall
8 &ndash; 13 &ndash;
9 - authored  
10 - = time_ago_in_words(update.created_at)  
11 - ago  
12 - - if update.kind_of? MergeRequest  
13 - = link_to project_merge_request_path(@project, update) do  
14 - = "Opened merge request ##{update.id}."  
15 - %span.label= update.source_branch  
16 - &rarr;  
17 - %span.label= update.target_branch  
18 - - elsif update.kind_of? Issue  
19 - = link_to project_issue_path(@project, update) do  
20 - Opened new  
21 - %span.label.important= "issue ##{update.id}"  
22 - = truncate update.title 14 + = image_tag gravatar_icon(update.author_email), :class => "", :width => 16
  15 + = truncate dashboard_feed_title(update), :length => 50
23 - else 16 - else
24 - = link_to [@project, update.target] do  
25 - %p  
26 - = update.target.class.name.titleize  
27 - = truncate(update.target.id.to_s, :length => 10)  
28 - &nbsp;  
29 - = dashboard_feed_title(update) 17 + %p
  18 + %strong
  19 + = update.class.name.titleize
  20 + = truncate update.id.to_s
  21 + &ndash;
  22 + = image_tag gravatar_icon(update.author_email), :class => "", :width => 16
  23 + = truncate dashboard_feed_title(update), :length => 50
app/views/projects/_form.html.haml
@@ -10,13 +10,17 @@ @@ -10,13 +10,17 @@
10 .clearfix 10 .clearfix
11 = f.label :path do 11 = f.label :path do
12 Path 12 Path
13 - %cite= "git@#{GIT_HOST["host"]}:"  
14 - .input= f.text_field :path, :placeholder => "example_project", :disabled => !@project.new_record? 13 + .input
  14 + .input-prepend
  15 + %span.add-on= "git@#{GIT_HOST["host"]}:"
  16 + = f.text_field :path, :placeholder => "example_project", :disabled => !@project.new_record?
15 .clearfix 17 .clearfix
16 = f.label :code do 18 = f.label :code do
17 Code 19 Code
18 - %cite= "http://#{GIT_HOST["host"]}/"  
19 - .input= f.text_field :code, :placeholder => "example" 20 + .input
  21 + .input-prepend
  22 + %span.add-on= "http://#{GIT_HOST["host"]}/"
  23 + = f.text_field :code, :placeholder => "example"
20 24
21 - unless @project.new_record? || @project.heads.empty? 25 - unless @project.new_record? || @project.heads.empty?
22 .clearfix 26 .clearfix
app/views/projects/_project_head.html.haml
1 %ul.tabs 1 %ul.tabs
2 %li{ :class => "#{'active' if current_page?(project_path(@project)) }" } 2 %li{ :class => "#{'active' if current_page?(project_path(@project)) }" }
3 = link_to project_path(@project), :class => "activities-tab tab" do 3 = link_to project_path(@project), :class => "activities-tab tab" do
4 - Activities  
5 - %li{ :class => "#{'active' if current_page?(info_project_path(@project)) || current_page?(edit_project_path(@project)) }" }  
6 - = link_to info_project_path(@project), :class => "stat-tab tab " do  
7 - Info 4 + Show
  5 + - if can? current_user, :admin_project, @project
  6 + %li{ :class => "#{'active' if current_page?(edit_project_path(@project)) }" }
  7 + = link_to edit_project_path(@project), :class => "stat-tab tab " do
  8 + Edit
8 9
9 - %li{ :class => " #{'active' if current_page?(team_project_path(@project)) }" } 10 + %li{ :class => " #{'active' if (controller.controller_name == "team_members") || current_page?(team_project_path(@project)) }" }
10 = link_to team_project_path(@project), :class => "team-tab tab" do 11 = link_to team_project_path(@project), :class => "team-tab tab" do
11 Team 12 Team
12 %li{ :class => "#{'active' if current_page?(files_project_path(@project)) }" } 13 %li{ :class => "#{'active' if current_page?(files_project_path(@project)) }" }
13 = link_to files_project_path(@project), :class => "files-tab tab " do 14 = link_to files_project_path(@project), :class => "files-tab tab " do
14 Files 15 Files
15 - %li{ :class => " #{'active' if current_page?(project_snippets_path(@project)) }" } 16 + %li{ :class => " #{'active' if (controller.controller_name == "snippets") }" }
16 = link_to project_snippets_path(@project), :class => "snippets-tab tab" do 17 = link_to project_snippets_path(@project), :class => "snippets-tab tab" do
17 Snippets 18 Snippets
18 -  
19 - - if current_page?(project_snippets_path(@project))  
20 - - if can? current_user, :write_snippet, @project  
21 - %li  
22 - = link_to new_project_snippet_path(@project), :class => "add_new", :title => "New Snippet" do  
23 - Add new  
24 -  
25 -  
26 - - if current_page?(team_project_path(@project))  
27 - - if can? current_user, :admin_team_member, @project  
28 - %li  
29 - = link_to new_project_team_member_path(@project), :class => "add_new", :title => "New Team Member" do  
30 - Add New  
app/views/projects/info.html.haml
@@ -1,96 +0,0 @@ @@ -1,96 +0,0 @@
1 -= render "project_head"  
2 -  
3 -.entry  
4 - %h3= @project.name  
5 - %br  
6 -  
7 -  
8 -  
9 - %pre  
10 - = "git clone #{@project.url_to_repo}"  
11 -  
12 -  
13 -  
14 -%h4 Details:  
15 -  
16 -%table  
17 - %tr  
18 - %td Name  
19 - %td= @project.name  
20 -  
21 - %tr  
22 - %td Slug  
23 - %td= @project.code  
24 -  
25 - %tr  
26 - %td Path  
27 - %td= @project.path  
28 -  
29 - %tr  
30 - %td Owner  
31 - %td= link_to @project.owner.name, project_team_member_path(@project, @project.team_member_by_id(@project.owner))  
32 -  
33 - %tr  
34 - %td Last commit  
35 - %td  
36 - = time_ago_in_words(@project.commit.committed_date)  
37 - ago  
38 -  
39 - %tr  
40 - %td Team  
41 - %td  
42 - = @project.users_projects.count  
43 - users  
44 -  
45 - %tr  
46 - %td Open Issues  
47 - %td  
48 - = @project.issues.opened.count  
49 -  
50 - %tr  
51 - %td Merge Requests  
52 - %td  
53 - = @project.merge_requests.opened.count  
54 -  
55 - %tr  
56 - %td Created  
57 - %td= @project.created_at.stamp("Aug 21, 2011")  
58 -  
59 - %tr  
60 - %td{:colspan => 2}= simple_format @project.description  
61 -  
62 -  
63 -%h4 Features:  
64 -  
65 -%table  
66 - %tr  
67 - %td Issues  
68 - %td  
69 - - if @project.issues_enabled  
70 - .alert-message.success  
71 - Enabled  
72 - - else  
73 - .alert-message.error  
74 - Disabled  
75 -  
76 - %tr  
77 - %td Merge Requests  
78 - %td  
79 - - if @project.merge_requests_enabled  
80 - .alert-message.success  
81 - Enabled  
82 - - else  
83 - .alert-message.error  
84 - Disabled  
85 - %tr  
86 - %td Wall  
87 - %td  
88 - - if @project.wall_enabled  
89 - .alert-message.success  
90 - Enabled  
91 - - else  
92 - .alert-message.error  
93 - Disabled  
94 -.actions  
95 - = link_to "Edit", edit_project_path(@project), :class => "btn"  
96 -  
app/views/projects/show.html.haml
1 = render "project_head" 1 = render "project_head"
2 -- @activities.each do |update|  
3 - .entry  
4 - = link_to dashboard_feed_path(@project, update) do  
5 - - if update.kind_of? Note  
6 - %p  
7 - %strong  
8 - - if update.target  
9 - = update.target.class.name.titleize  
10 - = truncate update.target.id.to_s, :length => 10  
11 - commented  
12 - - else  
13 - Project wall  
14 - &ndash;  
15 - = image_tag gravatar_icon(update.author_email), :class => "", :width => 16  
16 - = truncate dashboard_feed_title(update), :length => 50  
17 - - else  
18 - %p  
19 - %strong  
20 - = update.class.name.titleize  
21 - = truncate update.id.to_s  
22 - &ndash;  
23 - = image_tag gravatar_icon(update.author_email), :class => "", :width => 16  
24 - = truncate dashboard_feed_title(update), :length => 50 2 +%h3
  3 + = @project.name
  4 +%hr
  5 +.alert-message.block-message.warning
  6 + .input
  7 + .input-prepend
  8 + %span.add-on git clone
  9 + = text_field_tag :project_clone, @project.url_to_repo, :class => "xlarge one_click_select git_clone_url"
  10 +
  11 += simple_format @project.description
  12 +
  13 +%h5.cgray Recent Activity
  14 +.content_list= render "feed"
  15 +
  16 +
app/views/projects/team.html.haml
1 = render "project_head" 1 = render "project_head"
  2 +
  3 +- if can? current_user, :admin_team_member, @project
  4 + .alert-message.block-message
  5 + = link_to new_project_team_member_path(@project), :class => "btn small right", :title => "New Team Member" do
  6 + New Team Member
  7 + Manage project team from this page.
  8 + %br
  9 + To open team member profile - click on avatar.
  10 +
2 = render :partial => "team", :locals => {:project => @project} 11 = render :partial => "team", :locals => {:project => @project}
3 12
app/views/projects/update.js.haml
1 - if @project.valid? 1 - if @project.valid?
2 :plain 2 :plain
3 - location.href = "#{info_project_path(@project, :notice => 'Project was successfully updated.')}"; 3 + location.href = "#{edit_project_path(@project, :notice => 'Project was successfully updated.')}";
4 - else 4 - else
5 :plain 5 :plain
6 $(".edit_project").replaceWith("#{escape_javascript(render('form'))}"); 6 $(".edit_project").replaceWith("#{escape_javascript(render('form'))}");
app/views/repositories/_feed.html.haml
@@ -4,10 +4,10 @@ @@ -4,10 +4,10 @@
4 %p 4 %p
5 %strong 5 %strong
6 = commit.head.name 6 = commit.head.name
7 - &ndash;  
8 - = truncate(commit.id.to_s, :length => 10) 7 + %br
  8 + %code= commit.id.to_s[0..10]
9 = image_tag gravatar_icon(commit.author_email), :class => "", :width => 16 9 = image_tag gravatar_icon(commit.author_email), :class => "", :width => 16
10 = truncate(commit.safe_message, :length => 40) 10 = truncate(commit.safe_message, :length => 40)
11 - %span.right 11 + %span.right.cgray
12 = time_ago_in_words(commit.committed_date) 12 = time_ago_in_words(commit.committed_date)
13 ago 13 ago
app/views/repositories/show.html.haml
1 = render "head" 1 = render "head"
  2 +%h3
  3 + = @project.name
  4 + - if can? current_user, :download_code, @project
  5 + = link_to "Download", archive_project_repository_path(@project), :class => "btn small right"
  6 +
  7 +
  8 +%hr
  9 +.alert-message.block-message.warning
  10 + .input
  11 + .input-prepend
  12 + %span.add-on git clone
  13 + = text_field_tag :project_clone, @project.url_to_repo, :class => "xlarge one_click_select git_clone_url"
  14 +
  15 +
  16 +%p
  17 + Last commit was
  18 + %small
  19 + %code= @activities.first.commit.id.to_s[0..10]
  20 +
  21 + = time_ago_in_words(@activities.first.commit.committed_date)
  22 + ago to
  23 + = link_to project_commits_path(@project, :ref => @activities.first.head.name), :class => "visible_link" do
  24 + = @activities.first.head.name
  25 +
  26 +%h4.cgray
  27 + Recent Branches
  28 +
2 %ul.unstyled 29 %ul.unstyled
3 - @activities.each do |update| 30 - @activities.each do |update|
4 = render "repositories/feed", :update => update, :project => @project 31 = render "repositories/feed", :update => update, :project => @project
app/views/repositories/tags.html.haml
1 = render "head" 1 = render "head"
2 - unless @tags.empty? 2 - unless @tags.empty?
3 - %div.update-data.ui-box.ui-box-small  
4 - .data  
5 - - @tags.each do |tag|  
6 - %a.update-item{:href => project_commits_path(@project, :ref => tag.name)}  
7 - %span.update-title{:style => "margin-bottom:0px;"}  
8 - = tag.name  
9 - %span.update-author.right  
10 - = time_ago_in_words(tag.commit.committed_date)  
11 - ago 3 + - @tags.each do |tag|
  4 + .row
  5 + .span7
  6 + .entry
  7 + = tag.name
  8 + %code= tag.commit.id.to_s[0..10]
  9 + %span.update-author.right
  10 + = time_ago_in_words(tag.commit.committed_date)
  11 + ago
  12 + .span3
  13 + - if can? current_user, :download_code, @project
  14 + = link_to "Download", archive_project_repository_path(@project, :ref => tag.name), :class => "btn small"
  15 + = link_to "Commits", project_commits_path(@project, :ref => tag.name), :class => "btn small"
12 - else 16 - else
13 %h3 No tags 17 %h3 No tags
app/views/snippets/_form.html.haml
  1 +%h3= @snippet.new_record? ? "New Snippet" : "Edit Snippet ##{@snippet.id}"
  2 +%hr
1 = form_for [@project, @snippet] do |f| 3 = form_for [@project, @snippet] do |f|
2 - %div  
3 - %span.entity-info  
4 - - if @snippet.new_record?  
5 - = link_to project_snippets_path(@project) do  
6 - .entity-button  
7 - Snippets  
8 - %i  
9 - - else  
10 - = link_to project_snippet_path(@project, @snippet) do  
11 - .entity-button  
12 - Show Snippet  
13 - %i  
14 - %h2= @snippet.new_record? ? "New Snippet" : "Edit Snippet ##{@snippet.id}"  
15 -  
16 - %hr  
17 %table.no-borders 4 %table.no-borders
18 -if @snippet.errors.any? 5 -if @snippet.errors.any?
19 - %tr  
20 - %td{:colspan => 2}  
21 - #error_explanation  
22 - - @snippet.errors.full_messages.each do |msg|  
23 - %span= msg  
24 - %br 6 + .alert-message.block-message.error
  7 + %ul
  8 + - @snippet.errors.full_messages.each do |msg|
  9 + %li= msg
25 10
26 - %tr  
27 - %td= f.label :title  
28 - %td= f.text_field :title, :placeholder => "Example Snippet"  
29 - %tr  
30 - %td= f.label :file_name  
31 - %td= f.text_field :file_name, :placeholder => "example.rb"  
32 - %tr  
33 - %td= f.label "Lifetime"  
34 - %td= f.select :expires_at, lifetime_select_options, {}, :style => "width:200px;"  
35 - %tr  
36 - %td{:colspan => 2}  
37 - = f.label :content, "Code"  
38 - %br  
39 - %br  
40 - = f.text_area :content 11 + .clearfix
  12 + = f.label :title
  13 + .input= f.text_field :title, :placeholder => "Example Snippet"
  14 + .clearfix
  15 + = f.label :file_name
  16 + .input= f.text_field :file_name, :placeholder => "example.rb"
  17 + .clearfix
  18 + = f.label "Lifetime"
  19 + .input= f.select :expires_at, lifetime_select_options, {}, :style => "width:200px;"
  20 + .clearfix
  21 + = f.label :content, "Code"
  22 + = f.text_area :content, :class => "xxlarge"
41 23
42 - .merge-tabs  
43 - = f.submit 'Save', :class => "positive-button" 24 + .actions
  25 + = f.submit 'Save', :class => "primary btn"
  26 + = link_to "Cancel", project_snippets_path(@project), :class => " btn"
44 - unless @snippet.new_record? 27 - unless @snippet.new_record?
45 - .right= link_to 'Destroy', [@project, @snippet], :confirm => 'Are you sure?', :method => :delete, :class => "red-button delete-snippet", :id => "destroy_snippet_#{@snippet.id}" 28 + .right= link_to 'Destroy', [@project, @snippet], :confirm => 'Are you sure?', :method => :delete, :class => "btn right danger delete-snippet", :id => "destroy_snippet_#{@snippet.id}"
46 29
47 30
48 31
app/views/snippets/_snippet.html.haml
1 -%a.update-item{:href => project_snippet_path(snippet.project, snippet)}  
2 - = image_tag gravatar_icon(snippet.author_email), :class => "left", :width => 40  
3 - %span.update-title  
4 - = truncate(snippet.title, :length => 60)  
5 - %span.update-author  
6 - %strong= snippet.author_name  
7 - authored  
8 - = time_ago_in_words(snippet.created_at)  
9 - ago  
10 - .right  
11 - %span.tag.commit= snippet.file_name  
12 - 1 +%li.entry
  2 + %a{:href => project_snippet_path(snippet.project, snippet)}
  3 + %p
  4 + %strong
  5 + = truncate(snippet.title, :length => 60)
  6 + %span.right.cgray
  7 + = snippet.file_name
app/views/snippets/edit.html.haml
  1 += render "projects/project_head"
1 = render "snippets/form" 2 = render "snippets/form"
app/views/snippets/index.html.haml
1 = render "projects/project_head" 1 = render "projects/project_head"
2 2
  3 +- if can? current_user, :write_snippet, @project
  4 + .alert-message.block-message
  5 + = link_to new_project_snippet_path(@project), :class => "btn small add_new right", :title => "New Snippet" do
  6 + Add new snippet
  7 + Share code pastes with others if it cant be in a git repository
  8 + %br
  9 + To add new snippet - click on button.
  10 +
3 - unless @snippets.fresh.empty? 11 - unless @snippets.fresh.empty?
4 - %div{ :class => "update-data ui-box ui-box-small ui-box-big" }  
5 - .data  
6 - = render @snippets.fresh  
7 -- else  
8 - .notice_holder  
9 - %li Snippets do not exist yet.  
10 - - if can? current_user, :write_snippet, @project  
11 - %li You can add a new one by clicking on "Add New" button  
12 - 12 + %ul.unstyled= render @snippets.fresh
app/views/snippets/new.html.haml
  1 += render "projects/project_head"
1 = render "snippets/form" 2 = render "snippets/form"
app/views/snippets/show.html.haml
1 -%div  
2 - %span.entity-info  
3 - - if can?(current_user, :admin_snippet, @project) || @snippet.author == current_user  
4 - = link_to edit_project_snippet_path(@project, @snippet) do  
5 - .entity-button  
6 - Edit Snippet  
7 - %i  
8 - - if @snippet.author_email  
9 - = image_tag gravatar_icon(@snippet.author_email), :class => "left", :width => 40, :style => "padding-right:5px;"  
10 - - else  
11 - = image_tag "no_avatar.png", :class => "left", :width => 40, :style => "padding-right:5px;"  
12 - %span.commit-title  
13 - %strong  
14 - = truncate(@snippet.title, :length => 60)  
15 - %span.commit-author  
16 - %strong= @snippet.author_name  
17 - = @snippet.created_at.stamp("Aug 21, 2011 9:23pm") 1 += render "projects/project_head"
  2 +
  3 +%h3
  4 + = @snippet.title
  5 + %small= @snippet.file_name
  6 + - if can?(current_user, :admin_snippet, @project) || @snippet.author == current_user
  7 + = link_to "Edit", edit_project_snippet_path(@project, @snippet), :class => "btn small right"
18 8
19 %hr 9 %hr
20 10
app/views/team_members/_form.html.haml
  1 +%h3= "New Team member"
  2 +%hr
1 = form_for @team_member, :as => :team_member, :url => project_team_members_path(@project, @team_member) do |f| 3 = form_for @team_member, :as => :team_member, :url => project_team_members_path(@project, @team_member) do |f|
2 - %div  
3 - %span.entity-info  
4 - - if request.xhr?  
5 - = link_to project_team_members_path(@project) do  
6 - .entity-button  
7 - Team List  
8 - %i  
9 - %h3= "New Team member"  
10 -  
11 - %hr  
12 -if @team_member.errors.any? 4 -if @team_member.errors.any?
13 - %ul.errors_holder  
14 - - @team_member.errors.full_messages.each do |msg|  
15 - %li= msg 5 + .alert-message.block-message.error
  6 + %ul
  7 + - @team_member.errors.full_messages.each do |msg|
  8 + %li= msg
  9 +
  10 + .clearfix
  11 + = f.label :user_id, "Name"
  12 + .input= f.select(:user_id, User.not_in_project(@project).all.collect {|p| [ p.name, p.id ] }, { :include_blank => "Select user" }, { :style => "width:300px" })
  13 +
  14 + .clearfix
  15 + = f.label :project_access, "Project Access"
  16 + .input= f.select :project_access, options_for_select(Project.access_options, @team_member.project_access), {}, :class => "project-access-select"
  17 +
  18 + .clearfix
  19 + = f.label :repo_access, "Repository Access"
  20 + .input= f.select :repo_access, options_for_select(Repository.access_options, @team_member.repo_access), {}, :class => "repo-access-select"
16 21
17 - .span-6.append-bottom  
18 - %b Name  
19 - .span-6  
20 - = f.select(:user_id, User.not_in_project(@project).all.collect {|p| [ p.name, p.id ] }, { :include_blank => "Select user" }, { :style => "width:300px" })  
21 - .span-6  
22 - %b Project Access:  
23 - .span-6  
24 - = f.select :project_access, options_for_select(Project.access_options, @team_member.project_access), {}, :class => "project-access-select" 22 + .actions
  23 + = f.submit 'Save', :class => "btn primary"
  24 + = link_to "Cancel", team_project_path(@project), :class => "btn"
25 25
26 - .span-6  
27 - %b Repository Access:  
28 - .span-6  
29 - = f.select :repo_access, options_for_select(Repository.access_options, @team_member.repo_access), {}, :class => "repo-access-select"  
30 - %br  
31 - .merge-tabs  
32 - = f.submit 'Save', :class => "grey-button" 26 +:css
  27 + form select {
  28 + width:300px;
  29 + }
33 30
  31 +:javascript
  32 + $('select#team_member_user_id').chosen();
  33 + $('select#team_member_repo_access').chosen();
  34 + $('select#team_member_project_access').chosen();
app/views/team_members/_show.html.haml
1 - user = member.user 1 - user = member.user
2 - allow_admin = can? current_user, :admin_project, @project 2 - allow_admin = can? current_user, :admin_project, @project
3 -%li{:id => dom_id(member)} 3 +%li{:id => dom_id(member), :class => "team_member_row"}
4 = link_to project_team_member_path(@project, member), :title => user.name do 4 = link_to project_team_member_path(@project, member), :title => user.name do
5 - = image_tag gravatar_icon(user.email, 90), :class => "thumbnail" 5 + = image_tag gravatar_icon(user.email, 60), :class => "thumbnail"
6 .row 6 .row
7 - .span6 7 + .span8
8 %h4 8 %h4
9 = truncate(user.name, :lenght => 24) 9 = truncate(user.name, :lenght => 24)
10 %small= truncate user.email, :lenght => 24 10 %small= truncate user.email, :lenght => 24
config/routes.rb
@@ -46,7 +46,6 @@ Gitlab::Application.routes.draw do @@ -46,7 +46,6 @@ Gitlab::Application.routes.draw do
46 get "team" 46 get "team"
47 get "wall" 47 get "wall"
48 get "graph" 48 get "graph"
49 - get "info"  
50 get "files" 49 get "files"
51 end 50 end
52 51
@@ -54,6 +53,7 @@ Gitlab::Application.routes.draw do @@ -54,6 +53,7 @@ Gitlab::Application.routes.draw do
54 member do 53 member do
55 get "branches" 54 get "branches"
56 get "tags" 55 get "tags"
  56 + get "archive"
57 end 57 end
58 end 58 end
59 59
spec/requests/projects_spec.rb
@@ -141,7 +141,7 @@ describe &quot;Projects&quot; do @@ -141,7 +141,7 @@ describe &quot;Projects&quot; do
141 end 141 end
142 142
143 it "should be correct path" do 143 it "should be correct path" do
144 - current_path.should == info_project_path(@project) 144 + current_path.should == edit_project_path(@project)
145 end 145 end
146 146
147 it "should show project" do 147 it "should show project" do
spec/requests/snippets_spec.rb
@@ -73,7 +73,7 @@ describe &quot;Snippets&quot; do @@ -73,7 +73,7 @@ describe &quot;Snippets&quot; do
73 :author => @user, 73 :author => @user,
74 :project => project 74 :project => project
75 visit project_snippet_path(project, @snippet) 75 visit project_snippet_path(project, @snippet)
76 - click_link "Edit Snippet" 76 + click_link "Edit"
77 end 77 end
78 78
79 it "should open edit page" do 79 it "should open edit page" do