client/general: use 'ctx' variable for templates
This commit is contained in:
parent
bae238794a
commit
052a7ca684
|
@ -1,4 +1,4 @@
|
||||||
<div class='page'>
|
<div class='page'>
|
||||||
<p><span>Page <%= page %> of <%= totalPages %></span></p>
|
<p><span>Page <%= ctx.page %> of <%= ctx.totalPages %></span></p>
|
||||||
<div class='page-content-holder'></div>
|
<div class='page-content-holder'></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<div class='file-dropper-holder'>
|
<div class='file-dropper-holder'>
|
||||||
<input type='file' id='<%= id %>'/>
|
<input type='file' id='<%= ctx.id %>'/>
|
||||||
<label class='file-dropper' for='<%= id %>'>
|
<label class='file-dropper' for='<%= ctx.id %>'>
|
||||||
<% if (allowMultiple) { %>
|
<% if (ctx.allowMultiple) { %>
|
||||||
Drop files here!
|
Drop files here!
|
||||||
<% } else { %>
|
<% } else { %>
|
||||||
Drop file here!
|
Drop file here!
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
<p>By accessing <%= name %> (“Site”) you agree to the following
|
<p>By accessing <%= ctx.name %> (“Site”) you agree to the following
|
||||||
Terms of Service. If you do not agree to these terms, then please do not access
|
Terms of Service. If you do not agree to these terms, then please do not access
|
||||||
the Site.</p>
|
the Site.</p>
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<div class='content-wrapper transparent' id='home'>
|
<div class='content-wrapper transparent' id='home'>
|
||||||
<div class='messages'></div>
|
<div class='messages'></div>
|
||||||
<h1><%= name %></h1>
|
<h1><%= ctx.name %></h1>
|
||||||
<footer>Version: <span class='version'><%= version %></span> (built <%= makeRelativeTime(buildDate) %>)</footer>
|
<footer>Version: <span class='version'><%= ctx.version %></span> (built <%= ctx.makeRelativeTime(ctx.buildDate) %>)</footer>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
<head>
|
<head>
|
||||||
<meta charset='utf-8'/>
|
<meta charset='utf-8'/>
|
||||||
<meta name='viewport' content='width=device-width, initial-scale=1.0'>
|
<meta name='viewport' content='width=device-width, initial-scale=1.0'>
|
||||||
<title><!-- confiured in config file --></title>
|
<title><!-- configured in the config file --></title>
|
||||||
<link href='/app.min.css' rel='stylesheet' type='text/css'/>
|
<link href='/app.min.css' rel='stylesheet' type='text/css'/>
|
||||||
<link href='//maxcdn.bootstrapcdn.com/font-awesome/4.6.0/css/font-awesome.min.css' rel='stylesheet' type='text/css'/>
|
<link href='//maxcdn.bootstrapcdn.com/font-awesome/4.6.0/css/font-awesome.min.css' rel='stylesheet' type='text/css'/>
|
||||||
<link href='//fonts.googleapis.com/css?family=Droid+Sans' rel='stylesheet' type='text/css'/>
|
<link href='//fonts.googleapis.com/css?family=Droid+Sans' rel='stylesheet' type='text/css'/>
|
||||||
|
|
|
@ -4,20 +4,20 @@
|
||||||
<div class='input'>
|
<div class='input'>
|
||||||
<ul>
|
<ul>
|
||||||
<li>
|
<li>
|
||||||
<%= makeTextInput({text: 'User name', id: 'user-name', name: 'name', required: true, pattern: userNamePattern}) %>
|
<%= ctx.makeTextInput({text: 'User name', id: 'user-name', name: 'name', required: true, pattern: ctx.userNamePattern}) %>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<%= makePasswordInput({text: 'Password', id: 'user-password', name: 'password', required: true, pattern: passwordPattern}) %>
|
<%= ctx.makePasswordInput({text: 'Password', id: 'user-password', name: 'password', required: true, pattern: ctx.passwordPattern}) %>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<%= makeCheckbox({text: 'Remember me', id: 'remember-user', name: 'remember-user'}) %>
|
<%= ctx.makeCheckbox({text: 'Remember me', id: 'remember-user', name: 'remember-user'}) %>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<div class='messages'></div>
|
<div class='messages'></div>
|
||||||
<div class='buttons'>
|
<div class='buttons'>
|
||||||
<input type='submit' value='Log in'/>
|
<input type='submit' value='Log in'/>
|
||||||
<% if (canSendMails) { %>
|
<% if (ctx.canSendMails) { %>
|
||||||
<a class='append' href='/password-reset'>Forgot the password?</a>
|
<a class='append' href='/password-reset'>Forgot the password?</a>
|
||||||
<% } %>
|
<% } %>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
<nav class='text-nav'>
|
<nav class='text-nav'>
|
||||||
<ul>
|
<ul>
|
||||||
<li>
|
<li>
|
||||||
<% if (prevLinkActive) { %>
|
<% if (ctx.prevLinkActive) { %>
|
||||||
<a class='prev' href='<%= prevLink %>'>
|
<a class='prev' href='<%= ctx.prevLink %>'>
|
||||||
<% } else { %>
|
<% } else { %>
|
||||||
<a class='prev disabled'>
|
<a class='prev disabled'>
|
||||||
<% } %>
|
<% } %>
|
||||||
|
@ -11,7 +11,7 @@
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
<% _.each(pages, page => { %>
|
<% _.each(ctx.pages, page => { %>
|
||||||
<% if (page.ellipsis) { %>
|
<% if (page.ellipsis) { %>
|
||||||
<li>…</li>
|
<li>…</li>
|
||||||
<% } else { %>
|
<% } else { %>
|
||||||
|
@ -26,8 +26,8 @@
|
||||||
<% }) %>
|
<% }) %>
|
||||||
|
|
||||||
<li>
|
<li>
|
||||||
<% if (nextLinkActive) { %>
|
<% if (ctx.nextLinkActive) { %>
|
||||||
<a class='next' href='<%= nextLink %>'>
|
<a class='next' href='<%= ctx.nextLink %>'>
|
||||||
<% } else { %>
|
<% } else { %>
|
||||||
<a class='next disabled'>
|
<a class='next disabled'>
|
||||||
<% } %>
|
<% } %>
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
<div class='input'>
|
<div class='input'>
|
||||||
<ul>
|
<ul>
|
||||||
<li>
|
<li>
|
||||||
<%= makeTextInput({text: 'User name or e-mail address', id: 'user-name', name: 'user-name', required: true}) %>
|
<%= ctx.makeTextInput({text: 'User name or e-mail address', id: 'user-name', name: 'user-name', required: true}) %>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -5,11 +5,11 @@
|
||||||
<div class='input'>
|
<div class='input'>
|
||||||
<ul>
|
<ul>
|
||||||
<li>
|
<li>
|
||||||
<%= makeCheckbox({text: 'Endless scroll', id: 'endless-scroll', name: 'endless-scroll', checked: browsingSettings.endlessScroll}) %>
|
<%= ctx.makeCheckbox({text: 'Endless scroll', id: 'endless-scroll', name: 'endless-scroll', checked: ctx.browsingSettings.endlessScroll}) %>
|
||||||
<p class='hint'>Rather than using a paged navigation, smoothly scroll through the content.</p>
|
<p class='hint'>Rather than using a paged navigation, smoothly scroll through the content.</p>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<%= makeCheckbox({text: 'Enable keyboard shortcuts', id: 'keyboard-shortcuts', name: 'keyboard-shortcuts', checked: browsingSettings.keyboardShortcuts}) %>
|
<%= ctx.makeCheckbox({text: 'Enable keyboard shortcuts', id: 'keyboard-shortcuts', name: 'keyboard-shortcuts', checked: ctx.browsingSettings.keyboardShortcuts}) %>
|
||||||
<a class='append icon' href='/help/keyboard'><i class='fa fa-question-circle-o'></i></a>
|
<a class='append icon' href='/help/keyboard'><i class='fa fa-question-circle-o'></i></a>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
<div class='content-wrapper tag'>
|
<div class='content-wrapper tag'>
|
||||||
<h1><%= tag.names[0] %></h1>
|
<h1><%= ctx.tag.names[0] %></h1>
|
||||||
<nav class='text-nav'><!--
|
<nav class='text-nav'><!--
|
||||||
--><ul><!--
|
--><ul><!--
|
||||||
--><li data-name='summary'><a href='/tag/<%= tag.names[0] %>'>Summary</a></li><!--
|
--><li data-name='summary'><a href='/tag/<%= ctx.tag.names[0] %>'>Summary</a></li><!--
|
||||||
--><% if (canMerge) { %><!--
|
--><% if (ctx.canMerge) { %><!--
|
||||||
--><li data-name='merge'><a href='/tag/<%= tag.names[0] %>/merge'>Merge with…</a></li><!--
|
--><li data-name='merge'><a href='/tag/<%= ctx.tag.names[0] %>/merge'>Merge with…</a></li><!--
|
||||||
--><% } %><!--
|
--><% } %><!--
|
||||||
--><% if (canDelete) { %><!--
|
--><% if (ctx.canDelete) { %><!--
|
||||||
--><li data-name='delete'><a href='/tag/<%= tag.names[0] %>/delete'>Delete</a></li><!--
|
--><li data-name='delete'><a href='/tag/<%= ctx.tag.names[0] %>/delete'>Delete</a></li><!--
|
||||||
--><% } %><!--
|
--><% } %><!--
|
||||||
--></ul><!--
|
--></ul><!--
|
||||||
--></nav>
|
--></nav>
|
||||||
|
|
|
@ -10,18 +10,18 @@
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<% _.each(tagCategories, category => { %>
|
<% _.each(ctx.tagCategories, category => { %>
|
||||||
<tr data-category='<%= category.name %>'>
|
<tr data-category='<%= category.name %>'>
|
||||||
<td class='name'>
|
<td class='name'>
|
||||||
<% if (canEditName) { %>
|
<% if (ctx.canEditName) { %>
|
||||||
<%= makeTextInput({value: category.name, required: true}) %>
|
<%= ctx.makeTextInput({value: category.name, required: true}) %>
|
||||||
<% } else { %>
|
<% } else { %>
|
||||||
<%= category.name %>
|
<%= category.name %>
|
||||||
<% } %>
|
<% } %>
|
||||||
</td>
|
</td>
|
||||||
<td class='color'>
|
<td class='color'>
|
||||||
<% if (canEditColor) { %>
|
<% if (ctx.canEditColor) { %>
|
||||||
<%= makeColorInput({value: category.color}) %>
|
<%= ctx.makeColorInput({value: category.color}) %>
|
||||||
<% } else { %>
|
<% } else { %>
|
||||||
<%= category.color %>
|
<%= category.color %>
|
||||||
<% } %>
|
<% } %>
|
||||||
|
@ -31,7 +31,7 @@
|
||||||
<%= category.usages %>
|
<%= category.usages %>
|
||||||
</a>
|
</a>
|
||||||
</td>
|
</td>
|
||||||
<% if (canDelete) { %>
|
<% if (ctx.canDelete) { %>
|
||||||
<td>
|
<td>
|
||||||
<% if (category.usages) { %>
|
<% if (category.usages) { %>
|
||||||
<a class='inactive remove' title="Can't delete category in use">Remove</a>
|
<a class='inactive remove' title="Can't delete category in use">Remove</a>
|
||||||
|
@ -46,10 +46,10 @@
|
||||||
<tfoot>
|
<tfoot>
|
||||||
<tr class='add-template'>
|
<tr class='add-template'>
|
||||||
<td class='name'>
|
<td class='name'>
|
||||||
<%= makeTextInput({required: true}) %>
|
<%= ctx.makeTextInput({required: true}) %>
|
||||||
</td>
|
</td>
|
||||||
<td class='color'>
|
<td class='color'>
|
||||||
<%= makeColorInput({value: '#000000'}) %>
|
<%= ctx.makeColorInput({value: '#000000'}) %>
|
||||||
</td>
|
</td>
|
||||||
<td class='usages'>
|
<td class='usages'>
|
||||||
0
|
0
|
||||||
|
@ -61,13 +61,13 @@
|
||||||
</tfoot>
|
</tfoot>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
<% if (canCreate) { %>
|
<% if (ctx.canCreate) { %>
|
||||||
<p><a href='#' class='add'>Add new category</a></p>
|
<p><a href='#' class='add'>Add new category</a></p>
|
||||||
<% } %>
|
<% } %>
|
||||||
|
|
||||||
<div class='messages'></div>
|
<div class='messages'></div>
|
||||||
|
|
||||||
<% if (canCreate || canEditName || canEditColor || canDelete) { %>
|
<% if (ctx.canCreate || ctx.canEditName || ctx.canEditColor || ctx.canDelete) { %>
|
||||||
<div class='buttons'>
|
<div class='buttons'>
|
||||||
<input type='submit' class='save' value='Save changes'>
|
<input type='submit' class='save' value='Save changes'>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
<div class='tag-delete'>
|
<div class='tag-delete'>
|
||||||
<form>
|
<form>
|
||||||
<% if (tag.usages) { %>
|
<% if (ctx.tag.usages) { %>
|
||||||
<p>For extra <s>paranoia</s> safety, only tags that are unused can be deleted.</p>
|
<p>For extra <s>paranoia</s> safety, only tags that are unused can be deleted.</p>
|
||||||
<p>Check <a href='/posts/<%= tag.names[0] %>'>which posts</a> are tagged with <%= tag.names[0] %>.</p>
|
<p>Check <a href='/posts/<%= ctx.tag.names[0] %>'>which posts</a> are tagged with <%= ctx.tag.names[0] %>.</p>
|
||||||
<% } else { %>
|
<% } else { %>
|
||||||
<div class='input'>
|
<div class='input'>
|
||||||
<ul>
|
<ul>
|
||||||
<li>
|
<li>
|
||||||
<%= makeCheckbox({id: 'confirm-deletion', name: 'confirm-deletion', required: true, text: 'I confirm that I want to delete this tag.'}) %>
|
<%= ctx.makeCheckbox({id: 'confirm-deletion', name: 'confirm-deletion', required: true, text: 'I confirm that I want to delete this tag.'}) %>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1,16 +1,16 @@
|
||||||
<div class='tag-merge'>
|
<div class='tag-merge'>
|
||||||
<form class='tabular'>
|
<form class='tabular'>
|
||||||
<p>Proceeding will remove <%= tag.names[0] %> and retag its posts with
|
<p>Proceeding will remove <%= ctx.tag.names[0] %> and retag its posts with
|
||||||
the tag specified below. Aliases and relations of <%= tag.names[0] %>
|
the tag specified below. Aliases and relations of <%= ctx.tag.names[0] %>
|
||||||
will be discarded and need to be handled by hand.</p>
|
will be discarded and need to be handled by hand.</p>
|
||||||
<div class='input'>
|
<div class='input'>
|
||||||
<ul>
|
<ul>
|
||||||
<li class='target'>
|
<li class='target'>
|
||||||
<%= makeTextInput({required: true, text: 'Target tag', pattern: tagNamePattern}) %>
|
<%= ctx.makeTextInput({required: true, text: 'Target tag', pattern: ctx.tagNamePattern}) %>
|
||||||
</li>
|
</li>
|
||||||
<li class='confirm'>
|
<li class='confirm'>
|
||||||
<label></label>
|
<label></label>
|
||||||
<%= makeCheckbox({required: true, text: 'I confirm that I want to merge this tag.'}) %>
|
<%= ctx.makeCheckbox({required: true, text: 'I confirm that I want to merge this tag.'}) %>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -3,20 +3,20 @@
|
||||||
<div class='input'>
|
<div class='input'>
|
||||||
<ul>
|
<ul>
|
||||||
<li class='names'>
|
<li class='names'>
|
||||||
<%= makeTextInput({text: 'Names', value: tag.names.join(' '), required: true, readonly: !canEditNames, pattern: tagNamesPattern}) %>
|
<%= ctx.makeTextInput({text: 'Names', value: ctx.tag.names.join(' '), required: true, readonly: !ctx.canEditNames, pattern: ctx.tagNamesPattern}) %>
|
||||||
</li>
|
</li>
|
||||||
<li class='category'>
|
<li class='category'>
|
||||||
<%= makeSelect({text: 'Category', keyValues: categories, selectedKey: tag.category, required: true, readonly: !canEditCategory}) %>
|
<%= ctx.makeSelect({text: 'Category', keyValues: ctx.categories, selectedKey: ctx.tag.category, required: true, readonly: !ctx.canEditCategory}) %>
|
||||||
</li>
|
</li>
|
||||||
<li class='implications'>
|
<li class='implications'>
|
||||||
<%= makeTextInput({text: 'Implications', value: tag.implications.join(' '), readonly: !canEditImplications}) %>
|
<%= ctx.makeTextInput({text: 'Implications', value: ctx.tag.implications.join(' '), readonly: !ctx.canEditImplications}) %>
|
||||||
</li>
|
</li>
|
||||||
<li class='suggestions'>
|
<li class='suggestions'>
|
||||||
<%= makeTextInput({text: 'Suggestions', value: tag.suggestions.join(' '), readonly: !canEditSuggestions}) %>
|
<%= ctx.makeTextInput({text: 'Suggestions', value: ctx.tag.suggestions.join(' '), readonly: !ctx.canEditSuggestions}) %>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<% if (canEditNames || canEditCategory || canEditImplications || canEditSuggestions) { %>
|
<% if (ctx.canEditNames || ctx.canEditCategory || ctx.canEditImplications || ctx.canEditSuggestions) { %>
|
||||||
<div class='messages'></div>
|
<div class='messages'></div>
|
||||||
<div class='buttons'>
|
<div class='buttons'>
|
||||||
<input type='submit' class='save' value='Save changes'>
|
<input type='submit' class='save' value='Save changes'>
|
||||||
|
|
|
@ -3,14 +3,14 @@
|
||||||
<div class='input'>
|
<div class='input'>
|
||||||
<ul>
|
<ul>
|
||||||
<li>
|
<li>
|
||||||
<%= makeTextInput({id: 'search-text', name: 'search-text', value: searchQuery.text}) %>
|
<%= ctx.makeTextInput({id: 'search-text', name: 'search-text', value: ctx.searchQuery.text}) %>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<div class='buttons'>
|
<div class='buttons'>
|
||||||
<input type='submit' value='Search'/>
|
<input type='submit' value='Search'/>
|
||||||
<a class='button append' href='/help/search/tags'>Syntax help</a>
|
<a class='button append' href='/help/search/tags'>Syntax help</a>
|
||||||
<% if (canEditTagCategories) { %>
|
<% if (ctx.canEditTagCategories) { %>
|
||||||
<a class='append' href='/tag-categories'>Tag categories</a>
|
<a class='append' href='/tag-categories'>Tag categories</a>
|
||||||
<% } %>
|
<% } %>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1,30 +1,30 @@
|
||||||
<div class='tag-list'>
|
<div class='tag-list'>
|
||||||
<% if (results.length) { %>
|
<% if (ctx.results.length) { %>
|
||||||
<table>
|
<table>
|
||||||
<thead>
|
<thead>
|
||||||
<th class='names'>
|
<th class='names'>
|
||||||
<% if (query == 'sort:name' || !query) { %>
|
<% if (ctx.query == 'sort:name' || !ctx.query) { %>
|
||||||
<a href='/tags/text=-sort:name'>Tag name(s)</a>
|
<a href='/tags/text=-sort:name'>Tag name(s)</a>
|
||||||
<% } else { %>
|
<% } else { %>
|
||||||
<a href='/tags/text=sort:name'>Tag name(s)</a>
|
<a href='/tags/text=sort:name'>Tag name(s)</a>
|
||||||
<% } %>
|
<% } %>
|
||||||
</th>
|
</th>
|
||||||
<th class='implications'>
|
<th class='implications'>
|
||||||
<% if (query == 'sort:implication-count') { %>
|
<% if (ctx.query == 'sort:implication-count') { %>
|
||||||
<a href='/tags/text=-sort:implication-count'>Implications</a>
|
<a href='/tags/text=-sort:implication-count'>Implications</a>
|
||||||
<% } else { %>
|
<% } else { %>
|
||||||
<a href='/tags/text=sort:implication-count'>Implications</a>
|
<a href='/tags/text=sort:implication-count'>Implications</a>
|
||||||
<% } %>
|
<% } %>
|
||||||
</th>
|
</th>
|
||||||
<th class='suggestions'>
|
<th class='suggestions'>
|
||||||
<% if (query == 'sort:suggestion-count') { %>
|
<% if (ctx.query == 'sort:suggestion-count') { %>
|
||||||
<a href='/tags/text=-sort:suggestion-count'>Suggestions</a>
|
<a href='/tags/text=-sort:suggestion-count'>Suggestions</a>
|
||||||
<% } else { %>
|
<% } else { %>
|
||||||
<a href='/tags/text=sort:suggestion-count'>Suggestions</a>
|
<a href='/tags/text=sort:suggestion-count'>Suggestions</a>
|
||||||
<% } %>
|
<% } %>
|
||||||
</th>
|
</th>
|
||||||
<th class='usages'>
|
<th class='usages'>
|
||||||
<% if (query == 'sort:usages') { %>
|
<% if (ctx.query == 'sort:usages') { %>
|
||||||
<a href='/tags/text=-sort:usages'>Usages</a>
|
<a href='/tags/text=-sort:usages'>Usages</a>
|
||||||
<% } else { %>
|
<% } else { %>
|
||||||
<a href='/tags/text=sort:usages'>Usages</a>
|
<a href='/tags/text=sort:usages'>Usages</a>
|
||||||
|
@ -32,12 +32,12 @@
|
||||||
</th>
|
</th>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<% _.each(results, tag => { %>
|
<% _.each(ctx.results, tag => { %>
|
||||||
<tr>
|
<tr>
|
||||||
<td class='names'>
|
<td class='names'>
|
||||||
<ul>
|
<ul>
|
||||||
<% _.each(tag.names, name => { %>
|
<% _.each(tag.names, name => { %>
|
||||||
<li><%= makeTagLink(name) %></li>
|
<li><%= ctx.makeTagLink(name) %></li>
|
||||||
<% }) %>
|
<% }) %>
|
||||||
</ul>
|
</ul>
|
||||||
</td>
|
</td>
|
||||||
|
@ -45,7 +45,7 @@
|
||||||
<% if (tag.implications.length) { %>
|
<% if (tag.implications.length) { %>
|
||||||
<ul>
|
<ul>
|
||||||
<% _.each(tag.implications, name => { %>
|
<% _.each(tag.implications, name => { %>
|
||||||
<li><%= makeTagLink(name) %></li>
|
<li><%= ctx.makeTagLink(name) %></li>
|
||||||
<% }) %>
|
<% }) %>
|
||||||
</ul>
|
</ul>
|
||||||
<% } else { %>
|
<% } else { %>
|
||||||
|
@ -56,7 +56,7 @@
|
||||||
<% if (tag.suggestions.length) { %>
|
<% if (tag.suggestions.length) { %>
|
||||||
<ul>
|
<ul>
|
||||||
<% _.each(tag.suggestions, name => { %>
|
<% _.each(tag.suggestions, name => { %>
|
||||||
<li><%= makeTagLink(name) %></li>
|
<li><%= ctx.makeTagLink(name) %></li>
|
||||||
<% }) %>
|
<% }) %>
|
||||||
</ul>
|
</ul>
|
||||||
<% } else { %>
|
<% } else { %>
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
<nav id='top-nav' class='text-nav'>
|
<nav id='top-nav' class='text-nav'>
|
||||||
<ul><!--
|
<ul><!--
|
||||||
--><% _.each(items, (item, key) => { %><!--
|
--><% _.each(ctx.items, (item, key) => { %><!--
|
||||||
--><% if (item.available) { %><!--
|
--><% if (item.available) { %><!--
|
||||||
--><li data-name='<%= key %>'><!--
|
--><li data-name='<%= key %>'><!--
|
||||||
--><a href='<%= item.url %>' accesskey='<%= item.accessKey %>'><!--
|
--><a href='<%= item.url %>' accesskey='<%= item.accessKey %>'><!--
|
||||||
--><% if (item.imageUrl) { print(makeThumbnail(item.imageUrl)); } %><!--
|
--><% if (item.imageUrl) { print(ctx.makeThumbnail(item.imageUrl)); } %><!--
|
||||||
--><span class='text'><%- item.name %></span><!--
|
--><span class='text'><%- item.name %></span><!--
|
||||||
--></a><!--
|
--></a><!--
|
||||||
--></li><!--
|
--></li><!--
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
<div class='content-wrapper' id='user'>
|
<div class='content-wrapper' id='user'>
|
||||||
<h1><%= user.name %></h1>
|
<h1><%= ctx.user.name %></h1>
|
||||||
<nav class='text-nav'><!--
|
<nav class='text-nav'><!--
|
||||||
--><ul><!--
|
--><ul><!--
|
||||||
--><li data-name='summary'><a href='/user/<%= user.name %>'>Summary</a></li><!--
|
--><li data-name='summary'><a href='/user/<%= ctx.user.name %>'>Summary</a></li><!--
|
||||||
--><% if (canEditAnything) { %><!--
|
--><% if (ctx.canEditAnything) { %><!--
|
||||||
--><li data-name='edit'><a href='/user/<%= user.name %>/edit'>Account settings</a></li><!--
|
--><li data-name='edit'><a href='/user/<%= ctx.user.name %>/edit'>Account settings</a></li><!--
|
||||||
--><% } %><!--
|
--><% } %><!--
|
||||||
--><% if (canDelete) { %><!--
|
--><% if (ctx.canDelete) { %><!--
|
||||||
--><li data-name='delete'><a href='/user/<%= user.name %>/delete'>Account deletion</a></li><!--
|
--><li data-name='delete'><a href='/user/<%= ctx.user.name %>/delete'>Account deletion</a></li><!--
|
||||||
--><% } %><!--
|
--><% } %><!--
|
||||||
--></ul><!--
|
--></ul><!--
|
||||||
--></nav>
|
--></nav>
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
<div class='input'>
|
<div class='input'>
|
||||||
<ul>
|
<ul>
|
||||||
<li>
|
<li>
|
||||||
<%= makeCheckbox({id: 'confirm-deletion', name: 'confirm-deletion', required: true, text: 'I confirm that I want to delete this account.'}) %>
|
<%= ctx.makeCheckbox({id: 'confirm-deletion', name: 'confirm-deletion', required: true, text: 'I confirm that I want to delete this account.'}) %>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -3,27 +3,27 @@
|
||||||
<div class='left'>
|
<div class='left'>
|
||||||
<div class='input'>
|
<div class='input'>
|
||||||
<ul>
|
<ul>
|
||||||
<% if (canEditName) { %>
|
<% if (ctx.canEditName) { %>
|
||||||
<li>
|
<li>
|
||||||
<%= makeTextInput({text: 'User name', id: 'user-name', name: 'name', value: user.name, pattern: userNamePattern}) %>
|
<%= ctx.makeTextInput({text: 'User name', id: 'user-name', name: 'name', value: ctx.user.name, pattern: ctx.userNamePattern}) %>
|
||||||
</li>
|
</li>
|
||||||
<% } %>
|
<% } %>
|
||||||
|
|
||||||
<% if (canEditPassword) { %>
|
<% if (ctx.canEditPassword) { %>
|
||||||
<li>
|
<li>
|
||||||
<%= makePasswordInput({text: 'Password', id: 'user-password', name: 'password', placeholder: 'leave blank if not changing', pattern: passwordPattern}) %>
|
<%= ctx.makePasswordInput({text: 'Password', id: 'user-password', name: 'password', placeholder: 'leave blank if not changing', pattern: ctx.passwordPattern}) %>
|
||||||
</li>
|
</li>
|
||||||
<% } %>
|
<% } %>
|
||||||
|
|
||||||
<% if (canEditEmail) { %>
|
<% if (ctx.canEditEmail) { %>
|
||||||
<li>
|
<li>
|
||||||
<%= makeEmailInput({text: 'Email', id: 'user-email', name: 'email', value: user.email}) %>
|
<%= ctx.makeEmailInput({text: 'Email', id: 'user-email', name: 'email', value: ctx.user.email}) %>
|
||||||
</li>
|
</li>
|
||||||
<% } %>
|
<% } %>
|
||||||
|
|
||||||
<% if (canEditRank) { %>
|
<% if (ctx.canEditRank) { %>
|
||||||
<li>
|
<li>
|
||||||
<%= makeSelect({text: 'Rank', id: 'user-rank', name: 'rank', keyValues: ranks, selectedKey: user.rank}) %>
|
<%= ctx.makeSelect({text: 'Rank', id: 'user-rank', name: 'rank', keyValues: ctx.ranks, selectedKey: ctx.user.rank}) %>
|
||||||
</li>
|
</li>
|
||||||
<% } %>
|
<% } %>
|
||||||
</ul>
|
</ul>
|
||||||
|
@ -34,14 +34,14 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<% if (canEditAvatar) { %>
|
<% if (ctx.canEditAvatar) { %>
|
||||||
<div class='right'>
|
<div class='right'>
|
||||||
<ul>
|
<ul>
|
||||||
<li>
|
<li>
|
||||||
<%= makeRadio({text: 'Gravatar', id: 'gravatar-radio', name: 'avatar-style', value: 'gravatar', selectedValue: user.avatarStyle}) %>
|
<%= ctx.makeRadio({text: 'Gravatar', id: 'gravatar-radio', name: 'avatar-style', value: 'gravatar', selectedValue: ctx.user.avatarStyle}) %>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<%= makeRadio({text: 'Manual avatar', id: 'avatar-radio', name: 'avatar-style', value: 'manual', selectedValue: user.avatarStyle}) %>
|
<%= ctx.makeRadio({text: 'Manual avatar', id: 'avatar-radio', name: 'avatar-style', value: 'manual', selectedValue: ctx.user.avatarStyle}) %>
|
||||||
<div id='avatar-content'></div>
|
<div id='avatar-content'></div>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
|
@ -4,13 +4,13 @@
|
||||||
<div class='input'>
|
<div class='input'>
|
||||||
<ul>
|
<ul>
|
||||||
<li>
|
<li>
|
||||||
<%= makeTextInput({text: 'User name', id: 'user-name', name: 'user-name', placeholder: 'letters, digits, _, -', required: true, pattern: userNamePattern}) %>
|
<%= ctx.makeTextInput({text: 'User name', id: 'user-name', name: 'user-name', placeholder: 'letters, digits, _, -', required: true, pattern: ctx.userNamePattern}) %>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<%= makePasswordInput({text: 'Password', id: 'user-password', name: 'user-password', placeholder: '5+ characters', required: true, pattern: passwordPattern}) %>
|
<%= ctx.makePasswordInput({text: 'Password', id: 'user-password', name: 'user-password', placeholder: '5+ characters', required: true, pattern: ctx.passwordPattern}) %>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<%= makeEmailInput({text: 'Email', id: 'user-email', name: 'user-email', placeholder: 'optional'}) %>
|
<%= ctx.makeEmailInput({text: 'Email', id: 'user-email', name: 'user-email', placeholder: 'optional'}) %>
|
||||||
<p class='hint'>Used for password reminder and to show a <a href='http://gravatar.com/'>Gravatar</a>. Leave blank for random Gravatar.</p>
|
<p class='hint'>Used for password reminder and to show a <a href='http://gravatar.com/'>Gravatar</a>. Leave blank for random Gravatar.</p>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
|
@ -1,22 +1,22 @@
|
||||||
<div id='user-summary'>
|
<div id='user-summary'>
|
||||||
<%= makeThumbnail(user.avatarUrl) %>
|
<%= ctx.makeThumbnail(ctx.user.avatarUrl) %>
|
||||||
<ul class='basic-info'>
|
<ul class='basic-info'>
|
||||||
<li>Registered: <%= makeRelativeTime(user.creationTime) %></li>
|
<li>Registered: <%= ctx.makeRelativeTime(ctx.user.creationTime) %></li>
|
||||||
<li>Last seen: <%= makeRelativeTime(user.lastLoginTime) %></li>
|
<li>Last seen: <%= ctx.makeRelativeTime(ctx.user.lastLoginTime) %></li>
|
||||||
<li>Rank: <%= user.rankName.toLowerCase() %></li>
|
<li>Rank: <%= ctx.user.rankName.toLowerCase() %></li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<nav class='plain-nav'>
|
<nav class='plain-nav'>
|
||||||
<p><strong>Quick links</strong></p>
|
<p><strong>Quick links</strong></p>
|
||||||
<ul>
|
<ul>
|
||||||
<li><a href='/posts/text=submit:<%= user.name %>'>Uploads</a></li>
|
<li><a href='/posts/text=submit:<%= ctx.user.name %>'>Uploads</a></li>
|
||||||
<li><a href='/posts/text=fav:<%= user.name %>'>Favorites</a></li>
|
<li><a href='/posts/text=fav:<%= ctx.user.name %>'>Favorites</a></li>
|
||||||
<li><a href='/posts/text=comment:<%= user.name %>'>Posts commented on</a></li>
|
<li><a href='/posts/text=comment:<%= ctx.user.name %>'>Posts commented on</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</nav>
|
</nav>
|
||||||
|
|
||||||
<% if (isLoggedIn) { %>
|
<% if (ctx.isLoggedIn) { %>
|
||||||
<nav class='plain-nav'>
|
<nav class='plain-nav'>
|
||||||
<p><strong>Only visible to you</strong></p>
|
<p><strong>Only visible to you</strong></p>
|
||||||
<ul>
|
<ul>
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
<div class='input'>
|
<div class='input'>
|
||||||
<ul>
|
<ul>
|
||||||
<li>
|
<li>
|
||||||
<%= makeTextInput({id: 'search-text', name: 'search-text', value: searchQuery.text}) %>
|
<%= ctx.makeTextInput({id: 'search-text', name: 'search-text', value: ctx.searchQuery.text}) %>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1,17 +1,17 @@
|
||||||
<div class='user-list'>
|
<div class='user-list'>
|
||||||
<ul><!--
|
<ul><!--
|
||||||
--><% _.each(results, user => { %><!--
|
--><% _.each(ctx.results, user => { %><!--
|
||||||
--><li>
|
--><li>
|
||||||
<div class='wrapper'>
|
<div class='wrapper'>
|
||||||
<a class='image' href='/user/<%= user.name %>'><%= makeThumbnail(user.avatarUrl) %></a>
|
<a class='image' href='/user/<%= user.name %>'><%= ctx.makeThumbnail(user.avatarUrl) %></a>
|
||||||
<div class='details'>
|
<div class='details'>
|
||||||
<a href='/user/<%= user.name %>'><%= user.name %></a><br/>
|
<a href='/user/<%= user.name %>'><%= user.name %></a><br/>
|
||||||
Registered: <%= makeRelativeTime(user.creationTime) %><br/>
|
Registered: <%= ctx.makeRelativeTime(user.creationTime) %><br/>
|
||||||
Last seen: <%= makeRelativeTime(user.lastLoginTime) %>
|
Last seen: <%= ctx.makeRelativeTime(user.lastLoginTime) %>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</li><!--
|
</li><!--
|
||||||
--><% }) %><!--
|
--><% }) %><!--
|
||||||
--><%= makeFlexboxAlign() %><!--
|
--><%= ctx.makeFlexboxAlign() %><!--
|
||||||
--></ul>
|
--></ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -238,7 +238,7 @@ function getTemplate(templatePath) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
const templateText = templates[templatePath].trim();
|
const templateText = templates[templatePath].trim();
|
||||||
const templateFactory = lodash.template(templateText);
|
const templateFactory = lodash.template(templateText, {variable: 'ctx'});
|
||||||
return ctx => {
|
return ctx => {
|
||||||
if (!ctx) {
|
if (!ctx) {
|
||||||
ctx = {};
|
ctx = {};
|
||||||
|
|
Loading…
Reference in New Issue