thingspeak/app/views/channels/public.html.erb

56 lines
1.6 KiB
Plaintext
Raw Normal View History

<div class="row">
2014-02-28 19:57:58 +01:00
<div class="col-xs-12 col-sm-9">
2014-03-14 00:16:35 +01:00
<h4 class="breadcrumb"><%= @header %></h4>
<%= render :partial => 'list' %>
2014-03-14 00:16:35 +01:00
<br>
<%= will_paginate @channels %>
2014-02-28 19:57:58 +01:00
</div>
<div class="col-xs-12 col-sm-3">
<h4 class="breadcrumb"><%= t(:search).capitalize %></h4>
<div class="col-pad">
<form role="form">
<div class="form-group">
<label for="tag_input"><%= t(:search_by_tag) %></label>
<input type="text" class="form-control" id="tag_input" placeholder="<%= t(:search_input_tag) %>">
</div>
<button type="submit" id="search_tag" class="btn btn-primary btn-sm"><%= t(:submit) %></button>
</form>
<br><br>
<form role="form">
<div class="form-group">
<label for="username_input"><%= t(:search_by_username) %></label>
<input type="text" class="form-control" id="username_input" placeholder="<%= t(:search_input_username) %>">
</div>
<button type="submit" id="search_username" class="btn btn-primary btn-sm"><%= t(:submit) %></button>
</form>
</div>
</div>
2014-02-28 19:57:58 +01:00
</div>
2014-02-28 19:57:58 +01:00
<script>
// when the document is ready
$(document).ready(function() {
// when search tag is clicked
$('#search_tag').on('click', function() {
window.location.href = '<%= @domain %>channels/public?tag=' + encodeURIComponent($('#tag_input').val());
return false;
});
// when search username is clicked
$('#search_username').on('click', function() {
window.location.href = '<%= @domain %>channels/public?username=' + encodeURIComponent($('#username_input').val());
return false;
});
});
</script>