Plugin develoment - Add a new user setting

Added by Alexey Kalmykov almost 11 years ago

Hello,

I'm using redmine-wysiwyg-textile(http://www.redmine.org/boards/3/topics/17852) editor and i want to add user setting to choose default editor.
I created migration:

class UpdateUserPreferences < ActiveRecord::Migration
    def self.up
        create_table :default_editor do |t|
            t.column :editor, :string
            t.column :user_id, :integer
        end
    end

    def self.down
        drop_table :default_editor 
    end
end

I've created radio button using hooks in user settings:

module RedmineWysiwygTextile
  class Hooks < Redmine::Hook::ViewListener
        render_on :view_my_account_contextual,
        :partial => 'test/test'
  end
end

where _test.erb is
<html>
<body>
<br>
<br>
<b>Default editor</b?
<br>
<br><%= radio_button_tag 'editor', 'wysiwyg', false %> WYSIWYG <%= radio_button_tag 'editor', 'textile', true %> Textile
</body>
</html>

But i don't know how to catch event, when user clicks on save button, and how to get radio button value and how to save it to database.
Can anybody help me? I'm newbie in RoR.
Thanks a lot.