Module: Tasks::People::AuthorHelper

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

Instance Method Summary (collapse)

Instance Method Details

- (Object) cite_count(source)



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

- (Object) letter_color(letter)



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

- (Object) select_author_count(letter)



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

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

- (Object) select_authors(letter)



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

def select_authors(letter)
  Person.with_role('SourceAuthor').where("last_name ilike '#{letter}%'").order(:last_name).select(:last_name)
end

- (Object) source_color(source)



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