diff --git a/Gemfile b/Gemfile index 4d026e7..ba1a015 100755 --- a/Gemfile +++ b/Gemfile @@ -117,6 +117,8 @@ gem 'whenever' gem 'yaml_db' gem 'etherpad-lite' +gem 'opengraph_parser' + # Image gallery gem 'blueimp-gallery' gem 'blueimp-gallery-rails' \ No newline at end of file diff --git a/app/controllers/home_controller.rb b/app/controllers/home_controller.rb index 0410a28..8d4ccd0 100755 --- a/app/controllers/home_controller.rb +++ b/app/controllers/home_controller.rb @@ -26,7 +26,16 @@ class HomeController < ApplicationController end - + def log + authorize! :doadmin, User + lines = params[:lines] + if Rails.env == "production" + @logs = `tail -n #{lines} log/production.log | grep Error` + else + @logs = `tail -n #{lines} log/development.log | grep -v 'actionpack\\|railties\\|activesupport\\|::Translation'` + end + + end def startdev render 'setup_fetsite_dev' end diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 400de60..23d9f2f 100755 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -94,4 +94,12 @@ end end raw(html) end + def absurl(path) + if path.nil? + return nil + end + url=URI(root_url) + url.path=path + return url + end end diff --git a/app/models/neuigkeit.rb b/app/models/neuigkeit.rb index 198ca66..19091b0 100755 --- a/app/models/neuigkeit.rb +++ b/app/models/neuigkeit.rb @@ -64,6 +64,18 @@ class Neuigkeit < ActiveRecord::Base def name self.title end + def load_from_facebook(link) + event=FbGraph::Event.new(link).fetch(:access_token=>"CAABtfB8SO7kBADyHVHnWHqsxsU1bqqmeDdZCp7V1KF9G4o3oFHcZBq0IB8X3ird4muVIPuWKZB8jL1o9JCON60Lmnvk8rkZA2dyZAuU95dC0SWzOEnhtAEkyzZCN6hkKXdl87o38OloLBivc2kjJYmpUVKzdZAD5ywxKG7Hv5FWxXf6amWA782JSmcxgWsRDH4ZAZBXsUrhpnILNOVoKSBf1mGyfrFiPvA3QZD") + self.title=event.name + self.text=event.description + unless event.start_time.nil? + ce=Calentry.new(:start=>event.start_time, :ende=>event.end_time , :typ=>1) + ce.ende=ce.start if ce.ende.nil? + self.calentries<< ce + ce.save + + end + end def text_first_words md = /

(?[^\<\>]*)/.match Sanitize.clean(self.text,:elements=>['p']) words=md[:text].split(" ") unless md.nil? diff --git a/app/views/home/log.html.erb b/app/views/home/log.html.erb new file mode 100644 index 0000000..5359341 --- /dev/null +++ b/app/views/home/log.html.erb @@ -0,0 +1 @@ +

<%= @logs %>
diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 442d443..c6c40b8 100755 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -3,7 +3,7 @@ - + "> diff --git a/app/views/rubriken/_admin_liste.html.erb b/app/views/rubriken/_admin_liste.html.erb index db6a999..c113119 100755 --- a/app/views/rubriken/_admin_liste.html.erb +++ b/app/views/rubriken/_admin_liste.html.erb @@ -5,8 +5,7 @@ <%= fa_icon "globe" if r.public%> <%= r.name %> - <%= n.title %> - + <%= link_to n.title, n %> <%= unless n.datum.nil? diff --git a/config/routes.rb b/config/routes.rb index 421f549..b38910c 100755 --- a/config/routes.rb +++ b/config/routes.rb @@ -135,6 +135,7 @@ get 'linksnotimplemented' get 'kontakt' get 'choose_contact_topics' + get 'log' end end