ad_man 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/{README.md → README.rdoc} +19 -45
- data/app/helpers/ad_man/application_helper.rb +22 -23
- data/lib/ad_man/version.rb +1 -1
- data/test/dummy/db/development.sqlite3 +0 -0
- data/test/dummy/db/schema.rb +1 -2
- data/test/dummy/db/test.sqlite3 +0 -0
- data/test/dummy/log/development.log +30591 -14649
- data/test/dummy/log/test.log +1406 -0
- data/test/dummy/tmp/cache/assets/{D60/4E0/sprockets%2F1afdb2579da0da75df12b43c58333f04 → C02/0A0/sprockets%2F625bdc26802f8c498265353870490587} +0 -0
- data/test/dummy/tmp/cache/assets/CC8/220/sprockets%2F234102a39a522cfab9195fd0d7c12640 +0 -0
- data/test/dummy/tmp/cache/assets/CD6/A60/sprockets%2Fcca4c63026454615fd0a54b65b881d64 +0 -0
- data/test/dummy/tmp/cache/assets/CD8/370/sprockets%2F357970feca3ac29060c1e3861e2c0953 +0 -0
- data/test/dummy/tmp/cache/assets/{D93/C00/sprockets%2F62ce5a5ac0174b45e8ec26cfd0e372c3 → CE4/9E0/sprockets%2F3f5956491fde7227a651e20e4d756b1a} +0 -0
- data/test/dummy/tmp/cache/assets/{C4B/270/sprockets%2Fe4e551930b178644219b4815cd20b726 → D31/910/sprockets%2Fc1c18d3d756fe2777d18b236a0aea400} +0 -0
- data/test/dummy/tmp/cache/assets/D32/A10/sprockets%2F13fe41fee1fe35b49d145bcc06610705 +0 -0
- data/test/dummy/tmp/cache/assets/{D6D/A00/sprockets%2Ffda0ab5b1163661cd985617b079ff6bc → D3A/220/sprockets%2Fce53c5b352a83645d36d96aff26020fb} +0 -0
- data/test/dummy/tmp/cache/assets/{CE6/0E0/sprockets%2F2ea8935a8e0017c0f2e7740e88b1d597 → D3E/AF0/sprockets%2F317881d54abbd5721deee7d204e70e66} +0 -0
- data/test/dummy/tmp/cache/assets/D4E/1B0/sprockets%2Ff7cbd26ba1d28d48de824f0e94586655 +0 -0
- data/test/dummy/tmp/cache/assets/D5A/EA0/sprockets%2Fd771ace226fc8215a3572e0aa35bb0d6 +0 -0
- data/test/dummy/tmp/cache/assets/D79/2D0/sprockets%2F0d684f7bbe7d675f000dff8821d90ae8 +0 -0
- data/test/dummy/tmp/cache/assets/{E00/6F0/sprockets%2F41b788fc4de0cdcfa86c81c25b1fd72e → DBA/3C0/sprockets%2F9ca84f8118d29c3fd7bfd2876f83dc7e} +0 -0
- data/test/dummy/tmp/cache/assets/DDC/400/sprockets%2Fcffd775d018f68ce5dba1ee0d951a994 +0 -0
- data/test/dummy/tmp/cache/assets/{DA6/7B0/sprockets%2Fb8f1adecef3b6c4780afb36783e75047 → DF7/090/sprockets%2Fb3b1a32b0f923d6741fd5dacdf9f59ab} +0 -0
- data/test/dummy/tmp/cache/assets/E04/890/sprockets%2F2f5173deea6c795b8fdde723bb4b63af +0 -0
- data/test/dummy/tmp/cache/assets/E56/460/sprockets%2F5dde4d3dd93c8afa78eb0ba3fb55c20c +0 -0
- metadata +30 -116
- data/test/dummy/public/system/ad_man/advertisements/ad_banners/000/000/003/original/tshirthangout-banner_728x90.gif +0 -0
- data/test/dummy/public/system/ad_man/advertisements/ad_banners/000/000/003/small/tshirthangout-banner_728x90.gif +0 -0
- data/test/dummy/public/system/ad_man/advertisements/ad_banners/000/000/004/original/ieeextreme_banner_728x90.gif +0 -0
- data/test/dummy/public/system/ad_man/advertisements/ad_banners/000/000/004/small/ieeextreme_banner_728x90.gif +0 -0
- data/test/dummy/public/system/ad_man/advertisements/ad_banners/000/000/005/original/banner_728x90.jpg +0 -0
- data/test/dummy/public/system/ad_man/advertisements/ad_banners/000/000/005/small/banner_728x90.jpg +0 -0
- data/test/dummy/public/system/ad_man/advertisements/ad_banners/000/000/006/small/728x90_2MM.jpg +0 -0
- data/test/dummy/public/system/ad_man/advertisements/ad_banners/000/000/007/original/banner_728x90_2.jpg +0 -0
- data/test/dummy/public/system/ad_man/advertisements/ad_banners/000/000/007/small/banner_728x90_2.jpg +0 -0
- data/test/dummy/public/system/ad_man/advertisements/ad_banners/000/000/008/banner/728x90_2MM.jpg +0 -0
- data/test/dummy/public/system/ad_man/advertisements/ad_banners/000/000/008/leaderboard/728x90_2MM.jpg +0 -0
- data/test/dummy/public/system/ad_man/advertisements/ad_banners/000/000/008/original/728x90_2MM.jpg +0 -0
- data/test/dummy/public/system/ad_man/advertisements/ad_banners/000/000/009/banner/banner_728x90_2.jpg +0 -0
- data/test/dummy/public/system/ad_man/advertisements/ad_banners/000/000/009/leaderboard/banner_728x90_2.jpg +0 -0
- data/test/dummy/public/system/ad_man/advertisements/ad_banners/000/000/009/original/banner_728x90_2.jpg +0 -0
- data/test/dummy/public/system/ad_man/advertisements/ad_banners/000/000/010/banner/hubpages_728-90-b.gif +0 -0
- data/test/dummy/public/system/ad_man/advertisements/ad_banners/000/000/010/leaderboard/hubpages_728-90-b.gif +0 -0
- data/test/dummy/public/system/ad_man/advertisements/ad_banners/000/000/010/original/hubpages_728-90-b.gif +0 -0
- data/test/dummy/public/system/ad_man/advertisements/ad_banners/000/000/011/banner/728_90banner2health.gif +0 -0
- data/test/dummy/public/system/ad_man/advertisements/ad_banners/000/000/011/leaderboard/728_90banner2health.gif +0 -0
- data/test/dummy/public/system/ad_man/advertisements/ad_banners/000/000/011/original/728_90banner2health.gif +0 -0
- data/test/dummy/public/system/ad_man/advertisements/ad_banners/000/000/012/banner/tshirthangout-banner_728x90.gif +0 -0
- data/test/dummy/public/system/ad_man/advertisements/ad_banners/000/000/012/leaderboard/tshirthangout-banner_728x90.gif +0 -0
- data/test/dummy/public/system/ad_man/advertisements/ad_banners/000/000/012/original/tshirthangout-banner_728x90.gif +0 -0
- data/test/dummy/public/system/ad_man/advertisements/ad_banners/000/000/013/banner/ieeextreme_banner_728x90.gif +0 -0
- data/test/dummy/public/system/ad_man/advertisements/ad_banners/000/000/013/leaderboard/ieeextreme_banner_728x90.gif +0 -0
- data/test/dummy/public/system/ad_man/advertisements/ad_banners/000/000/013/original/ieeextreme_banner_728x90.gif +0 -0
- data/test/dummy/public/system/ad_man/advertisements/ad_banners/000/000/014/banner/tshirthangout-banner_728x90.gif +0 -0
- data/test/dummy/public/system/ad_man/advertisements/ad_banners/000/000/014/leaderboard/tshirthangout-banner_728x90.gif +0 -0
- data/test/dummy/public/system/ad_man/advertisements/ad_banners/000/000/014/original/tshirthangout-banner_728x90.gif +0 -0
- data/test/dummy/public/system/ad_man/advertisements/ad_banners/000/000/018/banner/tshirthangout-banner_728x90.gif +0 -0
- data/test/dummy/public/system/ad_man/advertisements/ad_banners/000/000/018/leaderboard/tshirthangout-banner_728x90.gif +0 -0
- data/test/dummy/public/system/ad_man/advertisements/ad_banners/000/000/018/original/tshirthangout-banner_728x90.gif +0 -0
- data/test/dummy/public/system/ad_man/advertisements/ad_banners/000/000/019/banner/ieeextreme_banner_728x90.gif +0 -0
- data/test/dummy/public/system/ad_man/advertisements/ad_banners/000/000/019/leaderboard/ieeextreme_banner_728x90.gif +0 -0
- data/test/dummy/public/system/ad_man/advertisements/ad_banners/000/000/019/original/ieeextreme_banner_728x90.gif +0 -0
- data/test/dummy/public/system/ad_man/advertisements/ad_banners/000/000/020/banner/banner_728x90.jpg +0 -0
- data/test/dummy/public/system/ad_man/advertisements/ad_banners/000/000/020/leaderboard/banner_728x90.jpg +0 -0
- data/test/dummy/public/system/ad_man/advertisements/ad_banners/000/000/020/original/banner_728x90.jpg +0 -0
- data/test/dummy/public/system/ad_man/advertisements/ad_banners/000/000/021/banner/728_90banner2health.gif +0 -0
- data/test/dummy/public/system/ad_man/advertisements/ad_banners/000/000/021/leaderboard/728_90banner2health.gif +0 -0
- data/test/dummy/public/system/ad_man/advertisements/ad_banners/000/000/021/original/728_90banner2health.gif +0 -0
- data/test/dummy/public/system/ad_man/advertisements/ad_banners/000/000/022/banner/ls_mimi_08_05_728_90.jpg +0 -0
- data/test/dummy/public/system/ad_man/advertisements/ad_banners/000/000/022/leaderboard/ls_mimi_08_05_728_90.jpg +0 -0
- data/test/dummy/public/system/ad_man/advertisements/ad_banners/000/000/022/original/ls_mimi_08_05_728_90.jpg +0 -0
- data/test/dummy/public/system/ad_man/advertisements/ad_banners/000/000/024/banner/hubpages_728-90-b.gif +0 -0
- data/test/dummy/public/system/ad_man/advertisements/ad_banners/000/000/024/leaderboard/hubpages_728-90-b.gif +0 -0
- data/test/dummy/public/system/ad_man/advertisements/ad_banners/000/000/024/original/hubpages_728-90-b.gif +0 -0
- data/test/dummy/tmp/pids/server.pid +0 -1
- /data/test/dummy/public/system/ad_man/advertisements/ad_banners/000/000/{006 → 002}/original/728x90_2MM.jpg +0 -0
data/{README.md → README.rdoc}
RENAMED
@@ -1,56 +1,36 @@
|
|
1
1
|
Ad_man
|
2
|
-
|
2
|
+
Ad_man is an advertising manager mountable engine. It allows the user to upload and manage advertising banners, and provides an easy to use helper for inserting the banners on your website. Also counts the number of times an ad has shown, and the number of times an advertisement has been clicked on. The user must set a keyword for each ad.
|
3
3
|
|
4
|
-
|
5
|
-
|
6
|
-
Currently supports two image sizes for advertising: Leaderboard 728 x 90 and Banner 468 x 60.
|
7
|
-
TODO: Will implement 9 different sizes as mentioned by google's adwords requirements.
|
4
|
+
Currently supports two image sizes for advertising: Leaderboard 728 x 90 and Banner 468 x 60. TODO: Will implement 9 different sizes as mentioned by google's adwords requirements.
|
8
5
|
|
9
6
|
Requires Paperclip 3.1, and requires ImageMagick be running on the server.
|
10
7
|
|
11
|
-
|
12
|
-
|
8
|
+
Getting started
|
13
9
|
Ad_man works with Rails 3.2 onwards. You can add it to your Gemfile with:
|
14
10
|
|
15
|
-
```ruby
|
16
11
|
gem 'ad_man'
|
17
|
-
```
|
18
|
-
|
19
12
|
After you install Ad_man and add it to your Gemfile, you need to run the generator:
|
20
13
|
|
21
|
-
```console
|
22
14
|
rails generate ad_man:install
|
23
|
-
```
|
24
|
-
|
25
15
|
Install the migrations, and rake the database:
|
26
|
-
|
16
|
+
|
27
17
|
rake ad_man:install:migrations
|
28
18
|
rake db:migrate
|
29
|
-
|
19
|
+
See where Ad_man is located by running:
|
30
20
|
|
31
|
-
See where Ad_man is located by running:
|
32
|
-
```console
|
33
21
|
rake routes
|
34
|
-
|
35
|
-
|
36
|
-
In our case, we needed to move the line generated by the install in the routes file to our admin space. Then add any before_filters to the controllers that were generated.
|
22
|
+
In our case, we needed to move the line generated by the install in the routes file to our admin space. Then add any before_filters to the controllers that were generated.
|
37
23
|
|
38
24
|
Make sure to change references to the application using the main_app helper:
|
39
|
-
|
25
|
+
|
40
26
|
<%= link_to "Home", main_app.root_path %>
|
41
27
|
<%= link_to "Advertising", main_app.ad_man_path %>
|
42
|
-
```
|
43
|
-
|
44
28
|
One final change may be necessary in order to preview an image before saving, and that is to add this line to the admin view:
|
45
|
-
```erb
|
46
|
-
<%= javascript_include_tag "ad_man/advertisements.js" %>
|
47
|
-
```
|
48
29
|
|
49
|
-
|
50
|
-
|
51
|
-
If you need to change the default values set by ad_man, you will need to create an ad_man.rb initializer in your config/initializers folder.
|
30
|
+
<%= javascript_include_tag "ad_man/advertisements.js" %>
|
31
|
+
Changing default values
|
32
|
+
If you need to change the default values set by ad_man, you will need to create an ad_man.rb initializer in your config/initializers folder.
|
52
33
|
|
53
|
-
```ruby
|
54
34
|
# AdMan Default Values
|
55
35
|
AdMan.leaderboard_size = "728x90"
|
56
36
|
AdMan.banner_size = "468x60"
|
@@ -65,23 +45,17 @@ AdMan.content_type = ["image/jpg", "image/bmp", "image/png", "image/gif", "image
|
|
65
45
|
|
66
46
|
# Configurable max advertising for keyword
|
67
47
|
AdMan.max_count = 6
|
68
|
-
|
69
|
-
|
70
|
-
## Putting an advertisement in the view
|
71
|
-
|
48
|
+
Putting an advertisement in the view
|
72
49
|
To put your advertisement in the view just add:
|
73
|
-
|
50
|
+
|
74
51
|
<%= link_to_ad %>
|
75
|
-
|
76
|
-
Currently there are three parameters that can control which ads get shown on your page. :keyword, :size, and :display_on_all_pages.
|
77
|
-
```erb
|
78
|
-
<%= link_to_ad :keyword => "Your Keyword", :size => "leaderboard", :display_on_all_pages => false %>
|
79
|
-
```
|
80
|
-
## Authors
|
81
|
-
Written by [David Strand](http://www.github.com/wspyder) and [Tyler Hu](http://www.github.com/tylerhu)
|
52
|
+
To call advertisements by keyword:
|
82
53
|
|
83
|
-
|
54
|
+
<%= link_to_ad @keyword.name %>
|
55
|
+
Authors
|
56
|
+
Written by David Strand and Tyler Hu
|
84
57
|
|
85
|
-
Copyright
|
58
|
+
Copyright & Licensing
|
59
|
+
Copyright (c) 2012 Kudelabs, Kudelabs on Github
|
86
60
|
|
87
|
-
Released under MIT License.
|
61
|
+
Released under MIT License.
|
@@ -1,28 +1,27 @@
|
|
1
1
|
module AdMan
|
2
2
|
module ApplicationHelper
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
end
|
19
|
-
end
|
3
|
+
def link_to_ad(keyword = nil, size = "leaderboard")
|
4
|
+
keyword ||= get_keyword_from_url
|
5
|
+
if !keyword.blank? && !Keyword.find_by_name(keyword).nil?
|
6
|
+
keyword_id = Keyword.find_by_name(keyword).id
|
7
|
+
ad = Advertisement.render_random_ad(keyword_id)
|
8
|
+
#grab size? leaderboard or banner
|
9
|
+
elsif keyword.blank?
|
10
|
+
ad = Advertisement.render_random_ad
|
11
|
+
end
|
12
|
+
if !ad.nil?
|
13
|
+
ad.display_count += 1
|
14
|
+
ad.save
|
15
|
+
link_to image_tag(ad.ad_banner.url(size)), { :controller => 'advertisements', :action => 'click_through', :id => ad.id },
|
16
|
+
:method => :post, :target => '_blank'
|
17
|
+
end
|
18
|
+
end
|
20
19
|
|
21
20
|
#grab the keyword form request url
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
21
|
+
def get_keyword_from_url
|
22
|
+
req_url = request.env["REQUEST_PATH"].split("/")
|
23
|
+
keyword_names = Keyword.all.map{ |keyword| keyword.name }
|
24
|
+
keyword = req_url & keyword_names
|
25
|
+
end
|
26
|
+
end
|
28
27
|
end
|
data/lib/ad_man/version.rb
CHANGED
Binary file
|
data/test/dummy/db/schema.rb
CHANGED
@@ -11,7 +11,7 @@
|
|
11
11
|
#
|
12
12
|
# It's strongly recommended to check this file into your version control system.
|
13
13
|
|
14
|
-
ActiveRecord::Schema.define(:version =>
|
14
|
+
ActiveRecord::Schema.define(:version => 20120808101547) do
|
15
15
|
|
16
16
|
create_table "ad_man_advertisements", :force => true do |t|
|
17
17
|
t.string "title"
|
@@ -27,7 +27,6 @@ ActiveRecord::Schema.define(:version => 20120809065243) do
|
|
27
27
|
t.date "start_date"
|
28
28
|
t.date "end_date"
|
29
29
|
t.integer "keyword_id"
|
30
|
-
t.integer "click_count", :default => 0, :null => false
|
31
30
|
end
|
32
31
|
|
33
32
|
create_table "ad_man_keywords", :force => true do |t|
|
Binary file
|