1
0
Fork 0
Dieser Commit ist enthalten in:
merefield 2021-10-27 15:01:29 +01:00
Ursprung 60388b7dab
Commit 203876e927
3 geänderte Dateien mit 12 neuen und 14 gelöschten Zeilen

Datei anzeigen

@ -1,7 +1,6 @@
import Component from "@ember/component"; import Component from "@ember/component";
import discourseComputed, { observes } from "discourse-common/utils/decorators"; import discourseComputed, { observes } from "discourse-common/utils/decorators";
import { alias, equal, or } from "@ember/object/computed"; import { alias, equal, or } from "@ember/object/computed";
import { computed } from "@ember/object";
import I18n from "I18n"; import I18n from "I18n";
import wizardSchema, { import wizardSchema, {
@ -48,7 +47,7 @@ export default Component.extend({
id: type, id: type,
name: I18n.t(`admin.wizard.custom_field.type.${type}`), name: I18n.t(`admin.wizard.custom_field.type.${type}`),
subscription: subscriptionLevel(type, "custom_fields", "types"), subscription: subscriptionLevel(type, "custom_fields", "types"),
disabled: disabled, disabled,
}); });
return result; return result;
}, []); }, []);
@ -65,7 +64,7 @@ export default Component.extend({
id: klass, id: klass,
name: I18n.t(`admin.wizard.custom_field.klass.${klass}`), name: I18n.t(`admin.wizard.custom_field.klass.${klass}`),
subscription: subscriptionLevel(klass, "custom_fields", "klasses"), subscription: subscriptionLevel(klass, "custom_fields", "klasses"),
disabled: disabled, disabled,
}); });
return result; return result;
}, []); }, []);

Datei anzeigen

@ -106,7 +106,7 @@ export default Component.extend(UndoChanges, {
id: type, id: type,
name: I18n.t(`admin.wizard.action.${type}.label`), name: I18n.t(`admin.wizard.action.${type}.label`),
subscription: subscriptionLevel(type, "actions", ""), subscription: subscriptionLevel(type, "actions", ""),
disabled: disabled, disabled,
}); });
return result; return result;
}, []); }, []);

Datei anzeigen

@ -200,7 +200,7 @@ const action = {
const custom_field = { const custom_field = {
klasses: ["topic", "post", "group", "category"], klasses: ["topic", "post", "group", "category"],
types: ["string", "boolean", "integer", "json"], types: ["string", "boolean", "integer", "json"],
} };
const subscription_levels = { const subscription_levels = {
standard: { standard: {
@ -218,7 +218,7 @@ const subscription_levels = {
types: [] types: []
} }
} }
} };
const wizardSchema = { const wizardSchema = {
wizard, wizard,
@ -227,7 +227,7 @@ const wizardSchema = {
custom_field, custom_field,
action, action,
subscription_levels subscription_levels
} };
export function requiringAdditionalSubscription( export function requiringAdditionalSubscription(
currentSubscription, category, subCategory currentSubscription, category, subCategory
@ -258,8 +258,7 @@ export function requiringAdditionalSubscription(
default: default:
return []; return [];
} }
} };
export function subscriptionLevel(type, category, subCategory) { export function subscriptionLevel(type, category, subCategory) {
switch (category) { switch (category) {
@ -286,15 +285,15 @@ export function subscriptionLevel(type, category, subCategory) {
default: default:
return ""; return "";
} }
} };
export function buildFieldTypes(types) { export function buildFieldTypes(types) {
wizardSchema.field.types = types; wizardSchema.field.types = types;
} };
export function buildFieldValidations(validations) { export function buildFieldValidations(validations) {
wizardSchema.field.validations = validations; wizardSchema.field.validations = validations;
} };
const siteSettings = getOwner(this).lookup("site-settings:main"); const siteSettings = getOwner(this).lookup("site-settings:main");
if (siteSettings.wizard_apis_enabled) { if (siteSettings.wizard_apis_enabled) {
@ -303,7 +302,7 @@ if (siteSettings.wizard_apis_enabled) {
api_endpoint: null, api_endpoint: null,
api_body: null, api_body: null,
}; };
} };
export function setWizardDefaults(obj, itemType) { export function setWizardDefaults(obj, itemType) {
const objSchema = wizardSchema[itemType]; const objSchema = wizardSchema[itemType];
@ -329,6 +328,6 @@ export function setWizardDefaults(obj, itemType) {
} }
return obj; return obj;
} };
export default wizardSchema; export default wizardSchema;