Module: Taggable::AdminUI

Defined in:
lib/taggable/admin_ui.rb

Class Method Summary collapse

Class Method Details

.included(base) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/taggable/admin_ui.rb', line 4

def self.included(base)
 base.class_eval do

    attr_accessor :tag
    alias_method :tags, :tag

    def load_taggable_regions
      @tag = load_default_tag_regions
    end

    protected

      def load_default_tag_regions
        OpenStruct.new.tap do |tag|
          tag.edit = Radiant::AdminUI::RegionSet.new do |edit|
            edit.main.concat %w{edit_header edit_form}
            edit.form.concat %w{edit_name edit_role edit_description}
            edit.form_bottom.concat %w{edit_timestamp edit_buttons}
          end
          tag.show = Radiant::AdminUI::RegionSet.new do |show|
            show.main.concat %w{show_header show_pages show_assets}
          end
          tag.index = Radiant::AdminUI::RegionSet.new do |index|
            index.thead.concat %w{title_header link_header description_header usage_header modify_header}
            index.tbody.concat %w{title_cell link_cell description_cell usage_cell modify_cell}
            index.bottom.concat %w{new_button}
          end
          tag.remove = tag.index
          tag.new = tag.edit
        end
      end
    
  end
end