-
Notifications
You must be signed in to change notification settings - Fork 141
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds demos for horizontal lists and useSwap=false
- Loading branch information
Showing
8 changed files
with
71 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import Ember from 'ember'; | ||
|
||
export default Ember.Controller.extend({ | ||
useSwap: true, | ||
sortFinishText: null, | ||
sortableObjectList: Ember.A( | ||
[{id: 1, title:'Number 1'}, | ||
{id: 2, title:'Number 2'}, | ||
{id: 3, title:'Number 3'}, | ||
{id: 4, title:'Number 4'}, | ||
{id: 5, title:'Number 5'}, | ||
{id: 6, title:'Number 6'}, | ||
{id: 7, title:'Number 7'}, | ||
{id: 8, title:'Number 8'}] | ||
), | ||
|
||
actions: { | ||
sortEndAction: function() { | ||
console.log('Sort Ended', this.get('sortableObjectList')); | ||
} | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import Ember from 'ember'; | ||
|
||
export default Ember.Route.extend({ | ||
|
||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<h3>A Horizontal sorting example</h3> | ||
<p>When using a horizontal list, you probably want to change the sorting algorithm.<br> | ||
This demo demonstrates the different between the flag useSwap=true (default) and useSwap=false | ||
</p> | ||
|
||
<div class="u-fullBlock u-pullLeft"> | ||
<p>In this template the sortable-objects passes in 'useSwap'</p> | ||
<p>{{input type="checkbox" checked=useSwap}} useSwap={{#if useSwap}}true{{else}} false{{/if}}</p> | ||
<p>Typically for a horizontal list, sending in useSwap=false is the right choice. <br>By default (useSwap=true) the box being dragged will be swapped with the item it's over. <br>If useSwap=false the item will be swapped with the one it's over and the items in the list under it will be pushed down the line.</p> | ||
<div class="u-pullLeft"> | ||
{{#sortable-objects sortableObjectList=sortableObjectList sortEndAction='sortEndAction' useSwap=useSwap}} | ||
{{#each sortableObjectList as |item|}} | ||
{{#draggable-object content=item overrideClass='sortObject u-pullLeft' isSortable=true}} | ||
{{item.title}} | ||
{{/draggable-object}} | ||
{{/each}} | ||
{{/sortable-objects}} | ||
</div> | ||
<div class="u-fullBlock"> | ||
<h3>Order of objects is:</h3> | ||
<ul> | ||
{{#each sortableObjectList as |item|}} | ||
<li>id:{{item.id}}, title:{{item.title}}</li> | ||
{{/each}} | ||
</ul> | ||
</div> | ||
</div> | ||
<br><br> | ||
<div class="u-fullBlock"> | ||
Template is here: <a href="https://github.com/mharris717/ember-drag-drop/blob/master/tests/dummy/app/templates/horizontal.hbs" target="_blank">https://github.com/mharris717/ember-drag-drop/blob/master/tests/dummy/app/templates/horizontal.hbs</a> | ||
<br>Controller is here: <a href="https://github.com/mharris717/ember-drag-drop/blob/master/tests/dummy/app/controllers/horizontal.js" target="_blank">https://github.com/mharris717/ember-drag-drop/blob/master/tests/dummy/app/controllers/horizontal.js</a> | ||
<br>Route is here: <a href="https://github.com/mharris717/ember-drag-drop/blob/master/tests/dummy/app/routes/horizontal.js" target="_blank">https://github.com/mharris717/ember-drag-drop/blob/master/tests/dummy/app/routes/horizontal.js</a> | ||
</div> | ||
|
||
|
||
|