Skip to content

Commit

Permalink
added option to remove indent from manual created shelfmarks #6
Browse files Browse the repository at this point in the history
  • Loading branch information
EliDeh committed Aug 22, 2018
1 parent 4ad8473 commit 4b0dfd0
Show file tree
Hide file tree
Showing 5 changed files with 68 additions and 11 deletions.
19 changes: 10 additions & 9 deletions signaturenDruck/css/preview.css
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,7 @@
height: 23mm;
}

.indent>p {
font-size: 16pt;
margin: 0px;
padding-top: 0px;
padding-bottom: 0px;
margin-left: 45%;
}

.center>p {
.center > .previewLine {
font-size: 15pt;
margin: 0pt;
text-align: center;
Expand All @@ -37,6 +29,15 @@

.previewLine {
white-space: pre;
margin: 0px;
font-size: 16pt;
margin: 0px;
padding-top: 0px;
padding-bottom: 0px;
}

.indent > .previewLine {
margin-left: 45%;
}

p#line1 {
Expand Down
3 changes: 3 additions & 0 deletions signaturenDruck/html/manual.html
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@
<input type="radio" name="numberOfLines" value="1"> 1 Zeile
<input type="radio" name="numberOfLines" value="3"> 3 Zeilen
<input type="radio" name="numberOfLines" value="6" checked> 6 Zeilen
<hr>
<input type="checkbox" id="chkbx_removeIndent" name="removeIndent"/>
<label for="chkbx_removeIndent">Einzug entfernen</label>
</fieldset>
</div>
</div>
Expand Down
39 changes: 38 additions & 1 deletion signaturenDruck/manualRenderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ function f () {
} else {
document.getElementById('previewBox').className = 'big indent'
}
toggleChkbx()
break
}
}
Expand Down Expand Up @@ -134,6 +135,7 @@ function next () {
} else {
removeLines()
show(getNumberOfLines())
toggleChkbx()
clearInput()
max++
focusFirst()
Expand Down Expand Up @@ -221,9 +223,11 @@ function getData () {
clearInput()
removeLines()
setLines()
toggleChkbx()
show(getNumberOfLines())
f()
loadData()
toggleIndent()
}

function loadData () {
Expand All @@ -238,6 +242,9 @@ function loadData () {
}
i++
}
if (objct.manual[id].removeIndent) {
document.getElementById('chkbx_removeIndent').checked = true
}
}

function setLines () {
Expand All @@ -260,11 +267,21 @@ function getNumberOfLines () {
return numberOfLinesValue
}

function toggleChkbx () {
let chkbx = document.getElementById('chkbx_removeIndent')
chkbx.disabled = false
chkbx.checked = false
}

function saveCurrent () {
let lineTxts = []
let numberOfLinesValue = getNumberOfLines()
let i = 0
let oneLineTxt = ''
let removeIndent = false
if (document.getElementById('chkbx_removeIndent').checked) {
removeIndent = true
}
while (i < (numberOfLinesValue)) {
let k = i + 1
lineTxts[i] = document.getElementById('line_' + k).value
Expand All @@ -276,7 +293,26 @@ function saveCurrent () {
'size': document.getElementById('previewBox').className.split(' ')[0],
'lines': numberOfLinesValue,
'lineTxts': lineTxts,
'oneLineTxt': oneLineTxt
'oneLineTxt': oneLineTxt,
'removeIndent': removeIndent
}
}

function toggleIndent () {
let chkbx = document.getElementById('chkbx_removeIndent')
let previewClassList = document.getElementById('previewBox').classList
if (getNumberOfLines() != 1) {
if (chkbx.checked) {
previewClassList.remove('indent')
} else {
previewClassList.add('indent')
}
} else {
if (chkbx.checked) {
document.getElementById('line1').style.textAlign = 'left'
} else {
document.getElementById('line1').style.textAlign = 'center'
}
}
}

Expand All @@ -285,3 +321,4 @@ document.getElementById('btn_previous').addEventListener('click', previous)
document.getElementById('btn_delete').addEventListener('click', deleteData)
document.getElementById('btn_deleteAndExit').addEventListener('click', deleteAndExit)
document.getElementById('btn_saveAndExit').addEventListener('click', saveAndExit)
document.getElementById('chkbx_removeIndent').addEventListener('change', toggleIndent)
9 changes: 9 additions & 0 deletions signaturenDruck/printRenderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,18 @@ function createSmall (data, dataMan, file) {
let div = document.createElement('div')
let line = document.createElement('p')
div.className = getShelfmarkClass(objct, length)
if (shelfmark.removeIndent) {
div.classList.remove('indent')
}
div.id = id
let text = dataMan[manualId].lineTxts
let lineCount = length
text.forEach(element => {
if ((lineCount == 1) && (text.length == 1)) {
line.className = 'shelfmarkLine_' + i + ' oneLine' + ' small'
if (shelfmark.removeIndent) {
line.style.textAlign = 'left'
}
} else {
line.className = 'shelfmarkLine_' + i + ' small'
}
Expand Down Expand Up @@ -201,6 +207,9 @@ function createBig (data, dataMan, file) {
let div = document.createElement('div')
let line = document.createElement('p')
div.className = 'shelfmark indent'
if (dataMan[manualId].removeIndent) {
div.classList.remove('indent')
}
div.id = id
shelfmark.lineTxts.forEach(element => {
line.className = 'shelfmarkLine_' + i
Expand Down
9 changes: 8 additions & 1 deletion signaturenDruck/renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -492,7 +492,8 @@ function printButton () {
'id': '',
'count': '1',
'size': 'big',
'short': false
'short': false,
'removeIndent': false
}
if (elems[i].id.includes('print_m_')) {
data.id = elems[i].id.split('print_')[1]
Expand Down Expand Up @@ -547,6 +548,9 @@ function preMan (id) {
prevBox.className = 'small center'
removeOld()
addLines()
if (objMan[id].removeIndent) {
document.getElementById('line1').style.textAlign = 'left'
}
} else if (objMan[id].lines == 3) {
prevBox.className = 'small indent'
removeOld()
Expand All @@ -556,6 +560,9 @@ function preMan (id) {
removeOld()
addLines()
}
if (objMan[id].removeIndent) {
prevBox.classList.remove('indent')
}

function addLines () {
let line
Expand Down

0 comments on commit 4b0dfd0

Please sign in to comment.