Comments

jseffel’s picture

Yes you can. Expose the filters you want in the ib_browser view, then you'll need this patch: http://drupal.org/node/555612

jdelaune’s picture

Status: Active » Postponed (maintainer needs more info)

Well v2 wasn't intended to have exposed views, although you can and jseffel has made a patch to make the work they will seriously mess up the styling.

The reason it's not intended is because there are very little useful filters you can expose on files in Views. Out of interest which filter do you plan to expose?

loze’s picture

Filtering by partial filename or imagetype would be useful, especially for sites with hundreds/thousands of images.
I will try the patch, and see what i can throw together.

thanks.

scroogie’s picture

StatusFileSize
new702 bytes

Filtering by partial filename is especially interesting if you combine it with filefield and filefield_paths, which is one of the rare solutions to somehow ordering your files. A more sophisticated filter would allow to choose the taxonomy of the nodes the file is referenced in.
Drupal 6 really needs a way to tag or otherwise categorize images. I have pages with 20.000 and more images. :/
Attached is a better patch to allow exposed filters.

scroogie’s picture

We need someone who is good at designing them, though. Starnox? ;)
I can write the hook_form_alter code if you want.

scroogie’s picture

We could also filter by the user who uploaded the file.

jdelaune’s picture

Sure if someone wants to write a patch I can do the UI parts.

scroogie’s picture

Assigned: Unassigned » scroogie

Okay, I'll do the patch. If you could review this patch here http://drupal.org/node/618838, I could also enable a views Relationship for nodes, which would give us some more opportunities on filters.

scroogie’s picture

Component: Documentation » Code
Category: support » feature
Status: Postponed (maintainer needs more info) » Needs review
StatusFileSize
new3.87 KB

Okay, here is a patch to be reviewed that lets us theme the exposed filters for the Imagebrowser view. I included the standard preprocess function and template, to make it easier. I hope the new file in the patch worked.

scroogie’s picture

StatusFileSize
new4.34 KB

Errrh, sorry, forgot the most important change. ;)

scroogie’s picture

StatusFileSize
new4.64 KB

This one includes the patch from #4, so you only have to apply one patch.

scroogie’s picture

Any news on this? I'd be willing to contribute other patches.

peter törnstrand’s picture

Assigned: scroogie » peter törnstrand
Status: Needs review » Needs work

The patch seems solid. What is missing is the styling of the exposed filter, am I right? I will write the UI part of this feature if Starnox has no objections. Will return to this issue in a week. Marking as "needs work" as this will not be commited without the UI to go with it.

scroogie’s picture

Great blixxa. Every contribution is welcome. If you need something in the code (theme function, template file, or whatever), ring me here. Also, I'd need to check the patch against the latest Views version. I was waiting for a basic review by Starnox.

Greetings
scroogie

jdelaune’s picture

I'm quite keen the make the filters optional. So if the view hasn't been modified to include filters then you won't notice that through the UI. The UI should adapt in size to accommodate both views with filters and without. Just my thoughts. Thanks for your work.

miro_dietiker’s picture

subscribing

peter törnstrand’s picture

StatusFileSize
new12.86 KB
new16.81 KB

Ok. So I have made a rough draft of how the UI could look like. I have tried to make it minimalistic. Please give som feedback on this.

peter törnstrand’s picture

StatusFileSize
new3.38 KB

Here is a patch for the filters UI (does not contain the modifications to the view).

jdelaune’s picture

StatusFileSize
new150.78 KB

Maybe something more like this. So the filter button toggles the bar on and off. While the filter bar is showing the paging bar at the bottom is hidden. Not sure how easy it will be to shift everything down but I'm sure it can be done.

scroogie’s picture

I think it would be good to have a "filters" button instead of only the handle (or perhaps both?). It will be more obvious for the ingenuous users. But why would you drop the pager? I can imagine that you often need both at the same time. The filter for roughly preselecting, and the pager to reach your goal.

jdelaune’s picture

Well you would toggle the filters on, narrow down your results. Then toggle the bar off and get your pager back.

peter törnstrand’s picture

StatusFileSize
new34.41 KB

I think that maybe we should make the filter panel a bit bigger so that a user can customize the exposed filters, maybe add more, and still not have the layout broken. See attached image.

jdelaune’s picture

Well lets go the whole way like in IBv1 where the filter window takes up all the browser window space. So if needed they can hit the filters button. Select their filters and then hit apply to go back to the browser.

buckley’s picture

subscribing

peter törnstrand’s picture

Status update. This is in the works and will probably be ready in the comming weeks. UI wise there will be a button next to Upload that when clicked displays the filters screen. Submitting the filters form takes you back to the filtered results.

Default available filters will be filename and file owner.

buckley’s picture

Good thinking to leverage view here devs!

peter törnstrand’s picture

Sorry, I jumped on another feature request (custom title and alt attributes) instead of doing this one ... filters are on the way.

idmacdonald’s picture

Hi,

Thanks to blixxxa for the patch in comment #18. That patch seems to style the exposed filters quite nicely, but when I hit the 'apply' button next to the filters I've set up, I end up with the site front page inside the image browser window.

It looks like some code needs to be added so that the exposed filter 'submit' button takes us back to that same screen. I've added the form_alter code suggested in #651360: Exposed views filters break on submit into my imagebrowser.module and have created a new patch, which I've attached. This seems to work for me.

-Ian

idmacdonald’s picture

Sorry, here's the patch.

-Ian

idmacdonald’s picture

The last patch worked for me, until I added an exposed autocomplete field. The JavaScript file for implementing autocomplete wasn't linked into the page. Here's a new patch that adds that in.

Also, I wanted to show the filters by default, instead of hiding them on initial page load. So, I made a one-line change to the CSS, removing the 'display: none' from the '.view-filters' class. But this is probably a matter of preference and different usage cases.

Thanks to Starnox for maintaining a great module.

-Ian

idmacdonald’s picture

Darn. There was a bug in the hook_form_alter code in the last two patches. I've fixed it and rolled a new patch.

-Ian

scroogie’s picture

idmacdonald: did you try the patch in #11? It had the logical modifications. blixxa said explicitly that #18 did not include the needed modifications.

gausarts’s picture

Subscribing. Thanks

rootwork’s picture

StatusFileSize
new4.67 KB

The patch in #31 mostly works great for me.

The only thing is the theming -- in my browser (Firefox Win 3.6) the bottom of the "Apply" button is cut off -- see attached screenshot. I also can't seem to adjust that pane -- clicking and dragging on the bar doesn't have any effect.

In terms of being able to apply filters, though, this works great.

nikolajb’s picture

Any chance of adding taxonomy term as a filter as well? I can't find it in views. Or am I missing something? I've got about a thousand images, using tags for galleries and content, so being able to filter by taxonomy terms in exposed filters would be extremely helpful :)