Module: ProjectsHelper

Included in:
ApplicationController
Defined in:
app/helpers/projects_helper.rb

Overview

A controller include, need to split out session methods versus those that aren't

Instance Method Summary collapse

Instance Method Details

#invalid_object(object) ⇒ Object

Came from application_controller



29
30
31
# File 'app/helpers/projects_helper.rb', line 29

def invalid_object(object)
  !(!object.try(:project_id) || project_matches(object))
end


15
16
17
18
19
20
21
# File 'app/helpers/projects_helper.rb', line 15

def project_link(project)
  return nil if project.nil?
  l = link_to(project.name, select_project_path(project))
  project.id == sessions_current_project_id ?
    (:mark, l) :
    l
end

#project_matches(object) ⇒ Object



33
34
35
# File 'app/helpers/projects_helper.rb', line 33

def project_matches(object)
  object.try(:project_id) == sessions_current_project_id
end

#project_tag(project) ⇒ Object



6
7
8
9
# File 'app/helpers/projects_helper.rb', line 6

def project_tag(project)
  return nil if project.nil?
  project.name
end

#projects_list(projects) ⇒ Object



23
24
25
# File 'app/helpers/projects_helper.rb', line 23

def projects_list(projects)
  projects.collect { |p| (:li, project_link(p)) }.join.html_safe
end

#projects_search_formObject



11
12
13
# File 'app/helpers/projects_helper.rb', line 11

def projects_search_form
  render('/projects/quick_search_form')
end