By Fagault Eric on Friday, 22 December 2017
Posted in General
Replies 12
Likes 0
Views 743
Votes 0
Hello,
For added functionality I will use JS, should I load JS into the relevant file with the Joomla class ($ document-> addScript ('/ media / system / js / jquery.min.js'); or y-a- is there another method you would use already in easysocial?


How to call the jQuery library?

Best regards.
Eric
Hi there,

Yes it is possible for you to apply those method. If you wanted to use Easysocial, on how to attach your custom scripts, you can use the method below.

[gist type="php"]
$baseurl = JURI::root(true);
$uri = $baseurl . '/path_to_script/' . $file;

$scripts = ES::scripts();
$scripts->addScript($uri);
[/gist]

Hope this help
·
Friday, 22 December 2017 17:51
·
0 Likes
·
0 Votes
·
0 Comments
·
Thank you for your reply,
I add this in the file header?
(It's defaut.php of story)
Best regards.
Eric
·
Friday, 22 December 2017 18:17
·
0 Likes
·
0 Votes
·
0 Comments
·
Can you tell me where is the code that does the action when you click on "PUBLISH" in the stream?
·
Friday, 22 December 2017 18:23
·
0 Likes
·
0 Votes
·
0 Comments
·
Hey Eric,

If you are trying to render the jquery library from Joomla, you should use this:

[gist]
JHtml::_('jquery.framework');
[/gist]

As for your second question regarding 'publish', I don't really understand your question here. Can you please elaborate more on this please?
·
Friday, 22 December 2017 23:26
·
0 Likes
·
0 Votes
·
0 Comments
·
Hello,
Thanks a lot for your answers.

I created a small piece of code to stylize posts in the stream.

I added a column "style" to the table "social_stream" and I have to send the value in this column at the time of the click on the button "Publish"

Here is the code placed in the default.php file of templates \ protostar \ html \ com_easysocial \ story \ default.php


<div class = "mentions">
<div data-mentions-overlay data-default = "<? php echo $ this-> html ('string.escape', $ story-> overlay);?>"> <? php echo $ story-> overlay; ?> </ Div>
<textarea class = "es-story-textfield" name = "content" data-story-textField data-mentions-textarea
data-default = "<? php echo $ this-> html ('string.escape', $ story-> content);?>"
data-initial = "<? php echo ($ story-> overlay)? JString :: strlen ($ story-> overlay): '0';?>"
placeholder = "<? php echo $ nameUser; echo", ";?> <? php echo JText :: _ ('COM_EASYSOCIAL_STORY_PLACEHOLDER');?>"> <? php echo $ story-> content; ?> </ Textarea>

<! - Buttons "images" for style links, value to be sent in the "Style" column of the _es_stream table with the "Submit" button. ->
<input type = "hidden" id = "js-image-link-value" value = "" />
<img src = "images / styles / blue.png" class = "js-image-link" data-value = "blue" />
<img src = "images / styles / red.png" class = "js-image-link" data-value = "red" />

<Script>
var imageLinkValue = document.getElementById ('js-image-link-value');
var imageLinks = document.querySelectorAll ('. js-image-link');

function onImageLinkClick () {
imageLinkValue.value = this.getAttribute ('data-value');
}

Array.prototype.forEach.call (imageLinks, function (imageLink) {
imageLink.addEventListener ('click', onImageLinkClick.bind (imageLink));
});
</ Script>
<! - End of the "Images" buttons for the links of the styles, value to be sent in the "Style" column with the button. ->
</ Div>



I think about sending (with a _POST) the value to another PHP file that would write in the table, but I do not know if it's the best solution?

Best regards.

Eric
·
Saturday, 23 December 2017 15:44
·
0 Likes
·
0 Votes
·
0 Comments
·
I believe if you give the hidden input the name attribute, the story library would also send this data back to EasySocial and you can then manipulate the post data from within your app.

Anyway, please understand that as this is a customization question, we would not be able to further provide support on this as it is beyond the scope of our support.

Thanks for understanding!
·
Saturday, 23 December 2017 15:58
·
0 Likes
·
0 Votes
·
0 Comments
·
Hello,
First of all, I wish you a happy end-of-year party and thank you very much.

I really do not want to bore you with my idea.
It was because I thought that it would allow a greater commitment on the part of the members of the network.
And that it might be an idea to share later with the different users of Easysocial.

I'm trying to understand how to send the information in the table that the input contains using the name of this input.

Best regards.

Eric
·
Friday, 29 December 2017 21:41
·
0 Likes
·
0 Votes
·
0 Comments
·
Hey Eric,

You should take a look at the video app in /media/com_easysocial/apps/user/videos/videos.php as it would be the best place for you to see how it is sending the data when a user submits the story form.
·
Saturday, 30 December 2017 22:42
·
0 Likes
·
0 Votes
·
0 Comments
·
Hello,
As evoked in a previous exchange, I prepare a modification of the file, "... \ story \ default.php" to put a background in the messages of the stream.
Even following your advice, I can not transmit the value to the table at the time of the click on the publish button.

The "selection" part of the background works well, (Like this)

<input type = "hidden" name = "Style" id = "js-image-link-value" value = "" />
<img src = "images / styles / 24px / blue.jpg" class = "js-image-link" data-value = "blue" />
<img src = "images / styles / 24px / red.jpg" class = "js-image-link" data-value = "red" />


This code returns the name of a CSS class

Then a script:
<Script>
var imageLinkValue = document.getElementById ('js-image-link-value');
var imageLinks = document.querySelectorAll ('. js-image-link');
var mentions = document.querySelector ('. mentions');

// Create the class .mentions
function onImageLinkClick () {
var value = this.getAttribute ('data-value');
imageLinkValue.value = value;
document.querySelector classList.add (value) ( ​​'entries..');
// alert (value);
}
Array.prototype.forEach.call (imageLinks, function (imageLink) {
imageLink.addEventListener ('click', onImageLinkClick.bind (imageLink));
});
</Script>


But I can not pass the "value" in the table "social_stream" (I added a column "style" in this table)

I understand that this can not be done as part of the support, so can you tell me how much it would cost me to help me achieve that?

Best regards.

Eric
·
Monday, 08 January 2018 16:19
·
0 Likes
·
0 Votes
·
0 Comments
·
Hi there,

You can submit them on https://crm.stackideas.com and select "Customizations" . Our sales person would be glad to send you a quote for the customizations that you have requested.

We normally charge you $80 per hours. Please advice.
·
Monday, 08 January 2018 16:24
·
0 Likes
·
0 Votes
·
0 Comments
·
View Full Post