forked from bofh/fetsite
AutoCommit Don Aug 6 21:03:01 CEST 2015
This commit is contained in:
@@ -26,7 +26,7 @@ class CalentriesController < ApplicationController
|
|||||||
# GET /calentries/new.json
|
# GET /calentries/new.json
|
||||||
def new
|
def new
|
||||||
@calentry = Calentry.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
|
@calentry.typ=1
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html # new.html.erb
|
format.html # new.html.erb
|
||||||
|
|||||||
@@ -43,6 +43,8 @@ cannot :destroy, Comment
|
|||||||
end
|
end
|
||||||
if ((user.has_role?("moderator",Beispiel)) || user.has_role?("fetuser") || user.has_role?("fetadmin"))
|
if ((user.has_role?("moderator",Beispiel)) || user.has_role?("fetuser") || user.has_role?("fetadmin"))
|
||||||
can :flag, Beispiel
|
can :flag, Beispiel
|
||||||
|
can [:create, :show], Beispiel, flag_delete: true
|
||||||
|
|
||||||
can [:edit, :update], Beispiel
|
can [:edit, :update], Beispiel
|
||||||
can :flag, Beispiel
|
can :flag, Beispiel
|
||||||
can :set_lecturer, Beispiel
|
can :set_lecturer, Beispiel
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ class Beispiel < ActiveRecord::Base
|
|||||||
|
|
||||||
belongs_to :lecturer
|
belongs_to :lecturer
|
||||||
FLAG_ICONS = {"badquality"=>"fa fa-flag","goodquality"=>"fa fa-flag", "delete"=>"fa fa-trash"}
|
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 :not_flag_badquality, ->{where("flag_badquality IS NULL OR flag_badquality=?",false)}
|
||||||
scope :flag_badquality, ->{where("flag_badquality=?",true)}
|
scope :flag_badquality, ->{where("flag_badquality=?",true)}
|
||||||
scope :not_flag_delete, ->{where("flag_delete IS NULL OR flag_delete=?",false)}
|
scope :not_flag_delete, ->{where("flag_delete IS NULL OR flag_delete=?",false)}
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ class Survey::Question < ActiveRecord::Base
|
|||||||
has_many :answers, through: :choices
|
has_many :answers, through: :choices
|
||||||
include IsCommentable
|
include IsCommentable
|
||||||
FLAG_ICONS={"delete" => "fa fa-trash"}
|
FLAG_ICONS={"delete" => "fa fa-trash"}
|
||||||
|
FLAG_CONFIRM={}
|
||||||
scope :templates, ->{ where(flag_template:true)}
|
scope :templates, ->{ where(flag_template:true)}
|
||||||
acts_as_flagable
|
acts_as_flagable
|
||||||
|
|
||||||
|
|||||||
@@ -3,4 +3,6 @@
|
|||||||
<%= render ce unless ce.nil? %>
|
<%= render ce unless ce.nil? %>
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
<div id="calentry_new_<%= parent.class.to_s + "_" + parent.id.to_s %>" ><%= link_to "new Calentry", new_calentry_path(:object_id=>@neuigkeit.id, :object_type=>"Neuigkeit"), :remote=>true if can? :edit, @neuigkeit %></div>
|
<div id="<%= divid_for(parent,"new_calentry") %>" >
|
||||||
|
<%= link_to "new Calentry", new_calentry_path(:object_id=>@neuigkeit.id, :object_type=>"Neuigkeit"), :remote=>true if can? :edit, @neuigkeit %>
|
||||||
|
</div>
|
||||||
|
|||||||
@@ -1,2 +1 @@
|
|||||||
alert("sdf");
|
$("#<%= divid_for(@calentry.object,"new_calentry") %>").replaceWith("<div id=\"calentry_<%= @calentry.id %>\"> <%=escape_javascript( render :partial=>"calentry", :object=>@calentry)%> </div><div id=\"<%= divid_for(@calentry.object,"new_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) %></div>");
|
||||||
$("#calentry_new").replaceWith("<div id=\"calentry_<%= @calentry.id %>\"> <%=escape_javascript( render :partial=>"calentry", :object=>@calentry)%> </div><div id=\"calentry_new\"><%= escape_javascript( link_to "new Calentry", new_calentry_path, :remote=>true) %></div>");
|
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
$("#calentry_new_<%= @calentry.object.class.to_s + "_" + @calentry.object.id.to_s %>").replaceWith("<div id=\"calentry_new_<%= @calentry.object.class.to_s + "_" + @calentry.object.id.to_s %>\"><%=escape_javascript( render :partial=>"nested_form" ,:object=>@calentry) %></div>");
|
$("#<%= divid_for(@calentry.object,"new_calentry") %>").replaceWith("<div id=\"<%= divid_for(@calentry.object,"new_calentry") %>\"><%=escape_javascript( render :partial=>"nested_form" ,:object=>@calentry) %></div>");
|
||||||
$('.datetimepicker').datetimepicker({format: 'd.m.Y H:i', startDate: (!($(this).attr("value")==undefined))? $(this).attr("value"): ""})
|
$('.datetimepicker').datetimepicker({format: 'd.m.Y H:i', startDate: (!($(this).attr("value")==undefined))? $(this).attr("value"): ""})
|
||||||
|
|
||||||
@@ -65,7 +65,8 @@ module Flagable
|
|||||||
fc = obj.class::FLAG_CONFIRM
|
fc = obj.class::FLAG_CONFIRM
|
||||||
value=obj.send("flag_"+flag)
|
value=obj.send("flag_"+flag)
|
||||||
cstyle=(value) ? "true" :"false"
|
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
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user