Commit 0f627a65f43e1b6bfce059bf1750075fb589e583

Authored by Dmitriy Zaporozhets
1 parent c1c903fb

Project tab r1 is finished

app/assets/stylesheets/projects.css.scss
@@ -573,7 +573,6 @@ h4.middle-panel { @@ -573,7 +573,6 @@ h4.middle-panel {
573 573
574 .tab { 574 .tab {
575 font-weight: bold; 575 font-weight: bold;
576 - text-transform: uppercase;  
577 border-right: 1px solid #ddd; 576 border-right: 1px solid #ddd;
578 background:none; 577 background:none;
579 padding: 10px; 578 padding: 10px;
@@ -600,7 +599,9 @@ h4.middle-panel { @@ -600,7 +599,9 @@ h4.middle-panel {
600 } 599 }
601 } 600 }
602 .activities-tab span { background: url("images.png") no-repeat -161px -1px; } 601 .activities-tab span { background: url("images.png") no-repeat -161px -1px; }
603 -.stat-tab, .team-tab, .snippets-tab span { background: url("images.png") no-repeat -38px -77px; } 602 +.stat-tab span,
  603 +.team-tab span,
  604 +.snippets-tab span { background: url("images.png") no-repeat -38px -77px; }
604 .files-tab span { background: url("images.png") no-repeat -112px -23px; } 605 .files-tab span { background: url("images.png") no-repeat -112px -23px; }
605 606
606 .merge-notes-tab span { background: url("images.png") no-repeat -161px -1px; } 607 .merge-notes-tab span { background: url("images.png") no-repeat -161px -1px; }
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 project, :notice => 'Project was successfully updated.' } 60 + format.html { redirect_to info_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" }
@@ -67,16 +67,16 @@ class ProjectsController < ApplicationController @@ -67,16 +67,16 @@ class ProjectsController < ApplicationController
67 end 67 end
68 68
69 def show 69 def show
  70 + return render "projects/empty" unless @project.repo_exists? && @project.has_commits?
  71 + limit = (params[:limit] || 20).to_i
  72 + @activities = @project.cached_updates(limit)
70 end 73 end
71 74
72 def files 75 def files
73 @notes = @project.notes.where("attachment != 'NULL'").order("created_at DESC") 76 @notes = @project.notes.where("attachment != 'NULL'").order("created_at DESC")
74 end 77 end
75 78
76 - def activities  
77 - return render "projects/empty" unless @project.repo_exists? && @project.has_commits?  
78 - limit = (params[:limit] || 20).to_i  
79 - @activities = @project.cached_updates(limit) 79 + def info
80 end 80 end
81 81
82 # 82 #
app/views/dashboard/_sidebar.html.haml
@@ -6,7 +6,7 @@ @@ -6,7 +6,7 @@
6 %ol.project-list 6 %ol.project-list
7 - @projects.each do |project| 7 - @projects.each do |project|
8 %li 8 %li
9 - %a{:href => activities_project_path(project)} 9 + %a{:href => project_path(project)}
10 %span.arrow → 10 %span.arrow →
11 %span.project-name= project.name 11 %span.project-name= project.name
12 %span.time 12 %span.time
app/views/layouts/project.html.haml
@@ -23,7 +23,7 @@ @@ -23,7 +23,7 @@
23 .project-sidebar 23 .project-sidebar
24 .fixed 24 .fixed
25 %aside 25 %aside
26 - = link_to "Project", project_path(@project), :class => (current_page?(:controller => "projects", :action => "activities", :id => @project) || controller.controller_name == "snippets" || current_page?(:controller => "projects", :action => "team", :id => @project) || controller.controller_name == "team_members" || current_page?(project_path(@project))) ? "current" : nil 26 + = link_to "Project", project_path(@project), :class => (current_page?(:controller => "projects", :action => "show", :id => @project) || controller.controller_name == "snippets" || current_page?(:controller => "projects", :action => "team", :id => @project) || controller.controller_name == "team_members" || current_page?(project_path(@project))) ? "current" : nil
27 = link_to "Tree", tree_project_ref_path(@project, @project.root_ref), :class => current_page?(:controller => "refs", :action => "tree", :project_id => @project, :id => @ref || @project.root_ref ) ? "current" : nil 27 = link_to "Tree", tree_project_ref_path(@project, @project.root_ref), :class => current_page?(:controller => "refs", :action => "tree", :project_id => @project, :id => @ref || @project.root_ref ) ? "current" : nil
28 = link_to "Commits", project_commits_path(@project), :class => current_page?(:controller => "commits", :action => "index", :project_id => @project) ? "current" : nil 28 = link_to "Commits", project_commits_path(@project), :class => current_page?(:controller => "commits", :action => "index", :project_id => @project) ? "current" : nil
29 = link_to "Network graph", graph_project_path(@project), :class => current_page?(:controller => "projects", :action => "graph", :id => @project) ? "current" : nil 29 = link_to "Network graph", graph_project_path(@project), :class => current_page?(:controller => "projects", :action => "graph", :id => @project) ? "current" : nil
app/views/projects/_project_head.html.haml
1 -%div  
2 - -#- if can? current_user, :admin_project, @project  
3 - -#%span.entity-info  
4 - -#= link_to edit_project_path(@project) do  
5 - -#.entity-button  
6 - -#Edit Project  
7 - -#%i  
8 -  
9 - -#%h2= @project.name  
10 .merge-tabs 1 .merge-tabs
11 - = link_to activities_project_path(@project), :class => "activities-tab tab #{'active' if current_page?(activities_project_path(@project)) }" do 2 + = link_to project_path(@project), :class => "activities-tab tab #{'active' if current_page?(project_path(@project)) }" do
12 %span 3 %span
13 Activities 4 Activities
14 - = link_to project_path(@project), :class => "stat-tab tab" do 5 + = link_to info_project_path(@project), :class => "stat-tab tab #{'active' if current_page?(info_project_path(@project)) || current_page?(edit_project_path(@project)) }" do
15 %span 6 %span
16 Info 7 Info
17 - = link_to team_project_path(@project), :class => "team-tab tab" do 8 + = link_to team_project_path(@project), :class => "team-tab tab #{'active' if current_page?(team_project_path(@project)) }" do
18 %span 9 %span
19 Team 10 Team
20 - = link_to files_project_path(@project), :class => "files-tab tab" do 11 + = link_to files_project_path(@project), :class => "files-tab tab #{'active' if current_page?(files_project_path(@project)) }" do
21 %span 12 %span
22 Files 13 Files
23 - = link_to project_snippets_path(@project), :class => "snippets-tab tab" do 14 + = link_to project_snippets_path(@project), :class => "snippets-tab tab #{'active' if current_page?(project_snippets_path(@project)) }" do
24 %span 15 %span
25 Snippets 16 Snippets
26 17
app/views/projects/_team.html.haml
1 -%h2.icon  
2 - %span>  
3 - Team  
4 - if can? current_user, :admin_team_member, @project 1 - if can? current_user, :admin_team_member, @project
5 %div#new-member-holder 2 %div#new-member-holder
6 .right= link_to "Add new", new_project_team_member_path(@project), :remote => true, :class => "grey-button" 3 .right= link_to "Add new", new_project_team_member_path(@project), :remote => true, :class => "grey-button"
  4 + .clear
7 %br 5 %br
8 %table.round-borders#team-table 6 %table.round-borders#team-table
9 %thead 7 %thead
app/views/projects/_tile.html.haml
@@ -2,7 +2,7 @@ @@ -2,7 +2,7 @@
2 - projects.each_with_index do |project, i| 2 - projects.each_with_index do |project, i|
3 %div.grid_1.projects_selector 3 %div.grid_1.projects_selector
4 %div{ :class => "project-box ui-box ui-box-big" } 4 %div{ :class => "project-box ui-box ui-box-big" }
5 - = link_to activities_project_path(project) do 5 + = link_to project_path(project) do
6 %h3= truncate(project.name, :length => 20) 6 %h3= truncate(project.name, :length => 20)
7 .data 7 .data
8 %p.title.repository.git_url_wrapper 8 %p.title.repository.git_url_wrapper
app/views/projects/activities.html.haml
@@ -1,13 +0,0 @@ @@ -1,13 +0,0 @@
1 -- content_for(:body_class, "project-page dashboard")  
2 -  
3 -= render "project_head"  
4 -#news-feed.news-feed  
5 - .project-box.project-updates.ui-box.ui-box-small.ui-box-big  
6 - - @activities.each do |update|  
7 - = render "projects/feed", :update => update, :project => @project  
8 -  
9 -:javascript  
10 - function updateDashboard(){  
11 - $('.project-content').load("#{escape_javascript(project_path(@project))} .project-content>*");  
12 - }  
13 - setInterval("updateDashboard()", 300000);  
app/views/projects/edit.html.erb
@@ -1 +0,0 @@ @@ -1 +0,0 @@
1 -<%= render 'form' %>  
app/views/projects/edit.html.haml 0 → 100644
@@ -0,0 +1,69 @@ @@ -0,0 +1,69 @@
  1 += render "project_head"
  2 +
  3 += form_for(@project, :remote => true) do |f|
  4 + %div
  5 + %span.entity-info
  6 + = link_to info_project_path(@project) do
  7 + .entity-button
  8 + Info
  9 + %i
  10 + %h2= @project.name
  11 + %hr
  12 + %table.no-borders
  13 + -if @project.errors.any?
  14 + %tr
  15 + %td{:colspan => 2}
  16 + #error_explanation
  17 + - @project.errors.full_messages.each do |msg|
  18 + %span= msg
  19 + %br
  20 +
  21 + %tr
  22 + %td= f.label :name
  23 + %td= f.text_field :name, :placeholder => "Example Project"
  24 + %tr
  25 + %td
  26 + .left= f.label :path
  27 + %cite.right= "git@#{GIT_HOST["host"]}:"
  28 + %td
  29 + = f.text_field :path, :placeholder => "example_project", :disabled => !@project.new_record?
  30 + %tr
  31 + %td
  32 + .left= f.label :code
  33 + %cite.right= "http://#{GIT_HOST["host"]}/"
  34 + %td= f.text_field :code, :placeholder => "example"
  35 +
  36 + - unless @project.new_record? || @project.heads.empty?
  37 + %tr
  38 + %td= f.label :default_branch, "Default Branch"
  39 + %td= f.select(:default_branch, @project.heads.map(&:name), {}, :style => "width:300px;")
  40 +
  41 + %tr
  42 + %td= f.label :description
  43 + %td= f.text_area :description, :placeholder => "project description", :style => "height:50px"
  44 +
  45 + %br
  46 +
  47 + .merge-tabs
  48 + = f.submit 'Save', :class => "grey-button"
  49 + &nbsp;
  50 + - unless @project.new_record?
  51 + .right
  52 + = link_to 'Remove', @project, :confirm => 'Are you sure?', :method => :delete, :class => "red-button"
  53 +
  54 +%div{ :class => "ajax_loader", :style => "display:none;height:200px;"}
  55 + %center
  56 + = image_tag "ajax-loader.gif", :class => "append-bottom"
  57 + %h3.prepend-top Updating project &amp; repository. Please wait for few minutes
  58 +
  59 +:javascript
  60 + $('.edit_project').bind('ajax:before', function() {
  61 + $(".edit_project").hide();
  62 + $('.ajax_loader').show();
  63 + });
  64 +
  65 +:javascript
  66 + $(function(){
  67 + $('form #project_default_branch').chosen();
  68 + })
  69 +
app/views/projects/info.html.haml 0 → 100644
@@ -0,0 +1,28 @@ @@ -0,0 +1,28 @@
  1 += render "project_head"
  2 +
  3 +%div
  4 + %span.entity-info
  5 + = link_to edit_project_path(@project) do
  6 + .entity-button
  7 + Edit
  8 + %i
  9 + %h2= @project.name
  10 + %hr
  11 +
  12 +%table.no-borders
  13 + %tr
  14 + %td Name
  15 + %td= @project.name
  16 +
  17 + %tr
  18 + %td Slug
  19 + %td= @project.code
  20 +
  21 + %tr
  22 + %td Created
  23 + %td= @project.created_at.stamp("Aug 21, 2011")
  24 +
  25 + %tr
  26 + %td{:colspan => 2}= simple_format @project.description
  27 +
  28 +
app/views/projects/show.html.haml
1 -= render "project_head"  
2 -.stats  
3 - - unless @project.description.empty?  
4 - %h3= simple_format @project.description 1 +- content_for(:body_class, "project-page dashboard")
5 2
  3 += render "project_head"
  4 +#news-feed.news-feed
  5 + .project-box.project-updates.ui-box.ui-box-small.ui-box-big
  6 + - @activities.each do |update|
  7 + = render "projects/feed", :update => update, :project => @project
6 8
  9 +:javascript
  10 + function updateDashboard(){
  11 + $('.project-content').load("#{escape_javascript(project_path(@project))} .project-content>*");
  12 + }
  13 + setInterval("updateDashboard()", 300000);
app/views/projects/update.js.haml
1 - if @project.valid? 1 - if @project.valid?
2 :plain 2 :plain
3 - location.href = "#{project_path(@project, :notice => 'Project was successfully updated.')}"; 3 + location.href = "#{info_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/snippets/index.html.haml
1 = render "projects/project_head" 1 = render "projects/project_head"
2 -%h2.icon  
3 - %span>  
4 - Snippets  
5 - if can? current_user, :write_snippet, @project 2 - if can? current_user, :write_snippet, @project
6 .right= link_to 'New Snippet', new_project_snippet_path(@project), :class => "grey-button append-bottom-10" 3 .right= link_to 'New Snippet', new_project_snippet_path(@project), :class => "grey-button append-bottom-10"
7 4
config/routes.rb
@@ -42,9 +42,7 @@ Gitlab::Application.routes.draw do @@ -42,9 +42,7 @@ Gitlab::Application.routes.draw do
42 get "team" 42 get "team"
43 get "wall" 43 get "wall"
44 get "graph" 44 get "graph"
45 - get "activities"  
46 - get "branches"  
47 - get "tags" 45 + get "info"
48 get "files" 46 get "files"
49 end 47 end
50 48
spec/requests/projects_spec.rb
@@ -140,7 +140,7 @@ describe &quot;Projects&quot; do @@ -140,7 +140,7 @@ describe &quot;Projects&quot; do
140 end 140 end
141 141
142 it "should be correct path" do 142 it "should be correct path" do
143 - current_path.should == project_path(@project) 143 + current_path.should == info_project_path(@project)
144 end 144 end
145 145
146 it "should show project" do 146 it "should show project" do