Module: ConcurrentDraft::HelperExtensions

Defined in:
lib/concurrent_draft/helper_extensions.rb

Instance Method Summary collapse

Instance Method Details

#save_model_and_promote_button(_model) ⇒ Object

def save_model_button(_model)

label = _model.new_record? ? "Create" : "Save"
submit_tag "#{label} and Exit", :class => 'button'

end

def save_model_and_continue_editing_button(_model)

label = _model.new_record? ? "Create" : "Save"
submit_tag label, :name => 'continue', :class => 'button'

end



35
36
37
38
# File 'lib/concurrent_draft/helper_extensions.rb', line 35

def save_model_and_promote_button(_model)
  label = _model.new_record? ? "Create" : "Save"
  submit_tag "#{label} and Promote Now", :name => 'promote', :class => 'button'
end

#updated_stamp(model) ⇒ Object



2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/concurrent_draft/helper_extensions.rb', line 2

def updated_stamp(model)
  unless model.new_record?
    updated_by = (model.updated_by || model.created_by) if model.respond_to?(:updated_by)
     = updated_by ? updated_by. : nil
    time = (model.updated_at || model.created_at)
    promoted_at = model.draft_promoted_at if model.respond_to?(:draft_promoted_at)
    html = %{<p style="clear: left"><small>}
    if  or time
      html << 'Last updated ' 
      html << %{by #{} } if 
      html << %{at #{ timestamp(time) }} if time
      html << '. '
    end
    if promoted_at
      html << %{Last promoted at #{ timestamp(promoted_at) }.}
    end
    html << %{</small></p>}
    html
  else
    %{<p class="clear">&nbsp;</p>}
  end
end