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 !
added resources controller, consolidated resource and template forms

git-svn-id: http://svn.techno-weenie.net/projects/mephisto/trunk@776 
567b1171-46fb-0310-a4c9-b4bef9110e78
technoweenie (author)
Sat Feb 11 23:17:22 -0800 2006
commit  17a88e5669656ac9ea3fb92e6f29da221575dcfc
tree    708066bc215f5b34483a6252ad76812041e71c89
parent  478db826e3191d2cc0e120afaf57d432238b576f
...
36
37
38
39
40
 
 
41
42
...
36
37
38
 
 
39
40
41
42
0
@@ -36,7 +36,7 @@ class Admin::TemplatesController < Admin::BaseController
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 ||= Template.find_or_create_by_filename(params[:id]) if Template.template_types.include?(params[:id].to_sym)
0
+ @tmpl = @templates.detect { |t| t.filename == params[:id] }
0
+ @tmpl ||= Template.find_or_create_by_filename(params[:id]) if Template.template_types.include?(params[:id].to_sym)
0
   end
0
 end
...
11
12
13
14
 
15
16
17
18
...
11
12
13
 
14
15
16
17
18
0
@@ -11,7 +11,7 @@
0
 <p class="hint">Modify a template by selecting it from the list below.</p>
0
 <ul id="resources">
0
   <% @resources.each do |resource| -%>
0
- <li><%= link_to resource.full_path, :controller => 'templates', :action => 'edit', :id => resource %></li>
0
+ <li><%= link_to resource.full_path, :controller => 'resources', :action => 'edit', :id => resource %></li>
0
   <% end -%>
0
 </ul>
0
 <% end -%>
0
\ No newline at end of file
...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
 
 
 
 
 
 
 
21
22
23
...
1
2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
4
5
6
7
8
9
10
11
12
0
@@ -1,23 +1,12 @@
0
 <h2>Manage your Assets and Resources</h2>
0
 <% form_for :resource, @resource, :url => {:action => 'new'} do |f| -%>
0
-<div class="group">
0
- <h3>Create a new template</h3>
0
- <dl>
0
- <dt>
0
- <%= f.label_for :data, :text => 'Template source code' %>
0
- <p class="hint">You can use HTML and Liquid in your template.</p>
0
- </dt>
0
- <dd><%= f.text_area :data, :class => 'fat' %></dd>
0
- <dt><%= f.label_for :filename, :text => 'Title of your template' %></dt>
0
- <dd><%= f.text_field :filename %></dd>
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
- </dl>
0
-</div>
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 => 'Title of your template' }
0
+ } %>
0
 <p class="btns"><%= submit_tag 'Create template' %></p>
0
 <% end -%>
0
 
...
1
2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
4
5
6
...
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
0
@@ -1,5 +1,26 @@
0
 <div id='template_container'>
0
-<%= render :partial => 'form', :locals => { :template => @tmpl } %>
0
+<% form_remote_for :template, @tmpl, :url => { :action => 'update', :id => @tmpl },
0
+ :html => { :id => 'template_form', :style => 'display:none' },
0
+ :loading => "TemplateForm.loadingDuringSave()",
0
+ :complete => "TemplateForm.completedSave()",
0
+ :update => 'template_container' 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 => 'Template source code',
0
+ :filename => 'Title of your template' }
0
+ } %>
0
+<p class="btns">
0
+ <%= submit_tag "Update #{@tmpl.filename}" %> or
0
+ <%= link_to_function 'cancel', 'TemplateForm.hide()', :id => 'template_cancel' %>
0
+</p>
0
+<% end -%>
0
+
0
+<div id='template_saved'>
0
+ <pre><code><%=h @tmpl.data %></code></pre>
0
+ <%= link_to_function 'edit', 'TemplateForm.show()' %>
0
+</div>
0
 </div>
0
 
0
 <%= render :partial => 'admin/design/sidebar' %>
0
\ No newline at end of file

Comments

    No one has commented yet.