mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-09-13 00:24:42 +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() {
|
(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);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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
|
||||||
|
|
Loading…
Add table
Reference in a new issue