summaryrefslogtreecommitdiffstats
path: root/afb-client/app/Frontend/pages
diff options
context:
space:
mode:
authorFulup Ar Foll <fulup@iot.bzh>2016-05-28 12:28:19 +0200
committerFulup Ar Foll <fulup@iot.bzh>2016-05-28 12:28:19 +0200
commit95a5e12dca0e0e0eb93b3dad69e529d737840d38 (patch)
tree618f800406d41e6f23e5722671ed51ac0144bd8e /afb-client/app/Frontend/pages
parent6d06a2a9a02906ce4c848540d74c3c5798688664 (diff)
Clean up and documentation
Diffstat (limited to 'afb-client/app/Frontend/pages')
-rw-r--r--afb-client/app/Frontend/pages/SampleHome/SampleHome.html (renamed from afb-client/app/Frontend/pages/Home/Home.html)10
-rw-r--r--afb-client/app/Frontend/pages/SampleHome/SampleHome.js (renamed from afb-client/app/Frontend/pages/Home/HomeModule.js)53
-rw-r--r--afb-client/app/Frontend/pages/SampleHome/SampleHome.scss (renamed from afb-client/app/Frontend/pages/Home/HomeModule.scss)0
-rw-r--r--afb-client/app/Frontend/pages/SamplePost/SamplePost.html (renamed from afb-client/app/Frontend/pages/Sample/Sample.html)14
-rw-r--r--afb-client/app/Frontend/pages/SamplePost/SamplePost.js (renamed from afb-client/app/Frontend/pages/Sample/SampleModule.js)6
-rw-r--r--afb-client/app/Frontend/pages/SamplePost/SamplePost.scss (renamed from afb-client/app/Frontend/pages/Sample/SampleModule.scss)0
6 files changed, 46 insertions, 37 deletions
diff --git a/afb-client/app/Frontend/pages/Home/Home.html b/afb-client/app/Frontend/pages/SampleHome/SampleHome.html
index 509bd6f..58474b2 100644
--- a/afb-client/app/Frontend/pages/Home/Home.html
+++ b/afb-client/app/Frontend/pages/SampleHome/SampleHome.html
@@ -1,8 +1,8 @@
<!-- Foundation Annotations generate tmp/route.js -->
---
-name: myhome
-url: /home
-controller: HomeController as ctrl
+name: SampleHome
+url: /sample-home
+controller: SampleHomeController as ctrl
animationIn: slideInRight
---
@@ -16,7 +16,7 @@ animationIn: slideInRight
<div class="button-box box-content ">
- <submit-button class="session-button {{ctrl.class.login}}" icon="fi-unlock" label="Login" clicked="ctrl.LoginClient" ></submit-button>
+ <submit-button class="session-button {{ctrl.class.connect}}" icon="fi-unlock" label="Connect" clicked="ctrl.ConnectClient" ></submit-button>
<submit-button class="session-button {{ctrl.class.check}}" icon="fi-checkbox" label="Check" clicked="ctrl.CheckSession" ></submit-button>
<submit-button class="session-button {{ctrl.class.refresh}}" icon="fi-arrows-compress" label="Refresh" clicked="ctrl.RefreshSession" ></submit-button>
<submit-button class="session-button {{ctrl.class.logout}}" icon="fi-lock" label="Logout" clicked="ctrl.LogoutClient" ></submit-button>
@@ -31,5 +31,5 @@ animationIn: slideInRight
</div>
-<link-button href="sample" icon="fi-home" label="sample"></link-button>
+<link-button href="sample-post" icon="fi-home" label="SamplePost"></link-button>
diff --git a/afb-client/app/Frontend/pages/Home/HomeModule.js b/afb-client/app/Frontend/pages/SampleHome/SampleHome.js
index 1743654..bce1b47 100644
--- a/afb-client/app/Frontend/pages/Home/HomeModule.js
+++ b/afb-client/app/Frontend/pages/SampleHome/SampleHome.js
@@ -4,9 +4,9 @@
// WARNING: make sure than app/frontend/services/AppConfig.js match your server
// list all rependencies within the page + controler if needed
-angular.module('HomeModule', ['SubmitButton', 'TokenRefresh','ModalNotification'])
+angular.module('SampleHomeModule', ['SamplePostModule', 'SubmitButton', 'TokenRefresh','ModalNotification'])
- .controller('HomeController', function (AppCall, Notification) {
+ .controller('SampleHomeController', function (AppCall, Notification) {
var scope = this; // I hate JavaScript
scope.uuid ="none";
scope.token ="none";
@@ -23,20 +23,35 @@ angular.module('HomeModule', ['SubmitButton', 'TokenRefresh','ModalNotification'
scope.request = jresp.request;
scope.response = jresp.response;
- if (jresp.request.status !== "success") {
- Notification.error ({message: "Invalid API call:" + jresp.request.info , delay: 5000});
- scope.class [jresp.request.reqid]="fail";
- return;
- }
-
- switch (jresp.request.reqid) {
- case 'login':
- case 'logout':
- scope.class={};
+ var action=jresp.request.reqid.toUpperCase();
+
+ switch (action) {
+ case 'CONNECT':
+ if (jresp.request.status !== "success") {
+ Notification.error ({message: action + ": Logout before reconnecting", delay: 5000});
+ scope.class [jresp.request.reqid]="fail";
+ return;
+ }
+ scope.class={}; // reset CSS buttons classes
break;
- case 'refresh':
- case 'check':
+ case 'LOGOUT':
+ if (jresp.request.status !== "success") {
+ Notification.error ({message: action + ": Do connect first", delay: 5000});
+ scope.class [jresp.request.reqid]="fail";
+ return;
+ }
+ scope.class={}; // reset CSS buttons classes
+ break;
+
+ case 'REFRESH':
+ case 'CHECK':
+ if (jresp.request.status !== "success") {
+ Notification.error ({message: action + ": Need to be Connected to check/refresh session", delay: 5000});
+ scope.class [jresp.request.reqid]="fail";
+ return;
+ }
+
break;
default:
@@ -58,9 +73,9 @@ angular.module('HomeModule', ['SubmitButton', 'TokenRefresh','ModalNotification'
console.log ("FX: "+ JSON.stringify(response));
};
- scope.LoginClient = function() {
- console.log ("LoginClient");
- AppCall.get ("auth", "login", {/*query*/}, scope.OnResponse, scope.InvalidApiCall);
+ scope.ConnectClient = function() {
+ console.log ("ConnectClient");
+ AppCall.get ("auth", "connect", {/*query*/}, scope.OnResponse, scope.InvalidApiCall);
};
scope.CheckSession = function() {
@@ -80,8 +95,8 @@ angular.module('HomeModule', ['SubmitButton', 'TokenRefresh','ModalNotification'
};
scope.Initialised = function () {
- scope.class = {login: "success"};
- }
+ scope.class = {connect: "success"};
+ };
});
diff --git a/afb-client/app/Frontend/pages/Home/HomeModule.scss b/afb-client/app/Frontend/pages/SampleHome/SampleHome.scss
index 8bf04a1..8bf04a1 100644
--- a/afb-client/app/Frontend/pages/Home/HomeModule.scss
+++ b/afb-client/app/Frontend/pages/SampleHome/SampleHome.scss
diff --git a/afb-client/app/Frontend/pages/Sample/Sample.html b/afb-client/app/Frontend/pages/SamplePost/SamplePost.html
index 03a4558..fa721c7 100644
--- a/afb-client/app/Frontend/pages/Sample/Sample.html
+++ b/afb-client/app/Frontend/pages/SamplePost/SamplePost.html
@@ -1,8 +1,8 @@
<!-- Foundation Annotations generate tmp/route.js -->
---
-name: mysample
-url: /sample
-controller: SampleController as ctrl
+name: PostSample
+url: /sample-post
+controller: SamplePostController as ctrl
animationIn: slideInRight
---
@@ -20,15 +20,9 @@ animationIn: slideInRight
maxsize = [xxx] maximum size in KB [default max depend on upload-type]
accept = [image] acceptable accept for upload
-->
- <upload-image name="avatar" category="avatar" thumbnail="tux-visitor.png" maxsize="100"
+ <upload-image category="avatar" thumbnail="tux-visitor.png" maxsize="100"
posturl="/api/post/upload-image" callback="ctrl.FileUploaded" accept="image" title="Change your Avatar">
</upload-image>
-
- <!-- Warning: name=xxx should match with what server expect [used as xform input name -->
- <upload-audio name="music" posturl="/api/post/upload-music" callback="ctrl.FileUploaded" title="Upload your Music"></upload-audio>
-
- <!-- Warning: name=xxx should match with what server expect [used as xform input name -->
- <upload-appli name="appli" posturl="/api/post/upload-appli" callback="ctrl.FileUploaded" title="Upload AGL App"></upload-appli>
</div>
diff --git a/afb-client/app/Frontend/pages/Sample/SampleModule.js b/afb-client/app/Frontend/pages/SamplePost/SamplePost.js
index 8ae82ea..e0c06de 100644
--- a/afb-client/app/Frontend/pages/Sample/SampleModule.js
+++ b/afb-client/app/Frontend/pages/SamplePost/SamplePost.js
@@ -2,9 +2,9 @@
'use strict';
// list all rependencies within the page + controler if needed
-angular.module('SampleModule', ['SubmitButton','UploadFiles'])
+angular.module('SamplePostModule', ['SubmitButton','UploadFiles'])
- .controller('SampleController', function ($http) {
+ .controller('SamplePostController', function ($http) {
var scope = this; // I hate JavaScript
console.log ("sample Init");
@@ -14,5 +14,5 @@ angular.module('SampleModule', ['SubmitButton','UploadFiles'])
};
});
-console.log ("SampleControler Loaded");
+console.log ("PostSampleController Loaded");
})(); \ No newline at end of file
diff --git a/afb-client/app/Frontend/pages/Sample/SampleModule.scss b/afb-client/app/Frontend/pages/SamplePost/SamplePost.scss
index 7654424..7654424 100644
--- a/afb-client/app/Frontend/pages/Sample/SampleModule.scss
+++ b/afb-client/app/Frontend/pages/SamplePost/SamplePost.scss