Changesets can be listed by changeset number.
The Git repository is here.
- Revision:
- 15
- Log:
Attempt to update Typo to a Typo SVN HEAD release from around the
time the prototype installation was set up on the RISC OS Open Limited
web site. Timestamps place this at 04-Jul so a revision from 05-Jul or
earlier was pulled and copied over the 2.6.0 tarball stable code.
- Author:
- adh
- Date:
- Sat Jul 22 23:27:35 +0100 2006
- Size:
- 2806 Bytes
1 | # The filters added to this controller will be run for all controllers in the application. |
2 | # Likewise will all the methods added be available for all controllers. |
3 | class ContentController < ApplicationController |
4 | class ExpiryFilter |
5 | def before(controller) |
6 | @request_time = Time.now |
7 | end |
8 | |
9 | def after(controller) |
10 | future_article = |
11 | Article.find(:first, |
12 | :conditions => ['published = ? AND created_at > ?', true, @request_time], |
13 | :order => "created_at ASC" ) |
14 | if future_article |
15 | delta = future_article.created_at - Time.now |
16 | controller.response.lifetime = (delta <= 0) ? 0 : delta |
17 | end |
18 | end |
19 | end |
20 | |
21 | include LoginSystem |
22 | model :user |
23 | |
24 | helper :theme |
25 | |
26 | before_filter :auto_discovery_defaults |
27 | |
28 | def self.caches_action_with_params(*actions) |
29 | super |
30 | around_filter ExpiryFilter.new, :only => actions |
31 | end |
32 | |
33 | def self.cache_page(content, path) |
34 | begin |
35 | # Don't cache the page if there are any questionmark characters in the url |
36 | unless path =~ /\?\w+/ or path =~ /page\d+$/ |
37 | super(content,path) |
38 | PageCache.create(:name => page_cache_file(path)) |
39 | end |
40 | rescue # if there's a caching error, then just return the content. |
41 | content |
42 | end |
43 | end |
44 | |
45 | def self.expire_page(path) |
46 | if cache = PageCache.find(:first, :conditions => ['name = ?', path]) |
47 | cache.destroy |
48 | end |
49 | end |
50 | |
51 | def auto_discovery_defaults |
52 | @auto_discovery_url_rss = |
53 | @request.instance_variable_get(:@auto_discovery_url_rss) |
54 | @auto_discovery_url_atom = |
55 | @request.instance_variable_get(:@auto_discovery_url_atom) |
56 | unless @auto_discovery_url_rss && @auto_discovery_url_atom |
57 | auto_discovery_feed(:type => 'feed') |
58 | @request.instance_variable_set(:@auto_discovery_url_rss, |
59 | @auto_discovery_url_rss) |
60 | @request.instance_variable_set(:@auto_discovery_url_atom, |
61 | @auto_discovery_url_atom) |
62 | end |
63 | end |
64 | |
65 | def auto_discovery_feed(options) |
66 | options = {:only_path => false, :action => 'feed', :controller => 'xml'}.merge options |
67 | # Special cased ugliness. Get rid of it when there's a user feed. |
68 | if options[:type] == 'user' |
69 | options[:type] = 'feed' |
70 | options[:id] = nil |
71 | end |
72 | |
73 | @auto_discovery_url_rss = url_for(({:format => 'rss20'}.merge options)) |
74 | @auto_discovery_url_atom = url_for(({:format => 'atom'}.merge options)) |
75 | end |
76 | |
77 | def theme_layout |
78 | this_blog.current_theme.layout |
79 | end |
80 | |
81 | helper_method :contents |
82 | def contents |
83 | if @articles |
84 | @articles |
85 | elsif @article |
86 | [@article] |
87 | elsif @page |
88 | [@page] |
89 | else |
90 | [] |
91 | end |
92 | end |
93 | |
94 | protected |
95 | |
96 | include_protected ActionView::Helpers::TagHelper, ActionView::Helpers::TextHelper |
97 | |
98 | end |