Skip to content

Commit

Permalink
Add submit button to redirect Load clipboard to View clipboard. (#1889)
Browse files Browse the repository at this point in the history
  • Loading branch information
melaniekung committed Nov 13, 2024
1 parent fb71ba7 commit 3b6aa76
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 4 deletions.
3 changes: 2 additions & 1 deletion apps/qubit/modules/clipboard/templates/loadSuccess.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@

<section class="actions">
<ul>
<li><input class="c-btn c-btn-submit" type="submit" value="<?php echo __('Load'); ?>"/></li>
<li><input class="c-btn c-btn-submit" name="load" type="submit" value="<?php echo __('Load'); ?>"/></li>
<li><input class="c-btn c-btn-submit" name="loadView" type="submit" value="<?php echo __('Load and view'); ?>"/></li>
</ul>
</section>

Expand Down
5 changes: 5 additions & 0 deletions js/clipboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@

var $form = $(event.target);
var mode = $form.find('select#mode').val();
var loadType = $(document.activeElement).attr("name");

$.ajax({
url: $form.attr('action'),
Expand Down Expand Up @@ -82,6 +83,10 @@
this.storage.setItem('clipboard', JSON.stringify(this.items));
this.updateCounts();
this.showAlert(data.success, 'alert-info');

if (loadType == "loadView") {
window.location.href = "/clipboard/view";
}
},
error: function(xhr)
{
Expand Down
5 changes: 5 additions & 0 deletions plugins/arDominionB5Plugin/js/clipboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ import Tooltip from "bootstrap/js/dist/tooltip";

var $form = $(event.target);
var mode = $form.find("select#mode").val();
var loadType = $(document.activeElement).attr("name");

$.ajax({
url: $form.attr("action"),
Expand All @@ -87,6 +88,10 @@ import Tooltip from "bootstrap/js/dist/tooltip";
this.storage.setItem("clipboard", JSON.stringify(this.items));
this.updateCounts();
this.showAlert(data.success, "alert-info");

if (loadType == "loadView") {
window.location.href = "/clipboard/view";
}
},
error: function (xhr) {
var data = JSON.parse(xhr.responseText);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,10 @@
</div>
</div>

<section class="actions mb-3">
<input class="btn atom-btn-outline-success" type="submit" value="<?php echo __('Load'); ?>">
</section>
<ul class="actions mb-3 nav gap-2">
<li><input class="btn atom-btn-outline-light" type="submit" name="load" value="<?php echo __('Load'); ?>"/></li>
<li><input class="btn atom-btn-outline-light" type="submit" name="loadView" value="<?php echo __('Load and view'); ?>"/></li>
</ul>

</form>

Expand Down

0 comments on commit 3b6aa76

Please sign in to comment.