Commit 1bbe83a3 authored by Robert Lyon's avatar Robert Lyon Committed by Gerrit Code Review
Browse files

Merge "Bug 1483964: Adjusting the confirm copy to use the new modal way"

parents 1915377f 919b1a52
......@@ -94,38 +94,21 @@ jQuery(function($j) {
});
}
$j(".copyview").each(function() {
$j(this).click(function(e) {
if (e.target.href.match(/collection=(.*)/)) {
e.preventDefault();
// We need to let user choose from collection or view only
var collection = e.target.href.match(/collection=(.*)/)[1];
if (!$j('#dialog-confirm').length) {
$j('body').append('<div id="dialog-confirm" title="' + get_string('confirmcopytitle') + '">' + get_string('confirmcopydesc') + '</div>');
}
$j('#dialog-confirm').dialog({
resizable: false,
height: 200,
modal: true,
buttons: [
{
text: get_string('View'),
click: function() {
// drop the collection bit from the url
var url = e.target.href.replace(/collection=(.*)/, '');
window.location = url;
}
},
{
text: get_string('Collection'),
click: function() {
window.location = e.target.href;
}
}
]
});
}
});
var copyurl = $j("#copyview-button").attr('href');
$j("#copyview-button").on('click', function(event) {
if (event.currentTarget.href.match(/collection=(.*)/)) {
event.preventDefault();
event.stopPropagation();
$j("#copyview-form").modal('show');
}
});
$j("#copy-view-button").on('click', function() {
// drop the collection bit from the url
var url = copyurl.replace(/collection=(.*)/, '');
window.location = url;
});
$j("#copy-collection-button").on('click', function() {
window.location = copyurl;
});
// Set up the onclick method for all comment reply buttons
......
......@@ -28,7 +28,7 @@
{/strip}{/if}
{if $copyurl}{strip}
<a title="{str tag=copythisview section=view}" href="{$copyurl}" class="btn btn-default">
<a id="copyview-button" title="{str tag=copythisview section=view}" href="{$copyurl}" class="btn btn-default">
<span class="text-success icon icon-files-o icon-lg prs"></span>
{str tag=copy section=mahara}
</a>
......@@ -165,6 +165,26 @@
</div>
</div>
{/if}
<div class="modal fade" id="copyview-form">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title">
<span class="icon icon-lg icon-flag text-danger prs"></span>
{str tag=confirmcopytitle section=view}
</h4>
</div>
<div class="modal-body">
<p>{str tag=confirmcopydesc section=view}</p>
<div class="btn-group">
<button id="copy-collection-button" type="button" class="btn btn-default"><span class="icon icon-folder-open text-success"></span> {str tag=Collection section=collection}</button>
<button id="copy-view-button" type="button" class="btn btn-default"><span class="icon icon-file-text text-success"></span> {str tag=view}</button>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment