Changesets can be listed by changeset number.
The Git repository is here.
- Revision:
- 373
- Log:
Initial import of Radiant 0.9.1, which is now packaged as a gem. This is an
import of the tagged 0.9.1 source checked out from GitHub, which isn't quite
the same as the gem distribution - but it doesn't seem to be available in an
archived form and the installed gem already has modifications, so this is
the closest I can get.
- Author:
- rool
- Date:
- Mon Mar 21 13:40:05 +0000 2011
- Size:
- 1917 Bytes
1 | class SiteController < ApplicationController |
2 | include Radiant::Pagination::Controller |
3 | |
4 | skip_before_filter :verify_authenticity_token |
5 | no_login_required |
6 | cattr_writer :cache_timeout |
7 | |
8 | def self.cache_timeout |
9 | @@cache_timeout ||= 5.minutes |
10 | end |
11 | |
12 | def show_page |
13 | url = params[:url] |
14 | if Array === url |
15 | url = url.join('/') |
16 | else |
17 | url = url.to_s |
18 | end |
19 | if @page = find_page(url) |
20 | batch_page_status_refresh if (url == "/" || url == "") |
21 | process_page(@page) |
22 | set_cache_control |
23 | @performed_render ||= true |
24 | else |
25 | render :template => 'site/not_found', :status => 404 |
26 | end |
27 | rescue Page::MissingRootPageError |
28 | redirect_to welcome_url |
29 | end |
30 | |
31 | private |
32 | def batch_page_status_refresh |
33 | @changed_pages = [] |
34 | @pages = Page.find(:all, :conditions => {:status_id => Status[:scheduled].id}) |
35 | @pages.each do |page| |
36 | if page.published_at <= Time.now |
37 | page.status_id = Status[:published].id |
38 | page.save |
39 | @changed_pages << page.id |
40 | end |
41 | end |
42 | |
43 | expires_in nil, :private=>true, "no-cache" => true if @changed_pages.length > 0 |
44 | end |
45 | |
46 | def set_cache_control |
47 | if (request.head? || request.get?) && @page.cache? && live? |
48 | expires_in self.class.cache_timeout, :public => true, :private => false |
49 | else |
50 | expires_in nil, :private => true, "no-cache" => true |
51 | headers['ETag'] = '' |
52 | end |
53 | end |
54 | |
55 | def find_page(url) |
56 | found = Page.find_by_url(url, live?) |
57 | found if found and (found.published? or dev?) |
58 | end |
59 | |
60 | def process_page(page) |
61 | page.pagination_parameters = pagination_parameters |
62 | page.process(request, response) |
63 | end |
64 | |
65 | def dev? |
66 | if dev_host = @config['dev.host'] |
67 | request.host == dev_host |
68 | else |
69 | request.host =~ /^dev\./ |
70 | end |
71 | end |
72 | |
73 | def live? |
74 | not dev? |
75 | end |
76 | |
77 | end |