[Fix #929] Add a current-tab only print feature

This commit is contained in:
gregoirenovel 2017-11-23 18:00:13 +01:00
parent 3c5361a96f
commit db3e07820a
5 changed files with 98 additions and 2 deletions

View file

@ -0,0 +1,8 @@
$(document).on("click", "body", function () {
$(".print-menu").removeClass("open fade-in-down");
});
TPS.togglePrintMenu = function(event) {
event.stopPropagation();
$(".print-menu").toggleClass("open fade-in-down");
}

View file

@ -30,3 +30,58 @@
font-size: 14px; font-size: 14px;
line-height: 20px; line-height: 20px;
} }
.print-menu-opener {
position: relative;
}
.print-menu {
display: none;
position: absolute;
right: 0;
top: 45px;
font-size: 14px;
background: #FFFFFF;
box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
border: 1px solid $border-grey;
min-width: 270px;
max-width: 340px;
z-index: 20;
&.open {
display: block;
}
li {
border-bottom: 1px solid $border-grey;
&:last-child {
border-bottom: none;
}
.menu-item {
align-items: center;
padding: 14px;
color: $grey;
overflow: hidden;
text-overflow: ellipsis;
img {
margin-right: 14px;
}
}
.menu-link {
display: flex;
color: $black;
&:hover {
background: $light-grey;
}
}
}
}
.print-header {
display: none;
}

View file

@ -104,6 +104,13 @@
font-weight: bold; font-weight: bold;
} }
&.icon-only {
&::after {
margin-left: 2px;
color: $blue;
}
}
.dropdown-content { .dropdown-content {
display: none; display: none;
} }

View file

@ -1,6 +1,20 @@
@import "colors"; @import "colors";
@import "fonts"; @import "fonts";
.new-header,
.backoffice-header,
footer {
display: none;
}
.print-header {
display: block;
margin-top: 30px;
font-size: 30px;
line-height: 50px;
font-weight: bold;
}
body { body {
font-family: "Muli"; font-family: "Muli";
} }

View file

@ -7,8 +7,14 @@
%li %li
= "Dossier nº #{dossier.id}" = "Dossier nº #{dossier.id}"
.mixed-buttons-bar .mixed-buttons-bar
= link_to print_dossier_path(dossier.procedure, dossier), target: "_blank", class: "button icon-only" do .button.dropdown.icon-only.print-menu-opener{ onclick: "javascript:TPS.togglePrintMenu(event);" }
.icon.printer> .icon.printer
%ul.print-menu
%li
= link_to "Tout le dossier", print_dossier_path(dossier.procedure, dossier), target: "_blank", class: "menu-item menu-link"
%li
= link_to "Uniquement cet onglet", "#", onclick: "TPS.togglePrintMenu; window.print()", class: "menu-item menu-link"
= render partial: "new_gestionnaire/procedures/dossier_actions", locals: { procedure: dossier.procedure, dossier: dossier, dossier_is_followed: current_gestionnaire&.follow?(dossier) } = render partial: "new_gestionnaire/procedures/dossier_actions", locals: { procedure: dossier.procedure, dossier: dossier, dossier_is_followed: current_gestionnaire&.follow?(dossier) }
= render partial: "state_button", locals: { dossier: dossier } = render partial: "state_button", locals: { dossier: dossier }
%ul.tabs %ul.tabs
@ -29,3 +35,9 @@
- if notifications_summary[:messagerie] - if notifications_summary[:messagerie]
%span.notifications{ 'aria-label': 'notifications' } %span.notifications{ 'aria-label': 'notifications' }
= link_to "Messagerie", messagerie_dossier_path(dossier.procedure, dossier) = link_to "Messagerie", messagerie_dossier_path(dossier.procedure, dossier)
.container
.print-header
= dossier.procedure.libelle.truncate_words(10)
>
= "Dossier nº #{dossier.id} (#{dossier.statut})"