public
Description: OBSOLETE! PLEASE SEE http://github.com/radiant/radiant
Homepage: http://www.radiantcms.org/
Clone URL: git://github.com/seancribbs/radiant.git
Search Repo:
Remove shards extension.
seancribbs (author)
Fri May 16 13:14:38 -0700 2008
commit  a82bae3e910ecc6c4c6dfac88ec992b6f0cc5480
tree    c5629b34d58a0ff0a9f223e209f6271d8b78eae3
parent  da888851494754322f6a10deee443a055903d17c
...
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
...
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
0
@@ -1,29 +1 @@
0
-= Shards
0
-
0
-Created by: Sean Cribbs, September 2007
0
-
0
-The Shards extension creates insertion points called "regions" into the admin
0
-UI. Other extensions can modify these regions by adding or removing partials
0
-in order to customize the UI and provide new or modify existing functionality.
0
-
0
-Regions are accessed via the "admin" object within an extension class. If I
0
-wanted to add a partial to the top of the page editing screen, I would do
0
-so like this:
0
-
0
- # Within the context of my extension class
0
- def activate
0
- admin.page.edit.add :main, "fuzzy_bears", :before => "edit_header"
0
- end
0
-
0
-The "fuzzy_bears" partial name is relative to the Admin::PageController, so it
0
-should exist inside the app/views/admin/page directory in the extension.
0
-
0
-More details can be found on the Radiant wiki:
0
-
0
-http://wiki.radiantcms.org/UsingShardsExtension
0
-
0
-== Acknowledgments
0
-
0
-Thanks to Digital Pulp, Inc. for funding the initial development of this
0
-extension as part of the Redken.com project.
...
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
...
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
0
@@ -1,26 +1 @@
0
-require 'rake'
0
-require 'rake/testtask'
0
-require 'rake/rdoctask'
0
-
0
-desc 'Default: run unit tests.'
0
-task :default => :test
0
-
0
-desc 'Test the shards extension.'
0
-Rake::TestTask.new(:test) do |t|
0
- t.libs << 'lib'
0
- t.pattern = 'test/**/*_test.rb'
0
- t.verbose = true
0
-end
0
-
0
-desc 'Generate documentation for the shards extension.'
0
-Rake::RDocTask.new(:rdoc) do |rdoc|
0
- rdoc.rdoc_dir = 'rdoc'
0
- rdoc.title = 'ShardsExtension'
0
- rdoc.options << '--line-numbers' << '--inline-source'
0
- rdoc.rdoc_files.include('README')
0
- rdoc.rdoc_files.include('lib/**/*.rb')
0
-end
0
-
0
-# Load any custom rakefiles for extension
0
-Dir[File.dirname(__FILE__) + '/tasks/*.rake'].sort.each { |f| require f }
...
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
...
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
0
@@ -1,50 +1 @@
0
-<form method="post" action="">
0
- <%= render_region :form_top %>
0
- <%= hidden_field "snippet", "lock_version" %>
0
- <div class="form-area">
0
- <% render_region :form do |form| %>
0
- <% form.edit_title do %>
0
- <p class="title">
0
- <label for="layout_name">Name</label>
0
- <%= text_field "layout", "name", :class => 'textbox', :maxlength => 100 %>
0
- </p>
0
- <% end %>
0
- <% form.edit_extended_metadata do %>
0
- <div id="extended-metadata" class="row"<%= meta_visible(:meta) %>>
0
- <table class="fieldset" cellpadding="0" cellspacing="0" border="0">
0
- <tr>
0
- <th class="label"><label for="layout_content_type">Content&#8209;Type</label></th>
0
- <td class="field"><%= text_field "layout", "content_type", :class => 'textbox', :maxlength => 40 %></td>
0
- </tr>
0
- </table>
0
- </div>
0
- <p>
0
- <small>
0
- <a id="more-extended-metadata" href="#" onclick="<%= toggle_javascript_for('extended-metadata') %>"<%= meta_visible(:meta_more) %>>More</a>
0
- <a id="less-extended-metadata" href="#" onclick="<%= toggle_javascript_for('extended-metadata') %>"<%= meta_visible(:meta_less) %>>Less</a>
0
- </small>
0
- </p>
0
- <% end %>
0
- <% form.edit_content do %>
0
- <p class="content">
0
- <label for="layout_content">Body</label>
0
- <%= text_area "layout", "content", :class => "textarea", :style => "width: 100%" %>
0
- </p>
0
- <% end %>
0
- <% form.edit_timestamp do %>
0
- <%= updated_stamp @layout %>
0
- <% end %>
0
- <% end %>
0
- </div>
0
- <% render_region :form_bottom do |form_bottom| %>
0
- <% form_bottom.edit_buttons do %>
0
- <p class="buttons">
0
- <%= save_model_button(@layout) %>
0
- <%= save_model_and_continue_editing_button(@layout) %> or <%= link_to "Cancel", layout_index_url %>
0
- </p>
0
- <% end %>
0
- <% end %>
0
-</form>
0
-
0
-<%= focus 'layout_name' %>
...
1
2
3
4
5
6
7
8
9
...
 
 
 
 
 
 
 
 
 
0
@@ -1,10 +1 @@
0
-<% render_region :main do |main| %>
0
- <% main.edit_header do %>
0
- <% if @layout.new_record? -%>
0
- <h1>New Layout</h1>
0
- <% else -%>
0
- <h1>Edit Layout</h1>
0
- <% end %>
0
- <% end %>
0
-<% end %>
...
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
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
...
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
0
@@ -1,77 +1 @@
0
-<form method="post" action="" enctype="multipart/form-data">
0
- <%= hidden_field "page", "lock_version" %>
0
- <%= render_region :form_top %>
0
- <div class="form-area">
0
- <% render_region :form do |form| %>
0
- <% form.edit_title do %>
0
- <p class="title">
0
- <label for="page_title">Page Title</label>
0
- <%= text_field "page", "title", :class => 'textbox', :maxlength => 255 %>
0
- </p>
0
- <% end %>
0
- <% form.edit_extended_metadata do %>
0
- <div id="extended-metadata" class="row"<%= meta_visible(:meta) %>>
0
- <table class="fieldset">
0
- <% for meta in @meta %>
0
- <%= render :partial => "meta_row", :object => meta %>
0
- <% end %>
0
- <%= render_region :extended_metadata %>
0
- </table>
0
- </div>
0
- <p class="more-or-less">
0
- <small>
0
- <a href="#" onclick="<%= toggle_javascript_for('extended-metadata') %> return false"<%= meta_visible(:meta_more) %> id="more-extended-metadata">More</a>
0
- <a href="#" onclick="<%= toggle_javascript_for('extended-metadata') %> return false"<%= meta_visible(:meta_less) %> id="less-extended-metadata">Less</a>
0
- </small>
0
- </p>
0
- <% end %>
0
- <% form.edit_page_parts do %>
0
- <div id="tab-control">
0
- <div id="tabs" class="tabs">
0
- <div id="tab-toolbar">
0
- <%= link_to_function image('plus'), 'toggle_add_part_popup()', :title => 'Add Tab' %>
0
- <%= link_to_function image('minus'), 'if(confirm(\'Delete the current tab?\')) { tabControl.removeTab(tabControl.selected) }', :title => 'Remove Tab' %>
0
- </div>
0
- </div>
0
- <div id="pages" class="pages">
0
- <%= render :partial => 'part', :collection => @page.parts %>
0
- </div>
0
- </div>
0
- <% render_region :parts_bottom do |parts_bottom| %>
0
- <% parts_bottom.edit_layout_and_type do %>
0
- <div class="row">
0
- <p><label for="page_layout_id">Layout</label>
0
- <%= select "page", "layout_id", [['<inherit>', '']] + Layout.find(:all).map { |s| [s.name, s.id] } %></p>
0
- <p><label for="page_class_name">Page Type</label>
0
- <%= select "page", "class_name", [['<normal>', 'Page']] + Page.descendants.map { |p| [p.display_name, p.name] }.sort_by { |p| p.first } %></p>
0
- <p><label for="page_status_id">Status</label>
0
- <%= select "page", "status_id", Status.find_all.map { |s| [s.name, s.id] } %></p>
0
- <p id="publication-date" style="display: none;"><label for="page_published_at">Published At</label>
0
- <%= datetime_select "page", "published_at", :disabled => true %></p>
0
- <%= render_region :layout_row %>
0
- </div>
0
- <span class="clear">&nbsp;</span>
0
- <% end %>
0
- <% parts_bottom.edit_timestamp do %>
0
- <%= updated_stamp @page %>
0
- <% end %>
0
- <% end %>
0
- <% end %>
0
- <% end %>
0
- </div>
0
- <% render_region :form_bottom do |form_bottom| %>
0
- <% form_bottom.edit_buttons do %>
0
- <% @buttons_partials.each do |partial| %>
0
- <%= render :partial => partial %>
0
- <% end %>
0
- <p class="buttons">
0
- <%= save_model_button(@page) %>
0
- <%= save_model_and_continue_editing_button(@page) %>
0
- or
0
- <%= link_to "Cancel", page_index_url %>
0
- <%= render_region :buttons %>
0
- </p>
0
- <% end %>
0
- <% end %>
0
-</form>
...
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,34 +1 @@
0
-<% content_for :popups do -%>
0
- <div class="popup" id="add-part-popup" style="display: none">
0
- <div id="busy" class="busy" style="display: none"><%= image 'spinner.gif' %></div>
0
- <h3>Add Part</h3>
0
- <% form_remote_tag(
0
- :url => page_add_part_url,
0
- :update => "pages",
0
- :position => :bottom,
0
- :loading => 'part_loading()',
0
- :complete => 'part_added()',
0
- :condition => 'valid_part_name()'
0
- ) do %>
0
- <div>
0
- <%= hidden_field_tag 'index', @index, :id => 'part-index-field' %>
0
- <%= text_field_tag "part[name]", "", :id => 'part-name-field', :maxlength => 100 %>
0
- <%= submit_tag "Add Part", :id => 'add-part-button' %>
0
- </div>
0
- <p><%= link_to_function 'Close', "$(this).up('.popup').hide()", :class => 'close-link' %></p>
0
- <% end %>
0
- </div>
0
- <div class="popup" id="tag-reference-popup" style="display:none;">
0
- <div style="float:right">Search Tags: <input type="text" id="search-tag-reference" /></div>
0
- <h3>Available Tags for <span id="page-type"><%= @page.class.display_name %></span></h3>
0
- <div id="tag-reference"><%= tag_reference(@page.class.name) %></div>
0
- <p><%= link_to 'Close', '#', :class => 'close' %></p>
0
- </div>
0
- <div class="popup" id="filter-reference-popup" style="display:none;">
0
- <h3><span id="filter-type"><%= default_filter_name %></span> Reference</h3>
0
- <div id="filter-reference"><%= filter_reference(default_filter_name) %></div>
0
- <p><%= link_to_function 'Close', "Element.hide('filter-reference-popup')", :class => 'close-link' %></p>
0
- </div>
0
- <%= render_region :popups %>
0
-<% end -%>
...
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
...
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
0
@@ -1,49 +1 @@
0
-<% content_for('page_scripts') do -%>
0
- var last_type = "<%= @page.class_name %>";
0
- function load_tag_reference(part) {
0
- page_type = $F('page_class_name');
0
- popup = $('tag-reference-popup');
0
- if(last_type != page_type) {
0
- url = "<%= tag_reference_url %>";
0
- params = "class_name=" + page_type;
0
- new Effect.Highlight('tag-reference-link-'+ part);
0
- req = new Ajax.Request(url, { method: 'get', parameters: params, evalScripts: true });
0
- } else {
0
- center(popup);
0
- Element.toggle(popup);
0
- }
0
- return false;
0
- }
0
- var last_filter = "<%= default_filter_name %>";
0
- function load_filter_reference(part) {
0
- filter_type = $F("part_" + part + "_filter_id");
0
- popup = $('filter-reference-popup');
0
- if(last_filter != filter_type) {
0
- url = "<%= filter_reference_url %>";
0
- params = "filter_name=" + filter_type;
0
- new Effect.Highlight('filter-reference-link-'+ part);
0
- req = new Ajax.Request(url, { method: 'get', parameters: params, evalScripts: true });
0
- } else {
0
- center(popup);
0
- Element.toggle(popup);
0
- }
0
- return false;
0
- }
0
-<% end -%>
0
-
0
-<% content_for :page_css do %>
0
- #content #extended-metadata .fieldset {
0
- margin-left: 0;
0
- margin-right: 0;
0
- margin-bottom: .5em;
0
- padding: 0;
0
- }
0
- #content #extended-metadata .fieldset td.label {
0
- text-align: left;
0
- width: 15%;
0
- }
0
- #content #extended-metadata .fieldset td.field .textbox {
0
- width: 90%;
0
- }
0
-<% end %>
...
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
34
35
36
...
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
0
@@ -1,37 +1 @@
0
- <tr id="page-<%= page.id %>" class="node level-<%= level %><%= children_class %><%= virtual_class %>">
0
- <% render_region :node, :locals => {:page => page, :level => level, :simple => simple} do |node| %>
0
- <% node.title_column do %>
0
- <td class="page" style="padding-left: <%= padding_left(level) %>px">
0
- <span class="w1">
0
- <% if simple -%>
0
- <%= icon %>
0
- <%= node_title %>
0
- <% else -%>
0
- <%= expander %><a href="<%= page_edit_url(:id => page) %>" title="<%= page.url %>"><%= icon %> <%= node_title %></a>
0
- <%= page_type %>
0
- <%= spinner %>
0
- <% end -%>
0
- </span>
0
- </td>
0
- <% end %>
0
- <% node.status_column do %>
0
- <% unless simple -%><td class="status <%= page.status.name.downcase %>-status"><%= page.status.name %></td><% end %>
0
- <% end %>
0
- <% node.add_child_column do %>
0
- <% unless simple -%><td class="add-child"><%= link_to image('add-child', :alt => 'add child'), page_new_url(:parent_id => page) %></td><% end %>
0
- <% end %>
0
- <% node.remove_column do %>
0
- <% unless simple -%><td class="remove"><%= link_to image('remove', :alt => 'remove page'), page_remove_url(:id => page) %></td><% end %>
0
- <% end %>
0
- <% end %>
0
- </tr>
0
-<%
0
-if expanded
0
- page.children.each do |child|
0
--%>
0
-<%= render_node child, :level => level + 1, :simple => simple -%>
0
-<%
0
- end
0
-end
0
--%>
...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
...
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
0
@@ -1,16 +1 @@
0
-<% @index ||= 0 -%>
0
-<div class="page" id="page-<%= @index + 1 %>">
0
- <div class="part" id="part-<%= @index + 1 %>">
0
- <%= hidden_field_tag "part[#{@index}][name]", part.name, :id => "part_#{@index}_name" %>
0
- <p>
0
- <label for="part_<%= @index %>_filter_id">Filter</label>
0
- <%= select_tag "part[#{@index}][filter_id]", options_for_select([['<none>', '']] + TextFilter.descendants.map { |s| s.filter_name }.sort, part.filter_id), :id => "part_#{@index}_filter_id" %>
0
- <span id="reference-links">Reference: <span id="filter-reference-link-<%= @index %>"><%= link_to_function "Filter", "load_filter_reference(#{@index})" %></span>
0
- <span id="tag-reference-link-<%= @index %>"><%= link_to_function 'Available Tags', "load_tag_reference(#{@index});" %></span></span>
0
- <%= render_region :part_controls, :locals => {:part => part} %>
0
- </p>
0
- <div><%= text_area_tag "part[#{@index}][content]", h(part.content), :class => "textarea", :style => "width: 100%", :id => "part_#{@index}_content" %></div>
0
- </div>
0
-</div>
0
-<% @index += 1 -%>
...
1
2
3
4
5
6
7
8
9
10
...
 
 
 
 
 
 
 
 
 
 
0
@@ -1,11 +1 @@
0
-<% render_region :main do |main| %>
0
- <% main.edit_header do %>
0
- <% if @page.new_record? -%>
0
- <h1 id="new_page">New Page</h1>
0
- <% else -%>
0
- <h1 id="edit_page">Edit Page</h1>
0
- <% end -%>
0
- <% end %>
0
-<% end %>
0
-<%= render :partial => "edit_scripts_and_styles" %>
...
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
34
35
...
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
0
@@ -1,36 +1 @@
0
-<% include_javascript 'admin/sitemap' -%>
0
-<h1>Pages</h1>
0
-<%= render_region :top %>
0
-<table id="site-map" class="index" summary="Page hierarchy of the current site">
0
- <thead>
0
- <tr>
0
- <% render_region :sitemap_head do |sitemap_head| %>
0
- <% sitemap_head.title_column_header do %>
0
- <th class="page">Page</th>
0
- <% end %>
0
- <% sitemap_head.status_column_header do %>
0
- <th class="status">Status</th>
0
- <% end %>
0
- <% sitemap_head.modify_column_header do %>
0
- <th class="modify" colspan="2">Modify</th>
0
- <% end %>
0
- <% end %>
0
- </tr>
0
- </thead>
0
- <tbody>
0
-<% if @homepage -%>
0
-<%= render_node @homepage -%>
0
-<% else -%>
0
- <tr>
0
- <td colspan="4" class="note">No Pages</td>
0
- </tr>
0
-<% end -%>
0
- </tbody>
0
-</table>
0
-<%= render_region :bottom %>
0
-<% unless @homepage -%>
0
-<p>
0
- <%= link_to image('new-homepage', :alt => 'New Homepage'), homepage_new_url %>
0
-</p>
0
-<% end -%>
...
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
34
35
36
37
38
39
...
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
0
@@ -1,40 +1 @@
0
-<form method="post" action="">
0
- <%= render_region :form_top %>
0
- <%= hidden_field "snippet", "lock_version" %>
0
- <div class="form-area">
0
- <% render_region :form do |form| %>
0
- <% form.edit_title do %>
0
- <p class="title">
0
- <label for="snippet_name">Name</label>
0
- <%= text_field "snippet", "name", :class => 'textbox', :maxlength => 100 %>
0
- </p>
0
- <% end %>
0
- <% form.edit_content do %>
0
- <p class="content">
0
- <label for="snippet_content">Body</label>
0
- <%= text_area "snippet", "content", :class => "textarea", :style => "width: 100%" %></p>
0
- <% end %>
0
- <% form.edit_filter do %>
0
- <p>
0
- <label for="snippet_filter">Filter</label>
0
- <%= select_tag "snippet[filter_id]", options_for_select([['none', '']] +
0
- TextFilter.descendants.map { |f| f.filter_name }.sort, @snippet.filter_id), :id => 'snippet_filter' %>
0
- </p>
0
- <% end %>
0
- <% form.edit_timestamp do %>
0
- <%= updated_stamp @snippet %>
0
- <% end %>
0
- <% end %>
0
- </div>
0
- <% render_region :form_bottom do |form_bottom| %>
0
- <% form_bottom.edit_buttons do %>
0
- <p class="buttons">
0
- <%= save_model_button(@snippet) %>
0
- <%= save_model_and_continue_editing_button(@snippet) %> or <%= link_to "Cancel", snippet_index_url %>
0
- </p>
0
- <% end %>
0
- <% end %>
0
-</form>
0
-
0
-<%= focus 'snippet_name' %>
...
1
2
3
4
5
6
7
8
9
...
 
 
 
 
 
 
 
 
 
0
@@ -1,10 +1 @@
0
-<% render_region :main do |main| %>
0
- <% main.edit_header do %>
0
- <% if @snippet.new_record? -%>
0
- <h1>New Snippet</h1>
0
- <% else -%>
0
- <h1>Edit Snippet</h1>
0
- <% end %>
0
- <% end %>
0
-<% end %>
...
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
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
...
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
0
@@ -1,76 +1 @@
0
-<form method="post" action="">
0
- <%= render_region :form_top %>
0
- <%= hidden_field "user", "lock_version" %>
0
- <% render_region :form do |form| %>
0
- <% form.edit_table_header do %>
0
- <table class="fieldset" cellpadding="0" cellspacing="0" border="0">
0
- <% end %>
0
- <% form.edit_name do %>
0
- <tr>
0
- <th class="label"><label for="user_name">Name</label></th>
0
- <td class="field"><%= text_field "user", "name", :class => 'textbox', :maxlength => 100 %></td>
0
- <td class="help">Required.</td>
0
- </tr>
0
- <% end %>
0
- <% form.edit_email do %>
0
- <tr>
0
- <th class="label"><label class="optional" for="user_email">E-mail</label></th>
0
- <td class="field"><%= text_field "user", "email", :class => 'textbox', :maxlength => 255 %></td>
0
- <td class="help">Optional. Please use a valid e-mail address.</td>
0
- </tr>
0
- <% end %>
0
- <% form.edit_login do %>
0
- <tr>
0
- <th class="label"><label for="user_login">Username</label></th>
0
- <td class="field"><%= text_field "user", "login", :class => 'textbox', :maxlength => 40 %></td>
0
- <td class="help">At least 3 characters. Must be unique.</td>
0
- </tr>
0
- <% end %>
0
- <% form.edit_password do %>
0
- <tr>
0
- <th class="label"><label for="user_password">Password</label></th>
0
- <td class="field"><%= password_field "user", "password", :class => 'textbox', :value => '', :maxlength => 40 %></td>
0
- <td class="help" rowspan="2">At least 5 characters. <% unless @user.new_record? %>Leave password blank for it to remain unchanged.<% end %></td>
0
- </tr>
0
- <% end %>
0
- <% form.edit_password_confirmation do %>
0
- <tr>
0
- <th class="label"><label for="user_password_confirmation">Confirm&nbsp;Password</label></th>
0
- <td class="field"><%= password_field "user", "password_confirmation", :class => 'textbox', :value => '', :maxlength => 40 %></td>
0
- </tr>
0
- <% end %>
0
- <% form.edit_roles do %>
0
- <tr>
0
- <th class="label"><label for="user_admin">Roles</label></th>
0
- <td class="field">
0
- <span class="checkbox"><%= check_box "user", "admin" %>&nbsp;<label for="user_admin">Administrator</label></span>
0
- <span class="checkbox"><%= check_box "user", "developer" %>&nbsp;<label for="user_developer">Developer</label></span>
0
- </td>
0
- <td class="help">Roles restrict user privileges and turn parts of the administrative interface on or off.</td>
0
- </tr>
0
- <% end %>
0
- <% form.edit_notes do %>
0
- <tr>
0
- <th class="label"><label class="optional" for="user_notes">Notes</label></th>
0
- <td class="field"><%= text_area "user", "notes", :size => '40x4' %></td>
0
- <td class="help">Optional.</td>
0
- </tr>
0
- <% end %>
0
- <% form.edit_table_footer do %>
0
- </table>
0
- <% end %>
0
- <% form.edit_timestamp do %>
0
- <%= updated_stamp @user %>
0
- <% end %>
0
- <% end %>
0
- <% render_region :form_bottom do |form_bottom| %>
0
- <% form_bottom.edit_buttons do %>
0
- <p class="buttons">
0
- <%= save_model_button(@user) %> <%= save_model_and_continue_editing_button(@user) %> or <%= link_to "Cancel", user_index_url %>
0
- </p>
0
- <% end %>
0
- <% end %>
0
-</form>
0
-
0
-<%= focus 'user_name' %>
...
1
2
3
4
5
6
7
8
9
...
 
 
 
 
 
 
 
 
 
0
@@ -1,10 +1 @@
0
-<% render_region :main do |main| %>
0
- <% main.edit_header do %>
0
- <% if @user.new_record? -%>
0
- <h1>New User</h1>
0
- <% else -%>
0
- <h1>Edit User</h1>
0
- <% end %>
0
- <% end %>
0
-<% end %>
...
1
2
...
 
 
0
@@ -1,3 +1 @@
0
-module Shards
0
-end
...
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
...
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
0
@@ -1,29 +1 @@
0
-module Shards::HelperExtensions
0
- def render_region(region, options={}, &block)
0
- lazy_initialize_region_set
0
- default_partials = Shards::RegionPartials.new(@template)
0
- if block_given?
0
- junk = capture(default_partials, &block)
0
- (options[:locals] ||= {}).merge!(:defaults => default_partials)
0
- end
0
- output = @region_set[region].compact.map do |partial|
0
- begin
0
- render options.merge(:partial => partial)
0
- rescue ::ActionView::TemplateError => e # error in template
0
- raise e
0
- rescue ::ActionView::ActionViewError # couldn't find template
0
- default_partials[partial]
0
- end
0
- end.join
0
- block_given? ? concat(output, block.binding) : output
0
- end
0
-
0
- def lazy_initialize_region_set
0
- unless @region_set
0
- @controller_name ||= @controller.controller_name
0
- @template_name ||= File.basename(@first_render).split(".").last
0
- @region_set = admin.send(@controller_name).send(@template_name)
0
- end
0
- end
0
-end
...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
...
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
0
@@ -1,19 +1 @@
0
-class Shards::RegionPartials
0
- def initialize(template)
0
- @partials = Hash.new {|h,k| h[k] = "<strong>`#{k}' default partial not found!</strong>" }
0
- @template = template
0
- end
0
-
0
- def [](key)
0
- @partials[key.to_s]
0
- end
0
-
0
- def method_missing(method, *args, &block)
0
- if block_given?
0
- @partials[method.to_s] = @template.capture(&block)
0
- else
0
- @partials[method.to_s]
0
- end
0
- end
0
-end
...
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
34
35
...
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
0
@@ -1,36 +1 @@
0
-class Shards::RegionSet
0
-
0
- def initialize
0
- @regions = Hash.new do |h,k|
0
- h[k] = []
0
- end
0
- yield self if block_given?
0
- end
0
-
0
- def [](region)
0
- @regions[region.to_sym]
0
- end
0
-
0
- def add(region=nil, partial=nil, options={})
0
- raise ArgumentError, "You must specify a region and a partial" unless region and partial
0
- if options[:before]
0
- index = @regions[region].empty? ? 0 : (@regions[region].index(options[:before]) || @regions[region].size)
0
- self[region].insert(index, partial)
0
- elsif options[:after]
0
- index = @regions[region].empty? ? 0 : (@regions[region].index(options[:after]) || @regions[region].size - 1)