[webpack.teacher] updated fields names + pdf download works [scss.container.card] added PDF download icon

This commit is contained in:
xdrm-brackets 2018-03-26 13:23:32 +02:00
parent a4e56c8574
commit 72e38d59b1
3 changed files with 73 additions and 2 deletions

View File

@ -93,12 +93,13 @@
</div>
<div title='équivalents TD'>
<span>{{ prof.equiTD }}</span>
<span>heures prévues</span>
<span>HETD</span>
</div>
</div>
<!-- if VIEW MODE -->
<div v-show='gstore.edit_i!=pi' class='sub' title='total des heures prévues'><strong>{{ prof.VHCours + prof.VHTd + prof.VHTp }}h</strong> réelles prévues</div>
<div v-show='gstore.edit_i!=pi' class='sub' title='total des heures prévues'><strong>{{ prof.VHCours + prof.VHTd + prof.VHTp }}h</strong> présentielles</div>
<div v-show='gstore.edit_i!=pi' class='pdfdl' title='Télécharger la fiche' @click='gstore.id_handler(prof.idProfesseur)'>fiche</div>
<!-- if EDIT MODE -->
<div v-show='gstore.edit_i==pi' :class="gstore.edit_err.length > 0 ? 'sub warning' : 'sub'" :data-valid='gstore.edit_err_valid?1:0'>{{ gstore.edit_err }}</div>
<!-- endif -->

View File

@ -658,3 +658,37 @@ gstore.add('ia_handler', function(prof_i){
});
});
/* (9) Manage instant download fiche
---------------------------------------------------------*/
/* (1) Define download handler */
gstore.add('id_handler', function(prof_id){
/* (1) Abort if wrong prof_id */
if( prof_id == null || isNaN(prof_id) )
return;
/* (2.1) Find index in gstore */
var gi = gstore.get.professors.map( (data, i) => { return ( data.idProfesseur && data.idProfesseur == prof_id ) ? i : ''; }).join('');
/* (2.2) Exit if not found */
if( isNaN(gi) ) return;
var local = gstore.get.professors[gi];
/* (3.1) Update in database */
api.call(`GET professor/pdf/${local.idProfesseur}`, {}, function(rs){
/* (3.1.1) Abort on error */
if( rs.error !== 0 || rs.link == null )
return console.log('Impossible de télécharger la fiche, erreur '+rs.error);
/* (3.1.2) Success */
document.location = rs.link;
});
});

View File

@ -541,6 +541,42 @@
}
/* (8) Card sub */
& > div.pdfdl{
display: inline-block;
margin-top: 1em;
color: lighten($primary-color, 20%);
transition: color .1s ease-in-out;
cursor: pointer;
&:before{
content: '';
display: inline-block;
position: relative;
top: .2em;
width: 1em;
height: 1em;
margin-right: .5em;
background: url('/asset/svg/fiche.svg@#{$menu-item-inactive}') center center no-repeat;
background-size: contain;
}
&:hover{
color: #333;
&:before{ background-image: url('/asset/svg/fiche.svg@ea4C3a'); }
}
}
}