diff --git a/app/controllers/comments_controller.rb b/app/controllers/comments_controller.rb
index c3b6a2c..fb3a87c 100644
--- a/app/controllers/comments_controller.rb
+++ b/app/controllers/comments_controller.rb
@@ -51,7 +51,7 @@ end
authorize! :comment, c
@comment = Comment.build_for(c, current_user,"", params_new)
-
+ @commentable=c
if @comment.parent_object.class==Comment
@comments= @comment.parent_object.children
else
diff --git a/app/controllers/lvas_controller.rb b/app/controllers/lvas_controller.rb
index 234cf3a..137bc89 100755
--- a/app/controllers/lvas_controller.rb
+++ b/app/controllers/lvas_controller.rb
@@ -16,16 +16,11 @@ class LvasController < ApplicationController
end
def beispiel_sammlung
@lva = Lva.find_by_id(params[:id])
- #Attachment name
filename = 'beispiel_sammlung_' + @lva.lvanr.to_s + '_' + l(Date.today).to_s + '.zip'
temp_file = Tempfile.new(filename)
begin
- #This is the tricky part
- #Initialize the temp file as a zip file
Zip::OutputStream.open(temp_file) { |zos| }
- #Add files to the zip file as usual
Zip::File.open(temp_file.path, Zip::File::CREATE) do |zip|
- #Put files in here
i=1
@lva.beispiele.each do |bsp|
zip.add(i.to_s + '_' + File.basename(bsp.beispieldatei.current_path), bsp.beispieldatei.current_path)
@@ -53,29 +48,26 @@ class LvasController < ApplicationController
@beispiele_deleted = @lva.beispiele.flag_delete.order(:datum).accessible_by(current_ability, :show)
@toolbar_elements =[]
@toolbar_elements<<{:hicon=>'icon-pencil', :icon=>:pencil,:text =>I18n.t('common.manage'),:path => verwalten_lva_path(@lva)} if can? :verwalten, @lva
- @crawlobjects = @lva.crawlobjects.roots.accessible_by(current_ability)
+ @crawlobjects = @lva.crawlobjects.roots.accessible_by(current_ability)
+ @questions=@lva.questions.accessible_by(current_ability,:show)
end
+
def verwalten
@lva = Lva.find_by_id(params[:id])
@beispiel=Beispiel.new
- @beispiele_all=@lva.beispiele.order(:datum).accessible_by(current_ability, :show)
+ @beispiele_all=@lva.beispiele.order(:datum).accessible_by(current_ability, :show)
@beispiele = @lva.beispiele.not_flag_badquality.not_flag_delete.order(:lecturer_id,:datum).accessible_by(current_ability, :show)
@beispiele_badQ = @lva.beispiele.flag_badquality.not_flag_delete.order(:datum).accessible_by(current_ability, :show)
@beispiele_deleted = @lva.beispiele.flag_delete.order(:datum).accessible_by(current_ability, :show)
-
render :show
end
- # GET /lvas/new
- # GET /lvas/new.json
def new
@lva = Lva.new
modul=Modul.find_by_id(params[:modul_id])
@lva.modul<
@@ -115,6 +120,7 @@