0
0
Fork 1
Spiegel von https://github.com/paviliondev/discourse-custom-wizard.git synchronisiert 2024-11-09 20:02:54 +01:00
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 discourseComputed, { observes } from "discourse-common/utils/decorators";
import { alias, equal, or } from "@ember/object/computed";
import { computed } from "@ember/object";
import I18n from "I18n";
import wizardSchema, {
@ -48,7 +47,7 @@ export default Component.extend({
id: type,
name: I18n.t(`admin.wizard.custom_field.type.${type}`),
subscription: subscriptionLevel(type, "custom_fields", "types"),
disabled: disabled,
disabled,
});
return result;
}, []);
@ -65,7 +64,7 @@ export default Component.extend({
id: klass,
name: I18n.t(`admin.wizard.custom_field.klass.${klass}`),
subscription: subscriptionLevel(klass, "custom_fields", "klasses"),
disabled: disabled,
disabled,
});
return result;
}, []);

Datei anzeigen

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

Datei anzeigen

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