Module: Sufia::Messages

Extended by:
ActiveSupport::Concern
Includes:
ActionView::Helpers::TagHelper, ActionView::Helpers::UrlHelper
Included in:
BatchUpdateJob
Defined in:
lib/sufia/messages.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#output_bufferObject

Borrowed from AbstractController so we can render html content tags



6
7
8
# File 'lib/sufia/messages.rb', line 6

def output_buffer
  @output_buffer
end

Instance Method Details

#failure_subjectObject



14
15
16
# File 'lib/sufia/messages.rb', line 14

def failure_subject
  I18n.t("sufia.messages.failure.subject")
end

#file_list(files) ⇒ Object

Double-quotes are replaced with single ones so this list can be included in a data block. Ex:

<a href="#" data-content="<a href='#'>embedded link</a>" rel="popover">Click me</a>


44
45
46
# File 'lib/sufia/messages.rb', line 44

def file_list(files)
  files.map { |gf| link_to_file(gf) }.join(', ').tr("\"", "'")
end


48
49
50
# File 'lib/sufia/messages.rb', line 48

def link_to_file(file)
  link_to(file.to_s, Sufia::Engine.routes.url_helpers.generic_file_path(file))
end

#multiple_failure(id, files) ⇒ Object



36
37
38
39
40
# File 'lib/sufia/messages.rb', line 36

def multiple_failure(id, files)
   :span, id: "ss-" + id do
    [failure_link(files), I18n.t("sufia.messages.failure.multiple.tag")].join(" ").html_safe
  end
end

#multiple_success(id, files) ⇒ Object



24
25
26
27
28
# File 'lib/sufia/messages.rb', line 24

def multiple_success(id, files)
   :span, id: "ss-" + id do
    [success_link(files), I18n.t("sufia.messages.success.multiple.tag")].join(" ").html_safe
  end
end

#single_failure(id, file) ⇒ Object



30
31
32
33
34
# File 'lib/sufia/messages.rb', line 30

def single_failure(id, file)
   :span, id: "ss-" + id do
    [link_to_file(file), I18n.t("sufia.messages.failure.single")].join(" ").html_safe
  end
end

#single_success(id, file) ⇒ Object



18
19
20
21
22
# File 'lib/sufia/messages.rb', line 18

def single_success(id, file)
   :span, id: "ss-" + id do
    [link_to_file(file), I18n.t("sufia.messages.success.single")].join(" ").html_safe
  end
end

#success_subjectObject



10
11
12
# File 'lib/sufia/messages.rb', line 10

def success_subject
  I18n.t("sufia.messages.success.subject")
end