Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CRO-97: Storefront admin bar #997

Merged
merged 1 commit into from
May 4, 2017
Merged

Conversation

adambilsing
Copy link
Contributor

@adambilsing adambilsing commented Apr 19, 2017

What?

Removing the Prelaunch yellow box and replacing it with an admin bar.

Tickets / Documentation

https://jira.bigcommerce.com/browse/CRO-97
https://github.com/bigcommerce/bigcommerce/pull/18545

Screenshots (if appropriate)

screen shot 2017-04-21 at 1 57 35 pm

screen shot 2017-04-21 at 1 57 29 pm

screen shot 2017-04-21 at 1 57 40 pm

Testing / Proof

https://launchbay.bigcommerce.net/projects/1/releases/31881

@bigcommerce/cp-dt @wendy @bc-kentaro @jordanwink201

@adambilsing adambilsing force-pushed the CRO-97 branch 19 times, most recently from a02d8e1 to fd93157 Compare April 19, 2017 08:08
@wendy wendy changed the title (WIP) CRO-97: Storefront admin bar CRO-97: Storefront admin bar Apr 21, 2017
Copy link
Contributor

@mcampa mcampa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 @adambilsing can you add a line to the changelog file with a brief description before merging it?

$('body').addClass('hasAdminBar');
$('body').prepend($element);

$('.adminBar-content a').click(attachThemeEditorParams);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This code doesn't belong in the theme. If you need to run code in the theme-editor iframe added to https://github.com/bigcommerce-labs/stencil-preview-sdk

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for the record: this JS needs to be run in the Cornerstone theme when it's not rendered in the iframe of stencil-editor

@jordanwink201 jordanwink201 force-pushed the CRO-97 branch 2 times, most recently from f752057 to 6e29fb6 Compare April 28, 2017 00:07
@jordanwink201 jordanwink201 force-pushed the CRO-97 branch 9 times, most recently from 478c4e7 to 40fdb3b Compare May 3, 2017 00:34
@jordanwink201
Copy link

@mcampa @bigcommerce/stencil-team @bigcommerce/cp-dt can we get a review on this again, thanks :)

CHANGELOG.md Outdated
@@ -11,6 +11,7 @@
- Update bigcommerce.com footer link [#990](https://github.com/bigcommerce/cornerstone/pull/990)
- Fix invalid icon HTML in AMP templates [#989](https://github.com/bigcommerce/cornerstone/pull/989)
- Add new theme editor setting for SSL common name to enable GeoTrust badge to work properly [#994](https://github.com/bigcommerce/cornerstone/pull/994)
- Add storefront admin bar to replace store not launched preview panel [#997](https://github.com/bigcommerce/cornerstone/pull/997)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should go up in the draft section, like this:

## Draft
- Add storefront admin bar to replace store not launched preview panel [#997](https://github.com/bigcommerce/cornerstone/pull/997)

## 1.7.0 (2017-04-26)


if (!(header && notice)) {
// Return if header & notice is null or if securePath is not defined (means inside theme editor)
Copy link
Contributor

@mcampa mcampa May 3, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This condition does not mean is in theme-editor. Yo'll have to check if is inside an iframe
http://stackoverflow.com/a/326076/1526448


$element.html(`<p class="maintenanceNotice-header">${header}</p>${notice}`);
const url = encodeURIComponent(window.location.pathname + window.location.search);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmmm... i think window.location.pathname might not be supported in IE: https://developer.mozilla.org/en-US/docs/Web/API/HTMLHyperlinkElementUtils/pathname

@@ -7,17 +7,43 @@ import $ from 'jquery';
export default function (maintenanceMode = {}) {
const header = maintenanceMode.header;
const notice = maintenanceMode.notice;
const password = maintenanceMode.password;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i'm confused - what's to stop a user from putting a breakpoint to see the preview code?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will this only be populated if the store owner/admin is logged in?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch @mjschock

You are injecting the password here https://github.com/bigcommerce/bigcommerce/pull/18694/files#diff-3491c3f0657689614b41beb712cb7681R114

And that is injected in the theme even if the user is not a store admin

@@ -7,17 +7,43 @@ import $ from 'jquery';
export default function (maintenanceMode = {}) {
const header = maintenanceMode.header;
const notice = maintenanceMode.notice;
const password = maintenanceMode.password;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch @mjschock

You are injecting the password here https://github.com/bigcommerce/bigcommerce/pull/18694/files#diff-3491c3f0657689614b41beb712cb7681R114

And that is injected in the theme even if the user is not a store admin

@bc-ranji
Copy link
Contributor

bc-ranji commented May 4, 2017

💚

@junedkazi
Copy link
Contributor

can we please squash the commits on this one.

@@ -7,17 +7,44 @@ import $ from 'jquery';
export default function (maintenanceMode = {}) {
const header = maintenanceMode.header;
const notice = maintenanceMode.notice;
const password = maintenanceMode.password || false;
const isInIframe = window.location !== window.parent.location;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you need to put this into a try/catch or it will throw an error in IE

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@adambilsing adambilsing force-pushed the CRO-97 branch 3 times, most recently from c5a2f9c to ba168fc Compare May 4, 2017 18:14
@@ -32,7 +32,7 @@ export default class Cart extends PageManager {
// Does not quality for min/max quantity
if (newQty < minQty) {
return alert(minError);
} else if (newQty > maxQty) {
} else if (maxQty > 0 && newQty > maxQty) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bad merge?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

got rolled into the squash.

@adambilsing adambilsing merged commit 44c9dc3 into bigcommerce:master May 4, 2017
@adambilsing adambilsing deleted the CRO-97 branch May 4, 2017 18:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants