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
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/helpers/dashboard_helper.rb
parent83c1194d5220cd0e21569a9b255bf813eab69c86 (diff)
dashboard
Diffstat (limited to 'app/helpers/dashboard_helper.rb')
-rw-r--r--app/helpers/dashboard_helper.rb25
1 files changed, 23 insertions, 2 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