changed the etherpad url
This commit is contained in:
@@ -10,7 +10,7 @@ class Document < ActiveRecord::Base
|
||||
has_paper_trail
|
||||
TYPS = { 1=>"fet_docs", 10=>"protocol", 11=> "agenda"}
|
||||
has_many :attachments, :as=>:parent
|
||||
def long_name
|
||||
def long_name
|
||||
if self.parent.class=="Meeting"
|
||||
"<b>"+self.parent.text+ "</b>"+ self.name
|
||||
else
|
||||
@@ -18,20 +18,20 @@ class Document < ActiveRecord::Base
|
||||
end
|
||||
end
|
||||
def self.new_divid_for(parent)
|
||||
"document_new_parent_" + parent.class.to_s + "_" + parent.id.to_s
|
||||
"document_new_parent_" + parent.class.to_s + "_" + parent.id.to_s
|
||||
end
|
||||
def divid
|
||||
"document_"+self.id.to_s
|
||||
end
|
||||
def self.ether
|
||||
EtherpadLite.connect('https://www.etherpad.fet.at', File.new('config/etherpad/APIKEY.txt'))
|
||||
EtherpadLite.connect('https://www.fet.at/etherpad', File.new('config/etherpad/APIKEY.txt'))#https://www.etherpad.fet.at
|
||||
end
|
||||
def create_pdf
|
||||
require "open3"
|
||||
|
||||
|
||||
#url=blank_document_url({id: self.id, host: host, port: port})
|
||||
# url=Rails.application.routes.url_helpers.blank_document_url({id: self.id, host: host, port: port})
|
||||
|
||||
|
||||
file = Tempfile.new(['document', '.pdf'])
|
||||
bin=Rails.application.config.pdf_bin
|
||||
sin,sout,serr=Open3.popen3("#{bin} --header-html \"file://#{Rails.root}/app/views/documents/header.html\" --footer-html \"file://#{Rails.root}/app/views/documents/footer.html\" --replace title1 \"#{self.name}\" - #{file.path}")
|
||||
@@ -70,9 +70,9 @@ class Document < ActiveRecord::Base
|
||||
end
|
||||
def move_to_etherpad
|
||||
unless self.is_etherpad? || self.id.nil?
|
||||
self.etherpadkey="document_"+ self.id.to_s
|
||||
self.etherpadkey="document_"+ self.id.to_s
|
||||
self.ep_pad.html = '<div>'+self.text+'</div>'
|
||||
end
|
||||
end
|
||||
end
|
||||
def dump_to_etherpad
|
||||
if self.is_etherpad?
|
||||
@@ -83,7 +83,7 @@ class Document < ActiveRecord::Base
|
||||
end
|
||||
def read_from_etherpad
|
||||
self.text=ApplicationController.helpers.strip_control_chars( self.ep_pad.html)
|
||||
|
||||
|
||||
end
|
||||
def ep_pad
|
||||
self.ep_group.pad(self.etherpadkey)
|
||||
@@ -93,16 +93,16 @@ class Document < ActiveRecord::Base
|
||||
Document.ether.group(Document::TYPS[t])
|
||||
end
|
||||
def text_stripped
|
||||
ApplicationController.helpers.strip_control_chars(ApplicationController.helpers.strip_tags(text.to_s.gsub("<"," <").gsub(">","> ").to_s))
|
||||
|
||||
ApplicationController.helpers.strip_control_chars(ApplicationController.helpers.strip_tags(text.to_s.gsub("<"," <").gsub(">","> ").to_s))
|
||||
|
||||
end
|
||||
searchable do
|
||||
text :text, stored: true do |d|
|
||||
d.text_stripped
|
||||
end
|
||||
text :name, :boost=>4.0, :stored=> true
|
||||
text :meeting, stored: true do |d|
|
||||
(d.parent.is_a?(Meeting))? d.try(:parent).try(:text).to_s : ""
|
||||
text :name, :boost=>4.0, :stored=> true
|
||||
text :meeting, stored: true do |d|
|
||||
(d.parent.is_a?(Meeting))? d.try(:parent).try(:text).to_s : ""
|
||||
end
|
||||
end
|
||||
def maketoc
|
||||
@@ -116,20 +116,20 @@ class Document < ActiveRecord::Base
|
||||
l=2
|
||||
f=true;
|
||||
s="<ul>"
|
||||
c.each do |h|
|
||||
c.each do |h|
|
||||
s=s+ "</li></ul></li>"*(l-h["level"]) if (h["level"]<l) and !f
|
||||
s=s+" </li>" if (h["level"]==l) and !f
|
||||
s=s+" </li>" if (h["level"]==l) and !f
|
||||
if (h["level"]>l)
|
||||
s=s + "<ul><li>" * (h["level"]-l)
|
||||
s=s + "<ul><li>" * (h["level"]-l)
|
||||
else
|
||||
s=s+"<li>"
|
||||
end
|
||||
end
|
||||
s=s+h["text"]
|
||||
|
||||
|
||||
l = h["level"]
|
||||
f=false
|
||||
end
|
||||
s=s+"</ul>"*(l-2) if (l>2)
|
||||
s=s+"</ul>"*(l-2) if (l>2)
|
||||
s=s+"</ul>"
|
||||
self.toc=s
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user