Fix modal closing in the hackiest way ever

This commit is contained in:
Ray Schamp 2015-08-10 16:29:47 -04:00
parent f670c78a50
commit 3be27931f3
5 changed files with 61 additions and 38 deletions

View file

@ -741,19 +741,7 @@ picture {
transition: opacity 0.25s ease; transition: opacity 0.25s ease;
border-radius: 5px; border-radius: 5px;
padding: 1.5em; padding: 1.5em;
position: relative; position: relative; }
max-width: 60em;
margin-left: auto;
margin-right: auto; }
.modal .modal-inner::after {
clear: both;
content: "";
display: table; }
.modal .modal-inner .modal-content {
color: #58595b;
-webkit-columns: 2 8em;
-moz-columns: 2 8em;
columns: 2 8em; }
.modal .modal-inner a.cta { .modal .modal-inner a.cta {
color: white; color: white;
display: inline-block; display: inline-block;
@ -1028,15 +1016,31 @@ body > section {
body #home { body #home {
display: block; } display: block; }
.modal dialog { .modal.n-children-1 dialog {
width: 50%; } width: 100%; }
.modal dialog:not(:only-child) { .modal.n-children-1 .modal-inner {
float: left; max-width: 25%;
display: block; margin-left: auto;
margin-right: 2.53165%; margin-right: auto; }
width: 48.73418%; } .modal.n-children-1 .modal-inner::after {
.modal dialog:not(:only-child):last-child { clear: both;
margin-right: 0; } content: "";
display: table; }
.modal.n-children-2 dialog {
float: left;
display: block;
margin-right: 2.53165%;
width: 48.73418%; }
.modal.n-children-2 dialog:last-child {
margin-right: 0; }
.modal.n-children-2 .modal-inner {
max-width: 50%;
margin-left: auto;
margin-right: auto; }
.modal.n-children-2 .modal-inner::after {
clear: both;
content: "";
display: table; }
.extension-file section:first-child { .extension-file section:first-child {
/* Add a border equal to the number of featured extensions - 1 */ /* Add a border equal to the number of featured extensions - 1 */

File diff suppressed because one or more lines are too long

View file

@ -227,13 +227,26 @@ function showModal(templateId, data) {
*/ */
var zIndex = 100; var zIndex = 100;
var modalId = "modal-" + templateId; var modalId = ("modal-" + templateId).replace(",", "-");
$modalwrapper = $("<div class='modal-fade-screen'><div class='modal-inner'></div></div>"); $modalwrapper = $("<div class='modal-fade-screen'><div class='modal-inner'><div class='modal-content'></div></div></div>");
var $modal = getOrCreateFromTemplate(modalId, templateId, "dialog", "body", $modalwrapper, data); var $modal = getOrCreateFromTemplate(modalId, templateId, "dialog", "body", $modalwrapper, data);
$(".modal-inner", $modal).append('<div class="modal-close" for="'+modalId+'"></div>');
$modal.addClass("modal"); $modal.addClass("modal");
if (typeof(templateId) != "string") {
$modal.addClass("n-children-" + templateId.length);
} else {
$modal.addClass("n-children-1");
}
$(".modal-fade-screen", $modal) $(".modal-fade-screen", $modal)
.addClass("visible") .addClass("visible")
.click(function(e){if ($(e.target).is($(this))) $(this).trigger("modal:exit")}); .click(function(e){if ($(e.target).is($(this))) $(this).trigger("modal:exit")});
$(".modal-close", $modal).click(function(e){
e.preventDefault();
$(document).trigger("modal:exit")
});
$("body").addClass("modal-open"); $("body").addClass("modal-open");
@ -265,7 +278,7 @@ $(document).on('click', "[data-action='modal']", function(e){
function JSshowWarning(extensionData) { function JSshowWarning(extensionData) {
$modal = showModal("template-warning", extensionData); $modal = showModal("template-warning", extensionData);
$("button, .modal-close", $modal).click(function(e){ $("button", $modal).click(function(e){
e.preventDefault(); e.preventDefault();
$(document).trigger("modal:exit") $(document).trigger("modal:exit")
}); });

View file

@ -89,12 +89,6 @@
border-radius: $base-border-radius; border-radius: $base-border-radius;
padding: $modal-padding / 2; padding: $modal-padding / 2;
position: relative; position: relative;
@include outer-container;
.modal-content {
color: $base-font-color;
@include columns(2 8em);
}
a.cta { a.cta {
color: white; color: white;

View file

@ -62,16 +62,28 @@ body {
} }
.modal dialog { .modal {
width: 50%; &.n-children-1 {
dialog {
width: 100%;
}
&:not(:only-child) { .modal-inner {
@include span-columns(3 of 6); @include outer-container(25%);
}
} }
} &.n-children-2 {
dialog {
@include span-columns(3 of 6);
}
.modal-inner {
@include outer-container(50%);
}
}
}
.extension-file { .extension-file {
section:first-child { section:first-child {