Skip to content

Commit

Permalink
Introduce site option to enable put saver
Browse files Browse the repository at this point in the history
I chose not to support this for Tiddlyspot sites. There's no
technical reason not to I guess, but I don't want to invest time
adding and testing this kind of new feature for legacy Tiddlyspot
sites.

Rolling it out as an option allows it to be soft-launched as a kind
of tech preview. Maybe in future it will become the default saving
method, but not immediately.

The option doesn't do anything yet, but see next commit.
  • Loading branch information
simonbaird committed Apr 4, 2022
1 parent d2793ce commit 9c6c3f1
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 3 deletions.
4 changes: 2 additions & 2 deletions rails/app/controllers/sites_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -112,14 +112,14 @@ def set_empties_list
def site_params_for_create
params.
require(:site).
permit(:name, :description, :is_private, :is_searchable, :tag_list, :allow_in_iframe, :empty_id).
permit(:name, :description, :is_private, :is_searchable, :tag_list, :allow_in_iframe, :enable_put_saver, :empty_id).
merge(user_id: current_user.id)
end

def site_params_for_update
params.
require(:site).
permit(:name, :description, :is_private, :is_searchable, :tag_list, :allow_in_iframe)
permit(:name, :description, :is_private, :is_searchable, :tag_list, :allow_in_iframe, :enable_put_saver)
end

def site_params_for_upload
Expand Down
8 changes: 8 additions & 0 deletions rails/app/views/sites/_form.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,14 @@
.form-text
%h5 Advanced settings

=render layout: 'field_wrapper' do
.form-check
=f.check_box :enable_put_saver, class: 'form-check-input'
=f.label :enable_put_saver, 'Enable put saver', class: 'form-check-label'
.form-text
Save to Tiddlyhost using the 'put' saver instead of the legacy 'upload' saver.
Works best with TiddlyWiki 5.2.3 or higher.

=render 'site_common/allow_in_iframe', f: f

=render layout: 'field_wrapper', locals: { pt: 'pt-5' } do
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class AddPutSaverOptionToSites < ActiveRecord::Migration[6.1]
def change
add_column :sites, :enable_put_saver, :boolean, default: false
end
end
3 changes: 2 additions & 1 deletion rails/db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema.define(version: 2022_03_30_234401) do
ActiveRecord::Schema.define(version: 2022_04_04_022507) do

# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
Expand Down Expand Up @@ -70,6 +70,7 @@
t.integer "raw_byte_size"
t.string "tw_version"
t.boolean "allow_in_iframe", default: false
t.boolean "enable_put_saver", default: false
t.index ["empty_id"], name: "index_sites_on_empty_id"
t.index ["name"], name: "index_sites_on_name", unique: true
t.index ["user_id"], name: "index_sites_on_user_id"
Expand Down

0 comments on commit 9c6c3f1

Please sign in to comment.