forked from bofh/fetsite
admin fixes
This commit is contained in:
@@ -24,7 +24,8 @@ class HomeController < ApplicationController
|
|||||||
end
|
end
|
||||||
def admin
|
def admin
|
||||||
authorize! :doadmin, User
|
authorize! :doadmin, User
|
||||||
|
t=YAML.load_file("#{::Rails.root.to_s}/config/contact_topic.yml")
|
||||||
|
@kontaktthemen = Thema.where(:id=>t)
|
||||||
|
|
||||||
end
|
end
|
||||||
def log
|
def log
|
||||||
@@ -81,7 +82,14 @@ class HomeController < ApplicationController
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
def choose_contact_topics
|
def choose_contact_topics
|
||||||
File.open("config/contact_topic.yml",'w'){|f| f.write(params[:themen].to_yaml)}
|
t=YAML.load_file("#{::Rails.root.to_s}/config/contact_topic.yml")
|
||||||
|
unless params[:themen].nil?
|
||||||
|
t=([t].flatten+params[:themen]).uniq
|
||||||
|
end
|
||||||
|
unless params[:rmthema].nil?
|
||||||
|
t=t-[params[:rmthema]]
|
||||||
|
end
|
||||||
|
File.open("config/contact_topic.yml",'w'){|f| f.write(t.to_yaml)}
|
||||||
redirect_to admin_home_index_path
|
redirect_to admin_home_index_path
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -13,16 +13,17 @@ class UsersController < ApplicationController
|
|||||||
redirect_to users_url
|
redirect_to users_url
|
||||||
end
|
end
|
||||||
def fb_set_default_publish_page
|
def fb_set_default_publish_page
|
||||||
if params["page"].nil? || !(current_user.provider=="facebook")
|
if Fetsite::Application.config.facebookconfig_enabled
|
||||||
redirect_to intern_home_index_path
|
if params["page"].nil? || !(current_user.provider=="facebook")
|
||||||
else
|
redirect_to intern_home_index_path
|
||||||
@fbu=FbGraph::User.new(current_user.uid.to_s).fetch(:access_token=>session["fbuser_access_token"])
|
else
|
||||||
File.open("config/page.yml",'w'){|f| f.write(@fbu.accounts(:access_token=>session["fbuser_access_token"]).select { |p| p.name == params["page"] }.first.to_yaml)}
|
@fbu=FbGraph::User.new(current_user.uid.to_s).fetch(:access_token=>session["fbuser_access_token"])
|
||||||
logger.info @fbu.to_s
|
File.open("config/page.yml",'w'){|f| f.write(@fbu.accounts(:access_token=>session["fbuser_access_token"]).select { |p| p.name == params["page"] }.first.to_yaml)}
|
||||||
logger.info "FbGraph Access" + session["fbuser_access_token"]
|
logger.info @fbu.to_s
|
||||||
redirect_to admin_home_index_path
|
logger.info "FbGraph Access" + session["fbuser_access_token"]
|
||||||
|
redirect_to admin_home_index_path
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def all_update
|
def all_update
|
||||||
|
|||||||
@@ -1,20 +1,30 @@
|
|||||||
<p><%= link_to "Grant extra FB privileges", user_omniauth_authorize_path(:facebook,:params=>{scope:"manage_pages,publish_actions,email"}) %>
|
<h1>Administration</h1>
|
||||||
</p>
|
|
||||||
<p>
|
<p>
|
||||||
<%= link_to "user", users_path %>
|
<%= link_to "user", users_path %>
|
||||||
</p>
|
</p>
|
||||||
|
<% if Fetsite::Application.config.facebookconfig_enabled %>
|
||||||
|
<h2>Facebook Konfiguration</h2>
|
||||||
|
<p><%= link_to "Grant extra FB privileges", user_omniauth_authorize_path(:facebook,:params=>{scope:"manage_pages,publish_actions,email"}), :confirm=>"Wirklich?" %>
|
||||||
|
</p>
|
||||||
<p>
|
<p>
|
||||||
<%= @fbu.to_yaml.to_s %>
|
<%= @fbu.to_yaml.to_s %>
|
||||||
|
|
||||||
<%= semantic_form_for :set_page, url: fb_set_default_publish_page_user_path(current_user), html:{method: :get} do |f| %>
|
<%= semantic_form_for :set_page, url: fb_set_default_publish_page_user_path(current_user), html:{method: :get} do |f| %>
|
||||||
<%= f.input :page , :input_html => { :name => 'page' }%>
|
<%= f.input :page , :input_html => { :name => 'page' }%>
|
||||||
<% end %>
|
|
||||||
|
|
||||||
<%= semantic_form_for :set_thema, url: choose_contact_topics_home_index_path, html:{method: :get} do |f| %>
|
|
||||||
<%= f.input :themen, :input_html=> {:name=>'themen'}, :as=>:select ,:multiple=>true,:collection =>Thema.all%>
|
|
||||||
|
|
||||||
<%= f.actions do %>
|
|
||||||
<%= f.action :submit, :as => :button, :label=> I18n.t("common.save" ) %>
|
<%= f.action :submit, :as => :button, :label=> I18n.t("common.save" ) %>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
|
<h2>Kontaktseite, Themen:</h2>
|
||||||
|
<% @kontaktthemen.each do |tt| %>
|
||||||
|
<%= render tt %>
|
||||||
|
<%= link_to "rm" ,choose_contact_topics_home_index_path(:params=>{:rmthema=>tt.id}) %>
|
||||||
|
<% end %>
|
||||||
|
<%= semantic_form_for :set_thema, url: choose_contact_topics_home_index_path, html:{method: :get} do |f| %>
|
||||||
|
<%= f.input :themen, :input_html=> {:name=>'themen'}, :as=>:select ,:multiple=>true,:collection =>Thema.all,:value=>10 %>
|
||||||
|
|
||||||
|
<%= f.actions do %>
|
||||||
|
<%= f.action :submit, :as => :button, :label=> "Hinzufuegen" %>
|
||||||
|
<% end %>
|
||||||
|
<% end %>
|
||||||
</p>
|
</p>
|
||||||
|
|||||||
@@ -35,4 +35,6 @@ Fetsite::Application.configure do
|
|||||||
|
|
||||||
# Expands the lines which load the assets
|
# Expands the lines which load the assets
|
||||||
config.assets.debug = false
|
config.assets.debug = false
|
||||||
|
|
||||||
|
config.facebookconfig_enabled=true
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -65,4 +65,7 @@ Fetsite::Application.configure do
|
|||||||
# Log the query plan for queries taking more than this (works
|
# Log the query plan for queries taking more than this (works
|
||||||
# with SQLite, MySQL, and PostgreSQL)
|
# with SQLite, MySQL, and PostgreSQL)
|
||||||
# config.active_record.auto_explain_threshold_in_seconds = 0.5
|
# config.active_record.auto_explain_threshold_in_seconds = 0.5
|
||||||
|
|
||||||
|
config.facebookconfig_enabled=true
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user