Module: Tasks::People::AuthorHelper

Defined in:
app/helpers/tasks/people/author_helper.rb

Instance Method Summary collapse

Instance Method Details

#cite_count(source) ⇒ Object



20
21
22
# File 'app/helpers/tasks/people/author_helper.rb', line 20

def cite_count(source)
  source.citations.where(project_id: sessions_current_project_id).count
end

#letter_color(letter) ⇒ Object



4
5
6
7
8
9
10
# File 'app/helpers/tasks/people/author_helper.rb', line 4

def letter_color(letter)
  style = ''
  if select_author_count(letter) == 0
    style =  " style='color:lightgrey;'"
  end
  "<h3#{style}>#{letter}</h3>"
end

#select_author_count(letter) ⇒ Object



12
13
14
# File 'app/helpers/tasks/people/author_helper.rb', line 12

def select_author_count(letter)
  select_authors(letter).count
end

#select_authors(letter) ⇒ Object

TODO: @mjy



16
17
18
# File 'app/helpers/tasks/people/author_helper.rb', line 16

def select_authors(letter)  # TODO: @mjy
  Person.with_role('SourceAuthor').where('last_name ilike ?', letter).order(:last_name).select(:last_name)
end

#source_color(source) ⇒ Object



24
25
26
27
28
29
30
# File 'app/helpers/tasks/people/author_helper.rb', line 24

def source_color(source)
  style = ' style="color:lightgrey:" '
  unless cite_count(source) == 0
    style = ''
  end
  "<span#{style}>#{source.cached}</span>"
end