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 !
allow Site#host updating in the sites controller
technoweenie (author)
Sun Feb 03 11:42:57 -0800 2008
commit  188c502e886f03afe8591881722bda646950061e
tree    a1ce59e6851b73d28346d869ae697c8a192934b4
parent  cdc1caa107641e121b5810dc0988e5c4dfb91152
...
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
 
 
 
 
 
 
 
 
 
 
45
46
47
...
27
28
29
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
30
31
32
33
34
35
36
37
38
39
40
41
42
0
@@ -27,21 +27,16 @@ class Admin::SitesController < Admin::BaseController
0
       render :action => "new"
0
     end
0
   end
0
-
0
- # Not sure about having an edit / update, maybe allow the change of a host name?
0
- # def edit
0
- # @site = Site.find(params[:id])
0
- # end
0
- #
0
- # def update
0
- # @site = Site.find(params[:id])
0
- # if @site.update_attributes(params[:site])
0
- # flash[:notice] = "Site #{@site.host} was successfully updated."
0
- # redirect_to :action => 'index'
0
- # else
0
- # render :action => "edit"
0
- # end
0
- # end
0
+
0
+ def update
0
+ @site = Site.find(params[:id])
0
+ if @site.update_attributes(params[:site])
0
+ flash[:notice] = "Site #{@site.host} was successfully updated."
0
+ redirect_to :action => 'show', :id => @site
0
+ else
0
+ render :action => 'show'
0
+ end
0
+ end
0
 
0
   def destroy
0
     @site = Site.find(params[:id])
...
19
20
21
22
 
23
24
25
26
27
28
29
30
...
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
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
...
19
20
21
 
22
23
24
25
26
 
27
28
29
...
31
32
33
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
34
35
36
37
38
0
@@ -19,12 +19,11 @@
0
 </div>
0
 <% end %>
0
 
0
-<% if @sites.any? %>
0
+<% if @sites.size > 0 %>
0
 <!-- begin article list -->
0
 <table id="article-list" cellspacing="0" cellpadding="0">
0
   <thead>
0
     <tr>
0
- <th scope="col">Site id</th>
0
       <th scope="col">Host</th>
0
       <th scope="col">Title</th>
0
     </tr>
0
@@ -32,59 +31,8 @@
0
   <tbody id="articles">
0
 <% @sites.each do |site| -%>
0
     <tr>
0
- <td><%=h site.id %></td>
0
- <td><%= link_to(site.host, {:action => 'show', :id => site}) %></td>
0
- <td><%=h site.title %></td>
0
- </tr>
0
-<% end -%>
0
- </tbody>
0
-</table>
0
-<!-- /end article list -->
0
-
0
-
0
-<!-- begin pagination -->
0
-<% if @sites.page_count > 1 -%>
0
- <%= will_paginate @sites, :id => 'pagination' %>
0
-<% end -%>
0
-<!-- /end pagination -->
0
-<% end %>
0
-<% content_for :action_nav do -%>
0
-<!-- begin action nav -->
0
-<div id="page-nav">
0
- <ul id="act-nav" class="clear">
0
- <li><%= link_to "New", :action => "new" %></li>
0
- </ul>
0
-</div>
0
-<!-- /end action nav -->
0
-<div id="filter" class="manual">
0
- <ul class="clear">
0
- <li><a href="#">&nbsp;</a></li>
0
- </ul>
0
- <% form_tag({:action => 'index'}, :method => 'get') do -%>
0
- <ul id="attributes">
0
- <li><label>Search: <%= text_field_tag :search_string, params[:search_string] %></label></li>
0
- <li><input type="submit" value="Go" /></li>
0
- </ul>
0
- <% end -%>
0
-</div>
0
-<% end %>
0
-
0
-<% if @sites.any? %>
0
-<!-- begin article list -->
0
-<table id="article-list" cellspacing="0" cellpadding="0">
0
- <thead>
0
- <tr>
0
- <th scope="col">Site id</th>
0
- <th scope="col">Host</th>
0
- <th scope="col">Title</th>
0
- </tr>
0
- </thead>
0
- <tbody id="articles">
0
-<% @sites.each do |site| -%>
0
- <tr>
0
- <td><%=h site.id %></td>
0
- <td><%=h site.host %></td>
0
       <td><%= link_to(site.title, {:action => 'show', :id => site}) %></td>
0
+ <td><%=h site.host %></td>
0
     </tr>
0
 <% end -%>
0
   </tbody>
...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
 
 
 
 
 
 
17
18
 
19
 
20
21
22
...
33
34
35
 
 
36
37
38
...
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
 
8
9
10
11
12
13
...
24
25
26
27
28
29
 
 
0
@@ -1,22 +1,13 @@
0
-<div id="general" class="setgroup">
0
- <%= error_messages_for :site %>
0
- <% form_for :site, :url => {:action => 'create'} do |f| %>
0
- <dl class="setform">
0
- <dt><label for="site_host">Host</label></dt>
0
- <dd><%= f.text_field :host %></dd>
0
- <dt><label for="site_title">Website title</label></dt>
0
- <dd><%= f.text_field :title %></dd>
0
- <dt><label for="site_subtitle">Website subtitle</label></dt>
0
- <dd><%= f.text_field :subtitle %></dd>
0
- <dt>
0
- <label for="site_email">Administrator email</label>
0
- <span class="hint">Shown in emails sent from your site</span>
0
- </dt>
0
- <dd><%= f.text_field :email %></dd>
0
- </dl>
0
+<% content_for :action_nav do -%>
0
+<!-- begin action nav -->
0
+<div id="page-nav">
0
+ <ul id="act-nav" class="clear">
0
+ <li><%= link_to "Sites", :action => "index" %></li>
0
+ </ul>
0
 </div>
0
-<p class="btns"><%= submit_tag 'Create new site' %></p>
0
+<!-- /end action nav -->
0
 <% end %>
0
+
0
 <div id="general" class="setgroup">
0
   <%= error_messages_for :site %>
0
   <% form_for :site, :url => {:action => 'create'} do |f| %>
0
@@ -33,6 +24,6 @@
0
     </dt>
0
     <dd><%= f.text_field :email %></dd>
0
   </dl>
0
+ <p class="btns"><%= submit_tag 'Create new site' %></p>
0
+ <% end %>
0
 </div>
0
-<p class="btns"><%= submit_tag 'Create new site' %></p>
0
-<% end %>
...
1
 
 
 
 
 
 
 
 
 
2
3
4
5
6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7
8
9
10
11
12
13
 
14
...
 
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
0
@@ -1,14 +1,33 @@
0
-<h2><%=h @site.host %></h2>
0
+<% content_for :action_nav do -%>
0
+<!-- begin action nav -->
0
+<div id="page-nav">
0
+ <ul id="act-nav" class="clear">
0
+ <li><%= link_to "Sites", :action => "index" %></li>
0
+ </ul>
0
+</div>
0
+<!-- /end action nav -->
0
+<% end %>
0
 
0
-<h3><%=h @site.title %> <small>(<%= mail_to @site.email %>)</small></h3>
0
-
0
-<% form_tag :action => 'destroy', :id => @site do -%>
0
- <p class="btns"><%= submit_tag 'Delete' %> or <%= link_to "go back", :action => "index" %></p>
0
+<% form_for :site, :url => { :action => "update", :id => @site } do |f| -%>
0
+<%= f.error_messages %>
0
+<div id="general" class="setgroup">
0
+ <h3><%=h @site.title %> <small>(<%= mail_to @site.email %>)</small></h3>
0
+ <dl class="setform">
0
+ <dt><label for="site_host">Host</label></dt>
0
+ <dd><%= f.text_field :host %></dd>
0
+ <dt><label>Theme Path</label></dt>
0
+ <dd><%=h @site.theme_path %></dd>
0
+ <dt>
0
+ See and update the <%= link_to 'other site settings.', :controller => 'settings', :action => 'index', :host => @site.host %>
0
+ </dt>
0
+ </dl>
0
+ <p class="btns">
0
+ <%= f.submit :Save %> or
0
+ <%= link_to 'Delete', {:action => 'destroy', :id => @site}, :confirm => "Are you sure you wish to delete this site?", :method => :post %>
0
+ </p>
0
+</div>
0
 <% end -%>
0
-<h2><%=h @site.host %></h2>
0
-
0
-<h3><%=h @site.title %> <small>(<%= mail_to @site.email %>)</small></h3>
0
 
0
 <% form_tag :action => 'destroy', :id => @site do -%>
0
- <p class="btns"><%= submit_tag 'Delete' %> or <%= link_to "go back", :action => "index" %></p>
0
+ <p class="btns"><%= submit_tag 'Delete' %>
0
 <% end -%>

Comments

    No one has commented yet.