Commit 2933ccf8 authored by Robert Lyon's avatar Robert Lyon

Bug 1631809: Allow image preview modal use within other modals

Like adding image block modal or tinymce insert image modal

behatnotneeded

Change-Id: If608f87b852b8ee2e4d6c74bdf2a31124599eb03
Signed-off-by: Robert Lyon's avatarRobert Lyon <robertl@catalyst.net.nz>
(cherry picked from commit 6601edd0)
parent 2a529380
......@@ -707,7 +707,7 @@ function FileBrowser(idprefix, folderid, config, globalconfig) {
return;
}
var pagemodalbody = $j('.modal-body');
var pagemodalbody = $j('#page-modal .modal-body');
var elem = $j('#' + self.id + '_filelist .img-modal-preview');
......@@ -747,7 +747,11 @@ function FileBrowser(idprefix, folderid, config, globalconfig) {
e.preventDefault();
// if folder, or a link that goes somewhere exit out
if(e.target.nodeName === 'A'){
if (e.target.nodeName === 'A') {
return;
}
// if an image preview link
if (jQuery(e.target).parent().hasClass('img-modal-preview')) {
return;
}
......@@ -756,7 +760,7 @@ function FileBrowser(idprefix, folderid, config, globalconfig) {
// remove visual selection if this is for selecting 1 file
if (self.config.selectone) {
for(j = 0; j < elem.length; j = j + 1){
for (j = 0; j < elem.length; j = j + 1) {
removeElementClass(elem[j], 'active');
}
}
......
......@@ -29,5 +29,4 @@
</div>
{/if}
{include file="pagemodal.tpl"}
{include file="footer.tpl"}
......@@ -181,6 +181,7 @@
</tbody>
</table>
{/if}
{include file="pagemodal.tpl"}
{if $tabs}
</div>
{/if}
......
......@@ -79,7 +79,7 @@
{elseif !$publishable}
<span class="display-title">{$displaytitle}</span>
{else}
<a href="{$WWWROOT}artefact/file/download.php?file={$file->id}" title="{str tag=downloadfile section=artefact.file arg1=$displaytitle}" class="file-download-link inner-link {if $file->artefacttype == 'image'}img-modal-preview{/if}">
<a href="{$WWWROOT}artefact/file/download.php?file={$file->id}" title="{str tag=downloadfile section=artefact.file arg1=$displaytitle}" class="file-download-link inner-link {if $file->artefacttype == 'image' || $file->artefacttype == 'profileicon'}img-modal-preview{/if}">
<span class="display-title">{$displaytitle}</span>
</a>
{/if}
......
......@@ -30,7 +30,7 @@ Scenario: Enable/disable external resources in mahara pages
| Block title | Text block with an internal image |
And I click the "Insert/edit image" button in the editor
And I expand the section "Image"
And I follow "Image2.png"
And I press "Select \"Image2.png\""
And I press "Submit"
And I press "Save"
......
......@@ -172,7 +172,7 @@ Scenario: Editing admin resume page (Bug 1426983)
And I press "Add a file"
And I wait "1" seconds
And I attach the file "Image2.png" to "File"
And I press "Close"
And I press "Close" in the "#editgoalsandskills_filebrowser_upload_browse" "css_element"
And I wait "1" seconds
And I press "Save"
And I should see "Saved successfully"
......@@ -183,7 +183,7 @@ Scenario: Editing admin resume page (Bug 1426983)
And I press "Add a file"
And I wait "1" seconds
And I attach the file "Image2.png" to "File"
And I press "Close"
And I press "Close" in the "#editgoalsandskills_filebrowser_upload_browse" "css_element"
And I wait "1" seconds
And I press "Save"
And I should see "Saved successfully"
......@@ -194,7 +194,7 @@ Scenario: Editing admin resume page (Bug 1426983)
And I press "Add a file"
And I wait "1" seconds
And I attach the file "Image2.png" to "File"
And I press "Close"
And I press "Close" in the "#editgoalsandskills_filebrowser_upload_browse" "css_element"
And I wait "1" seconds
And I press "Save"
And I should see "Saved successfully"
......@@ -205,7 +205,7 @@ Scenario: Editing admin resume page (Bug 1426983)
And I press "Add a file"
And I wait "1" seconds
And I attach the file "Image2.png" to "File"
And I press "Close"
And I press "Close" in the "#editgoalsandskills_filebrowser_upload_browse" "css_element"
And I wait "1" seconds
And I press "Save"
And I should see "Saved successfully"
......@@ -216,7 +216,7 @@ Scenario: Editing admin resume page (Bug 1426983)
And I press "Add a file"
And I wait "1" seconds
And I attach the file "Image2.png" to "File"
And I press "Close"
And I press "Close" in the "#editgoalsandskills_filebrowser_upload_browse" "css_element"
And I wait "1" seconds
And I press "Save"
And I should see "Saved successfully"
......@@ -227,7 +227,7 @@ Scenario: Editing admin resume page (Bug 1426983)
And I press "Add a file"
And I wait "1" seconds
And I attach the file "Image2.png" to "File"
And I press "Close"
And I press "Close" in the "#editgoalsandskills_filebrowser_upload_browse" "css_element"
And I wait "1" seconds
And I press "Save"
And I should see "Saved successfully"
......
Markdown is supported
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