Skip to content
This repository has been archived by the owner on Nov 28, 2022. It is now read-only.

Commit

Permalink
Ran "no implicit this in templates" codemod
Browse files Browse the repository at this point in the history
no issue

We were in a part-way state where some touched files had been (sometimes partially) migrated to explicit `this`. The codemod that was available has now fixed the formatting issues it had so it was a good time to run it.

https://github.com/ember-codemods/ember-no-implicit-this-codemod

- part of the migration path for emberjs/rfcs#308
- starts to make template resolution rules more explicit
  - `<MyComponent />` - always a component
  - `{{my-component}}` - component or helper (components _must_ have a `-`. This style of component will go away once fully migrated to angle bracket components)
  - `{{value}}` - a helper or local template variable
  - `{{this.value}}` - reference to a property on the backing context (either a controller or a component JS file)
  • Loading branch information
kevinansfield committed Dec 13, 2019
1 parent 077347a commit aaf9f88
Show file tree
Hide file tree
Showing 113 changed files with 1,186 additions and 1,205 deletions.
14 changes: 7 additions & 7 deletions app/templates/about.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,21 @@
<section class="view-container">
<section class="gh-env-details">
<ul class="gh-env-list">
<li class="gh-env-list-version"><strong>Version</strong> {{config.version}}</li>
<li><strong>Environment</strong> {{config.environment}}</li>
<li class="gh-env-list-database-type"><strong>Database</strong> {{config.database}}</li>
<li><strong>Mail</strong> {{#if config.mail}}{{config.mail}}{{else}}Native{{/if}}</li>
<li class="gh-env-list-version"><strong>Version</strong> {{this.config.version}}</li>
<li><strong>Environment</strong> {{this.config.environment}}</li>
<li class="gh-env-list-database-type"><strong>Database</strong> {{this.config.database}}</li>
<li><strong>Mail</strong> {{#if this.config.mail}}{{this.config.mail}}{{else}}Native{{/if}}</li>
</ul>
<div class="gh-env-help">
<a class="gh-btn" href="https://ghost.org/docs/" target="_blank"><span>User Documentation</span></a>
<a class="gh-btn" href="https://forum.ghost.org/" target="_blank"><span>Get Help With Ghost</span></a>
</div>
</section>

{{#if upgradeStatus.message}}
{{#if this.upgradeStatus.message}}
<section class="gh-upgrade-notification">
<p>
<strong>Update available!</strong> {{upgradeStatus.message}}
<strong>Update available!</strong> {{this.upgradeStatus.message}}
</p>
</section>
{{/if}}
Expand All @@ -38,7 +38,7 @@
</section>

<footer class="gh-copyright-info">
Copyright &copy; 2013 &ndash; {{copyrightYear}} Ghost Foundation, released under the <a href="https://github.com/TryGhost/Ghost/blob/master/LICENSE" target="_blank">MIT license</a>.
Copyright &copy; 2013 &ndash; {{this.copyrightYear}} Ghost Foundation, released under the <a href="https://github.com/TryGhost/Ghost/blob/master/LICENSE" target="_blank">MIT license</a>.
<br>
<a href="https://ghost.org/" target="_blank">Ghost</a> is a registered trademark of <a href="https://ghost.org/trademark/" target="_blank">Ghost Foundation Ltd</a>.
</footer>
Expand Down
8 changes: 4 additions & 4 deletions app/templates/application.hbs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{{#gh-app showSettingsMenu=ui.showSettingsMenu}}
{{#gh-app showSettingsMenu=this.ui.showSettingsMenu}}
{{#gh-skip-link anchor=".gh-main"}}Skip to main content{{/gh-skip-link}}

{{gh-alerts}}

<div class="gh-viewport {{if ui.showSettingsMenu 'settings-menu-expanded'}} {{if ui.showMobileMenu 'mobile-menu-expanded'}}">
{{#if showNavMenu}}
<div class="gh-viewport {{if this.ui.showSettingsMenu 'settings-menu-expanded'}} {{if this.ui.showMobileMenu 'mobile-menu-expanded'}}">
{{#if this.showNavMenu}}
{{gh-nav-menu
icon=settings.settledIcon
icon=this.settings.settledIcon
}}
{{/if}}

Expand Down
2 changes: 1 addition & 1 deletion app/templates/components/aspect-ratio-box.hbs
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{{#unless isResizing}}
{{#unless this.isResizing}}
{{yield}}
{{/unless}}
2 changes: 1 addition & 1 deletion app/templates/components/gh-activating-list-item.hbs
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{{#link-to route alternateActive=(action "setActive") classNameBindings="linkClasses"}}{{title}}{{yield}}{{/link-to}}
{{#link-to this.route alternateActive=(action "setActive") classNameBindings="linkClasses"}}{{title}}{{yield}}{{/link-to}}
2 changes: 1 addition & 1 deletion app/templates/components/gh-alerts.hbs
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{{#each messages as |message|}}
{{#each this.messages as |message|}}
{{gh-alert message=message}}
{{/each}}
2 changes: 1 addition & 1 deletion app/templates/components/gh-blog-url.hbs
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{{{config.blogUrl}}}
{{{this.config.blogUrl}}}
4 changes: 2 additions & 2 deletions app/templates/components/gh-canvas-header.hbs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<header
{{did-insert (action "initScrollWatch")}}
{{will-destroy (action "clearScrollWatch")}}
{{this.did-insert (action "initScrollWatch")}}
{{this.will-destroy (action "clearScrollWatch")}}
...attributes
>
{{yield}}
Expand Down
4 changes: 2 additions & 2 deletions app/templates/components/gh-cm-editor.hbs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{!-- display a standard textarea whilst waiting for CodeMirror to load/initialize --}}
{{gh-textarea
class=(concat "gh-cm-editor-textarea " textareaClass)
value=(readonly _value)
class=(concat "gh-cm-editor-textarea " this.textareaClass)
value=(readonly this._value)
input=(action "updateFromTextarea" value="target.value")}}
28 changes: 14 additions & 14 deletions app/templates/components/gh-date-time-picker.hbs
Original file line number Diff line number Diff line change
@@ -1,35 +1,35 @@
<div class="gh-date-time-picker">
{{#power-datepicker
selected=_date
center=_date
selected=this._date
center=this._date
onSelect=(action "setDate" value="date")
renderInPlace=true
disabled=disabled as |dp|
disabled=this.disabled as |dp|
}}
{{#dp.trigger tabindex="-1" data-test-date-time-picker-datepicker=true}}
<div class="gh-date-time-picker-date {{if dateError "error"}}">
<input type="text" readonly value={{moment-format _date "YYYY-MM-DD"}} disabled={{disabled}} data-test-date-time-picker-date-input>
<div class="gh-date-time-picker-date {{if this.dateError "error"}}">
<input type="text" readonly value={{moment-format this._date "YYYY-MM-DD"}} disabled={{this.disabled}} data-test-date-time-picker-date-input>
{{svg-jar "calendar"}}
</div>
{{/dp.trigger}}
{{#dp.content class="dropdown-menu"}}
{{dp.nav}}
{{dp.days minDate=_minDate maxDate=_maxDate weekdayFormat="min"}}
{{dp.days minDate=this._minDate maxDate=this._maxDate weekdayFormat="min"}}
{{/dp.content}}
{{/power-datepicker}}

<div class="gh-date-time-picker-time {{if hasError "error"}}">
<div class="gh-date-time-picker-time {{if this.hasError "error"}}">
<input
type="text"
value={{_time}}
disabled={{disabled}}
oninput={{action (mut _time) value="target.value"}}
onblur={{action "setTime" _time}}
value={{this._time}}
disabled={{this.disabled}}
oninput={{action (mut this._time) value="target.value"}}
onblur={{action "setTime" this._time}}
data-test-date-time-picker-time-input
>
<small class="gh-date-time-picker-timezone">({{timezone}})</small>
<small class="gh-date-time-picker-timezone">({{this.timezone}})</small>
</div>
</div>
{{#if hasError}}
<div class="gh-date-time-picker-error" data-test-date-time-picker-error>{{dateError}}{{timeError}}</div>
{{#if this.hasError}}
<div class="gh-date-time-picker-error" data-test-date-time-picker-error>{{this.dateError}}{{this.timeError}}</div>
{{/if}}
4 changes: 2 additions & 2 deletions app/templates/components/gh-download-count.hbs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{#if hasBlock}}
{{yield count}}
{{yield this.count}}
{{else}}
{{count}}
{{this.count}}
{{/if}}
4 changes: 2 additions & 2 deletions app/templates/components/gh-editor-post-status.hbs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{#if _isSaving}}
{{#if this._isSaving}}
Saving...
{{else if (or this.post.isPublished this.post.pastScheduledTime)}}
Published
Expand All @@ -8,7 +8,7 @@
and sent to {{pluralize this.post.email.emailCount "member"}}
{{/if}}
{{else if this.post.isScheduled}}
{{#if countdown}}
{{#if this.countdown}}
<time datetime="{{this.post.publishedAtUTC}}" class="ml1 green f8" data-test-schedule-countdown>
Scheduled to be published {{if this.post.sendEmailWhenPublished "and sent"}} {{this.countdown}}.
</time>
Expand Down
16 changes: 8 additions & 8 deletions app/templates/components/gh-editor.hbs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{{yield (hash
headerClass=headerClass
headerHeight=headerHeight
isDraggedOver=isDraggedOver
isFullScreen=isFullScreen
droppedFiles=droppedFiles
uploadedImageUrls=uploadedImageUrls
imageMimeTypes=imageMimeTypes
imageExtensions=imageExtensions
headerClass=this.headerClass
headerHeight=this.headerHeight
isDraggedOver=this.isDraggedOver
isFullScreen=this.isFullScreen
droppedFiles=this.droppedFiles
uploadedImageUrls=this.uploadedImageUrls
imageMimeTypes=this.imageMimeTypes
imageExtensions=this.imageExtensions
toggleFullScreen=(action "toggleFullScreen")
togglePreview=(action "togglePreview")
toggleSplitScreen=(action "toggleSplitScreen")
Expand Down
2 changes: 1 addition & 1 deletion app/templates/components/gh-error-message.hbs
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{{message}}
{{this.message}}
2 changes: 1 addition & 1 deletion app/templates/components/gh-feature-flag.hbs
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<input type="checkbox" checked={{value}} disabled={{disabled}} id={{for}} name={{name}} onclick={{action (mut value) value="target.checked"}}>
<input type="checkbox" checked={{this.value}} disabled={{this.disabled}} id={{this.for}} name={{this.name}} onclick={{action (mut this.value) value="target.checked"}}>
<span class="input-toggle-component"></span>
{{{yield}}}
6 changes: 3 additions & 3 deletions app/templates/components/gh-file-upload.hbs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<input class="gh-input gh-input-file q" data-url="upload" type="file" name="importfile" accept="{{acceptEncoding}}">
<button id="startupload" class="gh-btn gh-btn-hover-blue" type="submit" disabled={{uploadButtonDisabled}} {{action "upload"}}>
<span>{{uploadButtonText}}</span>
<input class="gh-input gh-input-file q" data-url="upload" type="file" name="importfile" accept="{{this.acceptEncoding}}">
<button id="startupload" class="gh-btn gh-btn-hover-blue" type="submit" disabled={{this.uploadButtonDisabled}} {{action "upload"}}>
<span>{{this.uploadButtonText}}</span>
</button>
14 changes: 7 additions & 7 deletions app/templates/components/gh-file-uploader.hbs
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
{{#if file}}
{{#if this.file}}
{{!-- Upload in progress! --}}
{{#if failureMessage}}
<div class="failed">{{failureMessage}}</div>
{{#if this.failureMessage}}
<div class="failed">{{this.failureMessage}}</div>
{{/if}}
<div class="progress-container">
<div class="progress">
<div class="bar {{if failureMessage "fail"}}" style={{progressStyle}}></div>
<div class="bar {{if this.failureMessage "fail"}}" style={{this.progressStyle}}></div>
</div>
</div>
{{#if failureMessage}}
{{#if this.failureMessage}}
<button class="gh-btn gh-btn-green" {{action "reset"}} data-test-upload-try-again-button><span>Try Again</span></button>
{{/if}}
{{else}}
<div class="upload-form">
{{#gh-file-input multiple=false alt=labelText action=(action 'fileSelected') accept=accept}}
<div class="description">{{labelText}}</div>
{{#gh-file-input multiple=false alt=this.labelText action=(action 'fileSelected') accept=this.accept}}
<div class="description">{{this.labelText}}</div>
{{/gh-file-input}}
</div>
{{/if}}
6 changes: 3 additions & 3 deletions app/templates/components/gh-fullscreen-modal.hbs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{{#liquid-wormhole class="fullscreen-modal-container"}}
<div class="fullscreen-modal-background" {{action "clickOverlay"}}></div>
<div class={{modalClasses}}>
<div class={{this.modalClasses}}>
{{#if hasBlock}}
{{yield}}
{{else}}
{{component modalPath
model=model
{{component this.modalPath
model=this.model
confirm=(action 'confirm')
closeModal=(action 'close')}}
{{/if}}
Expand Down
4 changes: 2 additions & 2 deletions app/templates/components/gh-image-uploader-with-preview.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
{{else}}
{{gh-image-uploader
text=text
altText=altText
allowUnsplash=allowUnsplash
altText=this.altText
allowUnsplash=this.allowUnsplash
update=(action 'update')
uploadStarted=(action 'uploadStarted')
uploadFinished=(action 'uploadFinished')
Expand Down
18 changes: 9 additions & 9 deletions app/templates/components/gh-image-uploader.hbs
Original file line number Diff line number Diff line change
@@ -1,32 +1,32 @@
{{#if file}}
{{#if this.file}}
{{!-- Upload in progress! --}}
{{#if failureMessage}}
<div class="failed">{{failureMessage}}</div>
{{#if this.failureMessage}}
<div class="failed">{{this.failureMessage}}</div>
{{/if}}
<div class="progress-container">
<div class="progress">
<div class="bar {{if failureMessage "fail"}}" style={{progressStyle}}></div>
<div class="bar {{if this.failureMessage "fail"}}" style={{this.progressStyle}}></div>
</div>
</div>
{{#if failureMessage}}
{{#if this.failureMessage}}
<button class="gh-btn gh-btn-green" {{action "reset"}}><span>Try Again</span></button>
{{/if}}
{{else}}
{{!-- file selection/drag-n-drop --}}
<div class="upload-form">
{{#gh-file-input multiple=false alt=description action=(action "fileSelected") accept=accept}}
<div class="gh-btn gh-btn-outline" data-test-file-input-description><span>{{description}}</span></div>
{{#gh-file-input multiple=false alt=this.description action=(action "fileSelected") accept=this.accept}}
<div class="gh-btn gh-btn-outline" data-test-file-input-description><span>{{this.description}}</span></div>
{{/gh-file-input}}

{{#if (and allowUnsplash settings.unsplash.isActive)}}
{{#if (and this.allowUnsplash this.settings.unsplash.isActive)}}
<div class="gh-image-uploader-unsplash" {{action (toggle "_showUnsplash" this)}}>
{{svg-jar "unsplash"}}
</div>
{{/if}}
</div>
{{/if}}

{{#if _showUnsplash}}
{{#if this._showUnsplash}}
{{gh-unsplash
select=(action "addUnsplashPhoto")
close=(action (toggle "_showUnsplash" this))
Expand Down
4 changes: 2 additions & 2 deletions app/templates/components/gh-infinity-loader.hbs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{{#if hasBlock}}
{{yield infinityModelContent}}
{{yield this.infinityModelContent}}
{{else}}
{{#if isDoneLoading}}
{{#if this.isDoneLoading}}
{{else}}
<div class="gh-loading-spinner"></div>
{{/if}}
Expand Down
20 changes: 10 additions & 10 deletions app/templates/components/gh-koenig-editor.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
>
{{gh-textarea
class="gh-editor-title"
placeholder=titlePlaceholder
placeholder=this.titlePlaceholder
tabindex="1"
autoExpand=".gh-koenig-editor"
value=(readonly title)
value=(readonly this.title)
input=(action "onTitleChange" value="target.value")
focus-out=(action "onTitleFocusOut")
keyDown=(action "onTitleKeydown")
Expand All @@ -18,18 +18,18 @@
}}

{{koenig-editor
mobiledoc=body
placeholder=bodyPlaceholder
autofocus=bodyAutofocus
mobiledoc=this.body
placeholder=this.bodyPlaceholder
autofocus=this.bodyAutofocus
spellcheck=true
onChange=(action "onBodyChange")
didCreateEditor=(action "onEditorCreated")
cursorDidExitAtTop=(action "focusTitle")
headerOffset=headerOffset
headerOffset=this.headerOffset
dropTargetSelector=".gh-koenig-editor-pane"
scrollContainerSelector=scrollContainerSelector
scrollOffsetTopSelector=scrollOffsetTopSelector
scrollOffsetBottomSelector=scrollOffsetBottomSelector
wordCountDidChange=(action onWordCountChange)
scrollContainerSelector=this.scrollContainerSelector
scrollOffsetTopSelector=this.scrollOffsetTopSelector
scrollOffsetBottomSelector=this.scrollOffsetBottomSelector
wordCountDidChange=(action this.onWordCountChange)
}}
</div>
2 changes: 1 addition & 1 deletion app/templates/components/gh-loading-spinner.hbs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{#if showSpinner}}
{{#if this.showSpinner}}
<div class="gh-loading-content">
<div class="gh-loading-spinner"></div>
</div>
Expand Down
20 changes: 10 additions & 10 deletions app/templates/components/gh-markdown-editor.hbs
Original file line number Diff line number Diff line change
@@ -1,32 +1,32 @@
{{yield (hash
editor=(component "gh-simplemde"
value=markdown
placeholder=placeholder
autofocus=autofocus
value=this.markdown
placeholder=this.placeholder
autofocus=this.autofocus
onChange=(action "updateMarkdown")
onFocus=(action "updateFocusState" true)
onBlur=(action "updateFocusState" false)
onEditorInit=(action "setEditor")
options=simpleMDEOptions)
isFullScreen=_isFullScreen
isSplitScreen=_isSplitScreen
options=this.simpleMDEOptions)
isFullScreen=this._isFullScreen
isSplitScreen=this._isSplitScreen
focus=(action "focusEditor")
)}}

<div style="display:none">
{{gh-file-input
multiple=true
action=(action onImageFilesSelected)
accept=imageMimeTypes}}
action=(action this.onImageFilesSelected)
accept=this.imageMimeTypes}}
</div>

{{#if _showUnsplash}}
{{#if this._showUnsplash}}
{{gh-unsplash
select=(action "insertUnsplashPhoto")
close=(action "toggleUnsplash")}}
{{/if}}

{{#if showMarkdownHelp}}
{{#if this.showMarkdownHelp}}
{{gh-fullscreen-modal "markdown-help"
close=(action "toggleMarkdownHelp")
modifier="wide"}}
Expand Down
Loading

0 comments on commit aaf9f88

Please sign in to comment.