| In: |
app/models/web.rb
|
| Parent: | Object |
| additional_style | [RW] | |
| address | [RW] | |
| brackets_only | [RW] | |
| color | [RW] | |
| count_pages | [RW] | |
| markup | [RW] | |
| name | [RW] | |
| pages | [RW] | |
| password | [RW] | |
| published | [RW] | |
| safe_mode | [RW] |
# File app/models/web.rb, line 11
11: def initialize(name, address, password = nil)
12: @name, @address, @password, @safe_mode = name, address, password, false
13: @pages = {}
14: end
# File app/models/web.rb, line 36
36: def categories
37: select.map { |page| page.categories }.flatten.uniq.sort
38: end
Create a link for the given page name and link text based on the render mode in options and whether the page exists in the this web.
# File app/models/web.rb, line 43
43: def make_link(name, text = nil, options = {})
44: page = pages[name]
45: text = text || WikiWords.separate(name)
46: link = CGI.escape(name)
47:
48: case options[:mode]
49: when :export
50: if page then "<a class=\"existingWikiWord\" href=\"#{link}.html\">#{text}</a>"
51: else "<span class=\"newWikiWord\">#{text}</span>" end
52: when :publish
53: if page then "<a class=\"existingWikiWord\" href=\"../show/#{link}\">#{text}</a>"
54: else "<span class=\"newWikiWord\">#{text}</span>" end
55: else
56: if page then "<a class=\"existingWikiWord\" href=\"../show/#{link}\">#{text}</a>"
57: else "<span class=\"newWikiWord\">#{text}<a href=\"../show/#{link}\">?</a></span>" end
58: end
59: end
Clears the display cache for all the pages with references to
# File app/models/web.rb, line 63
63: def refresh_pages_with_references(page_name)
64: select.pages_that_reference(page_name).each { |page|
65: page.revisions.each { |revision| revision.clear_display_cache }
66: }
67: end
# File app/models/web.rb, line 69
69: def refresh_revisions
70: select.each { |page| page.revisions.each { |revision| revision.clear_display_cache } }
71: end
# File app/models/web.rb, line 20
20: def remove_pages(pages_to_be_removed)
21: pages.delete_if { |page_name, page| pages_to_be_removed.include?(page) }
22: end