prototype of visual editor for payment parameters
A Pen by Wim Norder on CodePen.
prototype of visual editor for payment parameters
A Pen by Wim Norder on CodePen.
| <div ng-app="sortableParamsApp" ng-controller="sortableController" class="container"> | |
| <h2>Сортируемый список параметров платежа</h2> | |
| <div class="fl" style="margin-left: 20px;"> | |
| <ul class="list log"> | |
| <li ng-repeat="entry in sortingLog track by $index" class="logItem"> | |
| {{entry}} | |
| </li> | |
| </ul> | |
| </div> | |
| <div class="fl"> | |
| <ul ui-sortable="sortableOptions" ng-model="list" class="list"> | |
| <li ng-repeat="item in list" class="item"> | |
| {{item.text}} | |
| </li> | |
| </ul> | |
| </div> | |
| <div class="clear"></div> | |
| <script src="http://cdn.jsdelivr.net/g/jquery@1,jquery.ui@1.10%28jquery.ui.core.min.js+jquery.ui.widget.min.js+jquery.ui.mouse.min.js+jquery.ui.sortable.min.js%29,angularjs@1.2,angular.ui-sortable"></script> | |
| </div> |
| var serverapp_ui = angular.module('sortableParamsApp', ['ui.sortable']); | |
| serverapp_ui.controller('sortableController', function ($scope) { | |
| var tmpList = []; | |
| for (var i = 1; i <= 6; i++){ | |
| tmpList.push({ | |
| text: 'Параметр ' + i, | |
| value: i | |
| }); | |
| } | |
| $scope.list = tmpList; | |
| $scope.sortingLog = []; | |
| $scope.sortableOptions = { | |
| update: function(e, ui) { | |
| var logEntry = tmpList.map(function(i){ | |
| return i.value; | |
| }).join(', '); | |
| $scope.sortingLog.push('Было: ' + logEntry); | |
| }, | |
| stop: function(e, ui) { | |
| var logEntry = tmpList.map(function(i){ | |
| return i.value; | |
| }).join(', '); | |
| $scope.sortingLog.push('Стало: ' + logEntry); | |
| } | |
| }; | |
| }); |
| body {font-family: Verdana, 'Trebuchet ms', Tahoma; } | |
| h2 { text-align: center; } | |
| .fl { float: left; } | |
| .clear { clear: both; } | |
| .container { width: 800px; margin: auto; } | |
| .list { | |
| list-style: none outside none; | |
| margin: 10px 0 30px; | |
| } | |
| .item { | |
| width: 250px; | |
| padding: 5px 10px; | |
| margin: 5px 0; | |
| border: 1px solid #444; | |
| border-radius: 5px; | |
| background-color: #BADA55; | |
| font-size: 1.1em; | |
| font-weight: bold; | |
| text-align: center; | |
| cursor: move; | |
| } | |
| .log { | |
| margin-top: 20px; | |
| width: 300px; | |
| min-height: 200px; | |
| padding: 5px 15px; | |
| border: 5px solid #000; | |
| border-radius: 15px; | |
| } | |
| .log:before { | |
| content: 'отладка'; | |
| padding: 0 5px; | |
| position: relative; | |
| top: -1.1em; | |
| float: right; | |
| background-color: #FFF; | |
| } |