diff --git a/app/controllers/calentries_controller.rb b/app/controllers/calentries_controller.rb
index 6a797e1..59a52f7 100644
--- a/app/controllers/calentries_controller.rb
+++ b/app/controllers/calentries_controller.rb
@@ -26,7 +26,7 @@ class CalentriesController < ApplicationController
# GET /calentries/new.json
def new
@calentry = Calentry.new
- @calentry.object="Neuigkeit".constantize.find(params[:object_id])
+ @calentry.object=params[:object_type].constantize.find(params[:object_id])
@calentry.typ=1
respond_to do |format|
format.html # new.html.erb
diff --git a/app/models/ability.rb b/app/models/ability.rb
index a4ad4db..324c256 100755
--- a/app/models/ability.rb
+++ b/app/models/ability.rb
@@ -43,6 +43,8 @@ cannot :destroy, Comment
end
if ((user.has_role?("moderator",Beispiel)) || user.has_role?("fetuser") || user.has_role?("fetadmin"))
can :flag, Beispiel
+ can [:create, :show], Beispiel, flag_delete: true
+
can [:edit, :update], Beispiel
can :flag, Beispiel
can :set_lecturer, Beispiel
diff --git a/app/models/beispiel.rb b/app/models/beispiel.rb
index 69f6660..39c2bc0 100755
--- a/app/models/beispiel.rb
+++ b/app/models/beispiel.rb
@@ -20,6 +20,7 @@ class Beispiel < ActiveRecord::Base
belongs_to :lecturer
FLAG_ICONS = {"badquality"=>"fa fa-flag","goodquality"=>"fa fa-flag", "delete"=>"fa fa-trash"}
+ FLAG_CONFIRM={}
scope :not_flag_badquality, ->{where("flag_badquality IS NULL OR flag_badquality=?",false)}
scope :flag_badquality, ->{where("flag_badquality=?",true)}
scope :not_flag_delete, ->{where("flag_delete IS NULL OR flag_delete=?",false)}
diff --git a/app/models/survey/question.rb b/app/models/survey/question.rb
index 7fa1c12..892a038 100644
--- a/app/models/survey/question.rb
+++ b/app/models/survey/question.rb
@@ -5,6 +5,7 @@ class Survey::Question < ActiveRecord::Base
has_many :answers, through: :choices
include IsCommentable
FLAG_ICONS={"delete" => "fa fa-trash"}
+ FLAG_CONFIRM={}
scope :templates, ->{ where(flag_template:true)}
acts_as_flagable
diff --git a/app/views/calentries/_calentry_list.html.erb b/app/views/calentries/_calentry_list.html.erb
index d308b05..d789b06 100644
--- a/app/views/calentries/_calentry_list.html.erb
+++ b/app/views/calentries/_calentry_list.html.erb
@@ -3,4 +3,6 @@
<%= render ce unless ce.nil? %>
<% end %>
-
" ><%= link_to "new Calentry", new_calentry_path(:object_id=>@neuigkeit.id, :object_type=>"Neuigkeit"), :remote=>true if can? :edit, @neuigkeit %>
+" >
+<%= link_to "new Calentry", new_calentry_path(:object_id=>@neuigkeit.id, :object_type=>"Neuigkeit"), :remote=>true if can? :edit, @neuigkeit %>
+
diff --git a/app/views/calentries/create.js.erb b/app/views/calentries/create.js.erb
index 302cda5..b398491 100644
--- a/app/views/calentries/create.js.erb
+++ b/app/views/calentries/create.js.erb
@@ -1,2 +1 @@
-alert("sdf");
-$("#calentry_new").replaceWith("\"> <%=escape_javascript( render :partial=>"calentry", :object=>@calentry)%>
<%= escape_javascript( link_to "new Calentry", new_calentry_path, :remote=>true) %>
");
+$("#<%= divid_for(@calentry.object,"new_calentry") %>").replaceWith("\"> <%=escape_javascript( render :partial=>"calentry", :object=>@calentry)%>
\"><%= escape_javascript( link_to "new Calentry", new_calentry_path(:object_id=>@calentry.object.id.to_s, :object_type=>@calentry.object.class.to_s), :remote=>true) %>
");
diff --git a/app/views/calentries/new.js.erb b/app/views/calentries/new.js.erb
index 7d7e082..5251e10 100644
--- a/app/views/calentries/new.js.erb
+++ b/app/views/calentries/new.js.erb
@@ -1,3 +1,3 @@
-$("#calentry_new_<%= @calentry.object.class.to_s + "_" + @calentry.object.id.to_s %>").replaceWith("\"><%=escape_javascript( render :partial=>"nested_form" ,:object=>@calentry) %>
");
+$("#<%= divid_for(@calentry.object,"new_calentry") %>").replaceWith("\"><%=escape_javascript( render :partial=>"nested_form" ,:object=>@calentry) %>
");
$('.datetimepicker').datetimepicker({format: 'd.m.Y H:i', startDate: (!($(this).attr("value")==undefined))? $(this).attr("value"): ""})
-
\ No newline at end of file
+
diff --git a/lib/flagable.rb b/lib/flagable.rb
index e3215c8..2cee7f1 100644
--- a/lib/flagable.rb
+++ b/lib/flagable.rb
@@ -65,7 +65,8 @@ module Flagable
fc = obj.class::FLAG_CONFIRM
value=obj.send("flag_"+flag)
cstyle=(value) ? "true" :"false"
- link_to ff_icon(fi[flag]), url_for({controller: obj.class.name.tableize,action: :flag, flag: flag, value: !value, theme: nil, locale: nil, id: obj.id}), remote: true, class:("flag-"+cstyle +" flag-"+flag + "-"+cstyle ), id: obj.flaglinkid(flag), data: { confirm: (((!fc.nil? && fc["flag_"+flag].nil?) ? fc["flag_"+flag].nil? : nil)) }
+ cfm = (fc.nil? || fc["flag_"+flag].nil?) ? {} : {confirm: fc["flag_"+flag]}
+ link_to ff_icon(fi[flag]), url_for({controller: obj.class.name.tableize,action: :flag, flag: flag, value: !value, theme: nil, locale: nil, id: obj.id}), remote: true, class:("flag-"+cstyle +" flag-"+flag + "-"+cstyle ), id: obj.flaglinkid(flag), data: cfm
end
end
end