refinerycms-announcements 1.0 → 1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -17,6 +17,15 @@ class AnnouncementsController < ApplicationController
17
17
  present(@page)
18
18
  end
19
19
 
20
+ def sitemap
21
+ headers['Content-Type'] = 'application/xml'
22
+ @announcements = Announcement.displayable.all
23
+ logger.info @announcements.inspect
24
+ respond_to do |format|
25
+ format.xml {}
26
+ end
27
+ end
28
+
20
29
  protected
21
30
 
22
31
  def find_all_announcements
@@ -0,0 +1,24 @@
1
+ xml.instruct!
2
+
3
+ xml.urlset "xmlns" => "http://www.sitemaps.org/schemas/sitemap/0.9" do
4
+
5
+ for announcement in @announcements
6
+ duration = (announcement.ends_at - announcement.starts_at)
7
+ xml.url do
8
+ xml.loc url_for(:controller => "announcements", :action =>:show, :id => announcement.id, :only_path => false)
9
+ xml.lastmod announcement.updated_at.to_date
10
+ xml.priority "0.7"
11
+ xml.changefreq case
12
+ when duration > 6.months
13
+ "monthly"
14
+ when duration > 2.months
15
+ "weekly"
16
+ when duration > 2.weeks
17
+ "daily"
18
+ when duration > 2.days
19
+ "hourly"
20
+ end
21
+ end
22
+ end
23
+
24
+ end
@@ -1,5 +1,9 @@
1
1
  ::Refinery::Application.routes.draw do
2
- resources :announcements, :only => [:index, :show]
2
+ resources :announcements, :only => [:index, :show] do
3
+ collection do
4
+ get :sitemap
5
+ end
6
+ end
3
7
 
4
8
  scope(:path => 'refinery', :as => 'admin', :module => 'admin') do
5
9
  resources :announcements, :except => :show do
metadata CHANGED
@@ -1,20 +1,20 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: refinerycms-announcements
3
3
  version: !ruby/object:Gem::Version
4
- hash: 15
4
+ hash: 13
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
- - 0
9
- version: "1.0"
8
+ - 1
9
+ version: "1.1"
10
10
  platform: ruby
11
11
  authors:
12
- - "C\xC3\xA9dric Bousmanne"
12
+ - Cedric Bousmanne
13
13
  autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2011-11-28 00:00:00 Z
17
+ date: 2011-12-08 00:00:00 Z
18
18
  dependencies: []
19
19
 
20
20
  description: Announcements is an engine for Refinery CMS to manage temporary announce. It can be used, for example, as an advertising system for your website.
@@ -49,7 +49,8 @@ files:
49
49
  - app/views/admin/announcements/new.html.erb
50
50
  - app/views/announcements/index.html.erb
51
51
  - app/views/announcements/show.html.erb
52
- homepage: https://github.com/cedricbousmanne/refinerycms-announcements
52
+ - app/views/announcements/sitemap.xml.builder
53
+ homepage: http://www.studio-sept.be/
53
54
  licenses:
54
55
  - MIT
55
56
  post_install_message: