sections_rails 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/sections_rails/version.rb +1 -1
- data/lib/sections_rails.rb +10 -3
- metadata +7 -7
data/lib/sections_rails.rb
CHANGED
@@ -4,16 +4,23 @@ module SectionsRails
|
|
4
4
|
|
5
5
|
def section name
|
6
6
|
out = []
|
7
|
-
|
8
|
-
|
7
|
+
|
8
|
+
# Add assets of section when in dev mode.
|
9
|
+
if Rails.env != 'production'
|
10
|
+
out << javascript_include_tag("#{name}/#{name}") if File.exists? "#{Rails.root}/app/sections/#{name}/#{name}.js"
|
11
|
+
out << stylesheet_link_tag("#{name}/#{name}") if File.exists? "#{Rails.root}/app/sections/#{name}/#{name}.css"
|
12
|
+
end
|
13
|
+
|
14
|
+
# Render the section partial into the view.
|
9
15
|
if File.exists? "#{Rails.root}/app/sections/#{name}/_#{name}.html.erb"
|
10
16
|
out << render(:partial => "/../sections/#{name}/#{name}")
|
11
17
|
else
|
12
18
|
out << "<div class=\"#{name}\"></div>"
|
13
19
|
end
|
20
|
+
|
14
21
|
out.join("\n").html_safe
|
15
22
|
end
|
16
23
|
|
17
24
|
end
|
18
25
|
|
19
|
-
ActionView::Base.send :include, SectionsRails
|
26
|
+
ActionView::Base.send :include, SectionsRails
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sections_rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,7 +13,7 @@ date: 2012-05-25 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
16
|
-
requirement: &
|
16
|
+
requirement: &70240732445780 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '3.1'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70240732445780
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: rspec
|
27
|
-
requirement: &
|
27
|
+
requirement: &70240732445360 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70240732445360
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: sqlite3
|
38
|
-
requirement: &
|
38
|
+
requirement: &70240732444900 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,7 +43,7 @@ dependencies:
|
|
43
43
|
version: '0'
|
44
44
|
type: :development
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *70240732444900
|
47
47
|
description: Sections_rails adds infrastructure to the view layer of Ruby on Rails.
|
48
48
|
It allows to define and use the HTML, CSS, and JavaScript code of dedicated sections
|
49
49
|
of pages together in one place.
|