we_bridge-auto_view_helper 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6c2147712b44d45924880bc3a8a2065f09c4d44a
4
- data.tar.gz: 936adad2606e216d85c48a9c150bfae3692e88f3
3
+ metadata.gz: c1bc8d0f694c9f0ecc38fbd07fb2b675e159f942
4
+ data.tar.gz: 9f16c13e44ba68e9e8e73242573e15c2475ba721
5
5
  SHA512:
6
- metadata.gz: 88288baf6b81cde0e96020db35f413dae7e09d343121fb29da109584a489611744a43b00dace868623384a69b4d2c29d9c60de54241d2bbfc9cd912058fe7218
7
- data.tar.gz: 25888c8024da5743a8510541272c4cb5b3c636b14f09d096b1d86a8e4904ccecb2c65e9b184255c23a7f4aaf0e3ebc225fc19fef222bfb8d82f068cf8672befd
6
+ metadata.gz: bd9486c63d731eafa348af5f2e1450c4ea962a7bc99db3141a32a0e5e270b83c0673c7c419f1ff1c6e50c358fb93e332c1b45278b4baaf905d1d14f50a34bd17
7
+ data.tar.gz: 4a42d8888b766c85ad61eaa3fa2688cb0b70bbbea14c0853228f72ce23bebf8ab5a38471d9925efcf94b707dc835d73dee845096c1ed709f05e87bccd57b5648
@@ -1,5 +1,5 @@
1
1
  module WeBridge
2
2
  module AutoViewHelper
3
- VERSION = "0.0.4"
3
+ VERSION = "0.0.5"
4
4
  end
5
5
  end
@@ -16,6 +16,51 @@ module WeBridge
16
16
  @default_options = options
17
17
  end
18
18
 
19
+ def index_common records,options
20
+ options = WeBridge::AutoViewHelper.default_options.merge options.symbolize_keys
21
+
22
+ show_path = options[:show_path]
23
+ edit_path = options[:edit_path]
24
+ new_path = options[:new_path]
25
+ destroy_path = options[:destroy_path] || show_path
26
+ root_path = options[:root_path]
27
+ back_path = options[:back_path]
28
+ title = options[:title]
29
+
30
+ locale = options[:locale]
31
+ model = options[:model] || records.try(:first).try(:class)
32
+
33
+ markup do |m|
34
+ m.h1 title || 'Listing ' + model.try(:table_name).to_s
35
+ m.table do
36
+ m.thead do
37
+ m.tr do
38
+ m.th
39
+ m.th
40
+ m.th
41
+ m.th
42
+ end
43
+ end
44
+ m.tbody do
45
+ records.each do |record|
46
+ m.tr do
47
+ m.td record.try(:__display__) || record.to_s
48
+ m.td { m << link_to('Show', show_path.try(:call, record) || show_path) }
49
+ m.td { m << link_to('Edit', edit_path.try(:call, record) || edit_path) }
50
+ m.td { m << link_to('Destroy', destroy_path.try(:call, record) || destroy_path, data: { confirm: 'Are you sure?' }, method: :delete) }
51
+ end
52
+ end
53
+ end
54
+ end
55
+
56
+ if new_path
57
+ m.div do
58
+ m << link_to('New Lang', new_path)
59
+ end
60
+ end
61
+ end
62
+ end
63
+
19
64
  def edit_common(record,url,options={})
20
65
  self._form_common(record,url,{method: :patch}.merge(options))
21
66
  end
@@ -122,8 +167,6 @@ module WeBridge
122
167
  markup do |m|
123
168
  m.dl class: :table do
124
169
  method_names = model.try(:showable_methods) || model.content_columns.map(&:name)
125
-
126
- m.div method_names.inspect
127
170
  method_names.each do |mn|
128
171
  m.dt t_xxx(record.class.table_name,mn)
129
172
  m.dd { m << display_tag(mn,record) }
@@ -140,7 +183,7 @@ module WeBridge
140
183
  mns.each do |mn|
141
184
  m.div class: lang.code do
142
185
  m.dt t_xxx(record.class.text.table_name,mn)
143
- m.dd { m << (show_tag(mn,text) || "N/A") }
186
+ m.dd { m << (display_tag(mn,text) || "N/A") }
144
187
  end
145
188
  end
146
189
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: we_bridge-auto_view_helper
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shinjiro Itagaki