document/meeting updates

This commit is contained in:
Andreas Stephanides
2015-01-03 10:06:58 +01:00
parent de8802c34a
commit d72f78488d
24 changed files with 278 additions and 54 deletions

View File

@@ -1,5 +1,5 @@
class DocumentsController < ApplicationController
# require('etherpad-lite')
load_and_authorize_resource
def index
respond_to do |format|
@@ -18,13 +18,64 @@ class DocumentsController < ApplicationController
end
def edit
@document = Document.find(params[:id])
@parent=@document.parent
respond_to do |format|
format.js
end
end
def dump_to_etherpad
@document = Document.find(params[:id])
@document.dump_to_etherpad
@document.save
# author = ether.author('author_1')
# pad=group.pad(@document.etherpadkey)
# pad.html='<div>'+@document.text+'</div>'
redirect_to action: :show
end
def read_from_etherpad
@document = Document.find(params[:id])
@document.read_from_etherpad
@document.save
render :show
end
def write_etherpad
@document = Document.find(params[:id])
ether=Document.ether
author = Document.ether.author("fetsite_"+current_user.uid, :name => current_user.text)
author = Document.ether.author("author_1")
session[:ep_sessions]={} if session[:ep_sessions].nil?
group=@document.ep_group
sess = session[:ep_sessions][group.id] ? ether.get_session(session[:ep_sessions][group.id]) : group.create_session(author, 60)
if sess.expired?
sess.delete
sess = group.create_session(author, 60)
end
session[:ep_sessions][group.id] = sess.id
# Set the EtherpadLite session cookie. This will automatically be picked up by the jQuery plugin's iframe.
cookies[:sessionID] = {:value => sess.id, :domain => "www.fet.at"}
#cookies[:sessionID] = {:value => sess.id}
cookies[:sessionID1]=sess.id
# cookies[:sdf]=sess.id
# pad=ether.pad(@document.etherpadkey)
# redirect_to "http://www.fet.at/etherpad/p/"+@document.ep_pad.id
#render :write
end
def write
@document = Document.find(params[:id])
if @document.is_etherpad?
redirect_to action: :write_etherpad
else
@parent=@document.parent
respond_to do |format|
format.html
end
end
end
def create

View File

@@ -2,7 +2,8 @@ class HomeController < ApplicationController
def index
@beispiele = Beispiel.last([Beispiel.count, 3].min)
@neuigkeiten = Neuigkeit.recent
t=YAML.load_file("#{::Rails.root.to_s}/config/start_topic.yml")
@starttopic= @themen = Thema.where(:id=>t).first
end
def dev

View File

@@ -42,8 +42,8 @@ end
@meeting=Meeting.new
@meeting.parent=params[:parent_type].constantize.find(params[:parent_id])
@parent=@meeting.parent
@meeting.calentry=Calentry.new
# @meeting.typ = 1
@meeting.calentry=Calentry.new
@meeting.calentry.typ = 2
respond_to do |format|
format.js
end

View File

@@ -11,7 +11,7 @@ class ThemenController < ApplicationController
@toolbar_elements = [{:icon=>:pencil, :hicon=>'icon-pencil', :text=>I18n.t("thema.manage"), :path=>verwalten_thema_path(@thema)}]
@toolbar_elements << [{:icon=>:pencil, :hicon=>'icon-pencil', :text=>I18n.t('thema.edit'), :path=>edit_thema_path(@thema)}]
@toolbar_elements << {:hicon=>'icon-remove-circle', :text=>I18n.t('thema.remove'), :path=>thema_path(@thema), :method=>:delete, :confirm=>I18n.t('thema.sure')}
respond_to do |format|
format.html {
redirect_to :controller=>'themengruppen', :id=>@thema.themengruppe.id, :action=>:show, :anchor=> "thema_"+params[:id].to_s
@@ -40,6 +40,11 @@ class ThemenController < ApplicationController
# @thema.text = @thema.text.sanitize
render :edit
end
def version
@thema = Thema.find(params[:id])
end
def verwalten
@thema = Thema.find(params[:id])
@attachment=Attachment.new
@@ -67,7 +72,7 @@ class ThemenController < ApplicationController
def edit
@thema = Thema.find(params[:id])
respond_to do |format|
format.html
format.js { @themen= @thema.themengruppe.themen }
@@ -107,7 +112,14 @@ class ThemenController < ApplicationController
format.js
end
end
def attachments
def documents
@thema = Thema.find(params[:id])
@documents=@thema.documents
respond_to do |format|
format.js
end
end
def attachments
@thema = Thema.find(params[:id])
@attachments=@thema.attachments
@attachment=Attachment.new