Skip to content

Commit

Permalink
v1.2.0 - Made Compatibility fixes for KO 3.5.0 and 3.5.1
Browse files Browse the repository at this point in the history
  • Loading branch information
rniemeyer committed Nov 7, 2019
1 parent 679e175 commit 4ea028d
Show file tree
Hide file tree
Showing 11 changed files with 224 additions and 202 deletions.
11 changes: 7 additions & 4 deletions build/knockout-sortable.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// knockout-sortable 1.1.1 | (c) 2019 Ryan Niemeyer | http://www.opensource.org/licenses/mit-license
// knockout-sortable 1.2.0 | (c) 2019 Ryan Niemeyer | http://www.opensource.org/licenses/mit-license
;(function(factory) {
if (typeof define === "function" && define.amd) {
// AMD anonymous module
Expand Down Expand Up @@ -41,13 +41,16 @@
//prepare the proper options for the template binding
var prepareTemplateOptions = function(valueAccessor, dataName) {
var result = {},
options = unwrap(valueAccessor()) || {},
options = {},
actualAfterRender;

//build our options to pass to the template engine
if (options.data) {
if (ko.utils.peekObservable(valueAccessor()).data) {
options = unwrap(valueAccessor() || {});
result[dataName] = options.data;
result.name = options.template;
if (options.hasOwnProperty("template")) {
result.name = options.template;
}
} else {
result[dataName] = valueAccessor();
}
Expand Down
4 changes: 2 additions & 2 deletions build/knockout-sortable.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions examples/connectedLists.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<script type='text/javascript' src='../ext/jquery-1.9.1.js'></script>
<script type="text/javascript" src="../ext/jquery-ui.js"></script>

<script type='text/javascript' src="../ext/knockout-3.4.0.js"></script>
<script type='text/javascript' src="../ext/knockout-3.5.1.js"></script>
<script type='text/javascript' src="../build/knockout-sortable.min.js"></script>

<style type='text/css'>
Expand Down Expand Up @@ -85,7 +85,7 @@ <h3>Normal Priority</h3>
<hr/>
<h3>Trash</h3>

<div class="trash" data-bind="sortable: trash"></div>
<div class="trash" data-bind="sortable: trash"><p></p></div>

<script id="taskTmpl" type="text/html">
<div class="item">
Expand Down
2 changes: 1 addition & 1 deletion examples/draggable.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<script type='text/javascript' src='../ext/jquery-1.9.1.js'></script>
<script type="text/javascript" src="../ext/jquery-ui.js"></script>

<script type='text/javascript' src="../ext/knockout-3.4.0.js"></script>
<script type='text/javascript' src="../ext/knockout-3.5.1.js"></script>
<script type='text/javascript' src="../build/knockout-sortable.min.js"></script>

<style type='text/css'>
Expand Down
128 changes: 64 additions & 64 deletions examples/seatingChart.html
Original file line number Diff line number Diff line change
@@ -1,64 +1,64 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>Seating Chart</title>
<link rel="stylesheet" href="seatingChart.css" />
</head>
<body>
<div>Seating Assignments</div>
<div class="note">Rules: no more than 4 students per table. Must have at least one student of each gender at a full table.</div>
<div id="main" data-bind="foreach: tables">
<div class="table">
<span data-bind="text: students.id"></span>
<div class="seats" data-bind="sortable: { data: students, allowDrop: $root.isTableFull }">
<div class="student" data-bind="text: name"></div>
</div>
<div class="count" data-bind="text: students().length + '/' + $root.maximumStudents, css: { ready: students().length < $root.maximumStudents }"></div>
</div>
</div>

<div id="extra">
<div>Available Students</div>
<div class="new" data-bind="sortable: availableStudents">
<div class="student" data-bind="text: name"></div>
</div>
</div>

<div id="message" data-bind="flash: lastAction"></div>
<div id="error" data-bind="flash: lastError"></div>

<div id="master">
<div>Master List</div>
<table>
<tr>
<th></th>
<th>Seat One</th>
<th>Seat Two</th>
<th>Seat Three</th>
<th>Seat Four</th>
</tr>
<tbody data-bind="foreach: tables">
<tr>
<th data-bind="text: students.id"></th>
<!-- ko foreach: students -->
<td data-bind="text: name"></td>
<!-- /ko -->
</tr>
</tbody>
<tr>
<th>Available</th>
<!-- ko foreach: availableStudents -->
<td data-bind="text: name"></td>
<!-- /ko -->
</tr>
</table>
</div>

<script type='text/javascript' src='../ext/jquery-1.9.1.js'></script>
<script type="text/javascript" src="../ext/jquery-ui.js"></script>
<script type='text/javascript' src="../ext/knockout-3.4.0.js"></script>
<script type='text/javascript' src="../build/knockout-sortable.min.js"></script>
<script type='text/javascript' src="seatingChart.js"></script>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>Seating Chart</title>
<link rel="stylesheet" href="seatingChart.css" />
</head>
<body>
<div>Seating Assignments</div>
<div class="note">Rules: no more than 4 students per table. Must have at least one student of each gender at a full table.</div>
<div id="main" data-bind="foreach: tables">
<div class="table">
<span data-bind="text: students.id"></span>
<div class="seats" data-bind="sortable: { data: students, allowDrop: $root.isTableFull }">
<div class="student" data-bind="text: name"></div>
</div>
<div class="count" data-bind="text: students().length + '/' + $root.maximumStudents, css: { ready: students().length < $root.maximumStudents }"></div>
</div>
</div>

<div id="extra">
<div>Available Students</div>
<div class="new" data-bind="sortable: availableStudents">
<div class="student" data-bind="text: name"></div>
</div>
</div>

<div id="message" data-bind="flash: lastAction"></div>
<div id="error" data-bind="flash: lastError"></div>

<div id="master">
<div>Master List</div>
<table>
<tr>
<th></th>
<th>Seat One</th>
<th>Seat Two</th>
<th>Seat Three</th>
<th>Seat Four</th>
</tr>
<tbody data-bind="foreach: tables">
<tr>
<th data-bind="text: students.id"></th>
<!-- ko foreach: students -->
<td data-bind="text: name"></td>
<!-- /ko -->
</tr>
</tbody>
<tr>
<th>Available</th>
<!-- ko foreach: availableStudents -->
<td data-bind="text: name"></td>
<!-- /ko -->
</tr>
</table>
</div>

<script type='text/javascript' src='../ext/jquery-1.9.1.js'></script>
<script type="text/javascript" src="../ext/jquery-ui.js"></script>
<script type='text/javascript' src="../ext/knockout-3.5.1.js"></script>
<script type='text/javascript' src="../build/knockout-sortable.min.js"></script>
<script type='text/javascript' src="seatingChart.js"></script>
</body>
</html>
2 changes: 1 addition & 1 deletion examples/singleList.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<script type='text/javascript' src='../ext/jquery-1.9.1.js'></script>
<script type="text/javascript" src="../ext/jquery-ui.js"></script>

<script type='text/javascript' src="../ext/knockout-3.4.0.js"></script>
<script type='text/javascript' src="../ext/knockout-3.5.1.js"></script>
<script type='text/javascript' src="../build/knockout-sortable.js"></script>

<style type='text/css'>
Expand Down
Loading

0 comments on commit 4ea028d

Please sign in to comment.