open_porch 0.5.0 → 0.5.1

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.5.0
1
+ 0.5.1
@@ -15,9 +15,7 @@ class Admin::AreasController < Admin::BaseController
15
15
  start_date = Time.parse(params[:activity_start_date]).to_date rescue 30.days.ago.to_date
16
16
  end_date = Time.parse(params[:activity_end_date]).to_date rescue Date.today
17
17
 
18
- @activities = AreaActivity.grouped_by_day
19
- .search(:day_between => [start_date, end_date])
20
- .where(:area_id => @search.all.collect(&:id))
18
+ @activities = AreaActivity.grouped_by_day.search(:day_between => [start_date, end_date]).where(:area_id => @search.all.collect(&:id))
21
19
  end
22
20
 
23
21
  def new
@@ -11,14 +11,5 @@ module OpenPorchHelper
11
11
  raw %{update_user_activity('#{current_user.full_name}', '#{url}', '#{(UserActivity::EXPIRES-2) * 1000}');}
12
12
  end
13
13
  end
14
-
15
- def show_ad_for(zone_name, area)
16
- return unless defined?(OPEN_PORCH_ZONES)
17
- time = Time.now.to_i
18
-
19
- link_to("http://d1.openx.org/ck.php?cb=#{time}&n=a8417ca6", :class => "ad #{zone_name}", :target => '_blank') do
20
- image_tag("http://d1.openx.org/avw.php?zoneid=#{OPEN_PORCH_ZONES[zone_name.to_s]}&region=#{@area.slug}&cb=#{time}&n=a8417ca6")
21
- end
22
- end
23
14
  end
24
15
 
data/app/models/area.rb CHANGED
@@ -141,6 +141,29 @@ class Area < ActiveRecord::Base
141
141
  end
142
142
  end
143
143
 
144
+ # afr.php returns HTML code
145
+ def openx_ad(zone_name)
146
+ return unless defined?(OPEN_PORCH_ZONES)
147
+ time = Time.now.to_i
148
+ openx_url = "http://d1.openx.org"
149
+
150
+ case zone_name.to_sym
151
+ when :newsletter_text
152
+ url = URI.parse(openx_url)
153
+ res = Net::HTTP.start(url.host, url.port) {|http|
154
+ http.get("/afr.php?zoneid=#{OPEN_PORCH_ZONES[zone_name.to_s]}&region=#{self.slug}&cb=#{time}&n=a8417ca6")
155
+ }
156
+ res.body.gsub("\n", '').gsub(/.*<body>(.*)<div id='beacon.*/, '\1').html_safe
157
+ else
158
+ %{
159
+ <a href="#{openx_url}/ck.php?cb=#{time}&n=a8417ca6", class="ad #{zone_name}" target="_blank">
160
+ <img src="http://d1.openx.org/avw.php?zoneid=#{OPEN_PORCH_ZONES[zone_name.to_s]}&region=#{self.slug}&cb=#{time}&n=a8417ca6" />
161
+ </a>
162
+ }.html_safe
163
+ end
164
+ end
165
+
166
+
144
167
  protected
145
168
  def initialize_issue_numbers
146
169
  self.create_issue_number(:sequence_number => 0)
@@ -27,5 +27,4 @@
27
27
  = link_to "#{next_month.strftime('%b %Y')} &raquo;".html_safe, archive_area_issues_path(@area, next_month.year, next_month.month)
28
28
  = render :partial => 'areas/posts/posts_search_form', :locals => {:advanced => true}
29
29
 
30
- = show_ad_for(:current_issue, @area)
31
-
30
+ = @area.openx_ad(:current_issue)
@@ -19,4 +19,4 @@
19
19
  .right_column
20
20
  = render :partial => 'areas/posts/posts_search_form', :locals => {:advanced => true}
21
21
 
22
- = show_ad_for(:current_issue, @area)
22
+ = @area.openx_ad(:current_issue)
@@ -21,7 +21,7 @@
21
21
 
22
22
  .right_column
23
23
  = render :partial => 'posts_search_form', :locals => {:advanced => true}
24
- = show_ad_for(:current_issue, @area)
25
-
24
+
25
+ = @area.openx_ad(:current_issue)
26
26
 
27
27
 
@@ -43,5 +43,5 @@
43
43
  %p
44
44
  %em= @area.description
45
45
 
46
- = show_ad_for(:current_issue, @area)
46
+ = @area.openx_ad(:current_issue)
47
47
 
@@ -14,7 +14,9 @@
14
14
  </p>
15
15
 
16
16
  <% end %>
17
-
17
+ <br/>
18
+ <hr/>
19
+ <%= @issue.area.openx_ad(:newsletter_image) %>
18
20
 
19
21
  <% @issue.posts.order(:position).each do |post| %>
20
22
  <br/>
@@ -1,4 +1,4 @@
1
- To POST your message, email to <%= mail_to(@issue.area.email) %>
1
+ To POST your message, email to <%= @issue.area.email %>
2
2
 
3
3
  <%= "#{@issue.area.name} NEIGHBORHOOD FORUM NO.#{@issue.number}".upcase %>
4
4
 
@@ -10,17 +10,18 @@ To POST your message, email to <%= mail_to(@issue.area.email) %>
10
10
  <% end %>
11
11
 
12
12
 
13
+ ----------------------------------------------------------------------------
14
+ <%= @issue.area.openx_ad(:newsletter_text) %>
15
+ ----------------------------------------------------------------------------
13
16
 
14
- <% @issue.posts.order(:position).each do |post| %>
15
- ---------------------------------------------
17
+
18
+ <% @issue.posts.order(:position).each_with_index do |post, i| %>
16
19
 
17
20
 
18
- <%= post.title.upcase %>
19
- By <%= post.user_first_name%> <%= post.user_last_name%>, <%=post.user_address %>, <%=post.user_email %>
20
- <%= post.created_at.to_date.to_s(:long) %>
21
- Post your note to neighbors: <%= mail_to(@issue.area.email) %>
21
+ <%= "#{i+1}) #{post.title.upcase}" %>
22
+ By <%= post.user_first_name%> <%= post.user_last_name%>, <%=post.user_address %>, <%=post.user_email %> on <%= post.created_at.to_date.to_s(:long) %>
22
23
 
23
- <%= post.content %>
24
+ <%= post.content.html_safe %>
24
25
 
25
26
  <% end %>
26
27
 
@@ -12,7 +12,8 @@ pop3:
12
12
  openx_zones:
13
13
  development:
14
14
  current_issue: ZONE_ID
15
- newsletter: ZONE_ID
15
+ newsletter_text: ZONE_ID
16
+ newsletter_image: ZONE_ID
16
17
 
17
18
  # PostageApp configuration
18
19
  postageapp:
data/open_porch.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{open_porch}
8
- s.version = "0.5.0"
8
+ s.version = "0.5.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["The Working Group Inc"]
12
- s.date = %q{2011-03-22}
12
+ s.date = %q{2011-03-24}
13
13
  s.default_executable = %q{open_porch_engine}
14
14
  s.description = %q{}
15
15
  s.email = %q{jack@theworkinggroup.ca}
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: open_porch
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.5.0
5
+ version: 0.5.1
6
6
  platform: ruby
7
7
  authors:
8
8
  - The Working Group Inc
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-03-22 00:00:00 -06:00
13
+ date: 2011-03-24 00:00:00 -06:00
14
14
  default_executable: open_porch_engine
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
@@ -401,7 +401,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
401
401
  requirements:
402
402
  - - ">="
403
403
  - !ruby/object:Gem::Version
404
- hash: 3613787567784704505
404
+ hash: 1285707146431313998
405
405
  segments:
406
406
  - 0
407
407
  version: "0"