Skip to content
This repository has been archived by the owner on Aug 15, 2018. It is now read-only.

Commit

Permalink
Removed jqmodal stuff for content section editing.
Browse files Browse the repository at this point in the history
  • Loading branch information
jamescook committed Sep 17, 2008
1 parent fc66871 commit be4d22e
Show file tree
Hide file tree
Showing 9 changed files with 75 additions and 109 deletions.
1 change: 0 additions & 1 deletion app/views/admin/pages/edit.html.erb
Expand Up @@ -22,7 +22,6 @@
</ul>
<%= link_to "Add Plugin", new_admin_page_plugin_path(:page_id => @page.id) -%>
<% end -%>
<div id="modal" class="jqmWindow"></div>
<% if @page.display_title %>
<h2><%= @page.full_title %></h2>
Expand Down
3 changes: 2 additions & 1 deletion app/views/layouts/admin.html.erb
Expand Up @@ -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' %>
<!--[if lt IE 7.]><%= javascript_include_tag 'pngfix.js' %><![endif]-->
</head>
<body>
Expand Down
74 changes: 37 additions & 37 deletions public/javascripts/ansuz/growls.js
Expand Up @@ -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
// }
// }
// })
});
16 changes: 16 additions & 0 deletions 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 <li>.
function add_new_list_item(list_item)
{

}
});
51 changes: 0 additions & 51 deletions 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 <li>.
function add_new_list_item(list_item)
{

}
});
10 changes: 5 additions & 5 deletions public/javascripts/jquery.growl.js
Expand Up @@ -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('<link rel="stylesheet" type="text/css" href="' + jQuery.growl.settings.defaultStylesheet + '" />');
}

} else {
instance = $(instance);
instance = jQuery(instance);
}
jQuery('body').append(instance.css(jQuery.growl.settings.dockCss));
return instance;
Expand All @@ -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);;
Expand Down Expand Up @@ -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);
@@ -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
Expand All @@ -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
Expand Down

This file was deleted.

@@ -1,6 +1,8 @@
<h1>Editing Content Section</h1>
<% 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) -%><br />
<%= fckeditor_textarea(:content_section, :contents, :toolbarSet => 'Simple', :width => '100%', :height => '400px') -%><br />
<%= submit_tag("Update Content Section") -%>
<%= fckeditor_textarea(:content_section, :contents, :toolbarSet => 'Simple', :width => '100%', :height => '400px', :ajax => true) -%><br />
<%= submit_tag("Update Content Section", :id => 'close_modal_and_flash') -%>
<% end -%>
<div class="clear"></div>
<%= link_to("Back", :back)%>

0 comments on commit be4d22e

Please sign in to comment.