GitHub Sale: sign up for any paid plan this week and pay nothing until January 1, 2009!  [ hide ]

public
Description: A simple application written in merb to help you manage ad serving across multiple sites
Clone URL: git://github.com/kneath/greed.git
Add impressions & basic serving
kneath (author)
Sun Apr 27 00:38:53 -0700 2008
commit  3a2be190863e49a2211f844ac39505447672148e
tree    59da9828b97b3f130c5736df753df6c02a2085db
parent  fd7fd932d6657833bace20062c954d56a54602b9
...
4
5
6
7
 
8
...
4
5
6
 
7
8
0
@@ -4,4 +4,4 @@ class Dashboard < Application
0
     render
0
   end
0
   
0
-end
0
+end
0
\ No newline at end of file
...
15
16
17
 
 
 
 
 
18
19
...
15
16
17
18
19
20
21
22
23
24
0
@@ -15,5 +15,10 @@ module Merb
0
       (fraction*100).to_s + "%"
0
     end
0
     
0
+ def host_with_port
0
+ request.protocol + request.host
0
+ #"http://" + Merb.config[:host] + ":" + Merb.config[:port]
0
+ end
0
+
0
   end
0
 end
...
1
2
3
 
4
5
6
...
1
2
3
4
5
6
7
0
@@ -1,6 +1,7 @@
0
 class Campaign < ActiveRecord::Base
0
   
0
   belongs_to :spot
0
+ has_many :impressions
0
   
0
   validates_presence_of :name, :starts_on, :ends_on, :spot_id
0
   
...
13
14
15
 
 
 
 
 
16
17
...
13
14
15
16
17
18
19
20
21
22
0
@@ -13,4 +13,9 @@ class Spot < ActiveRecord::Base
0
     return self.campaigns[index - 1]
0
   end
0
   
0
+ # finds an advertisment with weighting, etc taken into account
0
+ def campaign_for_serving
0
+ self.campaigns.first
0
+ end
0
+
0
 end
0
\ No newline at end of file
...
20
21
22
23
 
24
25
26
 
27
 
 
28
29
30
...
20
21
22
 
23
24
25
 
26
27
28
29
30
31
32
0
@@ -20,11 +20,13 @@
0
 <% if @site.spots.empty? %>
0
   <p>No spots added for this site.</p>
0
 <% else %>
0
- <ul class="spots">
0
+ <ul class="spots full-width-spots">
0
     <% for spot in @site.spots %>
0
     <li>
0
- <h4><%=h spot.name %></h4>
0
+ <p class="status"><%=h spot.name %></p>
0
       <p class="meta"><%= spot.campaigns.count %> / <%= spot.campaign_limit %> campaigns filled</p>
0
+ <p class="action"><a href="#" class="codetoggler" toggle="code-<%= spot.id %>">Show Code</a></p>
0
+ <textarea id="code-<%= spot.id %>" class="code-insertion"><%= partial :insertion_code, :spot => spot %></textarea>
0
     </li>
0
     <% end %>
0
   </ul>
...
25
26
27
28
 
29
30
31
...
25
26
27
 
28
29
30
31
0
@@ -25,7 +25,7 @@ use_test :rspec
0
 
0
 ### Add your other dependencies here
0
 
0
-dependencies "merb-assets", "merb_helpers"
0
+dependencies "merb-assets", "merb_helpers", "geoip"
0
 
0
 Merb::BootLoader.after_app_loads do
0
   my_formats = {
...
37
38
39
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
40
41
42
...
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
0
@@ -37,6 +37,22 @@ var rules = {
0
 
0
     // update hidden fields if visual fields have info in them
0
     element.fireEvent('keyup');
0
+ },
0
+
0
+ '.codetoggler': function(element){
0
+ element = $(element);
0
+ toggle_element = $(element.getAttribute('toggle'));
0
+ toggle_element.hide();
0
+ element.addEvent('click', function(e){
0
+ if (toggle_element.visible()){
0
+ toggle_element.hide();
0
+ this.innerHTML = 'Show Code';
0
+ }else{
0
+ toggle_element.show();
0
+ this.innerHTML = 'Hide Code';
0
+ }
0
+ (new Event(e)).stop();
0
+ });
0
   }
0
 }
0
 
...
190
191
192
 
 
 
 
 
 
 
193
194
195
...
285
286
287
 
 
 
288
289
290
...
298
299
300
301
 
 
 
 
 
302
303
304
...
190
191
192
193
194
195
196
197
198
199
200
201
202
...
292
293
294
295
296
297
298
299
300
...
308
309
310
 
311
312
313
314
315
316
317
318
0
@@ -190,6 +190,13 @@ input[type=text], input[type=password], textarea{
0
 input[type=text].datepicker{
0
   width:100px;
0
 }
0
+textarea.code-insertion{
0
+ width:97%;
0
+ height:120px;
0
+ font-family: "Courier New", Courier, monospace;
0
+ font-size:11px;
0
+ color:#000;
0
+}
0
 
0
 input[type=submit], button[type=submit]{
0
   padding:5px 10px;
0
@@ -285,6 +292,9 @@ ul.meta li a{
0
 ul.spots{
0
   margin:15px 0 15px -10px;
0
 }
0
+ul.full-width-spots{
0
+ margin-left:0;
0
+}
0
 ul.spots li{
0
   list-style-type:none;
0
   float:left;
0
@@ -298,7 +308,11 @@ ul.spots li{
0
   -o-border-radius:4px;
0
   border-radius:4px;
0
 }
0
-
0
+ul.full-width-spots li{
0
+ float:none;
0
+ margin-left:0;
0
+ width:auto;
0
+}
0
 .spots p.status{
0
   margin:5px 0;
0
   font-size:11px;
...
9
10
11
12
 
13
14
15
...
22
23
24
 
 
 
 
 
 
 
 
 
 
 
25
26
27
...
9
10
11
 
12
13
14
15
...
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
0
@@ -9,7 +9,7 @@
0
 #
0
 # It's strongly recommended to check this file into your version control system.
0
 
0
-ActiveRecord::Schema.define(:version => 3) do
0
+ActiveRecord::Schema.define(:version => 4) do
0
 
0
   create_table "campaigns", :force => true do |t|
0
     t.string "name"
0
@@ -22,6 +22,17 @@ ActiveRecord::Schema.define(:version => 3) do
0
     t.integer "spot_id"
0
     t.datetime "created_at"
0
     t.datetime "updated_at"
0
+ t.string "link"
0
+ t.integer "impressions_count", :default => 0
0
+ t.integer "clicks_count", :default => 0
0
+ end
0
+
0
+ create_table "impressions", :force => true do |t|
0
+ t.string "ip"
0
+ t.string "country"
0
+ t.boolean "clicked", :default => false
0
+ t.integer "campaign_id"
0
+ t.datetime "created_at"
0
   end
0
 
0
   create_table "sites", :force => true do |t|

Comments

    No one has commented yet.