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

dashboard_helper.rb « helpers « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 78cc2343aa5a4a7edf15a3d19338ba923294fad7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
module DashboardHelper
  def dashboard_feed_path(project, object)
    case object.class.name.to_s
    when "Issue" then project_issue_path(project, project.issues.find(object.id))
    when "Commit" then project_commit_path(project, project.repo.commits(object.id).first)
    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 wall_project_path(project)
    end
  rescue
    "#"
  end

  def dashboard_feed_title(object)
    klass = object.class.to_s.split("::").last

    title = case klass
            when "Note" then markdown(object.note)
            when "Issue" then object.title
            when "Commit" then object.safe_message
            else return "Project Wall"
            end

    truncate(sanitize(title, :tags => []), :length => 60)
  end
end