Commit 61a2ce41104171b5803164830121df9125668dce
1 parent
0f627a65
Exists in
master
and in
4 other branches
code cleanin
Showing
5 changed files
with
33 additions
and
22 deletions
Show diff stats
app/controllers/projects_controller.rb
| @@ -73,7 +73,7 @@ class ProjectsController < ApplicationController | @@ -73,7 +73,7 @@ class ProjectsController < ApplicationController | ||
| 73 | end | 73 | end |
| 74 | 74 | ||
| 75 | def files | 75 | def files |
| 76 | - @notes = @project.notes.where("attachment != 'NULL'").order("created_at DESC") | 76 | + @notes = @project.notes.where("attachment != 'NULL'").order("created_at DESC").limit(100) |
| 77 | end | 77 | end |
| 78 | 78 | ||
| 79 | def info | 79 | def info |
app/helpers/projects_helper.rb
| @@ -16,12 +16,21 @@ module ProjectsHelper | @@ -16,12 +16,21 @@ module ProjectsHelper | ||
| 16 | nil | 16 | nil |
| 17 | end | 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 | end | 27 | end |
| 26 | end | 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 | end | 36 | end |
app/views/layouts/project.html.haml
| @@ -23,8 +23,8 @@ | @@ -23,8 +23,8 @@ | ||
| 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 => "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 | 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 | = 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 |
| 30 | = link_to project_issues_filter_path(@project), :class => (controller.controller_name == "issues") ? "current" : nil do | 30 | = link_to project_issues_filter_path(@project), :class => (controller.controller_name == "issues") ? "current" : nil do |
app/views/projects/edit.html.haml
app/views/projects/files.html.haml
| 1 | = render "project_head" | 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 | - | 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 | ||
| 14 | 16 | ||
| 15 | 17 |