Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Filter feature #6

Closed
wants to merge 19 commits into
from

Conversation

Projects
None yet
2 participants
Contributor

vlad-ghita commented Nov 24, 2011

Implemented Filter feature #4.

See Readme for details.

Please review.

Thank you.

Updates (25.11):

Fixed an edge case for checkboxes as radio-button. The returned value for selected on line 22 in sblp.js is not an array, as expected on line 31. The fix solves this.

I think it's related to #7. I will keep an eye for the behavior described in #7.


So far the filter feature is working fine. I'm using it w/o any problems.
Contributor

vlad-ghita commented Nov 25, 2011

Refined field settings:

When fetching related entries values, old behavior says:

if( filters exists ? ){
    apply filters
}

fetch data as usual

I added a new checkbox for settings which says: "Use filters". So new behavior is:

if( use filters ? ){
    if( filters exists ? ){
        apply filters
    }
    else{
        return empty results; // so when creating a new entry, SBL+ will not display all related values (aka bloat)
    }
}

fetch data as usual
Contributor

vlad-ghita commented Nov 30, 2011

No major issues encountered yet.

What do you think: to be merged as feature of SBL+ or should I create another extension which ... extends this one?

Contributor

kanduvisla commented Dec 5, 2011

I looked into this, and I understand the concept, but I'm not sure if this is something to be implemented right now. I still have some questions:

  • First of all, I couldn't get it to work. I have a section 'Pages' where each page has a slideshow (gallery), and I have a section 'Slides', which contains different images. So I created a SBL+/Gallery in 'Pages' and a 'SBL' in 'Slides', but nothing showed up in the Filter box. Am I doing it right?
  • What would happen if the user creates a new item with the SBL+ interface? Would it show up? Would the cross-reference be set automaticly correct? I would try this myself, but I couldn't get your changes to work.

I'm waiting with merging this one...

Contributor

vlad-ghita commented Dec 6, 2011

So I created a SBL+/Gallery in 'Pages' and a 'SBL' in 'Slides', but nothing showed up in the Filter box. Am I doing it right?

It must be SBL+ as well (checkbox suites nice), as mentioned in the readme. As you can see on this line, I chose to search for filters only among other SBL+ fields, without SBL. SBL is absolutely included in SBL+, so there is no need to use SBLs when SBL+ is around.

NB: I realised it's rather easy to change a SBL to SBL+ in phpMyAdmin, if that's a problem:

  1. insert a new row in tbl_fields_selectbox_link_plus with data from old row in tbl_fields_selectbox_link
  2. in tbl_fields search the field and change type from selectbox_link_field to selectbox_link_field_plus

What would happen if the user creates a new item with the SBL+ interface? Would it show up? Would the cross-reference be set automaticly correct? I would try this myself, but I couldn't get your changes to work.

Now here's a glitch with UX ...

Say I want to create a new entry in Pages. After filling the form, I must save the entry to register (create) it in the system so SBL can be aware of it.

a. I want to add existing Slides to this Page: I must navigate to Slides section, go to each Slide and select this new Page from the SBL+ filter. Then go back to Page and normally select desired Slides from the pool.

b. I want to create a new Slide. This can be done from the SBL+ interface (Page edit) but make sure that on creation, in the SBL+ filter I choose this Page (it can be done by making the field required, so the user won't miss the step).


In short, for a new `Entry`, the entry must be created first (so SBL can find it in the system) before the siblings can choose it as a filter.
This idea just poped in my mind.

Display all available Slides when creating a new Page (Slides will not be filtered. Exception from the rule). On pushing the create button for the Page, for each Slide that was selected, I can set the visibility for this Page. It would greatly improve UX.


In short:

For new entry -> Filter feature is disabled. For each selected sibling, the visibility will be set to this new Entry.

For entry edit -> Filter feature works as expected.

Contributor

vlad-ghita commented Dec 7, 2011

This commit says:

On new Page creation, filters are disabled and Create new entry in "Slides" is disabled as well. Upon creation, for each selected Slide, the visibility SBL+ will be set to this new Page.

Of course, on Page edit, filters are active.

Create new entry in "Slides" is disabled as well

This is because this situation arises:

1_ if VisibilitySBL+ in Slides section is required, problems exist on new Page -> new Slide creation through SBL+ interface. Page doesn't exist yet so the Slide can set it's visibility to it. Solution: Disable creation of Slides when creating a Page.

2_ if VisibilitySBL+ in Slides is not required, possible problems on Page edit -> new Slide creation through SBL+ interface. The user will forget to set the visibility of the new Slide to current Page and thus the Slide won't appear on Page edit.

I recommend approach 1_ (these lines) because it solves both the problem and the situation from2_ is avoided (visibility SBL+ from Slides will throw an error if no Page is selected => the user will not forget to set visibility).

Contributor

kanduvisla commented Apr 24, 2012

I just made some changes to the master branch, and I haven't had the time to check back on this (been very busy lately). I'll look into this as soon as I have the time. Or can you test it against the latest 1.3? Perhaps filtering could be added to 1.4

Contributor

vlad-ghita commented Apr 25, 2012

Hmm, I'm not sure I'll continue with this feature. It produces more hassle than it solves :)

Think about adding another existing Image to an existing Album.

  1. Go to Images.
  2. Search for the Image. Edit it. Select desired parent.
  3. Go to Albums. Edit the Album. Click the image.

Now ... this feature shouldn't be limited to gallery views, but ... well ... If it is needed, I'll integrate it with the latest SBLP.

@vlad-ghita vlad-ghita closed this Apr 25, 2012

Contributor

vlad-ghita commented May 7, 2012

I just had a snap :D

This feature is great. The missing piece is a "View more" button. Or 2 buttons:

||View XX more||                                              ||View all||

All items will be preloaded like they do now, but will be hidden with css/javascript. This way the UI won't be cluttered with not-required entries, but these entries will still be accessible.

Contributor

kanduvisla commented May 7, 2012

Isn't this exactly what my latest update added to the whole thing? Should be worked out further however...

Contributor

vlad-ghita commented May 7, 2012

Isn't this exactly what my latest update added to the whole thing?

Didn't have the time to check the latest SBL+ yet :) I'll see what's the status and post back here (in a few days).

Contributor

vlad-ghita commented May 18, 2012

Isn't this exactly what my latest update added to the whole thing? Should be worked out further however...

I just had a look at latest SBL. Great stuff !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment