Commit e33aab0b21e38f4cf7aed8bb6451d737fcefe110
Exists in
master
and in
4 other branches
Merge branch 'feature/project_tab'
Showing
16 changed files
with
172 additions
and
33 deletions
Show diff stats
app/assets/stylesheets/projects.css.scss
... | ... | @@ -561,6 +561,7 @@ h4.middle-panel { |
561 | 561 | display:none; |
562 | 562 | } |
563 | 563 | |
564 | + | |
564 | 565 | .merge-tabs { |
565 | 566 | margin: 0; |
566 | 567 | border: 1px solid #ccc; |
... | ... | @@ -572,11 +573,10 @@ h4.middle-panel { |
572 | 573 | |
573 | 574 | .tab { |
574 | 575 | font-weight: bold; |
575 | - text-transform: uppercase; | |
576 | 576 | border-right: 1px solid #ddd; |
577 | 577 | background:none; |
578 | 578 | padding: 10px; |
579 | - width:60px; | |
579 | + min-width:60px; | |
580 | 580 | float:left; |
581 | 581 | position:relative; |
582 | 582 | top:-5px; |
... | ... | @@ -598,6 +598,11 @@ h4.middle-panel { |
598 | 598 | } |
599 | 599 | } |
600 | 600 | } |
601 | +.activities-tab span { background: url("images.png") no-repeat -161px -1px; } | |
602 | +.stat-tab span, | |
603 | +.team-tab span, | |
604 | +.snippets-tab span { background: url("images.png") no-repeat -38px -77px; } | |
605 | +.files-tab span { background: url("images.png") no-repeat -112px -23px; } | |
601 | 606 | |
602 | 607 | .merge-notes-tab span { background: url("images.png") no-repeat -161px -1px; } |
603 | 608 | .merge-commits-tab span { background: url("images.png") no-repeat -86px 1px; } | ... | ... |
app/controllers/projects_controller.rb
... | ... | @@ -57,7 +57,7 @@ class ProjectsController < ApplicationController |
57 | 57 | def update |
58 | 58 | respond_to do |format| |
59 | 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 | 61 | format.js |
62 | 62 | else |
63 | 63 | format.html { render action: "edit" } |
... | ... | @@ -72,6 +72,13 @@ class ProjectsController < ApplicationController |
72 | 72 | @activities = @project.cached_updates(limit) |
73 | 73 | end |
74 | 74 | |
75 | + def files | |
76 | + @notes = @project.notes.where("attachment != 'NULL'").order("created_at DESC").limit(100) | |
77 | + end | |
78 | + | |
79 | + def info | |
80 | + end | |
81 | + | |
75 | 82 | # |
76 | 83 | # Wall |
77 | 84 | # | ... | ... |
app/helpers/projects_helper.rb
... | ... | @@ -16,12 +16,21 @@ module ProjectsHelper |
16 | 16 | nil |
17 | 17 | end |
18 | 18 | |
19 | - # expires in 360 days | |
20 | - def switch_colorscheme_link(opts) | |
21 | - if cookies[:colorschema].blank? | |
22 | - link_to_function "paint it black!", "$.cookie('colorschema','black', {expires:360}); window.location.reload()", opts | |
23 | - else | |
24 | - link_to_function "paint it white!", "$.cookie('colorschema','', {expires:360}); window.location.reload()", opts | |
19 | + def project_tab_class | |
20 | + [:show, :files, :team, :edit, :update, :info].each do |action| | |
21 | + return "current" if current_page?(:controller => "projects", :action => action, :id => @project) | |
22 | + end | |
23 | + | |
24 | + if controller.controller_name == "snippets" || | |
25 | + controller.controller_name == "team_members" | |
26 | + "current" | |
25 | 27 | end |
26 | 28 | end |
29 | + | |
30 | + def tree_tab_class | |
31 | + current_page?(:controller => "refs", | |
32 | + :action => "tree", | |
33 | + :project_id => @project, | |
34 | + :id => @ref || @project.root_ref ) ? "current" : nil | |
35 | + end | |
27 | 36 | end | ... | ... |
app/views/layouts/project.html.haml
... | ... | @@ -23,14 +23,10 @@ |
23 | 23 | .project-sidebar |
24 | 24 | .fixed |
25 | 25 | %aside |
26 | - = link_to "Activities", project_path(@project), :class => current_page?(:controller => "projects", :action => "show", :id => @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 | |
26 | + = link_to "Project", project_path(@project), :class => project_tab_class | |
27 | + = link_to "Tree", tree_project_ref_path(@project, @project.root_ref), :class => tree_tab_class | |
28 | 28 | = link_to "Commits", project_commits_path(@project), :class => current_page?(:controller => "commits", :action => "index", :project_id => @project) ? "current" : nil |
29 | 29 | = link_to "Network graph", graph_project_path(@project), :class => current_page?(:controller => "projects", :action => "graph", :id => @project) ? "current" : nil |
30 | - = link_to team_project_path(@project), :class => (current_page?(:controller => "projects", :action => "team", :id => @project) || controller.controller_name == "team_members") ? "current" : nil do | |
31 | - Team | |
32 | - - if @project.users_projects.count > 0 | |
33 | - %span{ :class => "number" }= @project.users_projects.count | |
34 | 30 | = link_to project_issues_filter_path(@project), :class => (controller.controller_name == "issues") ? "current" : nil do |
35 | 31 | Issues |
36 | 32 | - if @project.issues.open_for(current_user).count > 0 |
... | ... | @@ -43,13 +39,7 @@ |
43 | 39 | Merge Requests |
44 | 40 | - if @project.merge_requests.opened.count > 0 |
45 | 41 | %span{ :class => "number" }= @project.merge_requests.opened.count |
46 | - = link_to project_snippets_path(@project), :class => (controller.controller_name == "snippets") ? "current" : nil do | |
47 | - Snippets | |
48 | - - if @project.snippets.non_expired.count > 0 | |
49 | - %span{ :class => "number" }= @project.snippets.non_expired.count | |
50 | 42 | |
51 | - - if can? current_user, :admin_project, @project | |
52 | - = link_to "Admin", edit_project_path(@project), :class => (current_page?(edit_project_path(@project))) ? "current" : nil | |
53 | 43 | |
54 | 44 | .medium-tags{:style => 'padding: 10px 0 0 10px; width: 210px;'}= tag_list @project |
55 | 45 | ... | ... |
... | ... | @@ -0,0 +1,18 @@ |
1 | +.merge-tabs | |
2 | + = link_to project_path(@project), :class => "activities-tab tab #{'active' if current_page?(project_path(@project)) }" do | |
3 | + %span | |
4 | + Activities | |
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 | |
6 | + %span | |
7 | + Info | |
8 | + = link_to team_project_path(@project), :class => "team-tab tab #{'active' if current_page?(team_project_path(@project)) }" do | |
9 | + %span | |
10 | + Team | |
11 | + = link_to files_project_path(@project), :class => "files-tab tab #{'active' if current_page?(files_project_path(@project)) }" do | |
12 | + %span | |
13 | + Files | |
14 | + = link_to project_snippets_path(@project), :class => "snippets-tab tab #{'active' if current_page?(project_snippets_path(@project)) }" do | |
15 | + %span | |
16 | + Snippets | |
17 | + | |
18 | + | ... | ... |
app/views/projects/_team.html.haml
1 | -%h2.icon | |
2 | - %span> | |
3 | - Team | |
4 | 1 | - if can? current_user, :admin_team_member, @project |
5 | 2 | %div#new-member-holder |
6 | 3 | .right= link_to "Add new", new_project_team_member_path(@project), :remote => true, :class => "grey-button" |
4 | + .clear | |
7 | 5 | %br |
8 | 6 | %table.round-borders#team-table |
9 | 7 | %thead | ... | ... |
app/views/projects/edit.html.erb
... | ... | @@ -1 +0,0 @@ |
1 | -<%= render 'form' %> |
... | ... | @@ -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 | + | |
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 & 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 | + $('#project_default_branch').chosen(); | |
68 | + }) | |
69 | + | ... | ... |
... | ... | @@ -0,0 +1,17 @@ |
1 | += render "project_head" | |
2 | +- unless @notes.empty? | |
3 | + %div.update-data.ui-box.ui-box-small | |
4 | + .data | |
5 | + - @notes.each do |note| | |
6 | + %a.update-item{:href => note.attachment.url} | |
7 | + = image_tag gravatar_icon(note.author_email), :class => "left", :width => 16 | |
8 | + %span.update-title{:style => "margin-bottom:0px;"} | |
9 | + = note.attachment_identifier | |
10 | + %span.update-author.right | |
11 | + Added | |
12 | + = time_ago_in_words(note.created_at) | |
13 | + ago | |
14 | +- else | |
15 | + %h3 All files attached to project wall, issues etc will be displayed here | |
16 | + | |
17 | + | ... | ... |
... | ... | @@ -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 | 1 | - content_for(:body_class, "project-page dashboard") |
2 | 2 | |
3 | += render "project_head" | |
3 | 4 | #news-feed.news-feed |
4 | - %h2.icon | |
5 | - %span> | |
6 | - Activities | |
7 | 5 | .project-box.project-updates.ui-box.ui-box-small.ui-box-big |
8 | 6 | - @activities.each do |update| |
9 | 7 | = render "projects/feed", :update => update, :project => @project | ... | ... |
app/views/projects/team.html.haml
app/views/projects/update.js.haml
1 | 1 | - if @project.valid? |
2 | 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 | 4 | - else |
5 | 5 | :plain |
6 | 6 | $(".edit_project").replaceWith("#{escape_javascript(render('form'))}"); | ... | ... |
app/views/snippets/index.html.haml
config/routes.rb
spec/requests/projects_spec.rb