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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
|
# File 'lib/hancock/cache/admin/fragment.rb', line 4
def self.config(fields = {})
Proc.new {
navigation_label I18n.t('hancock.cache')
list do
field :enabled, :toggle
field :is_action_cache do
read_only true
end
field :name_n_desc_n_parents
field :name do
visible false
searchable true
end
field :desc do
visible false
searchable true
end
field :data do
pretty_value do
bindings[:object].data(false)
end
end
field :last_clear_data
field :last_clear_time do
visible false
searchable false
end
field :last_clear_user do
visible false
searchable false
end
field :on_ram, :toggle
field :is_html, :toggle
field :virtual_path do
searchable true
end
field :snapshot_data
field :snapshot do
visible false
searchable true
pretty_value do
bindings[:object].get_snapshot(false)
end
queryable true
end
field :last_dump_snapshot_time do
visible false
end
field :last_restore_snapshot_time do
visible false
end
scopes [nil, :is_action_cache, :on_ram]
end
edit do
field :enabled, :toggle
field :is_action_cache do
read_only true
end
field :on_ram, :toggle
field :name
field :virtual_path
field :is_html, :toggle
field :desc
field :parents, :hancock_multiselect
field :last_clear_time do
read_only true
end
field :last_clear_user do
read_only true
end
field :data do
read_only true
end
field :snapshot do
pretty_value do
bindings[:object].get_snapshot
end
read_only do
render_object = (bindings[:controller] || bindings[:view])
!(render_object and render_object.current_user.admin?)
end
end
field :last_dump_snapshot_time do
read_only true
end
field :last_restore_snapshot_time do
read_only true
end
end
show do
field :enabled, :toggle
field :is_action_cache do
read_only true
end
field :on_ram, :toggle
field :name
field :virtual_path
field :is_html
field :desc
field :parents
field :parent_names do
visible do
render_object = (bindings[:controller] || bindings[:view])
(render_object and render_object.current_user.admin?)
end
end
field :last_clear_time
field :last_clear_user
field :data
field :snapshot do
pretty_value do
bindings[:object].get_snapshot
end
end
field :last_dump_snapshot_time
field :last_restore_snapshot_time
end
}
end
|