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 CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- brightcontent-core (2.0.6)
4
+ brightcontent-core (2.0.7)
5
5
  bcrypt-ruby
6
6
  bootstrap-wysihtml5-rails
7
7
  has_scope
@@ -15,3 +15,5 @@
15
15
  //= require bootstrap-wysihtml5
16
16
  //= require bootstrap-wysihtml5/locales/nl-NL
17
17
  //= require brightcontent/attachments
18
+ //= require brightcontent/main
19
+ //= require brightcontent/custom
@@ -21,7 +21,7 @@ module Brightcontent
21
21
  helper_method :form_fields
22
22
 
23
23
  def default_fields
24
- resource_class.column_names - %w{id created_at updated_at password_digest}
24
+ resource_class.brightcontent_columns - %w{id created_at updated_at password_digest}
25
25
  end
26
26
 
27
27
  end
@@ -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}
@@ -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
@@ -1,5 +1,4 @@
1
1
  class Blog < ActiveRecord::Base
2
2
  attr_accessible :body, :name, :featured
3
-
4
3
  scope :featured, where(:featured => true)
5
4
  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.6
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-27 00:00:00.000000000 Z
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: 4143562847390699843
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: 4143562847390699843
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