Update publish popup title when project is live - Issue 1918 #2523
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I still need to test this but nice work so far!
locales/en-US/server.properties
Outdated
@@ -213,6 +213,7 @@ snippetJSChangeStyleComment=Select the element with id='alert' | |||
|
|||
# Publishing | |||
publishHeader=Publish your Project | |||
publisedhHeader=Your Project is Online |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
since you're using this in the client files you should add this string to the client.properties file instead as per https://github.com/mozilla/thimble.mozilla.org/wiki/Localization#client-side-localization.
Also rename this to publishHeaderOnline
@marcobeltempo before we go to land this, I need to show you how to rebase your work, since it looks like you've got a bunch of commits in here that aren't part of your patch (did you merge with master, maybe?). It's not a problem, we can fix it, but FYI, you don't need to do that while you're developing. |
@humphd that would be great! I made a mess somewhere down the line and a bigger one trying to fix it. |
Yeah, it's easily fixed, don't worry. For now, just keep getting your PR fixed. Then I'll give you a hand. Remind me please, I'll forget, but I need to cover this with all of you. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good work so far @marcobeltempo!
I'm not sure how you managed to get it to revert back to "Publish this project" when you unpublish the project as I don't see code to handle that case. I added comments to suggest where to make those changes. Let me know if you're having trouble with getting it to work and please do rebase your changes before pushing them up.
locales/en-US/client.properties
Outdated
@@ -27,6 +27,7 @@ renameProjectSavingIndicator=Saving… | |||
publishPublishingIndicator=Publishing… | |||
publishUnpublishingIndicator=Unpublishing… | |||
publishDeleteWarning=Are you sure? The current link will stop working and if you publish again, the link will be different. | |||
publishHeaderOnline=Your Project is Online |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also move the publishHeader
string from server.properties
to server-client-shared.properties
since we are going to use that string in both the server and the client.
@@ -14,6 +14,7 @@ var TEXT_UNPUBLISH = strings.get("publishDeleteBtn"); | |||
var TEXT_UNPUBLISHING = strings.get("publishUnpublishingIndicator"); | |||
var TEXT_UPDATE_PUBLISH = strings.get("publishChangesBtn"); | |||
var TEXT_UNPUBLISH_WARNING = strings.get("publishDeleteWarning"); | |||
var TEXT_PUBLISHED_HEADER = strings.get("publishHeaderOnline"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's call the TEXT_PUBLISH_HEADER_ONLINE
and add another variable here called TEXT_PUBLISH_HEADER
that stores the publishHeader
string
@@ -319,6 +321,7 @@ Publisher.prototype.updateDialog = function(publishUrl, allowUnpublish) { | |||
// "publish"/"cancel" buttons | |||
if (allowUnpublish) { | |||
this.dialog.buttons.parent.addClass("hide"); | |||
this.dialog.publishHeader.text(TEXT_PUBLISHED_HEADER); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you also need to set the title in the else condition back to TEXT_PUBLISH_HEADER
views/editor/publish.html
Outdated
@@ -41,4 +41,4 @@ | |||
<div id="publish-button-publish">{{ gettext("publishBtn") }}</div> | |||
</div> | |||
</div> | |||
{% endblock %} | |||
{% endblock %} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
revert this change
@gideonthomas Thank you for all your feedback! I've got it working again on my localhost. I'll commit shortly with the revisions |
Looking forward to testing this. Please ping me when it's ready @marcobeltempo! |
Everything's ready for testing @flukeout |
@marcobeltempo can you rebase this PR onto master? You seem to have some extra commits in here. |
cd0cfcc
to
0c5c45c
Compare
@gideonthomas I rebased the PR onto master |
0c5c45c
to
2c45484
Compare
This looks great! Thanks for the contribution @marcobeltempo! |
@gideonthomas Thanks again for all your help! 😃 |
Fixes #1918
The original issue was that the publish popup title would always display "Publish your Project" regards if it was live or not.
@flukeout @humphd My solution was to reuse the existing
h1
in "views/editor/publish.html" to assign the value depending on the current state of the project performed on the server side.Unpublished title = "Publish your Project"
Published title = " Your Project is Online"
created var
TEXT_PUBLISHED_HEADER = strings.get("publishedHeader");
holds the string value from"locales/en-US/server.properties"
added publishHeader to the Publisher() object in "\public\editor\scripts\ui\publisher.js". This gets the
<h1>
id in "views/editor/publish.html"Publisher.prototype.updateDialog
located in "views/editor/publish.html" already checks the handler of the project status.If the project is published, the header gets assigned
TEXT_PUBLISHED_HEADER
from step 1If the project is unpublished the header is set to default