Skip to content
This repository has been archived by the owner on Jul 31, 2019. It is now read-only.

added in logged-in check for enabling the save button #385

Merged
merged 1 commit into from Mar 7, 2014
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 8 additions & 4 deletions public/friendlycode/js/fc/ui/editor-toolbar.js
Expand Up @@ -67,11 +67,15 @@ define(function(require) {
onChangeViewLink( $('body').data('make-url') || false);

// If the editor has no content, disable the save button.
// Enable it only when the user is loggede in.
var authStatus = $("html");
panes.codeMirror.on("change", function() {
var codeLength = panes.codeMirror.getValue().trim().length;
[saveButton].forEach(function(button) {
button.attr("disabled", codeLength ? false : true);
});
if(authStatus.hasClass("loggedin")) {
var codeLength = panes.codeMirror.getValue().trim().length;
[saveButton].forEach(function(button) {
button.attr("disabled", codeLength ? false : true);
});
}
});

saveButton.click(function() {
Expand Down