public
Fork of halorgium/mephisto
Description: A mirror of the mephisto code-base
Homepage: http://mephistoblog.com/
Clone URL: git://github.com/technoweenie/mephisto.git
Click here to lend your support to: mephisto and make a donation at www.pledgie.com !
add new site/section configuration options

git-svn-id: http://svn.techno-weenie.net/projects/mephisto/trunk@2146 
567b1171-46fb-0310-a4c9-b4bef9110e78
technoweenie (author)
Sun Sep 10 19:41:26 -0700 2006
commit  1cc49c4ddb97ef8353dd7434df91a7df7e77f1ae
tree    bf07b2339c94f9be4ac3697c660e8507c21281f4
parent  f0701ad29f2536db10187a0397ac1555e0ddfdb0
...
8
9
10
 
 
 
 
 
11
...
8
9
10
11
12
13
14
15
16
0
@@ -8,4 +8,9 @@ class Admin::BaseController < ApplicationController
0
   end
0
   
0
   helper_method :admin?
0
+
0
+ protected
0
+ def find_and_sort_templates
0
+ @layouts, @templates = site.templates.partition { |t| t.dirname.to_s =~ /layouts$/ }
0
+ end
0
 end
...
30
31
32
33
34
35
36
37
38
39
...
30
31
32
 
 
 
 
33
34
35
0
@@ -30,10 +30,6 @@ class Admin::SectionsController < Admin::BaseController
0
   end
0
 
0
   protected
0
- def find_and_sort_templates
0
- @layouts, @templates = site.templates.partition { |t| t.dirname.to_s =~ /layouts$/ }
0
- end
0
-
0
     def find_and_reorder_sections
0
       @article_count = site.sections.articles_count
0
       @sections = site.sections.find :all
...
1
 
 
2
3
4
...
1
2
3
4
5
6
0
@@ -1,4 +1,6 @@
0
 class Admin::SettingsController < Admin::BaseController
0
+ before_filter :find_and_sort_templates
0
+
0
   def update
0
     if site.update_attributes params[:site]
0
       redirect_to :action => 'index'
...
1
2
 
 
 
 
3
...
1
 
2
3
4
5
6
0
@@ -1,3 +1,6 @@
0
 module Admin::BaseHelper
0
-
0
+ def options_from_templates_for_select(templates, selected = nil)
0
+ '<option value="0">-- default --</option>' +
0
+ options_for_select(templates.inject([]) { |options, template| options << template.basename.to_s.split('.').first }, selected.to_s)
0
+ end
0
 end
...
1
2
3
4
5
6
7
8
9
...
1
 
 
 
 
 
2
3
4
0
@@ -1,9 +1,4 @@
0
 module Admin::SectionsHelper
0
- def options_from_templates_for_select(templates, selected = nil)
0
- '<option value="0">-- default --</option>' +
0
- options_for_select(templates.inject([]) { |options, template| options << template.basename.to_s.split('.').first }, selected.to_s)
0
- end
0
-
0
   def pluralize_articles_count_for(section)
0
     pluralize @article_count ? (@article_count[section.id.to_s] || 0) : section.articles_count, 'article'
0
   end
...
1
2
 
3
4
 
 
5
6
7
...
83
84
85
 
 
 
 
 
86
87
88
...
1
2
3
4
 
5
6
7
8
9
...
85
86
87
88
89
90
91
92
93
94
95
0
@@ -1,7 +1,9 @@
0
 class Section < ActiveRecord::Base
0
   ARTICLES_COUNT_SQL = 'INNER JOIN assigned_sections ON contents.id = assigned_sections.article_id INNER JOIN sections ON sections.id = assigned_sections.section_id'.freeze unless defined?(ARTICLES_COUNT)
0
+ before_validation :set_archive_path
0
   before_validation_on_create :create_path
0
- validates_presence_of :name, :site_id
0
+ validates_presence_of :name, :site_id, :archive_path
0
+ validates_format_of :archive_path, :with => Format::STRING
0
   validates_exclusion_of :path, :in => [nil]
0
   validates_uniqueness_of :path, :case_sensitive => false, :scope => :site_id
0
   belongs_to :site
0
@@ -83,6 +85,11 @@ class Section < ActiveRecord::Base
0
   end
0
   
0
   protected
0
+ def set_archive_path
0
+ self.archive_path = 'archives' if archive_path.blank?
0
+ archive_path.downcase!
0
+ end
0
+
0
     def create_path
0
       # nasty regex because i want to keep alpha numerics AND /'s
0
       self.path = self.class.permalink_for(name.to_s) if path.blank?
...
1
2
3
4
5
6
7
8
9
10
...
49
50
51
52
53
54
 
 
 
 
55
56
 
57
58
59
...
82
83
84
85
86
87
88
89
90
91
92
93
94
 
95
96
97
...
106
107
108
109
 
110
111
112
...
138
139
140
141
142
143
144
145
 
 
 
 
 
146
147
 
148
149
150
 
151
152
153
 
154
155
156
...
158
159
160
161
 
 
 
 
 
162
163
164
165
166
167
168
 
 
 
 
169
170
171
...
1
2
3
 
 
 
 
4
5
6
...
45
46
47
 
 
 
48
49
50
51
52
 
53
54
55
56
...
79
80
81
 
 
 
 
 
82
83
84
85
 
86
87
88
89
...
98
99
100
 
101
102
103
104
...
130
131
132
 
 
 
 
 
133
134
135
136
137
138
 
139
140
141
 
142
143
144
 
145
146
147
148
...
150
151
152
 
153
154
155
156
157
158
 
 
 
 
 
 
159
160
161
162
163
164
165
0
@@ -1,10 +1,6 @@
0
 class Site < ActiveRecord::Base
0
   PERMALINK_OPTIONS = { 'year' => '\d{4}', 'month' => '\d{1,2}', 'day' => '\d{1,2}', 'permalink' => '[a-z0-9-]+', 'id' => '\d+' }
0
   PERMALINK_VAR = /^:([a-z]+)$/
0
- @@permalink_slug = ':year/:month/:day/:permalink'.freeze
0
- @@archive_slug = 'archives'.freeze
0
- @@tag_slug = 'tags'.freeze
0
- @@search_slug = 'search'.freeze
0
 
0
   include Mephisto::Attachments::AttachmentMethods
0
   cattr_accessor :multi_sites_enabled
0
@@ -49,11 +45,12 @@ class Site < ActiveRecord::Base
0
   has_many :admins, :through => :memberships, :source => :user, :conditions => ['memberships.admin = ? or users.admin = ?', true, true]
0
 
0
   before_validation :downcase_host
0
- before_validation :set_default_timezone
0
- before_validation_on_create :set_default_comment_options
0
- validates_format_of :host, :with => /^([a-z0-9]([-a-z0-9]*[a-z0-9])?\.)+((a[cdefgilmnoqrstuwxz]|aero|arpa)|(b[abdefghijmnorstvwyz]|biz)|(c[acdfghiklmnorsuvxyz]|cat|com|coop)|d[ejkmoz]|(e[ceghrstu]|edu)|f[ijkmor]|(g[abdefghilmnpqrstuwy]|gov)|h[kmnrtu]|(i[delmnoqrst]|info|int)|(j[emop]|jobs)|k[eghimnprwyz]|l[abcikrstuvy]|(m[acdghklmnopqrstuvwxyz]|mil|mobi|museum)|(n[acefgilopruz]|name|net)|(om|org)|(p[aefghklmnrstwy]|pro)|qa|r[eouw]|s[abcdeghijklmnortvyz]|(t[cdfghjklmnoprtvwz]|travel)|u[agkmsyz]|v[aceginu]|w[fs]|y[etu]|z[amw])$/
0
+ before_validation :set_default_attributes
0
+ validates_presence_of :permalink_style, :search_path, :tag_path
0
+ validates_format_of :search_path, :tag_path, :with => Format::STRING
0
+ validates_format_of :host, :with => Format::DOMAIN
0
   validates_uniqueness_of :host
0
- validate :check_permalink_slug
0
+ validate :check_permalink_style
0
   attr_reader :permalink_variables
0
 
0
   with_options :order => 'contents.created_at', :class_name => 'Comment' do |comment|
0
@@ -82,16 +79,11 @@ class Site < ActiveRecord::Base
0
     Tag.find(:all, :conditions => ['contents.type = ? AND contents.site_id = ?', 'Article', id], :order => 'tags.name',
0
       :joins => "INNER JOIN taggings ON taggings.tag_id = tags.id INNER JOIN contents ON (taggings.taggable_id = contents.id AND taggings.taggable_type = 'Content')")
0
   end
0
-
0
- def permalink_slug() @@permalink_slug end
0
- def archive_slug() @@archive_slug end
0
- def tag_slug() @@tag_slug end
0
- def search_slug() @@search_slug end
0
 
0
   def permalink_regex(refresh = false)
0
     if refresh || @permalink_regex.nil?
0
       @permalink_variables = []
0
- r = permalink_slug.split('/').inject [] do |s, piece|
0
+ r = permalink_style.split('/').inject [] do |s, piece|
0
         if piece =~ PERMALINK_VAR
0
           @permalink_variables << $1.to_sym
0
           s << "(#{PERMALINK_OPTIONS[$1]})"
0
@@ -106,7 +98,7 @@ class Site < ActiveRecord::Base
0
   end
0
 
0
   def permalink_for(article)
0
- permalink_slug.split('/').inject [''] do |s, piece|
0
+ permalink_style.split('/').inject [''] do |s, piece|
0
       s << (piece =~ PERMALINK_VAR && PERMALINK_OPTIONS.keys.include?($1) ? article.send($1).to_s : piece)
0
     end.join('/')
0
   end
0
@@ -138,19 +130,19 @@ class Site < ActiveRecord::Base
0
       var =~ PERMALINK_VAR && PERMALINK_OPTIONS.keys.include?(var)
0
     end
0
 
0
- def check_permalink_slug
0
- permalink_slug.sub! /^\//, ''
0
- permalink_slug.sub! /\/$/, ''
0
- pieces = permalink_slug.split('/')
0
- errors.add :permalink_slug, 'cannot have blank paths' if pieces.any?(&:blank?)
0
+ def check_permalink_style
0
+ permalink_style.sub! /^\//, ''
0
+ permalink_style.sub! /\/$/, ''
0
+ pieces = permalink_style.split('/')
0
+ errors.add :permalink_style, 'cannot have blank paths' if pieces.any?(&:blank?)
0
       pieces.each do |p|
0
- errors.add :permalink_slug, "cannot contain '#{$1}' variable" if p =~ PERMALINK_VAR && !PERMALINK_OPTIONS.keys.include?($1)
0
+ errors.add :permalink_style, "cannot contain '#{$1}' variable" if p =~ PERMALINK_VAR && !PERMALINK_OPTIONS.keys.include?($1)
0
       end
0
       unless pieces.include?(':id') || pieces.include?(':permalink')
0
- errors.add :permalink_slug, "must contain either :permalink or :id"
0
+ errors.add :permalink_style, "must contain either :permalink or :id"
0
       end
0
       if !pieces.include?(':year') && (pieces.include?(':month') || pieces.include?(':day'))
0
- errors.add :permalink_slug, "must contain :year for any date-based permalinks"
0
+ errors.add :permalink_style, "must contain :year for any date-based permalinks"
0
       end
0
     end
0
 
0
@@ -158,14 +150,16 @@ class Site < ActiveRecord::Base
0
       self.host = host.to_s.downcase
0
     end
0
 
0
- def set_default_timezone
0
+ def set_default_attributes
0
+ self.permalink_style = ':year/:month/:day/:permalink' if permalink_style.blank?
0
+ self.search_path = 'search' if search_path.blank?
0
+ self.tag_path = 'tags' if tag_path.blank?
0
+ [:permalink_style, :search_path, :tag_path].each { |a| send(a).downcase! }
0
       self.timezone = 'UTC' if read_attribute(:timezone).blank?
0
- true
0
- end
0
-
0
- def set_default_comment_options
0
- self.approve_comments = false unless approve_comments?
0
- self.comment_age = 30 unless comment_age
0
+ if new_record?
0
+ self.approve_comments = false unless approve_comments?
0
+ self.comment_age = 30 unless comment_age
0
+ end
0
       true
0
     end
0
     
...
21
22
23
 
 
 
 
 
 
24
25
26
...
28
29
30
 
 
 
 
 
 
31
32
33
...
21
22
23
24
25
26
27
28
29
30
31
32
...
34
35
36
37
38
39
40
41
42
43
44
45
0
@@ -21,6 +21,12 @@
0
               (@section.show_paged_articles? ? '1' : '0') %>
0
       </select>
0
     </dd>
0
+ <dt>
0
+ <label for="section_archive_path">Url that the search area is available at.</label>
0
+ <span class="hint">Defaults to #{section_path}/<strong>archives</strong>/#{year}/#{month}</span>
0
+ </dt>
0
+ <dd><%= f.text_field :archive_path %></dd>
0
+
0
     <% if @templates.any? -%>
0
     <dt><label for="section_template"><%= 'Paged ' if @section.show_paged_articles? %>Section Template</label></dt>
0
     <dd>
0
@@ -28,6 +34,12 @@
0
         <%= options_from_templates_for_select(@templates, @section.template) %>
0
       </select>
0
     </dd>
0
+ <dt><label for="section_archive_template">Section Archive Template</label></dt>
0
+ <dd>
0
+ <select name="section[archive_template]">
0
+ <%= options_from_templates_for_select(@templates, @section.archive_template) %>
0
+ </select>
0
+ </dd>
0
     <% end -%>
0
     <% if @layouts.any? -%>
0
     <dt><label for="section_layout">Section layout</label></dt>
...
3
4
5
6
7
 
8
9
10
...
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
 
63
64
65
...
73
74
75
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
76
77
78
...
3
4
5
 
6
7
8
9
10
...
32
33
34
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
35
36
 
37
38
39
40
...
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
0
@@ -3,8 +3,8 @@
0
 <div id="page-nav">
0
   <ul id="act-nav" class="clear">
0
     <li><%= link_to "General", '#general' %></li>
0
- <% if false -%><li><%= link_to "Publishing", '#publish' %></li><% end -%>
0
     <li><%= link_to "Comments", '#spam' %></li>
0
+ <li><%= link_to "Publishing", '#publish' %></li>
0
     <% if ActionController::Base.perform_caching -%>
0
     <li><%= link_to 'Caches', :controller => '/admin/cached_pages' %></li>
0
     <% end -%>
0
@@ -32,34 +32,9 @@
0
   </dl>
0
 </div>
0
 
0
-<% if false -%>
0
-<div id="publish" class="setgroup">
0
- <h3>Publishing and reading</h3>
0
- <dl class="setform">
0
- <dt>
0
- <label for="site_ping_urls">Urls to ping when publishing</label><br />
0
- <span class="hint">Each one should be on a separate line.</span>
0
- </dt>
0
- <dd><%= text_area 'site', 'ping_urls', :rows => 5, :cols => 45 %></dd>
0
- <dt><label for="site_articles_per_page">Articles shown on homepage</label></dt>
0
- <dd><%= text_field 'site', 'articles_per_page', :class => 'tiny' %></dd>
0
- <dt>
0
- <label for="site_permalink_style">Permalink style</label>
0
- <span class="hint">(How articles are linked to)</span>
0
- </dt>
0
- <dd>
0
- <select name="permalink_style">
0
- <%= options_for_select(%w(permalink year/month/permalink year/month/day/permalink section/permalink), '') %>
0
- </select>
0
- </dd>
0
-
0
- </dl>
0
-</div>
0
-<% end -%>
0
-
0
 <div id="spam" class="setgroup">
0
   <h3>Spam prevention</h3>
0
- <p>At the moment Mephisto uses <%= link_to 'Akismet', 'http://akismet.com' %> to automatically handle spam.</p>
0
+ <p>At the moment Mephisto uses <%= link_to 'Akismet', 'http://akismet.com' %> to automatically handle spam. If you leave out the Akismet settings, you can moderate new comments from the Overview.</p>
0
   <dl class="setform">
0
     <dt><label>Akismet API Key</label></dt>
0
     <dd><%= f.text_field :akismet_key %></dd>
0
@@ -73,6 +48,44 @@
0
   </dl>
0
 </div>
0
 
0
+<div id="publish" class="setgroup">
0
+ <h3>Publishing and Reading</h3>
0
+ <dl class="setform">
0
+ <dt>
0
+ <label for="site_search_path">Url that the search area is available at.</label>
0
+ </dt>
0
+ <dd><%= f.text_field :search_path %></dd>
0
+ <% if @templates.any? -%>
0
+ <dt>
0
+ <label for="site_search_template">Template used by the search area</label>
0
+ </dt>
0
+ <dd>
0
+ <select name="site[search_template]">
0
+ <%= options_from_templates_for_select(@templates, @site.search_template) %>
0
+ </select>
0
+ </dd>
0
+ <% end -%>
0
+ <dt>
0
+ <label for="site_tag_path">Url that the tag area is available at.</label>
0
+ </dt>
0
+ <dd><%= f.text_field :tag_path %></dd>
0
+ <% if @templates.any? -%>
0
+ <dt>
0
+ <label for="site_tag_template">Template used by the tag area</label>
0
+ </dt>
0
+ <dd>
0
+ <select name="site[tag_template]">
0
+ <%= options_from_templates_for_select(@templates, @site.tag_template) %>
0
+ </select>
0
+ </dd>
0
+ <% end -%>
0
+ <dt>
0
+ <label for="permalink_style">Url style that the articles use.</label>
0
+ <span class="hint">Use the <code>:year</code>, <code>:month</code>, <code>:day</code>, <code>:permalink</code>, and <code>:id</code> in place of actual article values.</span>
0
+ </dt>
0
+ <dd><%= f.text_field :permalink_style %></dd>
0
+ </dl>
0
+</div>
0
 
0
 <p class="btns"><%= submit_tag 'Save and apply settings' %></p>
0
 <% end %>
...
4
5
6
7
8
 
 
9
...
4
5
6
 
7
8
9
10
0
@@ -4,4 +4,5 @@ home:
0
   name: Home
0
   path: ''
0
   articles_per_page: 15
0
- template: home.liquid
0
\ No newline at end of file
0
+ template: home.liquid
0
+ archive_path: archives
0
\ No newline at end of file
...
6
7
8
9
10
 
 
 
 
11
...
6
7
8
 
9
10
11
12
13
14
0
@@ -6,4 +6,7 @@ default:
0
   email: email@domain.com
0
   approve_comments: true
0
   comment_age: 30
0
- timezone: UTC
0
\ No newline at end of file
0
+ timezone: UTC
0
+ permalink_style: ":year/:month/:day/:permalink"
0
+ search_path: search
0
+ tag_path: tags
0
\ No newline at end of file
...
2
3
4
5
 
6
7
8
...
113
114
115
 
 
116
117
118
...
136
137
138
 
 
 
 
 
139
140
141
...
2
3
4
 
5
6
7
8
...
113
114
115
116
117
118
119
120
...
138
139
140
141
142
143
144
145
146
147
148
0
@@ -2,7 +2,7 @@
0
 # migrations feature of ActiveRecord to incrementally modify your database, and
0
 # then regenerate this schema definition.
0
 
0
-ActiveRecord::Schema.define(:version => 56) do
0
+ActiveRecord::Schema.define(:version => 57) do
0
 
0
   create_table "assets", :force => true do |t|
0
     t.column "content_type", :string
0
@@ -113,6 +113,8 @@ ActiveRecord::Schema.define(:version => 56) do
0
     t.column "site_id", :integer
0
     t.column "path", :string
0
     t.column "articles_count", :integer, :default => 0
0
+ t.column "archive_path", :string
0
+ t.column "archive_template", :string
0
   end
0
 
0
   create_table "sessions", :force => true do |t|
0
@@ -136,6 +138,11 @@ ActiveRecord::Schema.define(:version => 56) do
0
     t.column "comment_age", :integer
0
     t.column "timezone", :string
0
     t.column "filter", :string
0
+ t.column "permalink_style", :string
0
+ t.column "search_path", :string
0
+ t.column "tag_path", :string
0
+ t.column "search_template", :string
0
+ t.column "tag_template", :string
0
   end
0
 
0
   create_table "taggings", :force => true do |t|
...
15
16
17
18
 
19
20
21
 
22
23
24
...
34
35
36
37
 
38
39
40
...
15
16
17
 
18
19
20
 
21
22
23
24
...
34
35
36
 
37
38
39
40
0
@@ -15,10 +15,10 @@ module Mephisto
0
       end
0
 
0
       # check for tags
0
- return [:tags, nil] + path[1..-1] if path.first == site.tag_slug
0
+ return [:tags, nil] + path[1..-1] if path.first == site.tag_path
0
       
0
       # check for search
0
- if path.first == site.search_slug
0
+ if path.first == site.search_path
0
         return (path.size == 1) ? [:search, nil] : [:error, nil]
0
       end
0
 
0
@@ -34,7 +34,7 @@ module Mephisto
0
         result.reverse!
0
         
0
         # check for archives
0
- if result[0] == site.archive_slug
0
+ if result[0] == section.archive_path
0
           # only allow /archives, /archives/yyyy and /archives/yyyy/mm
0
           if (result.size < 4 && year?(result[1]) && month?(result[2]))
0
             dispatch_type = :archives
...
102
103
104
105
 
106
107
108
109
110
 
111
112
113
...
102
103
104
 
105
106
107
108
109
 
110
111
112
113
0
@@ -102,12 +102,12 @@ module Mephisto
0
       def monthly_url(section, date = nil)
0
         date ||= Time.now.utc.beginning_of_month
0
         date = Date.new(*date.split('-')) unless date.is_a?(Date)
0
- File.join(section.url, @context['site']['archive_slug'], date.year.to_s, date.month.to_s)
0
+ File.join(section.url, section['archive_path'], date.year.to_s, date.month.to_s)
0
       end
0
       
0
       def tag_url(tags)
0
         tags = [tags] ; tags.flatten!
0
- absolute_url @context['site']['tag_slug'], *tags
0
+ absolute_url @context['site']['tag_path'], *tags
0
       end
0
 
0
       def page_url(page)
...
10
11
12
13
 
14
15
16
...
10
11
12
 
13
14
15
16
0
@@ -10,7 +10,7 @@ module Mephisto
0
       def initialize(source, current = false)
0
         @source = source
0
         @current = current
0
- @section_liquid = [:id, :name, :path].inject({}) { |h, k| h.update k.to_s => @source.send(k) }
0
+ @section_liquid = [:id, :name, :path, :archive_path].inject({}) { |h, k| h.update k.to_s => @source.send(k) }
0
         @section_liquid['articles_count'] = @source.send(:read_attribute, :articles_count)
0
         {:is_blog => :blog?, :is_paged => :paged?, :is_home => :home?}.each { |k, v| @section_liquid[k.to_s] = @source.send(v) }
0
       end
...
10
11
12
13
 
14
15
16
...
10
11
12
 
13
14
15
16
0
@@ -10,7 +10,7 @@ module Mephisto
0
         @source = source
0
         @current_section = section
0
         @current_section_liquid = section ? section.to_liquid : nil
0
- @site_liquid = [:id, :host, :subtitle, :title, :articles_per_page, :archive_slug, :tag_slug, :search_slug].inject({}) { |h, k| h.merge k.to_s => @source.send(k) }
0
+ @site_liquid = [:id, :host, :subtitle, :title, :articles_per_page, :tag_path, :search_path].inject({}) { |h, k| h.merge k.to_s => @source.send(k) }
0
         @site_liquid['accept_comments'] = @source.accept_comments?
0
       end
0
 
...
6
7
8
 
9
10
11
...
13
14
15
 
16
17
18
...
21
22
23
 
24
25
26
...
28
29
30
 
...
6
7
8
9
10
11
12
...
14
15
16
17
18
19
20
...
23
24
25
26
27
28
29
...
31
32
33
34
0
@@ -6,6 +6,7 @@ home:
0
   path: ''
0
   articles_count: 3
0
   template: home.liquid
0
+ archive_path: archives
0
 about:
0
   id: 2
0
   site_id: 1
0
@@ -13,6 +14,7 @@ about:
0
   path: about
0
   show_paged_articles: true
0
   articles_count: 3
0
+ archive_path: archives
0
 cupcake_home:
0
   id: 3
0
   site_id: 2
0
@@ -21,6 +23,7 @@ cupcake_home:
0
   show_paged_articles: true
0
   template: home.liquid
0
   articles_count: 1
0
+ archive_path: archives
0
 cupcake_about:
0
   id: 4
0
   site_id: 2
0
@@ -28,3 +31,4 @@ cupcake_about:
0
   path: about
0
   show_paged_articles: true
0
   articles_count: 1
0
+ archive_path: archives
...
13
14
15
 
 
 
16
17
18
...
23
24
25
 
 
 
26
27
28
29
30
31
32
 
 
 
 
33
...
13
14
15
16
17
18
19
20
21
...
26
27
28
29
30
31
32
33
34
35
36
 
37
38
39
40
41
42
0
@@ -13,6 +13,9 @@ first:
0
   comment_age: 30
0
   timezone: America/New_York
0
   articles_per_page: 15
0
+ permalink_style: ":year/:month/:day/:permalink"
0
+ search_path: search
0
+ tag_path: tags
0
 hostess:
0
   id: 2
0
   title: Cupcake
0
@@ -23,9 +26,15 @@ hostess:
0
   approve_comments: false
0
   comment_age: 0
0
   articles_per_page: 10
0
+ permalink_style: ":year/:month/:day/:permalink"
0
+ search_path: search
0
+ tag_path: tags
0
 garden:
0
   id: 3
0
   title: walled garden
0
   host: garden.com
0
   timezone: UTC
0
- comment_age: -1
0
\ No newline at end of file
0
+ comment_age: -1
0
+ permalink_style: ":year/:month/:day/:permalink"
0
+ search_path: search
0
+ tag_path: tags
0
\ No newline at end of file
...
1
2
3
4
5
6
7
8
9
...
1
2
3
 
 
 
4
5
6
0
@@ -1,9 +1,6 @@
0
 require File.join(RAILS_ROOT, 'app/models/site')
0
 class Site
0
   attr_reader :recent_template_type, :recent_preferred_template, :recent_layout_template
0
- attr_writer :permalink_slug
0
-
0
- def permalink_slug() @permalink_slug || @@permalink_slug end
0
 
0
   def attachment_base_path
0
     @attachment_base_path ||= File.join(RAILS_ROOT, 'tmp/themes', "site-#{id}")
...
86
87
88
89
 
90
91
92
...
99
100
101
102
 
103
104
105
...
86
87
88
 
89
90
91
92
...
99
100
101
 
102
103
104
105
0
@@ -86,7 +86,7 @@ context "Dispatcher Permalink Recognition" do
0
     options = {:year => '2006', :month => '9', :day => '1', :permalink => 'foo'}
0
     assert_equal [options, false, nil], Mephisto::Dispatcher.recognize_permalink(@site, %w(2006 9 1 foo))
0
     
0
- @site.permalink_slug = 'entries/:id/:permalink'
0
+ @site.permalink_style = 'entries/:id/:permalink'
0
     @site.permalink_regex(true)
0
     options = {:id => '5', :permalink => 'foo-bar-baz'}
0
     assert_equal [options, false, nil], Mephisto::Dispatcher.recognize_permalink(@site, %w(entries 5 foo-bar-baz))
0
@@ -99,7 +99,7 @@ context "Dispatcher Permalink Recognition" do
0
     assert_equal [options, true, nil], Mephisto::Dispatcher.recognize_permalink(@site, %w(2006 9 1 foo comments))
0
     assert_equal [options, true, '5'], Mephisto::Dispatcher.recognize_permalink(@site, %w(2006 9 1 foo comments 5))
0
     
0
- @site.permalink_slug = 'entries/:id/:permalink'
0
+ @site.permalink_style = 'entries/:id/:permalink'
0
     @site.permalink_regex(true)
0
     options = {:id => '5', :permalink => 'foo-bar-baz'}
0
     assert_equal [options, true, nil], Mephisto::Dispatcher.recognize_permalink(@site, %w(entries 5 foo-bar-baz comments))
...
117
118
119
 
 
 
 
 
 
 
 
 
 
 
 
120
...
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
0
@@ -117,4 +117,16 @@ class SectionTest < Test::Unit::TestCase
0
     assert sections(:home).blog?
0
     [:about, :cupcake_home, :cupcake_about].each { |s| assert sections(s).paged? }
0
   end
0
+
0
+ def test_should_set_default_archive_path
0
+ s = Section.new
0
+ s.valid?
0
+ assert_equal 'archives', s.archive_path
0
+ end
0
+
0
+ def test_should_downcase_archive_path
0
+ s = Section.new :archive_path => "OLD"
0
+ s.valid?
0
+ assert_equal 'old', s.archive_path
0
+ end
0
 end