summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2011-12-30 21:56:34 +0200
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2011-12-30 21:56:34 +0200
commit61a2ce41104171b5803164830121df9125668dce (patch)
treeca3f25b7bc5c3ab57984a20df0d4aa254b0b5693
parent0f627a65f43e1b6bfce059bf1750075fb589e583 (diff)
downloadgitlab-ce-61a2ce41104171b5803164830121df9125668dce.tar.gz
code cleanin
-rw-r--r--app/controllers/projects_controller.rb2
-rw-r--r--app/helpers/projects_helper.rb21
-rw-r--r--app/views/layouts/project.html.haml4
-rw-r--r--app/views/projects/edit.html.haml2
-rw-r--r--app/views/projects/files.html.haml26
5 files changed, 33 insertions, 22 deletions
diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb
index 2fcb7e62e5b..1e859ceac31 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 5acda509ec2..cc1d69d46c5 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 d67c682e6aa..1c9b588476a 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 ecd6e6b49e3..69e0f218ecd 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 8bc70345dc4..0d1ba8e8082 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