1
0
Fork 0

Commits vergleichen

...

24 Commits

Autor SHA1 Nachricht Datum
jumagura
71d39b9f7a bump version 2023-08-14 17:44:59 -04:00
jumagura
cc12afb139 COMPATIBILITY: Update insert-hyperlink invocation following core change 2023-08-14 17:43:31 -04:00
jumagura
242ec70a41 Merge branch 'main' into merge-main-into-stable 2023-08-10 15:51:27 -04:00
Angus McLeod
6141456f2f FIX: ensure element is present before passing on insertText event 2023-05-23 10:18:29 +02:00
Angus McLeod
2221f58231 Bump version 2023-05-23 10:17:30 +02:00
Angus McLeod
5072d9389a
Merge pull request #218 from paviliondev/stable_candidate
Stable candidate
2023-01-31 08:51:54 +01:00
merefield
22edf53cde MERGE: main into stable for 3.0.x 2023-01-30 15:05:07 +00:00
Angus McLeod
f5fdb98290 Merge branch 'main' into stable 2022-03-03 21:19:46 +01:00
Angus McLeod
d3c8588b62 Merge branch 'main' into stable 2022-02-28 20:32:52 +01:00
Faizaan Gagan
c6ec744b13 bump version, cleanup 2022-02-09 12:03:17 +05:30
Angus McLeod
ec78229ba0 FIX: use request_store properly 2022-02-09 11:59:00 +05:30
Angus McLeod
5360cef214 Update plugin.rb 2022-02-09 11:58:23 +05:30
Faizaan Gagan
86ff55c33a FEATURE: allow tags from tag field to be confined to a tag group (#175)
* FEATURE: allow tag field to be confined to a tag group

* fixed linting

* bump minor version

* moved monkeypatch to a separate module

* use snake case for variable names

* added specs
2022-02-07 16:00:25 +05:30
angusmcleod
52fe6e2baa Merge branch 'main' into stable 2022-01-31 21:50:12 +08:00
Angus McLeod
ecd1fdc5c7 FEATURE: Wizard Composer Mentionables Integration 2021-10-14 18:27:38 +05:30
Faizaan Gagan
d696ccd982 Bump version according to policy 2021-10-06 15:36:15 +05:30
angusmcleod
8770266d3e DEV: add stable to github workflows
(cherry picked from commit d4c25d406b)
2021-10-06 17:49:53 +08:00
angusmcleod
f537d8504b COMPATIBILITY: require all mixins for forwards compatibility 2021-10-05 11:55:20 +08:00
angusmcleod
72778884fa DEV: Update stable coverage percent 2021-10-05 10:51:10 +08:00
angusmcleod
f13b017b83 COMPATIBILITY: backwards compatibility for wizard spec 2021-10-05 10:38:41 +08:00
angusmcleod
76c2fd511c DEV: remove group log settings change from create_group action
(cherry picked from commit 1edfcca78b)
2021-10-05 10:25:23 +08:00
angusmcleod
95b0758647 COMPATIBILITY: Add backwards compatibility for category serialization 2021-10-05 10:07:21 +08:00
Faizaan Gagan
21cf81b7a5 FEATURE: add resume wizard popup (#146)
* FEATURE: add resume wizard popup

* code cleanup, copy edits

* FIX: address functionality, setting and copy issues

@fzngagan a few issues fixed

1. The resume button wasn't working (old reference to ``resumeDialog`` remained in callback.
2. This needs a wizard setting
3. It's not necessary to serialize the first step separately. We have all the steps in ``steps`` and steps have indexes.
4. Button copy

* Fix linting

* Ensure aa submission exists

* Apply prettier

Co-authored-by: angusmcleod <angus@mcleod.org.au>
(cherry picked from commit 2678ee153d)
2021-10-05 09:18:18 +08:00
angusmcleod
de2faf893f FIX: Minor bugfixes in manager and create_group action
(cherry picked from commit 208cb1229a)
2021-10-05 09:17:13 +08:00
3 geänderte Dateien mit 173 neuen und 6 gelöschten Zeilen

Datei anzeigen

@ -12,12 +12,15 @@ import { alias } from "@ember/object/computed";
import Site from "discourse/models/site"; import Site from "discourse/models/site";
import { uploadIcon } from "discourse/lib/uploads"; import { uploadIcon } from "discourse/lib/uploads";
import { dasherize } from "@ember/string"; import { dasherize } from "@ember/string";
import showModal from "discourse/lib/show-modal"; import InsertHyperlink from "discourse/components/modal/insert-hyperlink";
import { inject as service } from "@ember/service";
const IMAGE_MARKDOWN_REGEX = const IMAGE_MARKDOWN_REGEX =
/!\[(.*?)\|(\d{1,4}x\d{1,4})(,\s*\d{1,3}%)?(.*?)\]\((upload:\/\/.*?)\)(?!(.*`))/g; /!\[(.*?)\|(\d{1,4}x\d{1,4})(,\s*\d{1,3}%)?(.*?)\]\((upload:\/\/.*?)\)(?!(.*`))/g;
export default ComposerEditor.extend({ export default ComposerEditor.extend({
modal: service(),
classNameBindings: ["fieldClass"], classNameBindings: ["fieldClass"],
allowUpload: true, allowUpload: true,
showLink: false, showLink: false,
@ -197,10 +200,8 @@ export default ComposerEditor.extend({
if (this._lastSel) { if (this._lastSel) {
linkText = this._lastSel.value; linkText = this._lastSel.value;
} }
this.modal.show(InsertHyperlink, {
showModal("insert-hyperlink").setProperties({ model: { linkText, toolbarEvent },
linkText,
toolbarEvent,
}); });
}, },

Datei anzeigen

@ -0,0 +1,166 @@
import { default as computed } from "discourse-common/utils/decorators";
import getUrl from "discourse-common/lib/get-url";
import WizardField from "wizard/models/wizard-field";
import { ajax } from "wizard/lib/ajax";
import { popupAjaxError } from "discourse/lib/ajax-error";
import Step from "wizard/models/step";
import EmberObject from "@ember/object";
import Site from "./site";
const CustomWizard = EmberObject.extend({
@computed("steps.length")
totalSteps: (length) => length,
skip() {
if (this.required && !this.completed && this.permitted) {
return;
}
CustomWizard.skip(this.id);
},
restart() {
CustomWizard.restart(this.id);
},
});
CustomWizard.reopenClass({
skip(wizardId) {
ajax({ url: `/w/${wizardId}/skip`, type: "PUT" })
.then((result) => {
CustomWizard.finished(result);
})
.catch(popupAjaxError);
},
restart(wizardId) {
ajax({ url: `/w/${wizardId}/skip`, type: "PUT" })
.then(() => {
window.location.href = `/w/${wizardId}`;
})
.catch(popupAjaxError);
},
restart(wizardId) {
ajax({ url: `/w/${wizardId}/skip`, type: "PUT" }).then(() => {
window.location.href = `/w/${wizardId}`;
});
},
finished(result) {
let url = "/";
if (result.redirect_on_complete) {
url = result.redirect_on_complete;
}
window.location.href = getUrl(url);
},
build(wizardJson) {
if (!wizardJson) {
return null;
}
if (!wizardJson.completed && wizardJson.steps) {
wizardJson.steps = wizardJson.steps
.map((step) => {
const stepObj = Step.create(step);
stepObj.fields.sort((a, b) => {
return parseFloat(a.number) - parseFloat(b.number);
});
let tabindex = 1;
stepObj.fields.forEach((f) => {
f.tabindex = tabindex;
if (["date_time"].includes(f.type)) {
tabindex = tabindex + 2;
} else {
tabindex++;
}
});
stepObj.fields = stepObj.fields.map((f) => WizardField.create(f));
return stepObj;
})
.sort((a, b) => {
return parseFloat(a.index) - parseFloat(b.index);
});
}
if (wizardJson.categories) {
let subcatMap = {};
let categoriesById = {};
let categories = wizardJson.categories.map((c) => {
if (c.parent_category_id) {
subcatMap[c.parent_category_id] =
subcatMap[c.parent_category_id] || [];
subcatMap[c.parent_category_id].push(c.id);
}
return (categoriesById[c.id] = EmberObject.create(c));
});
// Associate the categories with their parents
categories.forEach((c) => {
let subcategoryIds = subcatMap[c.get("id")];
if (subcategoryIds) {
c.set(
"subcategories",
subcategoryIds.map((id) => categoriesById[id])
);
}
if (c.get("parent_category_id")) {
c.set("parentCategory", categoriesById[c.get("parent_category_id")]);
}
});
Site.currentProp("categoriesList", categories);
Site.currentProp("sortedCategories", categories);
Site.currentProp("listByActivity", categories);
Site.currentProp("categoriesById", categoriesById);
Site.currentProp(
"uncategorized_category_id",
wizardJson.uncategorized_category_id
);
}
return CustomWizard.create(wizardJson);
},
});
export function findCustomWizard(wizardId, params = {}) {
let url = `/w/${wizardId}`;
let paramKeys = Object.keys(params).filter((k) => {
if (k === "wizard_id") {
return false;
}
return !!params[k];
});
if (paramKeys.length) {
url += "?";
paramKeys.forEach((k, i) => {
if (i > 0) {
url += "&";
}
url += `${k}=${params[k]}`;
});
}
return ajax({ url, cache: false, dataType: "json" }).then((result) => {
return CustomWizard.build(result);
});
}
let _wizard_store;
export function updateCachedWizard(wizard) {
_wizard_store = wizard;
}
export function getCachedWizard() {
return _wizard_store;
}
export default CustomWizard;

Datei anzeigen

@ -1,7 +1,7 @@
# frozen_string_literal: true # frozen_string_literal: true
# name: discourse-custom-wizard # name: discourse-custom-wizard
# about: Forms for Discourse. Better onboarding, structured posting, data enrichment, automated actions and much more. # about: Forms for Discourse. Better onboarding, structured posting, data enrichment, automated actions and much more.
# version: 2.4.16 # version: 2.4.17
# authors: Angus McLeod, Faizaan Gagan, Robert Barrow, Keegan George, Kaitlin Maddever, Juan Marcos Gutierrez Ramos # authors: Angus McLeod, Faizaan Gagan, Robert Barrow, Keegan George, Kaitlin Maddever, Juan Marcos Gutierrez Ramos
# url: https://github.com/paviliondev/discourse-custom-wizard # url: https://github.com/paviliondev/discourse-custom-wizard
# contact_emails: development@pavilion.tech # contact_emails: development@pavilion.tech