From c52893ffd6fca1c2a92cf09d2daf0e9a7c87b079 Mon Sep 17 00:00:00 2001 From: xdrm-brackets Date: Sat, 12 May 2018 16:42:46 +0200 Subject: [PATCH] added global department's version export --- webpack/scss/header.scss | 36 +++++++++++++++++++++++++----------- webpack/vue/header.vue | 37 ++++++++++++++++++++++++++++++++++++- 2 files changed, 61 insertions(+), 12 deletions(-) diff --git a/webpack/scss/header.scss b/webpack/scss/header.scss index 2c423e8..0294d33 100644 --- a/webpack/scss/header.scss +++ b/webpack/scss/header.scss @@ -22,11 +22,12 @@ z-index: 150; - /* (1) Version management */ + /* (1) left-side managers */ & > div.departments, - & > div.versions{ + & > div.versions, + & > div.global-export{ - /* (1.1) Version status */ + /* (1.1) Current status */ & > div.current{ display: block; position: relative; @@ -47,11 +48,8 @@ // hover animation &:hover{ box-shadow: 0 2px 2px darken(#fff,10%); } - } - - // current: CREATE + EDIT + REMOVE - & > div.current{ - + // current: EXPORT / CREATE / EDIT / REMOVE icons + span.export, span.create, span.edit, span.remove{ @@ -66,6 +64,14 @@ background: center center no-repeat; background-size: 80% auto; + &.export{ + background-image: url('/asset/svg/fiche.svg@b8c0c8'); + background-size: 100% auto; + &:hover{ + background-image: url('/asset/svg/fiche.svg@#{$rd-form-invalid-color}'); + } + } + &.create{ background-image: url('/asset/svg/plus.svg@b8c0c8'); &:hover{ @@ -91,6 +97,10 @@ margin-right: .5em; } } + + &:hover > span.export{ + background-image: url('/asset/svg/fiche.svg@#{$rd-form-invalid-color}'); + } overflow: hidden; // editable input @@ -186,16 +196,20 @@ } - /* (2) Department | Version layout */ + /* (2) Department | Version | Export layout */ & > div.departments > div.current{ margin-right: 0; padding-left: 1em; border-radius: 3px 0 0 3px; - - &:before{ content: none; } } & > div.versions > div.current{ + margin-left: 0; + border-radius: 0; + border-left: 0; + } + + & > div.global-export > div.current{ margin-left: 0; border-radius: 0 3px 3px 0; border-left: 0; diff --git a/webpack/vue/header.vue b/webpack/vue/header.vue index f54a245..1723807 100644 --- a/webpack/vue/header.vue +++ b/webpack/vue/header.vue @@ -34,7 +34,14 @@ - + + +
+
+ + exporter +
+
@@ -420,8 +427,36 @@ export default { }); + }, + + + /* (x) Exports all data about this department's version + ---------------------------------------------------------*/ + global_export(){ + + api.call(`GET department/export`, {}, function(rs){ + console.log(rs); + + // 1. error -> popup + if( rs.error !== 0 || !rs.hasOwnProperty('link') ){ + + return popup.ask({ + title: 'Erreur ('+rs.error+')', + content: 'L\'export a échoué.', + action: 'OK', + type: 'neutral' + }, () => {}); + + } + + // 2. Launch download + document.location = rs.link; + + }.bind(this)); + } + }, beforeMount(){