diff --git a/gulpfile.js b/gulpfile.js index 6f08d841149ecc200ae0e2da0e24008ac66e33ca..cbc1d7314936a558c70903cbcb90cd4fb48ea116 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -43,7 +43,7 @@ var paths = { // plugins: templatecache_plugin: ['./www/plugins/*/templates/**/*.html'], ng_translate_plugin: ['./www/plugins/*/i18n/locale-*.json'], - ng_annotate_plugin: ['./www/plugins/*/js/**/*.js', '!./www/plugins/*/js/vendor/*.js'], + ng_annotate_plugin: ['./www/plugins/*/**/*.js', '!./www/plugins/*/js/vendor/*.js'], css_plugin: ['./www/plugins/*/css/**/*.css'] }; @@ -188,7 +188,6 @@ gulp.task('templatecache_plugin', function (done) { root: "plugins/" })) .pipe(gulp.dest('./www/dist/dist_js/plugins')) - //.pipe(gulp.dest('./www/plugins')) .on('end', done); }); @@ -203,7 +202,6 @@ gulp.task('ng_translate_plugin', function() { return gulp.src(paths.ng_translate_plugin) .pipe(ngTranslate({standalone:true, module: 'cesium.plugins.translations'})) .pipe(gulp.dest('www/dist/dist_js/plugins')); - //.pipe(gulp.dest('www/plugins')); }); gulp.task('css_plugin', function (done) { diff --git a/www/index.html b/www/index.html index fe6a31274b6cfb3c70104ac2a77d6562ccb62934..e97277e9ab32a289e9f07c53518e2e559f82b167 100644 --- a/www/index.html +++ b/www/index.html @@ -166,6 +166,9 @@ <script src="dist/dist_js/plugins/graph/js/controllers/currency-controllers.js"></script> <script src="dist/dist_js/plugins/graph/js/controllers/account-controllers.js"></script> + <!-- RML9 plugin + <script src="dist/dist_js/plugins/rml9/plugin.js"></script>--> + <!--endRemoveIf(no-plugin)--> <!-- App --> diff --git a/www/plugins/rml9/i18n/locale-fr-FR.json b/www/plugins/rml9/i18n/locale-fr-FR.json new file mode 100644 index 0000000000000000000000000000000000000000..c20b5b06ac7619cb48647ebd42e76fe192335cc9 --- /dev/null +++ b/www/plugins/rml9/i18n/locale-fr-FR.json @@ -0,0 +1,7 @@ +{ + "RML9": { + "WALLET": { + "BTN_EXPORT": "Exporter les transactions", + } + } +} diff --git a/www/plugins/rml9/plugin.js b/www/plugins/rml9/plugin.js new file mode 100644 index 0000000000000000000000000000000000000000..b1f9b687c3c3923350b03ab29d5263f759617132 --- /dev/null +++ b/www/plugins/rml9/plugin.js @@ -0,0 +1,54 @@ + +angular.module('cesium.rml9.plugin', ['cesium.services']) + + .config(function($stateProvider, PluginServiceProvider, csConfig) { + 'ngInject'; + + var enable = true; // csConfig.plugins && csConfig.plugins.rml9; + if (enable) { + + PluginServiceProvider + .extendState('app.view_wallet_tx', { + points: { + 'buttons': { + templateUrl: "plugins/rml9/templates/button.html", + controller: 'Rml9Ctrl' + } + } + }) + ; + } + }) + + /** + * Les controlleurs sont chargés de gérer faire la liaison entre les services d'accès aux données, et l'interface graphique. + * + * Celui-ci sert à étendre la page 'Mes opérations' + */ + .controller('Rml9Ctrl', function($scope, $state, PluginService, FileSaver, BMA, csWallet) { + 'ngInject'; + + $scope.extensionPoint = PluginService.extensions.points.current.get(); + + // Manage click on the export button + $scope.onButtonClick = function() { + + var pubkey = csWallet.data.pubkey; + + BMA.tx.history.all({pubkey: pubkey}) + .then(function(res){ + if (!res || !res.history) return; + console.log(res.history); + + /*var allTx = res.history.received.reduce(function(allTx, tx){ + return res.concat(tx.); + }, []);*/ + + //var saveIdFile = new Blob(["THis is a content"], {type: 'text/plain; charset=utf-8'}); + //FileSaver.saveAs(saveIdFile, 'transactions.txt'); + }); + }; + } +); + + diff --git a/www/plugins/rml9/templates/button.html b/www/plugins/rml9/templates/button.html new file mode 100644 index 0000000000000000000000000000000000000000..f996275ffd3da3d42af2f8d1b0c96bf4c575c52d --- /dev/null +++ b/www/plugins/rml9/templates/button.html @@ -0,0 +1,9 @@ +<!-- Buttons section --> +<ng-if ng-if="extensionPoint === 'buttons'"> + + <button class="button button-stable button-small-padding icon ion-android-archive" + ng-click="onButtonClick()" + title="{{'RML9.WALLET.BTN_EXPORT' | translate}}"> + </button> + +</ng-if>