summaryrefslogtreecommitdiffstats
path: root/afb-client/app/Frontend/pages
diff options
context:
space:
mode:
authorFulup Ar Foll <fulup@iot.bzh>2015-12-20 21:04:34 +0100
committerFulup Ar Foll <fulup@iot.bzh>2015-12-20 21:04:34 +0100
commit4136c1506e0c894e604ec069339313987a7e05e7 (patch)
tree1276966f93dce30949e78d4aef456223dea71b48 /afb-client/app/Frontend/pages
parent07eb8e102607da8d6a4c1cd9835e8465c9280161 (diff)
Implemented client upload with rangeslider and zip open
Diffstat (limited to 'afb-client/app/Frontend/pages')
-rw-r--r--afb-client/app/Frontend/pages/Home/Home.html7
-rw-r--r--afb-client/app/Frontend/pages/Home/HomeModule.js8
-rw-r--r--afb-client/app/Frontend/pages/Sample/Sample.html25
-rw-r--r--afb-client/app/Frontend/pages/Sample/SampleModule.js40
4 files changed, 30 insertions, 50 deletions
diff --git a/afb-client/app/Frontend/pages/Home/Home.html b/afb-client/app/Frontend/pages/Home/Home.html
index 6eda66d..25bb983 100644
--- a/afb-client/app/Frontend/pages/Home/Home.html
+++ b/afb-client/app/Frontend/pages/Home/Home.html
@@ -1,5 +1,4 @@
-<!-- comment -->
-
+<!-- Foundation Annotations generate tmp/route.js -->
---
name: myhome
url: /home
@@ -31,6 +30,6 @@ animationIn: slideInRight
</div>
</div>
-<!--
+
<link-button href="sample" icon="fi-home" label="sample"></link-button>
--->
+
diff --git a/afb-client/app/Frontend/pages/Home/HomeModule.js b/afb-client/app/Frontend/pages/Home/HomeModule.js
index 30e796e..6ebaefc 100644
--- a/afb-client/app/Frontend/pages/Home/HomeModule.js
+++ b/afb-client/app/Frontend/pages/Home/HomeModule.js
@@ -29,10 +29,10 @@ angular.module('HomeModule', ['SubmitButton', 'TokenRefresh'])
// Make sure we clean everything when Open/Close is called
if (apiname === "APIcreate" || apiname === "APIreset") {
- scope["APIreset"]='';
- scope["APIcreate"]='';
- scope["APIrefresh"]='';
- scope["APIcheck"]='';
+ scope.APIreset ='';
+ scope.APIcreate ='';
+ scope.APIrefresh='';
+ scope.APIcheck ='';
}
scope[apiname]="success";
diff --git a/afb-client/app/Frontend/pages/Sample/Sample.html b/afb-client/app/Frontend/pages/Sample/Sample.html
index e7e9164..35523a9 100644
--- a/afb-client/app/Frontend/pages/Sample/Sample.html
+++ b/afb-client/app/Frontend/pages/Sample/Sample.html
@@ -1,5 +1,4 @@
-<!-- comment -->
-
+<!-- Foundation Annotations generate tmp/route.js -->
---
name: mysample
url: /sample
@@ -8,16 +7,28 @@ animationIn: slideInRight
---
<h1><img class="logo" src="images/logo/triskel_iot_bzhx250.png" alt="IoT.bzh Logo" style="height:150px;">
- Not Working
+ Post File Upload
</h1>
<div class="sample-box box-content">
- <upload-file name="avatar" category="avatars" icon="tux-visitor.png"></upload-file>
+ <!-- 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 name="avatar" category="avatar" thumbnail="tux-visitor.png" maxsize="100"
+ posturl="/api/post/upload-image" callback="ctrl.FileUploaded" accept="image">
+ </upload-image>
- <submit-button class="sample-button" icon="fi-zoom-in" label="Vol+" clicked="ctrl.MuteOn" ></submit-button>
- <submit-button class="sample-button" icon="fi-zoom-out" label="Vol-" clicked="ctrl.MuteOff" ></submit-button>
- <submit-button class="home-button" icon="fi-upload" label="Refresh" clicked="ctrl.UploadFile" ></submit-button>
+ <!-- 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"></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"></upload-appli>
</div>
diff --git a/afb-client/app/Frontend/pages/Sample/SampleModule.js b/afb-client/app/Frontend/pages/Sample/SampleModule.js
index 2a2e777..8ae82ea 100644
--- a/afb-client/app/Frontend/pages/Sample/SampleModule.js
+++ b/afb-client/app/Frontend/pages/Sample/SampleModule.js
@@ -2,46 +2,16 @@
'use strict';
// list all rependencies within the page + controler if needed
-angular.module('SampleModule', ['SubmitButton','UploadFile'])
+angular.module('SampleModule', ['SubmitButton','UploadFiles'])
.controller('SampleController', function ($http) {
- var self = this; // I hate JavaScript
- this.status='muted-off';
+ var scope = this; // I hate JavaScript
- console.log ("sample controller");
-
- this.MuteOn = function() {
- console.log ("Muted");
- // send AJAX request to server
- var handler = $http.post('/api/dbus/ping', {type:'mute', action: "on"});
-
- handler.success(function(response, errcode, headers, config) {
- self.status = 'muted-on';
- });
-
- handler.error(function(status, errcode, headers) {
- console.log ("Oops /api/dbus/pring err=" + errcode);
- self.status = 'muted-error';
- });
- };
+ console.log ("sample Init");
- this.MuteOff = function() {
- console.log ("UnMuted");
- // send AJAX request to server
- var handler = $http.post('/api/dbus/ping', {type:'mute', action: "off"});
-
- handler.success(function(response, errcode, headers, config) {
- self.status = 'muted-off';
- });
-
- handler.error(function(status, errcode, headers) {
- console.log ("Oops /api/dbus/ping err=" + errcode);
- self.status = 'muted-error';
- });
-
+ scope.FileUploaded = function (response) {
+ console.log ("FileUploaded response=%s", JSON.stringify(response));
};
-
-
});
console.log ("SampleControler Loaded");