Web (Class)

In: app/models/web.rb
Parent: Object

Attributes

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] 

Public Class methods

[Source]

    # 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

Public Instance methods

[Source]

    # File app/models/web.rb, line 16
16:   def add_page(page)
17:     @pages[page.name] = page
18:   end

[Source]

    # File app/models/web.rb, line 32
32:   def authors 
33:     select.authors 
34:   end

[Source]

    # File app/models/web.rb, line 76
76:   def brackets_only() @brackets_only || false end

[Source]

    # File app/models/web.rb, line 36
36:   def categories
37:     select.map { |page| page.categories }.flatten.uniq.sort
38:   end

[Source]

    # File app/models/web.rb, line 75
75:   def color()         @color  || "008B26" end

[Source]

    # File app/models/web.rb, line 77
77:   def count_pages()   @count_pages || false 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.

[Source]

    # 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

Default values

[Source]

    # File app/models/web.rb, line 74
74:   def markup()        @markup || :textile end

Clears the display cache for all the pages with references to

[Source]

    # 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

[Source]

    # 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

[Source]

    # 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

[Source]

    # File app/models/web.rb, line 28
28:   def revised_on
29:     select.most_recent_revision
30:   end

[Source]

    # File app/models/web.rb, line 24
24:   def select(&accept)
25:     PageSet.new(self, @pages.values, accept)
26:   end

[Validate]