Skip to content

Commit

Permalink
classic: Show th save button only if it's usable
Browse files Browse the repository at this point in the history
There are some pros and cons to this, e.g. with this change, a user
with an expired login session might be confused about why they can
no longer save. On the other hand showing the "save to tiddlyhost"
button when a save is not possible is also potentially confusing.
Anyway, let's try it this way and see how we like it.

Closely related to the changes in the previous commit for
issue #326.
  • Loading branch information
simonbaird committed Jun 16, 2024
1 parent 16ae415 commit 58aa414
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions rails/lib/th_file.rb
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ def apply_classic_mods(site_name, for_download:, is_logged_in:)
},

# Used in the ThostUploadPlugin to ensure we don't render in readonly mode
# and to show the 'save to tiddlyhost' button
'TiddlyHostIsLoggedIn' => {
text: status_is_logged_in(is_logged_in:, for_download:),
modifier: 'TiddlyHost',
Expand Down
8 changes: 4 additions & 4 deletions rails/tw_content/plugins/thost_upload_plugin.js.erb
Original file line number Diff line number Diff line change
Expand Up @@ -200,10 +200,10 @@ if (config.shadowTiddlers.TiddlyHostIsLoggedIn == "yes") {
// set it here to make sure TW is editable, unlike window.showBackstage
// which is set after
window.readOnly = false
}

// Add 'upload to tiddlyhost' button
config.shadowTiddlers.SideBarOptions = config.shadowTiddlers.SideBarOptions
.replace(/(<<saveChanges>>)/,"$1<<thostUpload>>");
// Add the 'save to tiddlyhost' button after the regular save button
config.shadowTiddlers.SideBarOptions = config.shadowTiddlers.SideBarOptions
.replace(/(<<saveChanges>>)/,"$1<<thostUpload>>");
}

//}}}

0 comments on commit 58aa414

Please sign in to comment.