Interface Neuigkeiten & Attachment
This commit is contained in:
@@ -40,6 +40,7 @@ class Ability
|
||||
can :showintern, Thema
|
||||
can :manage, Thema
|
||||
can :manage, Themengruppe
|
||||
can :manage, Attachment
|
||||
end
|
||||
unless user.has_role?("fetadmin")
|
||||
cannot :delete, Themengruppe
|
||||
|
||||
@@ -18,6 +18,13 @@ class Attachment < ActiveRecord::Base
|
||||
validates :thema, :presence => true
|
||||
validates :name, :presence => true
|
||||
|
||||
def image?
|
||||
|
||||
# data_ext = datei.file.extension.downcase
|
||||
# %w(jpg png jpeg).include?(data_ext)
|
||||
datei.image?(datei.file)
|
||||
end
|
||||
|
||||
def to_jq_upload
|
||||
{
|
||||
"id" => read_attribute(:id),
|
||||
|
||||
@@ -49,7 +49,9 @@ include Rails.application.routes.url_helpers
|
||||
|
||||
def fix_links(host)
|
||||
full_url= URI.parse(root_url(:host=>host))
|
||||
self.text.gsub!(/src="[^"]*attachment\/datei\/(\d+)[^"]*"/){|s| full_url.path=Attachment.find($1.to_i).datei.url; 'src="'+full_url.to_s+'"'}
|
||||
self.text.gsub!(/src="[\.\/]*uploads\/attachment\/datei\/(\d+)\/thumb_big[^"]*"/){|s| full_url.path=Attachment.find($1.to_i).datei.thumb_big.url; 'src="'+full_url.to_s+'"'}
|
||||
self.text.gsub!(/src="[\.\/^"]*uploads\/attachment\/datei\/(\d+)\/[^"]*"/){|s| full_url.path=Attachment.find($1.to_i).datei.url; 'src="'+full_url.to_s+'"'}
|
||||
|
||||
self.text.gsub!(/href="[^"]*themen\/(\d+)[^"]*"/){|s| full_url.path=thema_path(Thema.find($1.to_i)); 'href="'+full_url.to_s+'"'}
|
||||
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user