Skip to content

Commit

Permalink
Add SMS and field hiding/showing for "What" fields
Browse files Browse the repository at this point in the history
  • Loading branch information
luigi committed Jun 16, 2010
1 parent 6871638 commit 55d6054
Showing 1 changed file with 33 additions and 2 deletions.
35 changes: 33 additions & 2 deletions geocron/web/templates/rules.html
Expand Up @@ -48,12 +48,27 @@ <h1>Ruleset for {{ g.user['firstname'] }} {{ g.user['lastname'] }}</h1>
<label>Send: </label>
<select name="action_type" id="action_type">
<option value="email">Email</option>
<option value="sms">SMS</option>
<option value="webhook">Webhook POST</option>

</select><br />
<label>To: </label>
<input type="text" name="recipient" length="30" /><br />
<div id="what_message">
<label>Message: </label>
<input type="text" name="message" length="30" />
</div>
<div id="what_carrier" style="display:none;">
<label>Carrier: </label>
<select name="carrier" id="carrier">
<option value="att">AT&amp;T</option>
<option value="boost">Boost</option>
<option value="sprint">Sprint</option>
<option value="tmobile">T-Mobile</option>
<option value="verizon">Verizon</option>
<option value="virgin">Virgin</option>
</select>
</div>
</td>
<td>
<input type="submit" value="Create Rule" />
Expand All @@ -63,9 +78,9 @@ <h1>Ruleset for {{ g.user['firstname'] }} {{ g.user['lastname'] }}</h1>
{% for rule in user['rules'] %}
<tr>
<td>{{ rule.name }}</td>
<td>{{ rule.address }} {{ rule.location[0] }}/{{ rule.location[1] }}</td>
<td>{{ rule.address|truncate(20,true) }}</td>
<td>{{ rule.days }} - {{ rule.times }}</td>
<td>{{ rule.action_type }} to {{ rule.recipient|truncate(30) }}</td>
<td>{{ rule.action_type }} to {{ rule.recipient|truncate(20,true) }}</td>
<td>&nbsp;</td>
</tr>
{% endfor %}
Expand Down Expand Up @@ -112,6 +127,22 @@ <h1>Ruleset for {{ g.user['firstname'] }} {{ g.user['lastname'] }}</h1>
}

$(function(){

$('select#action_type').change(function() {
if (this.value == 'email') {
$('div#what_message').show();
$('div#what_carrier').hide();
}
if (this.value == 'sms') {
$('div#what_message').show();
$('div#what_carrier').show();
}
if (this.value == 'webhook') {
$('div#what_message').hide();
$('div#what_carrier').hide();
}
});

if (GBrowserIsCompatible()) {
$(document).bind('unload', GUnload);

Expand Down

0 comments on commit 55d6054

Please sign in to comment.