changed the etherpad url
This commit is contained in:
@@ -10,7 +10,7 @@ class Document < ActiveRecord::Base
|
|||||||
has_paper_trail
|
has_paper_trail
|
||||||
TYPS = { 1=>"fet_docs", 10=>"protocol", 11=> "agenda"}
|
TYPS = { 1=>"fet_docs", 10=>"protocol", 11=> "agenda"}
|
||||||
has_many :attachments, :as=>:parent
|
has_many :attachments, :as=>:parent
|
||||||
def long_name
|
def long_name
|
||||||
if self.parent.class=="Meeting"
|
if self.parent.class=="Meeting"
|
||||||
"<b>"+self.parent.text+ "</b>"+ self.name
|
"<b>"+self.parent.text+ "</b>"+ self.name
|
||||||
else
|
else
|
||||||
@@ -18,20 +18,20 @@ class Document < ActiveRecord::Base
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
def self.new_divid_for(parent)
|
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
|
end
|
||||||
def divid
|
def divid
|
||||||
"document_"+self.id.to_s
|
"document_"+self.id.to_s
|
||||||
end
|
end
|
||||||
def self.ether
|
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
|
end
|
||||||
def create_pdf
|
def create_pdf
|
||||||
require "open3"
|
require "open3"
|
||||||
|
|
||||||
#url=blank_document_url({id: self.id, host: host, port: port})
|
#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})
|
# url=Rails.application.routes.url_helpers.blank_document_url({id: self.id, host: host, port: port})
|
||||||
|
|
||||||
file = Tempfile.new(['document', '.pdf'])
|
file = Tempfile.new(['document', '.pdf'])
|
||||||
bin=Rails.application.config.pdf_bin
|
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}")
|
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
|
end
|
||||||
def move_to_etherpad
|
def move_to_etherpad
|
||||||
unless self.is_etherpad? || self.id.nil?
|
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>'
|
self.ep_pad.html = '<div>'+self.text+'</div>'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
def dump_to_etherpad
|
def dump_to_etherpad
|
||||||
if self.is_etherpad?
|
if self.is_etherpad?
|
||||||
@@ -83,7 +83,7 @@ class Document < ActiveRecord::Base
|
|||||||
end
|
end
|
||||||
def read_from_etherpad
|
def read_from_etherpad
|
||||||
self.text=ApplicationController.helpers.strip_control_chars( self.ep_pad.html)
|
self.text=ApplicationController.helpers.strip_control_chars( self.ep_pad.html)
|
||||||
|
|
||||||
end
|
end
|
||||||
def ep_pad
|
def ep_pad
|
||||||
self.ep_group.pad(self.etherpadkey)
|
self.ep_group.pad(self.etherpadkey)
|
||||||
@@ -93,16 +93,16 @@ class Document < ActiveRecord::Base
|
|||||||
Document.ether.group(Document::TYPS[t])
|
Document.ether.group(Document::TYPS[t])
|
||||||
end
|
end
|
||||||
def text_stripped
|
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
|
end
|
||||||
searchable do
|
searchable do
|
||||||
text :text, stored: true do |d|
|
text :text, stored: true do |d|
|
||||||
d.text_stripped
|
d.text_stripped
|
||||||
end
|
end
|
||||||
text :name, :boost=>4.0, :stored=> true
|
text :name, :boost=>4.0, :stored=> true
|
||||||
text :meeting, stored: true do |d|
|
text :meeting, stored: true do |d|
|
||||||
(d.parent.is_a?(Meeting))? d.try(:parent).try(:text).to_s : ""
|
(d.parent.is_a?(Meeting))? d.try(:parent).try(:text).to_s : ""
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
def maketoc
|
def maketoc
|
||||||
@@ -116,20 +116,20 @@ class Document < ActiveRecord::Base
|
|||||||
l=2
|
l=2
|
||||||
f=true;
|
f=true;
|
||||||
s="<ul>"
|
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></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)
|
if (h["level"]>l)
|
||||||
s=s + "<ul><li>" * (h["level"]-l)
|
s=s + "<ul><li>" * (h["level"]-l)
|
||||||
else
|
else
|
||||||
s=s+"<li>"
|
s=s+"<li>"
|
||||||
end
|
end
|
||||||
s=s+h["text"]
|
s=s+h["text"]
|
||||||
|
|
||||||
l = h["level"]
|
l = h["level"]
|
||||||
f=false
|
f=false
|
||||||
end
|
end
|
||||||
s=s+"</ul>"*(l-2) if (l>2)
|
s=s+"</ul>"*(l-2) if (l>2)
|
||||||
s=s+"</ul>"
|
s=s+"</ul>"
|
||||||
self.toc=s
|
self.toc=s
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user