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