CodeForPhilly / CodeForPhilly/stately

Feature: Form designer

未关闭
#28 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
enhancement
主要语言
Python
星标
22
派生
5
PR 合并指标
30 天内没有已合并 PR

描述

Using this issue to jot down ideas about the form designer. We could try to reuse dobt's form designer ... but if we _didn't_....

We could use [dragula](https://bevacqua.github.io/dragula/) and HTML5's [contenteditable](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/contenteditable), and simply serialize the DOM.

So there'd be a form area, and a way to add fields to it. Adding an `` would actually add a `

`. The `
` would have dragula enabled on it. Dragging it around simply rearranges it in the DOM. The `` and description `

` would have `contenteditable="true"`, letting the user directly edit their contents (which also just updates the DOM).

"Saving" the form would be a matter of exporting `formArea.innerHTML`. Sure, we could serialize it into JSON if we want to, but there may be an advantage to simply storing the HTML. For instance, you could very easily customize it to infinity. We'd just need a way to associate the fields with the data, but that shouldn't be too hard; just require that each field has a `` and use an underscorified_version_of_the_label as the field name.

Sounds like fun!

贡献指南

这个仓库没有索引到贡献指南

调研方向

未指定任何文件、测试或入口点。首先将提议的表单区域、dragula 行为、contenteditable 标签和描述,以及 formArea.innerHTML 导出转化为明确的范围;完成内容应包括一份达成共识的设计和已定义的持久化格式。

由索引模型根据 Issue 内容生成。

评估

技术栈
javascript
领域
frontend
Issue 类型
功能
难度
5/5
预计耗时
一周以上
活跃度
停滞
描述清晰度
需要澄清
新手友好度
25/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。