Module: RepositoriesHelper

Defined in:
app/helpers/repositories_helper.rb

Instance Method Summary collapse

Instance Method Details

#repositories_search_formObject



27
28
29
# File 'app/helpers/repositories_helper.rb', line 27

def repositories_search_form
  render('/repositories/quick_search_form')
end

#repository_autocomplete_tag(repository) ⇒ Object



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

def repository_autocomplete_tag(repository)
  [repository.name,
   (:span, repository.acronym, class: [:feedback, 'feedback-thin', 'feedback-secondary']),
   (:span, repository.url, class: [:feedback, 'feedback-thin']),
   repository_usage_tag(repository)
  ].compact.join(' ').html_safe
end


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

def repository_link(repository)
  return nil if repository.nil?
  link_to(repository_tag(repository).html_safe, repository)
end

#repository_tag(repository) ⇒ Object



3
4
5
6
7
8
# File 'app/helpers/repositories_helper.rb', line 3

def repository_tag(repository)
  return nil if repository.nil?
  [repository.name,
   (repository.acronym ? "(#{repository.acronym})" : nil)
  ].join(' ').html_safe
end

#repository_usage_tag(repository) ⇒ Object



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

def repository_usage_tag(repository)
  (:span, repository.collection_objects.where(collection_objects: {project_id: sessions_current_project_id}).count.to_s + ' project uses', class: [:feedback, 'feedback-thin'])
end