From ce6711d69e695d3a784f950be8c74b16b6c4a28b Mon Sep 17 00:00:00 2001 From: Amine Ben hammou Date: Mon, 15 Oct 2018 14:51:32 +0200 Subject: [PATCH] adding discount to premium page --- assets/css/src/admin.styl | 1 + assets/css/src/discounts.styl | 24 ++++++++++++++++++++++++ lib/Config/Menu.php | 3 ++- lib/Util/Notices/PHPVersionWarnings.php | 3 +-- lib/Util/Notices/PermanentNotices.php | 1 - views/premium.html | 11 ++++++++++- 6 files changed, 38 insertions(+), 5 deletions(-) create mode 100644 assets/css/src/discounts.styl diff --git a/assets/css/src/admin.styl b/assets/css/src/admin.styl index c6b46b0981..cc9c26831e 100644 --- a/assets/css/src/admin.styl +++ b/assets/css/src/admin.styl @@ -36,3 +36,4 @@ @require 'welcome_wizard' @require 'intro' @require 'in_app_announcements' +@require 'discounts' diff --git a/assets/css/src/discounts.styl b/assets/css/src/discounts.styl new file mode 100644 index 0000000000..5bebb06b70 --- /dev/null +++ b/assets/css/src/discounts.styl @@ -0,0 +1,24 @@ +.mailpoet-discount-container + margin: 15px + padding: 20px + background: white + border: 1px solid #FF5301 + text-align: center + +.mailpoet-discount-container h1 + margin: 0 + line-height: 1.2em + font-size: 2.8em + font-weight: 400 + +.mailpoet-discount-container p + line-height: 1.2em + font-size: 1.2em + +.mailpoet-discount-container a + display: inline-block + padding: 10px 30px + background: #FF5301 + border: 1px solid #CC4200 + color: white + text-decoration: none diff --git a/lib/Config/Menu.php b/lib/Config/Menu.php index cb72f12d42..ce58a5feda 100644 --- a/lib/Config/Menu.php +++ b/lib/Config/Menu.php @@ -391,7 +391,8 @@ class Menu { function premium() { $data = array( 'subscriber_count' => Subscriber::getTotalSubscribers(), - 'sub_menu' => self::MAIN_PAGE_SLUG + 'sub_menu' => self::MAIN_PAGE_SLUG, + 'display_discount' => time() <= strtotime('2018-11-30 23:59:59') ); $this->displayPage('premium.html', $data); diff --git a/lib/Util/Notices/PHPVersionWarnings.php b/lib/Util/Notices/PHPVersionWarnings.php index 239cf85622..025532bd50 100644 --- a/lib/Util/Notices/PHPVersionWarnings.php +++ b/lib/Util/Notices/PHPVersionWarnings.php @@ -3,7 +3,6 @@ namespace MailPoet\Util\Notices; use MailPoet\Util\Helpers; -use MailPoet\WP\Notice as WPNotice; class PHPVersionWarnings { @@ -27,7 +26,7 @@ class PHPVersionWarnings { $error = Helpers::replaceLinkTags($error_string, 'https://beta.docs.mailpoet.com/article/251-upgrading-the-websites-php-version', array('target' => '_blank')); $extra_classes = 'mailpoet-dismissible-notice is-dismissible'; - return WPNotice::displayError($error, $extra_classes, self::OPTION_NAME); + return \MailPoet\WP\Notice::displayError($error, $extra_classes, self::OPTION_NAME); } function disable() { diff --git a/lib/Util/Notices/PermanentNotices.php b/lib/Util/Notices/PermanentNotices.php index 10b5edd2db..2e90f7fd6d 100644 --- a/lib/Util/Notices/PermanentNotices.php +++ b/lib/Util/Notices/PermanentNotices.php @@ -36,7 +36,6 @@ class PermanentNotices { } function ajaxDismissNoticeHandler() { - error_log('YOOOOOOOOOOOOOOOOO POST YES!'); if(!isset($_POST['type'])) return; switch($_POST['type']) { case (PHPVersionWarnings::OPTION_NAME): diff --git a/views/premium.html b/views/premium.html index ce00516608..fbf4ea8355 100644 --- a/views/premium.html +++ b/views/premium.html @@ -1,8 +1,17 @@ <% extends 'layout.html' %> <% block content %> -
+ + <% if display_discount %> +
+

<%= __('Discounts up to 40% for a limited time') %>

+

<%= __("Don’t miss out on our only sale of the year which ends on November 30.") %>

+

<%= __("There’s never been a better time to change gears.") %>

+ Save up to 40% +
+ <% endif %> +

<%= __('What is MailPoet Premium?') %>

<%= __("Check out the brief video below. Or, keep reading!") %>