ruling_template/app/views/admin/ruling_templates/index.html.erb

44 lines
1.5 KiB
Plaintext
Raw Permalink Normal View History

2017-08-02 09:07:55 +00:00
<%= csrf_meta_tags %>
<% content_for :page_specific_css do %>
<%= stylesheet_link_tag "ruling_template/template" %>
<% end %>
<ul id="template-holder">
<%= render :partial => "template", :collection => @templates %>
</ul>
<div id="templateDisplay" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h3 id="templateTitle">Modal header</h3>
</div>
<div class="modal-body" id="template-body">
<p>One fine body…</p>
</div>
<div class="modal-footer">
<a id="edit-button" class="btn btn-primary" href="">Edit</a>
<a data-method="delete" data-confirm="Are you sure?" id="delete-button" class="btn btn-danger" href="">Delete</a>
<button class="btn" data-dismiss="modal" aria-hidden="true">Close</button>
</div>
</div>
2021-05-11 02:31:38 +00:00
<%=
content_tag :div, class: "bottomnav clearfix" do
content_tag :div, paginate(@templates), class: "pagination pagination-centered"
end
%>
2017-08-02 09:07:55 +00:00
<script type="text/javascript">
$(".template-display-btn").on("click",function(){
var el = $(this);
$.ajax({
url : el.attr("href"),
type : "get",
dataType : "html"
}).done(function(html){
$("#templateTitle").text(el.data("title"));
$("#template-body").html(html);
$("#edit-button").attr("href", el.attr("href") + "/edit");
$("#delete-button").attr("href", el.attr("href"));
$("#templateDisplay").modal("show");
})
return false;
})
</script>