112 lines
3.3 KiB
Plaintext
112 lines
3.3 KiB
Plaintext
<h2><%= t(:channel_edit) %></h2>
|
|
|
|
<%= form_for @channel, :html => {:method => 'put'} do |d| %>
|
|
<%= error_messages_for 'channel', :header_message => t(:try_again), :message => t(:channel_error) %>
|
|
<input name='userlogin' class='userlogin' />
|
|
<table>
|
|
<tr>
|
|
<td><%= t(:channel_name) %></td>
|
|
<td><%= d.text_field :name %></td>
|
|
</tr>
|
|
<tr>
|
|
<td><%= t(:channel_description) %></td>
|
|
<td><%= d.text_field :description %></td>
|
|
</tr>
|
|
<tr>
|
|
<td><%= t(:api_key) %></td>
|
|
<td><%= @key %></td>
|
|
</tr>
|
|
<tr>
|
|
<td><%= t(:latitude) %></td>
|
|
<td><%= d.text_field :latitude %></td>
|
|
</tr>
|
|
<tr>
|
|
<td><%= t(:longitude) %></td>
|
|
<td><%= d.text_field :longitude %></td>
|
|
</tr>
|
|
<tr>
|
|
<td><%= t(:elevation) %></td>
|
|
<td><%= d.text_field :elevation %></td>
|
|
</tr>
|
|
<tr>
|
|
<td><%= t(:public) %></td>
|
|
<td><%= d.check_box :public_flag %></td>
|
|
</tr>
|
|
<tr>
|
|
<td><%= t(:field) %> 1</td>
|
|
<td><%= d.text_field :field1, :class => 'field' %></td>
|
|
</tr>
|
|
<tr>
|
|
<td><%= t(:field) %> 2</td>
|
|
<td><%= d.text_field :field2, :class => 'field' %></td>
|
|
</tr>
|
|
<tr>
|
|
<td><%= t(:field) %> 3</td>
|
|
<td><%= d.text_field :field3, :class => 'field' %></td>
|
|
</tr>
|
|
<tr>
|
|
<td><%= t(:field) %> 4</td>
|
|
<td><%= d.text_field :field4, :class => 'field' %></td>
|
|
</tr>
|
|
<tr>
|
|
<td><%= t(:field) %> 5</td>
|
|
<td><%= d.text_field :field5, :class => 'field' %></td>
|
|
</tr>
|
|
<tr>
|
|
<td><%= t(:field) %> 6</td>
|
|
<td><%= d.text_field :field6, :class => 'field' %></td>
|
|
</tr>
|
|
<tr>
|
|
<td><%= t(:field) %> 7</td>
|
|
<td><%= d.text_field :field7, :class => 'field' %></td>
|
|
</tr>
|
|
<tr>
|
|
<td><%= t(:field) %> 8</td>
|
|
<td><%= d.text_field :field8, :class => 'field' %></td>
|
|
</tr>
|
|
<tr>
|
|
<td></td>
|
|
<td><%= d.submit t(:channel_update) %>
|
|
</tr>
|
|
</table>
|
|
<% end %>
|
|
|
|
<br /><br />
|
|
|
|
<h2><%= t(:channel_delete_message) %></h2>
|
|
<%= button_to t(:channel_delete), channel_path(@channel.id), :method => 'delete', :confirm => t(:confirm_channel_delete) %>
|
|
|
|
<script type="text/javascript">
|
|
// remember default field label
|
|
var default_label = '<%= t(:channel_default_field) %>';
|
|
// when document is ready
|
|
$(function() {
|
|
|
|
// iterate through each field textbox
|
|
$('.field').each(function() {
|
|
// if a value is present, show the 'remove' checkbox
|
|
if ($(this).val()) {
|
|
$(this).after('<span class="small" id="span_' + $(this).attr('id') + '"><input type="checkbox" onclick="removeField(\'' + $(this).attr('id') + '\')" /><span class="up2">remove field</span></span>');
|
|
// else disable
|
|
} else {
|
|
$(this).after('<span class="small" id="span_' + $(this).attr('id') + '"><input type="checkbox" onclick="addField(\'' + $(this).attr('id') + '\')" /><span class="up2">add field</span></span>');
|
|
}
|
|
});
|
|
|
|
});
|
|
|
|
// adds a field
|
|
function addField(id) {
|
|
$('#span_'+id).remove()
|
|
$('#'+id).val(default_label + ' ' + id.substring(id.length-1));
|
|
$('#'+id).after('<span class="small" id="span_' + id + '"><input type="checkbox" onclick="removeField(\'' + id + '\')" /><span class="up2">remove field</span></span>');
|
|
$('#'+id).select();
|
|
}
|
|
|
|
// removes a field
|
|
function removeField(id) {
|
|
$('#span_'+id).remove();
|
|
$('#'+id).val('');
|
|
$('#'+id).after('<span class="small" id="span_' + id + '"><input type="checkbox" onclick="addField(\'' + id + '\')" /><span class="up2">add field</span></span>');
|
|
}
|
|
</script> |