Changesets can be listed by changeset number.
The Git repository is here.
- Revision:
- 178
- Log:
Hub integration of Beast forum. Completed styling for RISC OS Open site.
Removed reliance on JavaScript. Added Textile hints to various views.
Added bespoke utility code used to port over RForum data for posterity;
note the rather large bug that it ignores the deleted flag on RForum
data.Some amount of testing carried out on Firefox, Opera and Netsurf. Looks
OK so far, but there are definitely some aesthetic kinks to work out
still and doubtless some operational bugs will surface once it goes
live and is subjected to more intensive real world use.
- Author:
- rool
- Date:
- Mon Mar 12 00:19:40 +0000 2007
- Size:
- 2447 Bytes
1 | require 'md5' |
2 | |
3 | module ApplicationHelper |
4 | def submit_tag(value = "Save Changes", options={} ) |
5 | or_option = options.delete(:or) |
6 | return super + "<span class='button_or'>or " + or_option + "</span>" if or_option |
7 | super |
8 | end |
9 | |
10 | def ajax_spinner_for(id, spinner="spinner.gif") |
11 | "<img src='/images/#{spinner}' style='display:none; vertical-align:middle;' id='#{id.to_s}_spinner'> " |
12 | end |
13 | |
14 | def avatar_for(user, size=32) |
15 | image_tag "http://www.gravatar.com/avatar.php?gravatar_id=#{MD5.md5(user.email)}&size=#{size}", :size => "#{size}x#{size}", :class => 'photo' |
16 | end |
17 | |
18 | def feed_icon_tag(title, url) |
19 | (@feed_icons ||= []) << { :url => url, :title => title } |
20 | link_to image_tag('feed-icon.png', :size => '14x14', :alt => "Subscribe to #{title}"), url |
21 | end |
22 | |
23 | def search_posts_title |
24 | returning(params[:q].blank? ? 'Recent Posts' : "Searching for '#{h params[:q]}'") do |title| |
25 | title << " by #{h User.find(params[:user_id]).display_name}" if params[:user_id] |
26 | title << " in #{h Forum.find(params[:forum_id]).name}" if params[:forum_id] |
27 | end |
28 | end |
29 | |
30 | def search_posts_path(rss = false) |
31 | options = params[:q].blank? ? {} : {:q => params[:q]} |
32 | prefix = rss ? 'formatted_' : '' |
33 | options[:format] = 'rss' if rss |
34 | [[:user, :user_id], [:forum, :forum_id]].each do |(route_key, param_key)| |
35 | return send("#{prefix}#{route_key}_posts_path", options.update(param_key => params[param_key])) if params[param_key] |
36 | end |
37 | options[:q] ? all_search_posts_path(options) : send("#{prefix}all_posts_path", options) |
38 | end |
39 | |
40 | def distance_of_time_in_words(from_time, to_time = 0, include_seconds = false) |
41 | from_time = from_time.to_time if from_time.respond_to?(:to_time) |
42 | to_time = to_time.to_time if to_time.respond_to?(:to_time) |
43 | distance_in_minutes = (((to_time - from_time).abs)/60).round |
44 | |
45 | case distance_in_minutes |
46 | when 0..1 then (distance_in_minutes==0) ? 'a few seconds ago' : '1 minute ago' |
47 | when 2..59 then "#{distance_in_minutes} minutes ago" |
48 | when 60..90 then "1 hour ago" |
49 | when 90..1440 then "#{(distance_in_minutes.to_f / 60.0).round} hours ago" |
50 | when 1440..2160 then '1 day ago' # 1 day to 1.5 days |
51 | when 2160..2880 then "#{(distance_in_minutes.to_f / 1440.0).round} days ago" # 1.5 days to 2 days |
52 | else from_time.strftime("%b %e, %Y %l:%M%p").gsub(/([AP]M)/) { |x| x.downcase } |
53 | end |
54 | end |
55 | |
56 | end |