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

yanked mango-panel

An example of implementing the admin panel

0.1.0 Sep 6, 2021

#22 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

Admin panel for easy use of mango-orm. This example uses actix-web . Other frameworks can be used by this analogy.

Requirements

Hint

For examples of Model fields, use tests.

Quick start

1. Install mongodb (if not installed)

### 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. Download and unzip the project archive

3. Go to the project directory and run the following commands:

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

Login page

On the first visit to the panel, the first user with administrator rights will be created.

  • Default login: admin
  • Default password: 12345678 Login page

Welcome page

Welcome page

List of documents

List of documents

List of documents

Document form

 Document form

Example of using a dynamic widget

Dynamic Widgets - This is a simplified alternative to ForeignKey and ManyToMan. Dynamic widgets are used to create document-style categories.

Example of using a dynamic widget

Image upload field

Image upload field

File upload field

File upload field

Color selection field

Color selection field

Date and time field

In the database, the date and time are stored in UTC format. In the admin panel, the date and time are displayed as local.

Date and time field

Date and time field

Field textarea type and CKEditor 5

Usag CKEditor 5 with textArea widget

Editor settings: mango-panel/admin-panel/src/store/modules/ckeditor.js

//  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

Dependencies

~65MB
~1M SLoC