-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Force theme into the app, without having to add component to every page. Now uses Shopify 'Flash' notices in the EASDK. Has a fall back to regular flash notices if EASDK is not loaded.
- Loading branch information
Showing
11 changed files
with
172 additions
and
58 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 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 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,20 @@ | ||
<?php | ||
namespace Multidimensional\Seaff\Controller; | ||
|
||
use Cake\Event\Event; | ||
|
||
use App\Controller\AppController as BaseController; | ||
|
||
class AppController extends BaseController | ||
{ | ||
|
||
public function initialize() { | ||
|
||
parent::initialize(); | ||
$this->loadComponent('Flash'); | ||
|
||
} | ||
|
||
|
||
|
||
} |
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,39 @@ | ||
<?php | ||
|
||
namespace Multidimensional\Seaff\Controller\Component; | ||
|
||
use Cake\Core\Configure; | ||
use Cake\Controller\Component; | ||
use Cake\Event\Event; | ||
use Cake\Network\Session; | ||
|
||
class SeaffComponent extends Component { | ||
|
||
private $controller; | ||
private $api_key; | ||
private $shop_domain; | ||
|
||
public function initialize(array $config = []) { | ||
|
||
parent::initialize($config); | ||
$this->controller = $this->_registry->getController(); | ||
$this->controller->loadComponent('Flash'); | ||
|
||
$this->api_key = ((isset($config['api_key'])) ? $config['api_key'] : Configure::read('Shopify.api_key')); | ||
if (!empty($this->api_key)) { | ||
$this->shop_domain = ((isset($config['shop_domain'])) ? $config['shop_domain'] : $this->controller->request->session()->read('shopify_shop_domain_'.$this->api_key)); | ||
} | ||
} | ||
|
||
public function beforeRender(Event $event) { | ||
|
||
if (empty($this->shop_domain) && !empty($this->api_key)) { | ||
$this->controller->request->session()->read('shopify_shop_domain_'.$this->api_key); | ||
} | ||
|
||
$this->controller->viewBuilder()->theme('Multidimensional/Seaff'); | ||
$this->controller->set(["shopifyAPIkey" => $this->api_key, "shopifyShopDomain" => $this->shop_domain]); | ||
|
||
} | ||
|
||
} |
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 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 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 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,11 @@ | ||
<?php if ($shopifyAPIkey && $shopifyShopDomain): ?> | ||
<script src="https://cdn.shopify.com/s/assets/external/app.js?<?= date("YmdH"); ?>"></script> | ||
<script type="text/javascript"> | ||
ShopifyApp.init({ | ||
apiKey: '<?= h($shopifyAPIkey); ?>', | ||
shopOrigin: 'https://<?= h($shopifyShopDomain); ?>' | ||
}); | ||
</script> | ||
<?php else: ?> | ||
<?= $this->Html->css('flash.css'); ?> | ||
<?php endif; ?> |
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,61 @@ | ||
div.message { | ||
margin: 0; | ||
font-family: "Helvetica Neue", Helvetica, Roboto, Arial, sans-serif; | ||
font-style: normal; | ||
text-align: center; | ||
cursor: pointer; | ||
display: block; | ||
font-weight: normal; | ||
padding: 0 24px 0 24px; | ||
transition: height 300ms ease-out 0s; | ||
background-color: #a0d3e8; | ||
color: #626262; | ||
top: 15px; | ||
right: 15px; | ||
z-index: 999; | ||
overflow: hidden; | ||
height: 50px; | ||
box-radius: 5px; | ||
|
||
box-sizing: border-box; | ||
font-size: 16px; | ||
line-height: 40px; | ||
text-size-adjust: 100%; | ||
} | ||
|
||
div.message:before { | ||
line-height: 0px; | ||
font-size: 20px; | ||
height: 12px; | ||
width: 12px; | ||
border-radius: 15px; | ||
text-align: center; | ||
vertical-align: middle; | ||
display: inline-block; | ||
position: relative; | ||
left: -11px; | ||
background-color: #FFF; | ||
padding: 12px 14px 12px 10px; | ||
content: "i"; | ||
color: #a0d3e8; | ||
|
||
box-sizing: border-box; | ||
font-size: 20px; | ||
height: 24px; | ||
width: 24px ; | ||
} | ||
|
||
div.message.error { | ||
background-color: #C3232D; | ||
color: #FFF; | ||
} | ||
|
||
div.message.error:before { | ||
padding: 11px 16px 14px 7px; | ||
color: #C3232D; | ||
content: "x"; | ||
} | ||
|
||
div.message.hidden { | ||
height: 0; | ||
} |