Hot Fixes

This commit is contained in:
2015-06-21 16:01:01 +02:00
parent b0f1a2823f
commit 308b542caa
9 changed files with 24 additions and 15 deletions

View File

@@ -94,7 +94,7 @@ class DocumentsController < ApplicationController
end end
@parent=@document.parent @parent=@document.parent
respond_to do |format| respond_to do |format|
format.html format.html {render :edit}
end end
end end
end end

View File

@@ -1,6 +1,7 @@
module ApplicationHelper module ApplicationHelper
def cache_array_key(array) 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 # array.map{|c| c.id}.join('')+"_"+array.map{|c|c.try(:updated_at).try(:utc).to_s}.join('') +"_"+I18n.locale.to_s
end end

View File

@@ -82,7 +82,7 @@ class Document < ActiveRecord::Base
end end
end end
def read_from_etherpad 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 end
def ep_pad def ep_pad
@@ -92,13 +92,17 @@ class Document < ActiveRecord::Base
t= (self.typ.nil? || self.typ ==0) ? 1 : self.typ t= (self.typ.nil? || self.typ ==0) ? 1 : self.typ
Document.ether.group(Document::TYPS[t]) Document.ether.group(Document::TYPS[t])
end end
def text_stripped
ApplicationController.helpers.strip_control_chars(ApplicationController.helpers.strip_tags(text.to_s.gsub("<"," <").gsub(">","> ").to_s))
end
searchable do searchable do
text :text, stored: true text :text, stored: true do |d|
text :name, :boost=>4.0, :stored=> true d.text_stripped
if typ = 10 || typ=11 end
text :meeting, stored: true do text :name, :boost=>4.0, :stored=> true
parent.text unless parent.nil? text :meeting, stored: true do |d|
end (d.parent_type == "Meeting")? d.try(:parent).try(:text).to_s : ""
end end
end end
def maketoc def maketoc

View File

@@ -104,6 +104,8 @@ class Lva < ActiveRecord::Base
rescue OpenURI::HTTPError => e rescue OpenURI::HTTPError => e
end end
end end
rescue => e
end end
url url
end end

View File

@@ -92,7 +92,8 @@ end
File.extname(full_filename(file.file)).downcase File.extname(full_filename(file.file)).downcase
end end
def pdf?(for_file) 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 end
def image?(for_file) def image?(for_file)
%w(.jpg .png .jpeg).include?(File.extname(full_filename(for_file.file)).downcase) %w(.jpg .png .jpeg).include?(File.extname(full_filename(for_file.file)).downcase)

View File

@@ -1,4 +1,5 @@
<% unless search_results.nil? %> <% unless search_results.nil? %>
<%= search_results %>
<ul> <ul>
<% search_results.each_hit_with_result do |hit,result| %> <% search_results.each_hit_with_result do |hit,result| %>
<li> <%= link_to result.parent.title+": " + result.name, document_path(result) %> <li> <%= link_to result.parent.title+": " + result.name, document_path(result) %>
@@ -7,7 +8,7 @@
<% end %> <% end %>
<% %> <% %>
<% hit.highlights(:text).each do |hlgt| %> <% hit.highlights(:text).each do |hlgt| %>
<%= "text:" + raw(hlgt.format {|word| "*#{word}*" })%> <%= "text:" + raw(hlgt.format {|word| raw("<b>#{word}</b>") })%>
<% end %> <% end %>
<% hit.highlights(:meeting).each do |hlgt| %> <% hit.highlights(:meeting).each do |hlgt| %>
<%= "text:" + raw(hlgt.format {|word| "*#{word}*" })%> <%= "text:" + raw(hlgt.format {|word| "*#{word}*" })%>

View File

@@ -39,7 +39,7 @@
<% cache("calendar_" + @calentries.map{|c| c.id}.join('') + @calentries.max{|c|c.updated_at.to_i}.updated_at.to_i.to_s+"_"+I18n.locale.to_s+params[:month].to_s+params[:year].to_s) do %> <% cache("calendar_" + @calentries.map{|c| c.id}.join('') + @calentries.max{|c|c.updated_at.to_i}.updated_at.to_i.to_s+"_"+I18n.locale.to_s+params[:month].to_s+params[:year].to_s) do %>
<%= render 'calendars/calentries', :object=>@calentries %> <%= render 'calendars/calentries', :object=>@calentries %>
<% end %> <% end %>
<% if current_user.has_role?(:fetuser) %> <% if !current_user.nil? and current_user.has_role?(:fetuser) %>
<%= link_to calendars_url(:format=>:ics, :key=>Key.find_or_create(current_user,1).uuid) , calendars_path(:format=>:ics, :key=>Key.find_or_create(current_user,1).uuid)%> <%= link_to calendars_url(:format=>:ics, :key=>Key.find_or_create(current_user,1).uuid) , calendars_path(:format=>:ics, :key=>Key.find_or_create(current_user,1).uuid)%>
<% end %> <% end %>
</div> </div>

View File

@@ -52,7 +52,7 @@
<%= render 'calendars/calentries', :object=>@calentries %> <%= render 'calendars/calentries', :object=>@calentries %>
<% end %> <% end %>
<% end %> <% end %>
<% if current_user.has_role?(:fetuser) %> <% if !current_user.nil? and current_user.has_role?(:fetuser) %>
<%= link_to calendar_url(@rubrik.calendar,:format=>:ics, :key=>Key.find_or_create(current_user,1).uuid) , calendars_path(:format=>:ics, :key=>Key.find_or_create(current_user,1).uuid)%> <%= link_to calendar_url(@rubrik.calendar,:format=>:ics, :key=>Key.find_or_create(current_user,1).uuid) , calendars_path(:format=>:ics, :key=>Key.find_or_create(current_user,1).uuid)%>
<% end %> <% end %>

View File

@@ -31,10 +31,10 @@ Fetsite::Application.configure do
# config.force_ssl = true # config.force_ssl = true
# See everything in the log (default is :info) # See everything in the log (default is :info)
# config.log_level = :debug config.log_level = :debug
# Prepend all log lines with the following tags # Prepend all log lines with the following tags
# config.log_tags = [ :subdomain, :uuid ] config.log_tags = [ :remote_ip , :uuid ]
# Use a different logger for distributed setups # Use a different logger for distributed setups
# config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new) # config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)