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 / sso_custom_field.txt
Last active August 29, 2015 13:56
detect custom field on customer object set from the SSO/Desk Auth in web theme.
{% if portal.authentication_enabled %}
{% if current_user.customer.custom_user_type == 'Student' %}
content for students who are logged into the support portal
{% elsif current_user.customer.custom_user_type == 'Teacher' %}
content for Teachers who are logged into the support portal
{% else %}
display error message
{% endif %}
{% endif %}
@rruhlen
rruhlen / ignore_topic.txt
Last active August 29, 2015 13:56
how to ignore and detect a topic when looping through the topic array. Also included is an if/else statement which allows you to do both in the for loop and style each HTML it spits out differently.
{% if topics_count > 0 %}
{% for topic in topics %}
{% if topic.article_count > 0 %}
{% unless topic.id == 393291 %}
HTML goes here
{% endunless %}
{%endif%}
{% endfor %}
{%endif%}
@rruhlen
rruhlen / label_dropdown.txt
Created February 13, 2014 16:41
drop-down for for passing in a label when a case is created. you allow the user to choose what label gets applied to the case they are creating.
<select name="ticket[labels_new]" id="ticket_labels_new">
<option value="General">General</option>
<option value="Billing">Billing & Refunds</option>
<option value="Account">Account & Login Issues</option>
<option value="">Other</option>
</select>
@rruhlen
rruhlen / drop-down_localize.txt
Created February 21, 2014 00:27
how to hard-code a custom field of type list so you can apply snippets for localizing.
<select class="default xl" id="ticket_custom_topic" name="ticket[custom_topic]">
<option value="">{{system.snippets.wx2_select_one}}</option>
<option value="Getting Started">{{system.snippets.wx2_getting_started}}</option>
<option value="Conversations">{{system.snippets.wx2_conversations}}</option>
<option value="Meetings">{{system.snippets.wx2_meetings}}</option>
<option value="Searching &amp; Adding Contacts">{{system.snippets.wx2_searching_and_adding_contact}}</option>
<option value="Smartphone Use">{{system.snippets.wx2_smartphone_use}}</option>
<option value="Other">{{system.snippets.wx2_other}}</option>
<option value="">{{system.snippets.wx2_tablet_or_ipad_use_coming_so}}</option>
<option value="">{{system.snippets.wx2_telepresence_use_coming_soon}}</option>
@rruhlen
rruhlen / split_name_field.txt
Created March 10, 2014 18:54
splitting default name field into the first and last name fields on the customer record.
<div class='input-block'>
<span class='label'>
First Name <span>({{system.snippets.required}})</span>
</span>
<div>
<input value='{{ customer.first_name }}' id='customer_first_name' maxlength='100' name='customer[first_name]' type='text' />
</div>
</div>
<div class='input-block'>
<span class='label'>
@rruhlen
rruhlen / liquid_example.txt
Created March 12, 2014 19:51
display if page is not email (new) page
{% if page != 'email_new' %}
code goes here
{% endif %}
@rruhlen
rruhlen / case_priority.txt
Created April 21, 2014 19:59
Set priority on case from email form. Field is hidden and can be set with JS.
<input type="hidden" name="ticket[priority]" id="ticket_priority" value="">
@rruhlen
rruhlen / dc_link.txt
Created April 25, 2014 18:43
Code to display direct customer record link in the customer theme. Not needed if on default theme.
@rruhlen
rruhlen / brand_dependent.txt
Last active August 29, 2015 14:00
display fields in case theme depending on the brand.
{% if case.custom_brand == 'Brand 1' %}
<div class="agent_ticket_section">
<div>
{{custom_field1}}
</div>
@rruhlen
rruhlen / set_brand.txt
Last active August 29, 2015 14:00
detect brand on email form and set the value in a hidden custom field.
<select id="ticket_custom_brand" name="ticket[custom_brand]" style="display:none;">
<option value="{{desk.current_brand.name}}">{{desk.current_brand.name}}</option>
</select>