Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

harmonized with popcorn publish dialog #380

Merged
merged 1 commit into from

2 participants

@Pomax
Owner

No description provided.

public/friendlycode/js/fc/ui/publish.js
((6 lines not shown))
// The publish call is a one-time deal. Once chosen, it
// prevents the user from clicking again by virtue of
// unsetting itself. It gets rebound when the dialog
// window is brought back into view.
var publishAction = function() {
- performPublish(publishCheckbox.attr("checked") === "true")();
+ console.log(publishCheckbox[0].checked);
@ScottDowne Owner

console.log

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@Pomax Pomax merged commit 5de43bc into mozilla:master
@Pomax Pomax deleted the unknown repository branch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Mar 5, 2014
  1. @Pomax
This page is out of date. Refresh to see the latest.
View
1  locale/en_US/thimble.webmaker.org.json
@@ -47,6 +47,7 @@
"rescued your very recent": "We've rescued your very recent changes to this page, but you can click this button to undo them.",
"Resize": "Resize",
"Save": "Save",
+ "Searchable on webmaker.org": "Searchable on webmaker.org",
"Share this via…": "Share this via…",
"Show hints": "Show hints",
"Show tutorial": "Show tutorial",
View
4 public/friendlycode/css/modals.css
@@ -237,7 +237,6 @@ html.deployment-type-development .confirm-dialog .development-note {
font-weight: 700;
font-size: 16px;
padding: 0.8em 1em;
- opacity: 0.75;
-moz-transition: opacity 0.5s;
-webkit-transition: opacity 0.5s;
-o-transition: opacity 0.5s;
@@ -251,6 +250,9 @@ html.deployment-type-development .confirm-dialog .development-note {
.confirmation-button.yes-button {
background: #3FB58E;
}
+.confirmation-button.yes-button[disabled] {
+ opacity: 0.5;
+}
.confirmation-button.no-button {
background: #D93B3B;
View
6 public/friendlycode/js/fc/ui/details-form.js
@@ -46,10 +46,10 @@ define(['template!details-form', 'jquery', 'jquery-ui'], function (detailsFormHT
success: function(response) {
if(response.status !== 200) {
$error.show();
- $button.hide();
+ $button.attr("disabled","disabled");
} else {
$error.hide();
- $button.show();
+ $button.removeAttr("disabled");
}
}
});
@@ -268,7 +268,7 @@ define(['template!details-form', 'jquery', 'jquery-ui'], function (detailsFormHT
self.addTags(val);
break;
case 'published':
- self.setPublished(val);
+ self.setPublished(typeof val === "undefined" ? true : val);
break;
default:
val = val || currentVal || self.findMetaTagInfo(field)[0];
View
22 public/friendlycode/js/fc/ui/editor-toolbar.js
@@ -37,8 +37,6 @@ define(function(require) {
panes = options.panes,
navOptions = $(NavOptionsTemplate()).appendTo(div),
saveButton = navOptions.find(".save-button"),
- publishButton = navOptions.find(".publish-button"),
- startSave,
startPublish,
undoNavItem = navOptions.find(".undo-nav-item");
@@ -68,22 +66,16 @@ define(function(require) {
panes.preview.on("change:viewlink", onChangeViewLink);
onChangeViewLink( $('body').data('make-url') || false);
- // If the editor has no content, disable the save and publish button.
+ // If the editor has no content, disable the save button.
panes.codeMirror.on("change", function() {
var codeLength = panes.codeMirror.getValue().trim().length;
- [saveButton, publishButton].forEach(function(button) {
+ [saveButton].forEach(function(button) {
button.attr("disabled", codeLength ? false : true);
});
});
saveButton.click(function() {
if (!$(this).attr("disabled")) {
- startSave(this);
- }
- });
-
- publishButton.click(function() {
- if (!$(this).attr("disabled")) {
startPublish(this);
}
});
@@ -91,19 +83,13 @@ define(function(require) {
self.refresh = function() {
historyUI.refresh();
};
- self.setStartSave = function(func) {
- startSave = func;
- saveButton.toggle(!!startSave);
- };
self.setStartPublish = function(func) {
startPublish = func;
- publishButton.toggle(!!startPublish);
+ saveButton.toggle(!!startPublish);
};
// defaults are bound in friendlycode.js,
- // as publishUI.start(saveOnly) and as
- // publishUI.start(saveAndPublish), respectively.
- self.setStartSave(null);
+ // as publishUI.start(...)
self.setStartPublish(null);
return self;
View
10 public/friendlycode/js/fc/ui/publish.js
@@ -173,14 +173,14 @@ define(function (require) {
detailsForm.updateAll(makeData);
var confirmButton = $(".yes-button", confirmDialog),
- publishCheckbox = $("input[name=published]", confirmDialog);
+ publishCheckbox = $("#details-published");
// The publish call is a one-time deal. Once chosen, it
// prevents the user from clicking again by virtue of
// unsetting itself. It gets rebound when the dialog
// window is brought back into view.
var publishAction = function() {
- performPublish(publishCheckbox.attr("checked") === "true")();
+ performPublish(publishCheckbox[0].checked)();
};
// strip any lingering click handlers from the dialog getting
@@ -194,16 +194,12 @@ define(function (require) {
var cb = $("#details-published");
cb.click(function() {
var state = !!this.checked;
- confirmButton.text(state ? confirmButton.data("publish") : confirmButton.data("save"));
});
// massage the confirmation dialog based on whether
// this is a save, or a save-and-publish operation
if (saveAndPublish) {
- publishCheckbox.attr("checked", saveAndPublish);
- confirmButton.text(confirmButton.data("publish"));
- } else {
- confirmButton.text(confirmButton.data("save"));
+ publishCheckbox[0].checked = true;
}
confirmDialog.fadeIn();
View
8 public/friendlycode/js/friendlycode.js
@@ -55,11 +55,9 @@ define(function(require) {
ready.resolve();
}
- // save and publish buttons effect different publish options
- var saveOnly = false,
- saveAndPublish = true;
- editor.toolbar.setStartSave(publishUI.start(saveOnly));
- editor.toolbar.setStartPublish(publishUI.start(saveAndPublish));
+ // set up save to automatically save + publish to makeAPI,
+ // used in editor-toolbar.js
+ editor.toolbar.setStartPublish(publishUI.start(true));
editor.container.addClass("friendlycode-loading");
publishUI.on("publish", function(info) {
View
2  views/friendlycode/templates/confirm-dialog.html
@@ -7,7 +7,7 @@
<div class="details-container"></div>
<div class="error-warning">{{ gettext("error-warning") | safe }}</div>
<div class="confirmation-buttons">
- <button class="confirmation-button yes-button" data-save="{{ gettext("Save") }}" data-publish="{{ gettext("Publish") }}">{{ gettext("Publish") }}</button>
+ <button class="confirmation-button yes-button" data-save="{{ gettext("Save") }}" data-publish="{{ gettext("Save") }}">{{ gettext("Save") }}</button>
<button class="confirmation-button no-button" data-close-modal>{{ gettext("Cancel") }}</button>
</div>
</div>
View
2  views/friendlycode/templates/details-form.html
@@ -24,7 +24,7 @@
<textarea name="description" class="input"></textarea>
</fieldset>
<fieldset>
- <label for="details-published">{{ gettext("Treat this make as published, rather than merely saved") }}</label>
+ <label for="details-published">{{ gettext("Searchable on webmaker.org") }}</label>
<input type="checkbox" name="published" id="details-published">
</fieldset>
</form>
View
1  views/friendlycode/templates/nav-options.html
@@ -32,7 +32,6 @@
<div class="nav-item buttons">
<a class="page-view-link" href="" target="_blank"><div class="page-view-button wm-button wm-button-blue short">{{ gettext("View") }}</div></a>
<button class="save-button wm-button wm-button-blue short">{{ gettext("Save") }}</button>
- <button class="publish-button wm-button wm-button-blue short">{{ gettext("Publish") }}</button>
</div>
</div>
</div>
View
4 views/ssooverride.html
@@ -36,8 +36,7 @@
editor.ready.done(function() {
var userfield = $("#identity"),
buttons = $('.save-button, .publish-button'),
- saveButton = $('.save-button'),
- publishButton = $('.publish-button');
+ saveButton = $('.save-button');
function enable(user) {
buttons.attr("disabled", false).attr("title", '');
@@ -49,7 +48,6 @@
displayLogin();
buttons.attr("disabled", true);
saveButton.attr("title", "{{ gettext("Login to save") }}");
- publishButton.attr("title", "{{ gettext("Login to publish") }}");
html.classList.remove("loggedin");
}
Something went wrong with that request. Please try again.