项目作者: simplajs

项目描述 :
Beautiful, lightweight admin component for Simpla apps
高级语言: HTML
项目地址: git://github.com/simplajs/simpla-admin.git
创建时间: 2017-02-08T06:28:42Z
项目社区:https://github.com/simplajs/simpla-admin

开源协议:MIT License

下载


Simpla Admin

Build status Size Version Published

Simpla-admin is a lightweight, beautiful admin component for the Simpla content system. It provides everything you need to manage a Simpla app (login prompts, edit mode management, save controls, notifications, keyboard shortcuts) while remaining unobtrusive and minimal.

Contents

Resources

Installation and setup

Install simpla-admin with Bower (Yarn support coming soon)

  1. $ bower i simpla-admin --save

Setup Simpla on your page, then import simpla-admin into your <head>. It will automatically attach and load itself as a singleton when Simpla enters edit mode.

  1. <link rel="import" href="/bower_components/simpla-admin/simpla-admin.html" async>

Hashtracking

Simpla-admin binds #edit to Simpla’s edit mode. To enter edit mode, add #edit to the end of your URL. To exit edit mode, remove #edit from the URL.

You can disable hashtracking with the hashTracking property

  1. window.SimplaAdmin = window.SimplaAdmin || {};
  2. window.SimplaAdmin.hashTracking = false;

Login prompts

If you’re not authenticated when trying to enter edit mode, simpla-admin will prompt you to login with <simpla-login>. Closing the login modal without logging in exits edit mode.

The user will be prompted for login regardless of whether you enter edit mode via simpla-admin (#edit) or programmatically with Simpla (Simpla.editable(true)).

You can disable login prompts with the loginPrompt property, and authenticate manually with the Simpla.login() method

  1. window.SimplaAdmin = window.SimplaAdmin || {};
  2. window.SimplaAdmin.loginPrompt = false;

Hotkeys

Simpla-admin binds keyboard shortcuts to several common actions. On Mac the command key is used, on Windows the control key is used.

Shortcut Description
cmd/ctrl + s Save
cmd/ctrl + e Toggle edit mode (only if authenticated)

You can disable all hotkeys with the hotkeys property

  1. window.SimplaAdmin = window.SimplaAdmin || {};
  2. window.SimplaAdmin.hotkeys = false;

Accidental click protection

Simpla-admin makes a page non-interactive while it’s being edited, so users can edit content inside interactive elements (links, buttons, lightboxes) without accidentally leaving the page. Toggle off edit mode to re-enable clicks, your changes will remain in the local buffer until you either save or reload the page.

You can disable edit mode protection with the protectEditing property

  1. window.SimplaAdmin = window.SimplaAdmin || {};
  2. window.SimplaAdmin.protectEditing = false;

Notifications

Simpla-admin displays notifications for things like content saves with <simpla-notify>. You can display your own custom notifications by firing a simpla-notification window event with a text property

  1. var notification = new CustomEvent('simpla-notification', {
  2. detail: {
  3. text: 'something happened'
  4. }
  5. });
  6. window.dispatchEvent(notification);

Contributing

If you find any issues with simpla-admin please report them! If you’d like to see a new feature supported file an issue. We also happily accept PRs.


MIT © Simpla