exvo_helpers 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -69,9 +69,12 @@ Exvo::Helpers.pics_host = 'test.pics.exvo.local'
69
69
 
70
70
  ## View helpers
71
71
 
72
- There is a `javascript_bundle_include_tag` view helper function, which includes a different Desktop JS bundles depending on current environment.
72
+ There are also all kinds of view helpers available, which output html tags based on `env`.
73
73
 
74
- The following declaraions:
74
+ All examples are for the 'development' environment.
75
+
76
+
77
+ ### javascript_bundle_include_tag
75
78
 
76
79
  ```ruby
77
80
  = javascript_bundle_include_tag("plugins")
@@ -81,7 +84,7 @@ The following declaraions:
81
84
  = javascript_bundle_include_tag("uploader")
82
85
  ```
83
86
 
84
- will output this for the 'development' environment:
87
+ =>
85
88
 
86
89
  ```html
87
90
  <script src="http://www.exvo.local/javascripts/bundles/plugins.js" type="text/javascript"></script>
@@ -92,4 +95,32 @@ will output this for the 'development' environment:
92
95
  ```
93
96
 
94
97
 
98
+ ### themes_stylesheet_link_tag
99
+
100
+ Note, that this helper does not support full API of Rails' `stylesheet_link_tag` (works best with only one CSS path as argument).
101
+
102
+ ```ruby
103
+ = themes_stylesheet_link_tag "frost/all", :madia => 'all'
104
+ ```
105
+
106
+ =>
107
+
108
+ ```html
109
+ <link href="http://themes.exvo.local/stylesheets/themes/frost/all.css" media="all" rel="stylesheet" type="text/css" />
110
+ ```
111
+
112
+
113
+ ### themes_image_tag
114
+
115
+ ```ruby
116
+ = themes_image_tag("icons/exvo.png", :alt => 'Exvo')
117
+ ```
118
+
119
+ =>
120
+
121
+ ```html
122
+ <img alt="Exvo" src="http://themes.exvo.local/stylesheets/images/icons/exvo.png" />
123
+ ```
124
+
125
+
95
126
  Copyright © 2011 Exvo.com Development BV
data/exvo_helpers.gemspec CHANGED
@@ -16,8 +16,6 @@ Gem::Specification.new do |s|
16
16
  s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
17
17
  s.require_paths = ["lib"]
18
18
 
19
- s.add_dependency 'rails', ['~> 3.0']
20
-
21
19
  s.add_development_dependency 'rspec', ['>= 2.7']
22
20
  s.add_development_dependency 'guard', ['>= 0.8.0']
23
21
  s.add_development_dependency 'guard-rspec', ['>= 0.4.0']
@@ -1,3 +1,3 @@
1
1
  module ExvoHelpers
2
- VERSION = "0.0.5"
2
+ VERSION = "0.0.6"
3
3
  end
@@ -2,6 +2,7 @@ module Exvo
2
2
 
3
3
  module ViewHelpers
4
4
 
5
+ # Returns `javascript_include_tag` with link to js bundles (based on env)
5
6
  def javascript_bundle_include_tag(bundle)
6
7
  case Exvo::Helpers.env.to_sym
7
8
  when :production
@@ -15,6 +16,19 @@ module Exvo
15
16
  end
16
17
  end
17
18
 
19
+ # Returns `stylesheet_link_tag` with link to css on themes (based on env)
20
+ def themes_stylesheet_link_tag(path, options = {})
21
+ path = '/' + path unless path.start_with?('/')
22
+ path = path + '.css' unless path.end_with?('.css')
23
+ stylesheet_link_tag(Exvo::Helpers.themes_uri + '/stylesheets/themes' + path, options)
24
+ end
25
+
26
+ # Returns `image_tag` with link to image on themes (based on env)
27
+ def themes_image_tag(path, options = {})
28
+ path = '/' + path unless path.start_with?('/')
29
+ image_tag(Exvo::Helpers.themes_uri + '/stylesheets/images' + path, options)
30
+ end
31
+
18
32
  end
19
33
 
20
34
  end
@@ -10,11 +10,25 @@ describe Exvo::ViewHelpers do
10
10
 
11
11
  let(:view_helper) { SpecViewHelper.new }
12
12
 
13
- it "should return the javascript_include_tag based on env" do
13
+ before do
14
14
  Exvo::Helpers.stub(:env).and_return('production')
15
+ end
16
+
17
+ it "returns a javascript_include_tag based on env" do
15
18
  view_helper.should_receive(:javascript_include_tag).with("http://cdn.exvo.com/javascripts/plugins.js")
16
19
  view_helper.javascript_bundle_include_tag("plugins")
17
20
  end
21
+
22
+ it "returns a stylesheet_link_tag based on env" do
23
+ view_helper.should_receive(:stylesheet_link_tag).with("http://themes.exvo.com/stylesheets/themes/frost/all.css", { :media => 'all' })
24
+ view_helper.themes_stylesheet_link_tag("frost/all", :media => 'all')
25
+ end
26
+
27
+ it "returns an image_tag based on env" do
28
+ view_helper.should_receive(:image_tag).with("http://themes.exvo.com/stylesheets/images/icons/exvo.png", { :alt => 'Exvo' })
29
+ view_helper.themes_image_tag("icons/exvo.png", :alt => 'Exvo')
30
+ end
31
+
18
32
  end
19
33
 
20
34
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: exvo_helpers
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,22 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-11-23 00:00:00.000000000Z
12
+ date: 2011-11-24 00:00:00.000000000Z
13
13
  dependencies:
14
- - !ruby/object:Gem::Dependency
15
- name: rails
16
- requirement: &72666460 !ruby/object:Gem::Requirement
17
- none: false
18
- requirements:
19
- - - ~>
20
- - !ruby/object:Gem::Version
21
- version: '3.0'
22
- type: :runtime
23
- prerelease: false
24
- version_requirements: *72666460
25
14
  - !ruby/object:Gem::Dependency
26
15
  name: rspec
27
- requirement: &72666170 !ruby/object:Gem::Requirement
16
+ requirement: &74228700 !ruby/object:Gem::Requirement
28
17
  none: false
29
18
  requirements:
30
19
  - - ! '>='
@@ -32,10 +21,10 @@ dependencies:
32
21
  version: '2.7'
33
22
  type: :development
34
23
  prerelease: false
35
- version_requirements: *72666170
24
+ version_requirements: *74228700
36
25
  - !ruby/object:Gem::Dependency
37
26
  name: guard
38
- requirement: &72665880 !ruby/object:Gem::Requirement
27
+ requirement: &74228440 !ruby/object:Gem::Requirement
39
28
  none: false
40
29
  requirements:
41
30
  - - ! '>='
@@ -43,10 +32,10 @@ dependencies:
43
32
  version: 0.8.0
44
33
  type: :development
45
34
  prerelease: false
46
- version_requirements: *72665880
35
+ version_requirements: *74228440
47
36
  - !ruby/object:Gem::Dependency
48
37
  name: guard-rspec
49
- requirement: &72665590 !ruby/object:Gem::Requirement
38
+ requirement: &74228200 !ruby/object:Gem::Requirement
50
39
  none: false
51
40
  requirements:
52
41
  - - ! '>='
@@ -54,10 +43,10 @@ dependencies:
54
43
  version: 0.4.0
55
44
  type: :development
56
45
  prerelease: false
57
- version_requirements: *72665590
46
+ version_requirements: *74228200
58
47
  - !ruby/object:Gem::Dependency
59
48
  name: rb-fsevent
60
- requirement: &72665290 !ruby/object:Gem::Requirement
49
+ requirement: &74228010 !ruby/object:Gem::Requirement
61
50
  none: false
62
51
  requirements:
63
52
  - - ! '>='
@@ -65,10 +54,10 @@ dependencies:
65
54
  version: '0'
66
55
  type: :development
67
56
  prerelease: false
68
- version_requirements: *72665290
57
+ version_requirements: *74228010
69
58
  - !ruby/object:Gem::Dependency
70
59
  name: rb-inotify
71
- requirement: &72664900 !ruby/object:Gem::Requirement
60
+ requirement: &74227780 !ruby/object:Gem::Requirement
72
61
  none: false
73
62
  requirements:
74
63
  - - ! '>='
@@ -76,7 +65,7 @@ dependencies:
76
65
  version: '0'
77
66
  type: :development
78
67
  prerelease: false
79
- version_requirements: *72664900
68
+ version_requirements: *74227780
80
69
  description: Ruby gem providing helper *_uri/*_host methods for Exvo services/apps
81
70
  like DESKTOP/CFS/AUTH/THEMES.
82
71
  email: