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

support ticket features #4055

Open
stdweird opened this issue Jan 8, 2025 · 14 comments
Open

support ticket features #4055

stdweird opened this issue Jan 8, 2025 · 14 comments

Comments

@stdweird
Copy link

stdweird commented Jan 8, 2025

I am trying out the ticket support and have some feature requests:

  • support form.yml.erb like the dashboard apps. i don't really like that this data ends up in the main config files, i prefer to be able to manage it like the other interactive apps forms
  • support form.js like the dashboard apps. i would like to add some dynamic things, and prefer not ot have to fork the email_service_template.html.erb (or inject the javascript via the description ;)
  • limit the number of CC addresses. i prefer that people don't try to mass mail eg all students in a class or so
  • allow html tags in the description page. they are now "escaped/encoded" by rails, but you can probably use .html_safe (like <%= support_ticket_description_text.html_safe %>)

Anyway, i am probably discovering this pretty late, but this could be a great addition to our site. Nice work!

@osc-bot osc-bot added this to the Backlog milestone Jan 8, 2025
@abujeda
Copy link
Contributor

abujeda commented Jan 8, 2025

For more complex requirements, you can override the template used to render the support ticket form:

support_ticket:
  ui_template: "my_custom_template"

The default location for the override is:
/etc/ood/config/apps/dashboard/views/support_ticket/my_custom_template.html.erb

And use the current implementation as a reference:
https://github.com/OSC/ondemand/blob/master/apps/dashboard/app/views/support_ticket/email_service_template.html.erb

@stdweird
Copy link
Author

stdweird commented Jan 8, 2025

@abujeda thanks. any idea how to include the default template (i am no erb expert). i only need to append some javascript to it, no other changes required

@abujeda
Copy link
Contributor

abujeda commented Jan 8, 2025

You should be able to by adding a render partial to the custom template:

# /etc/ood/config/apps/dashboard/views/support_ticket/my_custom_template.html.erb
<%= javascript_tag nonce: true do -%>
    const my_custom_js_here = true
<% end  %>

<%= render partial: 'support_ticket/email_service_template' %>

Do let us know if this works for you as we haven't try this option before.

@stdweird
Copy link
Author

stdweird commented Jan 8, 2025

@abujeda thanks

@stdweird
Copy link
Author

stdweird commented Jan 8, 2025

@abujeda hmm, the partial render looks for file prefixed with _ it seems. i get There was an error processing your request: Missing partial support_ticket/_email_service_template

@abujeda
Copy link
Contributor

abujeda commented Jan 8, 2025

Ahh yes. email_service_template is not a partial. Let me see if there is an alternative

@abujeda
Copy link
Contributor

abujeda commented Jan 8, 2025

Try updating partial to file:

# /etc/ood/config/apps/dashboard/views/support_ticket/my_custom_template.html.erb
<%= javascript_tag nonce: true do -%>
    const my_custom_js_here = true
<% end  %>

<%= render file: 'support_ticket/email_service_template' %>

@stdweird
Copy link
Author

stdweird commented Jan 8, 2025

There was an error processing your request: render file: should be given the absolute path to a file.
with the fullpath i get verbatim data (as expected from the docs)

@stdweird
Copy link
Author

stdweird commented Jan 8, 2025

i symlinked the email_service_template to _email_service_template and then the partial works. it's at least easier to maintain then to fork the full email_service_template code.

@abujeda
Copy link
Contributor

abujeda commented Jan 8, 2025

Sorry for the back and forth, I should have tried myself before making the comment.
This works for me and does not require the symlink (using template instead):

<%= javascript_tag nonce: true do -%>
  const my_custom_js_here = true
<% end  %>

<%= render template: 'support_ticket/email_service_template' %>

@stdweird
Copy link
Author

stdweird commented Jan 8, 2025

@abujeda awesome. thanks for helping out

@stdweird
Copy link
Author

stdweird commented Jan 8, 2025

@abujeda i added supporting html tags in the description. maybe you know some other magic to achieve the same without having to touch the original email_service_template ;)

@johrstrom
Copy link
Contributor

You can redefine any partial following these instructions. This new file you provide in /etc/ood will override the one provided in /var/www so it's upgrade safe because you don't edit the original file.

https://osc.github.io/ood-documentation/latest/customizations.html?#overriding-pages

@stdweird
Copy link
Author

stdweird commented Jan 8, 2025

@johrstrom yes, @abujeda mentioned how to do this. but i only want to add some javascript like the apps forms do, not sure that is so unique to my case (and the description not being considered html safe is probably a bug anyway).

anyway, i'll manage. thanks again for all the work that went into it

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

No branches or pull requests

5 participants