impartial-rails 0.0.1
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/.gitignore +6 -0
- data/Gemfile +3 -0
- data/Gemfile.lock +103 -0
- data/MIT-LICENSE +20 -0
- data/README.md +25 -0
- data/Rakefile +27 -0
- data/impartial-rails.gemspec +23 -0
- data/lib/impartial-rails/helper.rb +11 -0
- data/lib/impartial-rails/rails.rb +39 -0
- data/lib/impartial-rails/railtie.rb +28 -0
- data/lib/impartial-rails/version.rb +8 -0
- data/lib/impartial-rails.rb +2 -0
- metadata +85 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,103 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
impartial-rails (0.0.1)
|
5
|
+
impartial
|
6
|
+
rails (~> 3.1.3)
|
7
|
+
|
8
|
+
GEM
|
9
|
+
remote: http://rubygems.org/
|
10
|
+
specs:
|
11
|
+
actionmailer (3.1.3)
|
12
|
+
actionpack (= 3.1.3)
|
13
|
+
mail (~> 2.3.0)
|
14
|
+
actionpack (3.1.3)
|
15
|
+
activemodel (= 3.1.3)
|
16
|
+
activesupport (= 3.1.3)
|
17
|
+
builder (~> 3.0.0)
|
18
|
+
erubis (~> 2.7.0)
|
19
|
+
i18n (~> 0.6)
|
20
|
+
rack (~> 1.3.5)
|
21
|
+
rack-cache (~> 1.1)
|
22
|
+
rack-mount (~> 0.8.2)
|
23
|
+
rack-test (~> 0.6.1)
|
24
|
+
sprockets (~> 2.0.3)
|
25
|
+
activemodel (3.1.3)
|
26
|
+
activesupport (= 3.1.3)
|
27
|
+
builder (~> 3.0.0)
|
28
|
+
i18n (~> 0.6)
|
29
|
+
activerecord (3.1.3)
|
30
|
+
activemodel (= 3.1.3)
|
31
|
+
activesupport (= 3.1.3)
|
32
|
+
arel (~> 2.2.1)
|
33
|
+
tzinfo (~> 0.3.29)
|
34
|
+
activeresource (3.1.3)
|
35
|
+
activemodel (= 3.1.3)
|
36
|
+
activesupport (= 3.1.3)
|
37
|
+
activesupport (3.1.3)
|
38
|
+
multi_json (~> 1.0)
|
39
|
+
arel (2.2.1)
|
40
|
+
builder (3.0.0)
|
41
|
+
erubis (2.7.0)
|
42
|
+
hbs (0.1.2)
|
43
|
+
therubyracer (~> 0.9.4)
|
44
|
+
hike (1.2.1)
|
45
|
+
i18n (0.6.0)
|
46
|
+
impartial (0.0.0)
|
47
|
+
activesupport (~> 3.0)
|
48
|
+
hbs (~> 0.1.2)
|
49
|
+
railties (~> 3.0)
|
50
|
+
json (1.6.3)
|
51
|
+
libv8 (3.3.10.4)
|
52
|
+
mail (2.3.0)
|
53
|
+
i18n (>= 0.4.0)
|
54
|
+
mime-types (~> 1.16)
|
55
|
+
treetop (~> 1.4.8)
|
56
|
+
mime-types (1.17.2)
|
57
|
+
multi_json (1.0.4)
|
58
|
+
polyglot (0.3.3)
|
59
|
+
rack (1.3.5)
|
60
|
+
rack-cache (1.1)
|
61
|
+
rack (>= 0.4)
|
62
|
+
rack-mount (0.8.3)
|
63
|
+
rack (>= 1.0.0)
|
64
|
+
rack-ssl (1.3.2)
|
65
|
+
rack
|
66
|
+
rack-test (0.6.1)
|
67
|
+
rack (>= 1.0)
|
68
|
+
rails (3.1.3)
|
69
|
+
actionmailer (= 3.1.3)
|
70
|
+
actionpack (= 3.1.3)
|
71
|
+
activerecord (= 3.1.3)
|
72
|
+
activeresource (= 3.1.3)
|
73
|
+
activesupport (= 3.1.3)
|
74
|
+
bundler (~> 1.0)
|
75
|
+
railties (= 3.1.3)
|
76
|
+
railties (3.1.3)
|
77
|
+
actionpack (= 3.1.3)
|
78
|
+
activesupport (= 3.1.3)
|
79
|
+
rack-ssl (~> 1.3.2)
|
80
|
+
rake (>= 0.8.7)
|
81
|
+
rdoc (~> 3.4)
|
82
|
+
thor (~> 0.14.6)
|
83
|
+
rake (0.9.2.2)
|
84
|
+
rdoc (3.11)
|
85
|
+
json (~> 1.4)
|
86
|
+
sprockets (2.0.3)
|
87
|
+
hike (~> 1.2)
|
88
|
+
rack (~> 1.0)
|
89
|
+
tilt (~> 1.1, != 1.3.0)
|
90
|
+
therubyracer (0.9.9)
|
91
|
+
libv8 (~> 3.3.10)
|
92
|
+
thor (0.14.6)
|
93
|
+
tilt (1.3.3)
|
94
|
+
treetop (1.4.10)
|
95
|
+
polyglot
|
96
|
+
polyglot (>= 0.3.1)
|
97
|
+
tzinfo (0.3.31)
|
98
|
+
|
99
|
+
PLATFORMS
|
100
|
+
ruby
|
101
|
+
|
102
|
+
DEPENDENCIES
|
103
|
+
impartial-rails!
|
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright 2011 Logan Lowell
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
# impartial-rails
|
2
|
+
|
3
|
+
Integrates [Impartial](http://github.com/thefrontside/impartial) into Rails for simple rendering of self-contained partials.
|
4
|
+
|
5
|
+
# Usage
|
6
|
+
|
7
|
+
Impartial-rails is simple to use. All impartials live in /app/impartials
|
8
|
+
|
9
|
+
To render them in a view, you can simply call `impartial :demo`
|
10
|
+
|
11
|
+
# Example
|
12
|
+
|
13
|
+
/app/impartials/example/example.rb
|
14
|
+
|
15
|
+
class Demo < Impartial::Base
|
16
|
+
end
|
17
|
+
|
18
|
+
/app/impartials/example/example.html.hbs
|
19
|
+
|
20
|
+
Hello World!
|
21
|
+
|
22
|
+
/app/views/dashboard/show.html.hbs
|
23
|
+
|
24
|
+
<%= impartial "demo" %>
|
25
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
#!/usr/bin/env rake
|
2
|
+
begin
|
3
|
+
require 'bundler/setup'
|
4
|
+
rescue LoadError
|
5
|
+
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
6
|
+
end
|
7
|
+
begin
|
8
|
+
require 'rdoc/task'
|
9
|
+
rescue LoadError
|
10
|
+
require 'rdoc/rdoc'
|
11
|
+
require 'rake/rdoctask'
|
12
|
+
RDoc::Task = Rake::RDocTask
|
13
|
+
end
|
14
|
+
|
15
|
+
RDoc::Task.new(:rdoc) do |rdoc|
|
16
|
+
rdoc.rdoc_dir = 'rdoc'
|
17
|
+
rdoc.title = 'ImpartialRails'
|
18
|
+
rdoc.options << '--line-numbers'
|
19
|
+
rdoc.rdoc_files.include('README.rdoc')
|
20
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
21
|
+
end
|
22
|
+
|
23
|
+
|
24
|
+
|
25
|
+
Bundler::GemHelper.install_tasks
|
26
|
+
|
27
|
+
require 'rake/testtask'
|
@@ -0,0 +1,23 @@
|
|
1
|
+
$:.push File.expand_path("../lib", __FILE__)
|
2
|
+
|
3
|
+
# Maintain your gem's version:
|
4
|
+
require "impartial-rails/version"
|
5
|
+
|
6
|
+
# Describe your gem and declare its dependencies:
|
7
|
+
Gem::Specification.new do |s|
|
8
|
+
s.name = "impartial-rails"
|
9
|
+
s.version = Impartial::Rails::VERSION
|
10
|
+
s.authors = ["Logan Lowell"]
|
11
|
+
s.email = ["fractaloop@thefrontside.net"]
|
12
|
+
s.homepage = "http://github.com/thefrontside/impartial-rails"
|
13
|
+
s.summary = "Partials without prejudice."
|
14
|
+
s.description = "Add impartial partials to your Rails project."
|
15
|
+
|
16
|
+
s.files = `git ls-files`.split("\n")
|
17
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
18
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
19
|
+
s.require_paths = ["lib"]
|
20
|
+
|
21
|
+
s.add_dependency "rails", "~> 3.1.3"
|
22
|
+
s.add_dependency "impartial"
|
23
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
require 'impartial/base'
|
2
|
+
require 'impartial-rails/helper'
|
3
|
+
|
4
|
+
module Impartial
|
5
|
+
class Base
|
6
|
+
|
7
|
+
protected
|
8
|
+
|
9
|
+
def model(object_or_id, model_class)
|
10
|
+
object_or_id.kind_of?(model_class) ? object_or_id : model_class.find(object_or_id.to_s)
|
11
|
+
end
|
12
|
+
|
13
|
+
def config
|
14
|
+
return ::ActionController::Base.config
|
15
|
+
end
|
16
|
+
|
17
|
+
def url_options
|
18
|
+
{}
|
19
|
+
end
|
20
|
+
|
21
|
+
def form_authenticity_token
|
22
|
+
params[request_forgery_protection_token]
|
23
|
+
end
|
24
|
+
|
25
|
+
def protect_against_forgery?
|
26
|
+
true
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
# Add to ActionController
|
32
|
+
ActionController::Base.class_eval do
|
33
|
+
include ::Impartial::Rails::Helper
|
34
|
+
end
|
35
|
+
|
36
|
+
# Add to ActionView
|
37
|
+
ActionView::Base.class_eval do
|
38
|
+
include ::Impartial::Rails::Helper
|
39
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'rails/railtie'
|
2
|
+
require 'impartial/base'
|
3
|
+
|
4
|
+
module Impartial
|
5
|
+
module Rails
|
6
|
+
class Railtie < ::Rails::Railtie
|
7
|
+
|
8
|
+
initializer 'impartial.autoload', :before => :set_autoload_paths do |app|
|
9
|
+
app.config.autoload_paths << ::Rails.root.join('app', 'impartials')
|
10
|
+
end
|
11
|
+
|
12
|
+
initializer 'impartial.paths' do |app|
|
13
|
+
Impartial.configure do |config|
|
14
|
+
config.paths = [::Rails.root.join('app', 'impartials')]
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
initializer "impartial.add_helper" do |app|
|
19
|
+
::Impartial::Base.class_eval do
|
20
|
+
include app.routes.url_helpers
|
21
|
+
include ::ApplicationHelper
|
22
|
+
include ::ActionView::Helpers
|
23
|
+
include ::Sprockets::Helpers::RailsHelper
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
metadata
ADDED
@@ -0,0 +1,85 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: impartial-rails
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Logan Lowell
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2011-12-07 00:00:00.000000000Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: rails
|
16
|
+
requirement: &70319035415620 !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ~>
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: 3.1.3
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: *70319035415620
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: impartial
|
27
|
+
requirement: &70319035414720 !ruby/object:Gem::Requirement
|
28
|
+
none: false
|
29
|
+
requirements:
|
30
|
+
- - ! '>='
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '0'
|
33
|
+
type: :runtime
|
34
|
+
prerelease: false
|
35
|
+
version_requirements: *70319035414720
|
36
|
+
description: Add impartial partials to your Rails project.
|
37
|
+
email:
|
38
|
+
- fractaloop@thefrontside.net
|
39
|
+
executables: []
|
40
|
+
extensions: []
|
41
|
+
extra_rdoc_files: []
|
42
|
+
files:
|
43
|
+
- .gitignore
|
44
|
+
- Gemfile
|
45
|
+
- Gemfile.lock
|
46
|
+
- MIT-LICENSE
|
47
|
+
- README.md
|
48
|
+
- Rakefile
|
49
|
+
- impartial-rails.gemspec
|
50
|
+
- lib/impartial-rails.rb
|
51
|
+
- lib/impartial-rails/helper.rb
|
52
|
+
- lib/impartial-rails/rails.rb
|
53
|
+
- lib/impartial-rails/railtie.rb
|
54
|
+
- lib/impartial-rails/version.rb
|
55
|
+
homepage: http://github.com/thefrontside/impartial-rails
|
56
|
+
licenses: []
|
57
|
+
post_install_message:
|
58
|
+
rdoc_options: []
|
59
|
+
require_paths:
|
60
|
+
- lib
|
61
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
62
|
+
none: false
|
63
|
+
requirements:
|
64
|
+
- - ! '>='
|
65
|
+
- !ruby/object:Gem::Version
|
66
|
+
version: '0'
|
67
|
+
segments:
|
68
|
+
- 0
|
69
|
+
hash: 3085731979893789187
|
70
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
71
|
+
none: false
|
72
|
+
requirements:
|
73
|
+
- - ! '>='
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
segments:
|
77
|
+
- 0
|
78
|
+
hash: 3085731979893789187
|
79
|
+
requirements: []
|
80
|
+
rubyforge_project:
|
81
|
+
rubygems_version: 1.8.11
|
82
|
+
signing_key:
|
83
|
+
specification_version: 3
|
84
|
+
summary: Partials without prejudice.
|
85
|
+
test_files: []
|