Commit c1c903fb955cbee1afe3bd10944d6c218b576b15

Authored by Dmitriy Zaporozhets
1 parent 6e5caa19

Project tab added. activities, team, snippets moved to project tab

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;
... ... @@ -576,7 +577,7 @@ h4.middle-panel {
576 577 border-right: 1px solid #ddd;
577 578 background:none;
578 579 padding: 10px;
579   - width:60px;
  580 + min-width:60px;
580 581 float:left;
581 582 position:relative;
582 583 top:-5px;
... ... @@ -598,6 +599,9 @@ h4.middle-panel {
598 599 }
599 600 }
600 601 }
  602 +.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; }
  604 +.files-tab span { background: url("images.png") no-repeat -112px -23px; }
601 605  
602 606 .merge-notes-tab span { background: url("images.png") no-repeat -161px -1px; }
603 607 .merge-commits-tab span { background: url("images.png") no-repeat -86px 1px; }
... ...
app/controllers/projects_controller.rb
... ... @@ -67,6 +67,13 @@ class ProjectsController < ApplicationController
67 67 end
68 68  
69 69 def show
  70 + end
  71 +
  72 + def files
  73 + @notes = @project.notes.where("attachment != 'NULL'").order("created_at DESC")
  74 + end
  75 +
  76 + def activities
70 77 return render "projects/empty" unless @project.repo_exists? && @project.has_commits?
71 78 limit = (params[:limit] || 20).to_i
72 79 @activities = @project.cached_updates(limit)
... ...
app/views/dashboard/_sidebar.html.haml
... ... @@ -6,7 +6,7 @@
6 6 %ol.project-list
7 7 - @projects.each do |project|
8 8 %li
9   - %a{:href => project_path(project)}
  9 + %a{:href => activities_project_path(project)}
10 10 %span.arrow →
11 11 %span.project-name= project.name
12 12 %span.time
... ...
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
  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
27 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 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  
... ...
app/views/projects/_project_head.html.haml 0 → 100644
... ... @@ -0,0 +1,27 @@
  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
  11 + = link_to activities_project_path(@project), :class => "activities-tab tab #{'active' if current_page?(activities_project_path(@project)) }" do
  12 + %span
  13 + Activities
  14 + = link_to project_path(@project), :class => "stat-tab tab" do
  15 + %span
  16 + Info
  17 + = link_to team_project_path(@project), :class => "team-tab tab" do
  18 + %span
  19 + Team
  20 + = link_to files_project_path(@project), :class => "files-tab tab" do
  21 + %span
  22 + Files
  23 + = link_to project_snippets_path(@project), :class => "snippets-tab tab" do
  24 + %span
  25 + Snippets
  26 +
  27 +
... ...
app/views/projects/_tile.html.haml
... ... @@ -2,7 +2,7 @@
2 2 - projects.each_with_index do |project, i|
3 3 %div.grid_1.projects_selector
4 4 %div{ :class => "project-box ui-box ui-box-big" }
5   - = link_to project_path(project) do
  5 + = link_to activities_project_path(project) do
6 6 %h3= truncate(project.name, :length => 20)
7 7 .data
8 8 %p.title.repository.git_url_wrapper
... ...
app/views/projects/activities.html.haml 0 → 100644
... ... @@ -0,0 +1,13 @@
  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/files.html.haml 0 → 100644
... ... @@ -0,0 +1,15 @@
  1 += render "project_head"
  2 +%div{ :class => "update-data ui-box ui-box-small ui-box-big" }
  3 + .data
  4 + - @notes.each do |note|
  5 + %a.update-item{:href => note.attachment.url}
  6 + = image_tag gravatar_icon(note.author_email), :class => "left", :width => 16
  7 + %span.update-title{:style => "margin-bottom:0px;"}
  8 + = note.attachment_identifier
  9 + %span.update-author.right
  10 + Added
  11 + = time_ago_in_words(note.created_at)
  12 + ago
  13 +
  14 +
  15 +
... ...
app/views/projects/show.html.haml
1   -- content_for(:body_class, "project-page dashboard")
  1 += render "project_head"
  2 +.stats
  3 + - unless @project.description.empty?
  4 + %h3= simple_format @project.description
2 5  
3   -#news-feed.news-feed
4   - %h2.icon
5   - %span>
6   - Activities
7   - .project-box.project-updates.ui-box.ui-box-small.ui-box-big
8   - - @activities.each do |update|
9   - = render "projects/feed", :update => update, :project => @project
10 6  
11   -:javascript
12   - function updateDashboard(){
13   - $('.project-content').load("#{escape_javascript(project_path(@project))} .project-content>*");
14   - }
15   - setInterval("updateDashboard()", 300000);
... ...
app/views/projects/team.html.haml
  1 += render "project_head"
1 2 %div
2 3 = render :partial => "team", :locals => {:project => @project}
3 4  
... ...
app/views/snippets/index.html.haml
  1 += render "projects/project_head"
1 2 %h2.icon
2 3 %span>
3 4 Snippets
... ...
config/routes.rb
... ... @@ -42,6 +42,10 @@ Gitlab::Application.routes.draw do
42 42 get "team"
43 43 get "wall"
44 44 get "graph"
  45 + get "activities"
  46 + get "branches"
  47 + get "tags"
  48 + get "files"
45 49 end
46 50  
47 51 resources :refs, :only => [], :path => "/" do
... ...