Giter Site home page Giter Site logo

kirby-sortable's People

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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

kirby-sortable's Issues

Hide page in module section

I have updated the modules and sortable plugin to the latest version. So far all is working but one thing i can't get done. In the Panel on the right side where the modules are diplayed, also the normal page are shown. how can i disable the normal pages in the sortable section? in the old version of modules and sortable plugin, normal pages are hidden in the module section on the right side. do i miss something?

bildschirmfoto 2018-04-17 um 13 34 33

Removed Modules break the panel

I noticed that the removal of the last module of a page breaks the panel. Only when deleting the module via the page/module sidebar, though. When deleting it in the field I guess some sort of "hook" gets triggered and it works as intended.
Seems like the field looks at the saved modules sequence that's saved to the page content and doesn't check if the module exists. If I remove a module and another last one still exists it doesn't happen.

Can you reproduce this @lukaskleinschmidt?

I think the field should remove its content responsible for the modules sorting when there are no modules anymore.

EDIT: If I remove these lines that seem to sort the modules according to the sequence found in the content file, the error disappears.

EDIT 2: I think I solved it with this commit: medienbaecker@f6ea8e1.

Feature request: Limit the number of modules you can create

It would be a great feature if you could be able to limit the number of modules that you can create in some way.

Then you can have a field like this:

modules

With a small indication of the amount of modules you got and if you have reached the limit. This would be very handy if you build something like a two column layout where you just want 2 elements to fill the left and the right column and don't want to worry of a 3rd module getting mistakenly created that crashes the layout.

Cheers
Andreas

Error 500 on update if status:false in child's blueprint

Hi,

I have an error returned each time the field is updated.
After investigation it looks like the error is caused by the fact that status option is set to false in the child's blueprint.
Maybe would it be nice to add a warning or so?
Cheers :-)

How to override the language variables ?

I tried copying the language variables to my config file to override them (my client doesn't understand modules but sections are fine) but to no effect. Is there any way to override the language variables without touching at the plugin files ?

Class 'PermissionsException' not found

If I want to delete a module with the delete button I get the error:

Class 'PermissionsException' not found

it gives me the following debug infos:
.../site/plugins/modules-field/fields/modules/controller.php
on line 64 - 66

if($page->ui()->delete() === false) {
  throw new PermissionsException();
}

I'm on Kirby 2.4.0.

Add page title for new entries

I use the sortable field for displaying blogpost entries, so no modules plugin is used...
Is there a way to add the page title field, when adding new entries, like the build in way on adding new pages. Then you would already have readable page urls and you don't have to change them afterwards.
I remember that is was discussed at some places, but I couldn't find where.

Thanks for all your effort and this awesome plugin.

Error: mb_strpos(): Empty delimiter

If I use "kirby-sortable" on my website I get the error "mb_strpos(): Empty delimiter" when I want to add a new module in the contentarea (cf. screens). I am using PHP 7.1. You can see the parameters in the screenshot. Is there any solution? I dont know what to do. On my local Mamp-Server everything works fine. Thanks for help a lot!

Screens:
kirby-use-of-plugin-sortable-1
kirby-use-of-plugin-sortable-errorview
serverparameters

Inconsistant plugin name

The repo is called kirby-field-modules and the folder when downloaded is like kirby-field-modules-master.

But the plugin folder should be renamed modules-field. Maybe match the repo with the plugin name or the other way around.

(nice field by the way)

Missing path

Hi,

I've set up a clean kirby, installed the modules plugin, which works fine as far as could see.

Than I installed the modules field:

  • adding/creating modules works fine
  • modules are created in content/page/modules subdirectory
  • modules are there but it shows 'no modules yet'

For the field in panel I get this:

schermafbeelding 2016-09-09 om 11 21 28

Do you have any idea?

Thanks,
Arno

Long module titles break the layout

The .sortable-layout__title element has white-space set to nowrap and breaks the layout of the panel when there's too much text inside:

bildschirmfoto 2017-08-30 um 12 57 04

This is especially noticable on the mobile version, where even short titles are enough to push everything off to the right:

bildschirmfoto 2017-08-30 um 13 00 31

Adding a <span> on icons text for css selecting?

I got a suggestion to make to help the modules readability when using it with columns.

Currently i am using the modules on a page where i got a 2/3 - 1/3 column layout like this:

image

As you see there is really just not much space for displaying the modules name e.g. "infobox". Now my thoguth was, that I don't need the text for "edit" and "delete" because they need so much space. I would like to hide it. However the generated html does not have a selector for the text element and so you can't hide it with css. It is like this:

<a href=""><i></i>edit</a>
and I would like to have something like that:
<a href=""><i></i><span class="maybe a class">edit</span></a>

So my suggestion is to add in file modules/styles/module.php a surrounding tag for the text element.

    <a class="modules-entry-button btn btn-with-icon modules-edit-button" href="<?php __($module->url('edit')); ?>">
      <?php i('pencil', 'left')?>
      <span><?php. _l('fields.structure.edit') ?></span>
    </a>
    <a data-modal class="modules-entry-button btn btn-with-icon modules-delete-button" href="<?php __($field->url('delete', array('uid' => $module->uid()))); ?>">
      <?php i('trash-o', 'left') ?>
      <span><?php _l('fields.structure.delete') ?></span>
    </a>

It would be great if the end result could be something like this:

image

Whats your thoughts on this one?

PHP 7.4.x and Kirby 2.5.13

We have to update your k2 installation because of php upgrade. is the sortable/modules plugin compatible with the latest kirby 2.5.13 patch and php 7.4.x?

Copy Page / recursively endless spinn

Hi,
If I copy A page and paste that page inside the page that i copied, it creates a recursively endless spinn, and creates endless subpages.

Is this a Bug or how do I prevent this from happening !?
Of Course it works if I copy another and paste that page inside the page.

Role based actions in layouts

Hi,

is it possible to to access the current role of the panel user in a custom layout?
$this only contains Page and Field data and the other default Kirby variables also don't work.
For instance I want to hide toggle or delete buttons if the current user is not in the admin role.
Is there any way to achieve this?

Kind regards,
Georg

Disable field when readonly is set to true in the blueprint

Hello, thank you very much for this plugin : it is exactly what I was looking for.

It seems that it is not yet possible to disable the field via blueprint or permissions.

Not sure if it's the best option but here's a css solution :

.field-is-readonly .sortable a,
.field-is-readonly .sortable .sortable-layout [data-handle],
.field-is-readonly .sortable .sortable-layout__action{
  cursor: default;
  pointer-events: none;
}
.field-is-readonly .sortable .sortable-layout {
  background: #efefef;
  border-color: #ddd;
  color: #777;
}
.field-is-readonly .sortable .sortable-layout__icon {
  border-left-color: #ccc;
  background: #efefef;
}
.field-is-readonly .sortable .sortable-layout__action {
  color: #c9c9c9;
}

Skipping modal (hacky solution)

public function routes() {
    return array(
      array(
        'pattern' => '(:any)',
        'method'  => 'POST|GET',
        'action'  => 'adder',
        'filter'  => 'auth',
      ),
    );
  }

<?php foreach($page->blueprint()->pages()->template() as $template): ?>
        <?php $url = $field->url() .'/'. $template->name(); ?>
        <a href="<?php echo $url ?>" data-action=""><?php echo ucfirst($template->name())  ?></a>
<?php endforeach; ?>

public function adder($template) {

        $page  = $this->field()->origin();
        $entries = $this->field()->entries();

        if($page->ui()->create() === false) {
            throw new Kirby\Panel\Exceptions\PermissionsException();
        }

        $uid = $template . '-' . uniqid();
        $uri = $page->uri() . DS . $uid;

        try {
            $page->create($uri, $template, array(
                'title' => ucfirst($template)
            ));

            $entries->add($uid);
            $this->update($this->field()->entries()->pluck('uid'));
            $this->notify(':)');
            $this->redirect($this->model());
        } catch(Exception $e) {
            echo $e->getMessage();
        }
    }

Inline editing of modules

I really like this plugin. But the one thing that keeps me from using it, is the fact that you jump to a different page when editing a module. Since each module is a separate subpage, it's the natural behavior in Kirby.

This is in my opinion a problem for the user, since you lose context when editing a module. I like more the approach that the Kirby Builder Plugin uses. When editing a module, you are still on the same page, and you don't lose the context.

Would it technically be possible to add the functionality to this plugin, so that you can edit the modules inline, without opening a new page? If so, I would flag this as a future feature request.

This issue (in my opinion) is kind of related to the recent discussion about getting rid of modals for in the Panel.

Inline editing without losing context would be ideal. But as I said, it might not even be technically possible for this plugin, since the modules is saved as subpages?

Hide subpage containing modules

I setup the modules plugin, so that they are in a subpage with the UID modules and not direct children of the parent page (as you recommended here).

So with this fields module installed, is there a way to completely hide the modules folder form the subpages and only show real ones?

Undefined property field::options

I've just installed the latest version of the plugin and the field and get an error in the panel:

Notice: Undefined property: Kirby\Panel\Models\Page\Blueprint\Field::$options in D:\Git\Natasa\site\fields\modules\controller.php on line 9
Warning: array_filter() expects parameter 1 to be array, null given in D:\Git\Natasa\site\fields\modules\controller.php on line 69

As far as I can tell, everything is working fine except for that part :(

Here's my blueprint. I have tried with just label and type and with every combination of options I could think of:

  modules:
    label: Sections
    type: modules
    style: items
    readonly: false
    options:
      redirect: false
      preview: true
      delete: true
      limit: null
      edit: true

in the add modal are modules and page templates shown mixed

I've a page where i use some modules and have also the possibility to add subpages. So when I want create a new module the add modal shows me the subpage templates as well. Don't know if it's a bug or a feature, but for my case it would be better if I only have the module templates there.

For me a workaround helps me quite well, I'd edit the site/plugins/sortable/sortable/actions/add/forms/add.php that only modules with prefix are shown.

foreach($page->blueprint()->pages()->template()->filterBy('name', '*=', $field->prefix()) as $template) { $options[$template->name()] = $template->title(); }

Rename modules & update blueprint in filestructure

Kirby 2.5.12
Latest Modules & Sortables plugin
PHP 7.2

Maybe this two issues are related to each other:
You can reproduce this in the kirby starterkit. here a basic test installation:

app.zip

** Renaming module slug does not proper update the folder .txt modules: entry **
When a modules slug title is changed in the panel, the .txt files Module reference is still the "old" slug. i have to go back to the parent page of the module and hit save once to update the .txt in the filesystem. Step 1 to 5 to reproduce.

1
2
3
4
5

Renaming an module title/slug to a number leads to invisible modules in the panel
There seems to be a problem with numbers in the module title/slug. When i create a module and change the title/slug to a number the module is then no longer visible in the panel backend.

a
b

Disable sorting based on roles

Hi,

We would need to have the option to disable sorting based on roles (and maybe other conditions). The current method in the blueprint with sortable: false is too global to do this and I can't find another method to do this with the currently possible extension options.

In my opinion this could be done nicely by binding it to a role permission. For instance if we have a permission like panel.page.sort and set it to false this would disable sorting in Kirby-Sortable.

What do you think?

Kind regards,
Georg

Drag and Drop not working in IE 11

Hi,

drag and drop of sortable elements seems not to work with IE 11. The mouse icon changes but the elements are not dragable.
Do you have any idea?

Kind regards,
Georg

Multilang titles in module overview

In the module overview, the title shown on each module is from the title field of the module. This title field is saved upon creation of the module.

Would it be possible to show the (translated) name of the master module, instead of the saved title of the created module instance?

I'm asking, because I've run into some problems on a multi language site.

If I use translation strings inside yaml site/modules/mymodule.yml:

title:
  de: Mein Modul
  en: My Module
  sv_SE: Min Modul

If I create a new instance of this module, the current title translation is then saved in the title field of the created module automatically. And it is this saved title field that is shown on the overview list. This is not good if several authors with different languages are editing pages with modules. For example, if I am creating some modules, the Swedish translation is used and saved as the title field. This Swedish translation is then shown in the overview list. This is not good, because later when an english author is logged in, this Swedish translation is shown in the overview list.

So, I would like to propose to change this behavior so the translated name of the master module is shown in the overview list instead.

Easier way of disabling default actions

Might be nice to have the option to remove the copy & paste actions globally when using type: sortable.

Perhaps something like:

c::set('sortable.field.add', true);
c::set('sortable.field.copy', false);
c::set('sortable.field.paste', false);

I just couldn't figure out how to do this following the instructions in the Customize section in the readme.

Which setup of the modules-plugin is the field assuming is in use?

I am struggling a little with setting up modules correctly, could someone document how the modules-plugin should be setup in order for the field and plugin to work together.

The readme at https://github.com/getkirby-plugins/modules-plugin talks about two methods of setting up.

Option 1

site/blueprints/default.yml

title: Default
pages:
  template:
    - module.text
    - module.gallery

Option 2

site/blueprints/default.yml

title: Default
pages:
  template: default
  build:
    - title: _modules
      uid: modules
      template: modules
...

site/blueprints/modules.yml

title: Modules
pages:
  template:
    - module.text
    - module.gallery

Does it make a difference which I use or is there one option I should be using in order for the field to work correctly?

In the readme for this field when you mention the blueprint, is that to go in the blueprints created in either of the options?

For example do I put them in the default blueprint..

site/blueprints/default.yml

title: Default
pages:
  template: default
  build:
    - title: _modules
      uid: modules
      template: modules
fields:
  modules:
    label: Modules
    type: modules

I am fairly competent with Kirby and the general use of blueprints, snippets, fields, templates and controllers. But I am finding the concept of these modules hard to implement and would appreciate a little more information if possible.

At the moment without the field when I create a new page it then creates a folder "_modules" and then I open that folder, and then add another "page" choose the template and then fill in the content.

The above workflow does seems a little complicated, but I can just about get my head around it and what is actually happening. But the idea of a "page within a page within a page" is not something I would want or expect a client to have to deal with.

Hopefully someone can explain a little on how these modules should be used. Thanks

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.