Problems, need help? Have a tip or advice? Post it here.
11 posts Page 1 of 2
Hi all,
I've been trying to figure this one out but am a little stumped/

Basically, i've changed the default view for my image-gallery to a list of rows with a thumbnail in and with changeable order as per the tutorial (https://www.couchcms.com/forum/viewtopic.php?f=5&t=10241#p24680)

Each page in the gallery can be linked to multiple categories as per https://www.couchcms.com/forum/viewtopic.php?f=2&t=9243&p=19515#p19511.

What i'd like to be able to do is to add / remove categories to the selected rows in the gallery list view.

I've managed to add option to bulk actions list but can't quite figure out where to go from there.

Might it be better to add another button(s) to do this, which opens a conditional section with the tag list in.

either way how would i then add or remove the categories from the selected pages.

appreciate any pointers.

cheers,
gwil
Gwil, if you managed to add an option to the bulk action list, then the next obvious move is to fire up an XHR to retrieve the list of all categories to select from. Take a look here to get an image of what that list could look like viewtopic.php?f=5&t=11021

Unfortunately, the whole thing you are after is not something available out of the box in Couch. It's a pretty deep customization..
trendoman, thanks again mate.
i'm still a little shaky on the old XHR but will look and see what i can figure out.
the advanced_gui seems like a good fit.
will let you know how i get on.
cheers,
gwil

ps have reverted to original gallery view so as to use your ordered_gallery template. nice one again. will use that as the base for my theme.
I haven't seen your theme, but I feel like you are looking towards quickly relate pages (images) to another page (category). I believe dropdown bulk action is just not the perfect user experience. I mean clicking on several images (selecting them), next choose an action and popup a window, next select the related category and save - it all sounds bulky and cumbersome.

If you could imagine a page where you just got a split screen with drag and drop option? Probably images on the left and a pane on the right so you can just drag and drop images from left to right to establish relation. That pane on the right represents one of the selectable categories. I can't yet visualize how to preselect a category so the images can be drag-dropped to it, but the main idea is anyways to make relation easier and quicker, just like ordering is now so much easier.

It would be an interesting thing to work on and probably would help in cases where a bunch of items are to be quickly assorted into various folders/categories etc.
@trendoman, thanks for your time. I think you are right regarding the clunkiness.

As it stands I've got some nestes pages, with 0-n associated tags from tags.php
[index.php]
Code: Select all
<cms:template clonable='1' nested_pages='1' order='100' title="Site">
    ...
    <cms:editable order='10' name='tags' type='relation' masterpage='tags.php' label='Tags' />
    ...
</template>

each with a gallery. the gallery images are all pulled from my image-library.php,
[image-libarary.php]
Code: Select all
<cms:template title='Image Library' clonable='1' dynamic_folders='1' gallery='1' order='30' executable='0'>
    ...
    <cms:editable order='10' name='tags' type='relation' masterpage='tags.php' label='Tags' />
    ...
</template>

where each page in gallery can 0-n tags associated with it from tags.php
[tags.php]
Code: Select all
<cms:template title='Tags/Categories' order='800' clonable='1' hidden='0'  order='20'>
    ...
</cms:template>


As can be seen the gallery content on each page is determined by the tags selected for it, and any images with those tags.
This works really well apart from the adding of tags to the images which is a bit clunky as it stands.
I was hoping to get the logic at-least with the bulk-action method, and then work on the ux.
This particular instance, there will be tens of tags rather than 100s or 1000s, but it would be nice to come up with a solution that scales ;).

another option i was considering was a drop down of tags above or below the list, with add/remove buttons. so select the tags, select the images and click add/remove. with the tags staying selected between page moves. that's my least clicks idea at the moment.
I think this way might work well with the advanced_ui option.
I should be able to sort out the ui, but will need to dig to figure out the logic, which i think is:
1 - get tag list for list screen
2 - apply selected tags (either add or remove) to selected imgs

going to dive in now and see where i end up

As i've only just seen your dragula work I haven't really been thinking in the drag & drop way. shall give it some more thought.

any further thoughts greatly appreciated.
If you come to a point where you have a custom form in list-view (in backend), use parameter action=k_qs_link which will submit the form to the page you are on (including paginated pages). Example -
Code: Select all
<cms:html>
    <cms:form action=k_qs_link anchor='0' method="post">
        <cms:if k_success>
            <cms:log "<cms:dump_all />" />
        </cms:if>
        <cms:input type='checkbox' name='my_tags' opt_values='tag1 | tag2 | tag3'  />
        <cms:input type='hidden' name='my_selected_pages' value='' />
        <cms:input type='submit' name='submit' value='Relate'/>
    </cms:form>
</cms:html>
Adding to my previous post..

I am going to give you another huge boost towards the solution. Place this in config_list_view and you'll instantly have access to the k_page_id value of the image you just clicked on/selected. Script also works in list-view of regular (not gallery type) templates.

Code: Select all
<cms:script>

    $( function(){
        COUCH.el.$content.find( ".checkbox-item" ).not( ":disabled" ).on( "change", function( e ) {
            elemId = e.target.id;
            checked = e.target.checked;

            if( checked ){
                $clonedPageId = $elemId.split('-')[2];
                console.log( 'Selected page(s) id: ' + $clonedPageId );
            }
        });
    });

</cms:script>


Do you know what to do with it?

Edit: A finer version of the script can be found here viewtopic.php?f=8&t=12042#p32994
possibly :?
I'm assuming i'd use it to do whatever to each k_page_id as it is selected, in this case add/remove tags?
So i can select the tags and whether to add or remove them then apply that to each gallery page as it is clicked. Or add them to list and loop through on add/remove. think i like the first one better.
If that's the case i think i can figure out that bit.

not sure how it links to your previous post. are they two different approaches?

trying to figure out back-end customisation so that I can add a field to content_form or content_form_list which lists all the tags. keep on getting lost in the docs..

sorry for my bumbling but this is at the limits of my couchability at the moment.

thank you
Unfortunately, it doesn't have anything to do with Couch, because as I said - this kind of customization is not documented or supported or ever planned. It's something deeply custom.

I am posting anything here because this topic gently touched a bit of my personal interest in modding things. However I don't have intentions of going deeper at the moment. Eventually you'll have to find courage to complete this on your own or ask someone (me included) to do it for you.

P.S. I modified the script so action fires only if page was selected and not deselected.
no worries, i understand.

believe me, if i was in a position to ask you (or anyone) to do this for me i would.

just feeling a bit stressed with it as it is final piece to website i'm finishing, which should lead to more lucrative work :D at which point i'll be buying licences & making donations. but all just words for now.

thanks for the ideas and gentle nudging, i think i'm going to go for a head clearing walk, and then dive back in. I'm sure i can feel the answer floating around the edges of my mind...

If & when i figure something out i'll let you know.
cheers,
gwil
11 posts Page 1 of 2
cron