Skip to content
New issue

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

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

REQUEST: Add new FILTERs to conversations/view.blade.php for Conversations Toolbar #4279

Closed
jshrek opened this issue Oct 9, 2024 · 8 comments

Comments

@jshrek
Copy link

jshrek commented Oct 9, 2024

Based on FreeScout v1.8.154 I would like to request the following additional two filters be added to :
/resources/views/conversations/view.blade.php

conversation.toolbar.convinfo.before
conversation.toolbar.convinfo.after

These will allow you add HTML code in the conf-info area of conversations toolbar before ASSIGNEE or after STATUS.
screenshot

For the code, I am not sure if this is the proper way to do it, but I modified view.blade.php and it works.

See line 75 and 126 for the changes in attached view.blade.php:
view.blade.php.txt

freescout-help-desk added a commit that referenced this issue Oct 9, 2024
…fore_nav - closes #4279
@freescout-help
Copy link
Collaborator

Two actions added (conversation.convinfo.prepend and conversation.convinfo.before_nav) and will be published in the next release.

@jshrek
Copy link
Author

jshrek commented Oct 9, 2024

I want to insert additional HTML at those locations, which is why I used a Filter.
How can I add HTML with an Action, as there is nothing returned?

@freescout-help
Copy link
Collaborator

See "Actions and Filters" in the Guide: https://github.com/freescout-help-desk/freescout/wiki/Modules-Development

@jshrek
Copy link
Author

jshrek commented Oct 9, 2024

Ok, well maybe I am not understanding how an Action works, but how can I modify the toolbar html (to add another button) with an action?
The action simple sends me $conversation and $mailbox, but nothing I do with these will allow me to add another button to the toolbar.
The filter I setup in the example, adds empty quotes (so nothing) to the toolbar by default, but if I hook the filter, I can return HTML code to add another button and/or text to the toolbar.

@ilyakonovalenko
Copy link
Contributor

Ok, well maybe I am not understanding how an Action works, but how can I modify the toolbar html (to add another button) with an action?

You have to develop custom module where actions and hooks can be used to insert HTML content. It is the only proper way to add something to the FreeScout web interface.

@jshrek
Copy link
Author

jshrek commented Oct 11, 2024

Yes, I have created custom module.
If you insert a FILTER into those two locations, then I can use the filter in MyModuleServiceProvider in the public function hooks like this:

\Eventy::addFilter('conversation.convinfo.prepend', function($data) {
            return $data."<li><div class='btn-group'>ADD A BUTTON TO TOOLBAR</div></li>";
        }, 20, 1);

However, you have added ACTIONS not filters, so since an action does not return anything back to where is was fired from, there is no way for me to add a new button to the toolbar. Again, if I am mis-understanding how actions work, please correct me.

@jshrek
Copy link
Author

jshrek commented Oct 11, 2024

Okay, so with the Action I figured out I can ECHO what I want to insert.

Is this the correct way to do this?

\Eventy::addAction('conversation.convinfo.prepend', function($data) {
            echo "<li><div class='btn-group'>ADD A BUTTON TO TOOLBAR</div></li>";
        }, 20, 1);

@freescout-help
Copy link
Collaborator

Yes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants