Commit 14499f50 authored by Joseph Lacey's avatar Joseph Lacey

Adding UI improvement for clearer targetting and less interface clutter.

parent d38e36a9
......@@ -3,6 +3,20 @@ cj(document).ready( function() {
populateUserFieldOptions();
cj("input#email_petition").click( function() { showHideEmailPetition(); });
cj("#profile_id").change( function() { populateUserFieldOptions(); });
cj('.petitionemail-matching-group_id :input').each( function () {
if (cj(this).val() > 0) {
cj("input.target-group").prop("checked", true);
}
});
if (cj('#recipients').val() != '') {
cj("input.target-individuals").prop("checked", true);
}
showHideTargetGroup();
showHideTargetIndividuals();
cj("input.target-group").click( function() { showHideTargetGroup(); });
cj("input.target-individuals").click( function() { showHideTargetIndividuals(); });
});
function populateUserFieldOptions() {
......@@ -49,3 +63,18 @@ function showHideEmailPetition() {
cj("tr.crm-campaign-survey-form-block-recipient_options").hide("fast");
}
}
function showHideTargetGroup() {
if (cj("input.target-group").prop("checked")) {
cj(".petition-email-target-group").show();
} else {
cj(".petition-email-target-group").hide();
}
}
function showHideTargetIndividuals() {
if (cj("input.target-individuals").prop("checked")) {
cj(".petition-email-target-individuals").show();
} else {
cj(".petition-email-target-individuals").hide();
}
}
......@@ -30,52 +30,60 @@
<div class="petitionemail-recipient-options">
<div class="petition-email-recipient-option-description">{ts}You must specify who will receive a copy of the petition using at least one of the methods below. You may also use both methods if you would like one set of recipients to receive all petitions signed and another set of recipients to be chosen dynamically.{/ts}</div>
<h3 class="petition-email-header">Dynamic Method</h3>
<label for="target-group">Target a Group (Dynamic Method)</label>
<input name="target-group" value="1" class="crm-form-checkbox target-group" type="checkbox">
<label for="target-individuals">Target Individuals (Static Method)</label>
<input name="target-individuals" value="2" class="crm-form-checkbox target-individuals" type="checkbox">
<div class="petition-email-recipient-option-description">The dynamic method allows you to choose different petition recipients depending on who is filling out the petition. To use the dynamic method, you must first put your targets into a group. Then specify the group below, and the field that must match between the person filling out the petition and the target contact. You can choose up to three group/field combinations.</div>
<table id="petition-email-dynamic-method">
<tr>
<td>{ts}Target Group{/ts}</td>
<td></td>
<td>{ts}Matching field{/ts}</td>
</tr>
<tr>
<td class="view-value">
<div class="petitionemail-matching-group_id">{$form.matching_group_id1.html}</div>
<div class="petitionemail-matching-group_id">{$form.matching_group_id2.html}</div>
<div class="petitionemail-matching-group_id">{$form.matching_group_id3.html}</div>
</td>
<td>
<div class="petitionemail-use-with">{ts}match using:{/ts}</div>
<div class="petitionemail-use-with">{ts}match using:{/ts}</div>
<div class="petitionemail-use-with">{ts}match using:{/ts}</div>
</td>
<td class="view-value">
<div class="petitionemail-matching-fields">{$form.matching_field1.html}</div>
<div class="petitionemail-matching-fields">{$form.matching_field2.html}</div>
<div class="petitionemail-matching-fields">{$form.matching_field3.html}</div>
</td>
</tr>
<tr>
<td colspan="3" class="description">{ts}Select the group containing the contacts that you want to receive the petition along with the field that should match between the petition signer and the target in this group. If the user and the target have the same value for this field, then the user's petition will be sent to the matching target.{/ts}
{if $petitionemail_matching_fields_count eq 0}
{ts}No fields are configured to be used as matching fields. Please <a target="_blank" href="{$petitionemail_profile_edit_link}">add fields to the petitionemail profile</a>.{/ts}
{else}
{ts}Don't see the field you want to use? You can <a target="_blank" href="{$petitionemail_profile_edit_link}">add more fields to the petitionemail profile</a> and they will show up here.{/ts}
{/if}
</td>
</tr>
</table>
<div class="label">{$form.location_type_id.label}</div>
<div class="view-value">{$form.location_type_id.html}</div>
<div class="description">{ts}A target contact can have more than one email address. Choose the email location that should be preferred when sending the petition. If blank, or the preferred location is not available for the target, the primary email address will be used.{/ts}</div>
<div class="petition-email-target-group">
<h3 class="petition-email-header">Target a Group (Dynamic Method)</h3>
<h3 class="petition-email-header">Static Method</h3>
<div class="label">{$form.recipients.label}</div>
<div class="view-value">{$form.recipients.html}</div>
<div class="description">{ts}Enter targets that receive copies of all petitions in the form: 'First name Last name' &lt;email@example.org&gt;. Put each recipient on a separate line.{/ts}</div></td>
<div class="petition-email-recipient-option-description">The dynamic method allows you to choose different petition recipients depending on who is filling out the petition. To use the dynamic method, you must first put your targets into a group. Then specify the group below, and the field that must match between the person filling out the petition and the target contact. You can choose up to three group/field combinations.</div>
<table id="petition-email-dynamic-method">
<tr>
<td>{ts}Target Group{/ts}</td>
<td></td>
<td>{ts}Matching field{/ts}</td>
</tr>
<tr>
<td class="view-value">
<div class="petitionemail-matching-group_id">{$form.matching_group_id1.html}</div>
<div class="petitionemail-matching-group_id">{$form.matching_group_id2.html}</div>
<div class="petitionemail-matching-group_id">{$form.matching_group_id3.html}</div>
</td>
<td>
<div class="petitionemail-use-with">{ts}match using:{/ts}</div>
<div class="petitionemail-use-with">{ts}match using:{/ts}</div>
<div class="petitionemail-use-with">{ts}match using:{/ts}</div>
</td>
<td class="view-value">
<div class="petitionemail-matching-fields">{$form.matching_field1.html}</div>
<div class="petitionemail-matching-fields">{$form.matching_field2.html}</div>
<div class="petitionemail-matching-fields">{$form.matching_field3.html}</div>
</td>
</tr>
<tr>
<td colspan="3" class="description">{ts}Select the group containing the contacts that you want to receive the petition along with the field that should match between the petition signer and the target in this group. If the user and the target have the same value for this field, then the user's petition will be sent to the matching target.{/ts}
{if $petitionemail_matching_fields_count eq 0}
{ts}No fields are configured to be used as matching fields. Please <a target="_blank" href="{$petitionemail_profile_edit_link}">add fields to the petitionemail profile</a>.{/ts}
{else}
{ts}Don't see the field you want to use? You can <a target="_blank" href="{$petitionemail_profile_edit_link}">add more fields to the petitionemail profile</a> and they will show up here.{/ts}
{/if}
</td>
</tr>
</table>
<div class="label">{$form.location_type_id.label}</div>
<div class="view-value">{$form.location_type_id.html}</div>
<div class="description">{ts}A target contact can have more than one email address. Choose the email location that should be preferred when sending the petition. If blank, or the preferred location is not available for the target, the primary email address will be used.{/ts}</div>
</div>
<div class="petition-email-target-individuals">
<h3 class="petition-email-header">Target Individuals (Static Method)</h3>
<div class="label">{$form.recipients.label}</div>
<div class="view-value">{$form.recipients.html}</div>
<div class="description">{ts}Enter targets that receive copies of all petitions in the form: 'First name Last name' &lt;email@example.org&gt;. Put each recipient on a separate line.{/ts}</div>
</div>
</td>
</div>
</td>
</tr>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment