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 !
HUGE change: remove attachment model

git-svn-id: http://svn.techno-weenie.net/projects/mephisto/trunk@1868 
567b1171-46fb-0310-a4c9-b4bef9110e78
technoweenie (author)
Mon Aug 21 21:04:29 -0700 2006
commit  93bca3fe1db8673f1defc4ebe6be301ec0b086e2
tree    fdcfa0187b2d67e0043236b6f481518822d357d5
parent  abc8fbb55c54b901b173f4c6894b2353830b7250
...
1
2
3
 
4
5
6
...
1
2
 
3
4
5
6
0
@@ -1,6 +1,6 @@
0
 class AssetSweeper < ActionController::Caching::Sweeper
0
   include Mephisto::SweeperMethods
0
- observe Resource
0
+ #observe Resource
0
   def after_save(record)
0
     return if controller.nil?
0
     pages = CachedPage.find_by_reference(record)
...
1
2
3
 
4
5
6
...
1
2
 
3
4
5
6
0
@@ -1,6 +1,6 @@
0
 class TemplateSweeper < ActionController::Caching::Sweeper
0
   include Mephisto::SweeperMethods
0
- observe Template
0
+ #observe Template
0
 
0
   # only sweep updates, not creations
0
   # tagged 'lame hack'
...
27
28
29
30
 
31
32
33
...
27
28
29
 
30
31
32
33
0
@@ -27,7 +27,7 @@ class Admin::ArticlesController < Admin::BaseController
0
     Mephisto::Liquid::CommentForm.article = @article
0
     @article = @article.to_liquid(:mode => :single)
0
     
0
- render :text => Template.render_liquid_for(site, site.sections.home, :single, 'articles' => [@article], 'article' => @article, 'comments' => @comments, 'site' => site.to_liquid)
0
+ render :text => site.render_liquid_for(site.sections.home, :single, 'articles' => [@article], 'article' => @article, 'comments' => @comments, 'site' => site.to_liquid)
0
   end
0
 
0
   def new
...
2
3
4
5
6
7
8
9
10
11
12
13
...
2
3
4
 
 
 
 
 
 
 
 
5
0
@@ -2,12 +2,4 @@ class Admin::BaseController < ApplicationController
0
   include AuthenticatedSystem
0
   before_filter :login_from_cookie
0
   before_filter :login_required, :except => :feed
0
-
0
- def find_templates_and_resources
0
- @resources, @templates = site.attachments.find_theme_files.partition do |asset|
0
- asset.is_a?(Resource)
0
- end
0
- @resources = @resources.sort_by { |r| r.full_filename }
0
- @images, @resources = @resources.partition { |r| r.image? }
0
- end
0
 end
...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
 
 
 
18
19
20
21
 
 
 
22
23
 
 
24
25
26
...
1
 
 
 
 
 
 
 
 
2
 
 
 
 
 
 
 
3
4
5
6
7
 
 
8
9
10
11
 
12
13
14
15
16
0
@@ -1,26 +1,16 @@
0
 class Admin::DesignController < Admin::BaseController
0
- verify :method => :post, :params => [:resource_type, :resource], :only => :create,
0
- :redirect_to => { :action => 'index' }
0
- before_filter :find_templates_and_resources
0
-
0
- def index
0
- @resource = site.resources.build
0
- end
0
-
0
   def create
0
- @resource = case params[:resource_type]
0
- when /css/i
0
- site.resources.create params[:resource].merge(:content_type => 'text/css')
0
- when /javascript/i
0
- site.resources.create params[:resource].merge(:content_type => 'text/javascript')
0
- else
0
- site.templates.create params[:resource]
0
+ if params[:filename].blank? || params[:data].blank?
0
+ render :action => 'index'
0
+ return
0
     end
0
 
0
- if @resource.new_record?
0
- render :action => 'index'
0
+ if params[:filename] =~ /\.(css|js)$/i
0
+ @resource = site.resources.write params[:filename], params[:data]
0
+ redirect_to :controller => 'resources', :action => 'edit', :filename => @resource.basename.to_s
0
     else
0
- redirect_to :controller => @resource.class.to_s.tableize, :action => 'edit', :id => @resource.to_param
0
+ @tmpl = site.templates.write params[:filename], params[:data]
0
+ redirect_to :controller => 'templates', :action => 'edit', :filename => @tmpl.basename.to_s
0
     end
0
   end
0
 end
...
1
2
3
 
4
5
6
 
7
8
9
10
11
12
13
14
15
16
17
 
18
19
20
21
 
 
 
 
22
 
 
23
24
 
25
26
27
28
29
30
31
 
 
 
32
33
34
...
36
37
38
 
39
40
 
41
42
43
44
45
46
47
48
...
1
 
 
2
3
4
 
5
6
7
8
9
10
 
 
 
 
 
 
11
12
13
14
15
16
17
18
19
20
21
22
23
 
24
25
26
27
28
 
 
 
29
30
31
32
33
34
...
36
37
38
39
40
 
41
42
43
 
 
 
 
 
44
0
@@ -1,34 +1,34 @@
0
 class Admin::ResourcesController < Admin::BaseController
0
- cache_sweeper :asset_sweeper
0
- verify :params => :id, :only => [:edit, :update],
0
+ verify :params => :filename, :only => [:edit, :update],
0
          :add_flash => { :error => 'Resource required' },
0
          :redirect_to => { :controller => 'design', :action => 'index' }
0
- verify :method => :post, :params => :resource, :only => :update,
0
+ verify :method => :post, :params => :data, :only => :update,
0
          :add_flash => { :error => 'Resource required' },
0
          :redirect_to => { :action => 'edit' }
0
   verify :method => :post, :params => :resource, :only => :upload,
0
          :add_flash => { :error => 'Resource required' },
0
          :redirect_to => { :controller => 'design', :action => 'index' }
0
-
0
- with_options :except => :index do |c|
0
- c.before_filter :find_templates_and_resources
0
- c.before_filter :select_resource
0
- end
0
-
0
+
0
   def index
0
     redirect_to :controller => 'design'
0
   end
0
 
0
+ def edit
0
+ @resource = site.resources[params[:filename]]
0
+ end
0
+
0
   def update
0
+ site.resources.write params[:filename], params[:data]
0
+ self.class.expire_page('/' << site.resources[params[:filename]].relative_path_from(site.attachment_path).to_s)
0
     render :update do |page|
0
- page.call 'Flash.notice', 'Resource updated successfully' if @resource.update_attributes(params[:resource])
0
+ page.call 'Flash.notice', 'Resource updated successfully'
0
     end
0
   end
0
 
0
   def upload
0
- @resource = site.resources.build params[:resource]
0
- if @resource.image? and @resource.save
0
- flash[:notice] = "'#{@resource.filename}' was uploaded successfully."
0
+ if params[:resource] && Asset.image?(params[:resource].content_type) && (1..1.megabyte).include?(params[:resource].size)
0
+ @resource = site.resources.write File.basename(params[:resource].original_filename), params[:resource].read
0
+ flash[:notice] = "'#{@resource.basename}' was uploaded successfully."
0
     else
0
       flash[:error] = "A bad or nonexistant image was uploaded."
0
     end
0
@@ -36,13 +36,9 @@ class Admin::ResourcesController < Admin::BaseController
0
   end
0
   
0
   def remove
0
+ site.resources[params[:filename]].unlink
0
     render :update do |page|
0
- page.visual_effect :fade, "image-#{params[:id]}", :duration => 0.3 if Resource.find(params[:id]).destroy
0
+ page.visual_effect :fade, "image-#{params[:id]}", :duration => 0.3
0
     end
0
   end
0
-
0
- protected
0
- def select_resource
0
- @resource = @resources.detect { |r| r.id.to_s == params[:id] }
0
- end
0
 end
...
31
32
33
34
 
35
36
37
...
31
32
33
 
34
35
36
37
0
@@ -31,7 +31,7 @@ class Admin::SectionsController < Admin::BaseController
0
 
0
   protected
0
     def find_and_sort_templates
0
- @layouts, @templates = site.templates.find_custom.partition { |t| t.layout? }
0
+ @layouts, @templates = site.templates.partition { |t| t.dirname.to_s =~ /layouts$/ }
0
     end
0
     
0
     def find_and_reorder_sections
...
1
2
3
 
4
5
6
 
7
8
9
10
11
12
13
14
15
16
17
18
 
 
 
 
19
 
 
20
21
22
23
24
25
 
26
27
28
29
30
31
32
33
34
35
36
37
...
1
 
 
2
3
4
 
5
6
7
 
 
 
 
 
8
9
10
11
12
13
14
15
16
17
18
19
20
 
 
 
 
 
21
22
23
 
 
 
 
 
 
 
 
 
24
0
@@ -1,37 +1,24 @@
0
 class Admin::TemplatesController < Admin::BaseController
0
- cache_sweeper :template_sweeper
0
- verify :params => :id, :only => [:edit, :update],
0
+ verify :params => :filename, :only => [:edit, :update],
0
          :add_flash => { :error => 'Template required' },
0
          :redirect_to => { :action => 'index' }
0
- verify :method => :post, :params => :template, :only => :update,
0
+ verify :method => :post, :params => :data, :only => :update,
0
          :add_flash => { :error => 'Template required' },
0
          :redirect_to => { :action => 'edit' }
0
-
0
- with_options :except => :index do |c|
0
- c.before_filter :find_templates_and_resources
0
- c.before_filter :select_template
0
- end
0
 
0
   def index
0
     redirect_to :controller => 'design'
0
   end
0
 
0
+ def edit
0
+ @tmpl = site.templates[params[:filename]]
0
+ end
0
+
0
   def update
0
+ site.templates.write(params[:filename], params[:data])
0
+ Mephisto::SweeperMethods.expire_cached_pages "Expired all referenced pages", self, *CachedPage.find(:all)
0
     render :update do |page|
0
- if @tmpl.update_attributes(params[:template])
0
- page.call 'Flash.notice', 'Template updated successfully'
0
- else
0
- page.call 'Flash.error', "Save failed: #{@tmpl.errors.full_messages.to_sentence}"
0
- end
0
+ page.call 'Flash.notice', 'Template updated successfully'
0
     end
0
   end
0
-
0
- protected
0
- # @template var clashes with ActionView instance, so use @tmpl
0
- # Selects all templates for sidebar
0
- # Create system template if it does not exist
0
- def select_template
0
- @tmpl = @templates.detect { |t| t.filename == params[:id] }
0
- @tmpl ||= site.templates.find_or_create_by_filename(params[:id]) if Template.template_types.include?(params[:id].to_sym)
0
- end
0
 end
...
24
25
26
27
 
28
29
30
...
24
25
26
 
27
28
29
30
0
@@ -24,7 +24,7 @@ class ApplicationController < ActionController::Base
0
 
0
       status = (assigns.delete(:status) || '200 OK')
0
       @liquid_assigns = assigns
0
- render :text => site.templates.render_liquid_for(site, @section, template_type, assigns, self), :status => status
0
+ render :text => site.render_liquid_for(@section, template_type, assigns, self), :status => status
0
     end
0
 
0
     def show_error(message = 'An error occurred.', status = '500 Error')
...
2
3
4
5
6
7
8
9
 
 
 
10
11
 
12
13
14
 
 
15
16
17
 
 
18
19
20
...
2
3
4
 
 
 
 
 
5
6
7
8
 
9
10
 
 
11
12
13
 
 
14
15
16
17
18
0
@@ -2,19 +2,17 @@ class AssetsController < ApplicationController
0
   session :off
0
   caches_page_with_references :show
0
   def show
0
- content_type = Attachment.content_path.index(params[:dir])
0
- @asset = content_type ?
0
- Resource.find_by_content_type_and_filename(content_type, params[:path].first) :
0
- Resource.find_image(params[:path].first)
0
- self.cached_references << @asset
0
+ file = Pathname.new([params[:path], params[:ext]] * '.')
0
+ content_type = site.resources.content_type(file)
0
+ resource = site.resources[file.to_s]
0
 
0
- if @asset.nil?
0
+ if !resource.file?
0
       show_404
0
- elsif @asset.image?
0
- send_data @asset.attachment_data, :filename => @asset.filename, :type => @asset.content_type, :disposition => 'inline'
0
+ elsif site.resources.image?(file)
0
+ send_data resource.read, :filename => resource.basename.to_s, :type => content_type, :disposition => 'inline'
0
     else
0
- headers['Content-Type'] = @asset.content_type
0
- render :text => @asset.attachment_data
0
+ headers['Content-Type'] = content_type
0
+ render :text => resource.read
0
     end
0
   end
0
 end
...
1
2
 
3
4
 
5
6
7
...
1
 
2
3
 
4
5
6
7
0
@@ -1,7 +1,7 @@
0
 module Admin::SectionsHelper
0
- def options_from_templates_for_select(template, selected = nil)
0
+ def options_from_templates_for_select(templates, selected = nil)
0
     '<option value="0">-- default --</option>' +
0
- options_for_select(template.sort_by { |s| s.filename }.inject([]) { |options, template| options << [template.filename, template.id.to_s] }, selected.to_s)
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)
...
1
 
2
3
4
...
11
12
13
14
15
16
17
18
19
...
32
33
34
 
 
 
 
 
 
 
 
 
 
35
36
37
...
1
2
3
4
5
...
12
13
14
 
 
 
15
16
17
...
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
0
@@ -1,4 +1,5 @@
0
 class Site < ActiveRecord::Base
0
+ include Mephisto::Attachments::AttachmentMethods
0
   cattr_accessor :multi_sites_enabled
0
 
0
   has_many :sections do
0
@@ -11,9 +12,6 @@ class Site < ActiveRecord::Base
0
   has_many :events
0
   
0
   has_many :assets, :as => :attachable, :order => 'created_at desc'
0
- has_many :templates
0
- has_many :resources
0
- has_many :attachments, :extend => Theme
0
   has_many :assets, :order => 'created_at desc', :conditions => 'parent_id is null'
0
 
0
   before_validation :downcase_host
0
@@ -32,6 +30,16 @@ class Site < ActiveRecord::Base
0
     comment_age.to_i > -1
0
   end
0
 
0
+ def render_liquid_for(section, template_type, assigns = {}, controller = nil)
0
+ preferred_template = templates.find_preferred(template_type)
0
+ preferred_template = (preferred_template && preferred_template.file? && preferred_template.read).to_s
0
+ layout_template = templates[(section && section.layout) || 'layout']
0
+ layout_template = (layout_template && layout_template.file? && layout_template.read).to_s
0
+ assigns['site'] = to_liquid(section)
0
+ assigns['content_for_layout'] = Liquid::Template.parse(preferred_template).render(assigns, :registers => {:controller => controller})
0
+ Liquid::Template.parse(layout_template).render(assigns, :registers => {:controller => controller})
0
+ end
0
+
0
   def to_liquid(current_section = nil)
0
     Mephisto::Liquid::SiteDrop.new self, current_section
0
   end
...
1
2
3
4
 
5
6
7
8
9
10
11
12
13
14
15
16
17
18
 
 
 
 
 
 
19
20
21
22
...
1
2
3
 
4
5
6
 
 
 
 
 
 
 
 
 
 
 
 
7
8
9
10
11
12
13
14
15
16
0
@@ -1,21 +1,15 @@
0
 <div class="group">
0
   <dl>
0
     <dt>
0
- <%= f.label_for :data, :text => labels[:data] %>
0
+ <%= label_tag :data, labels[:data] %>
0
       <p class="hint"><%= hint %></p>
0
     </dt>
0
- <dd><%= f.text_area :attachment_data, :class => 'fat' %></dd>
0
- <% if form.new_record? || form.is_a?(Resource) -%>
0
- <dt><%= f.label_for :filename, :text => labels[:filename] %></dt>
0
- <dd><%= f.text_field :filename %></dd>
0
- <% end -%>
0
- <% if form.new_record? -%>
0
- <dt><%= f.label_for :type, :text => 'Template type' %></dt>
0
- <dd>
0
- <select name="resource_type" id="resource_type">
0
- <%= options_for_select(%w(Liquid/Html CSS Javascript)) %>
0
- </select>
0
- </dd>
0
+ <dd><%= text_area_tag :data, (attachment && attachment.file? ? attachment.read : params[:data]), :class => 'fat', :rows => 20 %></dd>
0
+ <% if controller.action_name == 'index' -%>
0
+ <dt>
0
+ <%= label_tag :filename, labels[:filename] %>
0
+ </dt>
0
+ <dd><%= text_field_tag :filename, params[:filename] %></dd>
0
     <% end -%>
0
   </dl>
0
 </div>
0
\ No newline at end of file
...
3
4
5
6
7
 
 
8
9
10
 
 
11
12
13
...
15
16
17
18
19
 
 
 
20
21
22
23
24
25
 
26
27
28
 
29
30
31
32
33
 
34
35
36
37
 
38
39
40
...
3
4
5
 
 
6
7
8
 
 
9
10
11
12
13
...
15
16
17
 
 
18
19
20
21
22
23
24
25
 
26
27
28
 
29
30
31
32
33
 
34
35
36
37
 
38
39
40
41
0
@@ -3,11 +3,11 @@
0
 <p>Modify a template by selecting it from the list below. Add a new layout by creating a Liquid template with an
0
   *_layout suffix (e.g custom_layout).</p>
0
 <ul id="resources">
0
- <% @templates.each do |template| -%>
0
- <li><%= link_to template.filename, :controller => 'templates', :action => 'edit', :id => template %></li>
0
+ <% site.templates.each do |template| -%>
0
+ <li><%= link_to template.basename, :controller => 'templates', :action => 'edit', :filename => template.basename %></li>
0
   <% end -%>
0
- <% @resources.each do |resource| -%>
0
- <li><%= link_to resource.public_filename, :controller => 'resources', :action => 'edit', :id => resource %></li>
0
+ <% site.resources.reject { |r| site.resources.image?(r) }.each do |resource| -%>
0
+ <li><%= link_to resource.basename, :controller => 'resources', :action => 'edit', :filename => resource.basename %></li>
0
   <% end -%>
0
 </ul>
0
 
0
@@ -15,26 +15,27 @@
0
 
0
 <p>Select an image to use in your template.</p>
0
 <ul id="attachments">
0
- <% @images.each do |image| -%>
0
- <li id="image-<%= image.id %>"><%= link_to_remote image_tag('/images/icons/trash.gif', :class => 'iconb red'), {:url => {:controller => 'resources', :action => 'remove', :id => image}}, :class => 'aicon', :title => 'Delete image' %> <%= image.public_filename %> </li>
0
+ <% site.resources.select { |r| site.resources.image?(r) }.each do |image| -%>
0
+ <li><%= link_to_remote image_tag('/images/icons/trash.gif', :class => 'iconb red'),
0
+ {:url => {:controller => 'resources', :action => 'remove', :filename => image.basename}}, :class => 'aicon', :title => 'Delete image' %> <%= image.basename %> </li>
0
   <% end -%>
0
 </ul>
0
 
0
 
0
 <div class="sbar-group box">
0
- <% form_for :resource, @resource, :url => { :controller => 'resources', :action => 'upload', :id => nil }, :html => { :multipart => true } do |f| -%>
0
+ <%= start_form_tag({:controller => 'resources', :action => 'upload', :filename => nil }, { :multipart => true }) %>
0
   <dl class="sbar-form">
0
     <dt>
0
- <label for="resource_uploaded_data">Upload new image</label>
0
+ <label for="resource">Upload new image</label>
0
       <p class="hint">Upload images to use in your templates</p>
0
       <span style="display:none;" id="upload-spinner"><img src="/images/icons/spinner-black.gif" /> uploading...</span>
0
     </dt>
0
     <dd>
0
- 1. <%= f.file_field :uploaded_data %><br />
0
+ 1. <%= file_field_tag :resource %><br />
0
       2. <%= submit_tag 'Upload', :onclick => "Element.show('upload-spinner')" %>
0
     </dd>
0
   </dl>
0
- <% end -%>
0
+ </form>
0
 </div>
0
 
0
 
...
6
7
8
9
10
11
12
13
14
15
 
 
 
 
 
 
 
16
17
18
19
 
20
21
22
...
6
7
8
 
 
 
 
 
 
 
9
10
11
12
13
14
15
16
17
 
 
18
19
20
21
0
@@ -6,16 +6,15 @@
0
   </div>
0
 <% end %>
0
 
0
-<% form_for :resource, @resource, :url => { :action => 'create' } do |f| -%>
0
-<%= render :partial => 'form', :object => @resource, :locals => {
0
- :title => 'Create a new template',
0
- :hint => 'You can use HTML and Liquid in your template.',
0
- :f => f,
0
- :labels => { :data => 'Template source code',
0
- :filename => 'Name of your template' }
0
+<%= start_form_tag :action => 'create' %>
0
+<%= render :partial => 'form', :locals => {
0
+ :attachment => nil,
0
+ :title => 'Create a new template',
0
+ :hint => 'You can use HTML and Liquid in your template.',
0
+ :labels => { :data => 'Template source code',
0
+ :filename => 'Name of your template' }
0
  } %>
0
 <p class="btns"><%= submit_tag 'Create template' %></p>
0
-<% end -%>
0
-
0
+</form>
0
 
0
 <%= render :partial => 'sidebar' %>
0
\ No newline at end of file
...
2
3
4
5
 
 
6
7
8
9
10
11
 
12
13
14
15
16
17
18
 
 
 
 
 
 
 
19
20
21
 
22
23
24
...
2
3
4
 
5
6
7
8
9
10
11
 
12
13
 
 
 
 
 
 
14
15
16
17
18
19
20
21
22
 
23
24
25
26
0
@@ -2,23 +2,25 @@
0
   <div id="page-nav">
0
     <ul id="act-nav" class="clear">
0
       <li><%= link_to "New template", :controller => 'design' %></li>
0
- <li><%= link_to 'Delete this file', { :controller => 'resources', :action => 'remove', :id => @resource }, :confirm => "Are you sure you want to delete #{@resource.filename}?\nThis action can't be undone!" %></li>
0
+ <li><%= link_to 'Delete this file', { :controller => 'resources', :action => 'remove', :filename => @resource.basename },
0
+ :confirm => "Are you sure you want to delete #{@resource.basename}?\nThis action can't be undone!" %></li>
0
     </ul>
0
   </div>
0
 <% end %>
0
 
0
 <div id="template-container">
0
-<% form_remote_for :resource, @resource, :url => { :action => 'update', :id => @resource },
0
+<% form_remote_for :resource, @resource, :url => { :action => 'update', :filename => @resource.basename },
0
      :html => { :id => 'template-form' } do |f| -%>
0
-<%= render :partial => 'admin/design/form', :object => @resource, :locals => {
0
- :title => @resource.filename,
0
- :hint => 'You can use motor oil to fertilize your lawn',
0
- :f => f,
0
- :labels => { :data => 'Contents',
0
- :filename => 'Filename' }
0
+<%= render :partial => 'admin/design/form', :locals => {
0
+ :attachment => @resource,
0
+ :title => @resource.basename,
0
+ :hint => 'You can use motor oil to fertilize your lawn',
0
+ :f => f,
0
+ :labels => { :data => 'Contents',
0
+ :filename => 'Filename' }
0
  } %>
0
 <p class="btns">
0
- <%= submit_tag "Update #{@resource.filename}" %> or
0
+ <%= submit_tag "Update #{@resource.basename}" %> or
0
   <%= link_to "cancel", :controller => "design" %>
0
 </p>
0
 <% end -%>
...
7
8
9
10
11
12
13
14
15
16
17
 
 
 
 
 
 
 
18
19
20
 
21
22
23
 
24
25
26
27
...
7
8
9
 
 
 
 
 
 
 
 
10
11
12
13
14
15
16
17
18
 
19
20
21
 
22
23
24
25
26
0
@@ -7,20 +7,19 @@
0
 <% end %>
0
 
0
 <div id="template-container">
0
-<% form_remote_for :template, @tmpl, :url => { :action => 'update', :id => @tmpl },
0
- :html => { :id => 'template-form' } do |f| -%>
0
-<%= render :partial => 'admin/design/form', :object => @tmpl, :locals => {
0
- :title => @tmpl.filename,
0
- :hint => 'You can use HTML and Liquid in your template.',
0
- :f => f,
0
- :labels => { :data => %(Edit the source code for your <em class="highlight">#{@tmpl.filename}</em> template),
0
- :filename => 'Title of your template' }
0
+<%= form_remote_tag :url => { :action => 'update', :filename => params[:filename] }, :html => { :id => 'template-form' } %>
0
+<%= render :partial => 'admin/design/form', :locals => {
0
+ :attachment => @tmpl,
0
+ :title => @tmpl.basename.to_s,
0
+ :hint => 'You can use HTML and Liquid in your template.',
0
+ :labels => { :data => %(Edit the source code for your <em class="highlight">#{@tmpl.basename}</em> template),
0
+ :filename => 'Title of your template' }
0
  } %>
0
 <p class="btns">
0
- <%= submit_tag "Update #{@tmpl.filename}" %> or
0
+ <%= submit_tag "Update #{@tmpl.basename}" %> or
0
   <%= link_to "cancel", :controller => "design" %>
0
 </p>
0
-<% end -%>
0
+</form>
0
 </div>
0
 
0
 <%= render :partial => 'admin/design/sidebar' %>
0
\ No newline at end of file
...
2
3
4
5
6
7
8
 
 
 
 
9
10
11
...
2
3
4
 
 
 
 
5
6
7
8
9
10
11
0
@@ -2,10 +2,10 @@ ActionController::Routing::Routes.draw do |map|
0
   map.feed 'feed/*sections', :controller => 'feed', :action => 'feed'
0
 
0
   map.with_options :controller => 'assets', :action => 'show' do |m|
0
- m.connect ':dir/*path', :dir => /stylesheets|javascripts|images/
0
- m.css 'stylesheets/*path', :dir => 'stylesheets'
0
- m.js 'javascripts/*path', :dir => 'javascripts'
0
- m.images 'images/*path', :dir => 'images'
0
+ m.connect ':dir/:path.:ext', :dir => /stylesheets|javascripts|images/
0
+ m.css 'stylesheets/:path.:ext', :dir => 'stylesheets'
0
+ m.js 'javascripts/:path.:ext', :dir => 'javascripts'
0
+ m.images 'images/:path.:ext', :dir => 'images'
0
   end
0
   
0
   map.overview 'admin/overview.xml', :controller => 'admin/overview', :action => 'feed'
...
2
3
4
5
 
6
7
8
...
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
...
88
89
90
91
92
 
93
94
95
...
98
99
100
 
101
102
103
104
105
106
107
108
...
2
3
4
 
5
6
7
8
...
23
24
25
 
 
 
 
 
 
 
 
 
 
 
 
 
 
26
27
28
...
74
75
76
 
77
78
79
80
81
...
84
85
86
87
88
89
90
91
 
92
93
94
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 => 47) do
0
+ActiveRecord::Schema.define(:version => 48) do
0
 
0
   create_table "assets", :force => true do |t|
0
     t.column "content_type", :string
0
@@ -23,20 +23,6 @@ ActiveRecord::Schema.define(:version => 47) do
0
     t.column "position", :integer, :default => 1
0
   end
0
 
0
- create_table "attachments", :force => true do |t|
0
- t.column "type", :string, :limit => 15
0
- t.column "content_type", :string, :limit => 100
0
- t.column "filename", :string
0
- t.column "db_file_id", :integer
0
- t.column "parent_id", :integer
0
- t.column "size", :integer
0
- t.column "width", :integer
0
- t.column "height", :integer
0
- t.column "attachable_id", :integer
0
- t.column "attachable_type", :string, :limit => 20
0
- t.column "site_id", :integer
0
- end
0
-
0
   create_table "cached_pages", :force => true do |t|
0
     t.column "url", :string
0
     t.column "references", :text
0
@@ -88,8 +74,8 @@ ActiveRecord::Schema.define(:version => 47) do
0
     t.column "author_email", :string
0
     t.column "author_ip", :string, :limit => 100
0
     t.column "comments_count", :integer, :default => 0
0
- t.column "version", :integer
0
     t.column "updater_id", :integer
0
+ t.column "version", :integer