CB Activity new use for spots display

10 months 6 days ago #327219 by activha
Replied by activha on topic CB Activity new use for spots display
Thanks a lot for all this and for your time !

I'll try on my local dev site and will try to find a good php developer for the sql and js part.

Will let you know of our progresses.
The following user(s) said Thank You: krileon

Please Log in to join the conversation.

10 months 6 days ago - 10 months 6 days ago #327223 by activha
Replied by activha on topic CB Activity new use for spots display
I have just three last questions before starting :

How can I place the new button in first position ?
(I mean that this could be cool to order the buttons and have the activities displayed in the buttons ordered, so that it does not always state user has uploaded x files as soon as gallery is used)

Can I use and call a new cb gallery field also called by the new button in another input to store the images in a new folder ?

I tried to change the asset with the following; is it the way to do it with activity_onAfterCreateStreamActivity instead of activity_onBeforeCreateStreamActivity
$variables['var3']->asset->set('profile.[user_id].activation.[cb:userdata field="cb_marketevents" /]');

Please Log in to join the conversation.

10 months 6 days ago #327228 by krileon
Replied by krileon on topic CB Activity new use for spots display

How can I place the new button in first position ?

Convert it to a flexbox display using CSS and then change their order. This will let you reorder them entirely with CSS. Otherwise you'll need to change the PHP to push it to the beginning of the button left array.

developer.mozilla.org/en-US/docs/Web/CSS/flex
developer.mozilla.org/en-US/docs/Web/CSS/order

Example as follows.

.cb_template .activityContainerFooterRowLeft {
	display: flex;
	gap: 0.25rem;
}

.cb_template .activityContainerFooterRowLeft > * {
	order: 1;
}

.cb_template .activityContainerFooterRowLeft > .streamInputCUSTOM {
	order: 0;
}

For buttons it's probably even easier to just reverse the display entirely.

developer.mozilla.org/en-US/docs/Web/CSS/flex-direction

Example as follows.

.cb_template .activityContainerFooterRowLeft {
	display: flex;
	gap: 0.25rem;
	flex-direction: row-reverse;
}

Can also be done using CSS grid if you need to support browsers older than Safari 14.

.cb_template .activityContainerFooterRowLeft {
	display: grid;
	grid-auto-flow: column;
	gap: 0.25rem;
}

.cb_template .activityContainerFooterRowLeft > * {
	order: 1;
}

.cb_template .activityContainerFooterRowLeft > .streamInputCUSTOM {
	order: 0;
}

(I mean that this could be cool to order the buttons and have the activities displayed in the buttons ordered, so that it does not always state user has uploaded x files as soon as gallery is used)

Same situation as the input order. Change it to flex and use the order CSS rule. No code necessary.

Can I use and call a new cb gallery field also called by the new button in another input to store the images in a new folder ?

I would recommend implementing your own upload and storage behavior. I guess you can technically toggle the CB Gallery upload form open as well, but that's not going to create a server side dependency on it; you'd need to add that validation in your storage behavior to make sure activity save fails if they didn't upload something.

To do this you need to adjust the value of "data-cbactivity-toggle-target", which is set by $buttonTarget. Something like the below.

FROM:
data-cbactivity-toggle-target=".' . htmlspecialchars( $buttonTarget ) . '"
TO:
data-cbactivity-toggle-target=".streamInputUpload,.' . htmlspecialchars( $buttonTarget ) . '"

That should cause it to toggle open CB Gallery as well.

I tried to change the asset with the following; is it the way to do it with activity_onAfterCreateStreamActivity instead of activity_onBeforeCreateStreamActivity

asset is just a string. It's not an object and doesn't have a set function. Either set it as a string or call the set function for the activity object.

$variables['var3']->set( 'asset', 'profile.[user_id].activation.[cb:userdata field="cb_marketevents" /]' );


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.
The following user(s) said Thank You: activha

Please Log in to join the conversation.

10 months 5 days ago #327233 by activha
Replied by activha on topic CB Activity new use for spots display
Very clever with the css ! This begins to develop ;-)

I'll try to find a developer for the DB and other features but that's not easy to find someone good on joomla.

For now and for first tests waiting for CB 6 beta, I only added for validation :
$variables['var5'] = $content . $variables['var5'];
if('[var1_params_gallery]' <= 0) echo '<div class="text-danger">Attention ajoutez des photos pour cette activation !</div>';
if('[var1_params_location]' <= 0) echo '<div class="text-danger">Attention précisez le lieu de cette activation !</div>';
in the display auto action on activity_onDisplayStreamActivity

I'll try to have a functional proof of concept ready enough for people to get to develop cleverly.

Regarding the save and display function, I managed to have it work well.

For the edit and save on edit I guessed that I needed two other auto actions with activity_onDisplayStreamActivityEdit and onBeforeUpdateStreamActivity and managed to change the classes to adapt.

But for these two triggers, I noticed that it's impossible to edit or add images, only to suppress existing ones. The gallery button is also not present when editing.

Do I miss something ? is this the standard behavior ?

Please Log in to join the conversation.

10 months 5 days ago #327234 by krileon
Replied by krileon on topic CB Activity new use for spots display

For the edit and save on edit I guessed that I needed two other auto actions with activity_onDisplayStreamActivityEdit and onBeforeUpdateStreamActivity and managed to change the classes to adapt.

For editing yeah it's a bit more annoying. You'll need a copy of your auto action and to use activity_onDisplayStreamActivityEdit. Then change the reference variable and the button variable from var1 to var2. I'll be fixing this in 6.0.0 by sending an empty activity object to activity_onDisplayStreamActivityNew so the variable counts line up and you won't have to double code anymore. 6.0.0 will be making significant changes to triggers so some minor adjustments in your usage will be needed later down the road, but won't be significant. As for saving yes just add onBeforeUpdateStreamActivity to your save auto action; you don't need a copy for that one.

But for these two triggers, I noticed that it's impossible to edit or add images, only to suppress existing ones. The gallery button is also not present when editing.

Do I miss something ? is this the standard behavior ?

Correct, the CB Gallery implementation doesn't allow adding uploads to an existing entry. This will be changed in 6.0.0. So that is indeed working as intended. Also why I said it'd be best for you to fully implement your own upload and storage workflows so it matches exactly what you need.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in to join the conversation.

10 months 5 days ago #327239 by activha
Replied by activha on topic CB Activity new use for spots display

Also why I said it'd be best for you to fully implement your own upload and storage workflows so it matches exactly what you need.


After beginning to test the power of CB Activity, I think that a different storage may be not the best for me. In reality this is the action itself which is really interesting with a location associated.
As soon as a user clicks on the new button, its intention is to share a video with someone/some business on our website. So adding pictures, movies is a real bonus but that may be not compulsory with CB Activity instead of com_hotspots. The user can always come back and add location, pictures, themes, ideas, links later on.
That's why I begin to think that Gallery with CB Activity version 6 may work very well.

In this case I'll try to find a dev for enhancing the single activity page on which we'll try to display all sort of info/IA from the web related to the entry to help our users.

Will show you the concept on the devel website once we have CB Activity 6 beta

For now I have some other questions and a few suggestions :

Questions :
How can I condition the save auto action with [var1_params_custom] or [post_var1_params_custom] not empty ? I tried >0, not empty not egal to «  » without success

How can I validate inputs before posting (for instance to make the location compulsory if first button is clicked)

Can I define another folder/album for gallery images/files instead of imports on my save auto action ? say with the name snapshots

Suggestions for version 6 :
Add a modal map when clic on find me to allow the user to position the pointer elsewhere, and also display all locations on an external map page

Add ability to change images in CB 6, upload new ones and enhance the upload area with other font awesome buttons

Add a search box to find activities with keywords ?

If no location name is inputted but only coordinates thanks to the find me button, insert a default « is here » language string. For now coordinates are saved but nothing is displayed

Add the ability to slide the activity to display it in an external page ? As it’s a card it should be possible to link the whole card and 80% is viewed now on mobile


Thanks for all so far ;-)

Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.183 seconds

Facebook Twitter LinkedIn