mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-09-07 13:44:23 +08:00
Improve code style [SCI-1158]
This commit is contained in:
parent
a3f847a232
commit
bd5a48b9c8
3 changed files with 18 additions and 13 deletions
|
@ -1,12 +1,16 @@
|
|||
$(document.body).ready(function() {
|
||||
$('#search_whole_word').click(function() {
|
||||
if ($(this).prop('checked') === true) {
|
||||
$('#search_whole_phrase').prop('checked', false);
|
||||
}
|
||||
(function() {
|
||||
'use strict';
|
||||
|
||||
$(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);
|
||||
}
|
||||
});
|
||||
});
|
||||
})();
|
||||
|
|
|
@ -39,7 +39,7 @@ class SearchController < ApplicationController
|
|||
private
|
||||
|
||||
def load_vars
|
||||
query = params[:q].strip || ''
|
||||
query = (params.fetch(:q) { '' }).strip
|
||||
@search_category = params[:category] || ''
|
||||
@search_category = @search_category.to_sym
|
||||
@search_page = params[:page].to_i || 1
|
||||
|
|
|
@ -182,7 +182,8 @@ class Asset < ActiveRecord::Base
|
|||
.joins('LEFT JOIN asset_text_data ON ' \
|
||||
' assets.id = asset_text_data.asset_id')
|
||||
.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")
|
||||
.where('assets.id IN (?)', ids)
|
||||
end
|
||||
|
|
Loading…
Add table
Reference in a new issue