From b1c46a3dc379fdba18f0380d7ac6c48eda38bc6b Mon Sep 17 00:00:00 2001
From: Andreas Stephanides
Date: Sat, 14 Jun 2014 14:16:16 +0200
Subject: [PATCH] error fixes
---
.gitignore | 1 +
Gemfile | 1 +
Gemfile.lock | 16 +++++++++++++++-
app/controllers/themengruppen_controller.rb | 2 +-
app/controllers/wikis_controller.rb | 2 +-
app/models/fetprofile.rb | 4 +++-
app/models/user.rb | 2 +-
app/views/fetprofiles/_interninfo.html.erb | 8 ++++----
config/routes.rb | 2 +-
db/migrate/20140529120536_add_wiki_to_thema.rb | 2 +-
10 files changed, 29 insertions(+), 11 deletions(-)
diff --git a/.gitignore b/.gitignore
index 2f63aa3..987aa9b 100755
--- a/.gitignore
+++ b/.gitignore
@@ -5,6 +5,7 @@
/config/omniauth_secrets.yml
/config/database.yml
/config/initializers/omniauth_secrets.rb
+/config/databas*
# See http://help.github.com/ignore-files/ for more about ignoring files.
#
# If you find yourself ignoring temporary files generated by your text editor
diff --git a/Gemfile b/Gemfile
index ac45d67..6d9a3a2 100755
--- a/Gemfile
+++ b/Gemfile
@@ -60,6 +60,7 @@ gem "omniauth"
gem "omniauth-facebook"
gem "omniauth-ldap"
+gem "fb_graph"
# Roles for users
gem "rolify"
diff --git a/Gemfile.lock b/Gemfile.lock
index bfd0ce0..1574ef4 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -41,6 +41,7 @@ GEM
activerecord (>= 2.3.0)
rake (>= 0.8.7)
arel (3.0.3)
+ attr_required (1.0.0)
awesome_nested_set (2.1.6)
activerecord (>= 3.0.0)
bcrypt-ruby (3.1.2)
@@ -83,6 +84,11 @@ GEM
railties (>= 3.0.0)
faraday (0.8.8)
multipart-post (~> 1.2.0)
+ fb_graph (2.7.15)
+ httpclient (>= 2.2.0.2)
+ multi_json (>= 1.3)
+ rack-oauth2 (>= 0.14.4)
+ tzinfo
font-awesome-rails (4.0.3.1)
railties (>= 3.2, < 5.0)
formtastic (2.2.1)
@@ -114,6 +120,7 @@ GEM
hashie (2.0.5)
hike (1.2.3)
httpauth (0.2.0)
+ httpclient (2.4.0)
i18n (0.6.1)
journey (1.0.4)
jquery-fileupload-rails (0.4.1)
@@ -171,6 +178,12 @@ GEM
rack (1.4.5)
rack-cache (1.2)
rack (>= 0.4)
+ rack-oauth2 (1.0.8)
+ activesupport (>= 2.3)
+ attr_required (>= 0.0.5)
+ httpclient (>= 2.2.0.2)
+ multi_json (>= 1.3.6)
+ rack (>= 1.1)
rack-ssl (1.3.3)
rack
rack-test (0.6.2)
@@ -247,11 +260,11 @@ GEM
warden (1.2.3)
rack (>= 1.0)
webrick (1.3.1)
-<<<<<<< Updated upstream
wikicloth (0.8.1)
builder
expression_parser
rinku
+
PLATFORMS
ruby
@@ -267,6 +280,7 @@ DEPENDENCIES
devise (~> 2.2.3)
execjs (~> 1.4.0)
factory_girl_rails
+ fb_graph
font-awesome-rails
formtastic (~> 2.2.1)
formtastic-bootstrap (~> 2.1.3)
diff --git a/app/controllers/themengruppen_controller.rb b/app/controllers/themengruppen_controller.rb
index 7cc6872..8d0b956 100644
--- a/app/controllers/themengruppen_controller.rb
+++ b/app/controllers/themengruppen_controller.rb
@@ -3,7 +3,7 @@ class ThemengruppenController < ApplicationController
# GET /themengruppen.json
load_and_authorize_resource
def index
- @themengruppen = Themengruppe.public.order(:priority).reverse
+ @themengruppen = Themengruppe.where(:public=>true).order(:priority).reverse
@toolbar_elements = [{:icon=>:plus, :hicon=>'icon-plus-sign', :text=>I18n.t('themengruppe.new'), :path=>new_themengruppe_path()}]
@toolbar_elements = [{:icon=>:plus, :hicon=>'icon-plus-sign', :text=>I18n.t('common.verwalten'), :path=>verwalten_all_themengruppen_path()}]
diff --git a/app/controllers/wikis_controller.rb b/app/controllers/wikis_controller.rb
index a61be11..46b6b15 100644
--- a/app/controllers/wikis_controller.rb
+++ b/app/controllers/wikis_controller.rb
@@ -4,7 +4,7 @@ class WikisController < ApplicationController
def show
@wiki = Wiki.find(params[:id])
@fragen = @wiki.fragen
- @toolbar_elements = [{:icon=>:pencil, :hicon=>'icon-pencil', :text=>I18n.t('wiki.edit'), :path=>verwalten_wiki_path(@wiki)}]
+ @toolbar_elements = [{:icon=>:pencil, :hicon=>'icon-pencil', :text=>I18n.t('wiki.edit'), :path=>verwalten_thema_path(@wiki)}]
end
def wiki
diff --git a/app/models/fetprofile.rb b/app/models/fetprofile.rb
index a73c3ce..bf367bf 100644
--- a/app/models/fetprofile.rb
+++ b/app/models/fetprofile.rb
@@ -31,10 +31,12 @@ class Fetprofile < ActiveRecord::Base
accepts_nested_attributes_for :memberships, :reject_if=>lambda{|a| a[:typ].blank?|| a[:start].blank? ||a[:gremium_id].blank?}, :allow_destroy=>true
has_many :nlinks, as: :link
def validate_birthday
- unless Date.valid_date?(birth_year, birth_month, birth_day)
+ unless birth_month.nil? || birth_day.nil?
+ unless Date.valid_date?((birth_year.nil?) ? Date.today.year : birth_year, birth_month, birth_day)
errors.add(:birth_month, "Invalides Datum")
errors.add(:birth_day, "Invalides Datum")
end
+end
end
def title
diff --git a/app/models/user.rb b/app/models/user.rb
index ea6c46b..a715c06 100755
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -38,7 +38,7 @@ belongs_to :fetprofile
def self.find_for_facebook_oauth(auth, signed_in_resource=nil)
logger.debug auth.to_s
logger.debug "DDD Username= #{auth.username}"
- # user = User.where(:provider => auth.provider, :uid => auth.uid).first
+ user = User.where(:provider => auth.provider, :uid => auth.extra.raw_info.uid).first
unless user
user = User.create(name:auth.uid,
provider:auth.provider,
diff --git a/app/views/fetprofiles/_interninfo.html.erb b/app/views/fetprofiles/_interninfo.html.erb
index 889ab47..bd5fc1f 100644
--- a/app/views/fetprofiles/_interninfo.html.erb
+++ b/app/views/fetprofiles/_interninfo.html.erb
@@ -8,9 +8,9 @@
<%= interninfo.street %>
- <%= raw("Telefon: ")+ interninfo.telnr + "
" unless interninfo.telnr.empty?%>
- <%= raw("Handy: ") +interninfo.hdynr unless interninfo.hdynr.empty? %>
-<%= raw("Skype: ") +interninfo.skype unless interninfo.skype.empty? %>
-<%= raw("Instant Messaging: ") +interninfo.instant unless interninfo.instant.empty? %>
+ <%= raw("Telefon: ")+ interninfo.telnr + "
" unless (interninfo.telnr.nil? || interninfo.telnr.empty?) %>
+ <%= raw("Handy: ") +interninfo.hdynr unless interninfo.hdynr.nil? || interninfo.hdynr.empty? %>
+<%= raw("Skype: ") +interninfo.skype unless interninfo.skype.nil? || interninfo.skype.empty? %>
+<%= raw("Instant Messaging: ") +interninfo.instant unless interninfo.instant.nil? || interninfo.instant.empty? %>
diff --git a/config/routes.rb b/config/routes.rb
index 8c50b6c..da56eba 100755
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -25,7 +25,7 @@
get "wiki/:name", action: :wiki, controller: :wikis
resources :wikis do
member do
- get :verwalten
+
end
end
end
diff --git a/db/migrate/20140529120536_add_wiki_to_thema.rb b/db/migrate/20140529120536_add_wiki_to_thema.rb
index 0c5ccca..6b5fa81 100644
--- a/db/migrate/20140529120536_add_wiki_to_thema.rb
+++ b/db/migrate/20140529120536_add_wiki_to_thema.rb
@@ -2,6 +2,6 @@ class AddWikiToThema < ActiveRecord::Migration
def change
add_column :themen, :wikiname, :string
add_column :themen, :wikiformat, :integer
- add_column :themen, :hidelink, :boolea
+ add_column :themen, :hidelink, :boolean
end
end