brightcontent-core 2.0.30 → 2.0.31
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/Gemfile.lock +69 -82
- data/app/assets/javascripts/brightcontent/brightcontent.js +0 -1
- data/app/assets/javascripts/brightcontent/main.js +4 -3
- data/app/assets/stylesheets/brightcontent/main.css +16 -1
- data/app/controllers/brightcontent/admin_users_controller.rb +3 -0
- data/app/controllers/brightcontent/application_controller.rb +3 -3
- data/app/controllers/brightcontent/base_controller.rb +7 -5
- data/app/helpers/brightcontent/base_helper.rb +9 -2
- data/app/views/brightcontent/application/_menu.html.erb +2 -2
- data/app/views/brightcontent/application/_show_flash_names.html.erb +1 -1
- data/app/views/brightcontent/base/_form.html.erb +12 -5
- data/app/views/brightcontent/base/_list_actions.html.erb +2 -2
- data/app/views/brightcontent/base/edit.html.erb +1 -1
- data/app/views/brightcontent/base/index.csv.erb +1 -1
- data/app/views/brightcontent/base/index.html.erb +2 -2
- data/app/views/brightcontent/fields/_file.html.erb +6 -0
- data/brightcontent-core.gemspec +2 -2
- data/config/locales/brightcontent.en.yml +10 -0
- data/config/locales/brightcontent.nl.yml +10 -0
- data/lib/brightcontent/default_actions.rb +11 -3
- data/lib/brightcontent/routes_parser.rb +23 -9
- data/spec/dummy/app/controllers/brightcontent/comments_controller.rb +3 -0
- data/spec/dummy/app/models/blog.rb +1 -0
- data/spec/dummy/app/models/comment.rb +3 -0
- data/spec/dummy/config/routes.rb +3 -1
- data/spec/dummy/db/migrate/20130720211920_create_comments.rb +12 -0
- data/spec/dummy/db/schema.rb +10 -1
- data/spec/dummy/test/fixtures/comments.yml +11 -0
- data/spec/dummy/test/unit/comments_test.rb +7 -0
- data/spec/factories.rb +1 -1
- data/spec/features/nested_resource_spec.rb +50 -0
- data/spec/features/resources_index_spec.rb +1 -1
- data/spec/lib/brightcontent/routes_parser_spec.rb +13 -8
- metadata +52 -74
- data/lib/brightcontent/strong_params_fix.rb +0 -16
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA1:
|
|
3
|
+
metadata.gz: b14c5e3e5868779efe399929d61b1c1b6370865d
|
|
4
|
+
data.tar.gz: 042f496e3c714b54896d95ee48a02a173d29fc63
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 567b8186b474923724f93b6a681fe72bad14432bd9ec2f6f04d4c171a6585a4e20e5a42318a1aca3f1ecf00f7bce3aeea119d0bc6bd9f08fd624cde9d9e85be3
|
|
7
|
+
data.tar.gz: c55958d7cf3394301a00cf52c2d1866b838fcf1a31e88662f06516aa80baf36e38b16e696debf651a0d9a9d85fc756ed8e1406b3f8b31b0caa3ad369d5efd842
|
data/Gemfile.lock
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
brightcontent-core (2.0.
|
|
5
|
-
bcrypt-ruby
|
|
4
|
+
brightcontent-core (2.0.31)
|
|
5
|
+
bcrypt-ruby (= 3.0.0)
|
|
6
6
|
bootstrap-wysihtml5-rails
|
|
7
7
|
has_scope
|
|
8
8
|
inherited_resources
|
|
9
9
|
jquery-rails
|
|
10
|
-
rails (~> 3.2.
|
|
10
|
+
rails (~> 3.2.13)
|
|
11
11
|
simple_form
|
|
12
12
|
strong_parameters
|
|
13
13
|
will_paginate
|
|
@@ -15,124 +15,112 @@ PATH
|
|
|
15
15
|
GEM
|
|
16
16
|
remote: http://rubygems.org/
|
|
17
17
|
specs:
|
|
18
|
-
actionmailer (3.2.
|
|
19
|
-
actionpack (= 3.2.
|
|
20
|
-
mail (~> 2.
|
|
21
|
-
actionpack (3.2.
|
|
22
|
-
activemodel (= 3.2.
|
|
23
|
-
activesupport (= 3.2.
|
|
18
|
+
actionmailer (3.2.13)
|
|
19
|
+
actionpack (= 3.2.13)
|
|
20
|
+
mail (~> 2.5.3)
|
|
21
|
+
actionpack (3.2.13)
|
|
22
|
+
activemodel (= 3.2.13)
|
|
23
|
+
activesupport (= 3.2.13)
|
|
24
24
|
builder (~> 3.0.0)
|
|
25
25
|
erubis (~> 2.7.0)
|
|
26
26
|
journey (~> 1.0.4)
|
|
27
|
-
rack (~> 1.4.
|
|
27
|
+
rack (~> 1.4.5)
|
|
28
28
|
rack-cache (~> 1.2)
|
|
29
29
|
rack-test (~> 0.6.1)
|
|
30
30
|
sprockets (~> 2.2.1)
|
|
31
|
-
activemodel (3.2.
|
|
32
|
-
activesupport (= 3.2.
|
|
31
|
+
activemodel (3.2.13)
|
|
32
|
+
activesupport (= 3.2.13)
|
|
33
33
|
builder (~> 3.0.0)
|
|
34
|
-
activerecord (3.2.
|
|
35
|
-
activemodel (= 3.2.
|
|
36
|
-
activesupport (= 3.2.
|
|
34
|
+
activerecord (3.2.13)
|
|
35
|
+
activemodel (= 3.2.13)
|
|
36
|
+
activesupport (= 3.2.13)
|
|
37
37
|
arel (~> 3.0.2)
|
|
38
38
|
tzinfo (~> 0.3.29)
|
|
39
|
-
activeresource (3.2.
|
|
40
|
-
activemodel (= 3.2.
|
|
41
|
-
activesupport (= 3.2.
|
|
42
|
-
activesupport (3.2.
|
|
43
|
-
i18n (
|
|
39
|
+
activeresource (3.2.13)
|
|
40
|
+
activemodel (= 3.2.13)
|
|
41
|
+
activesupport (= 3.2.13)
|
|
42
|
+
activesupport (3.2.13)
|
|
43
|
+
i18n (= 0.6.1)
|
|
44
44
|
multi_json (~> 1.0)
|
|
45
|
-
addressable (2.3.
|
|
45
|
+
addressable (2.3.5)
|
|
46
46
|
arel (3.0.2)
|
|
47
|
-
bcrypt-ruby (3.0.
|
|
48
|
-
bootstrap-wysihtml5-rails (0.3.1.
|
|
47
|
+
bcrypt-ruby (3.0.0)
|
|
48
|
+
bootstrap-wysihtml5-rails (0.3.1.20)
|
|
49
49
|
railties (>= 3.0)
|
|
50
50
|
builder (3.0.4)
|
|
51
|
-
capybara (2.0
|
|
51
|
+
capybara (2.1.0)
|
|
52
52
|
mime-types (>= 1.16)
|
|
53
53
|
nokogiri (>= 1.3.3)
|
|
54
54
|
rack (>= 1.0.0)
|
|
55
55
|
rack-test (>= 0.5.4)
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
childprocess (0.3.6)
|
|
59
|
-
ffi (~> 1.0, >= 1.0.6)
|
|
60
|
-
diff-lcs (1.1.3)
|
|
56
|
+
xpath (~> 2.0)
|
|
57
|
+
diff-lcs (1.2.4)
|
|
61
58
|
erubis (2.7.0)
|
|
62
|
-
factory_girl (4.
|
|
59
|
+
factory_girl (4.2.0)
|
|
63
60
|
activesupport (>= 3.0.0)
|
|
64
|
-
factory_girl_rails (4.1
|
|
65
|
-
factory_girl (~> 4.
|
|
61
|
+
factory_girl_rails (4.2.1)
|
|
62
|
+
factory_girl (~> 4.2.0)
|
|
66
63
|
railties (>= 3.0.0)
|
|
67
|
-
ffi (1.2.0)
|
|
68
64
|
has_scope (0.5.1)
|
|
69
|
-
hike (1.2.
|
|
65
|
+
hike (1.2.3)
|
|
70
66
|
i18n (0.6.1)
|
|
71
|
-
inherited_resources (1.
|
|
67
|
+
inherited_resources (1.4.0)
|
|
72
68
|
has_scope (~> 0.5.0)
|
|
73
|
-
responders (~> 0.
|
|
69
|
+
responders (~> 0.9)
|
|
74
70
|
journey (1.0.4)
|
|
75
|
-
jquery-rails (
|
|
71
|
+
jquery-rails (3.0.4)
|
|
76
72
|
railties (>= 3.0, < 5.0)
|
|
77
73
|
thor (>= 0.14, < 2.0)
|
|
78
|
-
json (1.
|
|
79
|
-
launchy (2.
|
|
74
|
+
json (1.8.0)
|
|
75
|
+
launchy (2.3.0)
|
|
80
76
|
addressable (~> 2.3)
|
|
81
|
-
|
|
82
|
-
addressable
|
|
83
|
-
websocket
|
|
84
|
-
mail (2.4.4)
|
|
85
|
-
i18n (>= 0.4.0)
|
|
77
|
+
mail (2.5.4)
|
|
86
78
|
mime-types (~> 1.16)
|
|
87
79
|
treetop (~> 1.4.8)
|
|
88
|
-
mime-types (1.
|
|
89
|
-
|
|
90
|
-
|
|
80
|
+
mime-types (1.23)
|
|
81
|
+
mini_portile (0.5.1)
|
|
82
|
+
multi_json (1.7.7)
|
|
83
|
+
nokogiri (1.6.0)
|
|
84
|
+
mini_portile (~> 0.5.0)
|
|
91
85
|
polyglot (0.3.3)
|
|
92
|
-
rack (1.4.
|
|
86
|
+
rack (1.4.5)
|
|
93
87
|
rack-cache (1.2)
|
|
94
88
|
rack (>= 0.4)
|
|
95
|
-
rack-ssl (1.3.
|
|
89
|
+
rack-ssl (1.3.3)
|
|
96
90
|
rack
|
|
97
91
|
rack-test (0.6.2)
|
|
98
92
|
rack (>= 1.0)
|
|
99
|
-
rails (3.2.
|
|
100
|
-
actionmailer (= 3.2.
|
|
101
|
-
actionpack (= 3.2.
|
|
102
|
-
activerecord (= 3.2.
|
|
103
|
-
activeresource (= 3.2.
|
|
104
|
-
activesupport (= 3.2.
|
|
93
|
+
rails (3.2.13)
|
|
94
|
+
actionmailer (= 3.2.13)
|
|
95
|
+
actionpack (= 3.2.13)
|
|
96
|
+
activerecord (= 3.2.13)
|
|
97
|
+
activeresource (= 3.2.13)
|
|
98
|
+
activesupport (= 3.2.13)
|
|
105
99
|
bundler (~> 1.0)
|
|
106
|
-
railties (= 3.2.
|
|
107
|
-
railties (3.2.
|
|
108
|
-
actionpack (= 3.2.
|
|
109
|
-
activesupport (= 3.2.
|
|
100
|
+
railties (= 3.2.13)
|
|
101
|
+
railties (3.2.13)
|
|
102
|
+
actionpack (= 3.2.13)
|
|
103
|
+
activesupport (= 3.2.13)
|
|
110
104
|
rack-ssl (~> 1.3.2)
|
|
111
105
|
rake (>= 0.8.7)
|
|
112
106
|
rdoc (~> 3.4)
|
|
113
107
|
thor (>= 0.14.6, < 2.0)
|
|
114
|
-
rake (10.0
|
|
115
|
-
rdoc (3.12)
|
|
108
|
+
rake (10.1.0)
|
|
109
|
+
rdoc (3.12.2)
|
|
116
110
|
json (~> 1.4)
|
|
117
111
|
responders (0.9.3)
|
|
118
112
|
railties (~> 3.1)
|
|
119
|
-
rspec-core (2.
|
|
120
|
-
rspec-expectations (2.
|
|
121
|
-
diff-lcs (
|
|
122
|
-
rspec-mocks (2.
|
|
123
|
-
rspec-rails (2.
|
|
113
|
+
rspec-core (2.14.3)
|
|
114
|
+
rspec-expectations (2.14.0)
|
|
115
|
+
diff-lcs (>= 1.1.3, < 2.0)
|
|
116
|
+
rspec-mocks (2.14.1)
|
|
117
|
+
rspec-rails (2.14.0)
|
|
124
118
|
actionpack (>= 3.0)
|
|
125
119
|
activesupport (>= 3.0)
|
|
126
120
|
railties (>= 3.0)
|
|
127
|
-
rspec-core (~> 2.
|
|
128
|
-
rspec-expectations (~> 2.
|
|
129
|
-
rspec-mocks (~> 2.
|
|
130
|
-
rubyzip (0.9.9)
|
|
131
|
-
selenium-webdriver (2.27.2)
|
|
132
|
-
childprocess (>= 0.2.5)
|
|
133
|
-
libwebsocket (~> 0.1.3)
|
|
134
|
-
multi_json (~> 1.0)
|
|
135
|
-
rubyzip
|
|
121
|
+
rspec-core (~> 2.14.0)
|
|
122
|
+
rspec-expectations (~> 2.14.0)
|
|
123
|
+
rspec-mocks (~> 2.14.0)
|
|
136
124
|
simple_form (2.1.0)
|
|
137
125
|
actionpack (~> 3.0)
|
|
138
126
|
activemodel (~> 3.0)
|
|
@@ -141,20 +129,19 @@ GEM
|
|
|
141
129
|
multi_json (~> 1.0)
|
|
142
130
|
rack (~> 1.0)
|
|
143
131
|
tilt (~> 1.1, != 1.3.0)
|
|
144
|
-
sqlite3 (1.3.
|
|
145
|
-
strong_parameters (0.2.
|
|
132
|
+
sqlite3 (1.3.7)
|
|
133
|
+
strong_parameters (0.2.1)
|
|
146
134
|
actionpack (~> 3.0)
|
|
147
135
|
activemodel (~> 3.0)
|
|
148
136
|
railties (~> 3.0)
|
|
149
|
-
thor (0.
|
|
150
|
-
tilt (1.
|
|
151
|
-
treetop (1.4.
|
|
137
|
+
thor (0.18.1)
|
|
138
|
+
tilt (1.4.1)
|
|
139
|
+
treetop (1.4.14)
|
|
152
140
|
polyglot
|
|
153
141
|
polyglot (>= 0.3.1)
|
|
154
142
|
tzinfo (0.3.37)
|
|
155
|
-
websocket (1.0.6)
|
|
156
143
|
will_paginate (3.0.4)
|
|
157
|
-
xpath (
|
|
144
|
+
xpath (2.0.0)
|
|
158
145
|
nokogiri (~> 1.3)
|
|
159
146
|
|
|
160
147
|
PLATFORMS
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
$(document).ready(function(){
|
|
2
|
-
$('textarea').each(function(i, elem) {
|
|
2
|
+
$('textarea[name*="content"], textarea[name*="body"], textarea[name*="editor"]').each(function(i, elem) {
|
|
3
3
|
$(elem).wysihtml5({
|
|
4
4
|
html: true,
|
|
5
5
|
locale: "nl-NL",
|
|
6
|
+
parserRules: wysihtml5ParserRules,
|
|
6
7
|
"events": {
|
|
7
8
|
"load": function() {
|
|
8
9
|
editor = $('#insertable').data("wysihtml5").editor;
|
|
@@ -12,13 +13,13 @@ $(document).ready(function(){
|
|
|
12
13
|
});
|
|
13
14
|
});
|
|
14
15
|
|
|
15
|
-
$("
|
|
16
|
+
$("#attachments").on("click", ".insert_image", function(e){
|
|
16
17
|
e.preventDefault();
|
|
17
18
|
console.log($(this).data("insertImage"));
|
|
18
19
|
editor.composer.commands.exec("insertImage", { src: $(this).data("insertImage") });
|
|
19
20
|
});
|
|
20
21
|
|
|
21
|
-
$("
|
|
22
|
+
$("#attachments").on("click", ".insert_link", function(e){
|
|
22
23
|
e.preventDefault();
|
|
23
24
|
console.log($(this).data());
|
|
24
25
|
editor.composer.commands.exec("createLink", { href: $(this).data("insertUrl"), target: "_blank", rel: "nofollow", text: $(this).data("insertName") });
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/*=require pages */
|
|
2
1
|
body {
|
|
3
2
|
background-color: #f5f5f5;
|
|
4
3
|
}
|
|
@@ -9,6 +8,10 @@ body {
|
|
|
9
8
|
max-width: 622px;
|
|
10
9
|
}
|
|
11
10
|
|
|
11
|
+
.form-inputs input[type=checkbox] {
|
|
12
|
+
width: auto;
|
|
13
|
+
}
|
|
14
|
+
|
|
12
15
|
.btn-right {
|
|
13
16
|
float: right;
|
|
14
17
|
}
|
|
@@ -78,3 +81,15 @@ td.list-actions {
|
|
|
78
81
|
overflow: hidden;
|
|
79
82
|
padding: 5px 10px;
|
|
80
83
|
}
|
|
84
|
+
|
|
85
|
+
.file-preview img {
|
|
86
|
+
border: 1px solid #ccc;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
.delete {
|
|
90
|
+
float: right;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
select.datetime {
|
|
94
|
+
width: 116px
|
|
95
|
+
}
|
|
@@ -9,10 +9,10 @@ module Brightcontent
|
|
|
9
9
|
end
|
|
10
10
|
helper_method :current_user
|
|
11
11
|
|
|
12
|
-
def
|
|
13
|
-
@
|
|
12
|
+
def user_resources
|
|
13
|
+
@user_resources ||= RoutesParser.new.resources
|
|
14
14
|
end
|
|
15
|
-
helper_method :
|
|
15
|
+
helper_method :user_resources
|
|
16
16
|
|
|
17
17
|
def authorize
|
|
18
18
|
redirect_to login_url if current_user.nil?
|
|
@@ -10,10 +10,11 @@ module Brightcontent
|
|
|
10
10
|
include DefaultActions
|
|
11
11
|
include Pagination
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
def permitted_params
|
|
14
|
+
params.permit!
|
|
15
|
+
end
|
|
15
16
|
|
|
16
|
-
|
|
17
|
+
protected
|
|
17
18
|
|
|
18
19
|
def list_fields
|
|
19
20
|
default_fields - %w{attachments}
|
|
@@ -30,9 +31,10 @@ module Brightcontent
|
|
|
30
31
|
end
|
|
31
32
|
helper_method :default_fields
|
|
32
33
|
|
|
33
|
-
def
|
|
34
|
-
|
|
34
|
+
def parent
|
|
35
|
+
super if parent?
|
|
35
36
|
end
|
|
37
|
+
helper_method :parent
|
|
36
38
|
|
|
37
39
|
end
|
|
38
40
|
end
|
|
@@ -5,13 +5,15 @@ module Brightcontent
|
|
|
5
5
|
end
|
|
6
6
|
|
|
7
7
|
def render_form_field(form, field)
|
|
8
|
-
render_if_exists("form_field_#{field}", form: form, item: form.object) ||
|
|
8
|
+
render_if_exists("form_field_#{field}", form: form, item: form.object) ||
|
|
9
|
+
render_if_exists("brightcontent/fields/#{field_type(form, field)}", form: form, item: form.object, field: field) ||
|
|
10
|
+
form.input(field.to_sym)
|
|
9
11
|
end
|
|
10
12
|
|
|
11
13
|
def link_for_scope(scope)
|
|
12
14
|
case scope[:type]
|
|
13
15
|
when :boolean
|
|
14
|
-
polymorphic_url(resource_class, scope[:as] => true)
|
|
16
|
+
polymorphic_url([parent, resource_class], scope[:as] => true)
|
|
15
17
|
end
|
|
16
18
|
end
|
|
17
19
|
|
|
@@ -22,5 +24,10 @@ module Brightcontent
|
|
|
22
24
|
rescue ActionView::MissingTemplate
|
|
23
25
|
nil
|
|
24
26
|
end
|
|
27
|
+
|
|
28
|
+
def field_type(form, field)
|
|
29
|
+
column = form.send(:find_attribute_column, field)
|
|
30
|
+
form.send(:default_input_type, field, column, {})
|
|
31
|
+
end
|
|
25
32
|
end
|
|
26
33
|
end
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
<%
|
|
2
|
-
<li><%= link_to
|
|
1
|
+
<% user_resources.each do |resource| %>
|
|
2
|
+
<li><%= link_to resource.klass.model_name.human.pluralize, root_path + resource.path %></li>
|
|
3
3
|
<% end %>
|
|
@@ -1,10 +1,17 @@
|
|
|
1
|
-
<%= simple_form_for resource do |form|
|
|
1
|
+
<%= simple_form_for [parent, resource] do |form| -%>
|
|
2
2
|
<%= form.error_notification %>
|
|
3
3
|
|
|
4
4
|
<div class="form-inputs">
|
|
5
|
-
<% form_fields.each do |form_field|
|
|
6
|
-
<%= render_form_field(form, form_field)
|
|
7
|
-
<% end
|
|
5
|
+
<% form_fields.each do |form_field| -%>
|
|
6
|
+
<%= render_form_field(form, form_field) -%>
|
|
7
|
+
<% end -%>
|
|
8
8
|
</div>
|
|
9
|
+
|
|
9
10
|
<%= form.button :submit, class: "btn btn-primary" %>
|
|
10
|
-
|
|
11
|
+
<%= form.button :submit, "Save and continue", :name => "commit_and_continue" %>
|
|
12
|
+
|
|
13
|
+
<% unless resource.new_record? -%>
|
|
14
|
+
<%= link_to "Delete", [parent, resource], :class => "btn btn-danger delete", :method => :delete, :data => { :confirm => 'Are you sure?' } %>
|
|
15
|
+
<% end -%>
|
|
16
|
+
|
|
17
|
+
<% end -%>
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
<%= link_to "Edit",
|
|
2
|
-
<%= link_to "Delete",
|
|
1
|
+
<%= link_to "Edit", [:edit, parent, item], class: "btn btn-mini btn-primary" %>
|
|
2
|
+
<%= link_to "Delete", [parent, item], class: "btn btn-mini", confirm: 'Are you sure?', method: :delete %>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<div id="overview">
|
|
2
2
|
|
|
3
|
-
<%= link_to "Create new #{resource_instance_name.to_s.humanize}", polymorphic_url(resource_class, action: :new), class: "btn btn-primary btn-right" %>
|
|
4
|
-
<h1><%=
|
|
3
|
+
<%= link_to "Create new #{resource_instance_name.to_s.humanize}", polymorphic_url([parent, resource_class], action: :new), class: "btn btn-primary btn-right" %>
|
|
4
|
+
<h1><%= resource_class.model_name.human.pluralize %></h1>
|
|
5
5
|
|
|
6
6
|
<%= render "scope_filters" if scopes_configuration %>
|
|
7
7
|
<%= render "index_top" %>
|
data/brightcontent-core.gemspec
CHANGED
|
@@ -15,9 +15,9 @@ Gem::Specification.new do |s|
|
|
|
15
15
|
s.test_files = `git ls-files -- spec/*`.split("\n")
|
|
16
16
|
s.require_paths = ["lib"]
|
|
17
17
|
|
|
18
|
-
s.add_dependency "rails", "~> 3.2.
|
|
18
|
+
s.add_dependency "rails", "~> 3.2.13"
|
|
19
19
|
s.add_dependency "jquery-rails"
|
|
20
|
-
s.add_dependency "bcrypt-ruby"
|
|
20
|
+
s.add_dependency "bcrypt-ruby", "3.0.0"
|
|
21
21
|
s.add_dependency "inherited_resources"
|
|
22
22
|
s.add_dependency "has_scope"
|
|
23
23
|
s.add_dependency "simple_form"
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
en:
|
|
2
|
+
flash:
|
|
3
|
+
actions:
|
|
4
|
+
create:
|
|
5
|
+
notice: '%{resource_name} was successfully created.'
|
|
6
|
+
update:
|
|
7
|
+
notice: '%{resource_name} was successfully updated.'
|
|
8
|
+
destroy:
|
|
9
|
+
notice: '%{resource_name} was successfully destroyed.'
|
|
10
|
+
alert: '%{resource_name} could not be destroyed.'
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
nl:
|
|
2
|
+
flash:
|
|
3
|
+
actions:
|
|
4
|
+
create:
|
|
5
|
+
notice: '%{resource_name} was successfully created.'
|
|
6
|
+
update:
|
|
7
|
+
notice: '%{resource_name} was successfully updated.'
|
|
8
|
+
destroy:
|
|
9
|
+
notice: '%{resource_name} was successfully destroyed.'
|
|
10
|
+
alert: '%{resource_name} could not be destroyed.'
|
|
@@ -5,15 +5,23 @@ module Brightcontent
|
|
|
5
5
|
end
|
|
6
6
|
|
|
7
7
|
def create
|
|
8
|
-
|
|
8
|
+
if params["commit_and_continue"].present?
|
|
9
|
+
create! { [parent, resource] }
|
|
10
|
+
else
|
|
11
|
+
create! { [parent, resource_class] }
|
|
12
|
+
end
|
|
9
13
|
end
|
|
10
14
|
|
|
11
15
|
def update
|
|
12
|
-
|
|
16
|
+
if params["commit_and_continue"].present?
|
|
17
|
+
update! { [parent, resource] }
|
|
18
|
+
else
|
|
19
|
+
update! { [parent, resource_class] }
|
|
20
|
+
end
|
|
13
21
|
end
|
|
14
22
|
|
|
15
23
|
def destroy
|
|
16
|
-
destroy! {
|
|
24
|
+
destroy! { [parent, resource_class] }
|
|
17
25
|
end
|
|
18
26
|
end
|
|
19
27
|
end
|
|
@@ -3,31 +3,45 @@ require 'active_support/inflector'
|
|
|
3
3
|
module Brightcontent
|
|
4
4
|
class RoutesParser
|
|
5
5
|
|
|
6
|
-
def self.parse(routes_hash=nil, engine_resources=nil)
|
|
7
|
-
new(routes_hash, engine_resources).user_resource
|
|
8
|
-
end
|
|
9
|
-
|
|
10
6
|
def initialize(routes_hash=nil, engine_resources=nil)
|
|
11
7
|
@routes_hash = routes_hash
|
|
12
8
|
@engine_resources = engine_resources
|
|
13
9
|
end
|
|
14
10
|
|
|
15
|
-
def
|
|
16
|
-
resource_names - engine_resources
|
|
11
|
+
def resources
|
|
12
|
+
(resource_names - engine_resources).map do |name|
|
|
13
|
+
Resource.new(name)
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
class Resource < Struct.new(:path)
|
|
18
|
+
def klass
|
|
19
|
+
path.classify.constantize
|
|
20
|
+
rescue
|
|
21
|
+
"Brightcontent::#{path.classify}".constantize
|
|
22
|
+
end
|
|
17
23
|
end
|
|
18
24
|
|
|
19
25
|
private
|
|
20
26
|
|
|
21
27
|
def resource_names
|
|
22
28
|
routes_hash.map do |route|
|
|
23
|
-
|
|
24
|
-
|
|
29
|
+
next unless route && route[:controller] && route[:path_spec]
|
|
30
|
+
name = route[:controller].match(/brightcontent\/(.+)/)[1]
|
|
31
|
+
if route[:action] == "index" && route[:path_spec].start_with?('/' + name)
|
|
32
|
+
name
|
|
25
33
|
end
|
|
26
34
|
end.compact.uniq
|
|
27
35
|
end
|
|
28
36
|
|
|
29
37
|
def routes_hash
|
|
30
|
-
@routes_hash ||= Engine.routes.routes.map
|
|
38
|
+
@routes_hash ||= Engine.routes.routes.map do |r|
|
|
39
|
+
{
|
|
40
|
+
controller: r.defaults[:controller],
|
|
41
|
+
action: r.defaults[:action],
|
|
42
|
+
path_spec: r.path.spec.to_s
|
|
43
|
+
}
|
|
44
|
+
end
|
|
31
45
|
end
|
|
32
46
|
|
|
33
47
|
def engine_resources
|
data/spec/dummy/config/routes.rb
CHANGED
data/spec/dummy/db/schema.rb
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
#
|
|
12
12
|
# It's strongly recommended to check this file into your version control system.
|
|
13
13
|
|
|
14
|
-
ActiveRecord::Schema.define(:version =>
|
|
14
|
+
ActiveRecord::Schema.define(:version => 20130720211920) do
|
|
15
15
|
|
|
16
16
|
create_table "blogs", :force => true do |t|
|
|
17
17
|
t.string "name"
|
|
@@ -28,4 +28,13 @@ ActiveRecord::Schema.define(:version => 20121223131824) do
|
|
|
28
28
|
t.datetime "updated_at", :null => false
|
|
29
29
|
end
|
|
30
30
|
|
|
31
|
+
create_table "comments", :force => true do |t|
|
|
32
|
+
t.text "text"
|
|
33
|
+
t.integer "blog_id"
|
|
34
|
+
t.datetime "created_at", :null => false
|
|
35
|
+
t.datetime "updated_at", :null => false
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
add_index "comments", ["blog_id"], :name => "index_comments_on_blog_id"
|
|
39
|
+
|
|
31
40
|
end
|
data/spec/factories.rb
CHANGED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
feature "Nested resource" do
|
|
4
|
+
background { sign_in }
|
|
5
|
+
let!(:blog) { create(:blog) }
|
|
6
|
+
|
|
7
|
+
scenario "add new nested resource item" do
|
|
8
|
+
create_comment "Name for Commenty"
|
|
9
|
+
page.should have_content "Name for Commenty"
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
scenario "edit nested resource item" do
|
|
13
|
+
create_comment "Name for Commenty"
|
|
14
|
+
update_comment "Name for Commenty", "New Commentz name"
|
|
15
|
+
page.should have_content "New Commentz name"
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
scenario "Removes an nested resource item" do
|
|
19
|
+
create_comment "Name for Commenty"
|
|
20
|
+
remove_comment "Name for Commenty"
|
|
21
|
+
page.should_not have_content "Name for Commenty"
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def create_comment(title)
|
|
25
|
+
visit brightcontent.blog_comments_path(blog)
|
|
26
|
+
click_link "Create new Comment"
|
|
27
|
+
fill_in "Text", with: title
|
|
28
|
+
click_button "Create Comment"
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def update_comment(title, new_title)
|
|
32
|
+
within_comment_item(title) { click_link "Edit" }
|
|
33
|
+
fill_in "Text", with: new_title
|
|
34
|
+
click_button "Update Comment"
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
def remove_comment(title)
|
|
38
|
+
within_comment_item(title) do
|
|
39
|
+
click_link "Delete"
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
def within_comment_item(title)
|
|
44
|
+
comment = Comment.find_by_text!(title)
|
|
45
|
+
within "#comment_#{comment.id}" do
|
|
46
|
+
yield
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
end
|
|
@@ -5,17 +5,18 @@ module Brightcontent
|
|
|
5
5
|
let(:engine_resources) { %w{sessions admin_users} }
|
|
6
6
|
let(:routes_hash) do
|
|
7
7
|
[ {}, nil, {:action=>"admin"},
|
|
8
|
-
{:action=>"index", :controller=>"brightcontent/blogs"},
|
|
9
|
-
{:action=>"create", :controller=>"brightcontent/blogs"}
|
|
8
|
+
{:action=>"index", :controller=>"brightcontent/blogs", :path_spec => '/blogs(.:format)'},
|
|
9
|
+
{:action=>"create", :controller=>"brightcontent/blogs", :path_spec => '/blogs(.:format)'},
|
|
10
|
+
{:controller=>"brightcontent/comments", :action=>"show", :path_spec=>"/blogs/:blog_id/comments/:id(.:format)"}]
|
|
10
11
|
end
|
|
11
12
|
|
|
12
|
-
subject(:parser) { RoutesParser.
|
|
13
|
+
subject(:parser) { RoutesParser.new(routes_hash, engine_resources) }
|
|
13
14
|
|
|
14
|
-
|
|
15
|
+
its(:resources) { should eq [resource("blogs")] }
|
|
15
16
|
|
|
16
17
|
context "with extra resource" do
|
|
17
|
-
before { routes_hash << {:action=>"index", :controller=>"brightcontent/articles"} }
|
|
18
|
-
|
|
18
|
+
before { routes_hash << {:action=>"index", :controller=>"brightcontent/articles", :path_spec => '/articles' } }
|
|
19
|
+
its(:resources) { should eq [resource("blogs"), resource("articles")] }
|
|
19
20
|
end
|
|
20
21
|
|
|
21
22
|
context "with engine resources" do
|
|
@@ -24,7 +25,7 @@ module Brightcontent
|
|
|
24
25
|
routes_hash << {:action=>"index", :controller=>"brightcontent/#{resource_name}"}
|
|
25
26
|
end
|
|
26
27
|
end
|
|
27
|
-
|
|
28
|
+
its(:resources) { should eq [resource("blogs")] }
|
|
28
29
|
end
|
|
29
30
|
|
|
30
31
|
context "duplicate resources" do
|
|
@@ -32,7 +33,11 @@ module Brightcontent
|
|
|
32
33
|
routes_hash << {action: "index", controller: "brightcontent/blogs" }
|
|
33
34
|
end
|
|
34
35
|
|
|
35
|
-
|
|
36
|
+
its(:resources) { should eq [resource("blogs")] }
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
def resource(path)
|
|
40
|
+
RoutesParser::Resource.new(path)
|
|
36
41
|
end
|
|
37
42
|
|
|
38
43
|
end
|
metadata
CHANGED
|
@@ -1,238 +1,209 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: brightcontent-core
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.0.
|
|
5
|
-
prerelease:
|
|
4
|
+
version: 2.0.31
|
|
6
5
|
platform: ruby
|
|
7
6
|
authors:
|
|
8
7
|
- Developers at Brightin
|
|
9
8
|
autorequire:
|
|
10
9
|
bindir: bin
|
|
11
10
|
cert_chain: []
|
|
12
|
-
date: 2013-
|
|
11
|
+
date: 2013-07-20 00:00:00.000000000 Z
|
|
13
12
|
dependencies:
|
|
14
13
|
- !ruby/object:Gem::Dependency
|
|
15
14
|
name: rails
|
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
|
17
|
-
none: false
|
|
18
16
|
requirements:
|
|
19
17
|
- - ~>
|
|
20
18
|
- !ruby/object:Gem::Version
|
|
21
|
-
version: 3.2.
|
|
19
|
+
version: 3.2.13
|
|
22
20
|
type: :runtime
|
|
23
21
|
prerelease: false
|
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
|
25
|
-
none: false
|
|
26
23
|
requirements:
|
|
27
24
|
- - ~>
|
|
28
25
|
- !ruby/object:Gem::Version
|
|
29
|
-
version: 3.2.
|
|
26
|
+
version: 3.2.13
|
|
30
27
|
- !ruby/object:Gem::Dependency
|
|
31
28
|
name: jquery-rails
|
|
32
29
|
requirement: !ruby/object:Gem::Requirement
|
|
33
|
-
none: false
|
|
34
30
|
requirements:
|
|
35
|
-
- -
|
|
31
|
+
- - '>='
|
|
36
32
|
- !ruby/object:Gem::Version
|
|
37
33
|
version: '0'
|
|
38
34
|
type: :runtime
|
|
39
35
|
prerelease: false
|
|
40
36
|
version_requirements: !ruby/object:Gem::Requirement
|
|
41
|
-
none: false
|
|
42
37
|
requirements:
|
|
43
|
-
- -
|
|
38
|
+
- - '>='
|
|
44
39
|
- !ruby/object:Gem::Version
|
|
45
40
|
version: '0'
|
|
46
41
|
- !ruby/object:Gem::Dependency
|
|
47
42
|
name: bcrypt-ruby
|
|
48
43
|
requirement: !ruby/object:Gem::Requirement
|
|
49
|
-
none: false
|
|
50
44
|
requirements:
|
|
51
|
-
- -
|
|
45
|
+
- - '='
|
|
52
46
|
- !ruby/object:Gem::Version
|
|
53
|
-
version:
|
|
47
|
+
version: 3.0.0
|
|
54
48
|
type: :runtime
|
|
55
49
|
prerelease: false
|
|
56
50
|
version_requirements: !ruby/object:Gem::Requirement
|
|
57
|
-
none: false
|
|
58
51
|
requirements:
|
|
59
|
-
- -
|
|
52
|
+
- - '='
|
|
60
53
|
- !ruby/object:Gem::Version
|
|
61
|
-
version:
|
|
54
|
+
version: 3.0.0
|
|
62
55
|
- !ruby/object:Gem::Dependency
|
|
63
56
|
name: inherited_resources
|
|
64
57
|
requirement: !ruby/object:Gem::Requirement
|
|
65
|
-
none: false
|
|
66
58
|
requirements:
|
|
67
|
-
- -
|
|
59
|
+
- - '>='
|
|
68
60
|
- !ruby/object:Gem::Version
|
|
69
61
|
version: '0'
|
|
70
62
|
type: :runtime
|
|
71
63
|
prerelease: false
|
|
72
64
|
version_requirements: !ruby/object:Gem::Requirement
|
|
73
|
-
none: false
|
|
74
65
|
requirements:
|
|
75
|
-
- -
|
|
66
|
+
- - '>='
|
|
76
67
|
- !ruby/object:Gem::Version
|
|
77
68
|
version: '0'
|
|
78
69
|
- !ruby/object:Gem::Dependency
|
|
79
70
|
name: has_scope
|
|
80
71
|
requirement: !ruby/object:Gem::Requirement
|
|
81
|
-
none: false
|
|
82
72
|
requirements:
|
|
83
|
-
- -
|
|
73
|
+
- - '>='
|
|
84
74
|
- !ruby/object:Gem::Version
|
|
85
75
|
version: '0'
|
|
86
76
|
type: :runtime
|
|
87
77
|
prerelease: false
|
|
88
78
|
version_requirements: !ruby/object:Gem::Requirement
|
|
89
|
-
none: false
|
|
90
79
|
requirements:
|
|
91
|
-
- -
|
|
80
|
+
- - '>='
|
|
92
81
|
- !ruby/object:Gem::Version
|
|
93
82
|
version: '0'
|
|
94
83
|
- !ruby/object:Gem::Dependency
|
|
95
84
|
name: simple_form
|
|
96
85
|
requirement: !ruby/object:Gem::Requirement
|
|
97
|
-
none: false
|
|
98
86
|
requirements:
|
|
99
|
-
- -
|
|
87
|
+
- - '>='
|
|
100
88
|
- !ruby/object:Gem::Version
|
|
101
89
|
version: '0'
|
|
102
90
|
type: :runtime
|
|
103
91
|
prerelease: false
|
|
104
92
|
version_requirements: !ruby/object:Gem::Requirement
|
|
105
|
-
none: false
|
|
106
93
|
requirements:
|
|
107
|
-
- -
|
|
94
|
+
- - '>='
|
|
108
95
|
- !ruby/object:Gem::Version
|
|
109
96
|
version: '0'
|
|
110
97
|
- !ruby/object:Gem::Dependency
|
|
111
98
|
name: will_paginate
|
|
112
99
|
requirement: !ruby/object:Gem::Requirement
|
|
113
|
-
none: false
|
|
114
100
|
requirements:
|
|
115
|
-
- -
|
|
101
|
+
- - '>='
|
|
116
102
|
- !ruby/object:Gem::Version
|
|
117
103
|
version: '0'
|
|
118
104
|
type: :runtime
|
|
119
105
|
prerelease: false
|
|
120
106
|
version_requirements: !ruby/object:Gem::Requirement
|
|
121
|
-
none: false
|
|
122
107
|
requirements:
|
|
123
|
-
- -
|
|
108
|
+
- - '>='
|
|
124
109
|
- !ruby/object:Gem::Version
|
|
125
110
|
version: '0'
|
|
126
111
|
- !ruby/object:Gem::Dependency
|
|
127
112
|
name: bootstrap-wysihtml5-rails
|
|
128
113
|
requirement: !ruby/object:Gem::Requirement
|
|
129
|
-
none: false
|
|
130
114
|
requirements:
|
|
131
|
-
- -
|
|
115
|
+
- - '>='
|
|
132
116
|
- !ruby/object:Gem::Version
|
|
133
117
|
version: '0'
|
|
134
118
|
type: :runtime
|
|
135
119
|
prerelease: false
|
|
136
120
|
version_requirements: !ruby/object:Gem::Requirement
|
|
137
|
-
none: false
|
|
138
121
|
requirements:
|
|
139
|
-
- -
|
|
122
|
+
- - '>='
|
|
140
123
|
- !ruby/object:Gem::Version
|
|
141
124
|
version: '0'
|
|
142
125
|
- !ruby/object:Gem::Dependency
|
|
143
126
|
name: strong_parameters
|
|
144
127
|
requirement: !ruby/object:Gem::Requirement
|
|
145
|
-
none: false
|
|
146
128
|
requirements:
|
|
147
|
-
- -
|
|
129
|
+
- - '>='
|
|
148
130
|
- !ruby/object:Gem::Version
|
|
149
131
|
version: '0'
|
|
150
132
|
type: :runtime
|
|
151
133
|
prerelease: false
|
|
152
134
|
version_requirements: !ruby/object:Gem::Requirement
|
|
153
|
-
none: false
|
|
154
135
|
requirements:
|
|
155
|
-
- -
|
|
136
|
+
- - '>='
|
|
156
137
|
- !ruby/object:Gem::Version
|
|
157
138
|
version: '0'
|
|
158
139
|
- !ruby/object:Gem::Dependency
|
|
159
140
|
name: sqlite3
|
|
160
141
|
requirement: !ruby/object:Gem::Requirement
|
|
161
|
-
none: false
|
|
162
142
|
requirements:
|
|
163
|
-
- -
|
|
143
|
+
- - '>='
|
|
164
144
|
- !ruby/object:Gem::Version
|
|
165
145
|
version: '0'
|
|
166
146
|
type: :development
|
|
167
147
|
prerelease: false
|
|
168
148
|
version_requirements: !ruby/object:Gem::Requirement
|
|
169
|
-
none: false
|
|
170
149
|
requirements:
|
|
171
|
-
- -
|
|
150
|
+
- - '>='
|
|
172
151
|
- !ruby/object:Gem::Version
|
|
173
152
|
version: '0'
|
|
174
153
|
- !ruby/object:Gem::Dependency
|
|
175
154
|
name: rspec-rails
|
|
176
155
|
requirement: !ruby/object:Gem::Requirement
|
|
177
|
-
none: false
|
|
178
156
|
requirements:
|
|
179
|
-
- -
|
|
157
|
+
- - '>='
|
|
180
158
|
- !ruby/object:Gem::Version
|
|
181
159
|
version: '0'
|
|
182
160
|
type: :development
|
|
183
161
|
prerelease: false
|
|
184
162
|
version_requirements: !ruby/object:Gem::Requirement
|
|
185
|
-
none: false
|
|
186
163
|
requirements:
|
|
187
|
-
- -
|
|
164
|
+
- - '>='
|
|
188
165
|
- !ruby/object:Gem::Version
|
|
189
166
|
version: '0'
|
|
190
167
|
- !ruby/object:Gem::Dependency
|
|
191
168
|
name: capybara
|
|
192
169
|
requirement: !ruby/object:Gem::Requirement
|
|
193
|
-
none: false
|
|
194
170
|
requirements:
|
|
195
|
-
- -
|
|
171
|
+
- - '>='
|
|
196
172
|
- !ruby/object:Gem::Version
|
|
197
173
|
version: '0'
|
|
198
174
|
type: :development
|
|
199
175
|
prerelease: false
|
|
200
176
|
version_requirements: !ruby/object:Gem::Requirement
|
|
201
|
-
none: false
|
|
202
177
|
requirements:
|
|
203
|
-
- -
|
|
178
|
+
- - '>='
|
|
204
179
|
- !ruby/object:Gem::Version
|
|
205
180
|
version: '0'
|
|
206
181
|
- !ruby/object:Gem::Dependency
|
|
207
182
|
name: launchy
|
|
208
183
|
requirement: !ruby/object:Gem::Requirement
|
|
209
|
-
none: false
|
|
210
184
|
requirements:
|
|
211
|
-
- -
|
|
185
|
+
- - '>='
|
|
212
186
|
- !ruby/object:Gem::Version
|
|
213
187
|
version: '0'
|
|
214
188
|
type: :development
|
|
215
189
|
prerelease: false
|
|
216
190
|
version_requirements: !ruby/object:Gem::Requirement
|
|
217
|
-
none: false
|
|
218
191
|
requirements:
|
|
219
|
-
- -
|
|
192
|
+
- - '>='
|
|
220
193
|
- !ruby/object:Gem::Version
|
|
221
194
|
version: '0'
|
|
222
195
|
- !ruby/object:Gem::Dependency
|
|
223
196
|
name: factory_girl_rails
|
|
224
197
|
requirement: !ruby/object:Gem::Requirement
|
|
225
|
-
none: false
|
|
226
198
|
requirements:
|
|
227
|
-
- -
|
|
199
|
+
- - '>='
|
|
228
200
|
- !ruby/object:Gem::Version
|
|
229
201
|
version: '0'
|
|
230
202
|
type: :development
|
|
231
203
|
prerelease: false
|
|
232
204
|
version_requirements: !ruby/object:Gem::Requirement
|
|
233
|
-
none: false
|
|
234
205
|
requirements:
|
|
235
|
-
- -
|
|
206
|
+
- - '>='
|
|
236
207
|
- !ruby/object:Gem::Version
|
|
237
208
|
version: '0'
|
|
238
209
|
description: Brightcontent core
|
|
@@ -276,12 +247,15 @@ files:
|
|
|
276
247
|
- app/views/brightcontent/base/index.csv.erb
|
|
277
248
|
- app/views/brightcontent/base/index.html.erb
|
|
278
249
|
- app/views/brightcontent/base/new.html.erb
|
|
250
|
+
- app/views/brightcontent/fields/_file.html.erb
|
|
279
251
|
- app/views/brightcontent/sessions/new.html.erb
|
|
280
252
|
- app/views/layouts/brightcontent/application.html.erb
|
|
281
253
|
- brightcontent-core.gemspec
|
|
282
254
|
- config/initializers/simple_form.rb
|
|
283
255
|
- config/initializers/simple_form_bootstrap.rb
|
|
284
256
|
- config/initializers/will_paginate.rb
|
|
257
|
+
- config/locales/brightcontent.en.yml
|
|
258
|
+
- config/locales/brightcontent.nl.yml
|
|
285
259
|
- config/routes.rb
|
|
286
260
|
- db/migrate/20121206121725_create_brightcontent_admin_users.rb
|
|
287
261
|
- lib/brightcontent-core.rb
|
|
@@ -292,7 +266,6 @@ files:
|
|
|
292
266
|
- lib/brightcontent/pagination.rb
|
|
293
267
|
- lib/brightcontent/rails/routes.rb
|
|
294
268
|
- lib/brightcontent/routes_parser.rb
|
|
295
|
-
- lib/brightcontent/strong_params_fix.rb
|
|
296
269
|
- lib/generators/brightcontent/install_generator.rb
|
|
297
270
|
- lib/generators/brightcontent/resource_generator.rb
|
|
298
271
|
- lib/generators/brightcontent/templates/brightcontent_controller.rb
|
|
@@ -306,11 +279,13 @@ files:
|
|
|
306
279
|
- spec/dummy/app/assets/stylesheets/brightcontent/custom.css
|
|
307
280
|
- spec/dummy/app/controllers/application_controller.rb
|
|
308
281
|
- spec/dummy/app/controllers/brightcontent/blogs_controller.rb
|
|
282
|
+
- spec/dummy/app/controllers/brightcontent/comments_controller.rb
|
|
309
283
|
- spec/dummy/app/controllers/pages_controller.rb
|
|
310
284
|
- spec/dummy/app/helpers/application_helper.rb
|
|
311
285
|
- spec/dummy/app/mailers/.gitkeep
|
|
312
286
|
- spec/dummy/app/models/.gitkeep
|
|
313
287
|
- spec/dummy/app/models/blog.rb
|
|
288
|
+
- spec/dummy/app/models/comment.rb
|
|
314
289
|
- spec/dummy/app/views/layouts/application.html.erb
|
|
315
290
|
- spec/dummy/app/views/pages/index.html.erb
|
|
316
291
|
- spec/dummy/config.ru
|
|
@@ -333,6 +308,7 @@ files:
|
|
|
333
308
|
- spec/dummy/config/routes.rb
|
|
334
309
|
- spec/dummy/db/migrate/20121206225720_create_blogs.rb
|
|
335
310
|
- spec/dummy/db/migrate/20121223131824_add_featured_to_blog.rb
|
|
311
|
+
- spec/dummy/db/migrate/20130720211920_create_comments.rb
|
|
336
312
|
- spec/dummy/db/schema.rb
|
|
337
313
|
- spec/dummy/lib/assets/.gitkeep
|
|
338
314
|
- spec/dummy/public/404.html
|
|
@@ -340,10 +316,13 @@ files:
|
|
|
340
316
|
- spec/dummy/public/500.html
|
|
341
317
|
- spec/dummy/public/favicon.ico
|
|
342
318
|
- spec/dummy/script/rails
|
|
319
|
+
- spec/dummy/test/fixtures/comments.yml
|
|
320
|
+
- spec/dummy/test/unit/comments_test.rb
|
|
343
321
|
- spec/factories.rb
|
|
344
322
|
- spec/features/export_spec.rb
|
|
345
323
|
- spec/features/login_spec.rb
|
|
346
324
|
- spec/features/menu_spec.rb
|
|
325
|
+
- spec/features/nested_resource_spec.rb
|
|
347
326
|
- spec/features/resources_form_spec.rb
|
|
348
327
|
- spec/features/resources_index_spec.rb
|
|
349
328
|
- spec/features/scope_spec.rb
|
|
@@ -353,33 +332,26 @@ files:
|
|
|
353
332
|
- spec/support/acceptance_helper.rb
|
|
354
333
|
homepage: http://brightin.nl
|
|
355
334
|
licenses: []
|
|
335
|
+
metadata: {}
|
|
356
336
|
post_install_message:
|
|
357
337
|
rdoc_options: []
|
|
358
338
|
require_paths:
|
|
359
339
|
- lib
|
|
360
340
|
required_ruby_version: !ruby/object:Gem::Requirement
|
|
361
|
-
none: false
|
|
362
341
|
requirements:
|
|
363
|
-
- -
|
|
342
|
+
- - '>='
|
|
364
343
|
- !ruby/object:Gem::Version
|
|
365
344
|
version: '0'
|
|
366
|
-
segments:
|
|
367
|
-
- 0
|
|
368
|
-
hash: -1318734726726849324
|
|
369
345
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
370
|
-
none: false
|
|
371
346
|
requirements:
|
|
372
|
-
- -
|
|
347
|
+
- - '>='
|
|
373
348
|
- !ruby/object:Gem::Version
|
|
374
349
|
version: '0'
|
|
375
|
-
segments:
|
|
376
|
-
- 0
|
|
377
|
-
hash: -1318734726726849324
|
|
378
350
|
requirements: []
|
|
379
351
|
rubyforge_project:
|
|
380
|
-
rubygems_version:
|
|
352
|
+
rubygems_version: 2.0.2
|
|
381
353
|
signing_key:
|
|
382
|
-
specification_version:
|
|
354
|
+
specification_version: 4
|
|
383
355
|
summary: Brightcontent core
|
|
384
356
|
test_files:
|
|
385
357
|
- spec/dummy/README.rdoc
|
|
@@ -390,11 +362,13 @@ test_files:
|
|
|
390
362
|
- spec/dummy/app/assets/stylesheets/brightcontent/custom.css
|
|
391
363
|
- spec/dummy/app/controllers/application_controller.rb
|
|
392
364
|
- spec/dummy/app/controllers/brightcontent/blogs_controller.rb
|
|
365
|
+
- spec/dummy/app/controllers/brightcontent/comments_controller.rb
|
|
393
366
|
- spec/dummy/app/controllers/pages_controller.rb
|
|
394
367
|
- spec/dummy/app/helpers/application_helper.rb
|
|
395
368
|
- spec/dummy/app/mailers/.gitkeep
|
|
396
369
|
- spec/dummy/app/models/.gitkeep
|
|
397
370
|
- spec/dummy/app/models/blog.rb
|
|
371
|
+
- spec/dummy/app/models/comment.rb
|
|
398
372
|
- spec/dummy/app/views/layouts/application.html.erb
|
|
399
373
|
- spec/dummy/app/views/pages/index.html.erb
|
|
400
374
|
- spec/dummy/config.ru
|
|
@@ -417,6 +391,7 @@ test_files:
|
|
|
417
391
|
- spec/dummy/config/routes.rb
|
|
418
392
|
- spec/dummy/db/migrate/20121206225720_create_blogs.rb
|
|
419
393
|
- spec/dummy/db/migrate/20121223131824_add_featured_to_blog.rb
|
|
394
|
+
- spec/dummy/db/migrate/20130720211920_create_comments.rb
|
|
420
395
|
- spec/dummy/db/schema.rb
|
|
421
396
|
- spec/dummy/lib/assets/.gitkeep
|
|
422
397
|
- spec/dummy/public/404.html
|
|
@@ -424,10 +399,13 @@ test_files:
|
|
|
424
399
|
- spec/dummy/public/500.html
|
|
425
400
|
- spec/dummy/public/favicon.ico
|
|
426
401
|
- spec/dummy/script/rails
|
|
402
|
+
- spec/dummy/test/fixtures/comments.yml
|
|
403
|
+
- spec/dummy/test/unit/comments_test.rb
|
|
427
404
|
- spec/factories.rb
|
|
428
405
|
- spec/features/export_spec.rb
|
|
429
406
|
- spec/features/login_spec.rb
|
|
430
407
|
- spec/features/menu_spec.rb
|
|
408
|
+
- spec/features/nested_resource_spec.rb
|
|
431
409
|
- spec/features/resources_form_spec.rb
|
|
432
410
|
- spec/features/resources_index_spec.rb
|
|
433
411
|
- spec/features/scope_spec.rb
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
module Brightcontent
|
|
2
|
-
module StrongParamsFix
|
|
3
|
-
|
|
4
|
-
def build_resource
|
|
5
|
-
get_resource_ivar || set_resource_ivar(end_of_association_chain.send(method_for_build, params_for_build))
|
|
6
|
-
end
|
|
7
|
-
|
|
8
|
-
def params_for_build
|
|
9
|
-
request.get? ? {} : resource_params
|
|
10
|
-
end
|
|
11
|
-
|
|
12
|
-
def update_resource(object, attributes)
|
|
13
|
-
object.update_attributes(attributes)
|
|
14
|
-
end
|
|
15
|
-
end
|
|
16
|
-
end
|