From c1c903fb955cbee1afe3bd10944d6c218b576b15 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Wed, 28 Dec 2011 09:38:50 +0200 Subject: [PATCH 1/3] Project tab added. activities, team, snippets moved to project tab --- app/assets/stylesheets/projects.css.scss | 6 ++++- app/controllers/projects_controller.rb | 7 ++++++ app/views/dashboard/_sidebar.html.haml | 2 +- app/views/layouts/project.html.haml | 12 +--------- app/views/projects/_project_head.html.haml | 27 ++++++++++++++++++++++ app/views/projects/_tile.html.haml | 2 +- app/views/projects/activities.html.haml | 13 +++++++++++ app/views/projects/files.html.haml | 15 ++++++++++++ app/views/projects/show.html.haml | 17 ++++---------- app/views/projects/team.html.haml | 1 + app/views/snippets/index.html.haml | 1 + config/routes.rb | 4 ++++ 12 files changed, 80 insertions(+), 27 deletions(-) create mode 100644 app/views/projects/_project_head.html.haml create mode 100644 app/views/projects/activities.html.haml create mode 100644 app/views/projects/files.html.haml diff --git a/app/assets/stylesheets/projects.css.scss b/app/assets/stylesheets/projects.css.scss index 33d70e30..f73c063d 100644 --- a/app/assets/stylesheets/projects.css.scss +++ b/app/assets/stylesheets/projects.css.scss @@ -561,6 +561,7 @@ h4.middle-panel { display:none; } + .merge-tabs { margin: 0; border: 1px solid #ccc; @@ -576,7 +577,7 @@ h4.middle-panel { border-right: 1px solid #ddd; background:none; padding: 10px; - width:60px; + min-width:60px; float:left; position:relative; top:-5px; @@ -598,6 +599,9 @@ h4.middle-panel { } } } +.activities-tab span { background: url("images.png") no-repeat -161px -1px; } +.stat-tab, .team-tab, .snippets-tab span { background: url("images.png") no-repeat -38px -77px; } +.files-tab span { background: url("images.png") no-repeat -112px -23px; } .merge-notes-tab span { background: url("images.png") no-repeat -161px -1px; } .merge-commits-tab span { background: url("images.png") no-repeat -86px 1px; } diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 4b4f748f..02495a22 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -67,6 +67,13 @@ class ProjectsController < ApplicationController end def show + end + + def files + @notes = @project.notes.where("attachment != 'NULL'").order("created_at DESC") + end + + def activities return render "projects/empty" unless @project.repo_exists? && @project.has_commits? limit = (params[:limit] || 20).to_i @activities = @project.cached_updates(limit) diff --git a/app/views/dashboard/_sidebar.html.haml b/app/views/dashboard/_sidebar.html.haml index 9f6378b4..dfe4abda 100644 --- a/app/views/dashboard/_sidebar.html.haml +++ b/app/views/dashboard/_sidebar.html.haml @@ -6,7 +6,7 @@ %ol.project-list - @projects.each do |project| %li - %a{:href => project_path(project)} + %a{:href => activities_project_path(project)} %span.arrow → %span.project-name= project.name %span.time diff --git a/app/views/layouts/project.html.haml b/app/views/layouts/project.html.haml index 5de97b52..44cd1279 100644 --- a/app/views/layouts/project.html.haml +++ b/app/views/layouts/project.html.haml @@ -23,14 +23,10 @@ .project-sidebar .fixed %aside - = link_to "Activities", project_path(@project), :class => current_page?(:controller => "projects", :action => "show", :id => @project) ? "current" : nil + = 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 = 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 = link_to "Commits", project_commits_path(@project), :class => current_page?(:controller => "commits", :action => "index", :project_id => @project) ? "current" : nil = link_to "Network graph", graph_project_path(@project), :class => current_page?(:controller => "projects", :action => "graph", :id => @project) ? "current" : nil - = link_to team_project_path(@project), :class => (current_page?(:controller => "projects", :action => "team", :id => @project) || controller.controller_name == "team_members") ? "current" : nil do - Team - - if @project.users_projects.count > 0 - %span{ :class => "number" }= @project.users_projects.count = link_to project_issues_filter_path(@project), :class => (controller.controller_name == "issues") ? "current" : nil do Issues - if @project.issues.open_for(current_user).count > 0 @@ -43,13 +39,7 @@ Merge Requests - if @project.merge_requests.opened.count > 0 %span{ :class => "number" }= @project.merge_requests.opened.count - = link_to project_snippets_path(@project), :class => (controller.controller_name == "snippets") ? "current" : nil do - Snippets - - if @project.snippets.non_expired.count > 0 - %span{ :class => "number" }= @project.snippets.non_expired.count - - if can? current_user, :admin_project, @project - = link_to "Admin", edit_project_path(@project), :class => (current_page?(edit_project_path(@project))) ? "current" : nil .medium-tags{:style => 'padding: 10px 0 0 10px; width: 210px;'}= tag_list @project diff --git a/app/views/projects/_project_head.html.haml b/app/views/projects/_project_head.html.haml new file mode 100644 index 00000000..c9aab4f7 --- /dev/null +++ b/app/views/projects/_project_head.html.haml @@ -0,0 +1,27 @@ +%div + -#- if can? current_user, :admin_project, @project + -#%span.entity-info + -#= link_to edit_project_path(@project) do + -#.entity-button + -#Edit Project + -#%i + + -#%h2= @project.name +.merge-tabs + = link_to activities_project_path(@project), :class => "activities-tab tab #{'active' if current_page?(activities_project_path(@project)) }" do + %span + Activities + = link_to project_path(@project), :class => "stat-tab tab" do + %span + Info + = link_to team_project_path(@project), :class => "team-tab tab" do + %span + Team + = link_to files_project_path(@project), :class => "files-tab tab" do + %span + Files + = link_to project_snippets_path(@project), :class => "snippets-tab tab" do + %span + Snippets + + diff --git a/app/views/projects/_tile.html.haml b/app/views/projects/_tile.html.haml index d9549045..8d0ad21f 100644 --- a/app/views/projects/_tile.html.haml +++ b/app/views/projects/_tile.html.haml @@ -2,7 +2,7 @@ - projects.each_with_index do |project, i| %div.grid_1.projects_selector %div{ :class => "project-box ui-box ui-box-big" } - = link_to project_path(project) do + = link_to activities_project_path(project) do %h3= truncate(project.name, :length => 20) .data %p.title.repository.git_url_wrapper diff --git a/app/views/projects/activities.html.haml b/app/views/projects/activities.html.haml new file mode 100644 index 00000000..bbc31a59 --- /dev/null +++ b/app/views/projects/activities.html.haml @@ -0,0 +1,13 @@ +- content_for(:body_class, "project-page dashboard") + += render "project_head" +#news-feed.news-feed + .project-box.project-updates.ui-box.ui-box-small.ui-box-big + - @activities.each do |update| + = render "projects/feed", :update => update, :project => @project + +:javascript + function updateDashboard(){ + $('.project-content').load("#{escape_javascript(project_path(@project))} .project-content>*"); + } + setInterval("updateDashboard()", 300000); diff --git a/app/views/projects/files.html.haml b/app/views/projects/files.html.haml new file mode 100644 index 00000000..8bc70345 --- /dev/null +++ b/app/views/projects/files.html.haml @@ -0,0 +1,15 @@ += render "project_head" +%div{ :class => "update-data ui-box ui-box-small ui-box-big" } + .data + - @notes.each do |note| + %a.update-item{:href => note.attachment.url} + = image_tag gravatar_icon(note.author_email), :class => "left", :width => 16 + %span.update-title{:style => "margin-bottom:0px;"} + = note.attachment_identifier + %span.update-author.right + Added + = time_ago_in_words(note.created_at) + ago + + + diff --git a/app/views/projects/show.html.haml b/app/views/projects/show.html.haml index 0530736f..bc78e99d 100644 --- a/app/views/projects/show.html.haml +++ b/app/views/projects/show.html.haml @@ -1,15 +1,6 @@ -- content_for(:body_class, "project-page dashboard") += render "project_head" +.stats + - unless @project.description.empty? + %h3= simple_format @project.description -#news-feed.news-feed - %h2.icon - %span> - Activities - .project-box.project-updates.ui-box.ui-box-small.ui-box-big - - @activities.each do |update| - = render "projects/feed", :update => update, :project => @project -:javascript - function updateDashboard(){ - $('.project-content').load("#{escape_javascript(project_path(@project))} .project-content>*"); - } - setInterval("updateDashboard()", 300000); diff --git a/app/views/projects/team.html.haml b/app/views/projects/team.html.haml index 3b2c4b3e..41afc451 100644 --- a/app/views/projects/team.html.haml +++ b/app/views/projects/team.html.haml @@ -1,3 +1,4 @@ += render "project_head" %div = render :partial => "team", :locals => {:project => @project} diff --git a/app/views/snippets/index.html.haml b/app/views/snippets/index.html.haml index f08a3d1d..0c83bf9d 100644 --- a/app/views/snippets/index.html.haml +++ b/app/views/snippets/index.html.haml @@ -1,3 +1,4 @@ += render "projects/project_head" %h2.icon %span> Snippets diff --git a/config/routes.rb b/config/routes.rb index bf9fe954..2812b150 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -42,6 +42,10 @@ Gitlab::Application.routes.draw do get "team" get "wall" get "graph" + get "activities" + get "branches" + get "tags" + get "files" end resources :refs, :only => [], :path => "/" do From 0f627a65f43e1b6bfce059bf1750075fb589e583 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Fri, 30 Dec 2011 08:54:42 +0200 Subject: [PATCH 2/3] Project tab r1 is finished --- app/assets/stylesheets/projects.css.scss | 5 +- app/controllers/projects_controller.rb | 10 ++-- app/views/dashboard/_sidebar.html.haml | 2 +- app/views/layouts/project.html.haml | 2 +- app/views/projects/_project_head.html.haml | 19 ++---- app/views/projects/_team.html.haml | 4 +- app/views/projects/_tile.html.haml | 2 +- app/views/projects/activities.html.haml | 13 ---- app/views/projects/edit.html.erb | 1 - app/views/projects/edit.html.haml | 69 ++++++++++++++++++++++ app/views/projects/info.html.haml | 28 +++++++++ app/views/projects/show.html.haml | 15 +++-- app/views/projects/update.js.haml | 2 +- app/views/snippets/index.html.haml | 3 - config/routes.rb | 4 +- spec/requests/projects_spec.rb | 2 +- 16 files changed, 128 insertions(+), 53 deletions(-) delete mode 100644 app/views/projects/activities.html.haml delete mode 100644 app/views/projects/edit.html.erb create mode 100644 app/views/projects/edit.html.haml create mode 100644 app/views/projects/info.html.haml diff --git a/app/assets/stylesheets/projects.css.scss b/app/assets/stylesheets/projects.css.scss index f73c063d..6916d65c 100644 --- a/app/assets/stylesheets/projects.css.scss +++ b/app/assets/stylesheets/projects.css.scss @@ -573,7 +573,6 @@ h4.middle-panel { .tab { font-weight: bold; - text-transform: uppercase; border-right: 1px solid #ddd; background:none; padding: 10px; @@ -600,7 +599,9 @@ h4.middle-panel { } } .activities-tab span { background: url("images.png") no-repeat -161px -1px; } -.stat-tab, .team-tab, .snippets-tab span { background: url("images.png") no-repeat -38px -77px; } +.stat-tab span, +.team-tab span, +.snippets-tab span { background: url("images.png") no-repeat -38px -77px; } .files-tab span { background: url("images.png") no-repeat -112px -23px; } .merge-notes-tab span { background: url("images.png") no-repeat -161px -1px; } diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 02495a22..2fcb7e62 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -57,7 +57,7 @@ class ProjectsController < ApplicationController def update respond_to do |format| if project.update_attributes(params[:project]) - format.html { redirect_to project, :notice => 'Project was successfully updated.' } + format.html { redirect_to info_project_path(project), :notice => 'Project was successfully updated.' } format.js else format.html { render action: "edit" } @@ -67,16 +67,16 @@ class ProjectsController < ApplicationController end def show + return render "projects/empty" unless @project.repo_exists? && @project.has_commits? + limit = (params[:limit] || 20).to_i + @activities = @project.cached_updates(limit) end def files @notes = @project.notes.where("attachment != 'NULL'").order("created_at DESC") end - def activities - return render "projects/empty" unless @project.repo_exists? && @project.has_commits? - limit = (params[:limit] || 20).to_i - @activities = @project.cached_updates(limit) + def info end # diff --git a/app/views/dashboard/_sidebar.html.haml b/app/views/dashboard/_sidebar.html.haml index dfe4abda..9f6378b4 100644 --- a/app/views/dashboard/_sidebar.html.haml +++ b/app/views/dashboard/_sidebar.html.haml @@ -6,7 +6,7 @@ %ol.project-list - @projects.each do |project| %li - %a{:href => activities_project_path(project)} + %a{:href => project_path(project)} %span.arrow → %span.project-name= project.name %span.time diff --git a/app/views/layouts/project.html.haml b/app/views/layouts/project.html.haml index 44cd1279..d67c682e 100644 --- a/app/views/layouts/project.html.haml +++ b/app/views/layouts/project.html.haml @@ -23,7 +23,7 @@ .project-sidebar .fixed %aside - = 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 + = 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 = 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 = link_to "Commits", project_commits_path(@project), :class => current_page?(:controller => "commits", :action => "index", :project_id => @project) ? "current" : nil = link_to "Network graph", graph_project_path(@project), :class => current_page?(:controller => "projects", :action => "graph", :id => @project) ? "current" : nil diff --git a/app/views/projects/_project_head.html.haml b/app/views/projects/_project_head.html.haml index c9aab4f7..0a9e3094 100644 --- a/app/views/projects/_project_head.html.haml +++ b/app/views/projects/_project_head.html.haml @@ -1,26 +1,17 @@ -%div - -#- if can? current_user, :admin_project, @project - -#%span.entity-info - -#= link_to edit_project_path(@project) do - -#.entity-button - -#Edit Project - -#%i - - -#%h2= @project.name .merge-tabs - = link_to activities_project_path(@project), :class => "activities-tab tab #{'active' if current_page?(activities_project_path(@project)) }" do + = link_to project_path(@project), :class => "activities-tab tab #{'active' if current_page?(project_path(@project)) }" do %span Activities - = link_to project_path(@project), :class => "stat-tab tab" do + = 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 %span Info - = link_to team_project_path(@project), :class => "team-tab tab" do + = link_to team_project_path(@project), :class => "team-tab tab #{'active' if current_page?(team_project_path(@project)) }" do %span Team - = link_to files_project_path(@project), :class => "files-tab tab" do + = link_to files_project_path(@project), :class => "files-tab tab #{'active' if current_page?(files_project_path(@project)) }" do %span Files - = link_to project_snippets_path(@project), :class => "snippets-tab tab" do + = link_to project_snippets_path(@project), :class => "snippets-tab tab #{'active' if current_page?(project_snippets_path(@project)) }" do %span Snippets diff --git a/app/views/projects/_team.html.haml b/app/views/projects/_team.html.haml index 7c647e33..6cda3b9b 100644 --- a/app/views/projects/_team.html.haml +++ b/app/views/projects/_team.html.haml @@ -1,9 +1,7 @@ -%h2.icon - %span> - Team - if can? current_user, :admin_team_member, @project %div#new-member-holder .right= link_to "Add new", new_project_team_member_path(@project), :remote => true, :class => "grey-button" + .clear %br %table.round-borders#team-table %thead diff --git a/app/views/projects/_tile.html.haml b/app/views/projects/_tile.html.haml index 8d0ad21f..d9549045 100644 --- a/app/views/projects/_tile.html.haml +++ b/app/views/projects/_tile.html.haml @@ -2,7 +2,7 @@ - projects.each_with_index do |project, i| %div.grid_1.projects_selector %div{ :class => "project-box ui-box ui-box-big" } - = link_to activities_project_path(project) do + = link_to project_path(project) do %h3= truncate(project.name, :length => 20) .data %p.title.repository.git_url_wrapper diff --git a/app/views/projects/activities.html.haml b/app/views/projects/activities.html.haml deleted file mode 100644 index bbc31a59..00000000 --- a/app/views/projects/activities.html.haml +++ /dev/null @@ -1,13 +0,0 @@ -- content_for(:body_class, "project-page dashboard") - -= render "project_head" -#news-feed.news-feed - .project-box.project-updates.ui-box.ui-box-small.ui-box-big - - @activities.each do |update| - = render "projects/feed", :update => update, :project => @project - -:javascript - function updateDashboard(){ - $('.project-content').load("#{escape_javascript(project_path(@project))} .project-content>*"); - } - setInterval("updateDashboard()", 300000); diff --git a/app/views/projects/edit.html.erb b/app/views/projects/edit.html.erb deleted file mode 100644 index 2d343636..00000000 --- a/app/views/projects/edit.html.erb +++ /dev/null @@ -1 +0,0 @@ -<%= render 'form' %> diff --git a/app/views/projects/edit.html.haml b/app/views/projects/edit.html.haml new file mode 100644 index 00000000..ecd6e6b4 --- /dev/null +++ b/app/views/projects/edit.html.haml @@ -0,0 +1,69 @@ += render "project_head" + += form_for(@project, :remote => true) do |f| + %div + %span.entity-info + = link_to info_project_path(@project) do + .entity-button + Info + %i + %h2= @project.name + %hr + %table.no-borders + -if @project.errors.any? + %tr + %td{:colspan => 2} + #error_explanation + - @project.errors.full_messages.each do |msg| + %span= msg + %br + + %tr + %td= f.label :name + %td= f.text_field :name, :placeholder => "Example Project" + %tr + %td + .left= f.label :path + %cite.right= "git@#{GIT_HOST["host"]}:" + %td + = f.text_field :path, :placeholder => "example_project", :disabled => !@project.new_record? + %tr + %td + .left= f.label :code + %cite.right= "http://#{GIT_HOST["host"]}/" + %td= f.text_field :code, :placeholder => "example" + + - unless @project.new_record? || @project.heads.empty? + %tr + %td= f.label :default_branch, "Default Branch" + %td= f.select(:default_branch, @project.heads.map(&:name), {}, :style => "width:300px;") + + %tr + %td= f.label :description + %td= f.text_area :description, :placeholder => "project description", :style => "height:50px" + + %br + + .merge-tabs + = f.submit 'Save', :class => "grey-button" +   + - unless @project.new_record? + .right + = link_to 'Remove', @project, :confirm => 'Are you sure?', :method => :delete, :class => "red-button" + +%div{ :class => "ajax_loader", :style => "display:none;height:200px;"} + %center + = image_tag "ajax-loader.gif", :class => "append-bottom" + %h3.prepend-top Updating project & repository. Please wait for few minutes + +:javascript + $('.edit_project').bind('ajax:before', function() { + $(".edit_project").hide(); + $('.ajax_loader').show(); + }); + +:javascript + $(function(){ + $('form #project_default_branch').chosen(); + }) + diff --git a/app/views/projects/info.html.haml b/app/views/projects/info.html.haml new file mode 100644 index 00000000..787ad06d --- /dev/null +++ b/app/views/projects/info.html.haml @@ -0,0 +1,28 @@ += render "project_head" + +%div + %span.entity-info + = link_to edit_project_path(@project) do + .entity-button + Edit + %i + %h2= @project.name + %hr + +%table.no-borders + %tr + %td Name + %td= @project.name + + %tr + %td Slug + %td= @project.code + + %tr + %td Created + %td= @project.created_at.stamp("Aug 21, 2011") + + %tr + %td{:colspan => 2}= simple_format @project.description + + diff --git a/app/views/projects/show.html.haml b/app/views/projects/show.html.haml index bc78e99d..bbc31a59 100644 --- a/app/views/projects/show.html.haml +++ b/app/views/projects/show.html.haml @@ -1,6 +1,13 @@ +- content_for(:body_class, "project-page dashboard") + = render "project_head" -.stats - - unless @project.description.empty? - %h3= simple_format @project.description - +#news-feed.news-feed + .project-box.project-updates.ui-box.ui-box-small.ui-box-big + - @activities.each do |update| + = render "projects/feed", :update => update, :project => @project +:javascript + function updateDashboard(){ + $('.project-content').load("#{escape_javascript(project_path(@project))} .project-content>*"); + } + setInterval("updateDashboard()", 300000); diff --git a/app/views/projects/update.js.haml b/app/views/projects/update.js.haml index 0188f083..70d8490e 100644 --- a/app/views/projects/update.js.haml +++ b/app/views/projects/update.js.haml @@ -1,6 +1,6 @@ - if @project.valid? :plain - location.href = "#{project_path(@project, :notice => 'Project was successfully updated.')}"; + location.href = "#{info_project_path(@project, :notice => 'Project was successfully updated.')}"; - else :plain $(".edit_project").replaceWith("#{escape_javascript(render('form'))}"); diff --git a/app/views/snippets/index.html.haml b/app/views/snippets/index.html.haml index 0c83bf9d..9af12f74 100644 --- a/app/views/snippets/index.html.haml +++ b/app/views/snippets/index.html.haml @@ -1,7 +1,4 @@ = render "projects/project_head" -%h2.icon - %span> - Snippets - if can? current_user, :write_snippet, @project .right= link_to 'New Snippet', new_project_snippet_path(@project), :class => "grey-button append-bottom-10" diff --git a/config/routes.rb b/config/routes.rb index 2812b150..58880966 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -42,9 +42,7 @@ Gitlab::Application.routes.draw do get "team" get "wall" get "graph" - get "activities" - get "branches" - get "tags" + get "info" get "files" end diff --git a/spec/requests/projects_spec.rb b/spec/requests/projects_spec.rb index b0a52dcb..391bc3e5 100644 --- a/spec/requests/projects_spec.rb +++ b/spec/requests/projects_spec.rb @@ -140,7 +140,7 @@ describe "Projects" do end it "should be correct path" do - current_path.should == project_path(@project) + current_path.should == info_project_path(@project) end it "should show project" do From 61a2ce41104171b5803164830121df9125668dce Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Fri, 30 Dec 2011 21:56:34 +0200 Subject: [PATCH 3/3] code cleanin --- app/controllers/projects_controller.rb | 2 +- app/helpers/projects_helper.rb | 21 +++++++++++++++------ app/views/layouts/project.html.haml | 4 ++-- app/views/projects/edit.html.haml | 2 +- app/views/projects/files.html.haml | 26 ++++++++++++++------------ 5 files changed, 33 insertions(+), 22 deletions(-) diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 2fcb7e62..1e859cea 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -73,7 +73,7 @@ class ProjectsController < ApplicationController end def files - @notes = @project.notes.where("attachment != 'NULL'").order("created_at DESC") + @notes = @project.notes.where("attachment != 'NULL'").order("created_at DESC").limit(100) end def info diff --git a/app/helpers/projects_helper.rb b/app/helpers/projects_helper.rb index 5acda509..cc1d69d4 100644 --- a/app/helpers/projects_helper.rb +++ b/app/helpers/projects_helper.rb @@ -16,12 +16,21 @@ module ProjectsHelper nil end - # expires in 360 days - def switch_colorscheme_link(opts) - if cookies[:colorschema].blank? - link_to_function "paint it black!", "$.cookie('colorschema','black', {expires:360}); window.location.reload()", opts - else - link_to_function "paint it white!", "$.cookie('colorschema','', {expires:360}); window.location.reload()", opts + def project_tab_class + [:show, :files, :team, :edit, :update, :info].each do |action| + return "current" if current_page?(:controller => "projects", :action => action, :id => @project) + end + + if controller.controller_name == "snippets" || + controller.controller_name == "team_members" + "current" end end + + def tree_tab_class + current_page?(:controller => "refs", + :action => "tree", + :project_id => @project, + :id => @ref || @project.root_ref ) ? "current" : nil + end end diff --git a/app/views/layouts/project.html.haml b/app/views/layouts/project.html.haml index d67c682e..1c9b5884 100644 --- a/app/views/layouts/project.html.haml +++ b/app/views/layouts/project.html.haml @@ -23,8 +23,8 @@ .project-sidebar .fixed %aside - = 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 - = 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 + = link_to "Project", project_path(@project), :class => project_tab_class + = link_to "Tree", tree_project_ref_path(@project, @project.root_ref), :class => tree_tab_class = link_to "Commits", project_commits_path(@project), :class => current_page?(:controller => "commits", :action => "index", :project_id => @project) ? "current" : nil = link_to "Network graph", graph_project_path(@project), :class => current_page?(:controller => "projects", :action => "graph", :id => @project) ? "current" : nil = link_to project_issues_filter_path(@project), :class => (controller.controller_name == "issues") ? "current" : nil do diff --git a/app/views/projects/edit.html.haml b/app/views/projects/edit.html.haml index ecd6e6b4..69e0f218 100644 --- a/app/views/projects/edit.html.haml +++ b/app/views/projects/edit.html.haml @@ -64,6 +64,6 @@ :javascript $(function(){ - $('form #project_default_branch').chosen(); + $('#project_default_branch').chosen(); }) diff --git a/app/views/projects/files.html.haml b/app/views/projects/files.html.haml index 8bc70345..0d1ba8e8 100644 --- a/app/views/projects/files.html.haml +++ b/app/views/projects/files.html.haml @@ -1,15 +1,17 @@ = render "project_head" -%div{ :class => "update-data ui-box ui-box-small ui-box-big" } - .data - - @notes.each do |note| - %a.update-item{:href => note.attachment.url} - = image_tag gravatar_icon(note.author_email), :class => "left", :width => 16 - %span.update-title{:style => "margin-bottom:0px;"} - = note.attachment_identifier - %span.update-author.right - Added - = time_ago_in_words(note.created_at) - ago - +- unless @notes.empty? + %div.update-data.ui-box.ui-box-small + .data + - @notes.each do |note| + %a.update-item{:href => note.attachment.url} + = image_tag gravatar_icon(note.author_email), :class => "left", :width => 16 + %span.update-title{:style => "margin-bottom:0px;"} + = note.attachment_identifier + %span.update-author.right + Added + = time_ago_in_words(note.created_at) + ago +- else + %h3 All files attached to project wall, issues etc will be displayed here