diff --git a/src/app/pages/surveys/SurveysPageCtrl.js b/src/app/pages/surveys/SurveysPageCtrl.js index 3dabb2f..2110177 100644 --- a/src/app/pages/surveys/SurveysPageCtrl.js +++ b/src/app/pages/surveys/SurveysPageCtrl.js @@ -6,15 +6,22 @@ 'use strict'; angular.module('BlurAdmin.pages.surveys') - .controller('SurveysPageCtrl', SurveysPageCtrl); + .controller('SurveysPageCtrl', SurveysPageCtrl) + .directive('multiple', function() { + return { + templateUrl: 'app/pages/surveys/widgets/multiple.html' + }; + }); /** @ngInject */ - function SurveysPageCtrl($scope, $timeout) { + function SurveysPageCtrl($scope, $compile, $timeout) { $scope.isUnfolded = false; + $scope.actualId = 0; + $scope.survey = {}; $scope.survey.name = ''; $scope.survey.description = ''; - $scope.survey.elements.length = 0; + $scope.survey.elements = []; $scope.progressFunction = function() { return $timeout(function() {}, 3000); @@ -31,14 +38,24 @@ }; $scope.addElement = function(type){ - var element = createEmptyElement(type, $scope.survey.elements.length + 1); + $scope.actualId = $scope.survey.elements.length + 1; + var element = $scope.createEmptyElement(type, $scope.survey.elements.length + 1); $scope.activeElement=element; $scope.survey.elements.push(element); + var compiledeHTML = $compile("
")($scope); + $("#newElem").append(compiledeHTML); + console.log($scope.survey.elements); }; - function createEmptyElement(type,orderNo){ + $scope.removeElement = function(index){ + console.log("#q-"+index, index); + $scope.survey.elements.splice(index,1); + $("#q-"+index).remove(); + }; + + $scope.createEmptyElement = function(type,orderNo){ return { - id: 1, // TODO : generate the ID + id: $scope.survey.elements.length+1, // TODO : generate the ID orderNo: orderNo, type: type }; diff --git a/src/app/pages/surveys/surveys.html b/src/app/pages/surveys/surveys.html index 1c8a94a..ea89712 100644 --- a/src/app/pages/surveys/surveys.html +++ b/src/app/pages/surveys/surveys.html @@ -77,89 +77,7 @@

Page Title

Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum

-
-
-

Question 1

-
- - - - - - -
-
-
-
-
- -
- -
-
-
- -
- -
- -
- -
-
- - - -
-
- -
- -
- -
-
- - - -
-
-
- - -
- - -
- -
-
- -
- -
- -
- -
- -
-
- -
- -
-
- -
-
-
+
@@ -170,7 +88,7 @@ +
+
+ +
+ +
+ +
+
+ + + +
+
+ + + +
+ + +
+ +
+
+ +
+ +
+ +
+ +
+ +
+
+ +
+ +
+
+ + + + \ No newline at end of file