diff options
| author | hukl <contact@smyck.org> | 2009-04-27 16:11:47 +0200 |
|---|---|---|
| committer | hukl <contact@smyck.org> | 2009-04-27 16:11:47 +0200 |
| commit | e9418758513fea6a83f63d31ecac316fdb6fc151 (patch) | |
| tree | 0cddb6ca32f082837b6c2fb006e3ffe6f3c27b79 /app | |
| parent | 704d002850d995e677bd550c774d9c950f8e7e9c (diff) | |
seperated admin overview into partials. included recent changes
Diffstat (limited to 'app')
| -rw-r--r-- | app/controllers/admin_controller.rb | 7 | ||||
| -rw-r--r-- | app/views/admin/_drafts.html.erb | 25 | ||||
| -rw-r--r-- | app/views/admin/_recent_changes.html.erb | 24 | ||||
| -rw-r--r-- | app/views/admin/index.html.erb | 25 |
4 files changed, 59 insertions, 22 deletions
diff --git a/app/controllers/admin_controller.rb b/app/controllers/admin_controller.rb index d61de30..55c66cf 100644 --- a/app/controllers/admin_controller.rb +++ b/app/controllers/admin_controller.rb | |||
| @@ -3,6 +3,13 @@ class AdminController < ApplicationController | |||
| 3 | 3 | ||
| 4 | def index | 4 | def index |
| 5 | @drafts = Page.drafts | 5 | @drafts = Page.drafts |
| 6 | @recent_changes = Node.all( | ||
| 7 | :limit => 50, | ||
| 8 | :order => "updated_at desc", | ||
| 9 | :conditions => [ | ||
| 10 | "updated_at < ? AND updated_at > ?", Time.now, Time.now-14.days | ||
| 11 | ] | ||
| 12 | ) | ||
| 6 | end | 13 | end |
| 7 | 14 | ||
| 8 | end | 15 | end |
diff --git a/app/views/admin/_drafts.html.erb b/app/views/admin/_drafts.html.erb new file mode 100644 index 0000000..abda588 --- /dev/null +++ b/app/views/admin/_drafts.html.erb | |||
| @@ -0,0 +1,25 @@ | |||
| 1 | <h2>Drafts (<%= @drafts.size %>)</h2> | ||
| 2 | <div id="draft_list"> | ||
| 3 | <table> | ||
| 4 | <tr class="header"> | ||
| 5 | <th>ID</th> | ||
| 6 | <th>Title</th> | ||
| 7 | <th>Path</th> | ||
| 8 | <th>author</th> | ||
| 9 | <th></th> | ||
| 10 | </tr> | ||
| 11 | <% @drafts.each do |draft| %> | ||
| 12 | <tr> | ||
| 13 | <td><%= draft.id %></td> | ||
| 14 | <td><%= draft.title %></td> | ||
| 15 | <td><%= draft.node.unique_name %></td> | ||
| 16 | <td><%= draft.user.login rescue "" %></td> | ||
| 17 | <td class="actions"> | ||
| 18 | <%= link_to 'Show', node_path(draft.node) %> | ||
| 19 | <%= link_to "Revisions", :controller => :revisions, :action => :diff, :id => draft.node.id %> | ||
| 20 | <%= link_to "Publish", publish_node_path(draft.node), :method => :put, :confirm => "Do you really want to publish?" %> | ||
| 21 | </td> | ||
| 22 | </tr> | ||
| 23 | <% end %> | ||
| 24 | </table> | ||
| 25 | </div> \ No newline at end of file | ||
diff --git a/app/views/admin/_recent_changes.html.erb b/app/views/admin/_recent_changes.html.erb new file mode 100644 index 0000000..1bb14a6 --- /dev/null +++ b/app/views/admin/_recent_changes.html.erb | |||
| @@ -0,0 +1,24 @@ | |||
| 1 | <h2>Recent Changes</h2> | ||
| 2 | <div id="draft_list"> | ||
| 3 | <table> | ||
| 4 | <tr class="header"> | ||
| 5 | <th>Title</th> | ||
| 6 | <th>path</th> | ||
| 7 | <th>user</th> | ||
| 8 | <th>date</th> | ||
| 9 | <th></th> | ||
| 10 | </tr> | ||
| 11 | <% @recent_changes.each do |node| %> | ||
| 12 | <tr> | ||
| 13 | <td><%= node.draft.try(:title) %></td> | ||
| 14 | <td><%= node.unique_name %></td> | ||
| 15 | <td><%= node.draft.user.login rescue "" %></td> | ||
| 16 | <td><%= node.updated_at.to_s(:db) %></td> | ||
| 17 | <td class="actions"> | ||
| 18 | <%= link_to 'Show', node_path(node) %> | ||
| 19 | <%= link_to "Revisions", revision_path(:id => node.id) %> | ||
| 20 | </td> | ||
| 21 | </tr> | ||
| 22 | <% end %> | ||
| 23 | </table> | ||
| 24 | </div> \ No newline at end of file | ||
diff --git a/app/views/admin/index.html.erb b/app/views/admin/index.html.erb index b40f92a..cf33774 100644 --- a/app/views/admin/index.html.erb +++ b/app/views/admin/index.html.erb | |||
| @@ -1,22 +1,3 @@ | |||
| 1 | <div id="draft_list"> | 1 | <%= render :partial => 'drafts' %> |
| 2 | <h2>Drafts</h2> | 2 | |
| 3 | <table> | 3 | <%= render :partial => 'recent_changes' %> \ No newline at end of file |
| 4 | <tr> | ||
| 5 | <th>ID</th> | ||
| 6 | <th>Title</th> | ||
| 7 | <th>Path</th> | ||
| 8 | <th>Locked by</th> | ||
| 9 | </tr> | ||
| 10 | <% @drafts.each do |draft| %> | ||
| 11 | <tr> | ||
| 12 | <td><%= draft.id %></td> | ||
| 13 | <td><%= draft.title %></td> | ||
| 14 | <td><%= draft.node.unique_name %></td> | ||
| 15 | <td><%= draft.node.lock_owner.login rescue "" %></td> | ||
| 16 | <td><%= link_to 'Show', node_path(draft.node) %></td> | ||
| 17 | <td><%= link_to "Diff revisions", :controller => :revisions, :action => :diff, :id => draft.node.id %></td> | ||
| 18 | <td><%= link_to "Publish", publish_node_path(draft.node), :method => :put, :confirm => "Do you really want to publish?" %></td> | ||
| 19 | </tr> | ||
| 20 | <% end %> | ||
| 21 | </table> | ||
| 22 | </div> \ No newline at end of file | ||
