This is an automated email from the git hooks/post-receive script. unknown user pushed a commit to branch devel in repository Pollen. commit df7f32632c8f549e5bc90da0917c897f52f46837 Author: Adrien Garandel <a.garandel@dralagen.fr> Date: Mon May 19 14:46:28 2014 +0200 Add form register new user --- pollen-ui-angular/src/main/webapp/index.html | 1 + pollen-ui-angular/src/main/webapp/js/app.js | 2 ++ .../src/main/webapp/js/controllers/userCtrl.js | 26 +++++++++++++++ pollen-ui-angular/src/main/webapp/js/services.js | 23 ++++++++++++++ .../src/main/webapp/partials/user-register.html | 37 ++++++++++++++++++++++ 5 files changed, 89 insertions(+) diff --git a/pollen-ui-angular/src/main/webapp/index.html b/pollen-ui-angular/src/main/webapp/index.html index acd5756..7d14ee1 100644 --- a/pollen-ui-angular/src/main/webapp/index.html +++ b/pollen-ui-angular/src/main/webapp/index.html @@ -38,6 +38,7 @@ <script src="js/app.js"></script> <script src="js/services.js"></script> <script src="js/controllers/pollCtrl.js"></script> + <script src="js/controllers/userCtrl.js"></script> </head> <body> diff --git a/pollen-ui-angular/src/main/webapp/js/app.js b/pollen-ui-angular/src/main/webapp/js/app.js index 47c75aa..477cb3b 100644 --- a/pollen-ui-angular/src/main/webapp/js/app.js +++ b/pollen-ui-angular/src/main/webapp/js/app.js @@ -18,6 +18,7 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. * #L% */ +<<<<<<< HEAD angular.module('pollen', ['pollenServices', 'ngRoute', 'pollControllers', 'ui.bootstrap', 'ngCookies']) .config(['$httpProvider', '$cookiesProvider', function($httpProvider, $cookies) { $httpProvider.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded;charset=utf-8'; @@ -36,6 +37,7 @@ angular.module('pollen', ['pollenServices', 'ngRoute', 'pollControllers', 'ui.bo .when('/poll/edit/:pollId', {templateUrl: './partials/poll.html', controller:"PollEditCtrl"}) .when('/poll/vote/:pollId', {templateUrl: './partials/poll.html', controller :"PollVoteCtrl"}) .when('/poll/list', {templateUrl: './partials/poll-list.html', controller :"PollListCtrl"}) + .when('/user/register', {templateUrl: './partials/user-register.html', controller:"UserRegisterCtrl"}) .otherwise({redirectTo: '/'}); }]) diff --git a/pollen-ui-angular/src/main/webapp/js/controllers/userCtrl.js b/pollen-ui-angular/src/main/webapp/js/controllers/userCtrl.js new file mode 100644 index 0000000..539b351 --- /dev/null +++ b/pollen-ui-angular/src/main/webapp/js/controllers/userCtrl.js @@ -0,0 +1,26 @@ +/* + * #%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% + */ + angular.module('userControllers', []) + .controller('UserRegisterCtrl', ['$scope', 'User', function ($scope, User) { + $scope.submit = function () { + User.add({}, $scope.data.user); + } + }]); \ No newline at end of file diff --git a/pollen-ui-angular/src/main/webapp/js/services.js b/pollen-ui-angular/src/main/webapp/js/services.js index 41be424..9d37bf9 100644 --- a/pollen-ui-angular/src/main/webapp/js/services.js +++ b/pollen-ui-angular/src/main/webapp/js/services.js @@ -97,4 +97,27 @@ angular.module('pollenServices', ['ngResource']) } } ); +}]) + +.factory('User', ['$resource', 'RestInfo', function ($resource, RestInfo) { + var transformParam = function (data) { + return 'user='+encodeURIComponent(JSON.stringify(data))+RestInfo; + } + return $resource(conf.restURL+'/users/:userId', {userId : '@id'}, + { + 'add' : { + method : 'POST', + transformRequest: function (data, headersGetter) { + return transformParam(data); + } + }, + 'update' : + { + method:'PUT', + transformRequest : function (data, headersGetter) { + return transformParam(data); + } + } + } + ); }]) \ No newline at end of file diff --git a/pollen-ui-angular/src/main/webapp/partials/user-register.html b/pollen-ui-angular/src/main/webapp/partials/user-register.html new file mode 100644 index 0000000..e70496f --- /dev/null +++ b/pollen-ui-angular/src/main/webapp/partials/user-register.html @@ -0,0 +1,37 @@ +<!-- + #%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% + --> +<div> + <form ng-submit="submit()"> + <div class="form-group"> + <label for="formName">Nom d'utilisateur : </label> + <input type="text" id="formName" name="login" class="form-control" ng-model="data.user.login"/> + </div> + + <div class="form-group"> + <label for="formEmail">E-Mail :</label> + <input type="email" id="formEmail" name="email" class="form-control" ng-model="data.user.email"/> + </div> + + <div class="form-group"> + <button class="btn btn-primary" type="submit">Envoyer</button> + </div> + </form> +</div> \ No newline at end of file -- To stop receiving notification emails like this one, please contact Chorem.org SCM administrator <admin+scm@chorem.org>.
participants (1)
-
Chorem.org scm