diff --git a/app/controllers/sites_controller.rb b/app/controllers/sites_controller.rb index fcc02953..33c89dfa 100644 --- a/app/controllers/sites_controller.rb +++ b/app/controllers/sites_controller.rb @@ -5,7 +5,6 @@ def index @sites = Site.order(:fits_id).all @navigation_crumbs = [["Home", root_path]] @sites = if params[:query].present? - # Site.where('name LIKE ? OR fits_id LIKE ?', "%#{params[:query]}%", "%#{params[:query]}%") Site.where('name LIKE ? OR fits_id LIKE ? OR id IN ( SELECT sn.site_id FROM subnets s @@ -13,7 +12,7 @@ def index WHERE s.cidr_block LIKE ? )', "%#{params[:query]}%", "%#{params[:query]}%", "%#{params[:query]}%") else - Site.all + Site.order(:fits_id).all end end diff --git a/app/views/sites/index.html.erb b/app/views/sites/index.html.erb index 5e194ef8..eb18bbaa 100644 --- a/app/views/sites/index.html.erb +++ b/app/views/sites/index.html.erb @@ -12,12 +12,6 @@ <%= submit_tag "Search", class: "govuk-button", "data-module" => "govuk-button" %> <% end %> - - <%#= form_tag(dhcp_path, method: :get, class: "govuk-form") do %> - <%#= text_field_tag :query, params[:query], placeholder: "Search sites..." %> - <%#= submit_tag "Search", class: "govuk-button" %> - <%# end %> - <% if can? :create, Site %> <%= link_to "Create a new site", new_site_path, class: "govuk-button" %> <% end %>