Skip to content
Snippets Groups Projects
Commit 7cf47910 authored by kidkinster's avatar kidkinster
Browse files

induced NCS, Quicklist penthouse tabs

Had a rethink and just put some filters on the tabbed content, so that
it only activates on the 'All' tab (which is the default tab).  The idea
is if you're clicking on the other tabs, you've already narrowed your
selection, but in the 'All' tab, the quick list will appear and work as
expected.

-	new file:   src/js/hTagMacroJS.tw
-	modified:   src/uncategorized/slaveSummary.tw
parent 598425f2
No related branches found
No related tags found
No related merge requests found
:: HTAG Macro JS [script]
/*
* <<htag>> macro
* A simple macro which allows to create wrapping html elements with dynamic IDs.
* idea blatantly robbed from the spanMacroJS.tw but expanded to a more generic
* case, allowing <div>, <button> or whatever you want. elements, default is for
* the div though. In addition, you can pass an object in as the first argument
* instead of an id, and each of the object's attributes will become attributes
* of the generate tag.
*
* Usage: <<htag id>>...<</htag>>
* Usage: <<htag id tag>>...<</htag>>
* Usage: <<htag atributes>>...<</htag>>
* Usage: <<htag atributes tag>>...<</htag>>
*/
Macro.add('htag', {
tags : null,
munge(val, key) { return key + '="' + val + '"'; },
handler() {
const payload = this.payload[0].contents.replace(/(^\n+|\n+$)/, '');
let htag = 'div';
let attributes;
if (1 > this.args.length) {
return this.error('invalid syntax, format: <<htag [id [ tag ] | attributes [ tag ] >>');
}
if (1 < this.args.length) {
htag = String(this.args[1]).trim();
}
if (typeof this.args[0] === "object") {
attributes = //$.map(this.args[0], munge).join(" ");
$.map(
this.args[0],
function (val, key) { return key + '="' + val + '"'; })
.join(" ");
} else {
attributes = 'id="' + String(this.args[0]).trim() + '"';
}
Config.debug && this.debugView.modes({block: true});
jQuery('<' + htag + ' ' + attributes + ' />')
.wiki(payload)
.appendTo(this.output);
}
});
......@@ -94,7 +94,7 @@
/* Useful for finding weird combinations -- usages of this passage that don't yet generate the quick index.
* <<print 'pass/count/indexed/flag::[' + _Pass + '/' + _Count + '/' + _indexed + '/' + $Flag + ']'>>
*/
<<if ((_Count > 1) && (_indexed == 0) && (((_Pass == 'Main') && (ndef $Flag)) || ($Flag == 1)))>>
<<if ((_Count > 1) && (_indexed == 0) && (((_Pass == 'Main') && (ndef $Flag) && (($useSlaveSummaryTabs == 0) || ($slaveAssignmentTab == "all"))) || ($Flag == 1)))>>
<<set _indexed = 1, _counter = 0, _buttons = [], _offset = -50>>
<<if (/Select/i.test(_Pass))>>
<<set _offset = -25>>
......@@ -116,13 +116,16 @@
<br />
<<set _tableCount = _tableCount || 0>>
<<set _tableCount++>>
<<set _quickList = '<button data-quick-index="' + _tableCount + '">Quick Index</button>'>>
<<set _listDivOpen = '<div id="list_index' + _tableCount + '" class="hidden">'>>
<<set _listDivClose = '</div><!-- ' + _tableCount + ' -->'>>
_quickList
/% <button data-quick-index="<<print _tableCount>>">Quick Index</button> %/
_listDivOpen
/% <div id="list_index<<print _tableCount>>" class="hidden"> %/
/*
* we want <button data-quick-index="<<= _tableCount>>"> ...
*/
<<set _buttonAttributes = { 'data-quick-index': _tableCount }>>
<<htag _buttonAttributes 'button'>>Quick Index<</htag>>
/*
* we want <div id="list_index3" class=" hidden">...
*/
<<set _divAttributes = { id: 'list_index' + _tableCount, class: 'hidden'}>>
<<htag _divAttributes>>
<<for !_.isUndefined(_ssii = _indexSlavesIdxs.shift())>>
<<set _IndexSlave = $slaves[_ssii]>>
<<if $surnameOrder != 1>>
......@@ -177,8 +180,7 @@
});
</script>
<</if>>
_listDivClose
/% </div> %/
<</htag>>
<</if>>
<</if>>
<<switch _Pass>>
......@@ -756,7 +758,10 @@ will
<</if>> /* closes _numFacilities */
<<print '<span id="slave-' + $slaves[_ssi].ID + '">&nbsp;</span><br/>'>>
<<if ((_Pass != 'Main') || (def $Flag) || ($useSlaveSummaryTabs == 0) || ($slaveAssignmentTab == "all"))>>
<<print '<span id="slave-' + $slaves[_ssi].ID + '">&nbsp;</span>'>>
<</if>>
<br/>
<<if $seeImages != 1 || $seeSummaryImages != 1 || $imageChoice == 1>>&nbsp;&nbsp;&nbsp;&nbsp;<</if>>
<<SlaveSummary _Slave>>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment