Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorgitlabhq <m@gitlabhq.com>2011-11-03 00:14:03 +0400
committergitlabhq <m@gitlabhq.com>2011-11-03 00:14:03 +0400
commit020e1a8eee37e6a0acba9833f8abb5dfc80eb248 (patch)
treecf2d6bb2850e9ceecefbecbb712ebfa158577f27 /app
parent83c1194d5220cd0e21569a9b255bf813eab69c86 (diff)
dashboard
Diffstat (limited to 'app')
-rw-r--r--app/helpers/dashboard_helper.rb25
-rw-r--r--app/models/project.rb4
-rw-r--r--app/views/dashboard/index.html.haml24
-rw-r--r--app/views/layouts/_head_panel.html.erb4
4 files changed, 40 insertions, 17 deletions
diff --git a/app/helpers/dashboard_helper.rb b/app/helpers/dashboard_helper.rb
index 878c877d2f3..0560af5daf5 100644
--- a/app/helpers/dashboard_helper.rb
+++ b/app/helpers/dashboard_helper.rb
@@ -1,9 +1,30 @@
module DashboardHelper
- def path_to_object(project, object)
+ def dashboard_feed_path(project, object)
case object.class.name.to_s
when "Issue" then project_issues_path(project, project.issues.find(object.id))
when "Grit::Commit" then project_commit_path(project, project.repo.commits(object.id).first)
- else "#"
+ when "Note"
+ then
+ note = object
+ case note.noteable_type
+ when "Issue" then project_issue_path(project, note.noteable_id)
+ when "Snippet" then project_snippet_path(project, note.noteable_id)
+ when "Commit" then project_commit_path(project, :id => note.noteable_id)
+ else wall_project_path(project)
+ end
+ else "#"
end
+ rescue
+ "#"
+ end
+
+ def dashboard_feed_title(object)
+ title = case object.class.name.to_s
+ when "Note" then markdown(object.note)
+ when "Issue" then object.title
+ when "Grit::Commit" then object.safe_message
+ else ""
+ end
+ "[#{object.class.name}] #{truncate(sanitize(title, :tags => []), :length => 60)} "
end
end
diff --git a/app/models/project.rb b/app/models/project.rb
index 54cf77e4275..befa1c6b14e 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -136,7 +136,7 @@ class Project < ActiveRecord::Base
notes.fresh.limit(n)
].compact.flatten.sort do |x, y|
y.created_at <=> x.created_at
- end[0..n]
+ end[0...n]
end
def commit(commit_id = nil)
@@ -160,7 +160,7 @@ class Project < ActiveRecord::Base
y.committed_date <=> x.committed_date
end
- commits[0..n]
+ commits[0...n]
end
def commits_since(date)
diff --git a/app/views/dashboard/index.html.haml b/app/views/dashboard/index.html.haml
index 73d6eba23d7..761826cae52 100644
--- a/app/views/dashboard/index.html.haml
+++ b/app/views/dashboard/index.html.haml
@@ -3,12 +3,13 @@
#dashboard-content.dashboard-content.content
%aside
%h4
- %a.button-small.button-green{:href => ""} New Repository
+ - if current_user.can_create_project?
+ %a.button-small.button-green{:href => new_project_path} New Repository
Your Repositories
%ol.project-list
- @projects.each do |project|
%li
- %a{:href => "#"}
+ %a{:href => project_path(project)}
%span.arrow →
%span.project-name= project.name
%span.time
@@ -18,19 +19,20 @@
%h2.icon
%span>
Dashboard
- - @active_projects.each do |project|
+ - @active_projects.first(3).each do |project|
.project-box.project-updates.ui-box.ui-box-small.ui-box-big
%h3= project.name
.data
- project.updates.each do |update|
- %a.project-update{:href => path_to_object(project, update)}
- %img{:src => "http://placehold.it/40x40"}
- %span.update-title [#{update.class.name}] added a matcher that helps debugging matching problems
- %span.update-author
- %strong= update.author.name
- authored
- = time_ago_in_words(update.created_at)
- ago
+ %a.project-update{:href => dashboard_feed_path(project, update)}
+ = image_tag gravatar_icon(update.author.email), :class => "left", :width => 40
+ %span.update-title
+ = dashboard_feed_title(update)
+ %span.update-author
+ %strong= update.author.name
+ authored
+ = time_ago_in_words(update.created_at)
+ ago
%br
/ .project-update
/ .project-updates
diff --git a/app/views/layouts/_head_panel.html.erb b/app/views/layouts/_head_panel.html.erb
index 762c87ff3b4..a64aa3b5513 100644
--- a/app/views/layouts/_head_panel.html.erb
+++ b/app/views/layouts/_head_panel.html.erb
@@ -22,9 +22,9 @@
<%= link_to projects_path, :class => current_page?(projects_path) ? "current project" : "project" do %>
<span></span>Projects
<% end %>
- <%= link_to( admin_root_path, :class => admin_namespace? ? "current admin" : "admin" ) do %>
+ <%= link_to((current_user.is_admin? ? admin_root_path : "#"), :class => (admin_namespace? ? "current admin" : "admin")) do %>
<span></span>Admin
- <% end if current_user.is_admin? %>
+ <% end %>
</nav>
</header>
<!-- eo Page Header -->