Skip to content
This repository has been archived by the owner on Oct 24, 2022. It is now read-only.

Commit

Permalink
Handle aborted drags
Browse files Browse the repository at this point in the history
closes #289
  • Loading branch information
JPrevost committed Jul 15, 2015
1 parent 4274c8c commit ab5dc6f
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions app/views/subscriber/dashboard.scala.html
Expand Up @@ -75,7 +75,7 @@ <h4>Destinations</h4>
<h4>Subscriptions by Plan</h4>
<div class="row">
<div class="col-md-3">
<ul class="list-group" id="noplan" ondragenter="return false" ondragover="return false" ondragstart="handleDragStart(event)" ondrop="handleDrop(event, this)">
<ul class="list-group" id="noplan" ondragenter="return false" ondragover="return false" ondragstart="handleDragStart(event)" ondrop="handleDrop(event, this)" ondragend="handleDragEnd(event)">
<h5>Unassigned Schemes</h5>
<h5>[No destination]</h5>
@for(s <- sub.unplannedSchemes) {
Expand All @@ -89,7 +89,7 @@ <h5>[No destination]</h5>
</div>
@for(plan <- sub.plans) {
<div class="col-md-3">
<ul class="list-group" id="plan-@plan.id" ondragenter="return false" ondragover="return false" ondragstart="handleDragStart(event)" ondrop="handleDrop(event, this)">
<ul class="list-group" id="plan-@plan.id" ondragenter="return false" ondragover="return false" ondragstart="handleDragStart(event)" ondrop="handleDrop(event, this)" ondragend="handleDragEnd(event)">
<h5>@plan.name <span class="glyphicon glyphicon-@plan.icon" aria-hidden="true"></span></h5>
<h5 id="chanplan-@plan.id">@plan.channel.get.description</h5>
@for(s <- plan.schemes) {
Expand Down Expand Up @@ -156,6 +156,11 @@ <h6>Note: Drag a scheme from/to unassigned to a plan to enable/disable subscript
}
}

function handleDragEnd(event) {
$("#noplan").removeClass("validtarget");
$("[id^=plan-]").removeClass("validtarget");
}

function handleDrop(event, target) {
var srcId = event.dataTransfer.getData('text/x-dbid');
var source = document.getElementById(srcId);
Expand Down

0 comments on commit ab5dc6f

Please sign in to comment.