DEV: enforces ember-template-lint: no-partial (#9173)

selected-posts parial is kept and calling the new component to prevent errors with users who would have rewritten topic.hbs

dashboard-problems and version-checks seem less risky and have only been converted to components
This commit is contained in:
Joffrey JAFFEUX 2020-03-11 15:30:14 +01:00 committed by GitHub
parent 4e0b2ae294
commit 61a2c3650d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 249 additions and 121 deletions

View File

@ -12,6 +12,7 @@ module.exports = {
"no-unused-block-params": true,
"no-unbound": true,
"simple-unless": true,
"no-triple-curlies": true
"no-triple-curlies": true,
"no-partial": true
}
};

View File

@ -18,7 +18,7 @@
</div>
<p class="actions">
{{d-button action=(action "refreshProblems") class="btn-default" icon="sync" label="admin.dashboard.refresh_problems"}}
{{d-button action=refreshProblems class="btn-default" icon="sync" label="admin.dashboard.refresh_problems"}}
{{i18n 'admin.dashboard.last_checked'}}: {{problemsTimestamp}}
</p>
{{/conditional-loading-section}}

View File

@ -0,0 +1,135 @@
<div class="section-title">
<h2>
{{i18n "admin.dashboard.version"}}
</h2>
</div>
<div
class="dashboard-stats version-check
{{if versionCheck.critical_updates "critical" "normal"}}"
>
<div class="version-number">
<h4>
{{i18n "admin.dashboard.installed_version"}}
</h4>
<h3>
{{dash-if-empty versionCheck.installed_version}}
</h3>
{{#if versionCheck.gitLink}}
<div class="sha-link">
(
<a href={{versionCheck.gitLink}} rel="noopener" target="_blank">
{{versionCheck.shortSha}}
</a>
)
</div>
{{/if}}
</div>
{{#if versionCheck.noCheckPerformed}}
<div class="version-number">
<h4>
{{i18n "admin.dashboard.latest_version"}}
</h4>
<h3>
</h3>
</div>
<div class="version-status">
<div class="face">
<span class="icon critical-updates-available">
{{d-icon "far-frown"}}
</span>
</div>
<div class="version-notes">
<span class="normal-note">
{{i18n "admin.dashboard.no_check_performed"}}
</span>
</div>
</div>
{{else if versionCheck.stale_data}}
<div class="version-number">
<h4>
{{i18n "admin.dashboard.latest_version"}}
</h4>
<h3>
{{#if versionCheck.version_check_pending}}
{{dash-if-empty versionCheck.installed_version}}
{{/if}}
</h3>
</div>
<div class="version-status">
<div class="face">
{{#if versionCheck.version_check_pending}}
<span class="icon up-to-date">
{{d-icon "far-smile"}}
</span>
{{else}}
<span class="icon critical-updates-available">
{{d-icon "far-frown"}}
</span>
{{/if}}
</div>
<div class="version-notes">
<span class="normal-note">
{{#if versionCheck.version_check_pending}}
{{i18n "admin.dashboard.version_check_pending"}}
{{else}}
{{i18n "admin.dashboard.stale_data"}}
{{/if}}
</span>
</div>
</div>
{{else}}
<div class="version-number">
<h4>
{{i18n "admin.dashboard.latest_version"}}
</h4>
<h3>
{{dash-if-empty versionCheck.latest_version}}
</h3>
</div>
<div class="version-status">
<div class="face">
{{#if versionCheck.upToDate}}
<span class="icon up-to-date">
{{d-icon "far-smile"}}
</span>
{{else}}
<span
class="icon
{{if
versionCheck.critical_updates
"critical-updates-available"
"updates-available"
}}"
>
{{#if versionCheck.behindByOneVersion}}
{{d-icon "meh-o"}}
{{else}}
{{d-icon "far-frown"}}
{{/if}}
</span>
{{/if}}
</div>
<div class="version-notes">
{{#if versionCheck.upToDate}}
{{i18n "admin.dashboard.up_to_date"}}
{{else}}
<span class="critical-note">
{{i18n "admin.dashboard.critical_available"}}
</span>
<span class="normal-note">
{{i18n "admin.dashboard.updates_available"}}
</span>
{{i18n "admin.dashboard.please_upgrade"}}
{{/if}}
</div>
</div>
{{/if}}
{{custom-html
name="upgrade-header"
versionCheck=versionCheck
tagName="div"
classNames="upgrade-header"
}}
</div>

View File

@ -3,12 +3,18 @@
{{#if showVersionChecks}}
<div class="section-top">
<div class="version-checks">
{{partial "admin/templates/version-checks"}}
{{version-checks versionCheck=versionCheck}}
</div>
</div>
{{/if}}
{{partial "admin/templates/dashboard-problems"}}
{{dashboard-problems
loadingProblems=loadingProblems
foundProblems=foundProblems
problems=problems
problemsTimestamp=problemsTimestamp
refreshProblems=(action "refreshProblems")
}}
<ul class="navigation">
<li class="navigation-item general">

View File

@ -1,88 +0,0 @@
<div class="section-title">
<h2>{{i18n 'admin.dashboard.version'}}</h2>
</div>
<div class="dashboard-stats version-check {{if versionCheck.critical_updates 'critical' 'normal'}}">
<div class="version-number">
<h4>{{i18n 'admin.dashboard.installed_version'}}</h4>
<h3>{{dash-if-empty versionCheck.installed_version}}</h3>
{{#if versionCheck.gitLink}}
<div class="sha-link">
(<a href={{versionCheck.gitLink}} rel="noopener" target="_blank">{{versionCheck.shortSha}}</a>)
</div>
{{/if}}
</div>
{{#if versionCheck.noCheckPerformed}}
<div class="version-number">
<h4>{{i18n 'admin.dashboard.latest_version'}}</h4>
<h3>&mdash;</h3>
</div>
<div class="version-status">
<div class="face">
<span class="icon critical-updates-available">{{d-icon "far-frown"}}</span>
</div>
<div class="version-notes">
<span class="normal-note">{{i18n 'admin.dashboard.no_check_performed'}}</span>
</div>
</div>
{{else}}
{{#if versionCheck.stale_data}}
<div class="version-number">
<h4>{{i18n 'admin.dashboard.latest_version'}}</h4>
<h3>{{#if versionCheck.version_check_pending}}{{dash-if-empty versionCheck.installed_version}}{{/if}}</h3>
</div>
<div class="version-status">
<div class="face">
{{#if versionCheck.version_check_pending}}
<span class='icon up-to-date'>{{d-icon "far-smile"}}</span>
{{else}}
<span class="icon critical-updates-available">{{d-icon "far-frown"}}</span>
{{/if}}
</div>
<div class="version-notes">
<span class="normal-note">
{{#if versionCheck.version_check_pending}}
{{i18n 'admin.dashboard.version_check_pending'}}
{{else}}
{{i18n 'admin.dashboard.stale_data'}}
{{/if}}
</span>
</div>
</div>
{{else}}
<div class="version-number">
<h4>{{i18n 'admin.dashboard.latest_version'}}</h4>
<h3>{{dash-if-empty versionCheck.latest_version}}</h3>
</div>
<div class="version-status">
<div class="face">
{{#if versionCheck.upToDate }}
<span class='icon up-to-date'>{{d-icon "far-smile"}}</span>
{{else}}
<span class="icon {{if versionCheck.critical_updates 'critical-updates-available' 'updates-available'}}">
{{#if versionCheck.behindByOneVersion}}
{{d-icon "meh-o"}}
{{else}}
{{d-icon "far-frown"}}
{{/if}}
</span>
{{/if}}
</div>
<div class="version-notes">
{{#if versionCheck.upToDate }}
{{i18n 'admin.dashboard.up_to_date'}}
{{else}}
<span class="critical-note">{{i18n 'admin.dashboard.critical_available'}}</span>
<span class="normal-note">{{i18n 'admin.dashboard.updates_available'}}</span>
{{i18n 'admin.dashboard.please_upgrade'}}
{{/if}}
</div>
</div>
{{/if}}
{{/if}}
{{custom-html name="upgrade-header" versionCheck=versionCheck tagName="div" classNames="upgrade-header"}}
</div>

View File

@ -0,0 +1,61 @@
<p>
{{count-i18n key="topic.multi_select.description" count=selectedPostsCount}}
</p>
{{#if canSelectAll}}
<p>
<a class="select-all" href {{action selectAll}}>
{{i18n "topic.multi_select.select_all"}}
</a>
</p>
{{/if}}
{{#if canDeselectAll}}
<p>
<a href {{action deselectAll}}>
{{i18n "topic.multi_select.deselect_all"}}
</a>
</p>
{{/if}}
{{#if canDeleteSelected}}
{{d-button
action=deleteSelected
icon="far-trash-alt"
label="topic.multi_select.delete"
class="btn-danger"
}}
{{/if}}
{{#if canMergeTopic}}
{{d-button
action=(route-action "moveToTopic")
icon="sign-out-alt"
label="topic.move_to.action"
class="btn-primary move-to-topic"
}}
{{/if}}
{{#if canChangeOwner}}
{{d-button
action=(route-action "changeOwner")
icon="user"
label="topic.change_owner.action"
class="btn-primary"
}}
{{/if}}
{{#if canMergePosts}}
{{d-button
action=mergePosts
icon="arrows-v"
label="topic.merge_posts.action"
class="btn-primary"
}}
{{/if}}
<p class="cancel">
<a href {{action toggleMultiSelect}}>
{{i18n "topic.multi_select.cancel"}}
</a>
</p>

View File

@ -1,27 +1,14 @@
<p>{{count-i18n key="topic.multi_select.description" count=selectedPostsCount}}</p>
{{#if canSelectAll}}
<p><a class="select-all" href {{action "selectAll"}}>{{i18n 'topic.multi_select.select_all'}}</a></p>
{{/if}}
{{#if canDeselectAll}}
<p><a href {{action "deselectAll"}}>{{i18n 'topic.multi_select.deselect_all'}}</a></p>
{{/if}}
{{#if canDeleteSelected}}
{{d-button action=(action "deleteSelected") icon="far-trash-alt" label="topic.multi_select.delete" class="btn-danger"}}
{{/if}}
{{#if canMergeTopic}}
{{d-button action=(route-action "moveToTopic") icon="sign-out-alt" label="topic.move_to.action" class="btn-primary move-to-topic"}}
{{/if}}
{{#if canChangeOwner}}
{{d-button action=(route-action "changeOwner") icon="user" label="topic.change_owner.action" class="btn-primary"}}
{{/if}}
{{#if canMergePosts}}
{{d-button action=(action "mergePosts") icon="arrows-v" label="topic.merge_posts.action" class="btn-primary"}}
{{/if}}
<p class='cancel'><a href {{action "toggleMultiSelect"}}>{{i18n 'topic.multi_select.cancel'}}</a></p>
{{selected-posts
selectedPostsCount=selectedPostsCount
canSelectAll=canSelectAll
canDeselectAll=canDeselectAll
canDeleteSelected=canDeleteSelected
canMergeTopic=canMergeTopic
canChangeOwner=canChangeOwner
canMergePosts=canMergePosts
toggleMultiSelect=(action "toggleMultiSelect")
mergePosts=(action "mergePosts")
deleteSelected=(action "deleteSelected")
deselectAll=(action "deselectAll")
selectAll=(action "selectAll")
}}

View File

@ -91,7 +91,20 @@
<div class="container posts">
<div class='selected-posts {{unless multiSelect 'hidden'}}'>
{{partial "selected-posts"}}
{{selected-posts
selectedPostsCount=selectedPostsCount
canSelectAll=canSelectAll
canDeselectAll=canDeselectAll
canDeleteSelected=canDeleteSelected
canMergeTopic=canMergeTopic
canChangeOwner=canChangeOwner
canMergePosts=canMergePosts
toggleMultiSelect=(action "toggleMultiSelect")
mergePosts=(action "mergePosts")
deleteSelected=(action "deleteSelected")
deselectAll=(action "deselectAll")
selectAll=(action "selectAll")
}}
</div>
{{#topic-navigation topic=model jumpToDate=(action "jumpToDate") jumpToIndex=(action "jumpToIndex") as |info|}}
@ -327,7 +340,20 @@
{{#if showSelectedPostsAtBottom}}
<div class='selected-posts {{unless multiSelect 'hidden'}}'>
{{partial "selected-posts"}}
{{selected-posts
selectedPostsCount=selectedPostsCount
canSelectAll=canSelectAll
canDeselectAll=canDeselectAll
canDeleteSelected=canDeleteSelected
canMergeTopic=canMergeTopic
canChangeOwner=canChangeOwner
canMergePosts=canMergePosts
toggleMultiSelect=(action "toggleMultiSelect")
mergePosts=(action "mergePosts")
deleteSelected=(action "deleteSelected")
deselectAll=(action "deselectAll")
selectAll=(action "selectAll")
}}
</div>
{{/if}}