Skip to content

Commit

Permalink
Added a trash bin for drag and drop. Marginal.
Browse files Browse the repository at this point in the history
  • Loading branch information
jmhobbs committed Apr 15, 2010
1 parent d3c2c35 commit 209f516
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
15 changes: 15 additions & 0 deletions css/screen.css
Expand Up @@ -78,3 +78,18 @@ pre {
padding: 10px;
display: inline-block;
}
.trash {
display: inline-block;
background: #FAA;
padding: 5px;
border: 1px solid #F00;
list-style: none;
margin: 0;
font-size: 10px;
font-weight: bold;
}
.trash > li {
margin: 0;
display: inline-block;
padding: 0;
}
3 changes: 2 additions & 1 deletion js/mklst.js
Expand Up @@ -13,7 +13,8 @@ var MkLst = {
}
}
MkLst.list = $( "#list" );
MkLst.list.sortable( { start: function () { MkLst.sorting = true; } } );
$( ".trash" ).sortable( { cancel: '.ignore', receive: function( event, ui ) { ui.item.remove(); MkLst.sorting = false; MkLst.saved = false; } } );
MkLst.list.sortable( { start: function () { MkLst.sorting = true; }, connectWith: '.trash' } );
$( ".add" ).click( MkLst.createListItem );
$( ".list-item" ).click( MkLst.editListItem );
$( "#name" ).click( MkLst.editName );
Expand Down
2 changes: 2 additions & 0 deletions protected/views/list/view.php
Expand Up @@ -12,6 +12,7 @@
<div class="buttons">
<button class="add">Add Item +</button>
<button class="save">Save</button>
<ul class="trash"><li class="ignore">Trash</li></ul>
</div>
<?php endif; ?>

Expand All @@ -33,6 +34,7 @@
<div class="buttons">
<button class="add">Add Item +</button>
<button class="save">Save</button>
<ul class="trash"><li class="ignore">Trash</li></ul>
</div>

<form id="edit-form" method="POST"><input type="hidden" name="list-value" id="list-value" value="" /></form>
Expand Down

0 comments on commit 209f516

Please sign in to comment.