Skip to content

Commit

Permalink
overlays triggers close feature
Browse files Browse the repository at this point in the history
  • Loading branch information
lekoala committed Jun 17, 2022
1 parent 47a487f commit 43d7625
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 3 deletions.
1 change: 1 addition & 0 deletions _config/pure-modal.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ Name: pure-modal
---
LeKoala\PureModal\PureModal:
move_modal_to_body: true
overlay_triggers_close: true
10 changes: 10 additions & 0 deletions src/PureModal.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,16 @@ public static function getMoveModalScript()
return "document.body.appendChild(this.parentElement.querySelector('.pure-modal'));this.onclick=null;";
}

public static function getOverlayTriggersCloseConfig()
{
return self::config()->overlay_triggers_close;
}

public function getOverlayTriggersClose()
{
return PureModal::getOverlayTriggersCloseConfig();
}

public function getAttributes()
{
$attrs = [];
Expand Down
5 changes: 5 additions & 0 deletions src/PureModalAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,11 @@ public function __construct($name, $title)
parent::__construct($name, $title);
}

public function getOverlayTriggersClose()
{
return PureModal::getOverlayTriggersCloseConfig();
}

public function getAttributes()
{
$attrs = [];
Expand Down
2 changes: 1 addition & 1 deletion templates/LeKoala/PureModal/PureModal.ss
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
</label>
<div class="pure-modal from-top">
<input id="$ModalID" class="pure-checkbox no-change-track" type="checkbox">
<div class="pure-modal-overlay">
<div class="pure-modal-overlay"<% if getOverlayTriggersClose %> onclick="document.getElementById('$ModalID').checked=false;"<% end_if %>>
<div class="pure-modal-wrap">
<label for="$ModalID" class="close btn-close"><span>&#10006;</span></label>
<% if $Iframe && $IframeTop %>
Expand Down
4 changes: 2 additions & 2 deletions templates/LeKoala/PureModal/PureModalAction.ss
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
</label>
<div class="pure-modal from-top">
<input id="$ModalID" class="pure-checkbox no-change-track" type="checkbox">
<div class="pure-modal-overlay">
<div class="pure-modal-wrap pure-modal-action<% if getFillHeight %> fill-height<% end_if %>" style="max-height:90vh;">
<div class="pure-modal-overlay"<% if getOverlayTriggersClose %> onclick="document.getElementById('$ModalID').checked=false;"<% end_if %>>
<div class="pure-modal-wrap pure-modal-action<% if getFillHeight %> fill-height flex-fill<% end_if %>" style="max-height:90vh;">
<label for="$ModalID" class="pure-modal-close"></label>
<div class="toolbar toolbar--north row">
<h1>$Title</h1>
Expand Down

0 comments on commit 43d7625

Please sign in to comment.