Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

now requires cells-4.0.0.

  • Loading branch information...
commit c69b2791406d5f319ef61ee81e0f4f8cf8dc8a97 1 parent 7a3f488
@apotonick apotonick authored
View
10 README.rdoc
@@ -1,11 +1,11 @@
= Sinatra Cells
-_View Components for Sinatra_
+<em>View Components for Sinatra</em>
== Introduction
Cells are object-oriented view components for your MVC-apps. They provide a decent way for encapsulating logic
-and rendering and thus help in creating reusable widgets.
+and rendering - thus helping in creating reusable widgets.
For a detailed discussion on cells see http://github.com/apotonick/cells
@@ -13,8 +13,10 @@ For a detailed discussion on cells see http://github.com/apotonick/cells
Rendering cells in your Sinatra app is easy.
- MyApp < Sinatra::Base
- helpers Cells::Sinatra
+ require 'cells-sinatra'
+
+ MyApp < Sinatra::Base
+ helpers Cells::Sinatra
get "/" do
@top_posts = render_cell(:post, :top10)
View
2  Rakefile
@@ -65,7 +65,7 @@ begin
spec.files = FileList["[A-Z]*", File.join(*%w[{lib} ** *]).to_s]
spec.add_dependency 'activesupport', '>= 2.3.0'
- spec.add_dependency 'cells', '>= 3.4.0'
+ spec.add_dependency 'cells', '>= 4.0.0'
end
Jeweler::GemcutterTasks.new
View
7 lib/cell/sinatra.rb
@@ -1,8 +1,9 @@
module Cell
- class Sinatra < AbstractBase ### TODO: derive from Cell::Base.
+ class Sinatra
# Sinatra::Templates introduces two dependencies:
- # - it accesses @template_cache
- # - invokes methods #settings
+ # - it accesses @template_cache
+ # - invokes methods #settings
+ include ::Cell::BaseMethods # from the cells gem.
include ::Sinatra::Templates
alias_method :render_template, :render
delegate :settings, :to => :controller
View
5 lib/cells-sinatra.rb
@@ -2,10 +2,9 @@
require 'active_support'
-gem 'cells', '= 3.4.0'
-require 'cells'
-require 'cell/abstract_base' ### FIXME: let cells handle that!
+gem 'cells', '= 4.0.0'
+require 'cell/base_methods'
require 'sinatra/base'
require 'cells/sinatra'
require 'cell/sinatra'
View
8 lib/cells.rb
@@ -1,8 +0,0 @@
-require 'rubygems'
-
-gem 'cells', '= 3.4.0'
-
-module Cells
-end
-
-require 'cells/sinatra'
View
2  lib/cells/sinatra.rb
@@ -18,7 +18,7 @@ module Sinatra
#
# would render the state +top10+ of the +PostCell+.
def render_cell(name, state, opts={})
- ::Cell::AbstractBase.render_cell_for(self, name, state, opts)
+ ::Cell::Sinatra.render_cell_for(self, name, state, opts)
end
end
end
View
5 test/sinatra_test.rb
@@ -1,5 +0,0 @@
-require File.join(File.dirname(__FILE__), 'test_helper')
-
-class SinatraTest < ActiveSupport::TestCase
-
-end
View
2  test/test_helper.rb
@@ -13,7 +13,7 @@
class ActiveSupport::TestCase
def cell(name, opts={})
- ::Cell::AbstractBase.create_cell_for(@controller, name, opts)
+ ::Cell::Sinatra.create_cell_for(@controller, name, opts)
end
def render_cell(name, state, opts={}) ### FIXME.
Please sign in to comment.
Something went wrong with that request. Please try again.