diff --git a/vendor/plugins/resource_feeder/lib/resource_feeder/atom.rb b/vendor/plugins/resource_feeder/lib/resource_feeder/atom.rb index 315f1d3a..62d15370 100644 --- a/vendor/plugins/resource_feeder/lib/resource_feeder/atom.rb +++ b/vendor/plugins/resource_feeder/lib/resource_feeder/atom.rb @@ -3,6 +3,7 @@ require 'resource_feeder/common' module ResourceFeeder module Atom include ResourceFeeder::Common + include ActionController::Routing extend self def render_atom_feed_for(resources, options = {}) @@ -25,14 +26,14 @@ module ResourceFeeder options[:feed][:title] ||= klass.name.pluralize options[:feed][:id] ||= "tag:#{request.host_with_port}:#{klass.name.pluralize}" - options[:feed][:link] ||= SimplyHelpful::PolymorphicRoutes.polymorphic_url(new_record, options[:url_writer]) + options[:feed][:link] ||= polymorphic_url(new_record, :controller => options[:url_writer]) options[:item][:title] ||= [ :title, :subject, :headline, :name ] options[:item][:description] ||= [ :description, :body, :content ] options[:item][:pub_date] ||= [ :updated_at, :updated_on, :created_at, :created_on ] options[:item][:author] ||= [ :author, :creator ] - resource_link = lambda { |r| SimplyHelpful::PolymorphicRoutes.polymorphic_url(r, options[:url_writer]) } + resource_link = lambda { |r| polymorphic_url(r, :controller => options[:url_writer]) } xml.instruct! xml.feed "xml:lang" => "en-US", "xmlns" => 'http://www.w3.org/2005/Atom' do diff --git a/vendor/plugins/resource_feeder/lib/resource_feeder/rss.rb b/vendor/plugins/resource_feeder/lib/resource_feeder/rss.rb index 1053f427..bcbe7598 100644 --- a/vendor/plugins/resource_feeder/lib/resource_feeder/rss.rb +++ b/vendor/plugins/resource_feeder/lib/resource_feeder/rss.rb @@ -3,6 +3,7 @@ require 'resource_feeder/common' module ResourceFeeder module Rss include ResourceFeeder::Common + include ActionController::Routing extend self def render_rss_feed_for(resources, options = {}) @@ -25,7 +26,7 @@ module ResourceFeeder use_content_encoded = options[:item].has_key?(:content_encoded) options[:feed][:title] ||= klass.name.pluralize - options[:feed][:link] ||= SimplyHelpful::PolymorphicRoutes.polymorphic_url(new_record, options[:url_writer]) + options[:feed][:link] ||= polymorphic_url(new_record, :controller => options[:url_writer]) options[:feed][:language] ||= "en-us" options[:feed][:ttl] ||= "40" @@ -33,7 +34,7 @@ module ResourceFeeder options[:item][:description] ||= [ :description, :body, :content ] options[:item][:pub_date] ||= [ :updated_at, :updated_on, :created_at, :created_on ] - resource_link = lambda { |r| SimplyHelpful::PolymorphicRoutes.polymorphic_url(r, options[:url_writer]) } + resource_link = lambda { |r| polymorphic_url(r, :controller => options[:url_writer]) } rss_root_attributes = { :version => 2.0 } rss_root_attributes.merge!("xmlns:content" => "http://purl.org/rss/1.0/modules/content/") if use_content_encoded diff --git a/vendor/plugins/simply_helpful/CHANGELOG b/vendor/plugins/simply_helpful/CHANGELOG deleted file mode 100644 index fb38a874..00000000 --- a/vendor/plugins/simply_helpful/CHANGELOG +++ /dev/null @@ -1,9 +0,0 @@ -* Added formatted_polymorphic_url, formatted_polymorphic_path - -* Added support for route options. Example: - - polymorphic_url(:id => @subject, :anchor => "photo") - -* Added polymorphic routes for new and edit actions (new_polymorphic_url, edit_polymorphic_url) - -* Moved polymorphic routes from SimplyHelpful::RecordIdentifier to SimplyHelpful::PolymorphicRoutes \ No newline at end of file diff --git a/vendor/plugins/simply_helpful/README b/vendor/plugins/simply_helpful/README deleted file mode 100644 index 4711fe24..00000000 --- a/vendor/plugins/simply_helpful/README +++ /dev/null @@ -1,4 +0,0 @@ -SimplyHelpful -============= - -Description goes here \ No newline at end of file diff --git a/vendor/plugins/simply_helpful/Rakefile b/vendor/plugins/simply_helpful/Rakefile deleted file mode 100644 index efce24d2..00000000 --- a/vendor/plugins/simply_helpful/Rakefile +++ /dev/null @@ -1,22 +0,0 @@ -require 'rake' -require 'rake/testtask' -require 'rake/rdoctask' - -desc 'Default: run unit tests.' -task :default => :test - -desc 'Test the simply_helpful plugin.' -Rake::TestTask.new(:test) do |t| - t.libs << 'lib' - t.pattern = 'test/**/*_test.rb' - t.verbose = true -end - -desc 'Generate documentation for the simply_helpful plugin.' -Rake::RDocTask.new(:rdoc) do |rdoc| - rdoc.rdoc_dir = 'rdoc' - rdoc.title = 'SimplyHelpful' - rdoc.options << '--line-numbers' << '--inline-source' - rdoc.rdoc_files.include('README') - rdoc.rdoc_files.include('lib/**/*.rb') -end diff --git a/vendor/plugins/simply_helpful/init.rb b/vendor/plugins/simply_helpful/init.rb deleted file mode 100644 index d80efa41..00000000 --- a/vendor/plugins/simply_helpful/init.rb +++ /dev/null @@ -1,4 +0,0 @@ -require 'simply_helpful' -ActionController::Base.send :include, SimplyHelpful::RecordIdentificationHelper -ActionController::Base.helper SimplyHelpful::RecordIdentificationHelper, - SimplyHelpful::RecordTagHelper diff --git a/vendor/plugins/simply_helpful/lib/simply_helpful.rb b/vendor/plugins/simply_helpful/lib/simply_helpful.rb deleted file mode 100644 index 60e4d167..00000000 --- a/vendor/plugins/simply_helpful/lib/simply_helpful.rb +++ /dev/null @@ -1,10 +0,0 @@ -require 'simply_helpful/record_identification_helper' -require 'simply_helpful/record_identifier' -require 'simply_helpful/record_tag_helper' - -require 'simply_helpful/polymorphic_routes' - -require 'simply_helpful/jsg_extensions' -require 'simply_helpful/av_extensions' -require 'simply_helpful/form_helper_extensions' -require 'simply_helpful/controller_extensions' \ No newline at end of file diff --git a/vendor/plugins/simply_helpful/lib/simply_helpful/av_extensions.rb b/vendor/plugins/simply_helpful/lib/simply_helpful/av_extensions.rb deleted file mode 100644 index d4cd4f97..00000000 --- a/vendor/plugins/simply_helpful/lib/simply_helpful/av_extensions.rb +++ /dev/null @@ -1,26 +0,0 @@ -module ActionView - module Partials - def render_partial_with_record_identification(partial_path, local_assigns = nil, deprecated_local_assigns = nil) - if partial_path.is_a?(String) || partial_path.is_a?(Symbol) || partial_path.nil? - render_partial_without_record_identification( - partial_path, local_assigns, deprecated_local_assigns - ) - elsif partial_path.is_a?(Array) - if partial_path.any? - path = SimplyHelpful::RecordIdentifier.partial_path(partial_path.first) - collection = partial_path - render_partial_collection( - path, collection, nil, local_assigns.value - ) - else - "" - end - else - render_partial_without_record_identification( - SimplyHelpful::RecordIdentifier.partial_path(partial_path), local_assigns, deprecated_local_assigns - ) - end - end - alias_method_chain :render_partial, :record_identification - end -end diff --git a/vendor/plugins/simply_helpful/lib/simply_helpful/controller_extensions.rb b/vendor/plugins/simply_helpful/lib/simply_helpful/controller_extensions.rb deleted file mode 100644 index 5ce3c44f..00000000 --- a/vendor/plugins/simply_helpful/lib/simply_helpful/controller_extensions.rb +++ /dev/null @@ -1,42 +0,0 @@ -module SimplyHelpful - module ActionControllerExtensions - POLYMORPHIC_ROUTES = %w( - polymorphic_url polymorphic_path - edit_polymorphic_url edit_polymorphic_path - new_polymorphic_url new_polymorphic_path - formatted_polymorphic_url formatted_polymorphic_path - ) - - def self.included(base) - POLYMORPHIC_ROUTES.each { |route| base.helper_method(route) } - end - - POLYMORPHIC_ROUTES.each do |route| - module_eval <<-EOT - def #{route}(record) - SimplyHelpful::PolymorphicRoutes.#{route}(record, self) - end - EOT - end - - def redirect_to_with_record_identification(*args) - return redirect_to_without_record_identification *args unless args.size == 1 - - potential_object = args.first - - case potential_object - when String, Symbol, Hash - redirect_to_without_record_identification *args - else - redirect_to_without_record_identification SimplyHelpful::PolymorphicRoutes.polymorphic_url(potential_object, self) - end - end - end -end - -module ActionController - class Base - include SimplyHelpful::ActionControllerExtensions - alias_method_chain :redirect_to, :record_identification - end -end \ No newline at end of file diff --git a/vendor/plugins/simply_helpful/lib/simply_helpful/form_helper_extensions.rb b/vendor/plugins/simply_helpful/lib/simply_helpful/form_helper_extensions.rb deleted file mode 100644 index b284ab7b..00000000 --- a/vendor/plugins/simply_helpful/lib/simply_helpful/form_helper_extensions.rb +++ /dev/null @@ -1,48 +0,0 @@ -module ActionView - module Helpers - module FormHelper - def form_for_with_record_identification(name_or_object, *args, &proc) - form_method_with_record_identification :form_for, name_or_object, *args, &proc - end - - alias_method_chain :form_for, :record_identification - - protected - def form_method_with_record_identification(method_name, name_or_object, *args, &proc) - old_method_name = "#{method_name}_without_record_identification" - case name_or_object - when String, Symbol, NilClass - send(old_method_name, name_or_object, *args, &proc) - else - options = args.first || {} - - object_name = SimplyHelpful::RecordIdentifier.singular_class_name(name_or_object) - object = name_or_object - url = SimplyHelpful::PolymorphicRoutes.polymorphic_url(object, self) - - html_options = if object.new_record? - { :class => dom_class(object, :new), :id => dom_id(object), :method => :post } - else - { :class => dom_class(object, :edit), :id => dom_id(object, :edit), :method => :put } - end - - send(old_method_name, - object_name, object, options.merge({ :url => url, :html => html_options.update(options[:html] || {}) }), &proc - ) - end - end - end - end -end - -module ActionView - module Helpers - module PrototypeHelper - def remote_form_for_with_record_identification(name_or_object, *args, &proc) - form_method_with_record_identification :remote_form_for, name_or_object, *args, &proc - end - - alias_method_chain :remote_form_for, :record_identification - end - end -end diff --git a/vendor/plugins/simply_helpful/lib/simply_helpful/jsg_extensions.rb b/vendor/plugins/simply_helpful/lib/simply_helpful/jsg_extensions.rb deleted file mode 100644 index 6c9842a9..00000000 --- a/vendor/plugins/simply_helpful/lib/simply_helpful/jsg_extensions.rb +++ /dev/null @@ -1,18 +0,0 @@ -module ActionView - module Helpers - module PrototypeHelper - class JavaScriptGenerator - module GeneratorMethods - def [](id) - case id - when String, Symbol, NilClass - JavaScriptElementProxy.new(self, id) - else - JavaScriptElementProxy.new(self, SimplyHelpful::RecordIdentifier.dom_id(id)) - end - end - end - end - end - end -end \ No newline at end of file diff --git a/vendor/plugins/simply_helpful/lib/simply_helpful/polymorphic_routes.rb b/vendor/plugins/simply_helpful/lib/simply_helpful/polymorphic_routes.rb deleted file mode 100644 index 49cba920..00000000 --- a/vendor/plugins/simply_helpful/lib/simply_helpful/polymorphic_routes.rb +++ /dev/null @@ -1,52 +0,0 @@ -module SimplyHelpful - module PolymorphicRoutes - extend self - - def polymorphic_url(record_or_hash, url_writer, options = {}) - record = extract_record(record_or_hash) - - case - when options[:action] == "new" - url_writer.send(action_prefix(options) + RecordIdentifier.singular_class_name(record) + routing_type(options)) - - when record.new_record? - url_writer.send(RecordIdentifier.plural_class_name(record) + routing_type(options)) - - else - url_writer.send( - action_prefix(options) + RecordIdentifier.singular_class_name(record) + routing_type(options), record_or_hash - ) - end - end - - def polymorphic_path(record_or_hash, url_writer) - polymorphic_url(record_or_hash, url_writer, :routing_type => :path) - end - - %w( edit new formatted ).each do |action| - module_eval <<-EOT - def #{action}_polymorphic_url(record_or_hash, url_writer) - polymorphic_url(record_or_hash, url_writer, :action => "#{action}") - end - - def #{action}_polymorphic_path(record_or_hash, url_writer) - polymorphic_url(record_or_hash, url_writer, :action => "#{action}", :routing_type => :path) - end - EOT - end - - - private - def action_prefix(options) - options[:action] ? "#{options[:action]}_" : "" - end - - def routing_type(options) - "_#{options[:routing_type] || "url"}" - end - - def extract_record(record_or_hash) - record_or_hash.is_a?(Hash) ? record_or_hash[:id] : record_or_hash - end - end -end diff --git a/vendor/plugins/simply_helpful/lib/simply_helpful/record_identification_helper.rb b/vendor/plugins/simply_helpful/lib/simply_helpful/record_identification_helper.rb deleted file mode 100644 index 49178478..00000000 --- a/vendor/plugins/simply_helpful/lib/simply_helpful/record_identification_helper.rb +++ /dev/null @@ -1,16 +0,0 @@ -module SimplyHelpful - module RecordIdentificationHelper - protected - def partial_path(*args, &block) - RecordIdentifier.partial_path(*args, &block) - end - - def dom_class(*args, &block) - RecordIdentifier.dom_class(*args, &block) - end - - def dom_id(*args, &block) - RecordIdentifier.dom_id(*args, &block) - end - end -end diff --git a/vendor/plugins/simply_helpful/lib/simply_helpful/record_identifier.rb b/vendor/plugins/simply_helpful/lib/simply_helpful/record_identifier.rb deleted file mode 100644 index d50b4bad..00000000 --- a/vendor/plugins/simply_helpful/lib/simply_helpful/record_identifier.rb +++ /dev/null @@ -1,32 +0,0 @@ -module SimplyHelpful - module RecordIdentifier - extend self - - def partial_path(record_or_class) - klass = class_from_record_or_class(record_or_class) - "#{klass.name.tableize}/#{klass.name.demodulize.underscore}" - end - - def dom_class(record_or_class, prefix = nil) - [ prefix, singular_class_name(record_or_class) ].compact * '_' - end - - def dom_id(record, prefix = nil) - prefix ||= 'new' unless record.id - [ prefix, singular_class_name(record), record.id ].compact * '_' - end - - def plural_class_name(record_or_class) - singular_class_name(record_or_class).pluralize - end - - def singular_class_name(record_or_class) - class_from_record_or_class(record_or_class).name.underscore.tr('/', '_') - end - - private - def class_from_record_or_class(record_or_class) - record_or_class.is_a?(Class) ? record_or_class : record_or_class.class - end - end -end diff --git a/vendor/plugins/simply_helpful/lib/simply_helpful/record_tag_helper.rb b/vendor/plugins/simply_helpful/lib/simply_helpful/record_tag_helper.rb deleted file mode 100644 index 1352053f..00000000 --- a/vendor/plugins/simply_helpful/lib/simply_helpful/record_tag_helper.rb +++ /dev/null @@ -1,76 +0,0 @@ -module SimplyHelpful - module RecordTagHelper - # Produces a wrapper DIV element with id and class parameters that - # relate to the specified ActiveRecord object. Usage example: - # - # <% div_for(@person, :class => "foo") do %> - # <%=h @person.name %> - # <% end %> - # - # produces: - # - #