modular 0.1 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -7,9 +7,10 @@ module Modular
7
7
  module Components
8
8
  class Base < Modular::Helpers::AbstractModel
9
9
  #rendering
10
- include AbstractController::Rendering
10
+ include AbstractController
11
+ include Rendering, Helpers
11
12
  include Modular::Components::DirectRender
12
-
13
+
13
14
  #slug
14
15
  def self.type
15
16
  self.name.rpartition("::").last
@@ -13,9 +13,14 @@ module Modular
13
13
  type.underscore
14
14
  end
15
15
 
16
+ def config
17
+ ActionController::Base.config
18
+ end
19
+
16
20
  def execute
21
+
17
22
  end
18
-
23
+
19
24
  def render
20
25
  execute
21
26
  modular_render :render_type => :direct
@@ -45,6 +50,11 @@ module Modular
45
50
  a.html_safe
46
51
  end
47
52
  end
53
+
54
+ context.send :include, Rails.application.routes.url_helpers if defined? Rails
55
+
56
+ context.send :include, ApplicationHelper if defined? ApplicationHelper
57
+
48
58
  context
49
59
  end
50
60
  end
@@ -1,3 +1,3 @@
1
1
  module Modular
2
- VERSION = "0.1"
2
+ VERSION = "0.1.1"
3
3
  end
@@ -0,0 +1,7 @@
1
+ class Modular::Components::HelloWorld < Modular::Components::Base
2
+ def execute
3
+ @text = 'Hello, world!'
4
+ end
5
+ end
6
+
7
+ HelloWorld = Modular::Components::HelloWorld
@@ -0,0 +1,6 @@
1
+ class Modular::Components::HelpersExample < Modular::Components::Base
2
+ def execute
3
+ end
4
+ end
5
+
6
+ HelpersExample = Modular::Components::HelpersExample
@@ -0,0 +1 @@
1
+ <%=@text%>
@@ -0,0 +1,6 @@
1
+ <%= url_for :controller=>"example", :action=>"index" %>
2
+
3
+ <%= image_tag 'http://google.com/image.png' %>
4
+
5
+ <%= image_tag 'local_image.png' %>
6
+
@@ -0,0 +1,8 @@
1
+ require 'spec_helper'
2
+
3
+ describe Modular::Components::HelloWorld, ' vertical container class ' do
4
+ it "should have container" do
5
+ cmp = Modular.create :hello_world
6
+ cmp.render.should == 'Hello, world!'
7
+ end
8
+ end
@@ -0,0 +1,8 @@
1
+ require 'spec_helper'
2
+
3
+ describe Modular::Components::HelpersExample, ' example for using helpers' do
4
+ it "should not fail" do
5
+ cmp = Modular.create :helpers_example
6
+ cmp.render
7
+ end
8
+ end
metadata CHANGED
@@ -1,12 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: modular
3
3
  version: !ruby/object:Gem::Version
4
- hash: 9
4
+ hash: 25
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- version: "0.1"
9
+ - 1
10
+ version: 0.1.1
10
11
  platform: ruby
11
12
  authors:
12
13
  - Alex Rozumiy
@@ -14,13 +15,13 @@ autorequire:
14
15
  bindir: bin
15
16
  cert_chain: []
16
17
 
17
- date: 2011-07-22 00:00:00 +03:00
18
+ date: 2011-07-28 00:00:00 +03:00
18
19
  default_executable:
19
20
  dependencies:
20
21
  - !ruby/object:Gem::Dependency
21
22
  name: rails
22
- prerelease: false
23
- requirement: &id001 !ruby/object:Gem::Requirement
23
+ type: :runtime
24
+ version_requirements: &id001 !ruby/object:Gem::Requirement
24
25
  none: false
25
26
  requirements:
26
27
  - - ">="
@@ -29,12 +30,12 @@ dependencies:
29
30
  segments:
30
31
  - 0
31
32
  version: "0"
32
- type: :runtime
33
- version_requirements: *id001
33
+ prerelease: false
34
+ requirement: *id001
34
35
  - !ruby/object:Gem::Dependency
35
36
  name: rspec
36
- prerelease: false
37
- requirement: &id002 !ruby/object:Gem::Requirement
37
+ type: :development
38
+ version_requirements: &id002 !ruby/object:Gem::Requirement
38
39
  none: false
39
40
  requirements:
40
41
  - - ">="
@@ -45,12 +46,12 @@ dependencies:
45
46
  - 0
46
47
  - 0
47
48
  version: 2.0.0
48
- type: :development
49
- version_requirements: *id002
49
+ prerelease: false
50
+ requirement: *id002
50
51
  - !ruby/object:Gem::Dependency
51
52
  name: autotest
52
- prerelease: false
53
- requirement: &id003 !ruby/object:Gem::Requirement
53
+ type: :development
54
+ version_requirements: &id003 !ruby/object:Gem::Requirement
54
55
  none: false
55
56
  requirements:
56
57
  - - ">="
@@ -59,8 +60,8 @@ dependencies:
59
60
  segments:
60
61
  - 0
61
62
  version: "0"
62
- type: :development
63
- version_requirements: *id003
63
+ prerelease: false
64
+ requirement: *id003
64
65
  description: This gem provides functionality for modular frontend layout
65
66
  email:
66
67
  - brain-geek@yandex.ua
@@ -98,6 +99,8 @@ files:
98
99
  - modular-app/app/components/fake_news_feed.rb
99
100
  - modular-app/app/components/foobar.rb
100
101
  - modular-app/app/components/heavy_task.rb
102
+ - modular-app/app/components/hello_world.rb
103
+ - modular-app/app/components/helpers_example.rb
101
104
  - modular-app/app/components/validated.rb
102
105
  - modular-app/app/components/vertical.rb
103
106
  - modular-app/app/controllers/application_controller.rb
@@ -121,6 +124,8 @@ files:
121
124
  - modular-app/app/views/components/fake_news_feed.html.erb
122
125
  - modular-app/app/views/components/foobar.html.erb
123
126
  - modular-app/app/views/components/heavy_task.html.erb
127
+ - modular-app/app/views/components/hello_world.html.erb
128
+ - modular-app/app/views/components/helpers_example.html.erb
124
129
  - modular-app/app/views/components/validated.html.erb
125
130
  - modular-app/app/views/components/vertical.html.erb
126
131
  - modular-app/app/views/example/index.html.erb
@@ -149,6 +154,8 @@ files:
149
154
  - modular-app/script/rails
150
155
  - modular-app/spec/components/base.rb
151
156
  - modular-app/spec/components/container.rb
157
+ - modular-app/spec/components/hello_world.rb
158
+ - modular-app/spec/components/helpers_example.rb
152
159
  - modular-app/spec/components/validated.rb
153
160
  - modular-app/spec/controllers/cached_for_time_controller_spec.rb
154
161
  - modular-app/spec/controllers/cached_forever_controller_spec.rb
@@ -194,7 +201,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
194
201
  requirements: []
195
202
 
196
203
  rubyforge_project: modular
197
- rubygems_version: 1.5.2
204
+ rubygems_version: 1.6.2
198
205
  signing_key:
199
206
  specification_version: 3
200
207
  summary: This gem provides functionality for modular frontend layout