Git Product home page Git Product logo

statamic-pagereorder's Introduction

Statamic: Page Reorder

Adds AJAX drag and drop reordering of the top-level pages to your Statamic control panel's "Pages" page.

Installation

1. GIT Clone

  1. git clone [email protected]:jannisg/statamic-pagereorder.git pagereorder into your _add-ons directory.

2. Download

  1. Download the master branch if you are using Statamic 1.5 or later (or the 1.4.2 branch if you're using that version of Statamic)
  2. Extract the downloaded archive and rename the folder to pagereorder.
  3. Drag this pagereorder folder into the _add-ons folder at the root of your Statamic installation.

Requirements

This add-on makes use of:

  1. jQuery (already part of the Statamic Admin UI)
  2. jQuery.easing (already part of the Statamic Admin UI)
  3. Underscore.js (already part of the Statamic Admin UI)
  4. HTML5 drag and drop API.

jQuery, jQuery.easing and Underscore.js are all part of Statamics normal payload so we're just using what's already available there.

The drag and drop however needs the native HTML5 drag and drop api to work. If your browser doesn't support this then things aren't going to work…

If there is a need for it, I could look at adding fall back support for this using something like jQuery UI: Sortable for older browsers.

Browser Support

This add-on has been tested successfully in: Chrome, Safari, Firefox and Internet Explorer 10. Note: Touch devices are currently not supported.

Support for Internet Explorer 9 and lower could potentially be added, please file a GitHub issue if you'd like to see IE8/9 support.

What should you expect

  1. Visiting the control panel's ("Pages"/"Dashboard") page, you will be able to drag and drop each top-level page and numerically sorted subpages by clicking on the drag handle located to the left of the page title.
  2. Standalone pages are "special" and are not affected by reordering nor can you drag them anywhere.
  3. Subpages cannot currently be reordered. This is possible with version 0.3.0.

To Do

  • Touch support

Source Files

If you'd like to make modifications or view the uncompressed code, the source files are included in the /src/ directory. To make modifications be sure to use the Grunt JS task runner provided.

Setting up the task runner is fairly easy, go into the pagereoder folder, run npm install (you obviously need to have NodeJS installed for this to work) and then run either:

  • grunt to compile your changes into the compressed output served by the plugin.
  • grunt watch to auto compile during development.

If you don't have any interest in making modifications to this add-on yourself, you can safely delete the following files/folders:

  • Gruntfile.coffee
  • package.json
  • .gitignore
  • src/

Notes

Use at your own risk.

Check the To Do list and test things thoroughly yourself before any production use.

Attributions

This add-on uses the HTML5 Sortable plugin.

License

This add-on is released under the MIT license.

statamic-pagereorder's People

Contributors

jannisg 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

Watchers

 avatar  avatar

Forkers

bliswebagency

statamic-pagereorder's Issues

Not an issue, just an idea

Sorry, this is not an issue, just an idea.

Currently if we need to change the position number of entries (when not ordered by date) we have to (1) open the entry, (2) change the position field and (3) save and fix the numbering conflicts since now we have number duplicity. Quite puzzling and annoying for the user. It would be 100 times better and smarter to have a drag and drop mode to quickly change the ordering of entries. In my projects, ordering entries are always more important than ordering pages. That because the webdesigner is supposed to create the layout, which includes the page ordering. 90% of clients are never like: "Oh, I think I want to put the About Us page first". Usually they don't even think about page ordering. But the entries are inserted by the client, so he should be able to quickly reorder them as he pleases. For example, reorder the slides in the home page, or a restaurant manager reorder dishes in the food menu page.

Doesn't seem to work in v1.5b8

Unless I'm doing something wrong it doesn't seem to work in v1.5b8 but from the looks of things you're probably aware of that.

Statamic in subfolder not accounted for in hooks.pagereorder.php

Tried build 0.3.0 on Statamic 1.10.3 with Chrome 40.0. Statamic installed in a subfolder.

After accounting for the subfolder problem in issue #9 reordering childpages worked fine, but I got an error if I tried reordering the top level folders. The error was cast at line 150 in hooks.pageredordering.php.

I managed to fix it by changing line 91 from:

        if ( isset($page->url) && $page->url == $url ) {

To:

        if ( isset($page->url) && substr(Config::getSiteRoot(),0,-1).$page->url == $url ) {

The substr is there to remove an extra /. There is probably a nicer way of doing this, but should give you an idea.

Love the add-on! :)

Please add subpage reorder

Hi.

It would be awesome to be able to reorder subpages.

My client wants to reorder pages, but the only possibility is to alter the slug.
Which is not very usability friendly.

Wouldn't this be easy possible trough grabbing the foldername number of the subpage and alter this number trough the reorder plugin?

Thank you

Statamic in subfolder not accounted for in javascript

Tried build 0.3.0 on Statamic 1.10.3 with Chrome 40.0.

After dragging and dropping a page in the control panel I get the error:

There was an error saving your page order. Please try again.

In the console I get the error:

POST http://localhost/TRIGGER/pagereorder/reordersubpages 404 (Not Found)

The correct path when i have it installed in a subfolder should be:

http://localhost/subfolder/TRIGGER/pagereorder/reordersubpages

Need som extra magic on line 111 in jquery.page-reorder.coffee that account for the site root I presume :)

Reordering Child pages of Child Pages

When reordering child pages of another child page, extra folders are being created.

Before reorder:

before-screen

After page reorder through the control panel:

screen-shot-2015-05-15-at-9 08 03-am- 2

Installation has no effect

Running Statamic 1.5RC1. Installation has no effect on the Pages area of the CP. Tested in Chrome 27.0, Safari 5, Firefox 20.0. This is all on a local MAMP server.

Screenshot of my install, in /_add-ons/:

pagereorder

Let me know if I've done it incorrectly, thanks!

Improve handling of leading zeroes

Is it possible to limit the number of leading zeroes based on the number of pages/entries in the current context? In other words, having only a single leading zero (01-) rather than several (0001-) when there are under 100 pages. (And so on.)

It's an aesthetic issue, to be sure. But then, that's why we got in this racket in the first place :)

Ajax error

I'm trying to use the add-on with Statamic 1.7.3, but it's throwing a javascript error and won't save. Any idea what might be causing this?

screen shot 2014-03-27 at 14 02 39

Thanks!

respect displayed state of child pages

When reordering entries in the dashboard the child pages for entries that have then reopen if they were closed. It would be nice to respect the display state of the entries and keep them closed if they were originally closed.

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.