Skip to content

Commit

Permalink
Feature RFE-443 add iframe launch option (#149)
Browse files Browse the repository at this point in the history
* fix: add a missing closing tag for div in ltiResourceLinkLaunch.html.twig

* feat: add in-iframe ResourceLink launch option

* docs: mention in-iframe ResourceLink launch option in CHANGELOG.md
  • Loading branch information
wazelin authored Jun 7, 2023
1 parent b502f68 commit d2eba29
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 4 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
CHANGELOG
=========

2.6.0
-----

* Added in-iframe ResourceLink launch option

2.5.0
-----

Expand Down
20 changes: 16 additions & 4 deletions templates/platform/message/ltiResourceLinkLaunch.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -160,9 +160,13 @@
</div>
</div>
</div>
<div class="card-footer">
<div class="btn-group float-right" role="group" aria-label="Basic example">
{{ ltiResourceLinkLaunchRequest.toHtmlLink('<i class="fas fa-sign-out-alt"></i>&nbsp;Launch LtiResourceLinkRequest',{'class': 'btn btn-primary', 'target': '_blank'})|raw }}
<div class="card-footer">
<div class="btn-group float-right" role="group" aria-label="Basic example">
{{ ltiResourceLinkLaunchRequest.toHtmlLink('<i class="fas fa-sign-out-alt"></i>&nbsp;Launch',{'class': 'btn btn-primary', 'target': '_blank'})|raw }}
<button id="launch-in-iframe" class="btn btn-secondary" data-url="{{ ltiResourceLinkLaunchRequest.toUrl() }}">
<i class="fas fa-hashtag"></i>&nbsp;Launch in iframe
</button>
</div>
</div>
</div>
</div>
Expand Down Expand Up @@ -259,8 +263,16 @@
}
});
$('#launch-in-iframe').click(function () {
$(this).closest('.card').find('.card-body').replaceWith(
$('<div>').addClass('card-body embed-responsive embed-responsive-16by9').append(
$('<iframe>').addClass('embed-responsive-item').attr('src', $(this).data('url'))
)
);
});
$( document ).ready(function() {
checkClaims();
});
</script>
{% endblock body %}
{% endblock body %}

0 comments on commit d2eba29

Please sign in to comment.