From garandel@users.chorem.org Wed May 14 10:53:32 2014
From: garandel@users.chorem.org
To: pollen-commits@list.chorem.org
Subject:
[Pollen-commits] r3941 - in trunk/pollen-ui-angular/src/main/webapp: . js
Date: Wed, 14 May 2014 10:53:32 +0200
Message-ID: <20140514085332.AD8E8181D9E@goh.codelutin.com>
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="===============8745905210513413728=="
--===============8745905210513413728==
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: quoted-printable
Author: garandel
Date: 2014-05-14 10:53:32 +0200 (Wed, 14 May 2014)
New Revision: 3941
Url: http://forge.chorem.org/projects/pollen/repository/revisions/3941
Log:
Add global conf in js/conf.js
Added:
trunk/pollen-ui-angular/src/main/webapp/js/conf.js.exemple
Modified:
trunk/pollen-ui-angular/src/main/webapp/index.html
trunk/pollen-ui-angular/src/main/webapp/js/services.js
Modified: trunk/pollen-ui-angular/src/main/webapp/index.html
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/pollen-ui-angular/src/main/webapp/index.html 2014-05-13 22:58:53 UT=
C (rev 3940)
+++ trunk/pollen-ui-angular/src/main/webapp/index.html 2014-05-14 08:53:32 UT=
C (rev 3941)
@@ -25,6 +25,8 @@
=20
+
+
Added: trunk/pollen-ui-angular/src/main/webapp/js/conf.js.exemple
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/pollen-ui-angular/src/main/webapp/js/conf.js.exemple =
(rev 0)
+++ trunk/pollen-ui-angular/src/main/webapp/js/conf.js.exemple 2014-05-14 08:=
53:32 UTC (rev 3941)
@@ -0,0 +1,4 @@
+var conf =3D {
+ // Rest-API Base Url
+ restURL : "http://exemple.com/api"
+}
\ No newline at end of file
Modified: trunk/pollen-ui-angular/src/main/webapp/js/services.js
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/pollen-ui-angular/src/main/webapp/js/services.js 2014-05-13 22:58:5=
3 UTC (rev 3940)
+++ trunk/pollen-ui-angular/src/main/webapp/js/services.js 2014-05-14 08:53:3=
2 UTC (rev 3941)
@@ -20,14 +20,9 @@
*/
angular.module('pollenServices', ['ngResource'])
=20
-.factory('BaseUrl', function() {
+.factory('Poll', ['$resource', function ($resource) {
=20
- return 'http://localhost\\:8080/pollen-rest-api/v1';
-})
-
-.factory('Poll', ['$resource', 'BaseUrl', function ($resource, BaseUrl) {
-
- return $resource(BaseUrl+'/polls/:pollId/:cmd', {pollId:'@topiaId'}, {
+ return $resource(conf.restURL+'/polls/:pollId/:cmd', {pollId:'@topiaId'}, {
'add' : {
method : 'POST',
transformRequest : function (data, headersGetter) {
@@ -42,17 +37,16 @@
transformRequest : function (data, headersGetter) {
return 'poll=3D'+encodeURIComponent(JSON.stringify(data));
}
- ,headers : { 'X-HTTP-Method' : 'PUT'}
}
});
}])
=20
-.factory('PollChoice', ['$resource', 'BaseUrl', function ($resource, BaseUrl=
) {
+.factory('PollChoice', ['$resource', function ($resource) {
var transformParam =3D function (data) {
return 'choice=3D'+encodeURIComponent(JSON.stringify(data));
};
=20
- return $resource(BaseUrl+'/polls/:pollId/choices/:choiceId', {choiceId : '=
@topiaId'},
+ return $resource(conf.restURL+'/polls/:pollId/choices/:choiceId', {choiceI=
d : '@topiaId'},
{
'add' : {
method:'POST',
@@ -71,7 +65,7 @@
);
}])
=20
-.factory('PollVote', ['$resource', 'BaseUrl', function ($resource, BaseUrl) {
+.factory('PollVote', ['$resource', function ($resource) {
var transformParam =3D function (data) {
var obj =3D {};
obj.voter =3D {name : data.name}
@@ -80,7 +74,7 @@
return 'vote=3D'+encodeURIComponent(JSON.stringify(obj));
};
=20
- return $resource(BaseUrl+'/polls/:pollId/votes/:voteId', {voteId : '@topia=
Id'},
+ return $resource(conf.restURL+'/polls/:pollId/votes/:voteId', {voteId : '@=
topiaId'},
{
'add' : {
method:'POST',
--===============8745905210513413728==--