custom_announcement/app/views/admin/custom_announcements/index.html.erb

37 lines
1.2 KiB
Plaintext

<%= render_filter @filter_fields, "index_table" %>
<% custom_config = CustomBulletinConfig.where(:module=>params[:custom_module]).first %>
<% target_model = custom_config.bind_model.constantize %>
<h3><%= target_model.where(custom_config.uid_field=>params[:bind_uid]).first.send(custom_config.title_field) %></h3>
<span id="index_table">
<%= render 'index'%>
</span>
<%= render 'layouts/delete_modal', delete_options: @delete_options %>
<% if CustomAnnouncementSetting.is_pro? && user_can_approve? %>
<%= render :partial=> "approval_modal" %>
<script type="text/javascript">
$(function(){
var modal = $("#approvalModal");
$(document).on("click", ".approval_button",function(){
var url = $(this).attr("href");
if(window.location.protocol === "https:"){
url = url.replace("http:","https:");
}
modal.find("iframe").attr("src", url);
modal.find("#object_id").val($(this).data("id"));
modal.modal("show");
return false;
})
var params = getUrlVars();
console.log(params["url"])
if(typeof params["url"] != "undefined"){
modal.find("iframe").attr("src", params["url"]);
modal.find("#object_id").val(params["id"]);
modal.modal("show");
}
})
</script>
<% end %>