we_bridge-auto_view_helper 0.0.7 → 0.0.9

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: 9408085ceb7907955e8bdca4951cd50e216821d0
4
- data.tar.gz: fad421b8ed9e532246df66b2e570a2a891473324
3
+ metadata.gz: cbba39712b7aace911121f61c465a5180dd8ad4f
4
+ data.tar.gz: 0017b27689dc7349d19526a6fec05f68f06d122f
5
5
  SHA512:
6
- metadata.gz: b0f019dcf3360713080b5a16117f3541923b69160645ccd6be976edf8c166bc401de4ce2dcc3354d1df6ae52cf246a5d6765472317519133d6632ec725a06863
7
- data.tar.gz: 87053fe753c752998b3c1d0afc409c4c9fa3cf60b492375c4ad0ce11722291bcb3ee546ba786d38f6bbb182f1ed8ac05bb3a2bd3eb7aa725d5f19e6bc623b03e
6
+ metadata.gz: 807839462020c4818f076db6a40a43942f389ae83f364837ecd6656eb8963cbd51d793dd145092aca38379832f22e6e7e72a263864db8d4e037579f49a998555
7
+ data.tar.gz: 81938e9707dda8ede9340616cc97938c899693dbf6be266661ec4a32649e4cd4ca3965356775f7ef4e87f34419a37900c26bbdcd8a109f9dae2b0cff2b04e488
data/.rspec CHANGED
@@ -1,2 +1,2 @@
1
- --format documentation
2
1
  --color
2
+ --require spec_helper
data/Gemfile CHANGED
@@ -6,3 +6,6 @@ gemspec
6
6
  gem 'actionview'
7
7
  gem 'activerecord-mlang'
8
8
  gem 'actionview-helpers-auto_tag_helper'
9
+ gem 'rspec'
10
+ gem 'rspec-rails'
11
+ gem 'sqlite3'
data/Gemfile.lock CHANGED
@@ -1,28 +1,47 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- we_bridge-auto_view_helper (0.1.0)
4
+ we_bridge-auto_view_helper (0.0.8)
5
5
  actionview
6
6
  actionview-helpers-auto_tag_helper
7
+ activerecord-mlang
7
8
 
8
9
  GEM
9
10
  remote: https://rubygems.org/
10
11
  specs:
12
+ actionpack (4.2.3)
13
+ actionview (= 4.2.3)
14
+ activesupport (= 4.2.3)
15
+ rack (~> 1.6)
16
+ rack-test (~> 0.6.2)
17
+ rails-dom-testing (~> 1.0, >= 1.0.5)
18
+ rails-html-sanitizer (~> 1.0, >= 1.0.2)
11
19
  actionview (4.2.3)
12
20
  activesupport (= 4.2.3)
13
21
  builder (~> 3.1)
14
22
  erubis (~> 2.7.0)
15
23
  rails-dom-testing (~> 1.0, >= 1.0.5)
16
24
  rails-html-sanitizer (~> 1.0, >= 1.0.2)
17
- actionview-helpers-auto_tag_helper (0.1.1)
25
+ actionview-helpers-auto_tag_helper (0.1.2)
18
26
  actionview
19
27
  activesupport (>= 4.2.3)
28
+ activemodel (4.2.3)
29
+ activesupport (= 4.2.3)
30
+ builder (~> 3.1)
31
+ activerecord (4.2.3)
32
+ activemodel (= 4.2.3)
33
+ activesupport (= 4.2.3)
34
+ arel (~> 6.0)
35
+ activerecord-mlang (0.0.6)
36
+ activerecord
37
+ i18n
20
38
  activesupport (4.2.3)
21
39
  i18n (~> 0.7)
22
40
  json (~> 1.7, >= 1.7.7)
23
41
  minitest (~> 5.1)
24
42
  thread_safe (~> 0.3, >= 0.3.4)
25
43
  tzinfo (~> 1.1)
44
+ arel (6.0.3)
26
45
  builder (3.2.2)
27
46
  diff-lcs (1.2.5)
28
47
  erubis (2.7.0)
@@ -31,9 +50,12 @@ GEM
31
50
  loofah (2.0.2)
32
51
  nokogiri (>= 1.5.9)
33
52
  mini_portile (0.6.2)
34
- minitest (5.7.0)
53
+ minitest (5.8.0)
35
54
  nokogiri (1.6.6.2)
36
55
  mini_portile (~> 0.6.0)
56
+ rack (1.6.4)
57
+ rack-test (0.6.3)
58
+ rack (>= 1.0)
37
59
  rails-deprecated_sanitizer (1.0.3)
38
60
  activesupport (>= 4.2.0.alpha)
39
61
  rails-dom-testing (1.0.6)
@@ -42,6 +64,11 @@ GEM
42
64
  rails-deprecated_sanitizer (>= 1.0.1)
43
65
  rails-html-sanitizer (1.0.2)
44
66
  loofah (~> 2.0)
67
+ railties (4.2.3)
68
+ actionpack (= 4.2.3)
69
+ activesupport (= 4.2.3)
70
+ rake (>= 0.8.7)
71
+ thor (>= 0.18.1, < 2.0)
45
72
  rake (10.4.2)
46
73
  rspec (3.3.0)
47
74
  rspec-core (~> 3.3.0)
@@ -55,7 +82,17 @@ GEM
55
82
  rspec-mocks (3.3.2)
56
83
  diff-lcs (>= 1.2.0, < 2.0)
57
84
  rspec-support (~> 3.3.0)
85
+ rspec-rails (3.3.3)
86
+ actionpack (>= 3.0, < 4.3)
87
+ activesupport (>= 3.0, < 4.3)
88
+ railties (>= 3.0, < 4.3)
89
+ rspec-core (~> 3.3.0)
90
+ rspec-expectations (~> 3.3.0)
91
+ rspec-mocks (~> 3.3.0)
92
+ rspec-support (~> 3.3.0)
58
93
  rspec-support (3.3.0)
94
+ sqlite3 (1.3.10)
95
+ thor (0.19.1)
59
96
  thread_safe (0.3.5)
60
97
  tzinfo (1.2.2)
61
98
  thread_safe (~> 0.1)
@@ -66,9 +103,12 @@ PLATFORMS
66
103
  DEPENDENCIES
67
104
  actionview
68
105
  actionview-helpers-auto_tag_helper
106
+ activerecord-mlang
69
107
  bundler (~> 1.10)
70
108
  rake (~> 10.0)
71
109
  rspec
110
+ rspec-rails
111
+ sqlite3
72
112
  we_bridge-auto_view_helper!
73
113
 
74
114
  BUNDLED WITH
@@ -55,7 +55,7 @@ module WeBridge
55
55
 
56
56
  if new_path
57
57
  m.div do
58
- m << link_to('New Lang', new_path)
58
+ m << link_to("New " + model.try(:table_name).to_s, new_path)
59
59
  end
60
60
  end
61
61
  end
@@ -64,7 +64,8 @@ module WeBridge
64
64
  flash[:notice]='Record was successfully updated.'
65
65
  redirect_to action: :show, id: @record.id
66
66
  end
67
- rescue
67
+ rescue => e
68
+ flash[:error]=e.message + e.backtrace.join("\n")
68
69
  redirect_to action: :edit, id: @record.id
69
70
  end
70
71
 
@@ -83,12 +84,17 @@ module WeBridge
83
84
 
84
85
  # Only allow a trusted parameter "white list" through.
85
86
  def record_params
86
- params.require(self.class.model.table_name).permit(*self.class.model.editable_columns)
87
+ column_names = self.class.model.try(:editable_columns) || self.class.model.content_columns.map(&:name)
88
+ params.require(self.class.model.table_name).permit(*column_names)
87
89
  end
88
90
 
89
91
  def record_text_params
90
- columns = self.class.model.text.editable_columns
91
- permit = Hash[*self.class.model.all.pluck(:code).map{|code| [code,columns] }.flatten(1)]
92
+ if !(text = self.class.model.try(:text))
93
+ return nil
94
+ end
95
+ columns = text.try(:editable_columns) || text.content_columns.map(&:name)
96
+ lang_model = ( defined?(Lang) ? Lang : ActiveRecord::Mlang::Lang )
97
+ permit = Hash[*lang_model.all.pluck(:code).map{|code| [code,columns] }.flatten(1)]
92
98
  params[self.class.model.text.table_name].try(:permit,permit)
93
99
  end
94
100
 
@@ -1,5 +1,5 @@
1
1
  module WeBridge
2
2
  module AutoViewHelper
3
- VERSION = "0.0.7"
3
+ VERSION = "0.0.9"
4
4
  end
5
5
  end
@@ -34,4 +34,6 @@ Gem::Specification.new do |spec|
34
34
  spec.add_development_dependency "bundler", "~> 1.10"
35
35
  spec.add_development_dependency "rake", "~> 10.0"
36
36
  spec.add_development_dependency "rspec"
37
+ spec.add_development_dependency "rspec-rails"
38
+ spec.add_development_dependency "sqlite3"
37
39
  end
metadata CHANGED
@@ -1,14 +1,14 @@
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.7
4
+ version: 0.0.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shinjiro Itagaki
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-08-09 00:00:00.000000000 Z
11
+ date: 2015-08-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: actionview
@@ -94,6 +94,34 @@ dependencies:
94
94
  - - ">="
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: rspec-rails
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: sqlite3
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
97
125
  description: helper used in we-bridge
98
126
  email:
99
127
  - ishinjiroster@gmail.com