diff --git a/app/views/comatose_admin/_form.rhtml b/app/views/comatose_admin/_form.rhtml new file mode 100644 index 0000000..0b304dc --- /dev/null +++ b/app/views/comatose_admin/_form.rhtml @@ -0,0 +1,87 @@ +<%= error_messages_for :page %> + +<% form_for :page, @page do |f| %> + +
+ + <%= f.text_field :title, :tabindex => 1, :maxlength => 255, :size => 30 %> <%= link_to_function "More...", "ComatoseEditForm.toggle_extra_fields(this)", :id => 'more-options' %> +
+ +
+ + <%= f.text_field :slug, :tabindex=>6, :maxlength=>255, :size=>50, :disabled=>@root_pages.include?(@page) %> +
+ +
+ <% if show_field? 'keywords' %> + + <%= f.text_field :keywords, :tabindex=>7, :maxlength=>1000, :size=>50 %> + <% end %> +
+ +
+ <% if show_field? 'parent' %> + + <% if mode != :new and @root_pages.include? @page %> + + <% else %> + + <% end %> + <% end %> +
+ +
+ + <%= f.text_area :body, :rows => 14, :tabindex => 2 %> +
+ +
+ <% if show_field? 'filter' %> + + <%= 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' %> + Converts plain text into html + <% end %> +
+ +
+ <% if show_field? 'created_on' %> + + <%= f.datetime_select :created_on %> + <% end %> +
+ +
+<% unless @page.updated_on.nil? %> +
+ +
+<% end %> +<%= image_tag 'comatose/spinner.gif', :id=>'spinner', :align=>'absmiddle', :style=>'display:none;' %> + <%= button_to_function('Preview', "ComatoseEditForm.preview_content('#{url_for :controller=>controller.controller_name, :action=>'preview', :id=>@page}')", :tabindex=>3, :id=>'preview-btn' ) if show_field? 'preview' %>   + <%= submit_tag ((mode == :edit) ? 'Save Changes' : 'Create Page'), :tabindex=>4 %> + <% if @page.versions.length > 0 %> +   <%= link_to "Revert", :action=>'versions', :id=>@page %> + <% end %> + or + Cancel +
+<% end %> + + + +<%= javascript_tag "ComatoseEditForm.init('#{mode.to_s}');" %> diff --git a/app/views/comatose_admin/_page_list_item.rhtml b/app/views/comatose_admin/_page_list_item.rhtml new file mode 100644 index 0000000..a83b899 --- /dev/null +++ b/app/views/comatose_admin/_page_list_item.rhtml @@ -0,0 +1,60 @@ +<%# Params: +# - page (Page Node) +# - level (integer indicating current tree depth) +# Called From: +# - index +# Description: +# This partial is used recursively. Render it with the root node, and it will recurse +# down all of the child nodes to build a list with proper indentation to indicate +# tree depth. +%> + +<% +# Create the page-level links... +links = [] +links << link_to(pluralize(page.versions.length, 'revision', 'revisions'), :action=>'versions', :id=>page) if page.versions.length > 0 +links << link_to('add child page', {:action=>'new', :parent=>page}, :title=>"Add a child to '#{page.title}'", :class=>'add-page') +links << link_to_function('reorder children', "ComatoseList.toggle_reorder('page_list_#{page.id}',this,#{page.id})", :title=>"Reorder children of '#{page.title}'", :class=>'reorder-children', :href=>url_for(:action=>'reorder', :id=>page)) if !page.children.empty? and page.children.length > 1 +links << link_to('delete', {:action=>'delete', :id=>page}, :confirm=>'This will delete this page, and any children. Are you sure?', :title=>"Delete page '#{page.title}' and all it's children", :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 +# Level check, one, two, three... +collapse_children = (level >= Comatose.config.default_tree_level) +%> + +
  • + + + + + + + + + +
    + <% if !page.children.empty? %> + <%= 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}" ) %> + <% else %> + <%= image_tag 'comatose/no-children.gif', :size=>'12x12', :class=>'tree-controller' %> + <% end %> + + <%= image_tag 'comatose/page.gif', :size=>'25x31', :align=>"absmiddle" %> + DRAG + + <%= link_to page.title, {:action=>'edit', :id=>page}, :title=>"Path:#{page.full_path}", :class=>'page' %> +
    + Updated <%= time_ago_in_words page.updated_on, true %> ago<%= " by #{page.author}" unless page.author.nil? or page.author.empty? %>, + <%= links.join(', ') %>. +
    + + + + <%= sortable_element( "page_list_#{page.id}", + :complete => visual_effect(:highlight, "page_list_#{page.id}"), + :handle=>'handle', + :update=>'flash-content', + :url => { :action => "reorder", :id=>page } ) if !page.children.empty? and page.children.length > 1 %> +
  • diff --git a/app/views/comatose_admin/delete.rhtml b/app/views/comatose_admin/delete.rhtml new file mode 100644 index 0000000..c8a4857 --- /dev/null +++ b/app/views/comatose_admin/delete.rhtml @@ -0,0 +1,18 @@ +

    + Page Delete Confirmation +

    + +
    +

    Are you sure you want to delete the page titled "<%= @page.title %>"?

    +<% unless @page.children.empty? %> +

    It has <%= @page.children.length %> child pages that will also be deleted...

    +<% end %> +
    + +<%= start_form_tag %> +
    + <%= submit_tag "Yes, Delete The Page" %> + or + <%= link_to "Cancel", :action=>'index' %> +
    +<%= end_form_tag %> diff --git a/app/views/comatose_admin/edit.rhtml b/app/views/comatose_admin/edit.rhtml new file mode 100644 index 0000000..ce88c58 --- /dev/null +++ b/app/views/comatose_admin/edit.rhtml @@ -0,0 +1,5 @@ +

    + Edit Page +

    + +<%= render :partial=>'form', :locals=>{:mode=>:edit} %> \ No newline at end of file diff --git a/app/views/comatose_admin/index.rhtml b/app/views/comatose_admin/index.rhtml new file mode 100644 index 0000000..cc7563e --- /dev/null +++ b/app/views/comatose_admin/index.rhtml @@ -0,0 +1,18 @@ +
    + <%= link_to 'Clear Page Cache', :controller=>controller.controller_name, :action=>'expire_page_cache' %> +
    + +

    + Page List + <%= image_tag 'comatose/spinner.gif', :id=>'spinner', :align=>'absmiddle', :style=>'display:none;' %> +

    + + + +
    + +<%= javascript_tag "ComatoseList.init()" %> diff --git a/app/views/comatose_admin/new.rhtml b/app/views/comatose_admin/new.rhtml new file mode 100644 index 0000000..0291832 --- /dev/null +++ b/app/views/comatose_admin/new.rhtml @@ -0,0 +1,5 @@ +

    + New Page +

    + +<%= render :partial=>'form', :locals=>{:mode=>:new} %> \ No newline at end of file diff --git a/app/views/comatose_admin/reorder.rhtml b/app/views/comatose_admin/reorder.rhtml new file mode 100644 index 0000000..bb8a549 --- /dev/null +++ b/app/views/comatose_admin/reorder.rhtml @@ -0,0 +1,30 @@ +

    Reorder Pages

    + +

    "<%= @page.title %>" child pages:

    + + + +
    + <%= link_to "Finished", :action=>'index' %> +
    \ No newline at end of file diff --git a/app/views/comatose_admin/versions.rhtml b/app/views/comatose_admin/versions.rhtml new file mode 100644 index 0000000..8dc5910 --- /dev/null +++ b/app/views/comatose_admin/versions.rhtml @@ -0,0 +1,40 @@ +

    Page Revisions

    +
    +
    +
    +
    + <% form_tag :action => 'versions', :id => @page, :html => { :method => :get } do %> + View Version: <%= select_tag "version", options_from_collection_for_select(@page.versions, 'version', 'version', @version_num), {'onchange'=>'this.form.submit();'} %> + <%= submit_tag 'Go', {'id'=>'go-btn'} %> + <% end %> +
    + Version <%= @version_num %> +
    +
    + + + +
    + <%= @version.body.split("\n").join('
    ') unless @version.body.nil? %> + +
    + +
    +
    + Current Version +
    +
    + + + +
    + <%= @page.body.split("\n").join('
    ') unless @page.body.nil? %> +
    + +
     
    diff --git a/app/views/layouts/application.rhtml b/app/views/layouts/application.rhtml index b205a2b..3ea53e4 100644 --- a/app/views/layouts/application.rhtml +++ b/app/views/layouts/application.rhtml @@ -1,28 +1,58 @@ - - + - - Comatose Admin - <%= stylesheet_link_tag 'comatose_admin' %> <%= javascript_include_tag :defaults %> + <%= stylesheet_link_tag 'common' %> + <%= design_all_header_tags %> <%= javascript_include_tag 'comatose_admin' %> + <% if params[:controller] == 'comatose_admin' %> + <%= stylesheet_link_tag 'comatose_admin' %> + <% end %> + + -
    -