Apply prettier
Dieser Commit ist enthalten in:
Ursprung
7c9a0ef862
Commit
0313c773e8
15 geänderte Dateien mit 111 neuen und 99 gelöschten Zeilen
|
@ -8,8 +8,8 @@ const klasses = ["topic", "post", "group", "category"];
|
||||||
const types = ["string", "boolean", "integer", "json"];
|
const types = ["string", "boolean", "integer", "json"];
|
||||||
const proTypes = {
|
const proTypes = {
|
||||||
klass: ["group", "category"],
|
klass: ["group", "category"],
|
||||||
type: ["json"]
|
type: ["json"],
|
||||||
}
|
};
|
||||||
|
|
||||||
const generateContent = function (array, type, proSubscribed = false) {
|
const generateContent = function (array, type, proSubscribed = false) {
|
||||||
return array.reduce((result, key) => {
|
return array.reduce((result, key) => {
|
||||||
|
@ -19,7 +19,7 @@ const generateContent = function (array, type, proSubscribed = false) {
|
||||||
result.push({
|
result.push({
|
||||||
id: key,
|
id: key,
|
||||||
name: I18n.t(`admin.wizard.custom_field.${type}.${key}`),
|
name: I18n.t(`admin.wizard.custom_field.${type}.${key}`),
|
||||||
pro
|
pro,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
|
@ -32,10 +32,10 @@ export default Component.extend({
|
||||||
postSerializers: ["post"],
|
postSerializers: ["post"],
|
||||||
groupSerializers: ["basic_group"],
|
groupSerializers: ["basic_group"],
|
||||||
categorySerializers: ["basic_category"],
|
categorySerializers: ["basic_category"],
|
||||||
klassContent: computed("proSubscribed", function() {
|
klassContent: computed("proSubscribed", function () {
|
||||||
return generateContent(klasses, "klass", this.proSubscribed);
|
return generateContent(klasses, "klass", this.proSubscribed);
|
||||||
}),
|
}),
|
||||||
typeContent: computed("proSubscribed", function() {
|
typeContent: computed("proSubscribed", function () {
|
||||||
return generateContent(types, "type", this.proSubscribed);
|
return generateContent(types, "type", this.proSubscribed);
|
||||||
}),
|
}),
|
||||||
showInputs: or("field.new", "field.edit"),
|
showInputs: or("field.new", "field.edit"),
|
||||||
|
|
|
@ -102,10 +102,10 @@ export default Component.extend(UndoChanges, {
|
||||||
result.push({
|
result.push({
|
||||||
id: type,
|
id: type,
|
||||||
name: I18n.t(`admin.wizard.action.${type}.label`),
|
name: I18n.t(`admin.wizard.action.${type}.label`),
|
||||||
pro
|
pro,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}, []);
|
}, []);
|
||||||
}
|
},
|
||||||
});
|
});
|
||||||
|
|
|
@ -2,7 +2,7 @@ import SingleSelectComponent from "select-kit/components/single-select";
|
||||||
import { computed } from "@ember/object";
|
import { computed } from "@ember/object";
|
||||||
|
|
||||||
export default SingleSelectComponent.extend({
|
export default SingleSelectComponent.extend({
|
||||||
classNames: ["combo-box", 'wizard-pro-selector'],
|
classNames: ["combo-box", "wizard-pro-selector"],
|
||||||
|
|
||||||
selectKitOptions: {
|
selectKitOptions: {
|
||||||
autoFilterable: false,
|
autoFilterable: false,
|
||||||
|
@ -10,10 +10,10 @@ export default SingleSelectComponent.extend({
|
||||||
showFullTitle: true,
|
showFullTitle: true,
|
||||||
headerComponent: "wizard-pro-selector/wizard-pro-selector-header",
|
headerComponent: "wizard-pro-selector/wizard-pro-selector-header",
|
||||||
caretUpIcon: "caret-up",
|
caretUpIcon: "caret-up",
|
||||||
caretDownIcon: "caret-down"
|
caretDownIcon: "caret-down",
|
||||||
},
|
},
|
||||||
|
|
||||||
modifyComponentForRow() {
|
modifyComponentForRow() {
|
||||||
return "wizard-pro-selector/wizard-pro-selector-row";
|
return "wizard-pro-selector/wizard-pro-selector-row";
|
||||||
}
|
},
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
import SelectKitRowComponent from "select-kit/components/select-kit/select-kit-row";
|
import SelectKitRowComponent from "select-kit/components/select-kit/select-kit-row";
|
||||||
|
|
||||||
export default SelectKitRowComponent.extend();
|
export default SelectKitRowComponent.extend();
|
||||||
|
|
|
@ -4,44 +4,49 @@ import { notEmpty } from "@ember/object/computed";
|
||||||
import discourseComputed from "discourse-common/utils/decorators";
|
import discourseComputed from "discourse-common/utils/decorators";
|
||||||
|
|
||||||
export default Component.extend({
|
export default Component.extend({
|
||||||
classNameBindings: [':custom-wizard-pro-subscription', 'subscription.active:active:inactive'],
|
classNameBindings: [
|
||||||
subscribed: notEmpty('subscription'),
|
":custom-wizard-pro-subscription",
|
||||||
|
"subscription.active:active:inactive",
|
||||||
|
],
|
||||||
|
subscribed: notEmpty("subscription"),
|
||||||
|
|
||||||
@discourseComputed('subscription.type')
|
@discourseComputed("subscription.type")
|
||||||
title(type) {
|
title(type) {
|
||||||
return type ?
|
return type
|
||||||
I18n.t(`admin.wizard.pro.subscription.title.${type}`) :
|
? I18n.t(`admin.wizard.pro.subscription.title.${type}`)
|
||||||
I18n.t("admin.wizard.pro.not_subscribed");
|
: I18n.t("admin.wizard.pro.not_subscribed");
|
||||||
},
|
},
|
||||||
|
|
||||||
@discourseComputed('subscription.active')
|
@discourseComputed("subscription.active")
|
||||||
stateClass(active) {
|
stateClass(active) {
|
||||||
return active ? 'active' : 'inactive';
|
return active ? "active" : "inactive";
|
||||||
},
|
},
|
||||||
|
|
||||||
@discourseComputed('stateClass')
|
@discourseComputed("stateClass")
|
||||||
stateLabel(stateClass) {
|
stateLabel(stateClass) {
|
||||||
return I18n.t(`admin.wizard.pro.subscription.status.${stateClass}`);
|
return I18n.t(`admin.wizard.pro.subscription.status.${stateClass}`);
|
||||||
},
|
},
|
||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
update() {
|
update() {
|
||||||
this.set('updating', true);
|
this.set("updating", true);
|
||||||
CustomWizardPro.update_subscription().then(result => {
|
CustomWizardPro.update_subscription()
|
||||||
if (result.success) {
|
.then((result) => {
|
||||||
this.setProperties({
|
if (result.success) {
|
||||||
updateIcon: 'check',
|
this.setProperties({
|
||||||
subscription: result.subscription
|
updateIcon: "check",
|
||||||
});
|
subscription: result.subscription,
|
||||||
} else {
|
});
|
||||||
this.set('updateIcon', 'times');
|
} else {
|
||||||
}
|
this.set("updateIcon", "times");
|
||||||
}).finally(() => {
|
}
|
||||||
this.set('updating', false);
|
})
|
||||||
setTimeout(() => {
|
.finally(() => {
|
||||||
this.set('updateIcon', null);
|
this.set("updating", false);
|
||||||
}, 7000);
|
setTimeout(() => {
|
||||||
})
|
this.set("updateIcon", null);
|
||||||
}
|
}, 7000);
|
||||||
}
|
});
|
||||||
});
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
|
@ -5,52 +5,58 @@ import { alias } from "@ember/object/computed";
|
||||||
|
|
||||||
export default Controller.extend({
|
export default Controller.extend({
|
||||||
messageUrl: "https://thepavilion.io/t/3652",
|
messageUrl: "https://thepavilion.io/t/3652",
|
||||||
messageType: 'info',
|
messageType: "info",
|
||||||
messageKey: null,
|
messageKey: null,
|
||||||
showSubscription: alias('model.authentication.active'),
|
showSubscription: alias("model.authentication.active"),
|
||||||
|
|
||||||
setup() {
|
setup() {
|
||||||
const authentication = this.get('model.authentication');
|
const authentication = this.get("model.authentication");
|
||||||
const subscription = this.get('model.subscription');
|
const subscription = this.get("model.subscription");
|
||||||
const subscribed = subscription && subscription.active;
|
const subscribed = subscription && subscription.active;
|
||||||
const authenticated = authentication && authentication.active;
|
const authenticated = authentication && authentication.active;
|
||||||
|
|
||||||
if (!subscribed) {
|
if (!subscribed) {
|
||||||
this.set('messageKey', authenticated ? 'not_subscribed' : 'authorize');
|
this.set("messageKey", authenticated ? "not_subscribed" : "authorize");
|
||||||
} else {
|
} else {
|
||||||
this.set('messageKey', !authenticated ?
|
this.set(
|
||||||
'subscription_expiring' :
|
"messageKey",
|
||||||
subscribed ? 'subscription_active' : 'subscription_inactive'
|
!authenticated
|
||||||
|
? "subscription_expiring"
|
||||||
|
: subscribed
|
||||||
|
? "subscription_active"
|
||||||
|
: "subscription_inactive"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@discourseComputed('model.server')
|
@discourseComputed("model.server")
|
||||||
messageOpts(server) {
|
messageOpts(server) {
|
||||||
return { server };
|
return { server };
|
||||||
},
|
},
|
||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
unauthorize() {
|
unauthorize() {
|
||||||
this.set('unauthorizing', true);
|
this.set("unauthorizing", true);
|
||||||
|
|
||||||
CustomWizardPro.unauthorize().then(result => {
|
CustomWizardPro.unauthorize()
|
||||||
if (result.success) {
|
.then((result) => {
|
||||||
this.setProperties({
|
if (result.success) {
|
||||||
messageKey: 'unauthorized',
|
this.setProperties({
|
||||||
messageType: 'warn',
|
messageKey: "unauthorized",
|
||||||
"model.authentication": null,
|
messageType: "warn",
|
||||||
"model.subscription": null
|
"model.authentication": null,
|
||||||
});
|
"model.subscription": null,
|
||||||
} else {
|
});
|
||||||
this.setProperties({
|
} else {
|
||||||
messageKey: 'unauthorize_failed',
|
this.setProperties({
|
||||||
messageType: 'error'
|
messageKey: "unauthorize_failed",
|
||||||
});
|
messageType: "error",
|
||||||
}
|
});
|
||||||
}).finally(() => {
|
}
|
||||||
this.set('unauthorizing', false);
|
})
|
||||||
})
|
.finally(() => {
|
||||||
}
|
this.set("unauthorizing", false);
|
||||||
}
|
});
|
||||||
|
},
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
|
@ -80,7 +80,7 @@ export default Controller.extend({
|
||||||
if (result.wizard_id) {
|
if (result.wizard_id) {
|
||||||
this.send("afterSave", result.wizard_id);
|
this.send("afterSave", result.wizard_id);
|
||||||
} else if (result.errors) {
|
} else if (result.errors) {
|
||||||
this.set('error', result.errors.join(', '));
|
this.set("error", result.errors.join(", "));
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch((result) => {
|
.catch((result) => {
|
||||||
|
|
|
@ -45,7 +45,7 @@ export default {
|
||||||
|
|
||||||
this.route("adminWizardsLogs", {
|
this.route("adminWizardsLogs", {
|
||||||
path: "/logs",
|
path: "/logs",
|
||||||
resetNamespace: true
|
resetNamespace: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
this.route("adminWizardsManager", {
|
this.route("adminWizardsManager", {
|
||||||
|
|
|
@ -196,11 +196,11 @@ const action = {
|
||||||
],
|
],
|
||||||
required: ["id", "type"],
|
required: ["id", "type"],
|
||||||
proTypes: [
|
proTypes: [
|
||||||
'send_message',
|
"send_message",
|
||||||
'add_to_group',
|
"add_to_group",
|
||||||
'create_category',
|
"create_category",
|
||||||
'create_group',
|
"create_group",
|
||||||
'send_to_api'
|
"send_to_api",
|
||||||
],
|
],
|
||||||
dependent: {},
|
dependent: {},
|
||||||
objectArrays: {},
|
objectArrays: {},
|
||||||
|
|
|
@ -23,12 +23,12 @@ CustomWizardPro.reopenClass({
|
||||||
type: "DELETE",
|
type: "DELETE",
|
||||||
}).catch(popupAjaxError);
|
}).catch(popupAjaxError);
|
||||||
},
|
},
|
||||||
|
|
||||||
update_subscription() {
|
update_subscription() {
|
||||||
return ajax(`${basePath}/subscription`, {
|
return ajax(`${basePath}/subscription`, {
|
||||||
type: "POST",
|
type: "POST",
|
||||||
}).catch(popupAjaxError);
|
}).catch(popupAjaxError);
|
||||||
}
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
export default CustomWizardPro;
|
export default CustomWizardPro;
|
||||||
|
|
|
@ -221,7 +221,7 @@ CustomWizard.reopenClass({
|
||||||
const wizard = this._super.apply(this);
|
const wizard = this._super.apply(this);
|
||||||
wizard.setProperties(buildProperties(wizardJson));
|
wizard.setProperties(buildProperties(wizardJson));
|
||||||
return wizard;
|
return wizard;
|
||||||
}
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
export default CustomWizard;
|
export default CustomWizard;
|
||||||
|
|
|
@ -13,7 +13,7 @@ export default DiscourseRoute.extend({
|
||||||
|
|
||||||
controller.setProperties({
|
controller.setProperties({
|
||||||
customFields,
|
customFields,
|
||||||
proSubscribed
|
proSubscribed,
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
|
@ -7,13 +7,13 @@ export default DiscourseRoute.extend({
|
||||||
},
|
},
|
||||||
|
|
||||||
setupController(controller, model) {
|
setupController(controller, model) {
|
||||||
controller.set('model', model);
|
controller.set("model", model);
|
||||||
controller.setup();
|
controller.setup();
|
||||||
},
|
},
|
||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
authorize() {
|
authorize() {
|
||||||
CustomWizardPro.authorize();
|
CustomWizardPro.authorize();
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
});
|
});
|
||||||
|
|
|
@ -39,7 +39,7 @@ export default DiscourseRoute.extend({
|
||||||
currentStep: wizard.steps[0],
|
currentStep: wizard.steps[0],
|
||||||
currentAction: wizard.actions[0],
|
currentAction: wizard.actions[0],
|
||||||
creating: model.create,
|
creating: model.create,
|
||||||
proSubscribed: parentModel.pro_subscribed
|
proSubscribed: parentModel.pro_subscribed,
|
||||||
};
|
};
|
||||||
|
|
||||||
controller.setProperties(props);
|
controller.setProperties(props);
|
||||||
|
|
|
@ -700,7 +700,7 @@
|
||||||
background-color: var(--primary-low);
|
background-color: var(--primary-low);
|
||||||
padding: 1em;
|
padding: 1em;
|
||||||
margin: 0 0 1em 0;
|
margin: 0 0 1em 0;
|
||||||
|
|
||||||
.setting-title {
|
.setting-title {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
@ -711,7 +711,7 @@
|
||||||
|
|
||||||
input[type="checkbox"] {
|
input[type="checkbox"] {
|
||||||
margin: 0 5px 0 0;
|
margin: 0 5px 0 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.setting-label {
|
.setting-label {
|
||||||
|
@ -729,7 +729,7 @@
|
||||||
|
|
||||||
> span {
|
> span {
|
||||||
margin-right: 1em;
|
margin-right: 1em;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -741,7 +741,7 @@
|
||||||
|
|
||||||
.validation-section {
|
.validation-section {
|
||||||
min-width: 250px;
|
min-width: 250px;
|
||||||
margin: .5em 0;
|
margin: 0.5em 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -761,18 +761,19 @@
|
||||||
|
|
||||||
.pro-label {
|
.pro-label {
|
||||||
color: var(--tertiary);
|
color: var(--tertiary);
|
||||||
font-size: .75em;
|
font-size: 0.75em;
|
||||||
}
|
}
|
||||||
|
|
||||||
.admin-wizards-pro {
|
.admin-wizards-pro {
|
||||||
.admin-wizard-controls {
|
.admin-wizard-controls {
|
||||||
h3, label {
|
h3,
|
||||||
|
label {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
label {
|
label {
|
||||||
padding: .4em .5em;
|
padding: 0.4em 0.5em;
|
||||||
margin-left: .75em;
|
margin-left: 0.75em;
|
||||||
background-color: var(--success);
|
background-color: var(--success);
|
||||||
color: var(--secondary);
|
color: var(--secondary);
|
||||||
}
|
}
|
||||||
|
@ -792,14 +793,14 @@
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
margin-bottom: .5em;
|
margin-bottom: 0.5em;
|
||||||
|
|
||||||
h3 {
|
h3 {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.buttons > span {
|
.buttons > span {
|
||||||
margin-right: .5em;
|
margin-right: 0.5em;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -810,8 +811,8 @@
|
||||||
background-color: var(--primary-very-low);
|
background-color: var(--primary-very-low);
|
||||||
|
|
||||||
.subscription-state {
|
.subscription-state {
|
||||||
padding: .25em .5em;
|
padding: 0.25em 0.5em;
|
||||||
margin-right: .75em;
|
margin-right: 0.75em;
|
||||||
|
|
||||||
&.active {
|
&.active {
|
||||||
background-color: var(--success);
|
background-color: var(--success);
|
||||||
|
@ -829,7 +830,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.pro-label {
|
.pro-label {
|
||||||
margin-left: .75em;
|
margin-left: 0.75em;
|
||||||
padding-top: .25em;
|
padding-top: 0.25em;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Laden …
In neuem Issue referenzieren