1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-08-02 07:47:32 +00:00

Added a helper function "showConfirmWithExtraOption".

This commit is contained in:
Shuai Lin 2016-05-03 11:43:59 +08:00 committed by lian
parent bdd1fc2054
commit 7514c587d5
2 changed files with 32 additions and 0 deletions

View File

@ -1489,3 +1489,12 @@
<a href="{{ SITE_ROOT }}accounts/logout/" class="item" id="logout">{% trans "Log out" %}</a>
</div>
</script>
<script type="text/template" id="confirm-dialog-with-extra-option-tmpl">
<h3><%= title %></h3>
<p><%= content %></p>
<label class="checkbox-label">
<input type="checkbox" name="confirm-extra-option" id="confirm-extra-option" class="vam" />
<span class="checkbox-option vam"><%= extraOption %></span>
</label>
</script>

View File

@ -289,6 +289,29 @@ define([
$yesBtn.click(yesCallback);
},
confirm_with_extra_option_template: _.template($('#confirm-dialog-with-extra-option-tmpl').html()),
showConfirmWithExtraOption: function(title, content, extraOption, yesCallback) {
var $popup = $("#confirm-popup");
var $cont = $('#confirm-con');
var $yesBtn = $('#confirm-yes');
var html = this.confirm_with_extra_option_template({
'title': title,
'content': content,
'extraOption': extraOption
});
$cont.html(html);
$popup.modal({appendTo: '#main'});
$('#simplemodal-container').css({'height':'auto'});
$yesBtn.click(function() {
var extraOptionChecked = $('#confirm-extra-option:checked').val() === 'on';
yesCallback(extraOptionChecked);
});
},
closeModal: function() {
$.modal.close();
},