Module: Gaku::FrontendHelper
Instance Method Summary
collapse
#edit_button, #guardian_icon, #name_label, #name_reading_label, #surname_label, #surname_reading_label
#student_chooser_modal
#can_edit?, #disabled?, #genders, #render_flash, #state_load
#big_person_caption_for, #gender, #name_and_ruby_for, #person_caption_for, #student_names
Methods included from ExamHelper
#exam_completion_info
#autocomplete_date_field, #autocomplete_select, #autocomplete_text_field
Instance Method Details
#ajax_link_to_search(text, resource, options = {}) ⇒ Object
19
20
21
22
23
24
25
26
|
# File 'app/helpers/gaku/frontend_helper.rb', line 19
def ajax_link_to_search(text, resource, options = {})
name = ("<span class='glyphicon glyphicon-search'></span> " + text).html_safe
attributes = {
remote: true,
class: 'btn btn-primary'
}.merge(options)
link_to name, resource, attributes
end
|
#badge_count(count, text, css_class) ⇒ Object
11
12
13
14
15
16
17
|
# File 'app/helpers/gaku/frontend_helper.rb', line 11
def badge_count(count, text, css_class)
if count != 0
"#{text}<span class='badge pull-right #{css_class}'>#{count}</span>".html_safe
else
"#{text}<span class='badge pull-right #{css_class}'></span>".html_safe
end
end
|
41
42
43
|
# File 'app/helpers/gaku/frontend_helper.rb', line 41
def (grouped, resource)
grouped.map(&resource.to_sym)
end
|
#prepare_resource_name(nested_resources, resource) ⇒ Object
37
38
39
|
# File 'app/helpers/gaku/frontend_helper.rb', line 37
def prepare_resource_name(nested_resources, resource)
@resource_name = [nested_resources.map { |r| r.is_a?(Symbol) ? r.to_s : get_class(r) }, resource.to_s].flatten.join '-'
end
|
#prepare_target(nested_resource, address) ⇒ Object
28
29
30
31
|
# File 'app/helpers/gaku/frontend_helper.rb', line 28
def prepare_target(nested_resource, address)
return nil if nested_resource.blank?
[nested_resource, address].flatten
end
|
#show_field?(field) ⇒ Boolean
33
34
35
|
# File 'app/helpers/gaku/frontend_helper.rb', line 33
def show_field?(field)
ActiveRecord::Type::Boolean.new.type_cast_from_database(field.to_i)
end
|
#sort_handler ⇒ Object
45
46
47
48
49
|
# File 'app/helpers/gaku/frontend_helper.rb', line 45
def sort_handler
content_tag :td, class: 'sort-handler' do
content_tag :i, nil, class: 'glyphicon glyphicon-move'
end
end
|
#sortable_tbody(path, &block) ⇒ Object
51
52
53
54
55
|
# File 'app/helpers/gaku/frontend_helper.rb', line 51
def sortable_tbody(path, &block)
content_tag(:tbody, class: 'sortable', data: { 'sort-url' => url_for(path) }) do
block.call
end
end
|