Skip to content

Commit

Permalink
use prettier on templates
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelchadwick committed Sep 26, 2024
1 parent 07893bc commit 82acec1
Show file tree
Hide file tree
Showing 38 changed files with 252 additions and 261 deletions.
3 changes: 2 additions & 1 deletion packages/frontend/.template-lintrc.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
'use strict';

module.exports = {
extends: 'recommended',
plugins: ['ember-template-lint-plugin-prettier'],
extends: ['recommended', 'ember-template-lint-plugin-prettier:recommended'],
rules: {
'no-implicit-this': {
//our helpers which do not take arguments have to be listed here
Expand Down
8 changes: 6 additions & 2 deletions packages/frontend/app/components/counter.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,12 @@
</div>

<div class="buttons">
<button type="button" {{on "click" (fn this.change 1)}}>{{t "components.counter.countAdd"}}</button>
<button type="button" {{on "click" (fn this.change -1)}}>{{t "components.counter.countSubtract"}}</button>
<button type="button" {{on "click" (fn this.change 1)}}>{{t
"components.counter.countAdd"
}}</button>
<button type="button" {{on "click" (fn this.change -1)}}>{{t
"components.counter.countSubtract"
}}</button>

<button type="button" {{on "click" this.double}}>{{t "components.counter.multiX2"}}</button>

Expand Down
94 changes: 36 additions & 58 deletions packages/frontend/app/components/debug.hbs
Original file line number Diff line number Diff line change
@@ -1,67 +1,45 @@
{{#if @isExpanded}}
<details
class="debug"
{{on "click" this.saveDebugVisibility}}
open
>
<summary>{{t "components.debug.summary"}}</summary>
<div class="gallery">
<Box @text="Hello I'm a <code>Box</code> component in the <code>Debug</code> component." />
<Box>
{{t "components.box.defaultBlock1"}}
</Box>
<details class="debug" {{on "click" this.saveDebugVisibility}} open>
<summary>{{t "components.debug.summary"}}</summary>
<div class="gallery">
<Box @text="Hello I'm a <code>Box</code> component in the <code>Debug</code> component." />
<Box>
{{t "components.box.defaultBlock1"}}
</Box>

<DoubleIt />
<DoubleIt />

{{#if (eq this.env "production")}}
<AudioPlayer
@srcURL={{this.envApp.AUDIO_PLAYER_FILE_REMOTE}}
@shouldLoop={{true}}
/>
{{else}}
<AudioPlayer
@srcURL={{this.envApp.AUDIO_PLAYER_FILE_LOCAL}}
@shouldLoop={{true}}
/>
{{/if}}
{{#if (eq this.env "production")}}
<AudioPlayer @srcURL={{this.envApp.AUDIO_PLAYER_FILE_REMOTE}} @shouldLoop={{true}} />
{{else}}
<AudioPlayer @srcURL={{this.envApp.AUDIO_PLAYER_FILE_LOCAL}} @shouldLoop={{true}} />
{{/if}}

<GhUser
@username={{@ghUsername}}
@htmlUrl={{@ghHtmlUrl}}
@publicRepos={{@ghPublicRepos}}
@publicGists={{@ghPublicGists}}
@followers={{@ghFollowers}}
@following={{@ghFollowing}}
/>
<GhUser
@username={{@ghUsername}}
@htmlUrl={{@ghHtmlUrl}}
@publicRepos={{@ghPublicRepos}}
@publicGists={{@ghPublicGists}}
@followers={{@ghFollowers}}
@following={{@ghFollowing}}
/>

<Mover />
</div>
</details>
<Mover />
</div>
</details>
{{else}}
<details
class="debug"
{{on "click" this.saveDebugVisibility}}
>
<summary>{{t "components.debug.summary"}}</summary>
<div class="gallery">
<DoubleIt />
<details class="debug" {{on "click" this.saveDebugVisibility}}>
<summary>{{t "components.debug.summary"}}</summary>
<div class="gallery">
<DoubleIt />

{{#if (eq this.env "production")}}
<AudioPlayer
@srcURL={{this.envApp.AUDIO_PLAYER_FILE_REMOTE}}
@shouldLoop={{true}}
/>
{{else}}
<AudioPlayer
@srcURL={{this.envApp.AUDIO_PLAYER_FILE_LOCAL}}
@shouldLoop={{true}}
/>
{{/if}}
{{#if (eq this.env "production")}}
<AudioPlayer @srcURL={{this.envApp.AUDIO_PLAYER_FILE_REMOTE}} @shouldLoop={{true}} />
{{else}}
<AudioPlayer @srcURL={{this.envApp.AUDIO_PLAYER_FILE_LOCAL}} @shouldLoop={{true}} />
{{/if}}

<GhUser
@username={{@ghUsername}}
@publicRepos={{@ghPublicRepos}}
/>
</div>
</details>
<GhUser @username={{@ghUsername}} @publicRepos={{@ghPublicRepos}} />
</div>
</details>
{{/if}}
56 changes: 28 additions & 28 deletions packages/frontend/app/components/gh-commits/index.hbs
Original file line number Diff line number Diff line change
@@ -1,34 +1,34 @@
<div class="gh-commits">
<h3>{{if @title @title (t "components.ghCommits.head")}}</h3>
{{#if @commits}}
<table>
<thead>
<th></th>
<th></th>
</thead>
<tbody>
{{#each @commits as |commit|}}
<tr>
<td class="commit-date">
{{format-date
commit.commit.author.date
month="2-digit"
day="2-digit"
year="numeric"
hour="2-digit"
minute="2-digit"
}}
</td>
<td class="commit-message">
<a href={{commit.html_url}} target="_blank" rel="noopener noreferrer">
{{commit.commit.message}}
</a>
</td>
</tr>
{{/each}}
</tbody>
</table>
<table>
<thead>
<th></th>
<th></th>
</thead>
<tbody>
{{#each @commits as |commit|}}
<tr>
<td class="commit-date">
{{format-date
commit.commit.author.date
month="2-digit"
day="2-digit"
year="numeric"
hour="2-digit"
minute="2-digit"
}}
</td>
<td class="commit-message">
<a href={{commit.html_url}} target="_blank" rel="noopener noreferrer">
{{commit.commit.message}}
</a>
</td>
</tr>
{{/each}}
</tbody>
</table>
{{else}}
<p>{{t "general.noneFound" items="commits"}} {{t "errors.checkConsole"}}</p>
<p>{{t "general.noneFound" items="commits"}} {{t "errors.checkConsole"}}</p>
{{/if}}
</div>
4 changes: 2 additions & 2 deletions packages/frontend/app/components/gh-commits/loading.hbs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<div class="gh-commits-loading">
<h3>{{if @title @title (t "components.headGhCommits")}}</h3>
{{#if @commits}}
<p>{{t "general.loading" items="commits"}}</p>
<p>{{t "general.loading" items="commits"}}</p>
{{else}}
<p>{{t "general.noneFound" items="commits"}}</p>
<p>{{t "general.noneFound" items="commits"}}</p>
{{/if}}
</div>
12 changes: 8 additions & 4 deletions packages/frontend/app/components/gh-user.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,12 @@
<h3>{{t "components.ghUser.head"}}</h3>

<strong><a href={{@htmlUrl}}>{{@username}}</a></strong><br />
{{t "components.ghUser.repos"}}: {{@publicRepos}}<br />
{{t "components.ghUser.gists"}}: {{@publicGists}}<br />
{{t "components.ghUser.followers"}}: {{@followers}}<br />
{{t "components.ghUser.following"}}: {{@following}}<br />
{{t "components.ghUser.repos"}}:
{{@publicRepos}}<br />
{{t "components.ghUser.gists"}}:
{{@publicGists}}<br />
{{t "components.ghUser.followers"}}:
{{@followers}}<br />
{{t "components.ghUser.following"}}:
{{@following}}<br />
</div>
22 changes: 7 additions & 15 deletions packages/frontend/app/components/layout/nav-bar.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,14 @@

<div class="links">
{{#each this.routes as |route|}}
{{#if (eq route.route 'users')}}
<LinkTo
@route={{route.route}}
class="menu-{{route.route}}"
target={{route.target}}
>
<FaIcon @icon="user" />
</LinkTo>
{{#if (eq route.route "users")}}
<LinkTo @route={{route.route}} class="menu-{{route.route}}" target={{route.target}}>
<FaIcon @icon="user" />
</LinkTo>
{{else}}
<LinkTo
@route={{route.route}}
class="menu-{{route.route}}"
target={{route.target}}
>
{{route.title}}
</LinkTo>
<LinkTo @route={{route.route}} class="menu-{{route.route}}" target={{route.target}}>
{{route.title}}
</LinkTo>
{{/if}}
{{/each}}
</div>
Expand Down
13 changes: 3 additions & 10 deletions packages/frontend/app/components/locale-chooser.hbs
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
<div
class="locale-chooser"
data-test-locale-chooser
{{on-click-outside this.close}}
>
<div class="locale-chooser" data-test-locale-chooser {{on-click-outside this.close}}>
<button
type="button"
class="toggle"
Expand All @@ -21,10 +17,7 @@
<FaIcon @icon={{if this.isOpen "caret-down" "caret-right"}} />
</button>
{{#if this.isOpen}}
<div
class="menu"
role="menu"
>
<div class="menu" role="menu">
{{#each this.locales as |loc index|}}
<button
type="button"
Expand All @@ -44,4 +37,4 @@
{{/each}}
</div>
{{/if}}
</div>
</div>
3 changes: 2 additions & 1 deletion packages/frontend/app/components/messages.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
{{sanitize message.content}}
</Message>
{{else}}
<p>{{t "general.noneFound" items="messages"}}</p> {{t "sections.messages.addNew"}}
<p>{{t "general.noneFound" items="messages"}}</p>
{{t "sections.messages.addNew"}}
{{/each}}

<Forms::NewMessageInput @onCreate={{this.addMessage}} />
Expand Down
12 changes: 7 additions & 5 deletions packages/frontend/app/components/song-list/index.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,19 @@
<ul class="song-list">
{{#each @songs as |song|}}
<li>
<a href={{song.detailUrl}}
target="_blank"
<a
href={{song.detailUrl}}
target="_blank"
rel="noopener noreferrer"
title={{t "general.info"}}
>
<FaIcon @icon="circle-info" />
</a>
<a href={{song.fileUrl}}
target="_blank"
<a
href={{song.fileUrl}}
target="_blank"
rel="noopener noreferrer"
title={{t "general.listen"}}
title={{t "general.listen"}}
>
<FaIcon @icon="ear-listen" />
</a>
Expand Down
2 changes: 1 addition & 1 deletion packages/frontend/app/components/song-list/loading.hbs
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<FaIcon @icon="spinner" @spin={{true}} />{{t "general.loading"}}
<FaIcon @icon="spinner" @spin={{true}} />{{t "general.loading"}}
4 changes: 2 additions & 2 deletions packages/frontend/app/components/user-list.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@
</td>
<td class="text-left" colspan="1" data-test-root>
{{#if user.root}}
<FaIcon @icon="shield" />
<FaIcon @icon="shield" />
{{/if}}
</td>
</tr>
{{/each}}
</tbody>
</table>
</div>
</div>
2 changes: 1 addition & 1 deletion packages/frontend/app/components/user-profile.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
</h1>
<p>{{@user.email}}</p>
<p>{{if @user.root "Admin" "User"}}</p>
</div>
</div>
7 changes: 2 additions & 5 deletions packages/frontend/app/templates/about.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,5 @@
{{#if this.isLoading}}
<GhCommits::Loading />
{{else}}
<GhCommits
@title="Last 5 Commits"
@commits={{@model}}
/>
{{/if}}
<GhCommits @title="Last 5 Commits" @commits={{@model}} />
{{/if}}
16 changes: 6 additions & 10 deletions packages/frontend/app/templates/head.hbs
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
<title>
({{this.model.envTitle}})
{{#if this.model.routeTitle }}
{{this.model.routeTitle}} | {{this.model.title}}
{{#if this.model.routeTitle}}
{{this.model.routeTitle}}
|
{{this.model.title}}
{{else}}
{{this.model.title}}
{{/if}}
Expand All @@ -10,11 +12,5 @@
{{! template-lint-disable no-forbidden-elements }}
<meta property="og:title" content={{this.model.ogTitle}} />

<link
rel="shortcut icon"
href="/assets/icons/favicon-{{this.model.faviconType}}32.png"
/>
<link
rel="icon"
href="/assets/icons/favicon-{{this.model.faviconType}}32.png"
/>
<link rel="shortcut icon" href="/assets/icons/favicon-{{this.model.faviconType}}32.png" />
<link rel="icon" href="/assets/icons/favicon-{{this.model.faviconType}}32.png" />
Loading

0 comments on commit 82acec1

Please sign in to comment.