Skip to content

Instantly share code, notes, and snippets.

View DeskWOW's full-sized avatar

Desk.com Customer WOW Team DeskWOW

View GitHub Profile
@DeskWOW
DeskWOW / gist:d1e5b8f0546d62c1c037
Created February 9, 2015 14:29
How to modify your single email widget to allow previewing new form code -- https://your-site.desk.com/customer/widget/emails/new?ticket[labels_new]=preview
{% if ticket.labels_new == "preview" %}
This is where your new form's code would go.
{% else %}
<div class="customer_widget" id="customer_widget_main">
<div class="inside_title" style="font-size:25px"><img src=
"http://www.ebookconversion.biz/images/coffeecup_logo_banner_b.jpg"></div>
<div class="inside_desc">
CONTACT BOOKNOOK.BIZ NOW!
</div>
<script src="//desk-customers.s3.amazonaws.com/shared/default/js/jquery.customSelect.min.js" type="text/javascript"></script>
@DeskWOW
DeskWOW / gist:abc4c9864638898c7efc
Last active August 29, 2015 14:14
Case theme: Reveal custom field(s) based on custom field(s)
{% if case.custom_brand == "ABC Clothing Store" %}
<div class="agent_ticket_section">
{{custom_shirt_size}}
</div>
{% endif %}
@DeskWOW
DeskWOW / gist:7a791ddee4e776eea492
Last active August 29, 2015 14:13
Barebones reply theme with no history
{% assign emails = case.emails %}{% assign threadlength = emails.size|minus:1 %} {% for email in emails reversed %}{% if forloop.first %}{{email.new_html}}{% if email.agent %}{% if email.agent.signature %}<div style="margin-top:10px;">{{email.agent.signature | newline_to_br}}</div>{% else %}<p>--<br/>{{email.agent.signature | newline_to_br}}
<br /></p>{% endif %}{% endif %}{% endif %}{% endfor %}
@DeskWOW
DeskWOW / gist:53b9c9d8deafbbc39a41
Created January 21, 2015 13:43
Add labels to a case from support center contact form
$(".input-block select, .input-block input, .input-block textarea").on("change keyup", function() {
$("ticket_labels_new").val("");
var labels = [];
if ($("#div-inquiry-type select").val() == "Mobile App Support" && $("#div-platform select").val() == "Apple iPad" && $("#div-app select").val() == "Big Cat Week: Quest for Survival") {
labels.push("T- Channel");
}
if ($("#div-inquiry-type select").val() == "Mobile App Support" && ($("#div-platform select").val() == "Apple iPad" || $("#div-platform select").val() == "Apple iPhone or iPod Touch" || $("#div-platform select").val() == "Android Phone (any)" || $("#div-platform select").val() == "Android Tablet (any)") && $("#div-app select").val() == "Nat Geo TV") {
labels.push("T- Channel");
@DeskWOW
DeskWOW / require_dropdowns.js
Created January 8, 2015 02:19
An example of adding list case custom fields to your contact form and making them required.
<!-- HTML -->
<div class="form-group div-category">
<label for="ticket_custom_category" class="control-label">Category ({{system.snippets.required}}):</label>
{{ ticket_custom_category }}
</div>
<div class="form-group div-favorite-color">
<label for="customer_custom_favorite_color" class="control-label">Favorite Color ({{system.snippets.required}}):</label>
{{ customer_custom_favorite_color }}
</div>
@DeskWOW
DeskWOW / gist:3833990e38bc53de67ff
Created November 25, 2014 15:53
Ask users their first name and last name separately on contact form (instead of 'full name').
<!-- Example form HTML -->
<div class="row">
<div class="col-md-6">
<div class="form-group">
<label for="s-first-name" class="control-label">First Name <span class="required">*</span></label>
<input tabindex="1" id="s-first-name" class="form-control" maxlength="100" name="s-first-name" type="text">
</div>
</div>
<div class="col-md-6">
<div class="form-group">
@DeskWOW
DeskWOW / gist:d73f1242724ac8aedc41
Created November 19, 2014 17:27
If article doesn't have translation, redirect to default translation
{% if article == null %}
<script>
article_id = window.location.href.split("/portal/articles/")[1].split("-")[0];
window.location = "https://my-site.desk.com/customer/portal/articles/" + article_id;
</script>
{% endif %}
@DeskWOW
DeskWOW / mycases.js
Last active August 29, 2015 14:09 — forked from tstachl/mycases.js
(function($) {
function nextPage(url, callback) {
$.get(url, function(data, textStatus, jqXHR) {
var cases = $(data).find('.mycases tbody tr')
, nextUrl = $(data).find('#pagination a.next_page');
callback(cases);
if (nextUrl && nextUrl.attr('href')) nextPage(nextUrl.attr('href'), callback);
}, 'html');
@DeskWOW
DeskWOW / mycases.js
Last active August 29, 2015 14:09 — forked from tstachl/mycases.js
(function($) {
function nextPage(url, callback) {
$.get(url, function(data, textStatus, jqXHR) {
var cases = $(data).find('.mycases tbody tr')
, nextUrl = $(data).find('#pagination a.next_page');
callback(cases);
if (nextUrl && nextUrl.attr('href')) nextPage(nextUrl.attr('href'), callback);
}, 'html');