61 lines
2.0 KiB
Plaintext
61 lines
2.0 KiB
Plaintext
<%= stylesheet_link_tag "member_select" %>
|
|
<%= stylesheet_link_tag "lib/checkbox-card" %>
|
|
<style>
|
|
.checkbox-card li .member-pic {
|
|
float: left;
|
|
margin-right: 5px;
|
|
width: 40px;
|
|
height: 40px;
|
|
}
|
|
</style>
|
|
<div class="modal hide fade" tabindex="-1" role="dialog" id="role_modal">
|
|
<div class="modal-dialog" role="document">
|
|
<div class="modal-content">
|
|
<div class="modal-header">
|
|
<h5 class="modal-title"><%=t(:role)%></h5>
|
|
</div>
|
|
<div class="modal-body">
|
|
<div class="member-filter-result nano">
|
|
<div>
|
|
<ul class="checkbox-card clearfix">
|
|
<% @selected_role_ids = @selected_role_ids.to_a %>
|
|
<% @selected_roles = [] %>
|
|
<% @roles.each do |role| %>
|
|
<% if @selected_role_ids.include?(role.id.to_s) %>
|
|
<% @selected_roles << render(:partial => "role_card",:locals=>{:role=>role,:checked=>true}) %>
|
|
<% else %>
|
|
<%= render :partial => "role_card",:locals=>{:role=>role} %>
|
|
<% end %>
|
|
<% end %>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="modal-footer">
|
|
<button type="button" class="btn btn-primary save_button">Save changes</button>
|
|
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<script>
|
|
$(document).ready(function(){
|
|
function set_modal_max_height(){
|
|
var modal_body = $(this).find(".modal-body");
|
|
modal_body.css("max-height","auto");
|
|
var window_height = $(window).height();
|
|
var max_height = window_height - $(".modal-header").height() - $(".modal-footer").height() - 20 - window_height * 0.2 - 15 * 2;
|
|
modal_body.css("max-height",max_height);
|
|
}
|
|
$(".modal").on("shown.bs.modal",set_modal_max_height);
|
|
$(window).resize(function(){
|
|
set_modal_max_height.call($(".modal"));
|
|
})
|
|
$(".save_button").off("click").on("click",function(){
|
|
var modal = $(this).parents(".modal");
|
|
var li_selected = modal.find(".check-item input:checked").parents("li");
|
|
$("<%=@target%>").append(li_selected);
|
|
modal.modal('hide');
|
|
})
|
|
})
|
|
</script> |