Skip to content

Instantly share code, notes, and snippets.

View rruhlen's full-sized avatar

Ricky Ruhlen rruhlen

  • San Francisco, CA
View GitHub Profile
@rruhlen
rruhlen / cases_reports.json
Created April 3, 2018 17:39
JSON to post to insights3/cases_reports endpoint.
{
"fields": [
"channel_id",
"status_id",
"user_id",
"group_id",
"priority",
"created_at",
"time_to_first_response",
"avg_time_to_resolution",
@rruhlen
rruhlen / recaptcha.js
Created February 28, 2018 00:02
jQuery to move captcha to another location on the Desk email widget
<script type="text/javascript">
$(document).ready(function() {
$(".g-recaptcha").insertBefore("<field>");
});
</script>
@rruhlen
rruhlen / email_notes
Created February 12, 2018 19:32
loop through all email and note interactions
{% for obj in case.emails_and_notes %}
{{ obj }}
{% endfor %}
@rruhlen
rruhlen / article-ratings.js
Created February 7, 2018 23:35
Insert brand id parameter to article rating liquid block. Fixes issue where the default brand has a CNAME and the other brands need to use the Desk subdomain.
<!-- fix multibrand issue with article rating links -->
{% capture tempfix %}rate?b_id={{desk.current_brand.id}}&{% endcapture %}
{{ rate_block | replace: "rate?", tempfix}}
@rruhlen
rruhlen / 01 - desk-external-variables
Last active November 8, 2017 20:42
Attach multiple files to a Desk email form. Input fields must be generated on the fly and can't be hard-coded on the page.
<!-- add to desk-external-variables div -->
<div id="max_number_attachments">{{desk.system.max_attachments}}</div>
<div id="system-snippets-add_attachment">{{system.snippets.add_attachment}}</div>
@rruhlen
rruhlen / 01 - header
Created August 16, 2017 01:40
Video Support Portal Theme for Desk.com
{% if desk.apps.get_satisfaction.enabled %}
{{ gsinit }}
{% endif %}
{% if favicon.size > 0 %}
<link rel="SHORTCUT ICON" type='image/ico' href='{{favicon}}' />
<link rel="icon" type='image/png' href='{{favicon}}' />
{% else %}
<link rel="icon" type='image/vnd.microsoft.icon' href='{{ "/favicon.ico" | portal_image_url: image_asset_host }}' />
<link rel="icon" type='image/png' href='{{ "/favicon.png" | portal_image_url: image_asset_host }}' />
@rruhlen
rruhlen / gist:a1ee8857bc822f425541be5de55ee19c
Last active July 4, 2017 02:14
Custom Action to create a new email case. POST to /api/v2/customers/{{case.customer.id}}/cases.
{
"type": "email",
"subject": "Follow up for case {{case.id}}",
"priority": "{{case.priority}}",
"status": "open",
"labels": [
"Demo Followup"
],
"custom_fields": {
"case_id": "{{case.id}}"
@rruhlen
rruhlen / link.json
Last active August 8, 2017 17:40
Custom Action to link two cases. Change the key to what you specified when creating the custom field. POST to /api/v2/cases/{{case.id}}/links.
@rruhlen
rruhlen / article-ratings.js
Last active June 27, 2017 20:25
Insert custom snippets to translate article ratings and confirmation message.
<script type="text/javascript">
$(function() {
$("#rate_article div:nth-child(1) a").html("{{ system.snippets.yes }}");
$("#rate_article div:nth-child(2) a").html("{{ system.snippets.no }}");
});
@rruhlen
rruhlen / company.js
Created June 26, 2017 23:10
Grab company GET parameter.
<script type="text/javascript">
$(function() {
var getUrlParameter = function getUrlParameter(sParam) {
var sPageURL = decodeURIComponent(window.location.search.substring(1)),
sURLVariables = sPageURL.split('&'),
sParameterName,
i;