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

Watch and warn on rename or delete events for the root index.html file #564

Merged
merged 3 commits into from
Nov 8, 2016

Conversation

humphd
Copy link

@humphd humphd commented Nov 7, 2016

This is part of https://github.com/mozilla/thimble.mozilla.org/issues/1569#issuecomment-258889724. It adds an extra extension (not loaded by default--it will need to be enabled in Thimble) to watch and warn on any delete or rename to the project's root index.html file.

To test this, do the following:

I'm not sure if the text I've got in the dialog is right. I want to do another patch in Thimble that offers to create an index.html on publish, but decided to only warn about the issue here.

I've also added jshint excludes for src/nls to stop jshint complaining about strings as if they are code, and breaking the build.

r? @gideonthomas, @flukeout

Copy link

@gideonthomas gideonthomas left a comment

Choose a reason for hiding this comment

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

Code looks good to me. Going to test it now.

@@ -0,0 +1,68 @@
/*jslint vars: true, plusplus: true, devel: true, nomen: true, indent: 4, maxerr: 50 */
/*global define, brackets, clearTimeout, setTimeout */

Choose a reason for hiding this comment

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

don't need the last two


# extensions/extra/bramble-watch-index.html

INDEX_HTML_FILE_MISSING_DIALOG_TITLE=Warning - Missing index.html file

Choose a reason for hiding this comment

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

Before this lands, we should remove these changes from the commit and add them into Thimble so that it will show up on Pontoon to be localized and when Brackets syncs this file, there won't be merge conflicts.

Copy link
Author

Choose a reason for hiding this comment

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

Ah, OK, I misunderstood how to do this properly. The docs made me think I was supposed to do it here in Bramble. I'll do a PR against Thimble to add them there and remove these once you r+.

# extensions/extra/bramble-watch-index.html

INDEX_HTML_FILE_MISSING_DIALOG_TITLE=Warning - Missing index.html file
INDEX_HTML_FILE_MISSING_DIALOG_MESSAGE=Your project has no index.html file. Web servers look for index.html when URLs omit the filename, for example: google.com/ actually refers to google.com/index.html. Consider adding an index.html.

Choose a reason for hiding this comment

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

We also should simplify the wording for this a bit since when I was trying to explain this during a session, a lot of them were confused by "web servers".

Copy link
Author

@humphd humphd Nov 7, 2016

Choose a reason for hiding this comment

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

Yeah, I don't love the current text. Suggestions welcome, cc @flukeout

@flukeout
Copy link

flukeout commented Nov 7, 2016

If you get a chance, can you copy and paste a screenshot of how this dialog looks? Don't have my env up and running at the moment. I'll work on some copy ideas and paste them here in a bit.

@flukeout
Copy link

flukeout commented Nov 7, 2016

I'm thinking of something along the lines of...

You need an index.html page!

Projects that don't contain an index.html page will appear broken to viewers, it's the first page that the browser tries to load.

Question: when does this dialog pop-up? As soon as you right click and delete / rename? Are there an Undo or Do it anyway type buttons on the dialog?

@humphd
Copy link
Author

humphd commented Nov 8, 2016

@gideonthomas I've updated this PR, and also split out the Thimble bits into mozilla/thimble.mozilla.org#1580

@gideonthomas
Copy link

gideonthomas commented Nov 8, 2016

Ok looks like this works!

@humphd could you also add these three lines above this one: https://github.com/mozilla/brackets/blob/master/scripts/properties2js.js#L174

var DSStoreIndex = folders.indexOf(".DS_Store");
if(DSStoreIndex > -1) {
    folders.splice(DSStoreIndex, 1);
}

I was constantly blocked from proper l10n running on Macs.

After that I think this code is good to merge with @flukeout's copy/UI recommendations

@gideonthomas
Copy link

@flukeout here's the screenshot:
screen shot 2016-11-08 at 12 42 02 pm

@humphd
Copy link
Author

humphd commented Nov 8, 2016

I'm confused about strings again. Are you saying I need the strings here (Bramble) and in Thimble? Or just in Thimble?

Also, I updated the strings to a version of what Luke wrote already.

@gideonthomas
Copy link

@humphd no sorry, the strings are fine in Thimble, you don't need them in Bramble.

The code that I provide above (unrelated to your patch) just ignores .DS_Store when it runs npm run localize because it was throwing errors since it tries to localize files in .DS_Store on Macs.

@humphd
Copy link
Author

humphd commented Nov 8, 2016

@gideonthomas can you just take one last look at this? I made your change, but also remembered that I had to manually add the new extension to the service worker precache list.

Also, remind me how you want this landed. Do I squash, then land the PR in GitHub? I can't remember your preference.

@gideonthomas
Copy link

r=me

@humphd
Copy link
Author

humphd commented Nov 8, 2016

@gideonthomas reasking..."Also, remind me how you want this landed. Do I squash, then land the PR in GitHub? I can't remember your preference."

@gideonthomas
Copy link

@humphd you can use the "squash and merge" button in this pr to merge it in.

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.

3 participants