Giter VIP home page Giter VIP logo

amcommand's Introduction

Command Palette

Command palette in Craft.

Requirements

This plugin requires Craft CMS 3.0.0-RC1 or later.

Installation

To install the plugin, follow these instructions.

  1. Open your terminal and go to your Craft project:

     cd /path/to/project
    
  2. Then tell Composer to load the plugin:

     composer require am-impact/amcommand
    
  3. In the Control Panel, go to Settings → Plugins and click the “Install” button for Command Palette.

Functionality

If you have ever used Alfred, you know you'll be zipping through the control panel in no time!

You can open the command palette by using the keyboard combination: (command key for Apple users) CTRL + SHIFT + P, or you click on Command in the CP navigation.

Use the keyboard arrows (up and down) to navigate to your desired command. When you hit the return key or click on a command, the command palette will navigate to the location and show what it's loading. Use (command key for Apple users) CTRL + RETURN (or click) to fire the command in a new window.

Palette

Current commands

Default commands

Command Description
Content: Delete all entries Delete all entries in one of the available sections.
Content: Delete entries Delete an entry in one of the available sections.
Content: Edit entries Edit an entry in one of the available sections.
Content: New entry Create a new entry in one of the available sections.
Dashboard Redirect.
Globals: Edit Edit one of your globals.
Search on Craft Redirect - Search on Craft with given keywords.
Search on StackExchange Redirect - Search on StackExchange with given keywords.
Settings: Assets Redirect.
Settings: Categories Redirect.
Settings: Fields Redirect.
Settings: Fields - Duplicate Duplicate a field.
Settings: Fields - Edit Edit one of the fields.
Settings: Globals Redirect.
Settings: Globals - Global Sets Edit the settings for one of the globals.
Settings: New... Add something new in the settings...
Settings: Plugins Redirect.
Settings: Plugin settings Edit the settings for one of the enabled plugins
Settings: Routes Redirect.
Settings: Sections Redirect.
Settings: Sections - Edit Edit a section.
Settings: Sections - Edit entry type Edit an entry type of a section. (Field Layout and such)
Settings: Users Redirect.
Tasks Manage Craft tasks.
Tools Use one of the most used tools.
Users: Delete users Delete a user other than your own.
Users: Edit users Edit a user.
Users: Login as user Log in as a different user, and navigate to their dashboard.
Users: New user Create a user.
Sign out End current session.
My Account Redirect.

Special commands

Command Description
Content: Compare entry version Compare the current entry you are viewing in the CP with older versions.
Content: Duplicate entry Duplicate the current entry you are viewing in the CP.
Simply type! You will be able to search in elements directly when you haven't triggered a (deeper command, that returns a new list or such things) command yet.

Adding your own commands

If you'd like to add commands for a plugin you're developing, register the commands through an event.

Add this at the top of your main plugin file:

use amimpact\commandpalette\events\RegisterCommandsEvent;
use amimpact\commandpalette\services\General;
use yii\base\Event;

Add this to the init function of your main plugin file:

if (class_exists(General::class)) {
    Event::on(General::class, General::EVENT_REGISTER_COMMANDS, function(RegisterCommandsEvent $event) {
        $event->commands[] = [
            'name' => 'Search on Google',
            'type' => 'Custom',
            'url'  => 'http://www.google.nl',
            'icon' => [
                'type' => 'font',
                'content' => 'plugin'
            ]
        ];
        $event->commands[] = [
            'name' => 'My own plugin function in a service',
            'type' => 'Custom',
            'call' => 'yourPluginFunctionName',
            'plugin' => 'your-plugin-handle',
            'service' => 'yourPluginServiceName'
        ];
    });
}

That's it! The command palette will add these two commands.

If you look at the second example, you see a call, plugin and service key. These can be used to load a new set of commands.

In your plugin's service yourPluginServiceName (e.g.: general), you'll create a new function called yourPluginFunctionName. In here you could do the same thing as you see in the example, and just return the new set of commands.

Contact

If you have any questions or suggestions, don't hesitate to contact us. We would like to add more commands to the palette, so if you have any ideas then please let us know!

amcommand's People

Contributors

frankzwiers avatar hubertprein avatar lukeholder avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

amcommand's Issues

Simple Map plugin breaks when Comand Palette enabled

I'm not sure which plugin is causing the issue, but this issue: ethercreative/simplemap#61 explains how having Command Palette enabled breaks Craft CP entirely by causing this error:

Internal Server Error
Call to a member function getMap() on null

This is the comment from Simple Map author:

That error suggests that the field type was being called in some way before the rest of the plugin had been initialised. It's most likely that one of the other plugins you had installed was causing this.

The original issue has my logs and this might help figuring out the issue as well:

If I just uninstall that one (Command Palette plugin), I can create the Map field again. But funny enough, once I create the map field, I can re-enable Command Palette and then I can continue creating Map fields without errors.

Thanks for the great plugin, I hope I can re-enable it soon.

broken when changing settings

went to command palette settings and enabled more sections and its broken the app completely.

An Error occurred while handling another error:
Error: Class name must be a valid object or a string in /home/tsvg/public_html/nhd/vendor/am-impact/amcommand/src/services/General.php:512

removed and installed package again, still the same. having to remove in order to have a functioning app.

Open results in a new tab/window

It would be really nice if we could open the new page in a new tab, for example by hitting Cmd+Enter instead of Enter. Often I just forget to create an entry to which the current one should be related, open amcommand and hit "create new", but I still want to keep the previous page open to make the relation after that entry was created.

FR: Add Clear template caches

Please add Clear Template caches as an option. (don't want to clear all the caches including image transforms. Bad for your server.)

Sort by score

Sort json by score and build html from json when typing.

Composer Update

Composer complaints about this:

Problem 1
- The requested package amimpact/command-palette could not be found in any version, there may be a typo in the package name.

Craft Pro 3.0.17.1
Alfred: 3.1.4

Check for permissions first

First - awesome idea, thank you!

The first thing I tried to do with this plugin to test it out was create a new user, on a Craft Solo license. It took me to a 404 page as it's not possible to create new users on Solo. Perhaps the plugin could check whether you're able to do something before giving you the option?

RC11 Bug

Updated to 3.0.0-RC11 and the command palette stopped working.
When I click on the link in the admin sidebar nav, I get the following error page:
https://cl.ly/433K3P1d432z

Was working fine in RC10.1

UX: Change default order of some results

Hey there,

Just want to say as an avid Alfred user, I LOVE this plugin. I've already memorized the key command by heart.

I've been using it a bit and noticed that the default order of some listings for popular queries is a bit odd. For example, when typing in "entries" instead of it taking you to the whole entries list, the default is to delete all entries! I've accidentally hit enter a few times and almost deleted entire sections by accident.

like this

Is it possible to reorder the results somehow? I'm happy to take a stab at this if you're accepting PRs.

Thanks,
Rob

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.