radiant 0.5.0 → 0.5.1
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of radiant might be problematic. Click here for more details.
- data/CHANGELOG +1 -1
- data/CONTRIBUTORS +6 -0
- data/app/controllers/application.rb +1 -0
- data/app/helpers/admin/page_helper.rb +12 -1
- data/app/helpers/application_helper.rb +4 -0
- data/app/models/page_context.rb +1 -1
- data/app/models/response_cache.rb +2 -2
- data/app/views/admin/layout/index.rhtml +15 -15
- data/app/views/admin/layout/new.rhtml +13 -13
- data/app/views/admin/layout/remove.rhtml +9 -9
- data/app/views/admin/page/_node.rhtml +13 -14
- data/app/views/admin/page/_part.rhtml +8 -8
- data/app/views/admin/page/index.rhtml +44 -17
- data/app/views/admin/page/remove.rhtml +3 -3
- data/app/views/admin/snippet/index.rhtml +15 -15
- data/app/views/admin/snippet/new.rhtml +14 -14
- data/app/views/admin/snippet/remove.rhtml +8 -8
- data/app/views/admin/user/index.rhtml +19 -19
- data/app/views/admin/user/new.rhtml +26 -26
- data/app/views/admin/user/preferences.rhtml +13 -13
- data/app/views/admin/user/remove.rhtml +8 -8
- data/app/views/admin/welcome/login.rhtml +7 -7
- data/app/views/layouts/application.rhtml +50 -50
- data/bin/radiant +347 -244
- data/config/environment.rb +1 -1
- data/db/migrate/001_create_radiant_tables.rb +2 -0
- data/db/migrate/002_insert_initial_data.rb +12 -5
- data/lib/console_utils.rb +167 -0
- data/lib/radiant.rb +15 -2
- data/lib/tasks/release.rake +10 -6
- data/public/.htaccess +40 -0
- data/public/images/layout.png +0 -0
- data/public/images/new-layout.png +0 -0
- data/script/version +5 -0
- data/test/fixtures/pages.yml +39 -39
- data/test/functional/admin/page_controller_test.rb +47 -0
- data/test/functional/site_controller_test.rb +6 -0
- data/test/unit/page_context_test.rb +3 -1
- metadata +7 -6
- data/config/locomotive.yml +0 -6
- data/test/fixtures/pages.yml.rej +0 -28
- data/test/unit/page_context_test.rb.rej +0 -26
data/CHANGELOG
CHANGED
@@ -1 +1 @@
|
|
1
|
-
= Change Log
|
1
|
+
= Change Log
|
data/CONTRIBUTORS
CHANGED
@@ -1,8 +1,19 @@
|
|
1
1
|
module Admin::PageHelper
|
2
2
|
def render_node(page, locals = {})
|
3
|
-
locals.reverse_merge!(
|
3
|
+
locals.reverse_merge!(:level => 0, :simple => false).merge!(:page => page)
|
4
4
|
render :partial => 'node', :locals => locals
|
5
5
|
end
|
6
|
+
|
7
|
+
def expanded_rows
|
8
|
+
case
|
9
|
+
when row_string = (cookies['expanded_rows'] || []).first
|
10
|
+
row_string.split(',').map { |x| Integer(x) rescue nil }.compact
|
11
|
+
when @homepage
|
12
|
+
[@homepage.id]
|
13
|
+
else
|
14
|
+
[]
|
15
|
+
end
|
16
|
+
end
|
6
17
|
|
7
18
|
def meta_errors?
|
8
19
|
!!(@page.errors[:slug] or @page.errors[:breadcrumb])
|
data/app/models/page_context.rb
CHANGED
@@ -208,7 +208,7 @@ class PageContext < Radius::Context
|
|
208
208
|
contextual = boolean_attr['contextual', true]
|
209
209
|
if inherit and contextual
|
210
210
|
part = part_page.part(part_name)
|
211
|
-
page.behavior.render_snippet(part)
|
211
|
+
page.behavior.render_snippet(part) unless part.nil?
|
212
212
|
else
|
213
213
|
part_page.behavior.render_page_part(part_name)
|
214
214
|
end
|
@@ -22,7 +22,7 @@ class ResponseCache
|
|
22
22
|
# Options are as follows:
|
23
23
|
# :directory :: the path to the temporary cache directory
|
24
24
|
# :expire_time :: the number of seconds a cached response is considered valid (defaults to 5 min)
|
25
|
-
# :default_extension :: the extension cached files should use (defaults to '.
|
25
|
+
# :default_extension :: the extension cached files should use (defaults to '.yml')
|
26
26
|
# :peform_caching :: boolean value that turns caching on or off (defaults to true)
|
27
27
|
# :logger :: the application logging object (defaults to ActionController::Base.logger)
|
28
28
|
#
|
@@ -109,4 +109,4 @@ class ResponseCache
|
|
109
109
|
}.to_yaml
|
110
110
|
cache_page(content, path)
|
111
111
|
end
|
112
|
-
end
|
112
|
+
end
|
@@ -5,29 +5,29 @@
|
|
5
5
|
edit it or click <code>Remove</code> to delete it.</p>
|
6
6
|
|
7
7
|
<table id="layouts" class="index" cellpadding="0" cellspacing="0" border="0">
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
8
|
+
<thead>
|
9
|
+
<tr>
|
10
|
+
<th class="layout">Layout</th>
|
11
|
+
<th class="modify">Modify</th>
|
12
|
+
</tr>
|
13
|
+
</thead>
|
14
|
+
<tbody>
|
15
15
|
<% unless @layouts.empty? -%>
|
16
16
|
<% for layout in @layouts -%>
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
17
|
+
<tr class="node level-1">
|
18
|
+
<td class="layout">
|
19
|
+
<%= image_tag 'layout', :alt => 'layout-icon', :title => '', :align => 'center' %>
|
20
|
+
<%= link_to layout.name, layout_edit_url(:id => layout) %>
|
21
|
+
</td>
|
22
|
+
<td class="remove"><%= link_to image_tag('remove', :alt => 'Remove Layout'), layout_remove_url(:id => layout) %></td>
|
23
|
+
</tr>
|
24
24
|
<% end -%>
|
25
25
|
<% else -%>
|
26
26
|
<tr>
|
27
27
|
<td colspan="2" class="note">No Layouts</td>
|
28
28
|
</tr>
|
29
29
|
<% end -%>
|
30
|
-
|
30
|
+
</tbody>
|
31
31
|
</table>
|
32
32
|
<script type="text/javascript">
|
33
33
|
// <![CDATA[
|
@@ -5,12 +5,12 @@
|
|
5
5
|
<% end -%>
|
6
6
|
|
7
7
|
<form method="post">
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
8
|
+
<div class="form-area">
|
9
|
+
<p class="title">
|
10
|
+
<label for="layout_name">Name</label>
|
11
|
+
<%= text_field "layout", "name", :class => 'textbox', :maxlength => 100 %>
|
12
|
+
</p>
|
13
|
+
<div id="extended-metadata" class="row"<%= meta_visible(:meta) %>>
|
14
14
|
<table class="fieldset" cellpadding="0" cellspacing="0" border="0">
|
15
15
|
<tr>
|
16
16
|
<td><label for="layout_content_type">Content-Type</label></td>
|
@@ -24,14 +24,14 @@
|
|
24
24
|
<a id="less-extended-metadata" href="<%= toggle_javascript_for('extended-metadata') %>"<%= meta_visible(:meta_less) %>>Less</a>
|
25
25
|
</small>
|
26
26
|
</p>
|
27
|
-
|
28
|
-
|
29
|
-
|
27
|
+
<p class="content">
|
28
|
+
<label for="layout_content">Body</label>
|
29
|
+
<%= text_area "layout", "content", :class => "textarea", :style => "width: 100%" %></p>
|
30
30
|
<%= updated_stamp @layout %>
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
31
|
+
</div>
|
32
|
+
<p class="buttons">
|
33
|
+
<%= save_model_button(@layout) %> <%= save_model_and_continue_editing_button(@layout) %> or <%= link_to "Cancel", layout_index_url %>
|
34
|
+
</p>
|
35
35
|
</form>
|
36
36
|
|
37
37
|
<%= focus 'layout_name' %>
|
@@ -2,16 +2,16 @@
|
|
2
2
|
<p>Are you sure you want to <strong class="warning">permanently remove</strong> the following layout?</p>
|
3
3
|
|
4
4
|
<table id="site-map" class="index" cellpadding="0" cellspacing="0" border="0">
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
5
|
+
<tbody>
|
6
|
+
<tr class="node level-1" onmouseover="Element.addClassName(this, 'highlight');" onmouseout="Element.removeClassName(this, 'highlight');">
|
7
|
+
<td class="layout">
|
8
|
+
<%= image_tag 'layout', :alt => 'layout-icon', :title => '', :align => 'center' %>
|
9
|
+
<%= @layout.name %>
|
10
|
+
</td>
|
11
|
+
</tr>
|
12
|
+
</tbody>
|
13
13
|
</table>
|
14
14
|
|
15
15
|
<form method="post">
|
16
|
-
|
16
|
+
<p class="buttons"><%= submit_tag "Delete Layout", :class => 'button' %> or <%= link_to 'Cancel', layout_index_url %></p>
|
17
17
|
</form>
|
@@ -1,8 +1,7 @@
|
|
1
1
|
<%
|
2
2
|
count = page.children.count
|
3
3
|
children = count > 0
|
4
|
-
|
5
|
-
expanded = expand > 0
|
4
|
+
expanded = expanded_rows.include?(page.id)
|
6
5
|
padding_left = (level * 22) + 4
|
7
6
|
|
8
7
|
children_class = children ? (expanded ? ' children-visible' : ' children-hidden') : ' no-children'
|
@@ -20,32 +19,32 @@ behavior = behavior_id.empty? ? '' : %{<small class="info">(#{ behavior_id })</s
|
|
20
19
|
|
21
20
|
spinner = image_tag("spinner.gif", :class => 'busy', :id => "busy-#{page.id}", :alt => "", :title => "", :align => "center", :style => 'display: none;')
|
22
21
|
-%>
|
23
|
-
|
24
|
-
|
25
|
-
|
22
|
+
<tr id="page-<%= page.id %>" class="node level-<%= level %><%= children_class %><%= virtual_class %>">
|
23
|
+
<td class="page" style="padding-left: <%= padding_left %>px">
|
24
|
+
<span class="w1">
|
26
25
|
<% if simple -%>
|
27
26
|
<%= icon %>
|
28
27
|
<%= title %>
|
29
28
|
<% else -%>
|
30
29
|
<%= expander %><a href="<%= page_edit_url(:id => page) %>"><%= icon %> <%= title %></a>
|
31
|
-
|
32
|
-
|
30
|
+
<%= behavior %>
|
31
|
+
<%= spinner %>
|
33
32
|
<% end -%>
|
34
33
|
</span>
|
35
|
-
|
34
|
+
</td>
|
36
35
|
<% unless simple -%>
|
37
|
-
|
38
|
-
|
39
|
-
|
36
|
+
<td class="status <%= page.status.name.downcase %>-status"><%= page.status.name %></td>
|
37
|
+
<td class="add-child"><%= link_to image_tag('add-child', :alt => 'add child'), page_new_url(:parent_id => page) %></td>
|
38
|
+
<td class="remove"><%= link_to image_tag('remove', :alt => 'remove page'), page_remove_url(:id => page) %></td>
|
40
39
|
<% end -%>
|
41
|
-
|
40
|
+
</tr>
|
42
41
|
<% level = level + 1 -%>
|
43
42
|
<%
|
44
43
|
if expanded
|
45
44
|
page.children.each do |child|
|
46
45
|
-%>
|
47
|
-
<%= render_node child, :level => level, :
|
46
|
+
<%= render_node child, :level => level, :simple => simple -%>
|
48
47
|
<%
|
49
48
|
end
|
50
49
|
end
|
51
|
-
-%>
|
50
|
+
-%>
|
@@ -3,14 +3,14 @@
|
|
3
3
|
@index = (params[:index] || @index || 1).to_i
|
4
4
|
-%>
|
5
5
|
<div class="page" id="page-<%= @index %>">
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
6
|
+
<div class="part" id="part-<%= @index %>">
|
7
|
+
<%= hidden_field_tag "part[#{@index - 1}][name]", @part.name %>
|
8
|
+
<p>
|
9
|
+
<label for="part[<%= @index - 1 %>}][filter_id]">Filter</label>
|
10
|
+
<%= select_tag "part[#{@index - 1}][filter_id]", options_for_select([['<none>', '']] + TextFilter.find_all.map { |s| s.registered_id }, @part.filter_id) %>
|
11
|
+
</p>
|
12
|
+
<div><%= text_area_tag "part[#{@index - 1}][content]", h(@part.content), :class => "textarea", :style => "width: 100%" %></div>
|
13
|
+
</div>
|
14
14
|
</div>
|
15
15
|
<%
|
16
16
|
@index += 1;
|
@@ -2,6 +2,8 @@
|
|
2
2
|
var SiteMap = Class.create();
|
3
3
|
SiteMap.prototype = Object.extend({}, RuledTable.prototype); // Inherit from RuledTable
|
4
4
|
Object.extend(SiteMap.prototype, {
|
5
|
+
|
6
|
+
expandedRows: <%= expanded_rows.to_json %>,
|
5
7
|
|
6
8
|
onRowSetup: function(row) {
|
7
9
|
Event.observe(row, 'click', this.onMouseClickRow.bindAsEventListener(this), false);
|
@@ -50,7 +52,11 @@
|
|
50
52
|
expanders.push(image);
|
51
53
|
}.bind(this));
|
52
54
|
return expanders.first();
|
53
|
-
},
|
55
|
+
},
|
56
|
+
|
57
|
+
saveExpandedCookie: function() {
|
58
|
+
document.cookie = "expanded_rows="+this.expandedRows.join(",")+"; path=/admin";
|
59
|
+
},
|
54
60
|
|
55
61
|
hideBranch: function(row, img) {
|
56
62
|
var level = this.extractLevel(row);
|
@@ -62,6 +68,13 @@
|
|
62
68
|
}
|
63
69
|
sibling = sibling.nextSibling;
|
64
70
|
}
|
71
|
+
var pageId = this.extractPageId(row);
|
72
|
+
var newExpanded = [];
|
73
|
+
for(i=0; i < this.expandedRows.length; i++)
|
74
|
+
if(this.expandedRows[i] != pageId)
|
75
|
+
newExpanded.push(this.expandedRows[i]);
|
76
|
+
this.expandedRows = newExpanded;
|
77
|
+
this.saveExpandedCookie();
|
65
78
|
if (img == null)
|
66
79
|
img = this.getExpanderImageForRow(row);
|
67
80
|
img.src = img.src.replace(/collapse/, 'expand');
|
@@ -69,17 +82,22 @@
|
|
69
82
|
Element.addClassName(row, 'children-hidden');
|
70
83
|
},
|
71
84
|
|
72
|
-
|
85
|
+
showBranchInternal: function(row, img) {
|
73
86
|
var level = this.extractLevel(row);
|
74
87
|
var sibling = row.nextSibling;
|
75
88
|
var children = false;
|
89
|
+
var childOwningSiblings = [];
|
76
90
|
while(sibling != null) {
|
77
91
|
if (this.isRow(sibling)) {
|
78
92
|
var siblingLevel = this.extractLevel(sibling);
|
79
93
|
if (siblingLevel <= level) break;
|
80
94
|
if (siblingLevel == level + 1) {
|
81
95
|
Element.show(sibling);
|
82
|
-
|
96
|
+
if(sibling.className.match(/children-visible/)) {
|
97
|
+
childOwningSiblings.push(sibling);
|
98
|
+
} else {
|
99
|
+
this.hideBranch(sibling);
|
100
|
+
}
|
83
101
|
}
|
84
102
|
children = true;
|
85
103
|
}
|
@@ -88,12 +106,21 @@
|
|
88
106
|
if (!children)
|
89
107
|
this.getBranch(row);
|
90
108
|
if (img == null)
|
91
|
-
img = this.getExpanderImageForRow(row);
|
109
|
+
img = this.getExpanderImageForRow(row);
|
92
110
|
img.src = img.src.replace(/expand/, 'collapse');
|
111
|
+
for(i=0; i < childOwningSiblings.length; i++) {
|
112
|
+
this.showBranch(childOwningSiblings[i], null);
|
113
|
+
}
|
93
114
|
Element.removeClassName(row, 'children-hidden');
|
94
115
|
Element.addClassName(row, 'children-visible');
|
95
116
|
},
|
96
117
|
|
118
|
+
showBranch: function(row, img) {
|
119
|
+
this.showBranchInternal(row, img);
|
120
|
+
this.expandedRows.push(this.extractPageId(row));
|
121
|
+
this.saveExpandedCookie();
|
122
|
+
},
|
123
|
+
|
97
124
|
getBranch: function(row) {
|
98
125
|
var level = this.extractLevel(row).toString();
|
99
126
|
var id = this.extractPageId(row).toString();
|
@@ -140,22 +167,22 @@
|
|
140
167
|
<h1>Pages</h1>
|
141
168
|
|
142
169
|
<table id="site-map" class="index" cellpadding="0" cellspacing="0" border="0">
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
170
|
+
<thead>
|
171
|
+
<tr>
|
172
|
+
<th class="page">Page</th>
|
173
|
+
<th class="status">Status</th>
|
174
|
+
<th class="modify" colspan="2">Modify</th>
|
175
|
+
</tr>
|
176
|
+
</thead>
|
177
|
+
<tbody>
|
151
178
|
<% if @homepage -%>
|
152
179
|
<%= render_node @homepage -%>
|
153
180
|
<% else -%>
|
154
|
-
|
155
|
-
|
156
|
-
|
181
|
+
<tr>
|
182
|
+
<td colspan="4" class="note">No Pages</td>
|
183
|
+
</tr>
|
157
184
|
<% end -%>
|
158
|
-
|
185
|
+
</tbody>
|
159
186
|
</table>
|
160
187
|
<script type="text/javascript">
|
161
188
|
// <![CDATA[
|
@@ -169,4 +196,4 @@
|
|
169
196
|
<% end -%>
|
170
197
|
<%= image_submit_tag 'clear-page-cache' %>
|
171
198
|
</p>
|
172
|
-
</form>
|
199
|
+
</form>
|
@@ -4,11 +4,11 @@
|
|
4
4
|
<p>Are you sure you want to <strong class="warning">permanently remove</strong> the following <%= pages.downcase %>?</p>
|
5
5
|
|
6
6
|
<table id="site-map" class="index" cellpadding="0" cellspacing="0" border="0">
|
7
|
-
|
7
|
+
<tbody>
|
8
8
|
<%= render_node @page, :simple => true -%>
|
9
|
-
|
9
|
+
</tbody>
|
10
10
|
</table>
|
11
11
|
|
12
12
|
<form method="post">
|
13
|
-
|
13
|
+
<p class="buttons"><%= submit_tag "Delete #{pages}", :class => 'button' %> or <%= link_to 'Cancel', page_index_url %></p>
|
14
14
|
</form>
|
@@ -3,29 +3,29 @@
|
|
3
3
|
<p>Snippets are generally small pieces of content which are included in other pages or layouts.</p>
|
4
4
|
|
5
5
|
<table id="snippets" class="index" cellpadding="0" cellspacing="0" border="0">
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
6
|
+
<thead>
|
7
|
+
<tr>
|
8
|
+
<th class="snippet">Snippet</th>
|
9
|
+
<th class="modify">Modify</th>
|
10
|
+
</tr>
|
11
|
+
</thead>
|
12
|
+
<tbody>
|
13
13
|
<% unless @snippets.empty? -%>
|
14
14
|
<% for snippet in @snippets -%>
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
15
|
+
<tr class="node level-1">
|
16
|
+
<td class="snippet">
|
17
|
+
<%= image_tag "snippet", :class => "icon", :alt => 'snippet-icon', :title => '', :align => 'center' %>
|
18
|
+
<%= link_to snippet.name, snippet_edit_url(:id => snippet) %></span>
|
19
|
+
</td>
|
20
|
+
<td class="remove"><%= link_to image_tag('remove', :alt => 'Remove Snippet'), snippet_remove_url(:id => snippet) %></td>
|
21
|
+
</tr>
|
22
22
|
<% end -%>
|
23
23
|
<% else -%>
|
24
24
|
<tr>
|
25
25
|
<td colspan="2" class="note">No Snippets</td>
|
26
26
|
</tr>
|
27
27
|
<% end -%>
|
28
|
-
|
28
|
+
</tbody>
|
29
29
|
</table>
|
30
30
|
<script type="text/javascript">
|
31
31
|
// <![CDATA[
|