nesta-plugin-google-ads 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ lib/bundler/man
11
+ pkg
12
+ rdoc
13
+ spec/reports
14
+ test/tmp
15
+ test/version_tmp
16
+ tmp
17
+ .*sw*
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in nesta-plugin-google-ads.gemspec
4
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2012 Joshua Mervine
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,132 @@
1
+ # Nesta::Plugin::Google::Ads
2
+
3
+ Include google ads in your Nesta CMS applciation.
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'nesta-plugin-google-ads'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install nesta-plugin-google-ads
18
+
19
+ ## Usage
20
+
21
+ 1. Update your configs. [optional if you're passing params to helper, see below]
22
+
23
+ # config/config.yml
24
+ # this sets default which can be overriden in your helper
25
+ # call
26
+ google_ad:
27
+ client: google_client_id
28
+ slot: google_ad_slot_id
29
+ width: google_ad_width
30
+ height: google_ad_height
31
+
32
+ 2. Add helper method to your layout.haml or where you want it.
33
+
34
+ # views/layout.haml
35
+ -#- ... layout contents ...
36
+
37
+ = google_ad
38
+
39
+ -#- ... layout contents ...
40
+
41
+ > 'google_ad' helper also takes a hash of google_ad keys, which will
42
+ > override defaults set in config/config.yml.
43
+ >
44
+ > Example:
45
+ >
46
+ > = google_ad( "width" => 200, "height" => 200 )
47
+
48
+
49
+ ## Examples
50
+
51
+ ### Postal3
52
+
53
+ #### Menu Ad
54
+
55
+ # file: views/index.haml
56
+ 1 #header
57
+ 2 %h1#logo
58
+ 3 %a{ :href => "/" }= @heading
59
+ 4 %small= no_widow @subtitle
60
+ 5
61
+ 6 #sidebar
62
+ 7 = haml :categories, :layout => false
63
+ 8 = haml :feed, :layout => false
64
+ 9 = haml :about, :layout => false
65
+ 10 = google_ad
66
+ 11
67
+ 12 #content
68
+ 13 - @articles.each do |article|
69
+ 14 = haml :summary, :layout => false, :locals => { :article => article, :heading => :h2 }
70
+
71
+ #### Top Ad
72
+
73
+ # file: views/index.haml
74
+ 1 #header
75
+ 2 %h1#logo
76
+ 3 %a{ :href => "/" }= @heading
77
+ 4 %small= no_widow @subtitle
78
+ 5
79
+ 6 #sidebar
80
+ 7 = haml :categories, :layout => false
81
+ 8 = haml :feed, :layout => false
82
+ 9 = haml :about, :layout => false
83
+ 10
84
+ 11 #content
85
+ 12 = google_ad
86
+ 13 - @articles.each do |article|
87
+ 14 = haml :summary, :layout => false, :locals => { :article => article, :heading => :h2 }
88
+
89
+ #### Bottom Ad
90
+
91
+ # file: views/index.haml
92
+ 1 #header
93
+ 2 %h1#logo
94
+ 3 %a{ :href => "/" }= @heading
95
+ 4 %small= no_widow @subtitle
96
+ 5
97
+ 6 #sidebar
98
+ 7 = haml :categories, :layout => false
99
+ 8 = haml :feed, :layout => false
100
+ 9 = haml :about, :layout => false
101
+ 10
102
+ 11 #content
103
+ 12 - @articles.each do |article|
104
+ 13 = haml :summary, :layout => false, :locals => { :article => article, :heading => :h2 }
105
+ 14 = google_ad
106
+
107
+ #### Multiple Ads
108
+
109
+ # file: views/index.haml
110
+ 1 #header
111
+ 2 %h1#logo
112
+ 3 %a{ :href => "/" }= @heading
113
+ 4 %small= no_widow @subtitle
114
+ 5
115
+ 6 #sidebar
116
+ 7 = haml :categories, :layout => false
117
+ 8 = haml :feed, :layout => false
118
+ 9 = haml :about, :layout => false
119
+ 14 = google_ad("slot" => 0000000000, "width" => 200, "height" => 200)
120
+ 10
121
+ 11 #content
122
+ 12 - @articles.each do |article|
123
+ 13 = haml :summary, :layout => false, :locals => { :article => article, :heading => :h2 }
124
+ 14 = google_ad
125
+
126
+ ## Contributing
127
+
128
+ 1. Fork it
129
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
130
+ 3. Commit your changes (`git commit -am 'Added some feature'`)
131
+ 4. Push to the branch (`git push origin my-new-feature`)
132
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,11 @@
1
+ #!/usr/bin/env rake
2
+ require "bundler/gem_tasks"
3
+
4
+ task :doc do
5
+ puts %x{ yard --protected ./lib }
6
+ end
7
+
8
+ task :pages do
9
+ puts %x{ git checkout gh-pages && git merge master }
10
+ puts %x{ git checkout - }
11
+ end
@@ -0,0 +1,198 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
4
+ <head>
5
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
6
+ <title>
7
+ Module: Google::Ads::Helpers
8
+
9
+ &mdash; Documentation by YARD 0.8.2.1
10
+
11
+ </title>
12
+
13
+ <link rel="stylesheet" href="../../css/style.css" type="text/css" media="screen" charset="utf-8" />
14
+
15
+ <link rel="stylesheet" href="../../css/common.css" type="text/css" media="screen" charset="utf-8" />
16
+
17
+ <script type="text/javascript" charset="utf-8">
18
+ hasFrames = window.top.frames.main ? true : false;
19
+ relpath = '../../';
20
+ framesUrl = "../../frames.html#!" + escape(window.location.href);
21
+ </script>
22
+
23
+
24
+ <script type="text/javascript" charset="utf-8" src="../../js/jquery.js"></script>
25
+
26
+ <script type="text/javascript" charset="utf-8" src="../../js/app.js"></script>
27
+
28
+
29
+ </head>
30
+ <body>
31
+ <div id="header">
32
+ <div id="menu">
33
+
34
+ <a href="../../_index.html">Index (H)</a> &raquo;
35
+ <span class='title'><span class='object_link'><a href="../../Nesta.html" title="Nesta (module)">Nesta</a></span></span> &raquo; <span class='title'><span class='object_link'><a href="../../Nesta/Plugin.html" title="Nesta::Plugin (module)">Plugin</a></span></span> &raquo; <span class='title'><span class='object_link'><a href="../../Nesta/Plugin/Google.html" title="Nesta::Plugin::Google (module)">Google</a></span></span> &raquo; <span class='title'><span class='object_link'><a href="../../Nesta/Plugin/Google/Ads.html" title="Google::Ads (module)">Ads</a></span></span>
36
+ &raquo;
37
+ <span class="title">Helpers</span>
38
+
39
+
40
+ <div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
41
+ </div>
42
+
43
+ <div id="search">
44
+
45
+ <a class="full_list_link" id="class_list_link"
46
+ href="../../class_list.html">
47
+ Class List
48
+ </a>
49
+
50
+ <a class="full_list_link" id="method_list_link"
51
+ href="../../method_list.html">
52
+ Method List
53
+ </a>
54
+
55
+ <a class="full_list_link" id="file_list_link"
56
+ href="../../file_list.html">
57
+ File List
58
+ </a>
59
+
60
+ </div>
61
+ <div class="clear"></div>
62
+ </div>
63
+
64
+ <iframe id="search_frame"></iframe>
65
+
66
+ <div id="content"><h1>Module: Google::Ads::Helpers
67
+
68
+
69
+
70
+ </h1>
71
+
72
+ <dl class="box">
73
+
74
+
75
+
76
+
77
+
78
+
79
+
80
+
81
+ <dt class="r1 last">Defined in:</dt>
82
+ <dd class="r1 last">lib/nesta-plugin-google-ads/init.rb</dd>
83
+
84
+ </dl>
85
+ <div class="clear"></div>
86
+
87
+
88
+
89
+
90
+
91
+
92
+
93
+
94
+
95
+ <h2>
96
+ Instance Method Summary
97
+ <small>(<a href="#" class="summary_toggle">collapse</a>)</small>
98
+ </h2>
99
+
100
+ <ul class="summary">
101
+
102
+ <li class="public ">
103
+ <span class="summary_signature">
104
+
105
+ <a href="#google_ad-instance_method" title="#google_ad (instance method)">- (Object) <strong>google_ad</strong>(options = {}) </a>
106
+
107
+
108
+
109
+ </span>
110
+
111
+
112
+
113
+
114
+
115
+
116
+
117
+
118
+
119
+ <span class="summary_desc"><div class='inline'></div></span>
120
+
121
+ </li>
122
+
123
+
124
+ </ul>
125
+
126
+
127
+
128
+
129
+ <div id="instance_method_details" class="method_details_list">
130
+ <h2>Instance Method Details</h2>
131
+
132
+
133
+ <div class="method_details first">
134
+ <h3 class="signature first" id="google_ad-instance_method">
135
+
136
+ - (<tt>Object</tt>) <strong>google_ad</strong>(options = {})
137
+
138
+
139
+
140
+
141
+
142
+ </h3><table class="source_code">
143
+ <tr>
144
+ <td>
145
+ <pre class="lines">
146
+
147
+
148
+ 5
149
+ 6
150
+ 7
151
+ 8
152
+ 9
153
+ 10
154
+ 11
155
+ 12
156
+ 13
157
+ 14
158
+ 15
159
+ 16
160
+ 17
161
+ 18
162
+ 19</pre>
163
+ </td>
164
+ <td>
165
+ <pre class="code"><span class="info file"># File 'lib/nesta-plugin-google-ads/init.rb', line 5</span>
166
+
167
+ <span class='kw'>def</span> <span class='id identifier rubyid_google_ad'>google_ad</span> <span class='id identifier rubyid_options'>options</span><span class='op'>=</span><span class='lbrace'>{</span><span class='rbrace'>}</span>
168
+ <span class='id identifier rubyid_opts'>opts</span> <span class='op'>=</span> <span class='const'>Nesta</span><span class='op'>::</span><span class='const'>Config</span><span class='period'>.</span><span class='id identifier rubyid_google_ad'>google_ad</span><span class='period'>.</span><span class='id identifier rubyid_merge'>merge</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
169
+
170
+ <span class='comment'># all options are required for the add to work correctly
171
+ </span> <span class='tstring'><span class='tstring_beg'>%{</span><span class='tstring_content'>
172
+ &lt;script type=&quot;text/javascript&quot;&gt;&lt;!--
173
+ google_ad_client = &quot;</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_opts'>opts</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>client</span><span class='tstring_end'>&quot;</span></span><span class='rbracket'>]</span><span class='rbrace'>}</span><span class='tstring_content'>&quot;;
174
+ google_ad_slot = &quot;</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_opts'>opts</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>slot</span><span class='tstring_end'>&quot;</span></span><span class='rbracket'>]</span><span class='rbrace'>}</span><span class='tstring_content'>&quot;;
175
+ google_ad_width = </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_opts'>opts</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>width</span><span class='tstring_end'>&quot;</span></span><span class='rbracket'>]</span><span class='rbrace'>}</span><span class='tstring_content'>;
176
+ google_ad_height = </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_opts'>opts</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>height</span><span class='tstring_end'>&quot;</span></span><span class='rbracket'>]</span><span class='rbrace'>}</span><span class='tstring_content'>;
177
+ //--&gt;
178
+ &lt;/script&gt;
179
+ &lt;script type=&quot;text/javascript&quot; src=&quot;http://pagead2.googlesyndication.com/pagead/show_ads.js&quot;&gt;&lt;/script&gt;
180
+ </span><span class='tstring_end'>}</span></span>
181
+ <span class='kw'>end</span></pre>
182
+ </td>
183
+ </tr>
184
+ </table>
185
+ </div>
186
+
187
+ </div>
188
+
189
+ </div>
190
+
191
+ <div id="footer">
192
+ Generated on Thu Aug 23 15:53:22 2012 by
193
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
194
+ 0.8.2.1 (ruby-1.9.3).
195
+ </div>
196
+
197
+ </body>
198
+ </html>
data/doc/Nesta.html ADDED
@@ -0,0 +1,119 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
4
+ <head>
5
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
6
+ <title>
7
+ Module: Nesta
8
+
9
+ &mdash; Documentation by YARD 0.8.2.1
10
+
11
+ </title>
12
+
13
+ <link rel="stylesheet" href="css/style.css" type="text/css" media="screen" charset="utf-8" />
14
+
15
+ <link rel="stylesheet" href="css/common.css" type="text/css" media="screen" charset="utf-8" />
16
+
17
+ <script type="text/javascript" charset="utf-8">
18
+ hasFrames = window.top.frames.main ? true : false;
19
+ relpath = '';
20
+ framesUrl = "frames.html#!" + escape(window.location.href);
21
+ </script>
22
+
23
+
24
+ <script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
25
+
26
+ <script type="text/javascript" charset="utf-8" src="js/app.js"></script>
27
+
28
+
29
+ </head>
30
+ <body>
31
+ <div id="header">
32
+ <div id="menu">
33
+
34
+ <a href="_index.html">Index (N)</a> &raquo;
35
+
36
+
37
+ <span class="title">Nesta</span>
38
+
39
+
40
+ <div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
41
+ </div>
42
+
43
+ <div id="search">
44
+
45
+ <a class="full_list_link" id="class_list_link"
46
+ href="class_list.html">
47
+ Class List
48
+ </a>
49
+
50
+ <a class="full_list_link" id="method_list_link"
51
+ href="method_list.html">
52
+ Method List
53
+ </a>
54
+
55
+ <a class="full_list_link" id="file_list_link"
56
+ href="file_list.html">
57
+ File List
58
+ </a>
59
+
60
+ </div>
61
+ <div class="clear"></div>
62
+ </div>
63
+
64
+ <iframe id="search_frame"></iframe>
65
+
66
+ <div id="content"><h1>Module: Nesta
67
+
68
+
69
+
70
+ </h1>
71
+
72
+ <dl class="box">
73
+
74
+
75
+
76
+
77
+
78
+
79
+
80
+
81
+ <dt class="r1 last">Defined in:</dt>
82
+ <dd class="r1 last">lib/nesta-plugin-google-ads/init.rb<span class="defines">,<br />
83
+ lib/nesta-plugin-google-ads/version.rb</span>
84
+ </dd>
85
+
86
+ </dl>
87
+ <div class="clear"></div>
88
+
89
+ <h2>Defined Under Namespace</h2>
90
+ <p class="children">
91
+
92
+
93
+ <strong class="modules">Modules:</strong> <span class='object_link'><a href="Nesta/Plugin.html" title="Nesta::Plugin (module)">Plugin</a></span>
94
+
95
+
96
+
97
+ <strong class="classes">Classes:</strong> <span class='object_link'><a href="Nesta/App.html" title="Nesta::App (class)">App</a></span>, <span class='object_link'><a href="Nesta/Config.html" title="Nesta::Config (class)">Config</a></span>
98
+
99
+
100
+ </p>
101
+
102
+
103
+
104
+
105
+
106
+
107
+
108
+
109
+
110
+ </div>
111
+
112
+ <div id="footer">
113
+ Generated on Thu Aug 23 15:53:22 2012 by
114
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
115
+ 0.8.2.1 (ruby-1.9.3).
116
+ </div>
117
+
118
+ </body>
119
+ </html>