Improve code style [SCI-1158]

This commit is contained in:
Oleksii Kriuchykhin 2017-05-08 18:00:14 +02:00
parent a3f847a232
commit bd5a48b9c8
3 changed files with 18 additions and 13 deletions

View file

@ -1,12 +1,16 @@
$(document.body).ready(function() { (function() {
$('#search_whole_word').click(function() { 'use strict';
if ($(this).prop('checked') === true) {
$('#search_whole_phrase').prop('checked', false); $(document.body).ready(function() {
} $('#search_whole_word').click(function() {
if ($(this).prop('checked') === true) {
$('#search_whole_phrase').prop('checked', false);
}
});
$('#search_whole_phrase').click(function() {
if ($(this).prop('checked') === true) {
$('#search_whole_word').prop('checked', false);
}
});
}); });
$('#search_whole_phrase').click(function() { })();
if ($(this).prop('checked') === true) {
$('#search_whole_word').prop('checked', false);
}
});
});

View file

@ -39,7 +39,7 @@ class SearchController < ApplicationController
private private
def load_vars def load_vars
query = params[:q].strip || '' query = (params.fetch(:q) { '' }).strip
@search_category = params[:category] || '' @search_category = params[:category] || ''
@search_category = @search_category.to_sym @search_category = @search_category.to_sym
@search_page = params[:page].to_i || 1 @search_page = params[:page].to_i || 1

View file

@ -182,7 +182,8 @@ class Asset < ActiveRecord::Base
.joins('LEFT JOIN asset_text_data ON ' \ .joins('LEFT JOIN asset_text_data ON ' \
' assets.id = asset_text_data.asset_id') ' assets.id = asset_text_data.asset_id')
.select('assets.*') .select('assets.*')
.select("ts_headline(data, to_tsquery('" + s_query + .select("ts_headline(data, to_tsquery('" +
sanitize_sql_for_conditions(s_query) +
"'), 'StartSel=<mark>, StopSel=</mark>') headline") "'), 'StartSel=<mark>, StopSel=</mark>') headline")
.where('assets.id IN (?)', ids) .where('assets.id IN (?)', ids)
end end