summaryrefslogtreecommitdiffstats
path: root/afb-client/app/Frontend/pages
diff options
context:
space:
mode:
Diffstat (limited to 'afb-client/app/Frontend/pages')
-rw-r--r--afb-client/app/Frontend/pages/SampleHome/SampleHome.html35
-rw-r--r--afb-client/app/Frontend/pages/SampleHome/SampleHome.js104
-rw-r--r--afb-client/app/Frontend/pages/SampleHome/SampleHome.scss71
-rw-r--r--afb-client/app/Frontend/pages/SamplePost/SamplePost.html29
-rw-r--r--afb-client/app/Frontend/pages/SamplePost/SamplePost.js18
-rw-r--r--afb-client/app/Frontend/pages/SamplePost/SamplePost.scss41
6 files changed, 298 insertions, 0 deletions
diff --git a/afb-client/app/Frontend/pages/SampleHome/SampleHome.html b/afb-client/app/Frontend/pages/SampleHome/SampleHome.html
new file mode 100644
index 0000000..58474b2
--- /dev/null
+++ b/afb-client/app/Frontend/pages/SampleHome/SampleHome.html
@@ -0,0 +1,35 @@
+<!-- Foundation Annotations generate tmp/route.js -->
+---
+name: SampleHome
+url: /sample-home
+controller: SampleHomeController as ctrl
+animationIn: slideInRight
+---
+
+<h3>
+<img class="logo" src="images/logo/triskel_iot_bzhx250.png" alt="IoT.bzh Logo" style="height:150px;">
+ App Framework Binder Simple Client
+</h3>
+
+<token-refresh autolog="true" callback="ctrl.Initialised"></token-refresh>
+
+
+<div class="button-box box-content ">
+
+ <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>
+
+</div>
+<div class="message-box box-content vertical grid-frame">
+ <div class="response">
+ <span class="grid-content noscroll req {{ctrl.status}} ">req= {{ctrl.request}}</span>
+ <span class="grid-content noscroll res {{ctrl.status}} ">res= {{ctrl.response}}</span>
+ <span class="grid-content noscroll status {{ctrl.status}}">status= {{ctrl.errcode}}</span>
+ </div>
+</div>
+
+
+<link-button href="sample-post" icon="fi-home" label="SamplePost"></link-button>
+
diff --git a/afb-client/app/Frontend/pages/SampleHome/SampleHome.js b/afb-client/app/Frontend/pages/SampleHome/SampleHome.js
new file mode 100644
index 0000000..bce1b47
--- /dev/null
+++ b/afb-client/app/Frontend/pages/SampleHome/SampleHome.js
@@ -0,0 +1,104 @@
+(function() {
+'use strict';
+
+// WARNING: make sure than app/frontend/services/AppConfig.js match your server
+
+// list all rependencies within the page + controler if needed
+angular.module('SampleHomeModule', ['SamplePostModule', 'SubmitButton', 'TokenRefresh','ModalNotification'])
+
+ .controller('SampleHomeController', function (AppCall, Notification) {
+ var scope = this; // I hate JavaScript
+ scope.uuid ="none";
+ scope.token ="none";
+ scope.session="none";
+ scope.status ="err-no";
+
+ console.log ("Home Controller");
+
+ scope.OnResponse= function(jresp, errcode) {
+
+ // Update UI response global display zone
+ scope.status = jresp.request.status;
+ scope.errcode = errcode;
+ scope.request = jresp.request;
+ scope.response = jresp.response;
+
+ 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 '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:
+ Notification.error ({message: "Invalid RequestID:" + jresp.request.reqid , delay: 5000});
+ return;
+ }
+
+ // update button classes within home.html
+ scope.class [jresp.request.reqid]="success";
+ console.log ("OK: "+ JSON.stringify(jresp));
+ };
+
+ scope.ProcessError= function(response, errcode, config) {
+ Notification.error ({message: "Invalid API:" + response.request.reqid , delay: 5000});
+ scope.status = "err-fx";
+ scope.errcode = errcode;
+ scope.request = response.request;
+ scope.response = "";
+ console.log ("FX: "+ JSON.stringify(response));
+ };
+
+ scope.ConnectClient = function() {
+ console.log ("ConnectClient");
+ AppCall.get ("auth", "connect", {/*query*/}, scope.OnResponse, scope.InvalidApiCall);
+ };
+
+ scope.CheckSession = function() {
+ console.log ("CheckSession");
+ AppCall.get ("auth", "check", {/*query*/}, scope.OnResponse, scope.InvalidApiCall);
+
+ };
+
+ scope.RefreshSession = function() {
+ console.log ("RefreshSession");
+ AppCall.get ("auth", "refresh", {/*query*/}, scope.OnResponse, scope.InvalidApiCall);
+ };
+
+ scope.LogoutClient = function() {
+ console.log ("LogoutClient");
+ AppCall.get ("auth", "logout", {/*query*/}, scope.OnResponse, scope.InvalidApiCall);
+ };
+
+ scope.Initialised = function () {
+ scope.class = {connect: "success"};
+ };
+
+ });
+
+console.log ("SampleControler Loaded");
+})(); \ No newline at end of file
diff --git a/afb-client/app/Frontend/pages/SampleHome/SampleHome.scss b/afb-client/app/Frontend/pages/SampleHome/SampleHome.scss
new file mode 100644
index 0000000..8bf04a1
--- /dev/null
+++ b/afb-client/app/Frontend/pages/SampleHome/SampleHome.scss
@@ -0,0 +1,71 @@
+/*
+ * Copyright (C) 2015 "IoT.bzh"
+ * Author "Fulup Ar Foll"
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU 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 General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+@import "app/ibz-mixins";
+
+$COLOR_SUCCESS: green;
+$COLOR_FAIL: red;
+
+token-refresh {
+ display: block;
+ float: right;
+ margin: .5rem 1rem 0 0;
+}
+
+.button-box {
+ height : 4.5rem;
+
+ .session-button {
+ float: left;
+ width: 5rem;
+ };
+
+ .response > span{
+ display: block;
+ margin: .3rem .5rem .3rem .5rem;
+ }
+
+ .fail {
+ color:$COLOR_FAIL;
+ border: 1px solid darken($COLOR_FAIL,10%);
+ }
+ .success {
+ color:$COLOR_SUCCESS;
+ border: 1px solid darken($COLOR_SUCCESS,10%);
+ }
+
+};
+
+.message-box {
+ height : auto;
+ width: 100%;
+ font-size: .75rem;
+
+ .response {
+ .err-no { color:grey; }
+ .res.err-ok { color: blue; }
+ .req.err-ok { color:blueviolet; }
+ .status.err-ok { color:green; }
+ .status.err-fx { color:red; }
+ }
+
+
+};
+
+
+
diff --git a/afb-client/app/Frontend/pages/SamplePost/SamplePost.html b/afb-client/app/Frontend/pages/SamplePost/SamplePost.html
new file mode 100644
index 0000000..fa721c7
--- /dev/null
+++ b/afb-client/app/Frontend/pages/SamplePost/SamplePost.html
@@ -0,0 +1,29 @@
+<!-- Foundation Annotations generate tmp/route.js -->
+---
+name: PostSample
+url: /sample-post
+controller: SamplePostController as ctrl
+animationIn: slideInRight
+---
+
+<h1><img class="logo" src="images/logo/triskel_iot_bzhx250.png" alt="IoT.bzh Logo" style="height:150px;">
+ Post File Upload
+</h1>
+
+<div class="sample-box box-content">
+
+ <!-- Usage: upload-xxxxx
+ name = [xxxxxx] is use a field label for xform input field. Should match with server side
+ category = [avatar] should match to a valid directory of thumbnail within AppConfig.path
+ thumbnail= [tux-bzh.png] a valid image within AppConfig.paths.[category]
+ istoobig = [istoobig.png] used image from AppConfig.paths.[category] when file is oversized
+ maxsize = [xxx] maximum size in KB [default max depend on upload-type]
+ accept = [image] acceptable accept for upload
+ -->
+ <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>
+
+</div>
+
+<link-button href="home" icon="fi-home" label="home"></link-button>
diff --git a/afb-client/app/Frontend/pages/SamplePost/SamplePost.js b/afb-client/app/Frontend/pages/SamplePost/SamplePost.js
new file mode 100644
index 0000000..e0c06de
--- /dev/null
+++ b/afb-client/app/Frontend/pages/SamplePost/SamplePost.js
@@ -0,0 +1,18 @@
+(function() {
+'use strict';
+
+// list all rependencies within the page + controler if needed
+angular.module('SamplePostModule', ['SubmitButton','UploadFiles'])
+
+ .controller('SamplePostController', function ($http) {
+ var scope = this; // I hate JavaScript
+
+ console.log ("sample Init");
+
+ scope.FileUploaded = function (response) {
+ console.log ("FileUploaded response=%s", JSON.stringify(response));
+ };
+ });
+
+console.log ("PostSampleController Loaded");
+})(); \ No newline at end of file
diff --git a/afb-client/app/Frontend/pages/SamplePost/SamplePost.scss b/afb-client/app/Frontend/pages/SamplePost/SamplePost.scss
new file mode 100644
index 0000000..7654424
--- /dev/null
+++ b/afb-client/app/Frontend/pages/SamplePost/SamplePost.scss
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2015 "IoT.bzh"
+ * Author "Fulup Ar Foll"
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU 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 General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+@import "app/ibz-mixins";
+
+
+.sample-box {
+ display: block;
+ height : 4.5rem;
+
+ .sample-button {
+ float: right;
+ width: 5rem;
+ };
+
+ .muted-on-on,.muted-off-off{
+ background: blueviolet;
+ };
+
+ .muted-error{
+ background: red;
+ };
+};
+
+
+