Add some search input.
This commit is contained in:
parent
7cfbaaf3df
commit
9579179685
|
@ -6,8 +6,10 @@ class Admin::AdminModulesController < OrbitAdminController
|
|||
end
|
||||
|
||||
def index
|
||||
@registered_modules = RegisteredModule.where(:completed => true).page(params[:page]).per(10)
|
||||
@filter_fields = {}
|
||||
@registered_modules = RegisteredModule.where(:completed => true)
|
||||
@table_fields = table_fields
|
||||
@registered_modules = search_data(@registered_modules,[:name, :module_key]).page(params[:page]).per(10)
|
||||
if request.xhr?
|
||||
render :partial => "index"
|
||||
end
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
<%= javascript_include_tag "plugin/jquery.form.min" %>
|
||||
<%= render_filter @filter_fields, "index_table" %>
|
||||
<span id="index_table">
|
||||
<%= render 'index'%>
|
||||
</span>
|
||||
|
@ -64,7 +65,7 @@
|
|||
var actionsModal = $("#actionsModal");
|
||||
var btn_type = null;
|
||||
var module_id = null;
|
||||
$(".action-btns").on("click",function(){
|
||||
$(document).on("click", ".action-btns", function(){
|
||||
btn_type = $(this).attr("for");
|
||||
module_id = $(this).data("id");
|
||||
$.ajax({
|
||||
|
|
|
@ -2,11 +2,22 @@
|
|||
<% if @registered_sites.blank? %>
|
||||
<span>Sorry no sites active or all the websites already have this module.</span>
|
||||
<% else %>
|
||||
<input id="search_webs" type="text" placeholder="Domain, ex: example.com">
|
||||
<% @registered_sites.each do |rs|%>
|
||||
<label>
|
||||
<label data-domain="<%=rs.site_domain%>">
|
||||
<input type="checkbox" name="websites[]" value="<%= rs.id.to_s %>" />
|
||||
<a href="<%= "http://" + rs.site_domain %>" target="_blank"><%= rs.title || rs.site_domain %></a>
|
||||
</label>
|
||||
<% end %>
|
||||
<script>
|
||||
$('#search_webs').on('input',function(){
|
||||
var domain = $(this).val().replace(/http[s]:\/\//,'');
|
||||
if(domain == ""){
|
||||
$(this).siblings('label').removeClass('hide');
|
||||
}else{
|
||||
$(this).siblings('label').removeClass('hide').filter(':not([data-domain*="'+domain+'"])').addClass('hide');
|
||||
}
|
||||
})
|
||||
</script>
|
||||
<% end %>
|
||||
</div>
|
||||
|
|
|
@ -2,12 +2,23 @@
|
|||
<% if @registered_sites.blank? %>
|
||||
<span>Sorry no sites active or this module is not installed anywhere.</span>
|
||||
<% else %>
|
||||
<input id="search_webs" type="text" placeholder="Domain, ex: example.com">
|
||||
<% @registered_sites.each_with_index do |rs, index|%>
|
||||
<label>
|
||||
<label data-domain="<%=rs.site_domain%>">
|
||||
<input type="checkbox" name="websites[]" value="<%= rs.id.to_s %>" />
|
||||
<a href="<%= "http://" + rs.site_domain %>" target="_blank"><%= rs.title || rs.site_domain %></a>
|
||||
<span class="pull-right"><%= @times[index] %></span>
|
||||
</label>
|
||||
<% end %>
|
||||
<script>
|
||||
$('#search_webs').on('input',function(){
|
||||
var domain = $(this).val().replace(/http[s]:\/\//,'');
|
||||
if(domain == ""){
|
||||
$(this).siblings('label').removeClass('hide');
|
||||
}else{
|
||||
$(this).siblings('label').removeClass('hide').filter(':not([data-domain*="'+domain+'"])').addClass('hide');
|
||||
}
|
||||
})
|
||||
</script>
|
||||
<% end %>
|
||||
</div>
|
||||
|
|
Loading…
Reference in New Issue