From 308b542caac42ca776558620b99acbf8f5dd2c69 Mon Sep 17 00:00:00 2001 From: Andreas Stephanides Date: Sun, 21 Jun 2015 16:01:01 +0200 Subject: [PATCH] Hot Fixes --- app/controllers/documents_controller.rb | 2 +- app/helpers/application_helper.rb | 3 ++- app/models/document.rb | 18 +++++++++++------- app/models/lva.rb | 2 ++ app/uploaders/attachment_uploader.rb | 3 ++- app/views/documents/_search_results.html.erb | 3 ++- app/views/rubriken/index.html.erb | 2 +- app/views/rubriken/show.html.erb | 2 +- config/environments/production.rb | 4 ++-- 9 files changed, 24 insertions(+), 15 deletions(-) diff --git a/app/controllers/documents_controller.rb b/app/controllers/documents_controller.rb index 7a08f82..bacf9af 100644 --- a/app/controllers/documents_controller.rb +++ b/app/controllers/documents_controller.rb @@ -94,7 +94,7 @@ class DocumentsController < ApplicationController end @parent=@document.parent respond_to do |format| - format.html + format.html {render :edit} end end end diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 7a1f425..d59d2f9 100755 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -1,6 +1,7 @@ module ApplicationHelper def cache_array_key(array) - array.map{|c| c.id}.join('_')+"_"+array.max{|c|c.updated_at.to_i}.updated_at.try(:utc).to_s+"_"+I18n.locale.to_s + return "empty_array" if array.nil? or array.empty? + array.map{|c| c.id}.join('_')+"_"+array.max{|c|c.updated_at.to_i}.updated_at.try(:utc).to_s+"_"+I18n.locale.to_s # array.map{|c| c.id}.join('')+"_"+array.map{|c|c.try(:updated_at).try(:utc).to_s}.join('') +"_"+I18n.locale.to_s end diff --git a/app/models/document.rb b/app/models/document.rb index aa0158d..f820ebc 100644 --- a/app/models/document.rb +++ b/app/models/document.rb @@ -82,7 +82,7 @@ class Document < ActiveRecord::Base end end def read_from_etherpad - self.text=ApplicationController.helpers.strip_control_chars(self.ep_pad.html) + self.text=ApplicationController.helpers.strip_control_chars( self.ep_pad.html) end def ep_pad @@ -92,13 +92,17 @@ class Document < ActiveRecord::Base t= (self.typ.nil? || self.typ ==0) ? 1 : self.typ Document.ether.group(Document::TYPS[t]) end + def text_stripped + ApplicationController.helpers.strip_control_chars(ApplicationController.helpers.strip_tags(text.to_s.gsub("<"," <").gsub(">","> ").to_s)) + + end searchable do - text :text, stored: true - text :name, :boost=>4.0, :stored=> true - if typ = 10 || typ=11 - text :meeting, stored: true do - parent.text unless parent.nil? - end + text :text, stored: true do |d| + d.text_stripped + end + text :name, :boost=>4.0, :stored=> true + text :meeting, stored: true do |d| + (d.parent_type == "Meeting")? d.try(:parent).try(:text).to_s : "" end end def maketoc diff --git a/app/models/lva.rb b/app/models/lva.rb index 7c14ebd..6de47d1 100755 --- a/app/models/lva.rb +++ b/app/models/lva.rb @@ -104,6 +104,8 @@ class Lva < ActiveRecord::Base rescue OpenURI::HTTPError => e end end + rescue => e + end url end diff --git a/app/uploaders/attachment_uploader.rb b/app/uploaders/attachment_uploader.rb index 0e8a577..ed27902 100644 --- a/app/uploaders/attachment_uploader.rb +++ b/app/uploaders/attachment_uploader.rb @@ -92,7 +92,8 @@ end File.extname(full_filename(file.file)).downcase end def pdf?(for_file) - %w(.pdf).include?(File.extname(full_filename(for_file.file)).downcase) +# %w(.pdf).include?(File.extname(full_filename(for_file.file)).downcase) + false end def image?(for_file) %w(.jpg .png .jpeg).include?(File.extname(full_filename(for_file.file)).downcase) diff --git a/app/views/documents/_search_results.html.erb b/app/views/documents/_search_results.html.erb index 9dc371f..47d616a 100644 --- a/app/views/documents/_search_results.html.erb +++ b/app/views/documents/_search_results.html.erb @@ -1,4 +1,5 @@ <% unless search_results.nil? %> +<%= search_results %>