Skip to content

Commit

Permalink
Revert "Added archived option"
Browse files Browse the repository at this point in the history
This reverts commit f36764f.
  • Loading branch information
llad committed Apr 17, 2015
1 parent f36764f commit 3b29527
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 47 deletions.
10 changes: 5 additions & 5 deletions manifest.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"name": "Export for Trello",
"version": "1.9",
"version": "1.7",
"manifest_version" : 2,

"description": "Export Trello Boards to Excel",
"icons": { "128": "icons/icon128.png" },

"content_scripts": [
{
"matches": ["https://trello.com/*"],
Expand All @@ -18,5 +18,5 @@
],
"web_accessible_resources": [
"lib/jquery-2.1.0.min.map"]

}
}
61 changes: 19 additions & 42 deletions trelloexport.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,42 +19,33 @@ var $,


// Variables
var addInterval,
var $excel_btn,
addInterval,
columnHeadings = ['List', 'Title', 'Description', 'Points', 'Due', 'Members', 'Labels', 'Card #', 'Card URL'];

This comment has been minimized.

Copy link
@Stanly54

Stanly54 Mar 11, 2022

its possible to add a columm costumer fields ?


function createExcelExport(event) {
"use strict";

var p_archived = event.data.p_archived;
window.URL = window.webkitURL || window.URL;

function createExcelExport() {
"use strict";
// RegEx to find the points for users of TrelloScrum
var pointReg = /[\(](\x3f|\d*\.?\d+)([\)])\s?/m;

var boardExportURL = $('a.js-export-json').attr('href');

//RegEx to extract Board ID
//RegEx to extract Board ID
var parts = /\/b\/(\w{8})\.json/.exec(boardExportURL);

if (!parts) {
if(!parts) {
alert("Board menu not open.");
return;
}

var idBoard = parts[1];

// set whether we get archived stuff or not
var archive_query = "?lists=all&cards=all";

if (!p_archived) {
archive_query = "?lists=open&cards=visible";
}

var apiURL = "https://trello.com/1/boards/" + idBoard + archive_query + "&card_attachments=cover&card_stickers=true&card_fields=badges%2Cclosed%2CdateLastActivity%2Cdesc%2CdescData%2Cdue%2CidAttachmentCover%2CidList%2CidBoard%2CidMembers%2CidShort%2Clabels%2CidLabels%2Cname%2Cpos%2CshortUrl%2CshortLink%2Csubscribed%2Curl&card_checklists=none&members=all&member_fields=fullName%2Cinitials%2CmemberType%2Cusername%2CavatarHash%2Cbio%2CbioData%2Cconfirmed%2Cproducts%2Curl%2Cstatus&membersInvited=all&membersInvited_fields=fullName%2Cinitials%2CmemberType%2Cusername%2CavatarHash%2Cbio%2CbioData%2Cconfirmed%2Cproducts%2Curl&checklists=none&organization=true&organization_fields=name%2CdisplayName%2Cdesc%2CdescData%2Curl%2Cwebsite%2Cprefs%2Cmemberships%2ClogoHash%2Cproducts&myPrefs=true&fields=name%2Cclosed%2CdateLastActivity%2CdateLastView%2CidOrganization%2Cprefs%2CshortLink%2CshortUrl%2Curl%2Cdesc%2CdescData%2Cinvitations%2Cinvited%2ClabelNames%2Cmemberships%2Cpinned%2CpowerUps%2Csubscribed";
var apiURL = "https://trello.com/1/boards/" + idBoard + "?lists=all&cards=all&card_attachments=cover&card_stickers=true&card_fields=badges%2Cclosed%2CdateLastActivity%2Cdesc%2CdescData%2Cdue%2CidAttachmentCover%2CidList%2CidBoard%2CidMembers%2CidShort%2Clabels%2CidLabels%2Cname%2Cpos%2CshortUrl%2CshortLink%2Csubscribed%2Curl&card_checklists=none&members=all&member_fields=fullName%2Cinitials%2CmemberType%2Cusername%2CavatarHash%2Cbio%2CbioData%2Cconfirmed%2Cproducts%2Curl%2Cstatus&membersInvited=all&membersInvited_fields=fullName%2Cinitials%2CmemberType%2Cusername%2CavatarHash%2Cbio%2CbioData%2Cconfirmed%2Cproducts%2Curl&checklists=none&organization=true&organization_fields=name%2CdisplayName%2Cdesc%2CdescData%2Curl%2Cwebsite%2Cprefs%2Cmemberships%2ClogoHash%2Cproducts&myPrefs=true&fields=name%2Cclosed%2CdateLastActivity%2CdateLastView%2CidOrganization%2Cprefs%2CshortLink%2CshortUrl%2Curl%2Cdesc%2CdescData%2Cinvitations%2Cinvited%2ClabelNames%2Cmemberships%2Cpinned%2CpowerUps%2Csubscribed";

$.getJSON(apiURL, function (data) {

var file = {
worksheets: p_archived ? [[], []] : [[]],
worksheets: [[], []], // worksheets has one empty worksheet (array)
creator: 'TrelloExport',
created: new Date(),
lastModifiedBy: 'TrelloExport',
Expand All @@ -64,7 +55,7 @@ function createExcelExport(event) {

// Setup the active list and cart worksheet
w = file.worksheets[0],
wArchived = p_archived ? file.worksheets[1] : null,
wArchived = file.worksheets[1],
buffer,
i,
ia,
Expand All @@ -77,13 +68,11 @@ function createExcelExport(event) {
w.data[0] = columnHeadings;


// Setup the archive list and card worksheet
if (p_archived) {
wArchived.name = 'Archived ' + data.name.substring(0, 22);
wArchived.data = [];
wArchived.data.push([]);
wArchived.data[0] = columnHeadings;
}
// Setup the archive list and cart worksheet
wArchived.name = 'Archived ' + data.name.substring(0, 22);
wArchived.data = [];
wArchived.data.push([]);
wArchived.data[0] = columnHeadings;

// This iterates through each list and builds the dataset
$.each(data.lists, function (key, list) {
Expand Down Expand Up @@ -186,12 +175,12 @@ function createExcelExport(event) {
saveAs(blob, board_title + '.xlsx');
$("a.pop-over-header-close-btn")[0].click();


});

}



// Add a Export Excel button to the DOM and trigger export if clicked
function addExportLink() {
"use strict";
Expand All @@ -207,27 +196,15 @@ function addExportLink() {

// The new link/button
if ($js_btn.length) {
$('<a>')
.attr({
'class': 'js-export-excel',
'href': '#',
'target': '_blank',
'title': 'Export the board data to Excel with archived lists and cards'
})
.text('Export Excel with Archived')
.click({p_archived: true}, createExcelExport)
.insertAfter($js_btn.parent())
.wrap(document.createElement("li"));

$('<a>')
$excel_btn = $('<a>')
.attr({
'class': 'js-export-excel',
'href': '#',
'target': '_blank',
'title': 'Export the board data to Excel'
'title': 'Open downloaded file with Excel'
})
.text('Export Excel')
.click({p_archived: false}, createExcelExport)
.click(createExcelExport)
.insertAfter($js_btn.parent())
.wrap(document.createElement("li"));

Expand Down

0 comments on commit 3b29527

Please sign in to comment.