Commit 5ed537dc0161c2a0fa8c1cb65bccddcbf781ffa5
1 parent
057b9a32
Exists in
master
and in
29 other branches
ActionItem18: moving comatose_admin funcionalities inside new cms controller
git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@394 3f533792-8f58-4932-b0fe-aaf55b0a4547
Showing
23 changed files
with
693 additions
and
669 deletions
Show diff stats
| ... | ... | @@ -0,0 +1,86 @@ |
| 1 | +<%= error_messages_for :page %> | |
| 2 | + | |
| 3 | +<% form_for :page, @page do |f| %> | |
| 4 | + | |
| 5 | + <div class='comatose_field'> | |
| 6 | + <label for="page_title"><%= _("Title") %></label> | |
| 7 | + <%= f.text_field :title, :tabindex => 1, :maxlength => 255, :size => 30 %> <%= link_to_function "More...", "ComatoseEditForm.toggle_extra_fields(this, '%s', '%s')" % [_('More...'), _('Less...')], :id => 'more-options' %> | |
| 8 | + </div> | |
| 9 | + | |
| 10 | + <div class='comatose_field' id='slug_row'> | |
| 11 | + <label for="page_slug"><%= _('Slug') %></label> | |
| 12 | + <%= f.text_field :slug, :tabindex=>6, :maxlength=>255, :size=>50, :disabled=>@root_pages.include?(@page) %> | |
| 13 | + </div> | |
| 14 | + | |
| 15 | + <div class='comatose_field' id='keywords_row'> | |
| 16 | + <% if show_field? 'keywords' %> | |
| 17 | + <label for="page_keywords"><%= _('Keywords') %></label> | |
| 18 | + <%= f.text_field :keywords, :tabindex=>7, :maxlength=>1000, :size=>50 %> | |
| 19 | + <% end %> | |
| 20 | + </div> | |
| 21 | + | |
| 22 | + <div class='comatose_field' id='parent_row'> | |
| 23 | + <% if show_field? 'parent' %> | |
| 24 | + <label for="page_parent"><%= _('Parent') %></label> | |
| 25 | + <% if mode != :new and @root_pages.include? @page %> | |
| 26 | + <select id="page_parent" disabled="true"><option><%= _('%s is a root page') % @page.title %></option></select> | |
| 27 | + <% else %> | |
| 28 | + <select id="page_parent" name="page[parent_id]" tabindex="8"><%= tree_select_box @root_pages, @page.parent_id, @page.id %></select> | |
| 29 | + <% end %> | |
| 30 | + <% end %> | |
| 31 | + </div> | |
| 32 | + | |
| 33 | + <div class='comatose_field'> | |
| 34 | + <label for="page_body"><%= _('Content') %></label> | |
| 35 | + <%= f.text_area :body, :rows => 14, :tabindex => 2 %> | |
| 36 | + </div> | |
| 37 | + | |
| 38 | + <div class='comatose_field' id='filter_row'> | |
| 39 | + <% if show_field? 'filter' %> | |
| 40 | + <label for="page_filter_type"><%= _("Filter") %></label> | |
| 41 | + <%= select_tag 'page[filter_type]', options_for_select(TextFilters.all_titles.sort, @page.filter_type || Comatose.config.default_filter), :tabindex=>3, :id=>'page_filter_type' %> | |
| 42 | + <span class="field-help"><%= _('Converts plain text into HTML') %></span> | |
| 43 | + <% end %> | |
| 44 | + </div> | |
| 45 | + | |
| 46 | + <div class='comatose_field' id='created_row'> | |
| 47 | + <% if show_field? 'created_on' %> | |
| 48 | + <label for="page_created_on"><%= _('Created') %></label> | |
| 49 | + <%= f.datetime_select :created_on %> | |
| 50 | + <% end %> | |
| 51 | + </div> | |
| 52 | + | |
| 53 | +<div id="button-group"> | |
| 54 | +<% unless @page.updated_on.nil? %> | |
| 55 | + <div class="last-update"> | |
| 56 | + <label> | |
| 57 | + <%= link_to(n_("One revision", "%d revisions", @page.versions.length) % @page.versions.length, :action=>'versions', :id=>@page) if @page.versions.length > 0 %> | |
| 58 | + </label> | |
| 59 | + </div> | |
| 60 | +<% end %> | |
| 61 | + | |
| 62 | +<%= image_tag 'comatose/spinner.gif', :id=>'spinner', :align=>'absmiddle', :style=>'display:none;' %> | |
| 63 | + <%= button_to_function('Preview', "ComatoseEditForm.preview_content('#{url_for :controller=>controller.controller_name, :action=>'preview', :id=>@page}', '%s')" % _('Loading preview ...'), :tabindex=>3, :id=>'preview-btn' ) if show_field? 'preview' %> | |
| 64 | + <%= submit_tag ((mode == :edit) ? _('Save Changes') : _('Create Page')), :tabindex=>4 %> | |
| 65 | + <% if @page.versions.length > 0 %> | |
| 66 | + <%= link_to _("Revert"), :action=>'versions', :id=>@page %> | |
| 67 | + <% end %> | |
| 68 | + or | |
| 69 | + <a href="<%= url_for :controller=>controller.controller_name, :action=>'index' %>" onlick="ComatoseEditForm.cancel(this.href, '<%= _('Changes detected. You will lose all the updates you have made if you proceed...') %>'); return false;" tabindex="5"><%= _("Cancel") %></a> | |
| 70 | +</div> | |
| 71 | +<% end %> | |
| 72 | + | |
| 73 | +<div id="preview-area" style='display: none;'> | |
| 74 | + <fieldset> | |
| 75 | + <legend><%= _('Page Preview') %></legend> | |
| 76 | + <div class="preview-body"> | |
| 77 | + <div id="preview-panel"><span style='color:blue;'><%= _('Loading Preview...') %></span></div> | |
| 78 | + <div style="clear:both"></div> | |
| 79 | + </div> | |
| 80 | + </fieldset> | |
| 81 | + <div class="commands"> | |
| 82 | + <a href="#" onclick="$('preview-area').hide();"><%= _("Close Preview") %></a><% _("or") %><a href="#"><%= _('Back to top') %></a> | |
| 83 | + </div> | |
| 84 | +</div> | |
| 85 | + | |
| 86 | +<%= javascript_tag "ComatoseEditForm.init('#{mode.to_s}');" %> | ... | ... |
| ... | ... | @@ -0,0 +1,57 @@ |
| 1 | +<%# Params: | |
| 2 | +# - page (Page Node) | |
| 3 | +# - level (integer indicating current tree depth) | |
| 4 | +# Called From: | |
| 5 | +# - index | |
| 6 | +# Description: | |
| 7 | +# This partial is used recursively. Render it with the root node, and it will recurse | |
| 8 | +# down all of the child nodes to build a list with proper indentation to indicate | |
| 9 | +# tree depth. | |
| 10 | +%> | |
| 11 | + | |
| 12 | +<% | |
| 13 | +# Create the page-level links... | |
| 14 | +links = [] | |
| 15 | +links << link_to(pluralize(page.versions.length, 'revision', 'revisions'), :action=>'versions', :id=>page) if page.versions.length > 0 | |
| 16 | +links << link_to('add child page', {:action=>'new', :parent=>page}, :title=> _("Add a child to '%s'") % page.title, :class=>'add-page') | |
| 17 | +links << link_to_function('reorder children', "ComatoseList.toggle_reorder('page_list_#{page.id}',this,#{page.id}, '%s', '%s')" % [_('reorder children'), _('finished reordering')], :title=> _("Reorder children of '%s'") % page.title, :class=>'reorder-children', :href=>url_for(:action=>'reorder', :id=>page)) if !page.children.empty? and page.children.length > 1 | |
| 18 | +links << link_to('delete', {:action=>'delete', :id=>page}, :confirm=> _('This will delete this page, and any children. Are you sure?'), :title=> _("Delete page '%s' and all it's children") % page.title, :class=>'delete-page', :method=>'post', :onmouseover=>"ComatoseList.item_hover('page_#{page.id}', 'over', true)", :onmouseout=>"ComatoseList.item_hover('page_#{page.id}', 'out', true)") unless @root_pages.include? page | |
| 19 | +# Level check, one, two, three... | |
| 20 | +collapse_children = (level >= Comatose.config.default_tree_level) | |
| 21 | +%> | |
| 22 | + | |
| 23 | +<li id="page_<%= page.id %>"> | |
| 24 | + <table cellpadding="0" cellspacing="0"> | |
| 25 | + <tr> | |
| 26 | + <td valign="center"> | |
| 27 | + <% if !page.children.empty? %> | |
| 28 | + <%= image_tag( ((collapse_children) ? 'comatose/collapsed.gif' : 'comatose/expanded.gif'), :title=>'Expand/Collapse', :onclick=>"ComatoseList.toggle_tree_nodes(this,#{page.id});", :class=>'tree-controller', :size=>'12x12', :id=>"page_controller_#{page.id}" ) %> | |
| 29 | + <% else %> | |
| 30 | + <%= image_tag 'comatose/no-children.gif', :size=>'12x12', :class=>'tree-controller' %> | |
| 31 | + <% end %> | |
| 32 | + </td> | |
| 33 | + <td valign="center"> | |
| 34 | + <%= icon_for_document(page) %> | |
| 35 | + <span class="handle"><%= _('DRAG') %></span> | |
| 36 | + </td> | |
| 37 | + <td> | |
| 38 | + <%= link_to page.title, {:action=>'edit', :id=>page}, :title=>"Path:#{page.full_path}", :class=>'page' %> | |
| 39 | + </td> | |
| 40 | + <td class="commands"> | |
| 41 | + <%= links.join(', ') %>. | |
| 42 | + </td> | |
| 43 | + </tr> | |
| 44 | + </table> | |
| 45 | + | |
| 46 | + <ul id="page_list_<%= page.id %>" old="lvl-<%= page.id %>" class="page-list <%= 'collapsed' if collapse_children %>" > | |
| 47 | + <% for child in page.children %> | |
| 48 | + <%= render :partial=>'page_list_item', :locals=>{ :page=>child, :level=>level+1 } %> | |
| 49 | + <% end %> | |
| 50 | + </ul> | |
| 51 | + | |
| 52 | + <%= sortable_element( "page_list_#{page.id}", | |
| 53 | + :complete => visual_effect(:highlight, "page_list_#{page.id}"), | |
| 54 | + :handle=>'handle', | |
| 55 | + :update=>'flash-content', | |
| 56 | + :url => { :action => "reorder", :id=>page } ) if !page.children.empty? and page.children.length > 1 %> | |
| 57 | +</li> | ... | ... |
| ... | ... | @@ -0,0 +1,18 @@ |
| 1 | +<h1> | |
| 2 | + Page Delete Confirmation | |
| 3 | +</h1> | |
| 4 | + | |
| 5 | +<blockquote> | |
| 6 | + <p><%= _('Are you sure you want to delete the page titled "%s"?') % content_tag('strong', @page.title) %> </p> | |
| 7 | + <% unless @page.children.empty? %> | |
| 8 | + <p><%= _("It has %s child pages that will also be deleted...") % content_tag('strong', @page.children.length) %></p> | |
| 9 | +<% end %> | |
| 10 | +</blockquote> | |
| 11 | + | |
| 12 | +<%= start_form_tag %> | |
| 13 | +<div id="button-group"> | |
| 14 | + <%= submit_tag _("Yes, Delete The Page") %> | |
| 15 | + or | |
| 16 | + <%= link_to _("Cancel"), :action=>'index' %> | |
| 17 | +</div> | |
| 18 | +<%= end_form_tag %> | ... | ... |
| ... | ... | @@ -0,0 +1,18 @@ |
| 1 | +<div class="action"> | |
| 2 | + <%= link_to 'Clear Page Cache', :controller=>controller.controller_name, :action=>'expire_page_cache' %> | |
| 3 | +</div> | |
| 4 | + | |
| 5 | +<h1> | |
| 6 | + <%= _('Document List') %> | |
| 7 | + <%= image_tag 'comatose/spinner.gif', :id=>'spinner', :align=>'absmiddle', :style=>'display:none;' %> | |
| 8 | +</h1> | |
| 9 | + | |
| 10 | +<ul class="page-list root"> | |
| 11 | +<% @root_pages.each do |page| %> | |
| 12 | + <%= render :partial=>'page_list_item', :locals=>{ :page=>page, :level=>1 } %> | |
| 13 | +<% end %> | |
| 14 | +</ul> | |
| 15 | + | |
| 16 | +<div id="status"></div> | |
| 17 | + | |
| 18 | +<%= javascript_tag "ComatoseList.init()" %> | ... | ... |
| ... | ... | @@ -0,0 +1,30 @@ |
| 1 | +<h1><%= _('Reorder Pages') %></h1> | |
| 2 | + | |
| 3 | +<h3><%= _('"%s" child pages:') % @page.title %></h3> | |
| 4 | + | |
| 5 | +<ul class="page-list"> | |
| 6 | +<% @page.children.each do |page| %> | |
| 7 | + <li> | |
| 8 | + <table cellpadding="0" cellspacing="0"> | |
| 9 | + <tr> | |
| 10 | + <td rowspan="2" valign="center"> | |
| 11 | + <%= image_tag 'comatose/page.gif', :size=>'25x31', :align=>"absmiddle" %> | |
| 12 | + </td> | |
| 13 | + <td> | |
| 14 | + <a class="page"><%= page.title %></a> | |
| 15 | + </td> | |
| 16 | + </tr> | |
| 17 | + <tr> | |
| 18 | + <td class="commands"> | |
| 19 | + <%= link_to _("Move Up"), :action=>'reorder', :cmd=>'up', :page=>page.id %>, | |
| 20 | + <%= link_to _("Move Down"), :action=>'reorder', :cmd=>'down', :page=>page.id %> | |
| 21 | + </td> | |
| 22 | + </tr> | |
| 23 | + </table> | |
| 24 | + </li> | |
| 25 | +<% end %> | |
| 26 | +</ul> | |
| 27 | + | |
| 28 | +<div id="button-group"> | |
| 29 | + <%= link_to _("Finished"), :action=>'index' %> | |
| 30 | +</div> | ... | ... |
| ... | ... | @@ -0,0 +1,44 @@ |
| 1 | +<h1><%= _('Page Revisions') %></h1> | |
| 2 | +<form> | |
| 3 | +<div class="revisions older-content"> | |
| 4 | + <div class="header"> | |
| 5 | + <div class="header-actions"> | |
| 6 | + <% form_tag :action => 'versions', :id => @page, :html => { :method => :get } do %> | |
| 7 | + <%= _('View Version:') %><%= select_tag "version", options_from_collection_for_select(@page.versions, 'version', 'version', @version_num), {'onchange'=>'this.form.submit();'} %> | |
| 8 | + <%= submit_tag 'Go', {'id'=>'go-btn'} %> | |
| 9 | + <% end %> | |
| 10 | + </div> | |
| 11 | + <%= _('Version %s') % @version_num %> | |
| 12 | + </div> | |
| 13 | + <div class="meta"> | |
| 14 | + <label class="title"><span><%= _('Title:') %></span><%= @version.title %></label> | |
| 15 | + <label><span><%= _('Slug:') %></span> <%= @version.slug %></label> | |
| 16 | + <% if show_field? 'keywords' %> | |
| 17 | + <label><span><%= _("Keywords:") %></span> <%= @version.keywords %></label> | |
| 18 | + <% end %> | |
| 19 | + </div> | |
| 20 | + <%= @version.body.split("\n").join('<br/>') unless @version.body.nil? %> | |
| 21 | + <div id="button-group" class="footer"> | |
| 22 | + <% form_tag :action=>'set_version', :id => @page, :version => @version_num do %> | |
| 23 | + <%= submit_tag _("Set As Current Version") %> | |
| 24 | + <%= _('or') %> | |
| 25 | + <%= link_to _("Cancel"), :action=>'index' %> | |
| 26 | + <% end %> | |
| 27 | + </div> | |
| 28 | +</div> | |
| 29 | + | |
| 30 | +<div class="revisions current-content"> | |
| 31 | + <div class="header"> | |
| 32 | + <% _('Current Version') %> | |
| 33 | + </div> | |
| 34 | + <div class="meta"> | |
| 35 | + <label class="title"><span><%= _('Title:') %></span><%= @page.title %></label> | |
| 36 | + <label><span><%= _('Slug:') %></span> <%= @page.slug %></label> | |
| 37 | + <% if show_field? 'keywords' %> | |
| 38 | + <label><span><%= _('Keywords:') %></span> <%= @page.keywords %></label> | |
| 39 | + <% end %> | |
| 40 | + </div> | |
| 41 | + <%= @page.body.split("\n").join('<br/>') unless @page.body.nil? %> | |
| 42 | +</div> | |
| 43 | + | |
| 44 | +<div style="clear:both"> </div> | ... | ... |
app/views/comatose_admin/_form.rhtml
| ... | ... | @@ -1,86 +0,0 @@ |
| 1 | -<%= error_messages_for :page %> | |
| 2 | - | |
| 3 | -<% form_for :page, @page do |f| %> | |
| 4 | - | |
| 5 | - <div class='comatose_field'> | |
| 6 | - <label for="page_title"><%= _("Title") %></label> | |
| 7 | - <%= f.text_field :title, :tabindex => 1, :maxlength => 255, :size => 30 %> <%= link_to_function "More...", "ComatoseEditForm.toggle_extra_fields(this, '%s', '%s')" % [_('More...'), _('Less...')], :id => 'more-options' %> | |
| 8 | - </div> | |
| 9 | - | |
| 10 | - <div class='comatose_field' id='slug_row'> | |
| 11 | - <label for="page_slug"><%= _('Slug') %></label> | |
| 12 | - <%= f.text_field :slug, :tabindex=>6, :maxlength=>255, :size=>50, :disabled=>@root_pages.include?(@page) %> | |
| 13 | - </div> | |
| 14 | - | |
| 15 | - <div class='comatose_field' id='keywords_row'> | |
| 16 | - <% if show_field? 'keywords' %> | |
| 17 | - <label for="page_keywords"><%= _('Keywords') %></label> | |
| 18 | - <%= f.text_field :keywords, :tabindex=>7, :maxlength=>1000, :size=>50 %> | |
| 19 | - <% end %> | |
| 20 | - </div> | |
| 21 | - | |
| 22 | - <div class='comatose_field' id='parent_row'> | |
| 23 | - <% if show_field? 'parent' %> | |
| 24 | - <label for="page_parent"><%= _('Parent') %></label> | |
| 25 | - <% if mode != :new and @root_pages.include? @page %> | |
| 26 | - <select id="page_parent" disabled="true"><option><%= _('%s is a root page') % @page.title %></option></select> | |
| 27 | - <% else %> | |
| 28 | - <select id="page_parent" name="page[parent_id]" tabindex="8"><%= tree_select_box @root_pages, @page.parent_id, @page.id %></select> | |
| 29 | - <% end %> | |
| 30 | - <% end %> | |
| 31 | - </div> | |
| 32 | - | |
| 33 | - <div class='comatose_field'> | |
| 34 | - <label for="page_body"><%= _('Content') %></label> | |
| 35 | - <%= f.text_area :body, :rows => 14, :tabindex => 2 %> | |
| 36 | - </div> | |
| 37 | - | |
| 38 | - <div class='comatose_field' id='filter_row'> | |
| 39 | - <% if show_field? 'filter' %> | |
| 40 | - <label for="page_filter_type"><%= _("Filter") %></label> | |
| 41 | - <%= select_tag 'page[filter_type]', options_for_select(TextFilters.all_titles.sort, @page.filter_type || Comatose.config.default_filter), :tabindex=>3, :id=>'page_filter_type' %> | |
| 42 | - <span class="field-help"><%= _('Converts plain text into HTML') %></span> | |
| 43 | - <% end %> | |
| 44 | - </div> | |
| 45 | - | |
| 46 | - <div class='comatose_field' id='created_row'> | |
| 47 | - <% if show_field? 'created_on' %> | |
| 48 | - <label for="page_created_on"><%= _('Created') %></label> | |
| 49 | - <%= f.datetime_select :created_on %> | |
| 50 | - <% end %> | |
| 51 | - </div> | |
| 52 | - | |
| 53 | -<div id="button-group"> | |
| 54 | -<% unless @page.updated_on.nil? %> | |
| 55 | - <div class="last-update"> | |
| 56 | - <label> | |
| 57 | - <%= link_to(n_("One revision", "%d revisions", @page.versions.length) % @page.versions.length, :action=>'versions', :id=>@page) if @page.versions.length > 0 %> | |
| 58 | - </label> | |
| 59 | - </div> | |
| 60 | -<% end %> | |
| 61 | - | |
| 62 | -<%= image_tag 'comatose/spinner.gif', :id=>'spinner', :align=>'absmiddle', :style=>'display:none;' %> | |
| 63 | - <%= button_to_function('Preview', "ComatoseEditForm.preview_content('#{url_for :controller=>controller.controller_name, :action=>'preview', :id=>@page}', '%s')" % _('Loading preview ...'), :tabindex=>3, :id=>'preview-btn' ) if show_field? 'preview' %> | |
| 64 | - <%= submit_tag ((mode == :edit) ? _('Save Changes') : _('Create Page')), :tabindex=>4 %> | |
| 65 | - <% if @page.versions.length > 0 %> | |
| 66 | - <%= link_to _("Revert"), :action=>'versions', :id=>@page %> | |
| 67 | - <% end %> | |
| 68 | - or | |
| 69 | - <a href="<%= url_for :controller=>controller.controller_name, :action=>'index' %>" onlick="ComatoseEditForm.cancel(this.href, '<%= _('Changes detected. You will lose all the updates you have made if you proceed...') %>'); return false;" tabindex="5"><%= _("Cancel") %></a> | |
| 70 | -</div> | |
| 71 | -<% end %> | |
| 72 | - | |
| 73 | -<div id="preview-area" style='display: none;'> | |
| 74 | - <fieldset> | |
| 75 | - <legend><%= _('Page Preview') %></legend> | |
| 76 | - <div class="preview-body"> | |
| 77 | - <div id="preview-panel"><span style='color:blue;'><%= _('Loading Preview...') %></span></div> | |
| 78 | - <div style="clear:both"></div> | |
| 79 | - </div> | |
| 80 | - </fieldset> | |
| 81 | - <div class="commands"> | |
| 82 | - <a href="#" onclick="$('preview-area').hide();"><%= _("Close Preview") %></a><% _("or") %><a href="#"><%= _('Back to top') %></a> | |
| 83 | - </div> | |
| 84 | -</div> | |
| 85 | - | |
| 86 | -<%= javascript_tag "ComatoseEditForm.init('#{mode.to_s}');" %> |
app/views/comatose_admin/_page_list_item.rhtml
| ... | ... | @@ -1,57 +0,0 @@ |
| 1 | -<%# Params: | |
| 2 | -# - page (Page Node) | |
| 3 | -# - level (integer indicating current tree depth) | |
| 4 | -# Called From: | |
| 5 | -# - index | |
| 6 | -# Description: | |
| 7 | -# This partial is used recursively. Render it with the root node, and it will recurse | |
| 8 | -# down all of the child nodes to build a list with proper indentation to indicate | |
| 9 | -# tree depth. | |
| 10 | -%> | |
| 11 | - | |
| 12 | -<% | |
| 13 | -# Create the page-level links... | |
| 14 | -links = [] | |
| 15 | -links << link_to(pluralize(page.versions.length, 'revision', 'revisions'), :action=>'versions', :id=>page) if page.versions.length > 0 | |
| 16 | -links << link_to('add child page', {:action=>'new', :parent=>page}, :title=> _("Add a child to '%s'") % page.title, :class=>'add-page') | |
| 17 | -links << link_to_function('reorder children', "ComatoseList.toggle_reorder('page_list_#{page.id}',this,#{page.id}, '%s', '%s')" % [_('reorder children'), _('finished reordering')], :title=> _("Reorder children of '%s'") % page.title, :class=>'reorder-children', :href=>url_for(:action=>'reorder', :id=>page)) if !page.children.empty? and page.children.length > 1 | |
| 18 | -links << link_to('delete', {:action=>'delete', :id=>page}, :confirm=> _('This will delete this page, and any children. Are you sure?'), :title=> _("Delete page '%s' and all it's children") % page.title, :class=>'delete-page', :method=>'post', :onmouseover=>"ComatoseList.item_hover('page_#{page.id}', 'over', true)", :onmouseout=>"ComatoseList.item_hover('page_#{page.id}', 'out', true)") unless @root_pages.include? page | |
| 19 | -# Level check, one, two, three... | |
| 20 | -collapse_children = (level >= Comatose.config.default_tree_level) | |
| 21 | -%> | |
| 22 | - | |
| 23 | -<li id="page_<%= page.id %>"> | |
| 24 | - <table cellpadding="0" cellspacing="0"> | |
| 25 | - <tr> | |
| 26 | - <td valign="center"> | |
| 27 | - <% if !page.children.empty? %> | |
| 28 | - <%= image_tag( ((collapse_children) ? 'comatose/collapsed.gif' : 'comatose/expanded.gif'), :title=>'Expand/Collapse', :onclick=>"ComatoseList.toggle_tree_nodes(this,#{page.id});", :class=>'tree-controller', :size=>'12x12', :id=>"page_controller_#{page.id}" ) %> | |
| 29 | - <% else %> | |
| 30 | - <%= image_tag 'comatose/no-children.gif', :size=>'12x12', :class=>'tree-controller' %> | |
| 31 | - <% end %> | |
| 32 | - </td> | |
| 33 | - <td valign="center"> | |
| 34 | - <%= icon_for_document(page) %> | |
| 35 | - <span class="handle"><%= _('DRAG') %></span> | |
| 36 | - </td> | |
| 37 | - <td> | |
| 38 | - <%= link_to page.title, {:action=>'edit', :id=>page}, :title=>"Path:#{page.full_path}", :class=>'page' %> | |
| 39 | - </td> | |
| 40 | - <td class="commands"> | |
| 41 | - <%= links.join(', ') %>. | |
| 42 | - </td> | |
| 43 | - </tr> | |
| 44 | - </table> | |
| 45 | - | |
| 46 | - <ul id="page_list_<%= page.id %>" old="lvl-<%= page.id %>" class="page-list <%= 'collapsed' if collapse_children %>" > | |
| 47 | - <% for child in page.children %> | |
| 48 | - <%= render :partial=>'page_list_item', :locals=>{ :page=>child, :level=>level+1 } %> | |
| 49 | - <% end %> | |
| 50 | - </ul> | |
| 51 | - | |
| 52 | - <%= sortable_element( "page_list_#{page.id}", | |
| 53 | - :complete => visual_effect(:highlight, "page_list_#{page.id}"), | |
| 54 | - :handle=>'handle', | |
| 55 | - :update=>'flash-content', | |
| 56 | - :url => { :action => "reorder", :id=>page } ) if !page.children.empty? and page.children.length > 1 %> | |
| 57 | -</li> |
app/views/comatose_admin/delete.rhtml
| ... | ... | @@ -1,18 +0,0 @@ |
| 1 | -<h1> | |
| 2 | - Page Delete Confirmation | |
| 3 | -</h1> | |
| 4 | - | |
| 5 | -<blockquote> | |
| 6 | - <p><%= _('Are you sure you want to delete the page titled "%s"?') % content_tag('strong', @page.title) %> </p> | |
| 7 | - <% unless @page.children.empty? %> | |
| 8 | - <p><%= _("It has %s child pages that will also be deleted...") % content_tag('strong', @page.children.length) %></p> | |
| 9 | -<% end %> | |
| 10 | -</blockquote> | |
| 11 | - | |
| 12 | -<%= start_form_tag %> | |
| 13 | -<div id="button-group"> | |
| 14 | - <%= submit_tag _("Yes, Delete The Page") %> | |
| 15 | - or | |
| 16 | - <%= link_to _("Cancel"), :action=>'index' %> | |
| 17 | -</div> | |
| 18 | -<%= end_form_tag %> |
app/views/comatose_admin/edit.rhtml
app/views/comatose_admin/index.rhtml
| ... | ... | @@ -1,18 +0,0 @@ |
| 1 | -<div class="action"> | |
| 2 | - <%= link_to 'Clear Page Cache', :controller=>controller.controller_name, :action=>'expire_page_cache' %> | |
| 3 | -</div> | |
| 4 | - | |
| 5 | -<h1> | |
| 6 | - <%= _('Document List') %> | |
| 7 | - <%= image_tag 'comatose/spinner.gif', :id=>'spinner', :align=>'absmiddle', :style=>'display:none;' %> | |
| 8 | -</h1> | |
| 9 | - | |
| 10 | -<ul class="page-list root"> | |
| 11 | -<% @root_pages.each do |page| %> | |
| 12 | - <%= render :partial=>'page_list_item', :locals=>{ :page=>page, :level=>1 } %> | |
| 13 | -<% end %> | |
| 14 | -</ul> | |
| 15 | - | |
| 16 | -<div id="status"></div> | |
| 17 | - | |
| 18 | -<%= javascript_tag "ComatoseList.init()" %> |
app/views/comatose_admin/new.rhtml
app/views/comatose_admin/reorder.rhtml
| ... | ... | @@ -1,30 +0,0 @@ |
| 1 | -<h1><%= _('Reorder Pages') %></h1> | |
| 2 | - | |
| 3 | -<h3><%= _('"%s" child pages:') % @page.title %></h3> | |
| 4 | - | |
| 5 | -<ul class="page-list"> | |
| 6 | -<% @page.children.each do |page| %> | |
| 7 | - <li> | |
| 8 | - <table cellpadding="0" cellspacing="0"> | |
| 9 | - <tr> | |
| 10 | - <td rowspan="2" valign="center"> | |
| 11 | - <%= image_tag 'comatose/page.gif', :size=>'25x31', :align=>"absmiddle" %> | |
| 12 | - </td> | |
| 13 | - <td> | |
| 14 | - <a class="page"><%= page.title %></a> | |
| 15 | - </td> | |
| 16 | - </tr> | |
| 17 | - <tr> | |
| 18 | - <td class="commands"> | |
| 19 | - <%= link_to _("Move Up"), :action=>'reorder', :cmd=>'up', :page=>page.id %>, | |
| 20 | - <%= link_to _("Move Down"), :action=>'reorder', :cmd=>'down', :page=>page.id %> | |
| 21 | - </td> | |
| 22 | - </tr> | |
| 23 | - </table> | |
| 24 | - </li> | |
| 25 | -<% end %> | |
| 26 | -</ul> | |
| 27 | - | |
| 28 | -<div id="button-group"> | |
| 29 | - <%= link_to _("Finished"), :action=>'index' %> | |
| 30 | -</div> |
app/views/comatose_admin/versions.rhtml
| ... | ... | @@ -1,44 +0,0 @@ |
| 1 | -<h1><%= _('Page Revisions') %></h1> | |
| 2 | -<form> | |
| 3 | -<div class="revisions older-content"> | |
| 4 | - <div class="header"> | |
| 5 | - <div class="header-actions"> | |
| 6 | - <% form_tag :action => 'versions', :id => @page, :html => { :method => :get } do %> | |
| 7 | - <%= _('View Version:') %><%= select_tag "version", options_from_collection_for_select(@page.versions, 'version', 'version', @version_num), {'onchange'=>'this.form.submit();'} %> | |
| 8 | - <%= submit_tag 'Go', {'id'=>'go-btn'} %> | |
| 9 | - <% end %> | |
| 10 | - </div> | |
| 11 | - <%= _('Version %s') % @version_num %> | |
| 12 | - </div> | |
| 13 | - <div class="meta"> | |
| 14 | - <label class="title"><span><%= _('Title:') %></span><%= @version.title %></label> | |
| 15 | - <label><span><%= _('Slug:') %></span> <%= @version.slug %></label> | |
| 16 | - <% if show_field? 'keywords' %> | |
| 17 | - <label><span><%= _("Keywords:") %></span> <%= @version.keywords %></label> | |
| 18 | - <% end %> | |
| 19 | - </div> | |
| 20 | - <%= @version.body.split("\n").join('<br/>') unless @version.body.nil? %> | |
| 21 | - <div id="button-group" class="footer"> | |
| 22 | - <% form_tag :action=>'set_version', :id => @page, :version => @version_num do %> | |
| 23 | - <%= submit_tag _("Set As Current Version") %> | |
| 24 | - <%= _('or') %> | |
| 25 | - <%= link_to _("Cancel"), :action=>'index' %> | |
| 26 | - <% end %> | |
| 27 | - </div> | |
| 28 | -</div> | |
| 29 | - | |
| 30 | -<div class="revisions current-content"> | |
| 31 | - <div class="header"> | |
| 32 | - <% _('Current Version') %> | |
| 33 | - </div> | |
| 34 | - <div class="meta"> | |
| 35 | - <label class="title"><span><%= _('Title:') %></span><%= @page.title %></label> | |
| 36 | - <label><span><%= _('Slug:') %></span> <%= @page.slug %></label> | |
| 37 | - <% if show_field? 'keywords' %> | |
| 38 | - <label><span><%= _('Keywords:') %></span> <%= @page.keywords %></label> | |
| 39 | - <% end %> | |
| 40 | - </div> | |
| 41 | - <%= @page.body.split("\n").join('<br/>') unless @page.body.nil? %> | |
| 42 | -</div> | |
| 43 | - | |
| 44 | -<div style="clear:both"> </div> |
app/views/layouts/application.rhtml
| ... | ... | @@ -2,9 +2,9 @@ |
| 2 | 2 | <head> |
| 3 | 3 | <%= javascript_include_tag :defaults %> |
| 4 | 4 | <%= design_all_header_tags %> |
| 5 | - <%= javascript_include_tag 'comatose_admin' %> | |
| 6 | - <% if params[:controller] == 'comatose_admin' %> | |
| 7 | - <%= stylesheet_link_tag 'comatose_admin' %> | |
| 5 | + <%= javascript_include_tag 'cms' %> | |
| 6 | + <% if params[:controller] == 'cms' %> | |
| 7 | + <%= stylesheet_link_tag 'cms' %> | |
| 8 | 8 | <% end %> |
| 9 | 9 | <%= stylesheet_link_tag 'common' %> |
| 10 | 10 | </head> |
| ... | ... | @@ -37,7 +37,7 @@ |
| 37 | 37 | <div id='header_content'> |
| 38 | 38 | <!-- Aqui entra um conteudo tipo o titulo da pagina do usuário e os botoes do comatose? --> |
| 39 | 39 | </div> |
| 40 | - <% if params[:controller] == 'comatose_admin' %> | |
| 40 | + <% if params[:controller] == 'cms' %> | |
| 41 | 41 | <div id='boxes'> |
| 42 | 42 | <%= yield %> |
| 43 | 43 | </div> | ... | ... |
config/routes.rb
| ... | ... | @@ -23,7 +23,7 @@ ActionController::Routing::Routes.draw do |map| |
| 23 | 23 | map.connect 'customize/:profile/edit_template/:action/:id', :controller => 'edit_template' |
| 24 | 24 | |
| 25 | 25 | # content administration |
| 26 | - map.comatose_admin 'cms/:profile' | |
| 26 | + map.connect 'cms/:profile/:action/:id', :controller => 'cms' | |
| 27 | 27 | |
| 28 | 28 | # administrative tasks for a virtual community |
| 29 | 29 | map.connect 'admin', :controller => 'admin_panel', :action => 'index' | ... | ... |
| ... | ... | @@ -0,0 +1,401 @@ |
| 1 | +// CSS Browser Selector v0.2.3b (M@: added noscript support) | |
| 2 | +// Documentation: http://rafael.adm.br/css_browser_selector | |
| 3 | +// License: http://creativecommons.org/licenses/by/2.5/ | |
| 4 | +// Author: Rafael Lima (http://rafael.adm.br) | |
| 5 | +// Contributors: http://rafael.adm.br/css_browser_selector#contributors | |
| 6 | +var css_browser_selector = function() { | |
| 7 | + var | |
| 8 | + ua = navigator.userAgent.toLowerCase(), | |
| 9 | + is = function(t){ return ua.indexOf(t) != -1; }, | |
| 10 | + h = document.getElementsByTagName('html')[0], | |
| 11 | + b = (!(/opera|webtv/i.test(ua)) && /msie (\d)/.test(ua)) ? ((is('mac') ? 'ieMac ' : '') + 'ie ie' + RegExp.$1) | |
| 12 | + : is('gecko/') ? 'gecko' : is('opera') ? 'opera' : is('konqueror') ? 'konqueror' : is('applewebkit/') ? 'webkit safari' : is('mozilla/') ? 'gecko' : '', | |
| 13 | + os = (is('x11') || is('linux')) ? ' linux' : is('mac') ? ' mac' : is('win') ? ' win' : ''; | |
| 14 | + var c = b+os+' js'; | |
| 15 | + h.className = h.className.replace('noscript', '') + h.className?' '+c:c; | |
| 16 | +}(); | |
| 17 | + | |
| 18 | +// List View Functions | |
| 19 | +var ComatoseList = { | |
| 20 | + save_node_state: true, | |
| 21 | + state_store: 'cookie', // Only 'cookie' for now | |
| 22 | + state_key: 'ComatoseTreeState', | |
| 23 | + | |
| 24 | + init: function() { | |
| 25 | + var items = ComatoseList._read_state(); | |
| 26 | + items.each(function(node){ | |
| 27 | + ComatoseList.expand_node(node.replace('page_controller_', '')) | |
| 28 | + }); | |
| 29 | + }, | |
| 30 | + | |
| 31 | + toggle_tree_nodes : function(img, id) { | |
| 32 | + if(/expanded/.test(img.src)) { | |
| 33 | + $('page_list_'+ id).addClassName('collapsed'); | |
| 34 | + img.src = img.src.replace(/expanded/, 'collapsed') | |
| 35 | + if(ComatoseList.save_node_state) { | |
| 36 | + var items = ComatoseList._read_state(); | |
| 37 | + items = items.select(function(id){ return id != img.id; }) | |
| 38 | + ComatoseList._write_state(items); | |
| 39 | + } | |
| 40 | + } else { | |
| 41 | + $('page_list_'+ id).removeClassName('collapsed'); | |
| 42 | + img.src = img.src.replace(/collapsed/, 'expanded') | |
| 43 | + if(ComatoseList.save_node_state) { | |
| 44 | + var items = ComatoseList._read_state(); | |
| 45 | + items.push(img.id); | |
| 46 | + ComatoseList._write_state(items); | |
| 47 | + } | |
| 48 | + } | |
| 49 | + }, | |
| 50 | + | |
| 51 | + expand_node: function(id) { | |
| 52 | + $('page_list_'+ id).removeClassName('collapsed'); | |
| 53 | + $('page_controller_'+ id).src = $('page_controller_'+ id).src.replace(/collapsed/, 'expanded') | |
| 54 | + }, | |
| 55 | + | |
| 56 | + collapse_node: function(id) { | |
| 57 | + $('page_list_'+ id).addClassName('collapsed'); | |
| 58 | + $('page_controller_'+ id).src = $('page_controller_'+ id).src.replace(/expanded/, 'collapsed') | |
| 59 | + }, | |
| 60 | + | |
| 61 | + item_hover : function(node, state, is_delete) { | |
| 62 | + if( state == 'over') { | |
| 63 | + $(node).addClassName( (is_delete) ? 'hover-delete' : 'hover' ); | |
| 64 | + } else { | |
| 65 | + $(node).removeClassName( (is_delete) ? 'hover-delete' : 'hover' ); | |
| 66 | + } | |
| 67 | + }, | |
| 68 | + | |
| 69 | + toggle_reorder: function(node, anc, id, reorder_text, finished_text) { | |
| 70 | + if( $(node).hasClassName('do-reorder') ) { | |
| 71 | + $(node).removeClassName( 'do-reorder' ); | |
| 72 | + $(anc).removeClassName('reordering'); | |
| 73 | + $(anc).innerHTML = reorder_text; | |
| 74 | + } else { | |
| 75 | + $(node).addClassName( 'do-reorder' ); | |
| 76 | + $(anc).addClassName('reordering'); | |
| 77 | + $(anc).innerHTML = finished_text; | |
| 78 | + // Make sure the children are visible... | |
| 79 | + ComatoseList.expand_node(id); | |
| 80 | + } | |
| 81 | + }, | |
| 82 | + | |
| 83 | + _write_state: function(items) { | |
| 84 | + var cookie = {}; var options = {}; var expiration = new Date(); | |
| 85 | + cookie[ ComatoseList.state_key ] = items.join(','); | |
| 86 | + expiration.setDate(expiration.getDate()+30) | |
| 87 | + options['expires'] = expiration; | |
| 88 | + Cookie.write( cookie, options ); | |
| 89 | + }, | |
| 90 | + | |
| 91 | + _read_state: function() { | |
| 92 | + var state = Cookie.read( ComatoseList.state_key ); | |
| 93 | + return (state != "" && state != null) ? state.split(',') : []; | |
| 94 | + } | |
| 95 | +} | |
| 96 | + | |
| 97 | +// Edit Form Functions | |
| 98 | +var ComatoseEditForm = { | |
| 99 | + | |
| 100 | + default_data: {}, | |
| 101 | + last_preview: {}, | |
| 102 | + last_title_slug: '', | |
| 103 | + mode : null, | |
| 104 | + liquid_horiz: false, // changed from true to false by terceiro | |
| 105 | + width_offset: 325, | |
| 106 | + | |
| 107 | + // Initialize the page... | |
| 108 | + init : function(mode) { | |
| 109 | + this.mode = mode; | |
| 110 | + this.default_data = Form.serialize(document.forms[0]); | |
| 111 | + if(mode == 'new') { | |
| 112 | + this.last_title_slug = $('page_title').value.toSlug(); | |
| 113 | + Event.observe('page_title', 'blur', ComatoseEditForm.title_updated_aggressive); | |
| 114 | + } else { | |
| 115 | + Event.observe('page_title', 'blur', ComatoseEditForm.title_updated); | |
| 116 | + } | |
| 117 | + $('page_title').focus(); | |
| 118 | + Hide.these( | |
| 119 | + 'preview-area', | |
| 120 | + 'slug_row', | |
| 121 | + 'parent_row', | |
| 122 | + 'keywords_row', | |
| 123 | + 'filter_row', | |
| 124 | + 'created_row' | |
| 125 | + ); | |
| 126 | + $('page_title').select(); | |
| 127 | + // Create the horizontal liquidity of the fields | |
| 128 | + if(this.liquid_horiz) { | |
| 129 | + xOffset = this.width_offset; | |
| 130 | + new Layout.LiquidHoriz((xOffset + 50), 'page_title'); | |
| 131 | + new Layout.LiquidHoriz(xOffset, 'page_slug','page_keywords','page_parent','page_body'); | |
| 132 | + } | |
| 133 | + }, | |
| 134 | + // For use when updating an existing page... | |
| 135 | + title_updated : function() { | |
| 136 | + slug = $('page_slug'); | |
| 137 | + if(slug.value == "") { | |
| 138 | + title = $('page_title'); | |
| 139 | + slug.value = title.value.toSlug(); | |
| 140 | + } | |
| 141 | + }, | |
| 142 | + // For use when creating a new page... | |
| 143 | + title_updated_aggressive : function() { | |
| 144 | + slug = $('page_slug'); | |
| 145 | + title = $('page_title'); | |
| 146 | + if(slug.value == "" || slug.value == this.last_title ) { | |
| 147 | + slug.value = title.value.toSlug(); | |
| 148 | + } | |
| 149 | + this.last_title = slug.value; | |
| 150 | + }, | |
| 151 | + // Todo: Make the meta fields remember their visibility? | |
| 152 | + toggle_extra_fields : function(anchor, more_label, less_label) { | |
| 153 | + if(anchor.innerHTML == more_label) { | |
| 154 | + Show.these( | |
| 155 | + 'slug_row', | |
| 156 | + 'keywords_row', | |
| 157 | + 'parent_row', | |
| 158 | + 'filter_row', | |
| 159 | + 'created_row' | |
| 160 | + ); | |
| 161 | + anchor.innerHTML = less_label; | |
| 162 | + } else { | |
| 163 | + Hide.these( | |
| 164 | + 'slug_row', | |
| 165 | + 'keywords_row', | |
| 166 | + 'parent_row', | |
| 167 | + 'filter_row', | |
| 168 | + 'created_row' | |
| 169 | + ); | |
| 170 | + anchor.innerHTML = more_label; | |
| 171 | + } | |
| 172 | + }, | |
| 173 | + // Uses server to create preview of content... | |
| 174 | + preview_content : function(preview_url, preview_label) { | |
| 175 | + $('preview-area').show(); | |
| 176 | + var params = Form.serialize(document.forms[0]); | |
| 177 | + if( params != this.last_preview ) { | |
| 178 | + $('preview-panel').innerHTML = "<span style='color:blue;'>" + preview_label + "</span>"; | |
| 179 | + new Ajax.Updater( | |
| 180 | + 'preview-panel', | |
| 181 | + preview_url, | |
| 182 | + { parameters: params } | |
| 183 | + ); | |
| 184 | + } | |
| 185 | + this.last_preview = params; | |
| 186 | + }, | |
| 187 | + cancel : function(url, cancel_warning) { | |
| 188 | + var current_data = Form.serialize(document.forms[0]); | |
| 189 | + var data_changed = (this.default_data != current_data) | |
| 190 | + if(data_changed) { | |
| 191 | + if( confirm(cancel_warning) ) { | |
| 192 | + location.href = url; | |
| 193 | + } | |
| 194 | + } else { | |
| 195 | + location.href = url; | |
| 196 | + } | |
| 197 | + | |
| 198 | + } | |
| 199 | +} | |
| 200 | + | |
| 201 | +var Hide = { | |
| 202 | + these : function() { | |
| 203 | + for (var i = 0; i < arguments.length; i++) { | |
| 204 | + try { | |
| 205 | + $(arguments[i]).hide(); | |
| 206 | + } catch (e) {} | |
| 207 | + } | |
| 208 | + } | |
| 209 | +} | |
| 210 | + | |
| 211 | +var Show = { | |
| 212 | + these : function() { | |
| 213 | + for (var i = 0; i < arguments.length; i++) { | |
| 214 | + try { | |
| 215 | + $(arguments[i]).show(); | |
| 216 | + } catch (e) {} | |
| 217 | + } | |
| 218 | + } | |
| 219 | +} | |
| 220 | + | |
| 221 | +// Layout namespace | |
| 222 | +var Layout = {}; | |
| 223 | + | |
| 224 | +// This class allows dom objects to stretch with the browser | |
| 225 | +// (for when a good, cross-browser, CSS approach can't be found) | |
| 226 | +Layout.LiquidBase = Class.create(); | |
| 227 | +// Base class for all Liquid* layouts... | |
| 228 | +Object.extend(Layout.LiquidBase.prototype, { | |
| 229 | + enabled: true, | |
| 230 | + elems: [], | |
| 231 | + offset: null, | |
| 232 | + // Constructor is (offset, **array_of_elements) | |
| 233 | + initialize: function() { | |
| 234 | + args = $A(arguments) | |
| 235 | + this.offset = args.shift(); | |
| 236 | + this.elems = args.select( function(elem){ return ($(elem) != null) } ); | |
| 237 | + if( this.elems.length > 0 ) { | |
| 238 | + this.on_resize(); // Initial size | |
| 239 | + Event.observe(window, 'resize', this.on_resize.bind(this) ); | |
| 240 | + Event.observe(window, 'load', this.on_resize.bind(this) ); | |
| 241 | + } | |
| 242 | + }, | |
| 243 | + resize_in: function(timeout) { | |
| 244 | + setTimeout( this.on_resize.bind(this), timeout ); | |
| 245 | + }, | |
| 246 | + on_resize: function() { | |
| 247 | + // Need to override! | |
| 248 | + alert('Override on_resize, please!'); | |
| 249 | + } | |
| 250 | +}); | |
| 251 | + | |
| 252 | + | |
| 253 | +// Liquid vertical layout | |
| 254 | +Layout.LiquidVert = Class.create(); | |
| 255 | +Object.extend(Layout.LiquidVert.prototype, Object.extend(Layout.LiquidBase.prototype, { | |
| 256 | + on_resize: function() { | |
| 257 | + if( this.offset != null && this.enabled ) { | |
| 258 | + var new_height = ((window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight) - this.offset) +"px"; | |
| 259 | + this.elems.each(function(e){ $(e).style.height = new_height; }) | |
| 260 | + } | |
| 261 | + } | |
| 262 | +}) ); | |
| 263 | + | |
| 264 | + | |
| 265 | +// Liquid horizontal layout | |
| 266 | +Layout.LiquidHoriz = Class.create(); | |
| 267 | +Object.extend(Layout.LiquidHoriz.prototype, Object.extend(Layout.LiquidBase.prototype, { | |
| 268 | + on_resize: function() { | |
| 269 | + if( this.offset != null && this.enabled ) { | |
| 270 | + var new_width = ((window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth) - this.offset) +"px"; | |
| 271 | + this.elems.each( function(e){ $(e).style.width = new_width; }) | |
| 272 | + } | |
| 273 | + } | |
| 274 | +}) ); | |
| 275 | + | |
| 276 | +// String Extensions... Yes, these are from Radiant! ;-) | |
| 277 | +Object.extend(String.prototype, { | |
| 278 | + upcase: function() { | |
| 279 | + return this.toUpperCase(); | |
| 280 | + }, | |
| 281 | + downcase: function() { | |
| 282 | + return this.toLowerCase(); | |
| 283 | + }, | |
| 284 | + strip: function() { | |
| 285 | + return this.replace(/^\s+/, '').replace(/\s+$/, ''); | |
| 286 | + }, | |
| 287 | + toInteger: function() { | |
| 288 | + return parseInt(this); | |
| 289 | + }, | |
| 290 | + toSlug: function() { | |
| 291 | + // M@: Modified from Radiant's version, removes multple --'s next to each other | |
| 292 | + // This is the same RegExp as the one on the page model... | |
| 293 | + return this.strip().downcase().replace(/[^-a-z0-9~\s\.:;+=_]/g, '').replace(/[\s\.:;=_+]+/g, '-').replace(/[\-]{2,}/g, '-'); | |
| 294 | + } | |
| 295 | +}); | |
| 296 | + | |
| 297 | +// Run a spinner when an AJAX request in running... | |
| 298 | +var ComatoseAJAXSpinner = { | |
| 299 | + busy : function () { | |
| 300 | + if($('spinner') && Ajax.activeRequestCount > 0) { | |
| 301 | + Effect.Appear('spinner',{duration:0.5,queue:'end'}); | |
| 302 | + } | |
| 303 | + }, | |
| 304 | + | |
| 305 | + notBusy: function() { | |
| 306 | + if($('spinner') && Ajax.activeRequestCount == 0) { | |
| 307 | + Effect.Fade('spinner',{duration:0.5,queue:'end'}); | |
| 308 | + } | |
| 309 | + } | |
| 310 | +} | |
| 311 | +// Register it with Prototype... | |
| 312 | +Ajax.Responders.register({ | |
| 313 | + onCreate: ComatoseAJAXSpinner.busy, | |
| 314 | + onComplete: ComatoseAJAXSpinner.notBusy | |
| 315 | +}); | |
| 316 | + | |
| 317 | + | |
| 318 | +if(!window.Cookie) | |
| 319 | + (function (){ | |
| 320 | + // From Mephisto! | |
| 321 | + window.Cookie = { | |
| 322 | + version: '0.7', | |
| 323 | + cookies: {}, | |
| 324 | + _each: function(iterator) { | |
| 325 | + $H(this.cookies).each(iterator); | |
| 326 | + }, | |
| 327 | + | |
| 328 | + getAll: function() { | |
| 329 | + this.cookies = {}; | |
| 330 | + $A(document.cookie.split('; ')).each(function(cookie) { | |
| 331 | + var seperator = cookie.indexOf('='); | |
| 332 | + this.cookies[cookie.substring(0, seperator)] = | |
| 333 | + unescape(cookie.substring(seperator + 1, cookie.length)); | |
| 334 | + }.bind(this)); | |
| 335 | + return this.cookies; | |
| 336 | + }, | |
| 337 | + | |
| 338 | + read: function() { | |
| 339 | + var cookies = $A(arguments), results = []; | |
| 340 | + this.getAll(); | |
| 341 | + cookies.each(function(name) { | |
| 342 | + if (this.cookies[name]) results.push(this.cookies[name]); | |
| 343 | + else results.push(null); | |
| 344 | + }.bind(this)); | |
| 345 | + return results.length > 1 ? results : results[0]; | |
| 346 | + }, | |
| 347 | + | |
| 348 | + write: function(cookies, options) { | |
| 349 | + if (cookies.constructor == Object && cookies.name) cookies = [cookies]; | |
| 350 | + if (cookies.constructor == Array) { | |
| 351 | + $A(cookies).each(function(cookie) { | |
| 352 | + this._write(cookie.name, cookie.value, cookie.expires, | |
| 353 | + cookie.path, cookie.domain); | |
| 354 | + }.bind(this)); | |
| 355 | + } else { | |
| 356 | + options = options || {expires: false, path: '', domain: ''}; | |
| 357 | + for (name in cookies){ | |
| 358 | + this._write(name, cookies[name], | |
| 359 | + options.expires, options.path, options.domain); | |
| 360 | + } | |
| 361 | + } | |
| 362 | + }, | |
| 363 | + | |
| 364 | + _write: function(name, value, expires, path, domain) { | |
| 365 | + if (name.indexOf('=') != -1) return; | |
| 366 | + var cookieString = name + '=' + escape(value); | |
| 367 | + if (expires) cookieString += '; expires=' + expires.toGMTString(); | |
| 368 | + if (path) cookieString += '; path=' + path; | |
| 369 | + if (domain) cookieString += '; domain=' + domain; | |
| 370 | + document.cookie = cookieString; | |
| 371 | + }, | |
| 372 | + | |
| 373 | + erase: function(cookies) { | |
| 374 | + var cookiesToErase = {}; | |
| 375 | + $A(arguments).each(function(cookie) { | |
| 376 | + cookiesToErase[cookie] = ''; | |
| 377 | + }); | |
| 378 | + | |
| 379 | + this.write(cookiesToErase, {expires: (new Date((new Date()).getTime() - 1e11))}); | |
| 380 | + this.getAll(); | |
| 381 | + }, | |
| 382 | + | |
| 383 | + eraseAll: function() { | |
| 384 | + this.erase.apply(this, $H(this.getAll()).keys()); | |
| 385 | + } | |
| 386 | + }; | |
| 387 | + | |
| 388 | + Object.extend(Cookie, { | |
| 389 | + get: Cookie.read, | |
| 390 | + set: Cookie.write, | |
| 391 | + | |
| 392 | + add: Cookie.read, | |
| 393 | + remove: Cookie.erase, | |
| 394 | + removeAll: Cookie.eraseAll, | |
| 395 | + | |
| 396 | + wipe: Cookie.erase, | |
| 397 | + wipeAll: Cookie.eraseAll, | |
| 398 | + destroy: Cookie.erase, | |
| 399 | + destroyAll: Cookie.eraseAll | |
| 400 | + }); | |
| 401 | + })(); | ... | ... |
public/javascripts/comatose_admin.js
| ... | ... | @@ -1,401 +0,0 @@ |
| 1 | -// CSS Browser Selector v0.2.3b (M@: added noscript support) | |
| 2 | -// Documentation: http://rafael.adm.br/css_browser_selector | |
| 3 | -// License: http://creativecommons.org/licenses/by/2.5/ | |
| 4 | -// Author: Rafael Lima (http://rafael.adm.br) | |
| 5 | -// Contributors: http://rafael.adm.br/css_browser_selector#contributors | |
| 6 | -var css_browser_selector = function() { | |
| 7 | - var | |
| 8 | - ua = navigator.userAgent.toLowerCase(), | |
| 9 | - is = function(t){ return ua.indexOf(t) != -1; }, | |
| 10 | - h = document.getElementsByTagName('html')[0], | |
| 11 | - b = (!(/opera|webtv/i.test(ua)) && /msie (\d)/.test(ua)) ? ((is('mac') ? 'ieMac ' : '') + 'ie ie' + RegExp.$1) | |
| 12 | - : is('gecko/') ? 'gecko' : is('opera') ? 'opera' : is('konqueror') ? 'konqueror' : is('applewebkit/') ? 'webkit safari' : is('mozilla/') ? 'gecko' : '', | |
| 13 | - os = (is('x11') || is('linux')) ? ' linux' : is('mac') ? ' mac' : is('win') ? ' win' : ''; | |
| 14 | - var c = b+os+' js'; | |
| 15 | - h.className = h.className.replace('noscript', '') + h.className?' '+c:c; | |
| 16 | -}(); | |
| 17 | - | |
| 18 | -// List View Functions | |
| 19 | -var ComatoseList = { | |
| 20 | - save_node_state: true, | |
| 21 | - state_store: 'cookie', // Only 'cookie' for now | |
| 22 | - state_key: 'ComatoseTreeState', | |
| 23 | - | |
| 24 | - init: function() { | |
| 25 | - var items = ComatoseList._read_state(); | |
| 26 | - items.each(function(node){ | |
| 27 | - ComatoseList.expand_node(node.replace('page_controller_', '')) | |
| 28 | - }); | |
| 29 | - }, | |
| 30 | - | |
| 31 | - toggle_tree_nodes : function(img, id) { | |
| 32 | - if(/expanded/.test(img.src)) { | |
| 33 | - $('page_list_'+ id).addClassName('collapsed'); | |
| 34 | - img.src = img.src.replace(/expanded/, 'collapsed') | |
| 35 | - if(ComatoseList.save_node_state) { | |
| 36 | - var items = ComatoseList._read_state(); | |
| 37 | - items = items.select(function(id){ return id != img.id; }) | |
| 38 | - ComatoseList._write_state(items); | |
| 39 | - } | |
| 40 | - } else { | |
| 41 | - $('page_list_'+ id).removeClassName('collapsed'); | |
| 42 | - img.src = img.src.replace(/collapsed/, 'expanded') | |
| 43 | - if(ComatoseList.save_node_state) { | |
| 44 | - var items = ComatoseList._read_state(); | |
| 45 | - items.push(img.id); | |
| 46 | - ComatoseList._write_state(items); | |
| 47 | - } | |
| 48 | - } | |
| 49 | - }, | |
| 50 | - | |
| 51 | - expand_node: function(id) { | |
| 52 | - $('page_list_'+ id).removeClassName('collapsed'); | |
| 53 | - $('page_controller_'+ id).src = $('page_controller_'+ id).src.replace(/collapsed/, 'expanded') | |
| 54 | - }, | |
| 55 | - | |
| 56 | - collapse_node: function(id) { | |
| 57 | - $('page_list_'+ id).addClassName('collapsed'); | |
| 58 | - $('page_controller_'+ id).src = $('page_controller_'+ id).src.replace(/expanded/, 'collapsed') | |
| 59 | - }, | |
| 60 | - | |
| 61 | - item_hover : function(node, state, is_delete) { | |
| 62 | - if( state == 'over') { | |
| 63 | - $(node).addClassName( (is_delete) ? 'hover-delete' : 'hover' ); | |
| 64 | - } else { | |
| 65 | - $(node).removeClassName( (is_delete) ? 'hover-delete' : 'hover' ); | |
| 66 | - } | |
| 67 | - }, | |
| 68 | - | |
| 69 | - toggle_reorder: function(node, anc, id, reorder_text, finished_text) { | |
| 70 | - if( $(node).hasClassName('do-reorder') ) { | |
| 71 | - $(node).removeClassName( 'do-reorder' ); | |
| 72 | - $(anc).removeClassName('reordering'); | |
| 73 | - $(anc).innerHTML = reorder_text; | |
| 74 | - } else { | |
| 75 | - $(node).addClassName( 'do-reorder' ); | |
| 76 | - $(anc).addClassName('reordering'); | |
| 77 | - $(anc).innerHTML = finished_text; | |
| 78 | - // Make sure the children are visible... | |
| 79 | - ComatoseList.expand_node(id); | |
| 80 | - } | |
| 81 | - }, | |
| 82 | - | |
| 83 | - _write_state: function(items) { | |
| 84 | - var cookie = {}; var options = {}; var expiration = new Date(); | |
| 85 | - cookie[ ComatoseList.state_key ] = items.join(','); | |
| 86 | - expiration.setDate(expiration.getDate()+30) | |
| 87 | - options['expires'] = expiration; | |
| 88 | - Cookie.write( cookie, options ); | |
| 89 | - }, | |
| 90 | - | |
| 91 | - _read_state: function() { | |
| 92 | - var state = Cookie.read( ComatoseList.state_key ); | |
| 93 | - return (state != "" && state != null) ? state.split(',') : []; | |
| 94 | - } | |
| 95 | -} | |
| 96 | - | |
| 97 | -// Edit Form Functions | |
| 98 | -var ComatoseEditForm = { | |
| 99 | - | |
| 100 | - default_data: {}, | |
| 101 | - last_preview: {}, | |
| 102 | - last_title_slug: '', | |
| 103 | - mode : null, | |
| 104 | - liquid_horiz: false, // changed from true to false by terceiro | |
| 105 | - width_offset: 325, | |
| 106 | - | |
| 107 | - // Initialize the page... | |
| 108 | - init : function(mode) { | |
| 109 | - this.mode = mode; | |
| 110 | - this.default_data = Form.serialize(document.forms[0]); | |
| 111 | - if(mode == 'new') { | |
| 112 | - this.last_title_slug = $('page_title').value.toSlug(); | |
| 113 | - Event.observe('page_title', 'blur', ComatoseEditForm.title_updated_aggressive); | |
| 114 | - } else { | |
| 115 | - Event.observe('page_title', 'blur', ComatoseEditForm.title_updated); | |
| 116 | - } | |
| 117 | - $('page_title').focus(); | |
| 118 | - Hide.these( | |
| 119 | - 'preview-area', | |
| 120 | - 'slug_row', | |
| 121 | - 'parent_row', | |
| 122 | - 'keywords_row', | |
| 123 | - 'filter_row', | |
| 124 | - 'created_row' | |
| 125 | - ); | |
| 126 | - $('page_title').select(); | |
| 127 | - // Create the horizontal liquidity of the fields | |
| 128 | - if(this.liquid_horiz) { | |
| 129 | - xOffset = this.width_offset; | |
| 130 | - new Layout.LiquidHoriz((xOffset + 50), 'page_title'); | |
| 131 | - new Layout.LiquidHoriz(xOffset, 'page_slug','page_keywords','page_parent','page_body'); | |
| 132 | - } | |
| 133 | - }, | |
| 134 | - // For use when updating an existing page... | |
| 135 | - title_updated : function() { | |
| 136 | - slug = $('page_slug'); | |
| 137 | - if(slug.value == "") { | |
| 138 | - title = $('page_title'); | |
| 139 | - slug.value = title.value.toSlug(); | |
| 140 | - } | |
| 141 | - }, | |
| 142 | - // For use when creating a new page... | |
| 143 | - title_updated_aggressive : function() { | |
| 144 | - slug = $('page_slug'); | |
| 145 | - title = $('page_title'); | |
| 146 | - if(slug.value == "" || slug.value == this.last_title ) { | |
| 147 | - slug.value = title.value.toSlug(); | |
| 148 | - } | |
| 149 | - this.last_title = slug.value; | |
| 150 | - }, | |
| 151 | - // Todo: Make the meta fields remember their visibility? | |
| 152 | - toggle_extra_fields : function(anchor, more_label, less_label) { | |
| 153 | - if(anchor.innerHTML == more_label) { | |
| 154 | - Show.these( | |
| 155 | - 'slug_row', | |
| 156 | - 'keywords_row', | |
| 157 | - 'parent_row', | |
| 158 | - 'filter_row', | |
| 159 | - 'created_row' | |
| 160 | - ); | |
| 161 | - anchor.innerHTML = less_label; | |
| 162 | - } else { | |
| 163 | - Hide.these( | |
| 164 | - 'slug_row', | |
| 165 | - 'keywords_row', | |
| 166 | - 'parent_row', | |
| 167 | - 'filter_row', | |
| 168 | - 'created_row' | |
| 169 | - ); | |
| 170 | - anchor.innerHTML = more_label; | |
| 171 | - } | |
| 172 | - }, | |
| 173 | - // Uses server to create preview of content... | |
| 174 | - preview_content : function(preview_url, preview_label) { | |
| 175 | - $('preview-area').show(); | |
| 176 | - var params = Form.serialize(document.forms[0]); | |
| 177 | - if( params != this.last_preview ) { | |
| 178 | - $('preview-panel').innerHTML = "<span style='color:blue;'>" + preview_label + "</span>"; | |
| 179 | - new Ajax.Updater( | |
| 180 | - 'preview-panel', | |
| 181 | - preview_url, | |
| 182 | - { parameters: params } | |
| 183 | - ); | |
| 184 | - } | |
| 185 | - this.last_preview = params; | |
| 186 | - }, | |
| 187 | - cancel : function(url, cancel_warning) { | |
| 188 | - var current_data = Form.serialize(document.forms[0]); | |
| 189 | - var data_changed = (this.default_data != current_data) | |
| 190 | - if(data_changed) { | |
| 191 | - if( confirm(cancel_warning) ) { | |
| 192 | - location.href = url; | |
| 193 | - } | |
| 194 | - } else { | |
| 195 | - location.href = url; | |
| 196 | - } | |
| 197 | - | |
| 198 | - } | |
| 199 | -} | |
| 200 | - | |
| 201 | -var Hide = { | |
| 202 | - these : function() { | |
| 203 | - for (var i = 0; i < arguments.length; i++) { | |
| 204 | - try { | |
| 205 | - $(arguments[i]).hide(); | |
| 206 | - } catch (e) {} | |
| 207 | - } | |
| 208 | - } | |
| 209 | -} | |
| 210 | - | |
| 211 | -var Show = { | |
| 212 | - these : function() { | |
| 213 | - for (var i = 0; i < arguments.length; i++) { | |
| 214 | - try { | |
| 215 | - $(arguments[i]).show(); | |
| 216 | - } catch (e) {} | |
| 217 | - } | |
| 218 | - } | |
| 219 | -} | |
| 220 | - | |
| 221 | -// Layout namespace | |
| 222 | -var Layout = {}; | |
| 223 | - | |
| 224 | -// This class allows dom objects to stretch with the browser | |
| 225 | -// (for when a good, cross-browser, CSS approach can't be found) | |
| 226 | -Layout.LiquidBase = Class.create(); | |
| 227 | -// Base class for all Liquid* layouts... | |
| 228 | -Object.extend(Layout.LiquidBase.prototype, { | |
| 229 | - enabled: true, | |
| 230 | - elems: [], | |
| 231 | - offset: null, | |
| 232 | - // Constructor is (offset, **array_of_elements) | |
| 233 | - initialize: function() { | |
| 234 | - args = $A(arguments) | |
| 235 | - this.offset = args.shift(); | |
| 236 | - this.elems = args.select( function(elem){ return ($(elem) != null) } ); | |
| 237 | - if( this.elems.length > 0 ) { | |
| 238 | - this.on_resize(); // Initial size | |
| 239 | - Event.observe(window, 'resize', this.on_resize.bind(this) ); | |
| 240 | - Event.observe(window, 'load', this.on_resize.bind(this) ); | |
| 241 | - } | |
| 242 | - }, | |
| 243 | - resize_in: function(timeout) { | |
| 244 | - setTimeout( this.on_resize.bind(this), timeout ); | |
| 245 | - }, | |
| 246 | - on_resize: function() { | |
| 247 | - // Need to override! | |
| 248 | - alert('Override on_resize, please!'); | |
| 249 | - } | |
| 250 | -}); | |
| 251 | - | |
| 252 | - | |
| 253 | -// Liquid vertical layout | |
| 254 | -Layout.LiquidVert = Class.create(); | |
| 255 | -Object.extend(Layout.LiquidVert.prototype, Object.extend(Layout.LiquidBase.prototype, { | |
| 256 | - on_resize: function() { | |
| 257 | - if( this.offset != null && this.enabled ) { | |
| 258 | - var new_height = ((window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight) - this.offset) +"px"; | |
| 259 | - this.elems.each(function(e){ $(e).style.height = new_height; }) | |
| 260 | - } | |
| 261 | - } | |
| 262 | -}) ); | |
| 263 | - | |
| 264 | - | |
| 265 | -// Liquid horizontal layout | |
| 266 | -Layout.LiquidHoriz = Class.create(); | |
| 267 | -Object.extend(Layout.LiquidHoriz.prototype, Object.extend(Layout.LiquidBase.prototype, { | |
| 268 | - on_resize: function() { | |
| 269 | - if( this.offset != null && this.enabled ) { | |
| 270 | - var new_width = ((window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth) - this.offset) +"px"; | |
| 271 | - this.elems.each( function(e){ $(e).style.width = new_width; }) | |
| 272 | - } | |
| 273 | - } | |
| 274 | -}) ); | |
| 275 | - | |
| 276 | -// String Extensions... Yes, these are from Radiant! ;-) | |
| 277 | -Object.extend(String.prototype, { | |
| 278 | - upcase: function() { | |
| 279 | - return this.toUpperCase(); | |
| 280 | - }, | |
| 281 | - downcase: function() { | |
| 282 | - return this.toLowerCase(); | |
| 283 | - }, | |
| 284 | - strip: function() { | |
| 285 | - return this.replace(/^\s+/, '').replace(/\s+$/, ''); | |
| 286 | - }, | |
| 287 | - toInteger: function() { | |
| 288 | - return parseInt(this); | |
| 289 | - }, | |
| 290 | - toSlug: function() { | |
| 291 | - // M@: Modified from Radiant's version, removes multple --'s next to each other | |
| 292 | - // This is the same RegExp as the one on the page model... | |
| 293 | - return this.strip().downcase().replace(/[^-a-z0-9~\s\.:;+=_]/g, '').replace(/[\s\.:;=_+]+/g, '-').replace(/[\-]{2,}/g, '-'); | |
| 294 | - } | |
| 295 | -}); | |
| 296 | - | |
| 297 | -// Run a spinner when an AJAX request in running... | |
| 298 | -var ComatoseAJAXSpinner = { | |
| 299 | - busy : function () { | |
| 300 | - if($('spinner') && Ajax.activeRequestCount > 0) { | |
| 301 | - Effect.Appear('spinner',{duration:0.5,queue:'end'}); | |
| 302 | - } | |
| 303 | - }, | |
| 304 | - | |
| 305 | - notBusy: function() { | |
| 306 | - if($('spinner') && Ajax.activeRequestCount == 0) { | |
| 307 | - Effect.Fade('spinner',{duration:0.5,queue:'end'}); | |
| 308 | - } | |
| 309 | - } | |
| 310 | -} | |
| 311 | -// Register it with Prototype... | |
| 312 | -Ajax.Responders.register({ | |
| 313 | - onCreate: ComatoseAJAXSpinner.busy, | |
| 314 | - onComplete: ComatoseAJAXSpinner.notBusy | |
| 315 | -}); | |
| 316 | - | |
| 317 | - | |
| 318 | -if(!window.Cookie) | |
| 319 | - (function (){ | |
| 320 | - // From Mephisto! | |
| 321 | - window.Cookie = { | |
| 322 | - version: '0.7', | |
| 323 | - cookies: {}, | |
| 324 | - _each: function(iterator) { | |
| 325 | - $H(this.cookies).each(iterator); | |
| 326 | - }, | |
| 327 | - | |
| 328 | - getAll: function() { | |
| 329 | - this.cookies = {}; | |
| 330 | - $A(document.cookie.split('; ')).each(function(cookie) { | |
| 331 | - var seperator = cookie.indexOf('='); | |
| 332 | - this.cookies[cookie.substring(0, seperator)] = | |
| 333 | - unescape(cookie.substring(seperator + 1, cookie.length)); | |
| 334 | - }.bind(this)); | |
| 335 | - return this.cookies; | |
| 336 | - }, | |
| 337 | - | |
| 338 | - read: function() { | |
| 339 | - var cookies = $A(arguments), results = []; | |
| 340 | - this.getAll(); | |
| 341 | - cookies.each(function(name) { | |
| 342 | - if (this.cookies[name]) results.push(this.cookies[name]); | |
| 343 | - else results.push(null); | |
| 344 | - }.bind(this)); | |
| 345 | - return results.length > 1 ? results : results[0]; | |
| 346 | - }, | |
| 347 | - | |
| 348 | - write: function(cookies, options) { | |
| 349 | - if (cookies.constructor == Object && cookies.name) cookies = [cookies]; | |
| 350 | - if (cookies.constructor == Array) { | |
| 351 | - $A(cookies).each(function(cookie) { | |
| 352 | - this._write(cookie.name, cookie.value, cookie.expires, | |
| 353 | - cookie.path, cookie.domain); | |
| 354 | - }.bind(this)); | |
| 355 | - } else { | |
| 356 | - options = options || {expires: false, path: '', domain: ''}; | |
| 357 | - for (name in cookies){ | |
| 358 | - this._write(name, cookies[name], | |
| 359 | - options.expires, options.path, options.domain); | |
| 360 | - } | |
| 361 | - } | |
| 362 | - }, | |
| 363 | - | |
| 364 | - _write: function(name, value, expires, path, domain) { | |
| 365 | - if (name.indexOf('=') != -1) return; | |
| 366 | - var cookieString = name + '=' + escape(value); | |
| 367 | - if (expires) cookieString += '; expires=' + expires.toGMTString(); | |
| 368 | - if (path) cookieString += '; path=' + path; | |
| 369 | - if (domain) cookieString += '; domain=' + domain; | |
| 370 | - document.cookie = cookieString; | |
| 371 | - }, | |
| 372 | - | |
| 373 | - erase: function(cookies) { | |
| 374 | - var cookiesToErase = {}; | |
| 375 | - $A(arguments).each(function(cookie) { | |
| 376 | - cookiesToErase[cookie] = ''; | |
| 377 | - }); | |
| 378 | - | |
| 379 | - this.write(cookiesToErase, {expires: (new Date((new Date()).getTime() - 1e11))}); | |
| 380 | - this.getAll(); | |
| 381 | - }, | |
| 382 | - | |
| 383 | - eraseAll: function() { | |
| 384 | - this.erase.apply(this, $H(this.getAll()).keys()); | |
| 385 | - } | |
| 386 | - }; | |
| 387 | - | |
| 388 | - Object.extend(Cookie, { | |
| 389 | - get: Cookie.read, | |
| 390 | - set: Cookie.write, | |
| 391 | - | |
| 392 | - add: Cookie.read, | |
| 393 | - remove: Cookie.erase, | |
| 394 | - removeAll: Cookie.eraseAll, | |
| 395 | - | |
| 396 | - wipe: Cookie.erase, | |
| 397 | - wipeAll: Cookie.eraseAll, | |
| 398 | - destroy: Cookie.erase, | |
| 399 | - destroyAll: Cookie.eraseAll | |
| 400 | - }); | |
| 401 | - })(); |
public/stylesheets/comatose_admin.css
| ... | ... | @@ -0,0 +1,18 @@ |
| 1 | +require File.dirname(__FILE__) + '/../test_helper' | |
| 2 | +require 'cms_controller' | |
| 3 | + | |
| 4 | +# Re-raise errors caught by the controller. | |
| 5 | +class CmsController; def rescue_action(e) raise e end; end | |
| 6 | + | |
| 7 | +class CmsControllerTest < Test::Unit::TestCase | |
| 8 | + def setup | |
| 9 | + @controller = CmsController.new | |
| 10 | + @request = ActionController::TestRequest.new | |
| 11 | + @response = ActionController::TestResponse.new | |
| 12 | + end | |
| 13 | + | |
| 14 | + # Replace this with your real tests. | |
| 15 | + def test_truth | |
| 16 | + assert true | |
| 17 | + end | |
| 18 | +end | ... | ... |