mirror of https://github.com/zulip/zulip.git
js: Convert static/js/zform.js to ES6 module.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
parent
4513ef8861
commit
f66441adb2
|
@ -306,7 +306,6 @@
|
|||
"vdom": false,
|
||||
"widgetize": false,
|
||||
"zcommand": false,
|
||||
"zform": false,
|
||||
"zxcvbn": false
|
||||
}
|
||||
},
|
||||
|
|
|
@ -8,7 +8,6 @@ const {make_zjquery} = require("../zjsunit/zjquery");
|
|||
|
||||
set_global("$", make_zjquery());
|
||||
const poll_widget = set_global("poll_widget", {});
|
||||
set_global("zform", {});
|
||||
set_global("document", "document-stub");
|
||||
|
||||
const return_true = () => true;
|
||||
|
|
|
@ -43,7 +43,6 @@ import "../top_left_corner";
|
|||
import "../stream_list";
|
||||
import "../filter";
|
||||
import "../poll_widget";
|
||||
import "../zform";
|
||||
import "../widgetize";
|
||||
import "../submessage";
|
||||
import "../fetch_status";
|
||||
|
|
|
@ -169,4 +169,3 @@ declare let user_status: any;
|
|||
declare let user_status_ui: any;
|
||||
declare let widgetize: any;
|
||||
declare let zcommand: any;
|
||||
declare let zform: any;
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
"use strict";
|
||||
|
||||
const todo_widget = require("./todo_widget");
|
||||
const zform = require("./zform");
|
||||
|
||||
const widgets = new Map([
|
||||
["poll", poll_widget],
|
||||
|
|
|
@ -1,10 +1,8 @@
|
|||
"use strict";
|
||||
import render_widgets_zform_choices from "../templates/widgets/zform_choices.hbs";
|
||||
|
||||
const render_widgets_zform_choices = require("../templates/widgets/zform_choices.hbs");
|
||||
import * as schema from "./schema";
|
||||
|
||||
const schema = require("./schema");
|
||||
|
||||
exports.validate_extra_data = function (data) {
|
||||
export function validate_extra_data(data) {
|
||||
function check(data) {
|
||||
function check_choice_data(data) {
|
||||
function check_choice_item(field_name, val) {
|
||||
|
@ -40,15 +38,15 @@ exports.validate_extra_data = function (data) {
|
|||
}
|
||||
|
||||
return true;
|
||||
};
|
||||
}
|
||||
|
||||
exports.activate = function (opts) {
|
||||
export function activate(opts) {
|
||||
const self = {};
|
||||
|
||||
const outer_elem = opts.elem;
|
||||
const data = opts.extra_data;
|
||||
|
||||
if (!exports.validate_extra_data(data)) {
|
||||
if (!validate_extra_data(data)) {
|
||||
// callee will log reason we fail
|
||||
return undefined;
|
||||
}
|
||||
|
@ -102,6 +100,4 @@ exports.activate = function (opts) {
|
|||
render();
|
||||
|
||||
return self;
|
||||
};
|
||||
|
||||
window.zform = exports;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue