Use conditional to simplify some other HTML templates.

This commit is contained in:
ccd0 2015-03-28 15:33:09 -07:00
parent bf34d8cacb
commit b2659b91dd
3 changed files with 9 additions and 9 deletions

View File

@ -131,7 +131,7 @@ ThreadHiding =
a = $.el 'a',
className: "#{type}-thread-button"
href: 'javascript:;'
$.extend a, <%= html('<span class="fa fa-${(type === "hide") ? "minus" : "plus"}-square"></span>') %>
$.extend a, <%= html('<span class="fa fa-?{type === "hide"}{minus}{plus}-square"></span>') %>
a.dataset.fullID = thread.fullID
$.on a, 'click', ThreadHiding.toggle
a

View File

@ -2,14 +2,14 @@ ThreadStats =
init: ->
return if g.VIEW isnt 'thread' or !Conf['Thread Stats']
statsHTML = <%= html('<span id="post-count">?</span> / <span id="file-count">?</span>') %>
statsHTML = <%= html(
'<span id="post-count">?</span> / <span id="file-count">?</span>' +
'?{Conf["IP Count in Stats"]}{ / <span id="ip-count">?</span>}' +
'?{Conf["Page Count in Stats"]}{ / <span id="page-count">?</span>}'
) %>
statsTitle = 'Posts / Files'
if Conf['IP Count in Stats']
statsHTML = <%= html('&{statsHTML} / <span id="ip-count">?</span>') %>
statsTitle += ' / IPs'
if Conf['Page Count in Stats']
statsHTML = <%= html('&{statsHTML} / <span id="page-count">?</span>') %>
statsTitle += ' / Page'
statsTitle += ' / IPs' if Conf['IP Count in Stats']
statsTitle += ' / Page' if Conf['Page Count in Stats']
if Conf['Updater and Stats in Header']
@dialog = sc = $.el 'span',

View File

@ -48,7 +48,7 @@ QR =
link = $.el 'h1',
className: "qr-link-container"
$.extend link, <%= html('<a href="javascript:;" class="qr-link">${(g.VIEW === "thread") ? "Reply to Thread" : "Start a Thread"}</a>') %>
$.extend link, <%= html('<a href="javascript:;" class="qr-link">?{g.VIEW === "thread"}{Reply to Thread}{Start a Thread}</a>') %>
QR.link = link.firstElementChild
$.on link.firstChild, 'click', ->