39 lines
1.4 KiB
Plaintext
39 lines
1.4 KiB
Plaintext
<%= 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>
|
||
<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> |