#panel #admin #document #page #color #model #local

已删除 mango-panel

实现管理面板的一个例子

0.1.0 2021年9月6日

#23 in #panel

MIT/Apache

6.5MB
5.5K SLoC

JavaScript 2.5K SLoC // 0.4% comments Rust 2K SLoC // 0.2% comments Vue 1K SLoC // 0.1% comments

Logo

mango-panel

适用于轻松使用 mango-orm 的管理面板。本例使用 actix-web。其他框架也可以用此类比。

要求

提示

对于模型字段的示例,请使用 tests

快速入门

1. 安装mongodb(如果尚未安装)

### Ubuntu, Mint:
$ sudo apt install mongodb
## OR
### Ubuntu 20.04, Mint 20.x:
$ sudo apt update
$ sudo apt install dirmngr gnupg apt-transport-https ca-certificates
$ wget -qO - https://www.mongodb.org/static/pgp/server-4.4.asc | sudo apt-key add -
$ sudo add-apt-repository 'deb [arch=amd64] https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/4.4 multiverse'
$ sudo apt update
$ sudo apt install mongodb-org
$ sudo systemctl enable --now mongod
$ mongo --eval 'db.runCommand({ connectionStatus: 1 })'    # For check
$ reboot
### Configuration file:
sudo nano /etc/mongod.conf
### Systemd:
$ sudo service mongod status
$ sudo service mongod start
$ sudo service mongod stop
$ sudo service mongod restart
$ sudo service mongod enable
$ sudo service mongod disable
### Uninstall:
$ sudo service mongod stop
$ sudo service mongod disable
$ sudo apt purge mongodb-org*
$ sudo rm -r /var/log/mongodb
$ sudo rm -r /var/lib/mongodb
$ sudo rm -f /etc/mongod.conf
$ sudo rm -f /etc/apt/sources.list.d/mongodb-org-4.4.list    # for 4.4

2. 下载并解压项目存档

3. 进入项目目录并运行以下命令

$ cargo build
$ cargo run
Open in a web browser http://127.0.0.1:8088/admin

登录页面

第一次访问面板时,将创建第一个具有管理员权限的用户。

  • 默认登录: admin
  • 默认密码: 12345678 登录页面

欢迎页面

Welcome page

文档列表

List of documents

List of documents

文档表单

 Document form

动态小部件的使用示例

动态小部件 - 这是 ForeignKey ManyToMan 的简化替代品。动态小部件用于创建文档样式分类。

Example of using a dynamic widget

图片上传字段

Image upload field

文件上传字段

File upload field

颜色选择字段

Color selection field

日期和时间字段

在数据库中,日期和时间以UTC格式存储。在管理员面板中,日期和时间显示为本地时间。

Date and time field

Date and time field

字段 textarea 类型与 CKEditor 5

使用 ckeditor 的示例

依赖关系

//  Example of a field in the Model.
#[serde(default)]
#[field_attrs(
    widget = "textArea",
    label = "Text Editor",
    maxlength = 6000,
    css_classes = "ckeditor"
)]
pub text_editor: Option<String>,

Field textarea type and pulse CKEditor 5

~1M 使用 ckeditor 的示例

ckeditor 的示例
ckeditor 的示例