Compare commits

..

No commits in common. "revert" and "master" have entirely different histories.

5 changed files with 3 additions and 40 deletions

View File

@ -1,4 +0,0 @@
en:
sisyphus:
autosaved_content: You are viewing autosaved content.
revert: Revert to original content

View File

@ -7,25 +7,8 @@ module Sisyphus
mattr_accessor :process
mattr_accessor :app_root
mattr_accessor :config
mattr_accessor :form_builder
def self.setup
yield self
end
class FormBuilder
def initialize(template)
@template = template
end
def status
@template.content_tag(:div, message.html_safe, :class => 'sisyphus_status', :style => 'display: none')
end
def message
@template.t('sisyphus.autosaved_content') << @template.content_tag(:button, @template.t('sisyphus.revert'))
end
end
Sisyphus.form_builder = Sisyphus::FormBuilder
end
end

View File

@ -28,11 +28,6 @@ module ActionView
end
alias_method_chain :form_for, :sisyphus
def sisyphus_status
Sisyphus.form_builder.new(self).status
end
end
end
end
end

View File

@ -6,7 +6,7 @@ module ActionView
buf = ActiveSupport::SafeBuffer.new
if options.has_key?(:id) && Sisyphus::process
buf.safe_concat("<script type=\"text/javascript\">$(document).ready(function() {$('##{options[:id]}').sisyphus({onRestore: $.sisyphus.railsRestore, excludeFields: $('input[name=utf8], input[name=_method], input[name=authenticity_token]')});});</script>")
buf.safe_concat("<script type=\"text/javascript\">$(document).ready(function() {$('##{options[:id]}').sisyphus({excludeFields: $('input[name=utf8], input[name=_method], input[name=authenticity_token]')});});</script>")
end
buf << form_tag_without_sisyphus(url_for_options, options, &block)

View File

@ -1,11 +0,0 @@
//= require sisyphus
//= require_self
$.sisyphus.railsRestore = function() {
$('.sisyphus_status').show().find('button').unbind().click(function() {
$.sisyphus().manuallyReleaseData();
window.location.href = window.location.href;
return false;
});
};