From 54e44a3a95d3ad86e650a88651054525df7a3cbd Mon Sep 17 00:00:00 2001 From: "luis.reischak" Date: Sun, 24 Feb 2019 10:50:10 -0300 Subject: [PATCH] fix sei v3.0.15 incompatibility --- src/css/process_content.scss | 36 +++++++++++++++++++++++++++ src/js/entries/process_content/dom.js | 11 ++++++-- src/js/view/ui.js | 2 +- src/manifest.json | 1 + webpack.config.js | 1 + 5 files changed, 48 insertions(+), 3 deletions(-) create mode 100644 src/css/process_content.scss diff --git a/src/css/process_content.scss b/src/css/process_content.scss new file mode 100644 index 0000000..b08b027 --- /dev/null +++ b/src/css/process_content.scss @@ -0,0 +1,36 @@ +/* + Estilo para ser inserido na Árvore do Processo +*/ + + + +/* styles to handle sei v3.0.15 new tree structure */ +html.sei-v3015 { + + height: 100%; + + > body { + display: flex; + flex-direction: column; + height: 100%; + margin: 0; + + > [data-trello-process-box] { + margin: inherit; + } + + > #header { + position: static; + overflow: hidden; + } + + > #container { + position: static; + height: auto; + margin-top: 0; + flex: 1; + } + + } + +} diff --git a/src/js/entries/process_content/dom.js b/src/js/entries/process_content/dom.js index d235af2..0af8d40 100644 --- a/src/js/entries/process_content/dom.js +++ b/src/js/entries/process_content/dom.js @@ -16,8 +16,14 @@ const getProcessNumber = () => { return match[1]; }; +const checkIfSEI3015 = () => { + return (!!document.querySelector('div#header') && !!document.querySelector('div#container')); +}; + const addTrelloBox = () => { + if (checkIfSEI3015()) document.documentElement.classList.add('sei-v3015'); + const body = document.querySelector('body'); const mainForm = document.querySelector('form#frmArvore'); @@ -32,7 +38,7 @@ const addTrelloBox = () => { /* add trello card placeholder */ const cardPlaceholder = document.createElement('div'); cardPlaceholder.classList.add('trello-card'); - cardPlaceholder.setAttribute('full-width', null); + cardPlaceholder.setAttribute('data-full-width', ''); trelloBox.appendChild(cardPlaceholder); /* add create trello card button placeholder */ @@ -40,10 +46,11 @@ const addTrelloBox = () => { createCardPlaceHolder.classList.add('trello-create-card-button'); trelloBox.appendChild(createCardPlaceHolder); - body.insertBefore(trelloBox, mainForm); + body.insertAdjacentElement('afterbegin', trelloBox); }; export const prepare = () => { + addTrelloBox(); }; diff --git a/src/js/view/ui.js b/src/js/view/ui.js index 0d036ad..deec488 100644 --- a/src/js/view/ui.js +++ b/src/js/view/ui.js @@ -33,7 +33,7 @@ const renderFilterButton = (placeholder, data) => { const renderTrelloCard = (placeholder, card, hasAnotherCard, originalAnchor) => { - const fullWidth = placeholder.hasAttribute('full-width'); + const fullWidth = placeholder.hasAttribute('data-full-width'); ReactDOM.render(