Changesets can be listed by changeset number.
The Git repository is here.
- Revision:
- 193
- Log:
First stage commit of Typo 4.1, modified for the ROOL site.
Includes all local modifications but a final pass needs to be
made to delete any files left over from earlier Typo versions
that shouldn't be here anymore. See the 'tags' section of the
repository for a clean Typo 4.1 tree.Note that symlinks to shared files in the RISC OS Open theme
directory have been deliberately included this time around; I
decided that on balance it was better to leave them in as
placeholders, since unlike symlinks in app/views/shared, the
Typo theme structure is not a standard Rails concept.
- Author:
- rool
- Date:
- Wed Apr 04 18:51:02 +0100 2007
- Size:
- 1559 Bytes
1 | require 'backpack_api' |
2 | require 'redcloth' |
3 | |
4 | # Example: |
5 | # |
6 | # backpack = Backpack.new('<nick>', '<token>'[, '<page id>']) |
7 | # backpack.items.each do |item| |
8 | # puts "#{item.title} @ #{item.link} updated at #{item.date}" |
9 | # end |
10 | # |
11 | class Backpack |
12 | attr_accessor :username, :token, :page_id, :items, :title |
13 | |
14 | # This object holds given information of an item |
15 | class BackpackItem < Struct.new(:completed, :id, :content) |
16 | def to_s |
17 | # Use REXML::Text#value as a workaround for entity decoding |
18 | RedCloth.new(REXML::Text.new(self.content).value).to_html(:textile).gsub(/^<p>|<\/p>$/, '') |
19 | end |
20 | end |
21 | |
22 | # Pass the username, token, and page id for the Backpack page |
23 | # you wish to view the list items for. |
24 | # By default this will request the items right away |
25 | def initialize(username, token, page_id, refresh = true) |
26 | @items = [] |
27 | @username = username |
28 | @token = token |
29 | @page_id = page_id |
30 | @title = '' |
31 | self.refresh if refresh |
32 | end |
33 | |
34 | # This method lets you refresh the items in the items array |
35 | # useful if you keep the object cached in memory and |
36 | def refresh |
37 | bp = BackpackAPI.new(@username, @token) |
38 | begin |
39 | page = bp.show_page(@page_id)['page'].first |
40 | rescue |
41 | # Exception occurs if @page_id isn't valid |
42 | @items = [] |
43 | @title = '' |
44 | else |
45 | @items = parse(page['items'].first) |
46 | @title = page['title'] |
47 | end |
48 | end |
49 | |
50 | private |
51 | |
52 | def parse(result) |
53 | result['item'].collect do |item| |
54 | BackpackItem.new((item['completed'] == 'true'), item['id'], item['content']) |
55 | end |
56 | end |
57 | end |