mirror of
https://github.com/discourse/discourse-placeholder-theme-component.git
synced 2025-06-15 03:32:10 +00:00
DEV: Update linting config and run gjs-codemod (#59)
* DEV: Update linting config and run gjs-codemod * DEV: Update linting config and run gjs-codemod
This commit is contained in:
parent
279871bdfd
commit
a2447f34ea
@ -1,3 +1,4 @@
|
||||
< 3.5.0.beta5-dev: 279871bdfd2e2379ce681e6a621163937eaaab8b
|
||||
< 3.5.0.beta1-dev: 515cab41e930f195632ddbba442437cbe298dfd1
|
||||
< 3.4.0.beta1-dev: 948634fe310ed8c7fbdc21811ef201f4b5c4f306
|
||||
< 3.3.0.beta1-dev: 05a727efd5b398bbae44ff3fef881fa8bcd90a2d
|
||||
|
44
Gemfile.lock
44
Gemfile.lock
@ -14,30 +14,31 @@ GEM
|
||||
securerandom (>= 0.3)
|
||||
tzinfo (~> 2.0, >= 2.0.5)
|
||||
uri (>= 0.13.1)
|
||||
ast (2.4.2)
|
||||
base64 (0.2.0)
|
||||
benchmark (0.4.0)
|
||||
bigdecimal (3.1.9)
|
||||
ast (2.4.3)
|
||||
base64 (0.3.0)
|
||||
benchmark (0.4.1)
|
||||
bigdecimal (3.2.1)
|
||||
concurrent-ruby (1.3.5)
|
||||
connection_pool (2.5.0)
|
||||
drb (2.2.1)
|
||||
connection_pool (2.5.3)
|
||||
drb (2.2.3)
|
||||
i18n (1.14.7)
|
||||
concurrent-ruby (~> 1.0)
|
||||
json (2.10.2)
|
||||
language_server-protocol (3.17.0.4)
|
||||
json (2.12.2)
|
||||
language_server-protocol (3.17.0.5)
|
||||
lint_roller (1.1.0)
|
||||
logger (1.6.6)
|
||||
logger (1.7.0)
|
||||
minitest (5.25.5)
|
||||
parallel (1.26.3)
|
||||
parser (3.3.7.1)
|
||||
parallel (1.27.0)
|
||||
parser (3.3.8.0)
|
||||
ast (~> 2.4.1)
|
||||
racc
|
||||
prettier_print (1.2.1)
|
||||
prism (1.4.0)
|
||||
racc (1.8.1)
|
||||
rack (3.1.12)
|
||||
rack (3.1.15)
|
||||
rainbow (3.1.1)
|
||||
regexp_parser (2.10.0)
|
||||
rubocop (1.74.0)
|
||||
rubocop (1.76.0)
|
||||
json (~> 2.3)
|
||||
language_server-protocol (~> 3.17.0.2)
|
||||
lint_roller (~> 1.1.0)
|
||||
@ -45,11 +46,12 @@ GEM
|
||||
parser (>= 3.3.0.2)
|
||||
rainbow (>= 2.2.2, < 4.0)
|
||||
regexp_parser (>= 2.9.3, < 3.0)
|
||||
rubocop-ast (>= 1.38.0, < 2.0)
|
||||
rubocop-ast (>= 1.45.0, < 2.0)
|
||||
ruby-progressbar (~> 1.7)
|
||||
unicode-display_width (>= 2.4.0, < 4.0)
|
||||
rubocop-ast (1.39.0)
|
||||
parser (>= 3.3.1.0)
|
||||
rubocop-ast (1.45.0)
|
||||
parser (>= 3.3.7.2)
|
||||
prism (~> 1.4)
|
||||
rubocop-capybara (2.22.1)
|
||||
lint_roller (~> 1.1)
|
||||
rubocop (~> 1.72, >= 1.72.1)
|
||||
@ -65,13 +67,13 @@ GEM
|
||||
rubocop-factory_bot (2.27.1)
|
||||
lint_roller (~> 1.1)
|
||||
rubocop (~> 1.72, >= 1.72.1)
|
||||
rubocop-rails (2.30.3)
|
||||
rubocop-rails (2.32.0)
|
||||
activesupport (>= 4.2.0)
|
||||
lint_roller (~> 1.1)
|
||||
rack (>= 1.1)
|
||||
rubocop (>= 1.72.1, < 2.0)
|
||||
rubocop-ast (>= 1.38.0, < 2.0)
|
||||
rubocop-rspec (3.5.0)
|
||||
rubocop (>= 1.75.0, < 2.0)
|
||||
rubocop-ast (>= 1.44.0, < 2.0)
|
||||
rubocop-rspec (3.6.0)
|
||||
lint_roller (~> 1.1)
|
||||
rubocop (~> 1.72, >= 1.72.1)
|
||||
rubocop-rspec_rails (2.31.0)
|
||||
@ -98,4 +100,4 @@ DEPENDENCIES
|
||||
syntax_tree
|
||||
|
||||
BUNDLED WITH
|
||||
2.6.6
|
||||
2.6.9
|
||||
|
@ -0,0 +1,128 @@
|
||||
import Component, { Input } from "@ember/component";
|
||||
import { fn, hash } from "@ember/helper";
|
||||
import { on } from "@ember/modifier";
|
||||
import EmberObject, { action } from "@ember/object";
|
||||
import { service } from "@ember/service";
|
||||
import { isBlank } from "@ember/utils";
|
||||
import DButton from "discourse/components/d-button";
|
||||
import DModal from "discourse/components/d-modal";
|
||||
import { i18n } from "discourse-i18n";
|
||||
import MultiSelect from "select-kit/components/multi-select";
|
||||
|
||||
export default class DiscoursePlaceholderBuilder extends Component {
|
||||
@service dialog;
|
||||
|
||||
form = EmberObject.create({
|
||||
key: null,
|
||||
description: null,
|
||||
values: [],
|
||||
});
|
||||
|
||||
@action
|
||||
updateKey(event) {
|
||||
this.form.set("key", event.target.value);
|
||||
}
|
||||
|
||||
@action
|
||||
updateDescription(event) {
|
||||
this.form.set("description", event.target.value);
|
||||
}
|
||||
|
||||
@action
|
||||
insertPlaceholder() {
|
||||
if (isBlank(this.form.key)) {
|
||||
this.dialog.alert(i18n(themePrefix("builder.errors.no_key")));
|
||||
return;
|
||||
}
|
||||
|
||||
let output = `[wrap=placeholder key="${this.form.key}"`;
|
||||
|
||||
if (this.form.description) {
|
||||
output += ` description="${this.form.description}"`;
|
||||
}
|
||||
|
||||
if (this.form.values.length) {
|
||||
if (this.form.values.length === 1) {
|
||||
output += ` default="${this.form.values.firstObject}"`;
|
||||
} else {
|
||||
output += ` defaults="${this.form.values.join(",")}"`;
|
||||
}
|
||||
}
|
||||
|
||||
output += "][/wrap]";
|
||||
this.model.toolbarEvent.addText(output);
|
||||
|
||||
this.closeModal();
|
||||
}
|
||||
|
||||
<template>
|
||||
<DModal
|
||||
@title={{i18n (themePrefix "builder.title")}}
|
||||
@closeModal={{@closeModal}}
|
||||
@tagName="form"
|
||||
class="placeholder-builder"
|
||||
>
|
||||
<:body>
|
||||
<div class="control">
|
||||
<span class="label">
|
||||
{{i18n (themePrefix "builder.key.label")}}
|
||||
</span>
|
||||
<div class="input">
|
||||
<Input
|
||||
{{on "input" this.updateKey}}
|
||||
@value={{readonly this.form.key}}
|
||||
class="placeholder-builder__key"
|
||||
/>
|
||||
</div>
|
||||
<p class="description">{{i18n
|
||||
(themePrefix "builder.key.description")
|
||||
}}</p>
|
||||
</div>
|
||||
|
||||
<div class="control">
|
||||
<span class="label">
|
||||
{{i18n (themePrefix "builder.description.label")}}
|
||||
</span>
|
||||
<div class="input">
|
||||
<Input
|
||||
{{on "input" this.updateDescription}}
|
||||
@value={{readonly this.form.description}}
|
||||
class="placeholder-builder__description"
|
||||
/>
|
||||
</div>
|
||||
<p class="description">
|
||||
{{i18n (themePrefix "builder.description.description")}}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div class="control">
|
||||
<span class="label">
|
||||
{{i18n (themePrefix "builder.values.label")}}
|
||||
</span>
|
||||
<div class="input">
|
||||
<MultiSelect
|
||||
@valueProperty={{null}}
|
||||
@nameProperty={{null}}
|
||||
@value={{this.form.values}}
|
||||
@content={{this.form.values}}
|
||||
@options={{hash allowAny=true placementStrategy="absolute"}}
|
||||
@onChange={{fn (mut this.form.values)}}
|
||||
class="placeholder-builder__default-values"
|
||||
/>
|
||||
</div>
|
||||
<p class="description">{{i18n
|
||||
(themePrefix "builder.values.description")
|
||||
}}</p>
|
||||
</div>
|
||||
</:body>
|
||||
|
||||
<:footer>
|
||||
<DButton
|
||||
@action={{this.insertPlaceholder}}
|
||||
@label={{themePrefix "builder.insert"}}
|
||||
class="btn-primary"
|
||||
/>
|
||||
</:footer>
|
||||
</DModal>
|
||||
</template>
|
||||
}
|
@ -1,64 +0,0 @@
|
||||
<DModal
|
||||
@title={{i18n (theme-prefix "builder.title")}}
|
||||
@closeModal={{@closeModal}}
|
||||
@tagName="form"
|
||||
class="placeholder-builder"
|
||||
>
|
||||
<:body>
|
||||
<div class="control">
|
||||
<span class="label">
|
||||
{{theme-i18n "builder.key.label"}}
|
||||
</span>
|
||||
<div class="input">
|
||||
<Input
|
||||
{{on "input" this.updateKey}}
|
||||
@value={{readonly this.form.key}}
|
||||
class="placeholder-builder__key"
|
||||
/>
|
||||
</div>
|
||||
<p class="description">{{theme-i18n "builder.key.description"}}</p>
|
||||
</div>
|
||||
|
||||
<div class="control">
|
||||
<span class="label">
|
||||
{{theme-i18n "builder.description.label"}}
|
||||
</span>
|
||||
<div class="input">
|
||||
<Input
|
||||
{{on "input" this.updateDescription}}
|
||||
@value={{readonly this.form.description}}
|
||||
class="placeholder-builder__description"
|
||||
/>
|
||||
</div>
|
||||
<p class="description">
|
||||
{{theme-i18n "builder.description.description"}}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div class="control">
|
||||
<span class="label">
|
||||
{{theme-i18n "builder.values.label"}}
|
||||
</span>
|
||||
<div class="input">
|
||||
<MultiSelect
|
||||
@valueProperty={{null}}
|
||||
@nameProperty={{null}}
|
||||
@value={{this.form.values}}
|
||||
@content={{this.form.values}}
|
||||
@options={{hash allowAny=true placementStrategy="absolute"}}
|
||||
@onChange={{fn (mut this.form.values)}}
|
||||
class="placeholder-builder__default-values"
|
||||
/>
|
||||
</div>
|
||||
<p class="description">{{theme-i18n "builder.values.description"}}</p>
|
||||
</div>
|
||||
</:body>
|
||||
|
||||
<:footer>
|
||||
<DButton
|
||||
@action={{this.insertPlaceholder}}
|
||||
@label={{theme-prefix "builder.insert"}}
|
||||
class="btn-primary"
|
||||
/>
|
||||
</:footer>
|
||||
</DModal>
|
@ -1,52 +0,0 @@
|
||||
import Component from "@ember/component";
|
||||
import EmberObject, { action } from "@ember/object";
|
||||
import { service } from "@ember/service";
|
||||
import { isBlank } from "@ember/utils";
|
||||
import { i18n } from "discourse-i18n";
|
||||
|
||||
export default class DiscoursePlaceholderBuilder extends Component {
|
||||
@service dialog;
|
||||
|
||||
form = EmberObject.create({
|
||||
key: null,
|
||||
description: null,
|
||||
values: [],
|
||||
});
|
||||
|
||||
@action
|
||||
updateKey(event) {
|
||||
this.form.set("key", event.target.value);
|
||||
}
|
||||
|
||||
@action
|
||||
updateDescription(event) {
|
||||
this.form.set("description", event.target.value);
|
||||
}
|
||||
|
||||
@action
|
||||
insertPlaceholder() {
|
||||
if (isBlank(this.form.key)) {
|
||||
this.dialog.alert(i18n(themePrefix("builder.errors.no_key")));
|
||||
return;
|
||||
}
|
||||
|
||||
let output = `[wrap=placeholder key="${this.form.key}"`;
|
||||
|
||||
if (this.form.description) {
|
||||
output += ` description="${this.form.description}"`;
|
||||
}
|
||||
|
||||
if (this.form.values.length) {
|
||||
if (this.form.values.length === 1) {
|
||||
output += ` default="${this.form.values.firstObject}"`;
|
||||
} else {
|
||||
output += ` defaults="${this.form.values.join(",")}"`;
|
||||
}
|
||||
}
|
||||
|
||||
output += "][/wrap]";
|
||||
this.model.toolbarEvent.addText(output);
|
||||
|
||||
this.closeModal();
|
||||
}
|
||||
}
|
@ -1,11 +1,11 @@
|
||||
{
|
||||
"private": true,
|
||||
"devDependencies": {
|
||||
"@discourse/lint-configs": "2.11.1",
|
||||
"ember-template-lint": "7.0.1",
|
||||
"eslint": "9.22.0",
|
||||
"@discourse/lint-configs": "2.25.0",
|
||||
"ember-template-lint": "7.8.1",
|
||||
"eslint": "9.28.0",
|
||||
"prettier": "3.5.3",
|
||||
"stylelint": "16.16.0"
|
||||
"stylelint": "16.20.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 22",
|
||||
|
1371
pnpm-lock.yaml
generated
1371
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user