Merge branch 'opengraph'

This commit is contained in:
Andreas Stephanides
2015-02-17 19:00:37 +01:00
8 changed files with 36 additions and 4 deletions

View File

@@ -117,6 +117,8 @@ gem 'whenever'
gem 'yaml_db' gem 'yaml_db'
gem 'etherpad-lite' gem 'etherpad-lite'
gem 'opengraph_parser'
# Image gallery # Image gallery
gem 'blueimp-gallery' gem 'blueimp-gallery'
gem 'blueimp-gallery-rails' gem 'blueimp-gallery-rails'

View File

@@ -26,7 +26,16 @@ class HomeController < ApplicationController
end 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 def startdev
render 'setup_fetsite_dev' render 'setup_fetsite_dev'
end end

View File

@@ -94,4 +94,12 @@ end
end end
raw(html) raw(html)
end end
def absurl(path)
if path.nil?
return nil
end
url=URI(root_url)
url.path=path
return url
end
end end

View File

@@ -64,6 +64,18 @@ class Neuigkeit < ActiveRecord::Base
def name def name
self.title self.title
end 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 def text_first_words
md = /<p>(?<text>[^\<\>]*)/.match Sanitize.clean(self.text,:elements=>['p']) md = /<p>(?<text>[^\<\>]*)/.match Sanitize.clean(self.text,:elements=>['p'])
words=md[:text].split(" ") unless md.nil? words=md[:text].split(" ") unless md.nil?

View File

@@ -0,0 +1 @@
<pre><%= @logs %></pre>

View File

@@ -3,7 +3,7 @@
<head> <head>
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="shortcut icon" href="logo2014_64.png"> <link rel="shortcut icon" href="<%= absurl("/logo2014_64.png")%>">
<!--<link rel="shortcut icon" href="http://www.fet.at/favicon.ico">--> <!--<link rel="shortcut icon" href="http://www.fet.at/favicon.ico">-->
<!----> <!---->

View File

@@ -5,8 +5,7 @@
<td><%= fa_icon "globe" if r.public%></td> <td><%= fa_icon "globe" if r.public%></td>
<td><%= r.name %></td> <td><%= r.name %></td>
<td> <td>
<%= n.title %> <%= link_to n.title, n %>
</td> </td>
<td> <td>
<%= unless n.datum.nil? <%= unless n.datum.nil?

View File

@@ -135,6 +135,7 @@
get 'linksnotimplemented' get 'linksnotimplemented'
get 'kontakt' get 'kontakt'
get 'choose_contact_topics' get 'choose_contact_topics'
get 'log'
end end
end end