Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
1. replaced admin notification with modal
2. added extra theme option used in modal 3. code refactor.
- Loading branch information
Viktor Kim
committed
May 31, 2018
1 parent
dbcbba0
commit aaeb42a
Showing
10 changed files
with
446 additions
and
115 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
(function () { | ||
"use strict"; | ||
|
||
// Allow Subscribe for news | ||
jQuery(document).ready(function () { | ||
var modalContainer = document.getElementById('subscribe-notification-container'); | ||
if ('undefined' === typeof modalContainer || null === modalContainer) { | ||
return; | ||
} | ||
var statsInput = document.getElementById('modal-ffc-statistic'); | ||
var subscribeInput = document.getElementById('modal-ffc-subscribe'); | ||
var userInfoContainer = document.getElementById("frtfl-modal__content_user-info"); | ||
|
||
var modalForm = document.getElementById("frtfl-modal-form"); | ||
var submitBtn = document.getElementById("frtfl-modal__submit-btn"); | ||
var modalData = {}; | ||
|
||
modalContainer.addEventListener("click", function (e) { | ||
|
||
//Subscribe checkbox event. If checked show additional inputs | ||
if (e.target === subscribeInput) { | ||
userInfoContainer.classList.toggle("hidden"); | ||
if (userInfoContainer.classList.contains("hidden")) { | ||
userInfoContainer.querySelector('input[type="email"]').setAttribute('disabled', 'true'); | ||
userInfoContainer.querySelector('input[type="text"]').setAttribute('disabled', 'true'); | ||
} else { | ||
userInfoContainer.querySelector('input[type="email"]').removeAttribute('disabled'); | ||
userInfoContainer.querySelector('input[type="text"]').removeAttribute('disabled'); | ||
} | ||
|
||
} | ||
|
||
// Subscribe to newsletter click event - create modalData | ||
if (e.target === submitBtn) { | ||
modalData['ffc_statistic'] = +statsInput.checked; | ||
modalData['ffc_subscribe'] = +subscribeInput.checked; | ||
if (userInfoContainer.classList.contains("hidden")) { | ||
modalData['ffc_subscribe_name'] = ''; | ||
modalData['ffc_subscribe_email'] = ''; | ||
} else { | ||
modalData['ffc_subscribe_name'] = userInfoContainer.querySelector('input[type="text"]').value; | ||
modalData['ffc_subscribe_email'] = userInfoContainer.querySelector('input[type="email"]').value; | ||
} | ||
} | ||
|
||
// Dismiss subscribe notification Event | ||
if (e.target.classList.contains("notice-dismiss")) { | ||
var data = { | ||
action: "zoner_dismiss_subscribe_notification", | ||
type: "json", | ||
}; | ||
|
||
jQuery.post(ajaxurl, data, function (response) { | ||
modalContainer.remove(); | ||
location.reload(); | ||
}); | ||
} | ||
|
||
}); | ||
|
||
modalForm.addEventListener('submit', function (e) { | ||
|
||
e.preventDefault(); | ||
|
||
var __notificationText = modalForm.querySelector('.frtfl-modal__content'); | ||
|
||
var data = { | ||
action: "zoner_submit_modal", | ||
type: "json", | ||
data: modalData | ||
}; | ||
|
||
jQuery.post(ajaxurl, data, function (response) { | ||
var __title, __statMsg, __subscrMsg, __errMsg, __errDescr; | ||
if (response.status === 'success'){ | ||
__title = "<h2>" + response.title + "</h2>"; | ||
__statMsg = "<p>" + response.stat_msg + "</p>"; | ||
__subscrMsg = "<p>" + response.subscr_msg + "</p>"; | ||
__errMsg = ''; | ||
__errDescr = ''; | ||
} else { | ||
__title = ''; | ||
__statMsg = ''; | ||
__subscrMsg = ''; | ||
__errMsg = "<p>" + response.error_message + "</p>"; | ||
__errDescr = "<p>" + response.error_description + "</p>"; | ||
} | ||
__notificationText.innerHTML = __title + __statMsg + __subscrMsg + __errMsg + __errDescr; | ||
}); | ||
|
||
}); | ||
|
||
}); | ||
}()); | ||
|
||
|
83 changes: 83 additions & 0 deletions
83
includes/admin/fruitful-stats/assets/styles/admin_styles.css
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
1 change: 1 addition & 0 deletions
1
includes/admin/fruitful-stats/assets/styles/admin_styles.css.map
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
80 changes: 80 additions & 0 deletions
80
includes/admin/fruitful-stats/assets/styles/admin_styles.sass
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
// Subscribe modal window styles | ||
.frtfl-modal | ||
position: fixed | ||
z-index: 999999 | ||
top: 0 | ||
left: 0 | ||
right: 0 | ||
bottom: 0 | ||
background-color: rgba(0, 0, 0, 0.5) | ||
font-size: 14px | ||
line-height: 1.5 | ||
|
||
* | ||
box-sizing: border-box | ||
|
||
#frtfl-modal-form | ||
position: absolute | ||
top: 20% | ||
left: 50% | ||
-webkit-transform: translateX(-50%) | ||
-moz-transform: translateX(-50%) | ||
-ms-transform: translateX(-50%) | ||
-o-transform: translateX(-50%) | ||
transform: translateX(-50%) | ||
max-width: 50% | ||
max-height: 50% | ||
background-color: #fff | ||
padding: 25px 50px | ||
overflow: auto | ||
-webkit-box-shadow: 0px 0px 40px -5px rgba(0, 0, 0, 0.75) | ||
-moz-box-shadow: 0px 0px 40px -5px rgba(0, 0, 0, 0.75) | ||
box-shadow: 0px 0px 40px -5px rgba(0, 0, 0, 0.75) | ||
|
||
.description | ||
margin-bottom: 15px | ||
|
||
.form-group | ||
margin-bottom: 5px | ||
|
||
.submit-btn__wrapper | ||
text-align: right | ||
margin-top: 15px | ||
|
||
.floating-placeholder__wrapper | ||
position: relative | ||
height: 30px | ||
margin-top: 15px | ||
|
||
input | ||
height: 100% | ||
width: 100% | ||
position: relative | ||
background-color: transparent | ||
z-index: 1 | ||
&::placeholder | ||
color: transparent | ||
|
||
label, | ||
input:placeholder-shown:focus + label, | ||
input:placeholder-shown:active + label | ||
font-size: 12px | ||
font-style: italic | ||
line-height: 1 | ||
position: absolute | ||
left: 5px | ||
top: 0 | ||
transform: translateY(-50%) | ||
transition: 0.3s | ||
display: block | ||
padding: 0 3px | ||
background-color: #fff | ||
color: #666 | ||
z-index: 2 | ||
cursor: default | ||
|
||
input:placeholder-shown + label | ||
transform: translateY(50%) | ||
font-size: 16px | ||
z-index: 0 | ||
transition: 0.3s |
Oops, something went wrong.