brightcontent-core 2.0.6 → 2.0.7
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +1 -1
- data/app/assets/javascripts/brightcontent/brightcontent.js +2 -0
- data/app/controllers/brightcontent/base_controller.rb +1 -1
- data/lib/brightcontent/core.rb +1 -0
- data/lib/brightcontent/engine.rb +6 -0
- data/lib/brightcontent/model_extensions.rb +15 -0
- data/spec/dummy/app/models/blog.rb +0 -1
- data/spec/lib/brightcontent/model_extensions_spec.rb +15 -0
- metadata +7 -4
data/Gemfile.lock
CHANGED
data/lib/brightcontent/core.rb
CHANGED
@@ -14,6 +14,7 @@ module Brightcontent
|
|
14
14
|
autoload :PageMethods, 'brightcontent/page_methods'
|
15
15
|
autoload :RoutesParser, 'brightcontent/routes_parser'
|
16
16
|
autoload :DefaultActions, 'brightcontent/default_actions'
|
17
|
+
autoload :ModelExtensions, 'brightcontent/model_extensions'
|
17
18
|
|
18
19
|
mattr_accessor :engine_resources
|
19
20
|
@@engine_resources = %w{sessions admin_users}
|
data/lib/brightcontent/engine.rb
CHANGED
@@ -5,5 +5,11 @@ module Brightcontent
|
|
5
5
|
initializer "Brightcontent precompile hook", :group => :all do |app|
|
6
6
|
app.config.assets.precompile += ['brightcontent/brightcontent.js', 'brightcontent/brightcontent.css']
|
7
7
|
end
|
8
|
+
|
9
|
+
initializer "Add ActiveRecord column" do
|
10
|
+
ActiveSupport.on_load(:active_record) do
|
11
|
+
include ModelExtensions
|
12
|
+
end
|
13
|
+
end
|
8
14
|
end
|
9
15
|
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module Brightcontent
|
2
|
+
module ModelExtensions
|
3
|
+
extend ActiveSupport::Concern
|
4
|
+
|
5
|
+
module ClassMethods
|
6
|
+
def brightcontent_columns
|
7
|
+
@brightcontent_columns ||= column_names.dup
|
8
|
+
end
|
9
|
+
|
10
|
+
def add_brightcontent_column(column_name)
|
11
|
+
brightcontent_columns.append(column_name.to_s)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module Brightcontent
|
4
|
+
describe ModelExtensions do
|
5
|
+
let(:columns) { ["id", "name", "body", "created_at", "updated_at", "featured"] }
|
6
|
+
subject(:blog) { Blog }
|
7
|
+
its(:brightcontent_columns) { should eq columns }
|
8
|
+
|
9
|
+
context "with extra method" do
|
10
|
+
before { Blog.add_brightcontent_column("test_column") }
|
11
|
+
its(:brightcontent_columns) { should eq columns + ["test_column"] }
|
12
|
+
its(:column_names) { should eq columns }
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: brightcontent-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.7
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-12-
|
12
|
+
date: 2012-12-28 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
@@ -270,6 +270,7 @@ files:
|
|
270
270
|
- lib/brightcontent/core.rb
|
271
271
|
- lib/brightcontent/default_actions.rb
|
272
272
|
- lib/brightcontent/engine.rb
|
273
|
+
- lib/brightcontent/model_extensions.rb
|
273
274
|
- lib/brightcontent/pagination.rb
|
274
275
|
- lib/brightcontent/rails/routes.rb
|
275
276
|
- lib/brightcontent/routes_parser.rb
|
@@ -325,6 +326,7 @@ files:
|
|
325
326
|
- spec/features/resources_form_spec.rb
|
326
327
|
- spec/features/resources_index_spec.rb
|
327
328
|
- spec/features/scope_spec.rb
|
329
|
+
- spec/lib/brightcontent/model_extensions_spec.rb
|
328
330
|
- spec/lib/brightcontent/routes_parser_spec.rb
|
329
331
|
- spec/spec_helper.rb
|
330
332
|
- spec/support/acceptance_helper.rb
|
@@ -342,7 +344,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
342
344
|
version: '0'
|
343
345
|
segments:
|
344
346
|
- 0
|
345
|
-
hash:
|
347
|
+
hash: 139995493775042415
|
346
348
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
347
349
|
none: false
|
348
350
|
requirements:
|
@@ -351,7 +353,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
351
353
|
version: '0'
|
352
354
|
segments:
|
353
355
|
- 0
|
354
|
-
hash:
|
356
|
+
hash: 139995493775042415
|
355
357
|
requirements: []
|
356
358
|
rubyforge_project:
|
357
359
|
rubygems_version: 1.8.24
|
@@ -406,6 +408,7 @@ test_files:
|
|
406
408
|
- spec/features/resources_form_spec.rb
|
407
409
|
- spec/features/resources_index_spec.rb
|
408
410
|
- spec/features/scope_spec.rb
|
411
|
+
- spec/lib/brightcontent/model_extensions_spec.rb
|
409
412
|
- spec/lib/brightcontent/routes_parser_spec.rb
|
410
413
|
- spec/spec_helper.rb
|
411
414
|
- spec/support/acceptance_helper.rb
|