Module: ApplicationHelper
Instance Method Summary
collapse
#next_button, #next_exercise_button, #next_lesson_button
Instance Method Details
#assistance_box(assignment) ⇒ Object
36
37
38
39
40
41
42
|
# File 'app/helpers/application_helper.rb', line 36
def assistance_box(assignment)
if assignment.tips.present?
%Q{<div class="mu-tips-box">
#{Mumukit::Assistant::Narrator.random.compose_explanation_html assignment.tips}
</div>}.html_safe
end
end
|
#chapter_finished(chapter) ⇒ Object
44
45
46
|
# File 'app/helpers/application_helper.rb', line 44
def chapter_finished(chapter)
t :chapter_finished_html, chapter: link_to_path_element(chapter) if chapter
end
|
4
5
6
|
# File 'app/helpers/application_helper.rb', line 4
def contact_email
Organization.current.contact_email
end
|
#corollary_box(with_corollary) ⇒ Object
26
27
28
29
30
31
32
33
34
|
# File 'app/helpers/application_helper.rb', line 26
def corollary_box(with_corollary)
if with_corollary.corollary.present?
%Q{
<div class="corollary-box">
<p>#{with_corollary.corollary_html}</p>
</div>
}.html_safe
end
end
|
#page_title(subject) ⇒ Object
8
9
10
11
12
13
14
15
16
|
# File 'app/helpers/application_helper.rb', line 8
def page_title(subject)
name = "Mumuki#{Organization.current.title_suffix}"
if subject && !subject.new_record?
"#{subject.friendly} - #{name}"
else
"#{name} - #{t :mumuki_catchphrase}"
end
end
|
#paginate(object, options = {}) ⇒ Object
22
23
24
|
# File 'app/helpers/application_helper.rb', line 22
def paginate(object, options={})
"<div class=\"text-center\">#{super(object, {theme: 'twitter-bootstrap-3'}.merge(options))}</div>".html_safe
end
|
#profile_picture ⇒ Object
18
19
20
|
# File 'app/helpers/application_helper.rb', line 18
def profile_picture
image_tag(current_user.image_url, height: 40, class: 'img-circle', onError: "this.onerror = null; this.src = '#{image_url('user_shape.png')}'")
end
|
#span_toggle(hidden_text, active_text, active) ⇒ Object
48
49
50
51
52
53
|
# File 'app/helpers/application_helper.rb', line 48
def span_toggle(hidden_text, active_text, active)
%Q{
<span class="#{'hidden' if active}">#{hidden_text}</span>
<span class="#{'hidden' unless active}">#{active_text}</span>
}.html_safe
end
|