Module: RailsKindeditor::Helper
- Defined in:
- lib/rails_kindeditor/helper.rb
Instance Method Summary collapse
- #kindeditor(name, method, options = {}) ⇒ Object
- #kindeditor_file_manager_json_path ⇒ Object
- #kindeditor_tag(name, content = nil, options = {}) ⇒ Object
- #kindeditor_upload_json_path(*args) ⇒ Object
Instance Method Details
#kindeditor(name, method, options = {}) ⇒ Object
11 12 13 14 15 16 17 |
# File 'lib/rails_kindeditor/helper.rb', line 11 def kindeditor(name, method, = {}) # TODO: Refactory options: 1. kindeditor_option 2. html_option input_html = (.delete(:input_html) || {}).stringify_keys output_buffer = ActiveSupport::SafeBuffer.new output_buffer << build_text_area_tag(name, method, self, , input_html) output_buffer << javascript_tag(js_replace(input_html['id'], )) end |
#kindeditor_file_manager_json_path ⇒ Object
27 28 29 |
# File 'lib/rails_kindeditor/helper.rb', line 27 def kindeditor_file_manager_json_path "#{main_app_root_url}kindeditor/filemanager" end |
#kindeditor_tag(name, content = nil, options = {}) ⇒ Object
3 4 5 6 7 8 9 |
# File 'lib/rails_kindeditor/helper.rb', line 3 def kindeditor_tag(name, content = nil, = {}) id = sanitize_to_id(name) input_html = { :id => id }.merge(.delete(:input_html) || {}) output = ActiveSupport::SafeBuffer.new output << text_area_tag(name, content, input_html) output << javascript_tag(js_replace(id, )) end |
#kindeditor_upload_json_path(*args) ⇒ Object
19 20 21 22 23 24 25 |
# File 'lib/rails_kindeditor/helper.rb', line 19 def kindeditor_upload_json_path(*args) = args. owner_id_query_string = [:owner_id] ? "owner_id=#{[:owner_id]}" : '' fixed_folder = [:fixed_folder] ? "fixed_folder=#{[:fixed_folder]}" : '' digest_filename = [:fixed_folder] ? "digest_filename=#{[:digest_filename]}" : '' "#{main_app_root_url}kindeditor/upload?#{fixed_folder}&#{owner_id_query_string}&#{digest_filename}" end |