r3894 - in trunk/pollen-ui-angular/src/main/webapp: . js js/controllers partials
Author: garandel Date: 2014-05-02 11:08:56 +0200 (Fri, 02 May 2014) New Revision: 3894 Url: http://forge.chorem.org/projects/pollen/repository/revisions/3894 Log: Create poll with skeleton from rest api ( http://demo.codelutin.com/pollen-rest-api-latest/v1/polls/new ) Modified: trunk/pollen-ui-angular/src/main/webapp/index.html trunk/pollen-ui-angular/src/main/webapp/js/app.js trunk/pollen-ui-angular/src/main/webapp/js/controllers/pollCtrl.js trunk/pollen-ui-angular/src/main/webapp/partials/poll-popupChoice.html trunk/pollen-ui-angular/src/main/webapp/partials/poll.html Modified: trunk/pollen-ui-angular/src/main/webapp/index.html =================================================================== --- trunk/pollen-ui-angular/src/main/webapp/index.html 2014-04-30 16:17:52 UTC (rev 3893) +++ trunk/pollen-ui-angular/src/main/webapp/index.html 2014-05-02 09:08:56 UTC (rev 3894) @@ -18,16 +18,19 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #L% --> + <html lang="en" ng-app="pollen"> <head> <title>Pollen</title> <link href="http://netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css" rel="stylesheet"/> <link rel="stylesheet" href="css/style.css"/> + <script src="http://cdnjs.cloudflare.com/ajax/libs/lodash.js/2.4.1/lodash.min.js"></script> <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.15/angular.min.js"></script> <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.15/angular-route.min.js"></script> <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.15/angular-resource.min.js"></script> <script src="http://cdnjs.cloudflare.com/ajax/libs/angular-ui-bootstrap/0.10.0/ui-bootstrap-tpls.min.js"></script> + <script src="http://cdnjs.cloudflare.com/ajax/libs/restangular/1.4.0/restangular.min.js"></script> <script src="js/libs/ckeditor/ckeditor.js"></script> <script src="js/app.js"></script> Modified: trunk/pollen-ui-angular/src/main/webapp/js/app.js =================================================================== --- trunk/pollen-ui-angular/src/main/webapp/js/app.js 2014-04-30 16:17:52 UTC (rev 3893) +++ trunk/pollen-ui-angular/src/main/webapp/js/app.js 2014-05-02 09:08:56 UTC (rev 3894) @@ -18,7 +18,7 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. * #L% */ -angular.module('pollen', ["ngRoute", "pollControllers", 'ui.bootstrap']) +angular.module('pollen', ["restangular", 'ngRoute', 'pollControllers', 'ui.bootstrap']) .config(['$routeProvider', function($routeProvider) { $routeProvider.when('/', {templateUrl: './partials/home.html', controller: "HomeCtrl"}) @@ -30,6 +30,14 @@ }]) +.config(['RestangularProvider', function (RestangularProvider) { + RestangularProvider.setBaseUrl('http://demo.codelutin.com/pollen-rest-api-latest/v1'); +}]) + +.factory('PollsRest', ['Restangular', function(Restangular) { + return Restangular.service('polls'); +}]) + .directive('focusMe', function($timeout) { return { link: function($scope, element, attrs) { Modified: trunk/pollen-ui-angular/src/main/webapp/js/controllers/pollCtrl.js =================================================================== --- trunk/pollen-ui-angular/src/main/webapp/js/controllers/pollCtrl.js 2014-04-30 16:17:52 UTC (rev 3893) +++ trunk/pollen-ui-angular/src/main/webapp/js/controllers/pollCtrl.js 2014-05-02 09:08:56 UTC (rev 3894) @@ -64,15 +64,15 @@ }]) -.controller('PollAdminCtrl', ['$scope', '$controller', '$modal', '$filter', '$timeout', 'pollStorage', function ($scope, $controller, $modal, $filter, $timeout, pollStorage) { +.controller('PollAdminCtrl', ['$scope', '$controller', '$modal', '$filter', '$timeout', 'PollsRest', 'pollStorage', function ($scope, $controller, $modal, $filter, $timeout, PollsRest, pollStorage) { $controller('PollCtrl', {$scope:$scope}); var initPoll = function () { - return { - title :'', - description : '', - choices : [] - }; + + PollsRest.one('new').get().then(function (skeletonPoll) { + $scope.poll = skeletonPoll; + $scope.poll.choices = []; + }); } var initChoice = function () { @@ -93,8 +93,9 @@ }); if (!angular.isDefined($scope.poll.choices)) { - $scope.poll = initPoll(); + initPoll(); } + $scope.vote = {}; $scope.vote.choices = $scope.poll.choices; Modified: trunk/pollen-ui-angular/src/main/webapp/partials/poll-popupChoice.html =================================================================== --- trunk/pollen-ui-angular/src/main/webapp/partials/poll-popupChoice.html 2014-04-30 16:17:52 UTC (rev 3893) +++ trunk/pollen-ui-angular/src/main/webapp/partials/poll-popupChoice.html 2014-05-02 09:08:56 UTC (rev 3894) @@ -1,3 +1,24 @@ +<!-- + #%L + Pollen :: UI (Angular) + %% + Copyright (C) 2009 - 2014 CodeLutin + %% + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + #L% + --> + <form class="form-horizontal"> <div class="modal-header"> <h4 class="modal-title">{{title}}</h4> Modified: trunk/pollen-ui-angular/src/main/webapp/partials/poll.html =================================================================== --- trunk/pollen-ui-angular/src/main/webapp/partials/poll.html 2014-04-30 16:17:52 UTC (rev 3893) +++ trunk/pollen-ui-angular/src/main/webapp/partials/poll.html 2014-05-02 09:08:56 UTC (rev 3894) @@ -1,3 +1,24 @@ +<!-- + #%L + Pollen :: UI (Angular) + %% + Copyright (C) 2009 - 2014 CodeLutin + %% + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + #L% + --> + <form class="form-inline" name="pollForm" novalidate> <alert type="'danger'" ng-if="globalVariables.errorForm"> Champ non remplie </alert>
participants (1)
-
garandel@users.chorem.org