var closeButton = {
  text: "<%=j l(:button_close) -%>",
  click: function() {$(this).dialog('close');},
  'class': 'button'
};
var modal = $('#ajax-modal');
showModal('ajax-modal', '80%');

modal.html("<%=j form_for(@easy_attendance) {|f| render(:partial => 'form', :locals => {:f => f, :easy_attendance  => @easy_attendance, :modul_uniq_id => '', :easy_attendance_activities => @easy_attendance_activities}) }  %>");
<% if @easy_attendance.can_delete? %>
modal.append("<%=j link_to(l(:button_delete), easy_attendance_path(@easy_attendance, {:back_url => back_url}), :method => :delete, :data => {:confirm => l(:text_are_you_sure)}, :class => 'icon icon-del button') %>");
<% end -%>

var submitButton = {
  text:"<%=j l(:button_update) -%>",
  click: function() {$(this).find('form').submit()},
  'class': 'button-positive'
};

modal.dialog('option', {
  title: "<%=j l(:edit, :scope => :easy_attendance, :date => format_date(@easy_attendance.arrival)) -%>",
  buttons: [closeButton, submitButton]
});

iniEasyAttendanceActivityChanger();

modal.append("<%=j easy_journal_render_history(@journals, {:entity => @easy_attendance}) -%>");
EASY.journals.collapseUnnecessary();
