we_bridge-auto_view_helper 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +1 -0
- data/lib/we_bridge/auto_view_helper.rb +21 -4
- data/lib/we_bridge/auto_view_helper/version.rb +1 -1
- data/we_bridge-auto_view_helper.gemspec +1 -0
- metadata +15 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d3b825fa2add1ad6c39417b59028ca47ff4446a1
|
4
|
+
data.tar.gz: 03c2d5c6c75eba90d07a6883a60446d5e24f2586
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 806852cfb7ffddd9f02c1d1a97593eee1dd988e8da3d6a436da854550a7640c765c5bf5df41d78e382de0502ca7bb7cf7b85df401bd039944f09e5c2814ad093
|
7
|
+
data.tar.gz: 3e59aeb512ad79eda54cb80d48ea2019ca9f1df7846ae466b4222f8de2db6ff6c82a68ed055ad4d7b99533fc9a9905cd0cac0a03287cfce23601a46b2ceb73af
|
data/Gemfile
CHANGED
@@ -9,7 +9,7 @@ module WeBridge
|
|
9
9
|
end
|
10
10
|
|
11
11
|
def self.default_options
|
12
|
-
@default_options ? @default_options.dup : {show_path: nil, edit_path: nil, new_path: nil, root_path: '/', locale: ::I18n.default_locale}
|
12
|
+
@default_options ? @default_options.dup : {show_path: nil, edit_path: nil, new_path: nil, back_path: nil, root_path: '/', locale: ::I18n.default_locale}
|
13
13
|
end
|
14
14
|
|
15
15
|
def self.default_options=(options)
|
@@ -17,10 +17,21 @@ module WeBridge
|
|
17
17
|
end
|
18
18
|
|
19
19
|
def edit_common(record,url,options={})
|
20
|
+
self._form_common(record,url,options)
|
21
|
+
end
|
22
|
+
|
23
|
+
def new_common(record,url,options={})
|
24
|
+
self._form_common(record,url,{title: "New " + record.class.name }.merge(options))
|
25
|
+
end
|
26
|
+
|
27
|
+
def _form_common(record,url,options={})
|
20
28
|
options = WeBridge::AutoViewHelper.default_options.merge options.symbolize_keys
|
21
29
|
|
22
30
|
show_path = options[:show_path]
|
23
31
|
root_path = options[:root_path]
|
32
|
+
back_path = options[:back_path]
|
33
|
+
title = options[:title]
|
34
|
+
|
24
35
|
locale = options[:locale]
|
25
36
|
|
26
37
|
title ||= "Edit " + record.class.name
|
@@ -45,7 +56,7 @@ module WeBridge
|
|
45
56
|
end
|
46
57
|
|
47
58
|
m2.div class: locale do
|
48
|
-
if record.respond_to?(:text) && (text = record.text(
|
59
|
+
if record.respond_to?(:text) && record.respond_to?(:text) && record.respond_to?(:texts) && (text = record.text(locale))
|
49
60
|
syms = []
|
50
61
|
if text.respond_to? :editable_columns
|
51
62
|
syms = text.editable_columns
|
@@ -55,13 +66,13 @@ module WeBridge
|
|
55
66
|
syms.each do |sym|
|
56
67
|
column = text.class.columns_hash[sym.to_s]
|
57
68
|
m2.dt t_xxx(text.class.table_name,sym)
|
58
|
-
m2.dd { m2 << text_tag(column.type,"#{text.class.table_name}[#{
|
69
|
+
m2.dd { m2 << text_tag(column.type,"#{text.class.table_name}[#{locale}][#{sym}]",text.__send__(sym)) }
|
59
70
|
end
|
60
71
|
end
|
61
72
|
end
|
62
73
|
end
|
63
74
|
m2 << submit_tag("Save")
|
64
|
-
end
|
75
|
+
end.html_safe
|
65
76
|
end
|
66
77
|
end
|
67
78
|
|
@@ -71,6 +82,12 @@ module WeBridge
|
|
71
82
|
end
|
72
83
|
end
|
73
84
|
|
85
|
+
if back_path
|
86
|
+
m.div do
|
87
|
+
m.a "Back", href: back_path
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
74
91
|
if root_path
|
75
92
|
m.div do
|
76
93
|
m.a "Top", href: root_path
|
@@ -29,6 +29,7 @@ Gem::Specification.new do |spec|
|
|
29
29
|
|
30
30
|
spec.add_dependency 'actionview'
|
31
31
|
spec.add_dependency 'actionview-helpers-auto_tag_helper'
|
32
|
+
spec.add_dependency 'activerecord-mlang'
|
32
33
|
|
33
34
|
spec.add_development_dependency "bundler", "~> 1.10"
|
34
35
|
spec.add_development_dependency "rake", "~> 10.0"
|
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
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Shinjiro Itagaki
|
@@ -38,6 +38,20 @@ dependencies:
|
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: activerecord-mlang
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
41
55
|
- !ruby/object:Gem::Dependency
|
42
56
|
name: bundler
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|