0
0
Fork 1
Spiegel von https://github.com/paviliondev/discourse-custom-wizard.git synchronisiert 2024-11-28 11:50:28 +01:00
Dieser Commit ist enthalten in:
merefield 2023-11-15 10:30:09 +00:00
Commit 2617a6214b
22 geänderte Dateien mit 278 neuen und 28 gelöschten Zeilen

Datei anzeigen

@ -1,3 +1,4 @@
3.2.0.beta2: 1ee2f7d8babafe32912372fbbfa50c89f5b09ba9
3.1.999: 1f35b80f85e5fd1efb7f4851f0845700432febdc
2.7.99: e07a57e398b6b1676ab42a7e34467556fca5416b
2.5.1: bb85b3a0d2c0ab6b59bcb405731c39089ec6731c

Datei anzeigen

@ -6,3 +6,6 @@ RSpec/ContextWording:
RSpec/DescribeClass:
Enabled: false
Discourse/TimeEqMatcher:
Enabled: false

Datei anzeigen

@ -4,7 +4,7 @@ The Custom Wizard Plugin lets you make forms for your Discourse forum. Better us
<img src="https://camo.githubusercontent.com/593432f1fc9658ffca104065668cc88fa21dffcd3002cb78ffd50c71f33a2523/68747470733a2f2f706176696c696f6e2d6173736574732e6e7963332e63646e2e6469676974616c6f6365616e7370616365732e636f6d2f706c7567696e732f77697a6172642d7265706f7369746f72792d62616e6e65722e706e67" alt="" data-canonical-src="https://pavilion-assets.nyc3.cdn.digitaloceanspaces.com/plugins/wizard-repository-banner.png" style="max-width: 100%;" width="400">
👋 Looking to report an issue? We're managing issues for this plugin using our [bug report wizard](https://coop.pavilion.tech/w/bug-report).
👋 Looking to report an issue? We're managing issues for this plugin using our [bug report wizard](https://pavilion.tech/products/discourse-custom-wizard-plugin/support/bug-report).
## Install
@ -12,16 +12,20 @@ If you're not sure how to install a plugin in Discourse, please follow the [plug
## Documentation
[Read the full documentation here](https://coop.pavilion.tech/c/82), or go directly to the relevant section
[Read the full documentation here](https://pavilion.tech/products/discourse-custom-wizard-plugin/documentation/), or go directly to the relevant section
- [Wizard Administration](https://coop.pavilion.tech/t/1602)
- [Wizard Settings](https://coop.pavilion.tech/t/1614)
- [Step Settings](https://coop.pavilion.tech/t/1735)
- [Field Settings](https://coop.pavilion.tech/t/1580)
- [Conditional Settings](https://coop.pavilion.tech/t/1673)
- [Field Interpolation](https://coop.pavilion.tech/t/1557)
- [Step Settings](https://pavilion.tech/products/discourse-custom-wizard-plugin/documentation/step-settings)
- [Field Settings](https://pavilion.tech/products/discourse-custom-wizard-plugin/documentation/field-settings)
- [Conditional Settings](https://pavilion.tech/products/discourse-custom-wizard-plugin/documentation/conditional-settings)
- [Field Interpolation](https://pavilion.tech/products/discourse-custom-wizard-plugin/documentation/field-interpolation)
- [Handling Dates and Times](https://coop.pavilion.tech/t/1708)
## Support
- [Report an issue](https://coop.pavilion.tech/w/bug-report)
- [Report an issue](https://pavilion.tech/products/discourse-custom-wizard-plugin/support/bug-report)
## Statistics
For improved service and development, this plugin collects some generalised quantitative data related to version and usage. No personal or sensitive information is gathered. Please email contact@pavilion.tech if you have any questions or concerns about our data collection.

Datei anzeigen

@ -1,7 +1,7 @@
import Component from "@ember/component";
import { dasherize } from "@ember/string";
import discourseComputed from "discourse-common/utils/decorators";
import { cookAsync } from "discourse/lib/text";
import { cook } from "discourse/lib/text";
export default Component.extend({
classNameBindings: [
@ -14,7 +14,7 @@ export default Component.extend({
didReceiveAttrs() {
this._super(...arguments);
cookAsync(this.field.translatedDescription).then((cookedDescription) => {
cook(this.field.translatedDescription).then((cookedDescription) => {
this.set("cookedDescription", cookedDescription);
});
},

Datei anzeigen

@ -4,7 +4,7 @@ import I18n from "I18n";
import getUrl from "discourse-common/lib/get-url";
import { htmlSafe } from "@ember/template";
import { schedule } from "@ember/runloop";
import { cookAsync } from "discourse/lib/text";
import { cook } from "discourse/lib/text";
import CustomWizard, {
updateCachedWizard,
} from "discourse/plugins/discourse-custom-wizard/discourse/models/custom-wizard";
@ -25,10 +25,10 @@ export default Component.extend({
didReceiveAttrs() {
this._super(...arguments);
cookAsync(this.step.translatedTitle).then((cookedTitle) => {
cook(this.step.translatedTitle).then((cookedTitle) => {
this.set("cookedTitle", cookedTitle);
});
cookAsync(this.step.translatedDescription).then((cookedDescription) => {
cook(this.step.translatedDescription).then((cookedDescription) => {
this.set("cookedDescription", cookedDescription);
});
},

Datei anzeigen

@ -41,7 +41,8 @@ export default Component.extend(UndoChanges, {
};
}),
messageUrl: "https://discourse.pluginmanager.org/t/action-settings",
messageUrl:
"https://pavilion.tech/products/discourse-custom-wizard-plugin/documentation/action-settings",
@discourseComputed("action.type")
messageKey(type) {

Datei anzeigen

@ -27,7 +27,8 @@ export default Component.extend(UndoChanges, {
isTextType: or("isText", "isTextarea", "isComposer"),
isComposerPreview: equal("field.type", "composer_preview"),
categoryPropertyTypes: selectKitContent(["id", "slug"]),
messageUrl: "https://discourse.pluginmanager.org/t/field-settings",
messageUrl:
"https://pavilion.tech/products/discourse-custom-wizard-plugin/documentation/field-settings",
@discourseComputed("field.type")
validations(type) {

Datei anzeigen

@ -4,7 +4,7 @@ import {
default as discourseComputed,
observes,
} from "discourse-common/utils/decorators";
import { getOwner } from "discourse-common/lib/get-owner";
import { getOwner } from "@ember/application";
import { defaultSelectionType, selectionTypes } from "../lib/wizard-mapper";
import {
generateName,

Datei anzeigen

@ -4,7 +4,8 @@ import CustomWizardCustomField from "../models/custom-wizard-custom-field";
export default Controller.extend({
messageKey: "create",
fieldKeys: ["klass", "type", "name", "serializers"],
documentationUrl: "https://discourse.pluginmanager.org/t/custom-fields",
documentationUrl:
"https://pavilion.tech/products/discourse-custom-wizard-plugin/documentation/custom-fields",
actions: {
addField() {

Datei anzeigen

@ -2,7 +2,8 @@ import Controller from "@ember/controller";
import { default as discourseComputed } from "discourse-common/utils/decorators";
export default Controller.extend({
documentationUrl: "https://thepavilion.io/t/2818",
documentationUrl:
"https://pavilion.tech/products/discourse-custom-wizard-plugin/documentation/",
@discourseComputed("wizardId")
wizardName(wizardId) {

Datei anzeigen

@ -7,7 +7,8 @@ import I18n from "I18n";
import { underscore } from "@ember/string";
export default Controller.extend({
messageUrl: "https://discourse.pluginmanager.org/t/wizard-manager",
messageUrl:
"https://pavilion.tech/products/discourse-custom-wizard-plugin/documentation/wizard-manager",
messageKey: "info",
messageIcon: "info-circle",
messageClass: "info",

Datei anzeigen

@ -2,7 +2,8 @@ import Controller from "@ember/controller";
import { default as discourseComputed } from "discourse-common/utils/decorators";
export default Controller.extend({
documentationUrl: "https://thepavilion.io/t/2818",
documentationUrl:
"https://pavilion.tech/products/discourse-custom-wizard-plugin/documentation/",
@discourseComputed("wizardId")
wizardName(wizardId) {

Datei anzeigen

@ -22,5 +22,5 @@ export default Controller.extend({
},
messageUrl:
"https://discourse.pluginmanager.org/c/discourse-custom-wizard/documentation",
"https://pavilion.tech/products/discourse-custom-wizard-plugin/documentation/",
});

Datei anzeigen

@ -85,6 +85,8 @@ export default {
});
api.modifyClass("component:category-chooser", {
pluginId: "custom-wizard",
categoriesByScope(options = {}) {
let categories = this._super(options);
const currentUser = this.currentUser;

Datei anzeigen

@ -1,5 +1,5 @@
import { get, set } from "@ember/object";
import { getOwner } from "discourse-common/lib/get-owner";
import { getOwnerWithFallback } from "discourse-common/lib/get-owner";
const wizard = {
basic: {
@ -279,7 +279,7 @@ export function filterValues(currentWizard, feature, attribute, values = null) {
return values;
}
const siteSettings = getOwner(this).lookup("service:site-settings");
const siteSettings = getOwnerWithFallback(this).lookup("service:site-settings");
if (siteSettings.wizard_apis_enabled) {
wizardSchema.action.types.send_to_api = {
api: null,

Datei anzeigen

@ -0,0 +1,53 @@
import Mixin from "@ember/object/mixin";
import { getOwner } from "@ember/application";
import { readOnly } from "@ember/object/computed";
import discourseComputed from "discourse-common/utils/decorators";
const PRODUCT_PAGE = "https://custom-wizard.pavilion.tech";
const SUPPORT_MESSAGE =
"https://coop.pavilion.tech/new-message?username=support&title=Custom%20Wizard%20Support";
const MANAGER_CATEGORY =
"https://pavilion.tech/products/discourse-custom-wizard-plugin/support";
export default Mixin.create({
subscriptionLandingUrl: PRODUCT_PAGE,
subscriptionClientUrl: "/admin/plugins/subscription-client",
@discourseComputed
adminWizards() {
return getOwner(this).lookup("controller:admin-wizards");
},
subscribed: readOnly("adminWizards.subscribed"),
subscriptionType: readOnly("adminWizards.subscriptionType"),
businessSubscription: readOnly("adminWizards.businessSubscription"),
communitySubscription: readOnly("adminWizards.communitySubscription"),
standardSubscription: readOnly("adminWizards.standardSubscription"),
subscriptionAttributes: readOnly("adminWizards.subscriptionAttributes"),
subscriptionClientInstalled: readOnly(
"adminWizards.subscriptionClientInstalled"
),
@discourseComputed("subscriptionClientInstalled")
subscriptionLink(subscriptionClientInstalled) {
return subscriptionClientInstalled
? this.subscriptionClientUrl
: this.subscriptionLandingUrl;
},
@discourseComputed("subscriptionType")
subscriptionCtaLink(subscriptionType) {
switch (subscriptionType) {
case "none":
return PRODUCT_PAGE;
case "standard":
return SUPPORT_MESSAGE;
case "business":
return SUPPORT_MESSAGE;
case "community":
return MANAGER_CATEGORY;
default:
return PRODUCT_PAGE;
}
},
});

Datei anzeigen

@ -7,7 +7,7 @@
<li>
<span class="setting-title">
<h4>{{i18n (concat "admin.wizard.field.validations." type)}}</h4>
<Input @type="checkbox" @checked={{this.props.status}} />
<Input @type="checkbox" @checked={{props.status}} />
{{i18n "admin.wizard.field.validations.enabled"}}
</span>
<div class="validation-container">
@ -36,7 +36,7 @@
<div class="setting-value">
<Input
@type="number"
@value={{this.props.time_n_value}}
@value={{props.time_n_value}}
class="time-n-value"
/>
{{combo-box

Datei anzeigen

@ -171,7 +171,7 @@ en:
not_subscribed: "You've authorized, but are not currently subscribed to a Custom Wizard plan on %{server}."
subscription_expiring: "Your subscription is active, but will expire in the next 48 hours."
subscription_active: "Your subscription is active."
subscription_inactive: "Your subscription is inactive on this forum. Read more in <a href='https://thepavilion.io/t/3652'>the documentation</a>."
subscription_inactive: "Your subscription is inactive on this forum. Read more in <a href='https://pavilion.tech/products/discourse-custom-wizard-plugin/documentation/'>the documentation</a>."
unauthorized: "You're unauthorized. If you have a subscription, it will become inactive in the next 48 hours."
unauthorize_failed: Failed to unauthorize.
submissions:

Datei anzeigen

@ -128,7 +128,7 @@ class ::CustomWizard::UpdateValidator
return @ctx if @ctx
@ctx = PrettyText.v8
PrettyText.ctx_load(@ctx, "#{Rails.root}/vendor/assets/javascripts/moment.js")
@ctx.load("#{Rails.root}/vendor/assets/javascripts/moment.js")
@ctx
end
end

Datei anzeigen

@ -0,0 +1,98 @@
# frozen_string_literal: true
module DiscoursePluginStatistics
class Plugin
def self.discourse_custom_wizard
subscription_features = {
wizard: {
save_submissions: 0,
after_signup: 0,
prompt_completion: 0,
required: 0,
permitted: 0,
},
step: {
required_data: 0,
permitted_params: 0,
force_final: 0
},
field: {
condition: 0,
type: {
text: 0,
textarea: 0,
text_only: 0,
date: 0,
time: 0,
date_time: 0,
number: 0,
checkbox: 0,
dropdown: 0,
composer: 0,
composer_preview: 0,
url: 0,
upload: 0,
tag: 0,
category: 0,
group: 0,
user_selector: 0,
},
realtime_validations: 0
},
action: {
type: {
create_topic: 0,
send_message: 0,
update_profile: 0,
open_composer: 0,
route_to: 0,
send_to_api: 0,
watch_categories: 0,
watch_tags: 0,
add_to_group: 0,
create_group: 0,
create_category: 0,
}
}
}
increment_feature_count = lambda do |type, key, value|
if key == 'type'
if !subscription_features[type.to_sym][:type][value.to_sym].nil?
subscription_features[type.to_sym][:type][value.to_sym] += 1
end
else
if !subscription_features[type.to_sym][key.to_sym].nil?
subscription_features[type.to_sym][key.to_sym] += 1
end
end
end
CustomWizard::Template.list.each do |template|
template.each do |key, value|
increment_feature_count.call(:wizard, key, value)
end
template['steps'].each do |step|
step.each do |key, value|
increment_feature_count.call(:step, key, value)
end
step['fields'].each do |field|
field.each do |key, value|
increment_feature_count.call(:field, key, value)
end
end
end
template['actions'].each do |action|
action.each do |key, value|
increment_feature_count.call(:action, key, value)
end
end
end
{
total_wizards: CustomWizard::Template.list.size,
subscription_type: CustomWizard::Subscription.type.to_s,
subscription_features: subscription_features
}
end
end
end

Datei anzeigen

@ -1,7 +1,7 @@
# frozen_string_literal: true
# name: discourse-custom-wizard
# about: Forms for Discourse. Better onboarding, structured posting, data enrichment, automated actions and much more.
# version: 2.4.27
# version: 2.5.1
# authors: Angus McLeod, Faizaan Gagan, Robert Barrow, Keegan George, Kaitlin Maddever, Juan Marcos Gutierrez Ramos
# url: https://github.com/paviliondev/discourse-custom-wizard
# contact_emails: development@pavilion.tech
@ -9,7 +9,7 @@
gem 'liquid', '5.0.1', require: true
gem "discourse_subscription_client", "0.1.0.pre15", require_name: "discourse_subscription_client"
gem 'discourse_plugin_statistics', '0.1.0.pre7', require: true
register_asset 'stylesheets/common/admin.scss'
register_asset 'stylesheets/common/wizard.scss'
@ -76,6 +76,7 @@ after_initialize do
../lib/custom_wizard/api/log_entry.rb
../lib/custom_wizard/liquid_extensions/first_non_empty.rb
../lib/custom_wizard/exceptions/exceptions.rb
../lib/discourse_plugin_statistics/plugin.rb
../app/serializers/custom_wizard/api/authorization_serializer.rb
../app/serializers/custom_wizard/api/basic_endpoint_serializer.rb
../app/serializers/custom_wizard/api/endpoint_serializer.rb

Datei anzeigen

@ -0,0 +1,82 @@
# frozen_string_literal: true
describe DiscoursePluginStatistics::Plugin do
let(:template_json) { get_wizard_fixture("wizard") }
describe "#discourse_custom_wizard" do
before do
enable_subscription('standard')
CustomWizard::Template.save(template_json, skip_jobs: true)
template_json_2 = template_json.dup
template_json_2["id"] = 'super_mega_fun_wizard_2'
CustomWizard::Template.save(template_json_2, skip_jobs: true)
@data = DiscoursePluginStatistics::Plugin.discourse_custom_wizard
end
it "includes a total wizard count" do
expect(@data[:total_wizards]).to eq(2)
end
it "includes the subscription type" do
expect(@data[:subscription_type]).to eq('standard')
end
it "includes a count of features being used across all wizards" do
expect(@data[:subscription_features]).to eq(
wizard: {
save_submissions: 2,
after_signup: 2,
prompt_completion: 2,
required: 0,
permitted: 0,
},
step: {
required_data: 0,
permitted_params: 0,
force_final: 0
},
field: {
condition: 0,
type: {
text: 2,
textarea: 2,
text_only: 2,
date: 2,
time: 2,
date_time: 2,
number: 2,
checkbox: 2,
dropdown: 2,
composer: 0,
composer_preview: 0,
url: 0,
upload: 0,
tag: 0,
category: 0,
group: 0,
user_selector: 0,
},
realtime_validations: 0
},
action: {
type: {
create_topic: 2,
send_message: 0,
update_profile: 2,
open_composer: 2,
route_to: 2,
send_to_api: 0,
watch_categories: 0,
watch_tags: 0,
add_to_group: 0,
create_group: 0,
create_category: 0,
}
}
)
end
end
end