From be4d22e643ec2e72531a0356973c182d248cc74d Mon Sep 17 00:00:00 2001 From: jamescook Date: Tue, 16 Sep 2008 20:15:13 -0500 Subject: [PATCH] Removed jqmodal stuff for content section editing. --- app/views/admin/pages/edit.html.erb | 1 - app/views/layouts/admin.html.erb | 3 +- public/javascripts/ansuz/growls.js | 74 +++++++++---------- public/javascripts/ansuz/tree.js | 16 ++++ public/javascripts/application.js | 51 ------------- public/javascripts/jquery.growl.js | 10 +-- .../content_sections_controller.rb | 14 +++- .../app/views/content_sections/_edit.html.erb | 7 -- .../app/views/content_sections/edit.html.erb | 8 +- 9 files changed, 75 insertions(+), 109 deletions(-) create mode 100644 public/javascripts/ansuz/tree.js delete mode 100644 vendor/plugins/ansuz_content_section/app/views/content_sections/_edit.html.erb diff --git a/app/views/admin/pages/edit.html.erb b/app/views/admin/pages/edit.html.erb index cd50b4d..eb1599c 100644 --- a/app/views/admin/pages/edit.html.erb +++ b/app/views/admin/pages/edit.html.erb @@ -22,7 +22,6 @@ <%= link_to "Add Plugin", new_admin_page_plugin_path(:page_id => @page.id) -%> <% end -%> - <% if @page.display_title %>

<%= @page.full_title %>

diff --git a/app/views/layouts/admin.html.erb b/app/views/layouts/admin.html.erb index 44c591e..80d4626 100644 --- a/app/views/layouts/admin.html.erb +++ b/app/views/layouts/admin.html.erb @@ -18,9 +18,10 @@ <%= javascript_include_tag :defaults -%> <%= javascript_include_tag 'jquery' -%> <%= javascript_tag "jQuery.noConflict();" -%> - <%= javascript_include_tag 'jqModal', 'jquery.growl.js', 'ansuz/growls' %> + <%= javascript_include_tag 'jquery.growl.js', 'ansuz/growls' %> <%= javascript_include_tag 'show_and_hide' %> <%= javascript_include_tag 'fckeditor/fckeditor' %> + <%= javascript_include_tag 'ansuz/tree' %> diff --git a/public/javascripts/ansuz/growls.js b/public/javascripts/ansuz/growls.js index 6081af5..9d39ed0 100644 --- a/public/javascripts/ansuz/growls.js +++ b/public/javascripts/ansuz/growls.js @@ -47,42 +47,42 @@ function notify(message, title) jQuery(document).ready(function() { // Prevent the default growl settings from being overwritten. - $default_growl_settings = jQuery.growl.settings; + $default_growl_settings = jQuery.growl.settings; - var jq = jQuery.noConflict(); - jq('a.edit_page_plugin', jq('#page_plugins')).click(function() - { - var modal = jq('#modal'); - jq.ajax({ - type: 'GET', - url: jq(this).attr('href'), - complete: function(transport) - { - modal.jqm({overlay: 50}); - - jq('a.jqmClose').click(function(){ - jq(this).jqmHide(); - return false; - }); - - modal.jqmHide(); - modal.html(transport.responseText) - modal.jqmShow(); - } - }); - return false - }); - - // Make ESC close modal windows - jq(document).keypress(function(e) - { - if( e.which === 0 ) - { - var windows = jq('#modal, .jqmWindow'); - if( windows ) - { - windows.jqmHide(); // doesn't seem to work with the iframe > textarea thing focused. meh - } - } - }) + // var jq = jQuery.noConflict(); + // jq('a.edit_page_plugin', jq('#page_plugins')).click(function() + // { + // var modal = jq('#modal'); + // jq.ajax({ + // type: 'GET', + // url: jq(this).attr('href'), + // complete: function(transport) + // { + // modal.jqm({overlay: 50}); + // + // jq('a.jqmClose').click(function(){ + // jq(this).jqmHide(); + // return false; + // }); + // + // modal.jqmHide(); + // modal.html(transport.responseText) + // modal.jqmShow(); + // } + // }); + // return false + // }); + // + // // Make ESC close modal windows + // jq(document).keypress(function(e) + // { + // if( e.which === 0 ) + // { + // var windows = jq('#modal, .jqmWindow'); + // if( windows ) + // { + // windows.jqmHide(); // doesn't seem to work with the iframe > textarea thing focused. meh + // } + // } + // }) }); \ No newline at end of file diff --git a/public/javascripts/ansuz/tree.js b/public/javascripts/ansuz/tree.js new file mode 100644 index 0000000..ff37dcc --- /dev/null +++ b/public/javascripts/ansuz/tree.js @@ -0,0 +1,16 @@ + +jQuery(document).ready(function() +{ + jQuery("div.page_controls ul li.direction a").click(function() + { + var direction; + + return false; + }); + + // Clone a given list item, hide it and insert it above the specified
  • . + function add_new_list_item(list_item) + { + + } +}); diff --git a/public/javascripts/application.js b/public/javascripts/application.js index 1bdff50..fe45776 100644 --- a/public/javascripts/application.js +++ b/public/javascripts/application.js @@ -1,53 +1,2 @@ // Place your application-specific JavaScript functions and classes here // This file is automatically included by javascript_include_tag :defaults - - -// TESTING. I know this stuff doesn't go here -jQuery(document).ready(function() -{ - jQuery("div.page_controls ul li.direction a").click(function() - { - var easing; - var link = jQuery(this); - var li = link.parents('li'); - var parent_li = li.parents('li:first'); - - var above = parent_li.prevAll('li'); - var below = parent_li.nextAll('li'); - var cur_offset = link.parents('li.main_node').offset(); - - - if( parent_li.hasClass('up') ) - { - if( above.length > 0 ) - { - easing = "+=25px"; - } - - } else { - if( below.length > 0 ) - { - easing = "-=25px"; - } - } - - if( easing !== undefined) - { - var container = jQuery("yui-g"); - li.css("top", cur_offset.top); - li.css("left", cur_offset.left); - var last_position = li.css("position"); - li.css("position", "fixed"); - //container.animate({"height": easing}, "fast", "swing" }); - li.animate({"top": easing}, "slow", "swing", function() { li.css("position", last_position)}); - } - - return false; - }); - - // Clone a given list item, hide it and insert it above the specified
  • . - function add_new_list_item(list_item) - { - - } -}); diff --git a/public/javascripts/jquery.growl.js b/public/javascripts/jquery.growl.js index 0775cb0..3e6d509 100644 --- a/public/javascripts/jquery.growl.js +++ b/public/javascripts/jquery.growl.js @@ -58,13 +58,13 @@ jQuery.growl.version = "1.0.0-b2"; function create(rebuild) { var instance = document.getElementById('growlDock'); if(!instance || rebuild) { - instance = $(jQuery.growl.settings.dockTemplate).attr('id', 'growlDock').addClass('growl'); + instance = jQuery(jQuery.growl.settings.dockTemplate).attr('id', 'growlDock').addClass('growl'); if(jQuery.growl.settings.defaultStylesheet) { $('head').append(''); } } else { - instance = $(instance); + instance = jQuery(instance); } jQuery('body').append(instance.css(jQuery.growl.settings.dockCss)); return instance; @@ -80,13 +80,13 @@ function r(text, expr, val) { function notify(title,message,image,priority) { var instance = create(); var html = jQuery.growl.settings.noticeTemplate; - if(typeof(html) == 'object') html = $(html).html(); + if(typeof(html) == 'object') html = jQuery(html).html(); html = r(html, /%message%/, (message?message:'')); html = r(html, /%title%/, (title?title:'')); html = r(html, /%image%/, (image?image:jQuery.growl.settings.defaultImage)); html = r(html, /%priority%/, (priority?priority:'normal')); - var notice = $(html) + var notice = jQuery(html) .hide() .css(jQuery.growl.settings.noticeCss) .fadeIn(jQuery.growl.settings.notice);; @@ -134,7 +134,7 @@ jQuery.growl.settings = { defaultImage: 'growl.jpg', defaultStylesheet: null, noticeElement: function(el) { - jQuery.growl.settings.noticeTemplate = $(el); + jQuery.growl.settings.noticeTemplate = jQuery(el); } }; })(jQuery); \ No newline at end of file diff --git a/vendor/plugins/ansuz_content_section/app/controllers/content_sections_controller.rb b/vendor/plugins/ansuz_content_section/app/controllers/content_sections_controller.rb index d55409c..1433b4c 100644 --- a/vendor/plugins/ansuz_content_section/app/controllers/content_sections_controller.rb +++ b/vendor/plugins/ansuz_content_section/app/controllers/content_sections_controller.rb @@ -1,9 +1,16 @@ class ContentSectionsController < ApplicationController unloadable # This is required if you subclass a controller provided by the base rails app - layout 'admin' + before_filter :load_admin_plugin_nav before_filter :load_content_section, :only => [:show, :edit, :update] + protected + # This method duplicated from admin/base_controller + def load_admin_plugin_nav + # The plugin nav comes across as an array of arrays like [text, url] + @admin_plugin_nav = Ansuz::PluginManagerInstance.admin_plugin_nav + end + def load_content_section @content_section = Ansuz::JAdams::ContentSection.find(params[:id]) end @@ -12,17 +19,16 @@ def show end def edit - render :partial => 'edit', :layout => false end def update if @content_section.update_attributes(params[:content_section]) render :update do |page| - page << "notify('Content Section has been updated'); jQuery('#modal').jqmHide();" + page << "notify('Content Section has been updated');" end else render :update do |page| - page << "notify('An error occurred updating the content section'); jQuery('#modal').jqmHide();" + page << "notify('An error occurred updating the content section');" end end end diff --git a/vendor/plugins/ansuz_content_section/app/views/content_sections/_edit.html.erb b/vendor/plugins/ansuz_content_section/app/views/content_sections/_edit.html.erb deleted file mode 100644 index 0bac8f3..0000000 --- a/vendor/plugins/ansuz_content_section/app/views/content_sections/_edit.html.erb +++ /dev/null @@ -1,7 +0,0 @@ -
    X
    -

    Editing Content Section

    -<% remote_form_for :content_section, @content_section, :url => content_section_path(@content_section), :html => { :method => :put }, :before => fckeditor_before_js(:content_section, :contents) do |f| -%> - <%= f.text_field(:name) -%>
    - <%= fckeditor_textarea(:content_section, :contents, :toolbarSet => 'Simple', :width => '100%', :height => '400px', :ajax => true) -%>
    - <%= submit_tag("Update Content Section", :id => 'close_modal_and_flash') -%> -<% end -%> diff --git a/vendor/plugins/ansuz_content_section/app/views/content_sections/edit.html.erb b/vendor/plugins/ansuz_content_section/app/views/content_sections/edit.html.erb index d3d69ed..ee8c363 100644 --- a/vendor/plugins/ansuz_content_section/app/views/content_sections/edit.html.erb +++ b/vendor/plugins/ansuz_content_section/app/views/content_sections/edit.html.erb @@ -1,6 +1,8 @@

    Editing Content Section

    -<% form_for :content_section, :url => content_section_path(@content_section), :html => { :method => :put } do -%> +<% remote_form_for :content_section, @content_section, :url => content_section_path(@content_section), :html => { :method => :put }, :before => fckeditor_before_js(:content_section, :contents) do |f| -%> <%= f.text_field(:name) -%>
    - <%= fckeditor_textarea(:content_section, :contents, :toolbarSet => 'Simple', :width => '100%', :height => '400px') -%>
    - <%= submit_tag("Update Content Section") -%> + <%= fckeditor_textarea(:content_section, :contents, :toolbarSet => 'Simple', :width => '100%', :height => '400px', :ajax => true) -%>
    + <%= submit_tag("Update Content Section", :id => 'close_modal_and_flash') -%> <% end -%> +
    +<%= link_to("Back", :back)%> \ No newline at end of file