Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Autosave is not getting fired after 1st attempt #112

Open
dave4u90 opened this issue Mar 29, 2014 · 0 comments
Open

Autosave is not getting fired after 1st attempt #112

dave4u90 opened this issue Mar 29, 2014 · 0 comments

Comments

@dave4u90
Copy link
Contributor

The autosave is not firing after firs attempt.....here is my code

At

config.js

Extra open brace or missing close brace

$(document).ready(
    function () {
        var csrf_token = $
('meta[name=csrf-token]').attr('content'); var csrf_param =
Unable to render expression.

$('meta[name=csrf-param]').attr('content');
        var params;
        if (csrf_param !== undefined && csrf_token !== undefined) {
            params = csrf_param + "=" + encodeURIComponent(csrf_token);
        }
        $
('.redactor').redactor( { "imageUpload": "/redactor_rails/pictures?" + params, "imageGetJson": "/redactor_rails/pictures", "fileUpload": "/redactor_rails/documents?" + params, "fileGetJson": "/redactor_rails/documents", "path": "/assets/redactor-rails", "css": "style.css", autosave: "/notes", autosaveInterval: 30, // seconds autosaveFormdata: true, autosaveCallback: function (json) { console.log(json); } }); });

And at

NotesController

def create() if params[:note][:id].present? @note = Note.find(params[:note][:id]) @note.update_attributes(params[:note]) else @note = Note.new(params[:note]) @note.save end if request.xhr? if @note.note_object_type == ProductInstance.class.to_s render js: "window.location.replace('#{notes_url(:product_instance_id => @note.product_instance_id.to_s)}');" else render js: "history.back();" end else if @note.note_object_type == ProductInstance.class.to_s redirect_to notes_path(:product_instance_id => @note.product_instance_id.to_s) else redirect_to :back end end end

and in the view

<%= my_form.text_area :note, class: "redactor form-control", rows: 100, columns: 100 %>

Am i missing something or wrongly coded??

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant