From 3524ef0c26f8760615c01217045c72f9bb20dde9 Mon Sep 17 00:00:00 2001 From: Richard Worth Date: Sat, 7 Jun 2008 17:35:27 +0000 Subject: removed extra level ui folder --- demos/real-world/layout/demo.css | 42 +++++++++++++++ demos/real-world/layout/demo.js | 97 ++++++++++++++++++++++++++++++++++ demos/real-world/layout/index.html | 94 ++++++++++++++++++++++++++++++++ demos/real-world/layout/loader.gif | Bin 0 -> 4782 bytes demos/real-world/layout/loader_bg.gif | Bin 0 -> 317 bytes 5 files changed, 233 insertions(+) create mode 100644 demos/real-world/layout/demo.css create mode 100644 demos/real-world/layout/demo.js create mode 100644 demos/real-world/layout/index.html create mode 100644 demos/real-world/layout/loader.gif create mode 100644 demos/real-world/layout/loader_bg.gif (limited to 'demos/real-world/layout') diff --git a/demos/real-world/layout/demo.css b/demos/real-world/layout/demo.css new file mode 100644 index 000000000..a7b108623 --- /dev/null +++ b/demos/real-world/layout/demo.css @@ -0,0 +1,42 @@ +body { background-color:#666; color:#FFF; font:11px/1.5 Arial, sans-serif; margin:0; overflow:hidden; padding:30px 0 0 30px; } +h1 { font-size:18px; margin:0 0 20px; } +a { color:#FFF; } + +.clear { clear:both; font-size:1px; line-height:1px; } + +#overlay { background:#666; height:100%; left:0; position:absolute; top:0; width:100%; z-index:2000; } +#overlay #preloader { background:url(loader_bg.gif) no-repeat; height:50px; left:50%; line-height:50px; margin:-25px 0 0 -25px; position:absolute; text-align:center; top:50%; width:50px; } +#overlay #preloader img { margin:11px 0 0 0; vertical-align:middle; } + +.ui-sortable { background-color:#FFF; border:1px solid #555; color:#222; margin:0 15px 15px 0; padding:0 10px 10px; width:175px; } +.ui-sortable h2 { background-color:#555; border-top:3px solid #666; color:#FFF; font-size:11px; margin:0 -10px 10px; line-height:2; padding:0 10px; } + +dl.sort { color:#222; margin:10px 0; } +#uidemo dl.first { margin-top:0; } +#uidemo dl.last { margin-bottom:0; } + +dl.sort dt { background-color:#666; color:#FFF; cursor:move; height:2em; line-height:2; padding:0 6px; position:relative; } +dl.sort dd { background-color:#FFF; margin:0; padding:3px 6px; } + +.ui-sortable-helper { width:175px; } +.placeholder { border:1px dashed #AAA; } + +span.options { cursor:default; font-size:1px; line-height:1px; position:absolute; } +span.options a { background-color:#FFF; cursor:pointer; display:block; float:left; text-indent:-9000px; } + +.ui-sortable h2 span.options { right:10px; top:8px; width:30px; } +.ui-sortable h2 span.options a { height:12px; width:30px; } + +dl.sort dt span.options { right:5px; top:5px; width:27px; } +dl.sort dt span.options a { height:12px; width:12px; } +dl.sort dt span.options a.up { margin-right:3px; } +dl.sort dt span.options a.disabled { background-color:#555; cursor:default; } + +#container { float:left; } +#header { width:638px; } +#content { float:left; width:400px; } +#sidebar { float:left; width:200px; } +#footer { width:638px; } +#trashcan { float:left; } + +#trashcan p { margin:0; } \ No newline at end of file diff --git a/demos/real-world/layout/demo.js b/demos/real-world/layout/demo.js new file mode 100644 index 000000000..695863f25 --- /dev/null +++ b/demos/real-world/layout/demo.js @@ -0,0 +1,97 @@ +(function($){ + var updateUpDown = function(sortable){ + $('dl:not(.ui-sortable-helper)', sortable) + .removeClass('first').removeClass('last') + .find('.up, .down').removeClass('disabled').end() + .filter(':first').addClass('first').find('.up').addClass('disabled').end().end() + .filter(':last').addClass('last').find('.down').addClass('disabled').end().end(); + }; + + var moveUpDown = function(){ + var link = $(this), + dl = link.parents('dl'), + prev = dl.prev('dl'), + next = dl.next('dl'); + + if(link.is('.up') && prev.length > 0) + dl.insertBefore(prev); + + if(link.is('.down') && next.length > 0) + dl.insertAfter(next); + + updateUpDown(dl.parent()); + }; + + var addItem = function(){ + var sortable = $(this).parents('.ui-sortable'); + var options = 'updown'; + var tpl = '
{name}' + options + '
{desc}
'; + var html = tpl.replace(/{name}/g, 'Dynamic name :D').replace(/{desc}/g, 'Description'); + + sortable.append(html).sortable('refresh').find('a.up, a.down').bind('click', moveUpDown); + updateUpDown(sortable); + }; + + var emptyTrashCan = function(item){ + item.remove(); + }; + + var sortableChange = function(e, ui){ + if(ui.sender){ + var w = ui.element.width(); + ui.placeholder.width(w); + ui.helper.css("width",ui.element.children().width()); + } + }; + + var sortableUpdate = function(e, ui){ + if(ui.element[0].id == 'trashcan'){ + emptyTrashCan(ui.item); + } else { + updateUpDown(ui.element[0]); + if(ui.sender) + updateUpDown(ui.sender[0]); + } + }; + + $(document).ready(function(){ + var els = ['#header', '#content', '#sidebar', '#footer', '#trashcan']; + var $els = $(els.toString()); + + $('h2', $els.slice(0,-1)).append('add'); + $('dt', $els).append('updown'); + + $('a.add').bind('click', addItem); + $('a.up, a.down').bind('click', moveUpDown); + + $els.each(function(){ + updateUpDown(this); + }); + + $els.sortable({ + items: '> dl', + handle: 'dt', + cursor: 'move', + //cursorAt: { top: 2, left: 2 }, + //opacity: 0.8, + //helper: 'clone', + appendTo: 'body', + //placeholder: 'clone', + //placeholder: 'placeholder', + connectWith: els, + start: function(e,ui) { + ui.helper.css("width", ui.item.width()); + }, + change: sortableChange, + update: sortableUpdate + }); + }); + + $(window).bind('load',function(){ + setTimeout(function(){ + $('#overlay').fadeOut(function(){ + $('body').css('overflow', 'auto'); + }); + }, 750); + }); +})(jQuery); \ No newline at end of file diff --git a/demos/real-world/layout/index.html b/demos/real-world/layout/index.html new file mode 100644 index 000000000..83f9d0378 --- /dev/null +++ b/demos/real-world/layout/index.html @@ -0,0 +1,94 @@ + + + + UI Sortable: Layout Demo + + + + + + + + + + + + + + + + + + +

UI Sortable: Layout demo

+ +
+ + +
+

Content

+
+
Blog
+
Main blog post
+
+
+ + + +
+ + +
+ +
+

Trash can

+

Drag modules here to delete them.

+
+ +
+
+
+
+ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/demos/real-world/layout/loader.gif b/demos/real-world/layout/loader.gif new file mode 100644 index 000000000..7e717cdf9 Binary files /dev/null and b/demos/real-world/layout/loader.gif differ diff --git a/demos/real-world/layout/loader_bg.gif b/demos/real-world/layout/loader_bg.gif new file mode 100644 index 000000000..9c0488402 Binary files /dev/null and b/demos/real-world/layout/loader_bg.gif differ -- cgit v1.2.3