3
4
5
6
7
8
9
10
11
12
13
14
15
|
# File 'lib/countdowner/action_view.rb', line 3
def countdowner(options = {})
message = Countdowner::Message.current.first or return
options.merge!(
:id => 'countdowner',
:'data-end_at' => Countdowner::Datetime.new(message.end_at).iso,
:'data-start_at' => Countdowner::Datetime.new(message.start_at).iso
)
options[:style] = 'display:none' if options.delete(:hidden_initially)
content_tag(:div, options) do
time = Countdowner::Datetime.new(message.target)
message.message.sub('{{target}}', content_tag(:time, time.to_s, :datetime => time.iso)).html_safe
end
end
|