Sha256: b6434131bdcd55aab386480ac02f7e75be6adf5422215b3777888787a35fc845

Contents?: true

Size: 1.65 KB

Versions: 3

Compression:

Stored size: 1.65 KB

Contents

require_dependency 'application_controller'
require "radiant-taggable-extension"

class TaggableExtension < Radiant::Extension
  version RadiantTaggableExtension::VERSION
  description RadiantTaggableExtension::DESCRIPTION
  url RadiantTaggableExtension::URL
  
  def activate
    require 'natcmp'                                                      # a natural sort algorithm. possibly not that efficient.
    ActiveRecord::Base.send :include, Taggable::Model                     # provide has_tags for everything but don't call it for anything
    Page.send :include, Taggable::Page                                    # pages are taggable (and the keywords column is overridden)
    Asset.send :include, Taggable::Asset                                  # assets are taggable (and a fake keywords column is provided)
    Page.send :include, Radius::TaggableTags                              # adds the basic radius tags for showing page tags and tag pages
    Page.send :include, Radius::AssetTags                                 # adds some asset:* tags
    Page.send :include, Radius::LibraryTags
    SiteController.send :include, Taggable::SiteController                # some path and parameter handling in support of library pages
    Admin::PagesController.send :include, Taggable::AdminPagesController  # tweaks the admin interface to make page tags more prominent
    UserActionObserver.instance.send :add_observer!, Tag                  # tags get creator-stamped

    unless defined? admin.tag
      Radiant::AdminUI.send :include, Taggable::AdminUI
      Radiant::AdminUI.load_taggable_regions
    end

    tab("Content") do
      add_item("Tags", "/admin/tags")
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
radiant-taggable-extension-2.0.3 taggable_extension.rb
radiant-taggable-extension-2.0.2 taggable_extension.rb
radiant-taggable-extension-2.0.1 taggable_extension.rb