Sha256: e9db7d532d833f1d1bd1e01f990d19466489404fce2b500932843f82418ebe94

Contents?: true

Size: 1.25 KB

Versions: 15

Compression:

Stored size: 1.25 KB

Contents

class SnippetsExtension < TrustyCms::Extension

  def activate
    if defined?(Radiant::Exporter)
      TrustyCms::Exporter.exportable_models << Snippet
      TrustyCms::Exporter.template_models << Snippet
    end

    Page.class_eval do
      include SnippetTags
    end

    TrustyCms::AdminUI.class_eval do
      attr_accessor :snippet

      alias_method :snippets, :snippet

      def load_default_snippet_regions
        OpenStruct.new.tap do |snippet|
          snippet.edit = TrustyCms::AdminUI::RegionSet.new do |edit|
            edit.main.concat %w{edit_header edit_form}
            edit.form.concat %w{edit_title edit_content edit_filter}
            edit.form_bottom.concat %w{edit_buttons edit_timestamp}
          end
          snippet.index = TrustyCms::AdminUI::RegionSet.new do |index|
            index.top.concat %w{}
            index.thead.concat %w{title_header actions_header}
            index.tbody.concat %w{title_cell actions_cell}
            index.bottom.concat %w{new_button}
          end
          snippet.new = snippet.edit
          snippet.remove = snippet.edit
        end
      end
    end

    admin.snippet ||= TrustyCms::AdminUI.load_default_snippet_regions

    tab 'Design' do
      add_item "Snippets", "/admin/snippets"
    end

  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
trusty-cms-7.0.9.1 vendor/extensions/snippets-extension/snippets_extension.rb
trusty-cms-7.0.11 vendor/extensions/snippets-extension/snippets_extension.rb
trusty-cms-7.0.10 vendor/extensions/snippets-extension/snippets_extension.rb
trusty-cms-7.0.9 vendor/extensions/snippets-extension/snippets_extension.rb
trusty-cms-7.0.8 vendor/extensions/snippets-extension/snippets_extension.rb
trusty-cms-7.0.7 vendor/extensions/snippets-extension/snippets_extension.rb
trusty-cms-7.0.6 vendor/extensions/snippets-extension/snippets_extension.rb
trusty-cms-7.0.5 vendor/extensions/snippets-extension/snippets_extension.rb
trusty-cms-7.0.4 vendor/extensions/snippets-extension/snippets_extension.rb
trusty-cms-7.0.3 vendor/extensions/snippets-extension/snippets_extension.rb
trusty-cms-6.3.1 vendor/extensions/snippets-extension/snippets_extension.rb
trusty-cms-7.0.2 vendor/extensions/snippets-extension/snippets_extension.rb
trusty-cms-7.0.1 vendor/extensions/snippets-extension/snippets_extension.rb
trusty-cms-7.0.0 vendor/extensions/snippets-extension/snippets_extension.rb
trusty-cms-6.3 vendor/extensions/snippets-extension/snippets_extension.rb