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; z-index: 150;
/* (1) Version management */ /* (1) left-side managers */
& > div.departments, & > div.departments,
& > div.versions{ & > div.versions,
& > div.global-export{
/* (1.1) Version status */ /* (1.1) Current status */
& > div.current{ & > div.current{
display: block; display: block;
position: relative; position: relative;
@ -47,11 +48,8 @@
// hover animation // hover animation
&:hover{ box-shadow: 0 2px 2px darken(#fff,10%); } &:hover{ box-shadow: 0 2px 2px darken(#fff,10%); }
} // current: EXPORT / CREATE / EDIT / REMOVE icons
span.export,
// current: CREATE + EDIT + REMOVE
& > div.current{
span.create, span.create,
span.edit, span.edit,
span.remove{ span.remove{
@ -66,6 +64,14 @@
background: center center no-repeat; background: center center no-repeat;
background-size: 80% auto; 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{ &.create{
background-image: url('/asset/svg/plus.svg@b8c0c8'); background-image: url('/asset/svg/plus.svg@b8c0c8');
&:hover{ &:hover{
@ -91,6 +97,10 @@
margin-right: .5em; margin-right: .5em;
} }
} }
&:hover > span.export{
background-image: url('/asset/svg/fiche.svg@#{$rd-form-invalid-color}');
}
overflow: hidden; overflow: hidden;
// editable input // editable input
@ -186,16 +196,20 @@
} }
/* (2) Department | Version layout */ /* (2) Department | Version | Export layout */
& > div.departments > div.current{ & > div.departments > div.current{
margin-right: 0; margin-right: 0;
padding-left: 1em; padding-left: 1em;
border-radius: 3px 0 0 3px; border-radius: 3px 0 0 3px;
&:before{ content: none; }
} }
& > div.versions > div.current{ & > div.versions > div.current{
margin-left: 0;
border-radius: 0;
border-left: 0;
}
& > div.global-export > div.current{
margin-left: 0; margin-left: 0;
border-radius: 0 3px 3px 0; border-radius: 0 3px 3px 0;
border-left: 0; border-left: 0;

View File

@ -34,7 +34,14 @@
</div> </div>
</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> </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(){ beforeMount(){