added global department's version export

This commit is contained in:
xdrm-brackets 2018-05-12 16:42:46 +02:00
parent 56eb72ac55
commit c52893ffd6
2 changed files with 61 additions and 12 deletions

View File

@ -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;

View File

@ -34,7 +34,14 @@
</div>
</div>
<!-- <div class='header-title'>{{ gstore.header_title }}</div> -->
<!-- Export all -->
<div class='global-export'>
<div class='current export' @click='global_export()'>
<span class='export'></span>
exporter
</div>
</div>
</div>
@ -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(){