fixed icon bug on field dragging
This commit is contained in:
parent
d74c04fa86
commit
5ad2875378
|
@ -16,14 +16,20 @@ angular.module('forms').directive('editFormDirective', ['$rootScope', 'FormField
|
|||
*/
|
||||
var newField;
|
||||
|
||||
//Populate local scope with rootScope methods/variables
|
||||
$scope.update = $rootScope.update;
|
||||
|
||||
//Setup UI-Sortable
|
||||
$scope.sortableOptions = {
|
||||
appendTo: '.dropzone',
|
||||
//helper: 'clone',
|
||||
items: '.sortable-fields',
|
||||
forceHelperSize: true,
|
||||
forcePlaceholderSize: true,
|
||||
update: function(e, ui) {
|
||||
$scope.update(false, $scope.myform, true, false, function(err){
|
||||
if(err){
|
||||
console.error(err);
|
||||
}
|
||||
});
|
||||
},
|
||||
};
|
||||
|
@ -251,10 +257,6 @@ angular.module('forms').directive('editFormDirective', ['$rootScope', 'FormField
|
|||
});
|
||||
};
|
||||
|
||||
|
||||
//Populate local scope with rootScope methods/variables
|
||||
$scope.update = $rootScope.update;
|
||||
|
||||
/*
|
||||
** Field CRUD Methods
|
||||
*/
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('view-form').directive('fieldIconDirective', function() {
|
||||
angular.module('forms').directive('fieldIconDirective', function() {
|
||||
|
||||
return {
|
||||
template: '<i class="{{typeIcon}}"></i>',
|
||||
template: '<i ng-class="iconTypeMap[typeName]"></i>',
|
||||
restrict: 'E',
|
||||
scope: {
|
||||
typeName: '@'
|
||||
},
|
||||
controller: function($scope){
|
||||
var iconTypeMap = {
|
||||
$scope.iconTypeMap = {
|
||||
'textfield': 'fa fa-pencil-square-o',
|
||||
'dropdown': 'fa fa-th-list',
|
||||
'date': 'fa fa-calendar',
|
||||
|
@ -27,7 +27,6 @@ angular.module('view-form').directive('fieldIconDirective', function() {
|
|||
'yes_no': 'fa fa-toggle-on',
|
||||
'number': 'fa fa-slack'
|
||||
};
|
||||
$scope.typeIcon = iconTypeMap[$scope.typeName];
|
||||
}
|
||||
};
|
||||
});
|
|
@ -487,8 +487,9 @@
|
|||
</div>
|
||||
<div class="panel-group row" class="draggable" ng-model="addField.types">
|
||||
|
||||
<div class="col-xs-12 col-sm-12 col-md-6" ng-repeat="type in addField.types" style="padding-top:7.5px;">
|
||||
<div class="panel panel-default" style="background-color:#f5f5f5;">
|
||||
<div class="col-xs-12 col-sm-12 col-md-6"
|
||||
ng-repeat="type in addField.types" style="padding-top: 7.5px;">
|
||||
<div class="panel panel-default" style="background-color: #f5f5f5;">
|
||||
<div class="panel-heading" ng-click="addNewField(type.name)" style="cursor: pointer; font-size:12px; padding-left: 10px; padding-right: 10px;">
|
||||
<span>
|
||||
<field-icon-directive type-name="{{type.name}}">
|
||||
|
@ -526,13 +527,14 @@
|
|||
|
||||
<div class="panel-group dropzone col-xs-12" ui-sortable="sortableOptions" ng-model="myform.form_fields">
|
||||
|
||||
<div class="col-xs-12 field-row" ng-repeat="field in myform.form_fields track by $index" ng-hide="field.deletePreserved">
|
||||
<div class="col-xs-10">
|
||||
<div class="col-xs-12 field-row sortable-fields" ng-repeat="field in myform.form_fields track by $index">
|
||||
<div class="col-xs-10 sortable-panel">
|
||||
<div class="panel panel-default" ng-click="openEditModal(field, true, $index)">
|
||||
<div class="panel-heading">
|
||||
<div class="row">
|
||||
<span class="col-xs-1" ng-switch="field.fieldType">
|
||||
<field-icon-directive type-name="{{field.fieldType}}"></field-icon-directive>
|
||||
<field-icon-directive type-name="{{field.fieldType}}">
|
||||
</field-icon-directive>
|
||||
</span>
|
||||
<span class="col-xs-11">
|
||||
{{field.title}}
|
||||
|
@ -551,7 +553,6 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-xs-1 box">
|
||||
<div class="panel tool-panel panel-default">
|
||||
<div class="panel-heading" style="padding: 10px 10px;" ng-click="duplicateField($index)">
|
||||
|
|
Loading…
Reference in a new issue