Sha256: 3d9f9c82ce4a7175c6c2137e3311e7f484ab1560bb1a923eac64c48046363b14

Contents?: true

Size: 1.74 KB

Versions: 10

Compression:

Stored size: 1.74 KB

Contents

require 'ajax'

include Ajax::Helpers::TaskHelper

namespace :ajax do
  desc "Install required Ajax files.  Existing files will not be overwritten."
  task :install do
    INSTALL_FILES.map do |file|
      show_result(file) { |file| copy_unless_exists(file) }
    end
    puts <<-END
\nWelcome to Ajax!

1. Ajax looks for an alternative layout to use with AJAX requests in
<tt>app/views/layouts/ajax/</tt>. Copy existing layouts into this directory and get them
ready for AJAX by removing any HTML HEAD elements, everything but the inner BODY content.

 Your main layout should contain a container element that will receive page content.
Typically this would be the container below the page header. If you don't have a static
header, you can make the whole BODY element the container.

 Here is an example of converting our layouts/application.html.haml to
layouts/ajax/application.html.haml:
http://gist.github.com/373133/5a80a63ef69a883ed3c5630b68330b1036ad01ec.

2. Instantiate an instance of the Ajax class in public/javascripts/application.js. For
example:

  // public/javascripts/application.js
  if (typeof(Ajax) != 'undefined') {
    window.ajax = new Ajax({
      default_container: '#main',  // jQuery selector of your container element
      enabled: true,               // Enable/disable the plugin
      lazy_load_assets: false      // YMMV
    });
  }
END
  end

  namespace :install do
    desc "Copy Ajax integration spec tests into spec/integration."
    task :specs do
      puts "Coming soon..."
    end
  end

  namespace :update do
    desc "Overwrite public/javascripts/ajax.js with the latest version."
    task :javascript do
      UPDATE_JAVASCRIPT_FILES.map do |file|
        show_result(file) { |file| copy_and_overwrite(file) }
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
ajax-1.0.8 tasks/ajax_tasks.rake
ajax-1.0.7 tasks/ajax_tasks.rake
ajax-1.0.6 tasks/ajax_tasks.rake
ajax-1.0.5 tasks/ajax_tasks.rake
ajax-1.0.4 tasks/ajax_tasks.rake
ajax-1.0.3 tasks/ajax_tasks.rake
ajax-1.0.2 tasks/ajax_tasks.rake
ajax-1.0.1 tasks/ajax_tasks.rake
ajax-0.1.7 tasks/ajax_tasks.rake
ajax-0.1.6 tasks/ajax_tasks.rake