DEV: Resolve some template linting issues (#123)

Some larger issues still remain, but this is a good first step
This commit is contained in:
David Taylor 2021-07-02 16:35:50 +01:00 committed by GitHub
parent 814ec14636
commit 4354e1b766
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
18 changed files with 103 additions and 98 deletions

View File

@ -31,4 +31,4 @@ DEPENDENCIES
rubocop-discourse
BUNDLED WITH
2.2.7
2.2.15

View File

@ -30,7 +30,7 @@
{{#if selectedItem}}
{{#if editing}}
<div class="name">
{{d-button action=(action "goHome") icon="chevron-left" class="previous"}}
{{d-button action=(action "goHome") icon="chevron-left" class="previous"}}
<div class="name-text-field">
{{text-field value=selectedItem.name}}
</div>
@ -42,9 +42,10 @@
{{else}}
<div class="name">
{{d-button action=(action "goHome") icon="chevron-left" class="previous"}}
<h1>{{selectedItem.name}}
<h1>
{{selectedItem.name}}
{{#unless editDisabled}}
<a {{action "editName" class="edit-query-name"}}>{{d-icon "pencil-alt"}}</a>
<a href {{action "editName" class="edit-query-name"}}>{{d-icon "pencil-alt"}}</a>
{{/unless}}
</h1>
</div>
@ -212,32 +213,32 @@
<medium>{{query.username}}</medium>
</a>
{{/if}}
</td>
<td class="query-group-names">
{{#each query.group_names as |group|}}
{{share-report group=group query=query}}
{{/each}}
</td>
<td class="query-created-at">
{{#if query.last_run_at}}
<medium>
{{bound-date query.last_run_at}}
</medium>
{{else if query.created_at}}
<medium>
{{bound-date query.created_at}}
</medium>
{{/if}}
</td>
</tr>
{{else}}
<br>
<em class="no-search-results"> {{i18n "explorer.no_search_results"}}</em>
{{/each}}
</tbody>
</table>
</div>
{{/if}}
</td>
<td class="query-group-names">
{{#each query.group_names as |group|}}
{{share-report group=group query=query}}
{{/each}}
</td>
<td class="query-created-at">
{{#if query.last_run_at}}
<medium>
{{bound-date query.last_run_at}}
</medium>
{{else if query.created_at}}
<medium>
{{bound-date query.created_at}}
</medium>
{{/if}}
</td>
</tr>
{{else}}
<br>
<em class="no-search-results"> {{i18n "explorer.no_search_results"}}</em>
{{/each}}
</tbody>
</table>
</div>
{{/if}}
<div class="explorer-pad-bottom"></div>

View File

@ -1,5 +1,5 @@
{{#each enuminfo as |enum|}}
<li value="{{enum.value}}">
<li value={{enum.value}}>
{{enum.name}}
</li>
{{/each}}

View File

@ -9,36 +9,36 @@
<div class="schema-table-cols">
{{#if open}}
<dl>
{{#each table.columns as |col|}}
<div>
<dt class="{{if col.sensitive "sensitive"}}" title="{{if col.sensitive (i18n "explorer.schema.sensitive")}}">
{{#if col.sensitive}}
{{d-icon "exclamation-triangle"}}
{{/if}}
{{col.column_name}}
</dt>
<dd>
{{col.data_type}}
{{#if col.havetypeinfo}}
<br>
{{#if col.havepopup}}
<div class="popup-info">
{{d-icon "info"}}
<div class="popup">
{{col.column_desc}}
{{#if col.enum}}
{{explorer-schema-enuminfo col=col}}
{{/if}}
</div>
</div>
{{/if}}
<span class="schema-typenotes">
{{col.notes}}
</span>
{{/if}}
</dd>
</div>
{{/each}}
{{#each table.columns as |col|}}
<div>
<dt class={{if col.sensitive "sensitive"}} title={{if col.sensitive (i18n "explorer.schema.sensitive")}}>
{{#if col.sensitive}}
{{d-icon "exclamation-triangle"}}
{{/if}}
{{col.column_name}}
</dt>
<dd>
{{col.data_type}}
{{#if col.havetypeinfo}}
<br>
{{#if col.havepopup}}
<div class="popup-info">
{{d-icon "info"}}
<div class="popup">
{{col.column_desc}}
{{#if col.enum}}
{{explorer-schema-enuminfo col=col}}
{{/if}}
</div>
</div>
{{/if}}
<span class="schema-typenotes">
{{col.notes}}
</span>
{{/if}}
</dd>
</div>
{{/each}}
</dl>
{{/if}}
</div>

View File

@ -1,4 +1,4 @@
<div class="{{if hideSchema "hidden"}}">
<div class={{if hideSchema "hidden"}}>
{{text-field value=filter placeholderKey="explorer.schema.filter"}}
{{d-button action=(action "collapseSchema") icon="chevron-right" class="no-text"}}
{{conditional-loading-spinner condition=loading}}

View File

@ -1,7 +1,7 @@
<div class="jsfu-shade-container">
<div class="jsfu-file">
<input id="js-file-input" type="file" style="display:none;" accept={{accept}}>
{{d-button class="fileSelect" action=(action "selectFile") class="" icon="upload" label="upload_selector.select_file"}}
{{d-button class="fileSelect" action=(action "selectFile") icon="upload" label="upload_selector.select_file"}}
{{conditional-loading-spinner condition=loading size="small"}}
</div>
<div class="jsfu-separator">
@ -12,5 +12,5 @@
<div class="jsfu-paste">
{{textarea value=value}}
</div>
<div class="jsfu-shade {{if hover '' 'hidden'}}"><span class="text">{{d-icon "upload"}}</span></div>
<div class="jsfu-shade {{if hover "" "hidden"}}"><span class="text">{{d-icon "upload"}}</span></div>
</div>

View File

@ -3,9 +3,9 @@
{{group}}
</div>
{{#if visible}}
<div class='popup'>
<div class="popup">
<label>{{i18n "explorer.link"}} {{group}}</label>
<input type="text" value={{link}}/>
<input type="text" value={{link}}>
{{d-button action="close" class="btn-flat close" icon="times" aria-label="share.close" title="share.close"}}
</div>
{{/if}}

View File

@ -1,3 +1,3 @@
{{#link-to 'group.reports'}}
{{d-icon 'chart-bar'}}{{i18n 'group.reports'}}
{{#link-to "group.reports"}}
{{d-icon "chart-bar"}}{{i18n "group.reports"}}
{{/link-to}}

View File

@ -37,19 +37,19 @@
{{else}}
<table>
<thead>
<tr class="headers">
{{#each columnDispNames as |col|}}
<th>{{col}}</th>
{{/each}}
</tr>
<tr class="headers">
{{#each columnDispNames as |col|}}
<th>{{col}}</th>
{{/each}}
</tr>
</thead>
<tbody>
{{#each rows as |row|}}
{{query-row-content
row=row
fallbackTemplate=fallbackTemplate
columnTemplates=columnTemplates}}
{{/each}}
{{#each rows as |row|}}
{{query-row-content
row=row
fallbackTemplate=fallbackTemplate
columnTemplates=columnTemplates}}
{{/each}}
</tbody>
</table>
{{/if}}

View File

@ -1,6 +1,8 @@
{{! source: badge-button component }}
<a href="{{baseuri}}/badges/{{badge.id}}/{{badge.name}}"
class="user-badge {{badge.badgeTypeClassName}}"
title="{{badge.display_name}}"
data-badge-name="{{badge.name}}">{{icon-or-image badge.icon}}
<span class="badge-display-name">{{badge.display_name}}</span></a>
class="user-badge {{badge.badgeTypeClassName}}"
title={{badge.display_name}}
data-badge-name={{badge.name}}>
{{icon-or-image badge.icon}}
<span class="badge-display-name">{{badge.display_name}}</span>
</a>

View File

@ -1 +1 @@
{{{value}}}
{{html-safe value}}

View File

@ -1,5 +1,5 @@
{{#if post}}
<aside class="quote" data-post="{{post.post_number}}" data-topic="{{post.topic_id}}">
<aside class="quote" data-post={{post.post_number}} data-topic={{post.topic_id}}>
<div class="title">
<div class="quote-controls">
<a href="/t/via-quote/{{post.topic_id}}/{{post.post_number}}"
@ -13,7 +13,7 @@
</div>
<blockquote>
<p>
{{{post.excerpt}}}
{{html-safe post.excerpt}}
</p>
</blockquote>
</aside>

View File

@ -1,6 +1,8 @@
{{#if topic}}
<a href="{{baseuri}}/t/{{topic.slug}}/{{topic.id}}"
>{{{topic.fancy_title}}}</a> ({{topic.posts_count}})
<a href="{{baseuri}}/t/{{topic.slug}}/{{topic.id}}">
{{html-safe topic.fancy_title}}
</a>
({{topic.posts_count}})
{{else}}
<a href="{{baseuri}}/t/{{id}}">{{id}}</a>
{{/if}}

View File

@ -1 +1 @@
<a href="{{href}}">{{target}}</a>
<a href={{href}}>{{target}}</a>

View File

@ -1,6 +1,7 @@
{{#if user}}
<a href="{{baseuri}}/u/{{user.username}}/activity"
data-user-card="{{user.username}}">{{avatar user imageSize="tiny"}} {{user.username}}</a>
<a href="{{baseuri}}/u/{{user.username}}/activity" data-user-card={{user.username}}>
{{avatar user imageSize="tiny"}} {{user.username}}
</a>
{{else}}
{{id}}
{{/if}}

View File

@ -1,5 +1,5 @@
<section class='user-content'>
<table class='group-reports'>
<section class="user-content">
<table class="group-reports">
<thead>
<th>
{{i18n "explorer.report_name"}}
@ -11,12 +11,11 @@
{{i18n "explorer.query_time"}}
</th>
</thead>
<tr></tr>
<tbody>
{{#each queries as |query|}}
<tr>
<td>
{{#link-to 'group.reports.show' group.name query.id}}{{query.name}}{{/link-to}}
{{#link-to "group.reports.show" group.name query.id}}{{query.name}}{{/link-to}}
</td>
<td>{{query.description}}</td>
<td>

View File

@ -1,4 +1,4 @@
<section class='user-content'>
<section class="user-content">
<h1>{{model.name}}</h1>
<p>{{model.description}}</p>
<form class="query-run" {{action "run" on="submit"}}>

View File

@ -1,10 +1,10 @@
{{#d-modal-body title="explorer.import.modal"}}
<form {{action "dummy" on="submit"}}>
<div class='modal-body'>
<div class="modal-body">
{{json-file-uploader value=queryFile extension=".dcquery.json"}}
</div>
<div class="modal-footer">
{{d-button class='btn-primary' action='doImport' type='submit' disabled=notReady icon="plus" label='explorer.import.label'}}
{{d-button class="btn-primary" action="doImport" type="submit" disabled=notReady icon="plus" label="explorer.import.label"}}
</div>
</form>
{{/d-modal-body}}