Merge branch 'master' of github.com:fetsite/fetsite

This commit is contained in:
Andreas Stephanides
2015-06-24 11:16:43 +02:00
13 changed files with 29 additions and 19 deletions

1
.gitignore vendored
View File

@@ -49,3 +49,4 @@ Gemfile.lock
/config/database.yml /config/database.yml
/config/start_topic.yml /config/start_topic.yml
/config/contact_topic.yml /config/contact_topic.yml
.*

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

@@ -3,7 +3,7 @@ class ThemengruppenController < ApplicationController
# GET /themengruppen.json # GET /themengruppen.json
load_and_authorize_resource load_and_authorize_resource
def index def index
@themengruppen = Themengruppe.accessible_by(current_ability, :show).public.order(:priority).reverse_order @themengruppen = Themengruppe.accessible_by(current_ability, :show).public.includes(:themen)
@toolbar_elements = [] @toolbar_elements = []
@toolbar_elements << {:icon=>:plus, :hicon=>'icon-plus-sign', :text=>I18n.t('themengruppe.new'), :path=>new_themengruppe_path()} if can? :new, Themengruppe @toolbar_elements << {:icon=>:plus, :hicon=>'icon-plus-sign', :text=>I18n.t('themengruppe.new'), :path=>new_themengruppe_path()} if can? :new, Themengruppe
@toolbar_elements << {:icon=>:plus, :hicon=>'icon-plus-sign', :text=>I18n.t('themengruppe.manage_all'), :path=>verwalten_all_themengruppen_path()} if can? :verwalten_all, Themengruppe @toolbar_elements << {:icon=>:plus, :hicon=>'icon-plus-sign', :text=>I18n.t('themengruppe.manage_all'), :path=>verwalten_all_themengruppen_path()} if can? :verwalten_all, Themengruppe

View File

@@ -1,5 +1,6 @@
module ApplicationHelper module ApplicationHelper
def cache_array_key(array) def cache_array_key(array)
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.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

View File

@@ -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
searchable do def text_stripped
text :text, stored: true ApplicationController.helpers.strip_control_chars(ApplicationController.helpers.strip_tags(text.to_s.gsub("<"," <").gsub(">","> ").to_s))
text :name, :boost=>4.0, :stored=> true
if typ = 10 || typ=11
text :meeting, stored: true do
parent.text unless parent.nil?
end end
searchable do
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
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

@@ -43,7 +43,7 @@ class Thema < ActiveRecord::Base
scope :outdated, -> {includes(:translations).where("thema_translations.updated_at<?",7.month.ago).where("thema_translations.locale"=>I18n.t.locale)} scope :outdated, -> {includes(:translations).where("thema_translations.updated_at<?",7.month.ago).where("thema_translations.locale"=>I18n.t.locale)}
scope :public, where(:isdraft=>false).includes(:themengruppe).where("themengruppen.public"=>true) scope :public, where(:isdraft=>false).includes(:themengruppe).where("themengruppen.public"=>true)
default_scope order("themen.priority").reverse_order default_scope includes(:translations).order("themen.priority").reverse_order
# make topic searchable # make topic searchable
searchable do searchable do
text :text text :text

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)

View File

@@ -1 +1 @@
ActiveRecordQueryTrace.enabled=true #ActiveRecordQueryTrace.enabled=true