aboutsummaryrefslogtreecommitdiffstats
path: root/app/helpers/history_helper.rb
blob: ccc6374a169e30c6f4f2153f1f811c235eb4b702 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
module HistoryHelper

  def creation_tag(object)
    field_set_tag t("layouts.history_tag.title"), :class => "history_tag" do
      content_tag :ul do
        [(content_tag :li do
          if object.has_attribute?(:creation_time)  
            object.human_attribute_name('creation_time') + ' : ' + l(object.creation_time, :format => :short)
          else            
            object.class.human_attribute_name('created_at') + ' : ' + l(object.created_at, :format => :short)
          end
        end), 
        (content_tag :li do
           if object.has_attribute?(:creator_id)
             object.human_attribute_name('creator_id') + ' : ' + object.creator_id if object.creator_id
           end
        end), 
        (content_tag :li do
           if object.has_attribute?(:objectid)
             object.human_attribute_name('objectid') + ' : ' + object.objectid if object.objectid
           end
        end), 
        (content_tag :li do
           if object.has_attribute?(:object_version)
             object.human_attribute_name('object_version') + ' : ' + object.object_version.to_s if object.object_version
           end
        end)].join.html_safe
      end
    end
  end
  
  def history_tag(object)
    field_set_tag t("layouts.history_tag.title"), :class => "history_tag" do
      content_tag :ul do
        [(content_tag :li do
          if object.has_attribute?(:created_at)    
            t('layouts.history_tag.created_at') + ' : ' + l(object.created_at, :format => :short)
          end
        end),
        (content_tag :li do
          if object.has_attribute?(:updated_at)    
            t('layouts.history_tag.updated_at') + ' : ' + l(object.updated_at, :format => :short)
          end
        end),  
        (content_tag :li do
           if object.has_attribute?(:user_name)
             t('layouts.history_tag.user_name') + ' : ' + object.user_name if  object.user_name
           end
        end)].join.html_safe
      end
    end
  end
end