summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhukl <contact@smyck.org>2009-10-18 17:57:18 +0200
committerhukl <contact@smyck.org>2009-10-18 17:57:18 +0200
commitf7d4d68953f913fa025d140674c6db56ed612c00 (patch)
treecaa5682d25cfe79e1e99572b75058ce6e72bc733
parent443947a319692e0462024c99f06e4d18ab5f0344 (diff)
re-activated admin overview screen - listing 20 recent changes and 20 current drafts. more to come
-rw-r--r--app/controllers/admin_controller.rb8
-rw-r--r--app/views/admin/index.html.erb67
-rw-r--r--app/views/nodes/index.html.erb2
-rw-r--r--public/javascripts/admin_interface.js21
-rw-r--r--public/stylesheets/admin.css26
5 files changed, 109 insertions, 15 deletions
diff --git a/app/controllers/admin_controller.rb b/app/controllers/admin_controller.rb
index 538e7d7..0446387 100644
--- a/app/controllers/admin_controller.rb
+++ b/app/controllers/admin_controller.rb
@@ -5,9 +5,13 @@ class AdminController < ApplicationController
5 before_filter :login_required 5 before_filter :login_required
6 6
7 def index 7 def index
8 @drafts = Page.drafts 8 @drafts = Node.all(
9 :limit => 20,
10 :order => "updated_at desc",
11 :conditions => ["draft_id IS NOT NULL"]
12 )
9 @recent_changes = Node.all( 13 @recent_changes = Node.all(
10 :limit => 50, 14 :limit => 20,
11 :order => "updated_at desc", 15 :order => "updated_at desc",
12 :conditions => [ 16 :conditions => [
13 "updated_at < ? AND updated_at > ?", Time.now, Time.now-14.days 17 "updated_at < ? AND updated_at > ?", Time.now, Time.now-14.days
diff --git a/app/views/admin/index.html.erb b/app/views/admin/index.html.erb
index bd0df0b..1e599aa 100644
--- a/app/views/admin/index.html.erb
+++ b/app/views/admin/index.html.erb
@@ -1,3 +1,68 @@
1<table id="admin_overview"> 1<p id="overview_toggle">
2 <a href="#" id="recent_changes_toggle" class="button">recent changes</a>
3 <a href="#" id="current_drafts_toggle" class="button">current drafts</a>
4</p>
5
6<div id="recent_changes_table">
2 7
8 <h1>Recent Changes</h1>
9
10 <table class="node_table">
11 <tr class="header">
12 <th class="node_id">ID</th>
13 <th class="title">Title</th>
14 <th class="actions">Actions</th>
15 <th class="editor">Locked by</th>
16 <th class="revision">Rev.</th>
17 </tr>
18 <% @recent_changes.each do |node| %>
19 <tr class="<%= cycle("even", "odd") %>">
20 <td class="node_id"><%= node.id %></td>
21 <td class="title">
22 <h4><%= link_to title_for_node(node), node_path(node) %></h4>
23 <p><%= link_to_path(node.unique_name, node.unique_name) %></p>
24 </td>
25 <td class="actions">
26 <%= link_to 'show', node_path(node) %>
27 <%= link_to 'Revisions', node_revisions_path(node) %>
28 </td>
29 <td>
30 <%= node.lock_owner.login if node.lock_owner %>
31 </td>
32 <td>
33 <%= node.draft ? node.draft.revision : node.head.revision %>
34 </td>
35 </tr>
36 <% end %>
37 </table>
38</div>
39<h1>Current Drafts</h1>
40
41<table id="current_drafts_table" class="node_table">
42 <tr class="header">
43 <th class="node_id">ID</th>
44 <th class="title">Title</th>
45 <th class="actions">Actions</th>
46 <th class="editor">Locked by</th>
47 <th class="revision">Rev.</th>
48 </tr>
49 <% @drafts.each do |node| %>
50 <tr class="<%= cycle("even", "odd") %>">
51 <td class="node_id"><%= node.id %></td>
52 <td class="title">
53 <h4><%= link_to title_for_node(node), node_path(node) %></h4>
54 <p><%= link_to_path(node.unique_name, node.unique_name) %></p>
55 </td>
56 <td class="actions">
57 <%= link_to 'show', node_path(node) %>
58 <%= link_to 'Revisions', node_revisions_path(node) %>
59 </td>
60 <td>
61 <%= node.lock_owner.login if node.lock_owner %>
62 </td>
63 <td>
64 <%= node.draft ? node.draft.revision : node.head.revision %>
65 </td>
66 </tr>
67 <% end %>
3</table> \ No newline at end of file 68</table> \ No newline at end of file
diff --git a/app/views/nodes/index.html.erb b/app/views/nodes/index.html.erb
index 46c58f6..bf01645 100644
--- a/app/views/nodes/index.html.erb
+++ b/app/views/nodes/index.html.erb
@@ -4,7 +4,7 @@
4<h1>Nodes</h1> 4<h1>Nodes</h1>
5 5
6<%= will_paginate @nodes %> 6<%= will_paginate @nodes %>
7 <table id="node_table"> 7 <table class="node_table">
8 <tr class="header"> 8 <tr class="header">
9 <th class="node_id">ID</th> 9 <th class="node_id">ID</th>
10 <th class="title">Title</th> 10 <th class="title">Title</th>
diff --git a/public/javascripts/admin_interface.js b/public/javascripts/admin_interface.js
index 7aeb0b1..66e9a96 100644
--- a/public/javascripts/admin_interface.js
+++ b/public/javascripts/admin_interface.js
@@ -21,6 +21,27 @@ $(document).ready(function () {
21 move_to_search.initialize_search(); 21 move_to_search.initialize_search();
22 } 22 }
23 23
24 if ($('#recent_changes_toggle').length != 0) {
25 $('#current_drafts_table').hide();
26 $('#recent_changes_toggle').attr("class", "selected");
27
28 $('#recent_changes_toggle').bind("click", function(){
29 $('#recent_changes_toggle').attr("class", "selected");
30 $('#current_drafts_toggle').attr("class", "unselected");
31 $('#recent_changes_table').show();
32 $('#current_drafts_table').hide();
33 return false;
34 });
35
36 $('#current_drafts_toggle').bind("click", function(){
37 $('#recent_changes_toggle').attr("class", "unselected");
38 $('#current_drafts_toggle').attr("class", "selected");
39 $('#current_drafts_table').show();
40 $('#recent_changes_table').hide();
41 return false;
42 });
43 }
44
24 $(".with_editor").tinymce({ 45 $(".with_editor").tinymce({
25 script_url : '/javascripts/tiny_mce/tiny_mce.js', 46 script_url : '/javascripts/tiny_mce/tiny_mce.js',
26 theme: "advanced", 47 theme: "advanced",
diff --git a/public/stylesheets/admin.css b/public/stylesheets/admin.css
index 6fa5b59..921e83d 100644
--- a/public/stylesheets/admin.css
+++ b/public/stylesheets/admin.css
@@ -93,7 +93,11 @@ div.pagination span.current, div.pagination a:hover {
93 background-color: #000000; 93 background-color: #000000;
94} 94}
95 95
96#main_navigation a, #sub_navigation a, #metadata a, input[type=submit]{ 96#main_navigation a,
97#sub_navigation a,
98#metadata a,
99input[type=submit],
100#overview_toggle a {
97 letter-spacing: 1px; 101 letter-spacing: 1px;
98 padding-left: 5px; 102 padding-left: 5px;
99 padding-right: 5px; 103 padding-right: 5px;
@@ -116,53 +120,53 @@ div.pagination span.current, div.pagination a:hover {
116 background-color: #ff9600; 120 background-color: #ff9600;
117} 121}
118 122
119#navigation a.selected, #metadata a.selected { 123#navigation a.selected, #metadata a.selected, #overview_toggle a.selected {
120 color: #ffffff; 124 color: #ffffff;
121 background-color: #000000; 125 background-color: #000000;
122} 126}
123 127
124/* Nodes */ 128/* Nodes */
125 129
126table#node_table { 130table.node_table {
127 width: 899px; 131 width: 899px;
128 border-collapse: collapse; 132 border-collapse: collapse;
129} 133}
130 134
131table#node_table tr { 135table.node_table tr {
132 height: 65px; 136 height: 65px;
133 border-bottom: 1px solid #000000; 137 border-bottom: 1px solid #000000;
134} 138}
135 139
136table#node_table th.title { 140table.node_table th.title {
137 width: 450px; 141 width: 450px;
138} 142}
139 143
140table#node_table tr.header { 144table.node_table tr.header {
141 height: 20px; 145 height: 20px;
142 text-align: left; 146 text-align: left;
143} 147}
144 148
145table#node_table td { 149table.node_table td {
146 padding-top: 0px; 150 padding-top: 0px;
147 padding-bottom: 0px; 151 padding-bottom: 0px;
148 padding-right: 25px; 152 padding-right: 25px;
149 padding-left: 0px; 153 padding-left: 0px;
150} 154}
151 155
152table#node_table .node_id { 156table.node_table .node_id {
153 padding-left: 10px; 157 padding-left: 10px;
154 padding-right: 15px; 158 padding-right: 15px;
155} 159}
156 160
157table#node_table tr.header:hover { 161table.node_table tr.header:hover {
158 background-color: #ffffff; 162 background-color: #ffffff;
159} 163}
160 164
161table#node_table tr:hover { 165table.node_table tr:hover {
162 background-color: #f1f1f1; 166 background-color: #f1f1f1;
163} 167}
164 168
165table#node_table .actions { 169table.node_table .actions {
166 text-transform: lowercase; 170 text-transform: lowercase;
167} 171}
168 172