+ hide assignee

+ hide due date
This commit is contained in:
Bengt Brodersen 2015-06-07 13:39:29 +02:00
parent d29739acef
commit c7fcc2767b
2 changed files with 1528 additions and 1460 deletions

View File

@ -5,7 +5,7 @@
var global = {};
global.isDev = /.*jira.atlassian.com\/secure\/RapidBoard.jspa\?.*projectKey=ANERDS.*/g.test(document.URL) // Jira
|| /.*pivotaltracker.com\/n\/projects\/510733.*/g.test(document.URL) // PivotTracker
|| ( /.*trello.com\/.*/g.test(document.URL) && jQuery("span.js-member-name").text() =='Bengt Brodersen'); // Trello
|| (/.*trello.com\/.*/g.test(document.URL) && jQuery("span.js-member-name").text() == 'Bengt Brodersen'); // Trello
global.isProd = !global.isDev;
window.addEventListener("error", function(event) {
@ -69,14 +69,21 @@
var printFrame = jQuery("#card-print-dialog-content-iframe");
var printWindow = printFrame[0].contentWindow;
printWindow.addEventListener("resize", function(){redrawCards();});
printWindow.matchMedia("print").addListener(function(){redrawCards();});
printWindow.addEventListener("resize", function() {
redrawCards();
});
printWindow.matchMedia("print").addListener(function() {
redrawCards();
});
jQuery("#rowCount").val(readCookie("card_printer_row_count",2));
jQuery("#columnCount").val(readCookie("card_printer_column_count",1));
jQuery("#rowCount").val(readCookie("card_printer_row_count", 2));
jQuery("#columnCount").val(readCookie("card_printer_column_count", 1));
//jQuery("#font-scale-range").val(readCookie("card_printer_font_scale",1));
jQuery("#single-card-page-checkbox").attr('checked',readCookie("card_printer_single_card_page", 'true' ) == 'true');
jQuery("#hide-description-checkbox").attr('checked',readCookie("card_printer_hide_description", 'false') == 'true');
jQuery("#single-card-page-checkbox").attr('checked', readCookie("card_printer_single_card_page", 'true') == 'true');
jQuery("#hide-description-checkbox").attr('checked', readCookie("card_printer_hide_description", 'false') == 'true');
jQuery("#hide-assignee-checkbox").attr('checked', readCookie("card_printer_hide_assignee", 'true') == 'true');
jQuery("#hide-due-date-checkbox").attr('checked', readCookie("card_printer_hide_due_date", 'false') == 'true');
jQuery("#hide-status-checkbox").attr('checked', readCookie("card_printer_hide_status", 'true') == 'true');
jQuery("#card-print-dialog-title").text("Card Print - Loading " + issueKeyList.length + " issues...");
renderCards(issueKeyList, function() {
@ -100,7 +107,7 @@
}
global.resourceOrigin = global.hostOrigin + "resources/";
if (global.isProd){
if (global.isProd) {
initGoogleAnalytics();
}
}
@ -166,36 +173,13 @@
function redrawCards() {
var printFrame = jQuery("#card-print-dialog-content-iframe");
var printWindow = printFrame[0].contentWindow;
var printDocument = printWindow.document;
// hide/show description
jQuery("#styleHideDescription", printDocument).remove();
if(jQuery("#hide-description-checkbox")[0].checked){
var style= document.createElement('style');
style.id = 'styleHideDescription';
style.type ='text/css';
style.innerHTML = ".issue-description { display: none; }"
jQuery("head", printDocument).append(style);
}
// enable/disable single card page
jQuery("#styleSingleCardPage", printDocument).remove();
if(jQuery("#single-card-page-checkbox")[0].checked){
var style= document.createElement('style');
style.id = 'styleSingleCardPage';
style.type ='text/css';
style.innerHTML = ".card { page-break-after: always; float: none; }"
jQuery("head", printDocument).append(style);
}
styleCards();
scaleCards();
cropCards();
var printFrame = jQuery("#card-print-dialog-content-iframe");
resizeIframe(printFrame);
resizeIframe(jQuery("#card-print-dialog-content-iframe"));
}
@ -259,7 +243,63 @@
card.find(".issue-qr-code").css("background-image", "url('" + qrCodeUrl + "')");
}
function scaleCards(){
function styleCards() {
var printFrame = jQuery("#card-print-dialog-content-iframe");
var printWindow = printFrame[0].contentWindow;
var printDocument = printWindow.document;
// hide/show description
jQuery("#styleHideDescription", printDocument).remove();
if (jQuery("#hide-description-checkbox")[0].checked) {
var style = document.createElement('style');
style.id = 'styleHideDescription';
style.type = 'text/css';
style.innerHTML = ".issue-description { display: none; }"
jQuery("head", printDocument).append(style);
}
// hide/show assignee
jQuery("#styleHideAssignee", printDocument).remove();
if (jQuery("#hide-assignee-checkbox")[0].checked) {
var style = document.createElement('style');
style.id = 'styleHideAssignee';
style.type = 'text/css';
style.innerHTML = ".issue-assignee { display: none; }"
jQuery("head", printDocument).append(style);
}
// hide/show assignee
jQuery("#styleHideDueDate", printDocument).remove();
if (jQuery("#hide-due-date-checkbox")[0].checked) {
var style = document.createElement('style');
style.id = 'styleHideDueDate';
style.type = 'text/css';
style.innerHTML = ".issue-due-box { display: none; }"
jQuery("head", printDocument).append(style);
}
// hide/show status
jQuery("#styleHideStatus", printDocument).remove();
if (!jQuery("#hide-status-checkbox")[0].checked) {
var style = document.createElement('style');
style.id = 'styleHideStatus';
style.type = 'text/css';
style.innerHTML = ".issue-status { display: none; }"
jQuery("head", printDocument).append(style);
}
// enable/disable single card page
jQuery("#styleSingleCardPage", printDocument).remove();
if (jQuery("#single-card-page-checkbox")[0].checked) {
var style = document.createElement('style');
style.id = 'styleSingleCardPage';
style.type = 'text/css';
style.innerHTML = ".card { page-break-after: always; float: none; }"
jQuery("head", printDocument).append(style);
}
}
function scaleCards() {
var printFrame = jQuery("#card-print-dialog-content-iframe");
var printWindow = printFrame[0].contentWindow;
var printDocument = printWindow.document;
@ -274,17 +314,17 @@
// size horizontal
jQuery("#styleColumnCount", printDocument).remove();
var style= document.createElement('style');
var style = document.createElement('style');
style.id = 'styleColumnCount';
style.type ='text/css';
style.type = 'text/css';
style.innerHTML = ".card { width: calc( 100% / " + columnCount + " - 0.0001px ); }"
jQuery("head", printDocument).append(style);
// size horizontal
jQuery("#styleRowCount", printDocument).remove();
var style= document.createElement('style');
var style = document.createElement('style');
style.id = 'styleRowCount';
style.type ='text/css';
style.type = 'text/css';
style.innerHTML = ".card { height: calc( 100% / " + rowCount + " - 0.0001px ); }"
jQuery("head", printDocument).append(style);
@ -294,21 +334,21 @@
// scale horizontal
// substract one pixel due to rounding problems
var cardMaxWidth = Math.floor(jQuery(".card", printDocument).outerWidth() / columnCount) ;
var cardMinWidth = jQuery(".card", printDocument).css("min-width").replace("px", "") ;
var cardMaxWidth = Math.floor(jQuery(".card", printDocument).outerWidth() / columnCount);
var cardMinWidth = jQuery(".card", printDocument).css("min-width").replace("px", "");
var scaleWidth = cardMaxWidth / cardMinWidth;
// scale vertical
// substract one pixel due to rounding problems
// dont know why to multiply outer height with 2
var cardMaxHeight = Math.floor(jQuery(".card", printDocument).outerHeight() * 2 / rowCount) ;
var cardMinHeight = jQuery(".card", printDocument).css("min-height").replace("px", "") ;
var cardMaxHeight = Math.floor(jQuery(".card", printDocument).outerHeight() * 2 / rowCount);
var cardMinHeight = jQuery(".card", printDocument).css("min-height").replace("px", "");
var scaleHeight = cardMaxHeight / cardMinHeight;
// scale min
var scale = Math.min(scaleWidth, scaleHeight, 1);
if(scale < 1) {
jQuery("html", printDocument).css("font-size",scale +"cm");
if (scale < 1) {
jQuery("html", printDocument).css("font-size", scale + "cm");
}
}
@ -318,7 +358,7 @@
var printDocument = printWindow.document;
var cardElements = printDocument.querySelectorAll(".card");
forEach(cardElements, function (cardElement) {
forEach(cardElements, function(cardElement) {
var cardContent = cardElement.querySelectorAll(".card-body")[0];
if (cardContent.scrollHeight > cardContent.offsetHeight) {
cardContent.classList.add("zigzag");
@ -349,8 +389,8 @@
var result = jQuery(document.createElement('div'))
.attr("id", "card-print-overlay")
.html(multilineString(function() {
/*!
<div id="card-print-dialog">
/*!
<div id="card-print-dialog">
<div id="card-print-dialog-header">
<div id="card-print-dialog-title">Card Print</div>
<div id="info">
@ -367,14 +407,17 @@
<label style="display:none; margin-right:10px"><input id="font-scale-range" type="range" min="0.4" max="1.6" step="0.1" value="1.0" />Font Scale</label>
<label style="margin-right:10px;"><input id="rowCount" type="text" class="text" maxlength="1" style="width: 10px;" value="2"/>Row Count</label>
<label style="margin-right:10px;"><input id="columnCount" type="text" class="text" maxlength="1" style="width: 10px;" value="1"/>Column Count</label>
<label style="margin-right:10px"><input id="single-card-page-checkbox" type="checkbox"/>Single Card Page</label>
<label style="margin-right:10px"><input id="single-card-page-checkbox" type="checkbox"/>Single Card Per Page</label>
<label style="margin-right:10px"><input id="hide-description-checkbox" type="checkbox"/>Hide Description</label>
<label style="margin-right:10px"><input id="hide-assignee-checkbox" type="checkbox"/>Hide Assignee</label>
<label style="margin-right:10px"><input id="hide-due-date-checkbox" type="checkbox"/>Hide Due Date</label>
<label style="display:none; margin-right:10px"><input id="hide-status-checkbox" type="checkbox"/>Hide Status</label>
<input id="card-print-dialog-print" type="button" class="aui-button aui-button-primary" value="Print" />
<a id="card-print-dialog-cancel" title="Cancel" class="cancel">Cancel</a>
</div>
</div>
</div>
*/
</div>
*/
}));
// info
@ -391,7 +434,7 @@
// enable single card page
result.find("#single-card-page-checkbox").click(function() {
writeCookie("card_printer_single_card_page",this.checked);
writeCookie("card_printer_single_card_page", this.checked);
redrawCards();
return true;
});
@ -399,7 +442,31 @@
// hide description
result.find("#hide-description-checkbox").click(function() {
writeCookie("card_printer_hide_description",this.checked);
writeCookie("card_printer_hide_description", this.checked);
redrawCards();
return true;
});
// show assignee
result.find("#hide-assignee-checkbox").click(function() {
writeCookie("card_printer_hide_assignee", this.checked);
redrawCards();
return true;
});
// show due date
result.find("#hide-due-date-checkbox").click(function() {
writeCookie("card_printer_hide_due_date", this.checked);
redrawCards();
return true;
});
// show status
result.find("#hide-status-checkbox").click(function() {
writeCookie("card_printer_hide_status", this.checked);
redrawCards();
return true;
});
@ -407,7 +474,7 @@
// scale font
result.find("#font-scale-range").on("input", function() {
writeCookie("card_printer_font_scale",jQuery(this).val());
writeCookie("card_printer_font_scale", jQuery(this).val());
var printFrame = result.find("#card-print-dialog-content-iframe");
var printWindow = printFrame[0].contentWindow;
@ -424,16 +491,16 @@
writeCookie("card_printer_row_count", jQuery(this).val());
redrawCards();
});
result.find("#rowCount").click( function() {
result.find("#rowCount").click(function() {
this.select();
});
result.find("#columnCount").on("input", function() {
writeCookie("card_printer_column_count",jQuery(this).val());
writeCookie("card_printer_column_count", jQuery(this).val());
redrawCards();
});
result.find("#columnCount").click( function() {
result.find("#columnCount").click(function() {
this.select();
});
@ -480,8 +547,8 @@
.attr("id", "card-print-overlay-style")
.attr("type", "text/css")
.html(multilineString(function() {
/*!
#card-print-overlay {
/*!
#card-print-overlay {
position: fixed;
height: 100%;
width: 100%;
@ -493,9 +560,9 @@
word-wrap:break-word;
z-index: 99999;
}
}
#card-print-dialog {
#card-print-dialog {
position: relative;
top: 60px;
@ -513,9 +580,9 @@
border-radius: 4px;
overflow: hidden;
}
}
#card-print-dialog-header {
#card-print-dialog-header {
position: relative;
background: #f0f0f0;
height: 25px;
@ -523,54 +590,54 @@
border-bottom: 1px solid #cccccc;
padding: 15px 20px 15px 20px;
}
}
#card-print-dialog-content {
#card-print-dialog-content {
position: relative;
background: white;
height: calc(100% - 106px);
width: 100%;
overflow: hidden;
}
}
#card-print-dialog-content-iframe {
#card-print-dialog-content-iframe {
position: relative;
height: 100%;
width: 100%;
overflow: hidden;
border:none;
}
}
#card-print-dialog-footer {
#card-print-dialog-footer {
position: relative;
background: #f0f0f0;
border-top: 1px solid #cccccc;
height: 30px;
padding: 10px;
text-align: right;
}
}
#buttons {
#buttons {
position: relative;
float: right;
display: inline-block;
height 30px;
}
}
#info {
#info {
position: relative;
float: right;
display: inline-block;
height 30px;
}
#info-line {
}
#info-line {
padding-left: 3rem;
padding-right: 3rem;
}
}
#card-print-dialog-title{
#card-print-dialog-title{
position: relative;
float: left;
color: rgb(51, 51, 51);
@ -580,15 +647,15 @@
font-weight: normal;
height: 30px;
line-height: 30px;
}
.cancel{
}
.cancel{
cursor: pointer;
font-size: 14px;
display: inline-block;
padding: 5px 10px;
vertical-align: baseline;
}
*/
}
*/
}));
return result;
}
@ -600,8 +667,8 @@
.attr("id", issueKey)
.addClass("card")
.html(multilineString(function() {
/*!
<div class="card-content">
/*!
<div class="card-content">
<div class="card-body shadow">
<div class="issue-summary"></div>
<div class="issue-description"></div>
@ -624,9 +691,9 @@
<span class="issue-epic-name"></span>
</div>
</div>
</div>
<div class="author">© qoomon.com Bengt Brodersen</div>
*/
</div>
<div class="author">© qoomon.com Bengt Brodersen</div>
*/
}));
return page;
@ -636,34 +703,34 @@
var result = jQuery(document.createElement('style'))
.attr("type", "text/css")
.html(multilineString(function() {
/*!
* {
/*!
* {
box-sizing: border-box;
overflow: hidden;
}
html {
}
html {
background: WHITE;
padding: 0rem;
margin: 0rem;
font-size: 1.0cm;
overflow-y: scroll;
}
body {
}
body {
padding: 0rem;
margin: 0rem;
}
#preload {
}
#preload {
position: fixed;
top: 0rem;
left: 100%;
}
.author {
}
.author {
position: absolute;
top:0.8rem;
left:calc(50% - 3rem);
font-size: 0.5rem;
}
.card {
}
.card {
position: relative;
float:left;
height: 100%;
@ -675,16 +742,16 @@
border-color: LightGray;
border-style: dotted;
border-width: 0.03cm;
}
.card-content {
}
.card-content {
position: relative;
height: 100%;
// find .card-header;
padding-top: 2rem;
// find .card-footer;
padding-bottom: 1.3rem;
}
.card-body {
}
.card-body {
position: relative;
height: 100%;
margin-left: 0.4rem;
@ -694,33 +761,33 @@
padding-left: 0.4rem;
padding-right: 0.4rem;
background: WHITE;
}
.card-header {
}
.card-header {
position: absolute;
top: 0rem;
height: 4.2rem;
width: 100%;
}
.card-footer {
}
.card-footer {
position: absolute;
bottom: 0rem;
height: 2.2rem;
width: 100%;
}
.issue-summary {
}
.issue-summary {
font-weight: bold;
display: -webkit-box;
//-webkit-line-clamp: 2;
//-webkit-box-orient: vertical;
}
.issue-description {
}
.issue-description {
margin-top: 0.4rem;
display: block;
font-size: 0.6rem;
line-height: 0.6rem;
overflow: hidden;
}
.issue-id {
}
.issue-id {
position: absolute;
left: 1rem;
top: 1.2rem;
@ -736,8 +803,8 @@
text-align: center;
white-space: nowrap;
text-overflow: ellipsis;
}
.issue-icon {
}
.issue-icon {
position: absolute;
left: 0rem;
top: 0rem;
@ -749,24 +816,24 @@
background-repeat: no-repeat;
background-position: center;
background-size: 70%;
}
.issue-icon[type="story"] {
}
.issue-icon[type="story"] {
background-color: GOLD !important;
background-image: url(https://qoomon.github.io/Jira-Issue-Card-Printer/resources/icons/Bulb.png);
}
.issue-icon[type="bug"] {
}
.issue-icon[type="bug"] {
background-color: CRIMSON !important;
background-image: url(https://qoomon.github.io/Jira-Issue-Card-Printer/resources/icons/Bug.png);
}
.issue-icon[type="epic"] {
}
.issue-icon[type="epic"] {
background-color: ROYALBLUE !important;
background-image: url(https://qoomon.github.io/Jira-Issue-Card-Printer/resources/icons/Flash.png);
}
.issue-icon[type="task"] {
}
.issue-icon[type="task"] {
background-color: ORANGE !important;
background-image: url(https://qoomon.github.io/Jira-Issue-Card-Printer/resources/icons/Task.png);
}
.issue-estimate {
}
.issue-estimate {
position: absolute;
left: 2.5rem;
top: 0.0rem;
@ -778,8 +845,8 @@
font-size: 0.9rem;
font-weight: bold;
text-align: center;
}
.issue-qr-code {
}
.issue-qr-code {
position: absolute;
left:0rem;
top: 0rem;
@ -789,8 +856,8 @@
background-repeat: no-repeat;
background-size: cover;
background-position: center;
}
.issue-attachment {
}
.issue-attachment {
position: absolute;
left:2.8rem;
top: 0rem;
@ -802,8 +869,8 @@
background-repeat: no-repeat;
background-position: center;
background-size: 70%;
}
.issue-assignee {
}
.issue-assignee {
position: absolute;
top:0rem;
right:0rem;
@ -821,8 +888,8 @@
font-weight: bold;
font-size: 1.4rem;
line-height: 1.9rem;
}
.issue-epic-box {
}
.issue-epic-box {
position: absolute;
right:3.0rem;
top: 0rem;
@ -842,23 +909,23 @@
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
}
.issue-epic-id {
}
.issue-epic-id {
font-size: 0.5rem;
font-weight: bold;
}
.issue-epic-name {
}
.issue-epic-name {
margin-left: 0.1rem;
font-size: 0.6rem;
font-weight: bold;
}
.issue-due-date-box {
}
.issue-due-date-box {
position: absolute;
right: 0rem;
top: 0rem;
overflow: visible !important;
}
.issue-due-date {
}
.issue-due-date {
position: absolute;
top: 1.3rem;
right: 1rem;
@ -871,8 +938,8 @@
font-weight: bold;
font-size: 0.7rem;
line-height: 1.0rem;
}
.issue-due-icon {
}
.issue-due-icon {
position: absolute;
top: 0.5rem;
right: 0rem;
@ -884,8 +951,8 @@
background-repeat: no-repeat;
background-position: center;
background-size: 65%;
}
.badge, .shadow {
}
.badge, .shadow {
border-style: solid;
border-color: #555;
border-top-width: 0.12rem;
@ -893,19 +960,19 @@
border-bottom-width: 0.21rem;
border-right-width: 0.21rem;
border-radius: 0.25rem;
}
.badge {
}
.badge {
// WHITESMOKE, GAINSBOROM;
background-color: WHITESMOKE;
}
.hidden {
}
.hidden {
display: none;
}
}
.zigzag {
.zigzag {
border-bottom-width: 0rem;
}
.zigzag::after {
}
.zigzag::after {
position: absolute;
bottom: -0.00rem;
left:-0.07rem;
@ -917,8 +984,8 @@
border-image-width: 0 0 0.7rem 0;
border-image-slice: 56 0 56 1;
border-image-repeat: round round;
}
@media print {
}
@media print {
@page {
margin: 0.0mm;
padding: 0.0mm;
@ -931,8 +998,8 @@
page-break-inside: avoid;
}
}
}
*/
}
*/
}).replace(/{RESOURCE_ORIGIN}/g, global.resourceOrigin));
return result;
}
@ -955,7 +1022,7 @@
head.appendChild(script);
}
function initGoogleAnalytics(){
function initGoogleAnalytics() {
// <GoogleAnalytics>
(function(i, s, o, g, r, a, m) {
i['GoogleAnalyticsObject'] = r;
@ -989,17 +1056,18 @@
jQuery.when.apply(jQuery, deferredList).done(callback);
}
function readCookie(name, defaultValue){
function readCookie(name, defaultValue) {
var cookies = document.cookie.split('; ');
for(var i = 0; i<cookies.length; i++){
for (var i = 0; i < cookies.length; i++) {
var cookie = cookies[i].split('=');
if(cookie[0] == name) return cookie[1];
if (cookie[0] == name) return cookie[1];
}
return defaultValue
}
function writeCookie(name, value){
document.cookie=name+"=" +value;
function writeCookie(name, value) {
document.cookie = name + "=" + value;
}
//############################################################################################################################
//############################################################################################################################
@ -1225,7 +1293,7 @@
//############################################################################################################################
//############################################################################################################################
var jiraFunctions = (function (module) {
var jiraFunctions = (function(module) {
module.getSelectedIssueKeyList = function() {
//Browse
@ -1243,7 +1311,7 @@
return [];
};
module.getCardData= function(issueKey, callback) {
module.getCardData = function(issueKey, callback) {
module.getIssueData(issueKey, function(data) {
var issueData = {};
@ -1323,7 +1391,7 @@
return module;
}({}));
var youTrackFunctions = (function (module) {
var youTrackFunctions = (function(module) {
module.getSelectedIssueKeyList = function() {
//Detail View
@ -1341,7 +1409,7 @@
return [];
};
module.getCardData= function(issueKey, callback) {
module.getCardData = function(issueKey, callback) {
module.getIssueData(issueKey, function(data) {
var issueData = {};
@ -1414,7 +1482,7 @@
return module;
}({}));
var pivotalTrackerFunctions = (function (module) {
var pivotalTrackerFunctions = (function(module) {
module.getSelectedIssueKeyList = function() {
//Single Story
@ -1494,7 +1562,7 @@
return module;
}({}));
var trelloFunctions = (function (module) {
var trelloFunctions = (function(module) {
module.getSelectedIssueKeyList = function() {
//Card View
@ -1521,7 +1589,7 @@
if (data.members && data.members.length > 0) {
issueData.assignee = data.members[0].fullName;
issueData.avatarUrl = "https://trello-avatars.s3.amazonaws.com/"+data.members[0].avatarHash+"/170.png";
issueData.avatarUrl = "https://trello-avatars.s3.amazonaws.com/" + data.members[0].avatarHash + "/170.png";
}
if (data.due) {

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.0 KiB