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 rubocop-discourse
BUNDLED WITH BUNDLED WITH
2.2.7 2.2.15

View File

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

View File

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

View File

@ -9,36 +9,36 @@
<div class="schema-table-cols"> <div class="schema-table-cols">
{{#if open}} {{#if open}}
<dl> <dl>
{{#each table.columns as |col|}} {{#each table.columns as |col|}}
<div> <div>
<dt class="{{if col.sensitive "sensitive"}}" title="{{if col.sensitive (i18n "explorer.schema.sensitive")}}"> <dt class={{if col.sensitive "sensitive"}} title={{if col.sensitive (i18n "explorer.schema.sensitive")}}>
{{#if col.sensitive}} {{#if col.sensitive}}
{{d-icon "exclamation-triangle"}} {{d-icon "exclamation-triangle"}}
{{/if}} {{/if}}
{{col.column_name}} {{col.column_name}}
</dt> </dt>
<dd> <dd>
{{col.data_type}} {{col.data_type}}
{{#if col.havetypeinfo}} {{#if col.havetypeinfo}}
<br> <br>
{{#if col.havepopup}} {{#if col.havepopup}}
<div class="popup-info"> <div class="popup-info">
{{d-icon "info"}} {{d-icon "info"}}
<div class="popup"> <div class="popup">
{{col.column_desc}} {{col.column_desc}}
{{#if col.enum}} {{#if col.enum}}
{{explorer-schema-enuminfo col=col}} {{explorer-schema-enuminfo col=col}}
{{/if}} {{/if}}
</div> </div>
</div> </div>
{{/if}} {{/if}}
<span class="schema-typenotes"> <span class="schema-typenotes">
{{col.notes}} {{col.notes}}
</span> </span>
{{/if}} {{/if}}
</dd> </dd>
</div> </div>
{{/each}} {{/each}}
</dl> </dl>
{{/if}} {{/if}}
</div> </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"}} {{text-field value=filter placeholderKey="explorer.schema.filter"}}
{{d-button action=(action "collapseSchema") icon="chevron-right" class="no-text"}} {{d-button action=(action "collapseSchema") icon="chevron-right" class="no-text"}}
{{conditional-loading-spinner condition=loading}} {{conditional-loading-spinner condition=loading}}

View File

@ -1,7 +1,7 @@
<div class="jsfu-shade-container"> <div class="jsfu-shade-container">
<div class="jsfu-file"> <div class="jsfu-file">
<input id="js-file-input" type="file" style="display:none;" accept={{accept}}> <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"}} {{conditional-loading-spinner condition=loading size="small"}}
</div> </div>
<div class="jsfu-separator"> <div class="jsfu-separator">
@ -12,5 +12,5 @@
<div class="jsfu-paste"> <div class="jsfu-paste">
{{textarea value=value}} {{textarea value=value}}
</div> </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> </div>

View File

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

View File

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

View File

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

View File

@ -1,6 +1,8 @@
{{! source: badge-button component }} {{! source: badge-button component }}
<a href="{{baseuri}}/badges/{{badge.id}}/{{badge.name}}" <a href="{{baseuri}}/badges/{{badge.id}}/{{badge.name}}"
class="user-badge {{badge.badgeTypeClassName}}" class="user-badge {{badge.badgeTypeClassName}}"
title="{{badge.display_name}}" title={{badge.display_name}}
data-badge-name="{{badge.name}}">{{icon-or-image badge.icon}} data-badge-name={{badge.name}}>
<span class="badge-display-name">{{badge.display_name}}</span></a> {{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}} {{#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="title">
<div class="quote-controls"> <div class="quote-controls">
<a href="/t/via-quote/{{post.topic_id}}/{{post.post_number}}" <a href="/t/via-quote/{{post.topic_id}}/{{post.post_number}}"
@ -13,7 +13,7 @@
</div> </div>
<blockquote> <blockquote>
<p> <p>
{{{post.excerpt}}} {{html-safe post.excerpt}}
</p> </p>
</blockquote> </blockquote>
</aside> </aside>

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,10 +1,10 @@
{{#d-modal-body title="explorer.import.modal"}} {{#d-modal-body title="explorer.import.modal"}}
<form {{action "dummy" on="submit"}}> <form {{action "dummy" on="submit"}}>
<div class='modal-body'> <div class="modal-body">
{{json-file-uploader value=queryFile extension=".dcquery.json"}} {{json-file-uploader value=queryFile extension=".dcquery.json"}}
</div> </div>
<div class="modal-footer"> <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> </div>
</form> </form>
{{/d-modal-body}} {{/d-modal-body}}