dead_simple_cms 0.9.4 → 0.10.0
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.
- data/lib/dead_simple_cms.rb +6 -1
- data/lib/dead_simple_cms/attribute/type/base.rb +0 -1
- data/lib/dead_simple_cms/group.rb +6 -21
- data/lib/dead_simple_cms/group/configuration.rb +4 -6
- data/lib/dead_simple_cms/group/presenter/base.rb +29 -0
- data/lib/dead_simple_cms/group/presenter/render_mixin.rb +42 -0
- data/lib/dead_simple_cms/rack/section_refresher.rb +20 -0
- data/lib/dead_simple_cms/rails/railtie.rb +12 -0
- data/lib/dead_simple_cms/section.rb +5 -0
- data/lib/dead_simple_cms/version.rb +1 -1
- data/spec/dead_simple_cms/attribute/collection_spec.rb +4 -1
- data/spec/dead_simple_cms/attribute/type/all_spec.rb +2 -0
- data/spec/dead_simple_cms/attribute/type/base_spec.rb +18 -6
- data/spec/dead_simple_cms/group/presenter/render_mixin_spec.rb +49 -0
- data/spec/dead_simple_cms/group/presenter_spec.rb +1 -1
- data/spec/dead_simple_cms/group_spec.rb +4 -16
- data/spec/dead_simple_cms/section_spec.rb +9 -0
- data/spec/dead_simple_cms/util/identifier/dictionary_spec.rb +43 -19
- data/spec/setup/banner_presenter.rb +1 -1
- data/spec/setup/shared.rb +4 -3
- metadata +20 -15
- data/lib/dead_simple_cms/group/presenter.rb +0 -23
data/lib/dead_simple_cms.rb
CHANGED
@@ -29,7 +29,8 @@ require 'dead_simple_cms/attribute/type/all'
|
|
29
29
|
|
30
30
|
require 'dead_simple_cms/group'
|
31
31
|
require 'dead_simple_cms/group/configuration'
|
32
|
-
require 'dead_simple_cms/group/presenter'
|
32
|
+
require 'dead_simple_cms/group/presenter/base'
|
33
|
+
require 'dead_simple_cms/group/presenter/render_mixin'
|
33
34
|
|
34
35
|
require 'dead_simple_cms/section'
|
35
36
|
require 'dead_simple_cms/section/builder'
|
@@ -51,6 +52,10 @@ if defined?(ActionController)
|
|
51
52
|
require 'dead_simple_cms/rails/action_controller/fragment_sweeper'
|
52
53
|
end
|
53
54
|
|
55
|
+
if defined?(Rails)
|
56
|
+
require 'dead_simple_cms/rails/railtie'
|
57
|
+
end
|
58
|
+
|
54
59
|
module DeadSimpleCMS
|
55
60
|
|
56
61
|
extend self
|
@@ -5,7 +5,11 @@ module DeadSimpleCMS
|
|
5
5
|
|
6
6
|
ROOT_IDENTIFIER = :root
|
7
7
|
|
8
|
-
attr_reader :groups
|
8
|
+
attr_reader :groups
|
9
|
+
attr_accessor :parent
|
10
|
+
|
11
|
+
require 'dead_simple_cms/group/presenter/render_mixin'
|
12
|
+
include Presenter::RenderMixin
|
9
13
|
|
10
14
|
def initialize(identifier, options={})
|
11
15
|
@groups = DeadSimpleCMS::Group.new_dictionary
|
@@ -16,37 +20,18 @@ module DeadSimpleCMS
|
|
16
20
|
new(ROOT_IDENTIFIER)
|
17
21
|
end
|
18
22
|
|
19
|
-
# Public: Set different mechanisms for rendering this group.
|
20
|
-
def display(presenter_class=nil, &block)
|
21
|
-
@presenter_class = presenter_class
|
22
|
-
@render_proc = block
|
23
|
-
end
|
24
|
-
|
25
23
|
# Public: Exend functionality for the current group.
|
26
24
|
def extend(*modules, &block)
|
27
25
|
modules << Module.new(&block) if block_given?
|
28
26
|
super(*modules)
|
29
27
|
end
|
30
28
|
|
31
|
-
# Public: If a presenter class was specified, returns an instance of the presenter.
|
32
|
-
def presenter(view_context, *args)
|
33
|
-
@presenter_class.new(view_context, *args) if @presenter_class
|
34
|
-
end
|
35
|
-
|
36
|
-
# Public: Render the group using the passed in proc in the scope of the template.
|
37
|
-
def render(view_context, *args)
|
38
|
-
if @render_proc
|
39
|
-
view_context.instance_exec(self, *args, &@render_proc)
|
40
|
-
elsif presenter = presenter(view_context, self, *args)
|
41
|
-
presenter.render
|
42
|
-
end
|
43
|
-
end
|
44
|
-
|
45
29
|
def root?
|
46
30
|
identifier == ROOT_IDENTIFIER
|
47
31
|
end
|
48
32
|
|
49
33
|
def add_group(group)
|
34
|
+
group.parent = self
|
50
35
|
groups.add(group)
|
51
36
|
group_accessor(group)
|
52
37
|
end
|
@@ -4,7 +4,10 @@ module DeadSimpleCMS
|
|
4
4
|
|
5
5
|
include Util::Identifier
|
6
6
|
|
7
|
-
|
7
|
+
require 'dead_simple_cms/group/presenter/render_mixin'
|
8
|
+
include Presenter::RenderMixin
|
9
|
+
|
10
|
+
attr_reader :options, :attribute_arguments
|
8
11
|
|
9
12
|
def initialize(identifier, options={}, &block)
|
10
13
|
super(identifier, options)
|
@@ -13,11 +16,6 @@ module DeadSimpleCMS
|
|
13
16
|
instance_eval(&block)
|
14
17
|
end
|
15
18
|
|
16
|
-
def display(presenter_class=nil, &block)
|
17
|
-
@presenter_class = presenter_class if presenter_class
|
18
|
-
@render_proc = block if block_given?
|
19
|
-
end
|
20
|
-
|
21
19
|
def self.define_attribute_builder_method(klass)
|
22
20
|
class_eval <<-RUBY, __FILE__, __LINE__ + 1
|
23
21
|
def #{klass.builder_method_name}(identifier, options={})
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require 'delegate'
|
2
|
+
module DeadSimpleCMS
|
3
|
+
class Group
|
4
|
+
# Public: Presenter class used for rendering groups.
|
5
|
+
#
|
6
|
+
# Within the context of this group, you can call methods as if you were in the view_context.
|
7
|
+
module Presenter
|
8
|
+
class Base < SimpleDelegator
|
9
|
+
|
10
|
+
attr_reader :group
|
11
|
+
|
12
|
+
def initialize(view_context, group, *args)
|
13
|
+
@group = group
|
14
|
+
initialize_extra_arguments(*args)
|
15
|
+
super(view_context)
|
16
|
+
end
|
17
|
+
|
18
|
+
# Private: Initialize extra arguments for the presenter.
|
19
|
+
def initialize_extra_arguments(*args)
|
20
|
+
end
|
21
|
+
|
22
|
+
def render
|
23
|
+
raise(NotImplementedError, "Please define your own #render method.")
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
require 'delegate'
|
2
|
+
module DeadSimpleCMS
|
3
|
+
class Group
|
4
|
+
module Presenter
|
5
|
+
# Public: Module to add rendering of lambda and presenters for DeadSimpleCMS::Group.
|
6
|
+
module RenderMixin
|
7
|
+
|
8
|
+
def presenter_class
|
9
|
+
display if display.is_a?(Class) && display < Presenter::Base
|
10
|
+
end
|
11
|
+
|
12
|
+
def render_proc
|
13
|
+
display if display.is_a?(Proc)
|
14
|
+
end
|
15
|
+
|
16
|
+
# Public: Set different mechanisms for rendering this group.
|
17
|
+
def display(presenter_class_or_block=nil, &block)
|
18
|
+
@display = presenter_class_or_block if presenter_class_or_block
|
19
|
+
@display = block if block_given?
|
20
|
+
@display
|
21
|
+
end
|
22
|
+
|
23
|
+
# Public: Render the group using the passed in proc in the scope of the template.
|
24
|
+
#
|
25
|
+
# If you include this module in something other then a DeadSimpleCMS::Group, you can pass in the +group+ directly with
|
26
|
+
# the first argument:
|
27
|
+
#
|
28
|
+
# render([view_context, group], *args) # and also
|
29
|
+
# render(view_context, *args)
|
30
|
+
#
|
31
|
+
def render(view_context, *args)
|
32
|
+
view_context, group = view_context.is_a?(Array) ? view_context : [view_context, self]
|
33
|
+
case display
|
34
|
+
when Proc then view_context.instance_exec(group, *args, &display)
|
35
|
+
when Class then display.new(view_context, group, *args).render if display < Presenter::Base
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require 'rack'
|
2
|
+
module DeadSimpleCMS
|
3
|
+
module Rack
|
4
|
+
# Public: Refresh the DeadSimpleCMS values in between requests. Since DeadSimpleCMS stores all the attributes for a
|
5
|
+
# section in a serialized format, we cache the storage mechanism on a per-request basis to avoid unnecessary hits
|
6
|
+
# to the cache, whether it be Redis, Memcache, or the Database.
|
7
|
+
class SectionRefresher
|
8
|
+
|
9
|
+
def initialize(app, options = {})
|
10
|
+
@app = app
|
11
|
+
end
|
12
|
+
|
13
|
+
def call(env)
|
14
|
+
DeadSimpleCMS.sections.values.each(&:refresh!)
|
15
|
+
@app.call(env)
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
module DeadSimpleCMS
|
2
|
+
module Rails
|
3
|
+
class Railtie < ::Rails::Railtie
|
4
|
+
|
5
|
+
initializer "dead_simple_cms.section_refresher" do |app|
|
6
|
+
require 'dead_simple_cms/rack/section_refresher'
|
7
|
+
app.config.middleware.use(DeadSimpleCMS::Rack::SectionRefresher)
|
8
|
+
end
|
9
|
+
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
@@ -52,6 +52,11 @@ module DeadSimpleCMS
|
|
52
52
|
@storage ||= storage_class.new(self)
|
53
53
|
end
|
54
54
|
|
55
|
+
# Public: Clears out the storage so new values can be repopulated. Used primarily to clear the values between refreshes.
|
56
|
+
def refresh!
|
57
|
+
@storage = nil
|
58
|
+
end
|
59
|
+
|
55
60
|
# Public: Update the section values.
|
56
61
|
#
|
57
62
|
# Examples
|
@@ -29,7 +29,10 @@ describe DeadSimpleCMS::Attribute::Collection do
|
|
29
29
|
|
30
30
|
let(:string_attribute) { DeadSimpleCMS::Attribute::Type::String.new(:string_attr) }
|
31
31
|
|
32
|
-
before(:each)
|
32
|
+
before(:each) do
|
33
|
+
string_attribute.stub(:attributes_from_storage).and_return({})
|
34
|
+
subject.add_attribute(string_attribute)
|
35
|
+
end
|
33
36
|
|
34
37
|
it "should create a getter method" do
|
35
38
|
string_attribute.stub(:value).and_return("value")
|
@@ -215,8 +215,10 @@ describe DeadSimpleCMS::Attribute::Type::File do
|
|
215
215
|
end
|
216
216
|
|
217
217
|
before(:each) do
|
218
|
+
subject.stub(:attributes_from_storage).and_return({})
|
218
219
|
subject.uploader_class = file_uploader_class
|
219
220
|
end
|
221
|
+
|
220
222
|
it "should call upload!" do
|
221
223
|
subject.should_receive(:upload!).once
|
222
224
|
subject.upload!
|
@@ -21,6 +21,10 @@ describe DeadSimpleCMS::Attribute::Type::Base do
|
|
21
21
|
subject { fake_attribute_class.new(:fake_identifier, :label => "Fake Label", :default => 413, :hint => "some hint",
|
22
22
|
:group_hierarchy => group_hierarchy) }
|
23
23
|
|
24
|
+
before(:each) do
|
25
|
+
subject.stub(:attributes_from_storage).and_return({})
|
26
|
+
end
|
27
|
+
|
24
28
|
describe ".builder_method_name" do
|
25
29
|
it "should derive from the class name" do
|
26
30
|
fake_attribute_class.builder_method_name.should == "fake_attribute"
|
@@ -71,14 +75,22 @@ describe DeadSimpleCMS::Attribute::Type::Base do
|
|
71
75
|
|
72
76
|
describe "#value" do
|
73
77
|
|
74
|
-
context "when
|
75
|
-
before(:each)
|
78
|
+
context "when value is in attributes_from_storage" do
|
79
|
+
before(:each) do
|
80
|
+
subject.stub(:section_identifier).and_return(:foo)
|
81
|
+
subject.stub(:attributes_from_storage).and_return(:foo => 3)
|
82
|
+
end
|
76
83
|
|
77
|
-
its(:value) { should
|
84
|
+
its(:value) { should == 3 }
|
85
|
+
|
86
|
+
context "and value is storage is nil and default is not nil" do
|
87
|
+
|
88
|
+
before(:each) do
|
89
|
+
subject.stub(:default).and_return(true)
|
90
|
+
subject.stub(:attributes_from_storage).and_return(:foo => nil)
|
91
|
+
end
|
78
92
|
|
79
|
-
|
80
|
-
subject.should_receive(:attributes_from_storage).never
|
81
|
-
subject.value
|
93
|
+
its(:value) { should be_nil }
|
82
94
|
end
|
83
95
|
end
|
84
96
|
|
@@ -0,0 +1,49 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe DeadSimpleCMS::Group::Presenter::RenderMixin do
|
4
|
+
|
5
|
+
subject { Class.new { include DeadSimpleCMS::Group::Presenter::RenderMixin }.new }
|
6
|
+
|
7
|
+
shared_context :presenter_class do
|
8
|
+
let(:presenter_class) { Class.new(DeadSimpleCMS::Group::Presenter::Base) { def render ; "render result" ; end } }
|
9
|
+
before(:each) { subject.display(presenter_class) }
|
10
|
+
end
|
11
|
+
|
12
|
+
describe "#render" do
|
13
|
+
context "when presenter_class is set" do
|
14
|
+
|
15
|
+
include_context :presenter_class
|
16
|
+
|
17
|
+
specify { subject.render(:view_context).should == "render result" }
|
18
|
+
|
19
|
+
end
|
20
|
+
|
21
|
+
context "when render_proc is set" do
|
22
|
+
|
23
|
+
before(:each) { subject.display { |group, first, second| "#{first} #{second}" } }
|
24
|
+
|
25
|
+
specify { subject.render(:view_context, :first_arg, :second_arg).should == "first_arg second_arg" }
|
26
|
+
|
27
|
+
context "and when group is passed in arguments" do
|
28
|
+
let(:group) { DeadSimpleCMS::Group.new(:group_identifier) }
|
29
|
+
before(:each) { subject.display { |group, arg1, arg2| "#{group.identifier} #{arg1} #{arg2}" } }
|
30
|
+
|
31
|
+
it "should use the passed in group for the render_proc" do
|
32
|
+
subject.render([:view_context, group], "arg1", "arg2").should == "group_identifier arg1 arg2"
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
37
|
+
|
38
|
+
context "when group is passed in" do
|
39
|
+
include_context :presenter_class
|
40
|
+
|
41
|
+
it "should use that as the group" do
|
42
|
+
presenter_class.stub(:new).with(:view_context, :group).and_return(double(:render => :result))
|
43
|
+
subject.render([:view_context, :group])
|
44
|
+
end
|
45
|
+
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
@@ -14,22 +14,6 @@ describe DeadSimpleCMS::Group do
|
|
14
14
|
specify { described_class.root.should be_an_instance_of described_class }
|
15
15
|
end
|
16
16
|
|
17
|
-
describe "#presenter" do
|
18
|
-
context "when presenter_class is set" do
|
19
|
-
|
20
|
-
let(:presenter_class) { Struct.new(:view_context) }
|
21
|
-
|
22
|
-
before(:each) { subject.display(presenter_class) }
|
23
|
-
|
24
|
-
specify { subject.presenter(:view_context).should be_an_instance_of presenter_class }
|
25
|
-
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
describe "#render" do
|
30
|
-
|
31
|
-
end
|
32
|
-
|
33
17
|
describe "#root?" do
|
34
18
|
|
35
19
|
its(:root?) { should be false }
|
@@ -59,6 +43,10 @@ describe DeadSimpleCMS::Group do
|
|
59
43
|
subject.nested_group_attributes = :value
|
60
44
|
end
|
61
45
|
|
46
|
+
it "should set the parent" do
|
47
|
+
nested_group.parent.should == subject
|
48
|
+
end
|
49
|
+
|
62
50
|
end
|
63
51
|
|
64
52
|
end
|
@@ -55,6 +55,15 @@ describe DeadSimpleCMS::Section do
|
|
55
55
|
describe "#storage" do
|
56
56
|
specify { subject.storage.should be_a DeadSimpleCMS::Storage::Base }
|
57
57
|
end
|
58
|
+
|
59
|
+
describe "#refresh!" do
|
60
|
+
before(:each) do
|
61
|
+
subject.instance_variable_set(:@storage, :some_value)
|
62
|
+
subject.refresh!
|
63
|
+
end
|
64
|
+
|
65
|
+
specify { subject.instance_variable_get(:@storage).should be_nil }
|
66
|
+
end
|
58
67
|
|
59
68
|
describe "#update_attributes" do
|
60
69
|
before(:each) do
|
@@ -2,41 +2,65 @@ require "spec_helper"
|
|
2
2
|
|
3
3
|
describe DeadSimpleCMS::Util::Identifier::Dictionary do
|
4
4
|
|
5
|
-
|
6
|
-
|
5
|
+
class ClassWithIdentifier
|
6
|
+
include DeadSimpleCMS::Util::Identifier
|
7
|
+
alias :some_method :identifier
|
7
8
|
end
|
8
|
-
|
9
|
+
|
10
|
+
subject { described_class.new(ClassWithIdentifier, :identifier_method => :some_method) }
|
11
|
+
|
12
|
+
its(:identifier_method) { should == :some_method }
|
13
|
+
its(:target_class) { should == ClassWithIdentifier }
|
14
|
+
|
15
|
+
context "when items are added " do
|
16
|
+
let(:instance_with_identifier_1) { ClassWithIdentifier.new("basketball") }
|
17
|
+
let(:instance_with_identifier_2) { ClassWithIdentifier.new("soccer") }
|
18
|
+
|
19
|
+
before(:each) do
|
20
|
+
subject.add(instance_with_identifier_1)
|
21
|
+
subject.add(instance_with_identifier_2)
|
22
|
+
end
|
23
|
+
|
24
|
+
its(:identifiers) { should include(:basketball, :soccer) }
|
25
|
+
|
26
|
+
it "should be indexed by the identifier" do
|
27
|
+
subject[:basketball].should == instance_with_identifier_1
|
28
|
+
subject[:soccer].should == instance_with_identifier_2
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
32
|
+
|
9
33
|
describe "#target_class" do
|
10
|
-
|
34
|
+
|
11
35
|
end
|
12
|
-
|
36
|
+
|
13
37
|
describe "#identifier_method" do
|
14
|
-
|
38
|
+
|
15
39
|
end
|
16
|
-
|
40
|
+
|
17
41
|
describe "#identifiers" do
|
18
|
-
|
42
|
+
|
19
43
|
end
|
20
|
-
|
44
|
+
|
21
45
|
describe "#add" do
|
22
|
-
|
46
|
+
|
23
47
|
end
|
24
|
-
|
48
|
+
|
25
49
|
describe "#include?" do
|
26
|
-
|
50
|
+
|
27
51
|
end
|
28
|
-
|
52
|
+
|
29
53
|
describe "#to_hash" do
|
30
|
-
|
54
|
+
|
31
55
|
end
|
32
|
-
|
56
|
+
|
33
57
|
describe "#[]=" do
|
34
|
-
|
58
|
+
|
35
59
|
end
|
36
|
-
|
60
|
+
|
37
61
|
describe "#[]" do
|
38
|
-
|
62
|
+
|
39
63
|
end
|
40
|
-
|
64
|
+
|
41
65
|
end
|
42
66
|
|
data/spec/setup/shared.rb
CHANGED
@@ -46,8 +46,9 @@ shared_examples :group_display do
|
|
46
46
|
describe "#display" do
|
47
47
|
context "when presenter_class is set" do
|
48
48
|
it "should set the @presenter_class variable" do
|
49
|
-
|
50
|
-
subject.
|
49
|
+
klass = Class.new(DeadSimpleCMS::Group::Presenter::Base)
|
50
|
+
subject.display klass
|
51
|
+
subject.presenter_class.should == klass
|
51
52
|
end
|
52
53
|
end
|
53
54
|
|
@@ -55,7 +56,7 @@ shared_examples :group_display do
|
|
55
56
|
it "should set it to the @render_proc" do
|
56
57
|
proc = lambda { "do something" }
|
57
58
|
subject.display(&proc)
|
58
|
-
subject.
|
59
|
+
subject.render_proc.should == proc
|
59
60
|
end
|
60
61
|
end
|
61
62
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dead_simple_cms
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.10.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,12 +9,12 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-06-
|
12
|
+
date: 2012-06-29 00:00:00.000000000 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: activesupport
|
17
|
-
requirement: &
|
17
|
+
requirement: &2157724540 !ruby/object:Gem::Requirement
|
18
18
|
none: false
|
19
19
|
requirements:
|
20
20
|
- - ! '>='
|
@@ -22,10 +22,10 @@ dependencies:
|
|
22
22
|
version: '3.0'
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
|
-
version_requirements: *
|
25
|
+
version_requirements: *2157724540
|
26
26
|
- !ruby/object:Gem::Dependency
|
27
27
|
name: activemodel
|
28
|
-
requirement: &
|
28
|
+
requirement: &2157723920 !ruby/object:Gem::Requirement
|
29
29
|
none: false
|
30
30
|
requirements:
|
31
31
|
- - ! '>='
|
@@ -33,10 +33,10 @@ dependencies:
|
|
33
33
|
version: '3.0'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
|
-
version_requirements: *
|
36
|
+
version_requirements: *2157723920
|
37
37
|
- !ruby/object:Gem::Dependency
|
38
38
|
name: simple_form
|
39
|
-
requirement: &
|
39
|
+
requirement: &2157723540 !ruby/object:Gem::Requirement
|
40
40
|
none: false
|
41
41
|
requirements:
|
42
42
|
- - ! '>='
|
@@ -44,10 +44,10 @@ dependencies:
|
|
44
44
|
version: '0'
|
45
45
|
type: :development
|
46
46
|
prerelease: false
|
47
|
-
version_requirements: *
|
47
|
+
version_requirements: *2157723540
|
48
48
|
- !ruby/object:Gem::Dependency
|
49
49
|
name: rails
|
50
|
-
requirement: &
|
50
|
+
requirement: &2157722900 !ruby/object:Gem::Requirement
|
51
51
|
none: false
|
52
52
|
requirements:
|
53
53
|
- - ! '>='
|
@@ -55,10 +55,10 @@ dependencies:
|
|
55
55
|
version: '3.0'
|
56
56
|
type: :development
|
57
57
|
prerelease: false
|
58
|
-
version_requirements: *
|
58
|
+
version_requirements: *2157722900
|
59
59
|
- !ruby/object:Gem::Dependency
|
60
60
|
name: rspec
|
61
|
-
requirement: &
|
61
|
+
requirement: &2157722360 !ruby/object:Gem::Requirement
|
62
62
|
none: false
|
63
63
|
requirements:
|
64
64
|
- - ! '>='
|
@@ -66,10 +66,10 @@ dependencies:
|
|
66
66
|
version: '0'
|
67
67
|
type: :development
|
68
68
|
prerelease: false
|
69
|
-
version_requirements: *
|
69
|
+
version_requirements: *2157722360
|
70
70
|
- !ruby/object:Gem::Dependency
|
71
71
|
name: sqlite3
|
72
|
-
requirement: &
|
72
|
+
requirement: &2157721800 !ruby/object:Gem::Requirement
|
73
73
|
none: false
|
74
74
|
requirements:
|
75
75
|
- - ! '>='
|
@@ -77,7 +77,7 @@ dependencies:
|
|
77
77
|
version: '0'
|
78
78
|
type: :development
|
79
79
|
prerelease: false
|
80
|
-
version_requirements: *
|
80
|
+
version_requirements: *2157721800
|
81
81
|
description: ! "Dead Simple CMS is a library for modifying different parts of your
|
82
82
|
website without the overhead of having a\nfullblown CMS. The idea with this library
|
83
83
|
is simple: provide an easy way to hook into different parts of your\napplication
|
@@ -113,7 +113,9 @@ files:
|
|
113
113
|
- lib/dead_simple_cms/file_uploader/base.rb
|
114
114
|
- lib/dead_simple_cms/group.rb
|
115
115
|
- lib/dead_simple_cms/group/configuration.rb
|
116
|
-
- lib/dead_simple_cms/group/presenter.rb
|
116
|
+
- lib/dead_simple_cms/group/presenter/base.rb
|
117
|
+
- lib/dead_simple_cms/group/presenter/render_mixin.rb
|
118
|
+
- lib/dead_simple_cms/rack/section_refresher.rb
|
117
119
|
- lib/dead_simple_cms/rails/action_controller/extensions.rb
|
118
120
|
- lib/dead_simple_cms/rails/action_controller/fragment_sweeper.rb
|
119
121
|
- lib/dead_simple_cms/rails/action_view/extensions.rb
|
@@ -122,6 +124,7 @@ files:
|
|
122
124
|
- lib/dead_simple_cms/rails/action_view/form_builders/simple_form.rb
|
123
125
|
- lib/dead_simple_cms/rails/action_view/form_builders/simple_form_with_bootstrap.rb
|
124
126
|
- lib/dead_simple_cms/rails/action_view/presenter.rb
|
127
|
+
- lib/dead_simple_cms/rails/railtie.rb
|
125
128
|
- lib/dead_simple_cms/section.rb
|
126
129
|
- lib/dead_simple_cms/section/builder.rb
|
127
130
|
- lib/dead_simple_cms/storage/base.rb
|
@@ -138,6 +141,7 @@ files:
|
|
138
141
|
- spec/dead_simple_cms/configuration_spec.rb
|
139
142
|
- spec/dead_simple_cms/file_uploader/base_spec.rb
|
140
143
|
- spec/dead_simple_cms/group/configuration_spec.rb
|
144
|
+
- spec/dead_simple_cms/group/presenter/render_mixin_spec.rb
|
141
145
|
- spec/dead_simple_cms/group/presenter_spec.rb
|
142
146
|
- spec/dead_simple_cms/group_spec.rb
|
143
147
|
- spec/dead_simple_cms/rails/action_view/form_builders/default_spec.rb
|
@@ -195,6 +199,7 @@ test_files:
|
|
195
199
|
- spec/dead_simple_cms/configuration_spec.rb
|
196
200
|
- spec/dead_simple_cms/file_uploader/base_spec.rb
|
197
201
|
- spec/dead_simple_cms/group/configuration_spec.rb
|
202
|
+
- spec/dead_simple_cms/group/presenter/render_mixin_spec.rb
|
198
203
|
- spec/dead_simple_cms/group/presenter_spec.rb
|
199
204
|
- spec/dead_simple_cms/group_spec.rb
|
200
205
|
- spec/dead_simple_cms/rails/action_view/form_builders/default_spec.rb
|
@@ -1,23 +0,0 @@
|
|
1
|
-
require 'delegate'
|
2
|
-
module DeadSimpleCMS
|
3
|
-
class Group
|
4
|
-
# Public: Presenter class used for rendering groups.
|
5
|
-
#
|
6
|
-
# Within the context of this group, you can call methods as if you were in the view_context.
|
7
|
-
class Presenter < SimpleDelegator
|
8
|
-
|
9
|
-
attr_reader :group
|
10
|
-
|
11
|
-
def initialize(view_context, group, *args)
|
12
|
-
@group = group
|
13
|
-
initialize_extra_arguments(*args)
|
14
|
-
super(view_context)
|
15
|
-
end
|
16
|
-
|
17
|
-
# Private: Initialize extra arguments for the presenter.
|
18
|
-
def initialize_extra_arguments(*args)
|
19
|
-
end
|
20
|
-
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|