Changesets can be listed by changeset number.
The Git repository is here.
Changeset 117
Updated for use with HubSsoLib 0.1.0 (Changeset #113). Article details no
longer cached, so login_hop jump into Hub can return to that point of
origin and have the Flash displayed. JavaScript pop-up code for comment
markup help tidied up to fit the Textile quick reference guide, with the
same window dimensions as used in I2.
- Comitted by: adh
- Date: Friday October 27 16:09:44 2006 (over 18 years ago)
Affected files:
- rool/rails/typo/trunk/app/controllers/application.rb (diff)
- rool/rails/typo/trunk/app/controllers/articles_controller.rb (diff)
- rool/rails/typo/trunk/app/views/articles/_comment_box.rhtml (diff)
- rool/rails/typo/trunk/app/views/articles/read.rhtml (diff)
- rool/rails/typo/trunk/components/plugins/textfilters/textile_controller.rb (diff)
- rool/rails/typo/trunk/config/environments/production.rb (diff)
- rool/rails/typo/trunk/public/javascripts/typo.js (diff)
- rool/rails/typo/trunk/vendor/plugins/expiring_action_cache/lib/actionparamcache.rb (diff)
rool/rails/typo/trunk/app/controllers/application.rb:
prev. | current | |
require 'hub_sso_lib' | ||
include HubSsoLib::Core | ||
9 | | |
9 | before_filter :hubssolib_beforehand | |
10 | after_filter :hubssolib_afterwards | |
# Standard Typo gubbins follows, including its own admin login system. | ||
rool/rails/typo/trunk/app/controllers/articles_controller.rb:
prev. | current | |
cache_sweeper :blog_sweeper | ||
26 | | |
26 | cached_pages = [:index, :category, :find_by_date, :archives, :view_page, :tag, :author] | |
# If you're really memory-constrained, then consider replacing | ||
# caches_action_with_params with caches_page | ||
caches_action_with_params *cached_pages |
rool/rails/typo/trunk/app/views/articles/_comment_box.rhtml:
prev. | current | |
<tr> | ||
<td><p><label for="comment_author">Your name</label></p></td> | ||
<td> | ||
19 | ||
19 | <% if hubssolib_privileged? -%> | |
<input id="comment_author" name="comment[author]" size="20" type="text" value="<%= hubssolib_unique_name %>" /> | ||
<% else -%> | ||
<input id="comment_author" name="comment[author]" size="20" type="hidden" value="<%= hubssolib_unique_name %>" /> |
rool/rails/typo/trunk/app/views/articles/read.rhtml:
prev. | current | |
<% if hubssolib_logged_in? -%> | ||
<small><a href="#respond">Add a comment about this article</a></small> | ||
<% else -%> | ||
37 | | |
37 | <b>To add a comment</b> about this article, <a href="/rails/hub/account/login_hop">please log in</a>. | |
<% end -%> | ||
</p> | ||
<% end -%> |
rool/rails/typo/trunk/components/plugins/textfilters/textile_controller.rb:
prev. | current | |
def self.help_text | ||
%{ | ||
7 | | |
7 | See [Why's Textile Quick Reference](http://hobix.com/textile/quick.html). | |
} | ||
end | ||
10 | | |
10 | ||
def self.filtertext(controller,content,text,params) | ||
RedCloth.new(text).to_html(:textile) | ||
end |
rool/rails/typo/trunk/config/environments/production.rb:
prev. | current | |
# config.logger = SyslogLogger.new | ||
9 | ||
9 | # Full error reports are disabled; caching is enabled. | |
config.action_controller.consider_all_requests_local = false | ||
config.action_controller.perform_caching = true | ||
rool/rails/typo/trunk/public/javascripts/typo.js:
prev. | current | |
{ | ||
if (! window.focus) return true; | ||
var href; | ||
75 | | |
75 | window.open(mylink, windowname, 'width=550,height=600,scrollbars=yes'); | |
return false; | ||
} | ||
... | ... | |
} | ||
} | ||
}) | ||
103 | ||
104 | register_onload(function() { if ($('q')) {$('q').setAttribute('autocomplete', 'off');} }) |
rool/rails/typo/trunk/vendor/plugins/expiring_action_cache/lib/actionparamcache.rb:
prev. | current | |
def lifetime | ||
@lifetime[:time] | ||
end | ||
14 | | |
14 | ||
def lifetime=(seconds) | ||
16 | | |
16 | # Only allow the lifetime to be lowered--if one component wants | |
# lifetime=3.hours and another wants lifetime=15.minutes, then | ||
# the right thing to do is to always use lifetime=15.minutes, no | ||
# matter which order they're called in. | ||
return if @lifetime[:time] and @lifetime[:time] < seconds | ||
@lifetime[:time] = seconds | ||
end | ||
23 | | |
23 | ||
def initialize | ||
25 | | |
25 | @body, @headers, @session, @assigns = '', DEFAULT_HEADERS.merge('cookie' => []), [], [] | |
@lifetime = Hash.new | ||
end | ||
end | ||
29 | | |
29 | ||
module Caching | ||
module ActionParams | ||
def self.append_features(base) #:nodoc: | ||
... | ... | |
def expire_action_with_params(options = {}) | ||
return unless perform_caching | ||
47 | | |
47 | ||
if options == {} | ||
expire_meta_fragment(%r{ACTION_PARAM/.*}) | ||
else | ||
... | ... | |
def before(controller) | ||
return unless @actions.include?(controller.action_name.intern) | ||
meta, cache = controller.read_meta_fragment_expire(cache_key(controller)) | ||
74 | | |
74 | ||
if cache | ||
# 304 handling from Tom Fakes, | ||
# http://craz8.com/svn/trunk/plugins/action_cache/lib/action_cache.rb | ||
... | ... | |
controller.response.headers['Cache-Control'] = 'max-age=1' | ||
controller.response.headers['Last-Modified'] = meta[:cached_at].httpdate rescue nil | ||
controller.response.headers['Content-Type'] = meta[:content_type] | ||
83 | | |
83 | ||
if request_time and cached_time <= (request_time + 1) | ||
controller.render(:text => "", :status => 304) | ||
else | ||
controller.render(:text => cache) | ||
end | ||
89 | | |
89 | ||
controller.rendered_action_cache = true | ||
return false | ||
else |