-
Notifications
You must be signed in to change notification settings - Fork 572
/
Copy pathdnd-ctrl-as-syntax.html
86 lines (81 loc) · 3.11 KB
/
dnd-ctrl-as-syntax.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
<!DOCTYPE html>
<html ng-app="drag-and-drop">
<head lang="en">
<meta charset="utf-8">
<title>Drag & Drop: Guess A Name</title>
<!-- <script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1/jquery-ui.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.0/angular.min.js"></script>
<link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1/themes/base/jquery-ui.css" rel="stylesheet" type="text/css" />
<link href="http://netdna.bootstrapcdn.com/twitter-bootstrap/2.1.1/css/bootstrap.min.css" rel="stylesheet"> -->
<script src="../components/jquery/dist/jquery.min.js"></script>
<script src="../components/jquery-ui/jquery-ui.min.js"></script>
<script src="../components/angular/angular.min.js"></script>
<script src="../src/angular-dragdrop.js"></script>
<link href="assets/css/bootstrap.min.css" rel="stylesheet">
<style>
body {
padding: 30px;
}
.thumbnail {
height: 50px;
width: 50px;
text-align: center;
padding-top: 0px;
transition: none;
-webkit-transition: none;
-moz-transition: none;
-o-transition: none;
cursor: pointer;
background: rgb(182, 173, 123);
}
.thumbnail[data-drag="false"] { background: green; }
li {
height: 56px;
width: 60px;
line-height: 20px;
border: 1px solid #ddd;
padding: 3px;
margin-left: 10px;
}
</style>
<script type="text/javascript">
var App = angular.module('drag-and-drop', ['ngDragDrop']);
App.controller('oneCtrl', function($scope) {
$scope.list1 = [
{ 'title': 'L', 'drag': true },
{ 'title': 'O', 'drag': true },
{ 'title': 'M', 'drag': true },
{ 'title': 'L', 'drag': true },
{ 'title': 'G', 'drag': true },
{ 'title': 'U', 'drag': true }
];
this.dropCallback = function(event, ui, title, $index) {
if ($scope.list1.map(function(item) { return item.title; }).join('') === 'GOLLUM') {
$scope.list1.forEach(function(value, key) { $scope.list1[key].drag = false; });
}
};
});
</script>
</head>
<body>
<h2>Whose dialog is it? <em>"What is it, Precious? What is it?"</em></h2>
<div ng-controller="oneCtrl as loki">
<div class='contentWrapper ng-cloak'>
<div class='content'>
<div class="row-fluid">
<ul class="thumbnails">
<li ng-repeat="item in list1" data-drop="true" ng-model='list1' jqyoui-droppable="{index: {{$index}}, onDrop:'loki.dropCallback(item.title, $index)'}">
<div class="thumbnail" data-drag="{{item.drag}}" data-jqyoui-options="{revert: 'invalid'}" ng-model="list1" jqyoui-draggable="{index: {{$index}},animate:true}">
<h1>
{{item.title}}
</h1>
</div>
</li>
</ul>
</div>
</div>
</div>
</div>
</body>
</html>