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

Customizer: Alert on successful save to Gist #10632

Merged
merged 2 commits into from
Jun 5, 2014
Merged

Conversation

stuartpb
Copy link
Contributor

Part of my suggested solution for #9951

@@ -12,6 +12,12 @@ window.onload = function () { // wait for load in a dumb way because B-0
throw err
}

function showSuccess(msg {
Copy link
Collaborator

Choose a reason for hiding this comment

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

You seem to be missing a close-paren...Has this code been tested?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Whoops! The built-in tests for Bootstrap don't lint the docs-assets. I've opened a PR for that at #11033.

@cvrebert
Copy link
Collaborator

IMHO, it'd be better to include the Gist and/or Customizer URLs in a README file and/or in the generated CSS+JS files.

@stuartpb
Copy link
Contributor Author

From the discussion in the original issue:

My thinking is that waiting for the potential server response to concatenate the customizer / Gist URLs to the relevant files would unnecessarily slow down and complicate the file output flow:

  • If a developer just wants a snapshot of their selected options, the included config.json gives that to them.
  • If a developer wants to keep a note of where the configuration is stored online, they can copy the URLs from the callout to the output's comment block(s), or wherever they're keeping their development notes.
  • If a developer's Bootstrap development flow is complex enough to merit repeated output of the Gist URL to their output comments every time, they should probably be doing their Bootstrap customization / compilation locally instead of using the online customizer anyway.

Anyway, incorporating this change wouldn't stop anybody from implementing that - it would just give more visual feedback as to the existence of these links.

@cvrebert
Copy link
Collaborator

I guess I don't agree with your assessment of the potential complexity+performance impact.

@stuartpb
Copy link
Contributor Author

I'll make a pull request some time with the performance reasons why I'd argue against adding it. Anyway, I'd still implement it on top of this change.

@stuartpb
Copy link
Contributor Author

Pushed a rebased and revised commit.

var hereNow = window.location.origin + window.location.pathname + '?id=' + result.id
showSuccess('<strong>Success!</strong> Your configuration has been saved to <a href="' + gist +'">' + gist + '</a>\
and can be revisited here at <a href="' + hereNow +'">' + hereNow + '</a> for further customization.')
history.replaceState(false, document.title, hereNow)
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this check for the existence of window.history before calling it? IE9 does not implement the history API: http://caniuse.com/#search=history

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think it's being polyfilled? If not, that's an issue that exists upstream.

Copy link
Member

Choose a reason for hiding this comment

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

IE9 does not work anyway due to jszip's limitations.

@mdo mdo modified the milestones: v3.2.0, v3.1.1 Feb 10, 2014
@cvrebert
Copy link
Collaborator

cvrebert commented Apr 4, 2014

@stuartpb I believe we'd be happy to accept this if it was rebased/redone so that it merges cleanly against current master.

@hnrch02
Copy link
Collaborator

hnrch02 commented May 5, 2014

@stuartpb Ping.

@stuartpb
Copy link
Contributor Author

Rebased, updated and pushed.

@ftbastler
Copy link

+1

@XhmikosR
Copy link
Member

@stuartpb: Tests fail.

@stuartpb
Copy link
Contributor Author

Apparently Bootstrap implemented linting of docs-assets in testing, with concatenation over newline escapement for multi-line strings, since I originally submitted this PR. Fixed.

@XhmikosR
Copy link
Member

Thanks. Can you squash those 2 commits into one?

@stuartpb
Copy link
Contributor Author

Squashed and pushed.

@stuartpb
Copy link
Contributor Author

BTW, when did doc asset linting get added to the test suite? I proposed doing so in #11033 and got shot down.

@XhmikosR
Copy link
Member

I added it some time ago.

@cvrebert
Copy link
Collaborator

Lint still failing. This time due to lack of a space between the + operator and '">'.

@stuartpb
Copy link
Contributor Author

Fixed, tests passing.

@@ -60,10 +66,13 @@ window.onload = function () { // wait for load in a dumb way because B-0
data: JSON.stringify(data)
})
.success(function (result) {
var gistUrl = result.html_url;
Copy link
Member

Choose a reason for hiding this comment

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

semicolon

@stuartpb
Copy link
Contributor Author

Removed all semicolons per @fat's complaint

@cvrebert
Copy link
Collaborator

Will merge as soon as we get a chance to test it out.

@XhmikosR
Copy link
Member

I had a look at this. After doing grunt dist and trying the patch locally I get:

customize and download bootstrap

@XhmikosR
Copy link
Member

OK, this patch is pretty old... the classes no longer exist.

@stuartpb: can you update the patch to use bs-callout bs-callout-info and use a similar markup as showCallout?

@stuartpb
Copy link
Contributor Author

How's this change?

@XhmikosR
Copy link
Member

It's better for sure.

What I'm not sure about is the duplication. I mean, we have showError, showCallout and now showSuccess. I think we should at least follow the same markup as the other two functions meaning using h4 and p.

After this is in, we can extend an existent function instead of duplicating stuff.

@stuartpb
Copy link
Contributor Author

No close button?

@XhmikosR
Copy link
Member

The close button should be there I guess (see also https://github.com/twbs/bootstrap/pull/10632/files#diff-d16c8aeafb7656f16175f3eebc03c831R19).

@cvrebert
Copy link
Collaborator

Given #12955, making the alerts always dismissable could be misleading.

@XhmikosR
Copy link
Member

Yeah but that is a general issue and not directly related to this. I simply suggested we are a little more consistent with the alerts so far.

@cvrebert
Copy link
Collaborator

cvrebert commented Jun 5, 2014

Looks good enough, IMO. We can always tweak it more later.

cvrebert added a commit that referenced this pull request Jun 5, 2014
Customizer: Alert on successful save to Gist
@cvrebert cvrebert merged commit a8641b4 into twbs:master Jun 5, 2014
@cvrebert
Copy link
Collaborator

cvrebert commented Jun 5, 2014

Thanks @stuartpb!

@mdo mdo mentioned this pull request Jun 5, 2014
@mdo
Copy link
Member

mdo commented Jun 5, 2014

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.

8 participants