Class: Redcar::Macros::ManagerController

Inherits:
Object
  • Object
show all
Includes:
HtmlController
Defined in:
plugins/macros/lib/macros/manager_controller.rb

Constant Summary

Constant Summary

Constants included from Observable

Observable::ASPECTS

Instance Method Summary (collapse)

Methods included from HtmlController

#ask_before_closing, #close, #execute, #javascript_controller_actions, #reload_index

Methods included from Observable

#add_listener, #notify_listeners, #remove_listener

Instance Method Details

- (Object) assign_name(macro_name)



16
17
18
19
# File 'plugins/macros/lib/macros/manager_controller.rb', line 16

def assign_name(macro_name)
  Macros.name_macro(macro_name, "Assign a name:")        
  nil
end

- (Object) delete_macro(macro_name)



26
27
28
29
# File 'plugins/macros/lib/macros/manager_controller.rb', line 26

def delete_macro(macro_name)
  Macros.delete_macro(macro_name)
  nil
end

- (Object) index



11
12
13
14
# File 'plugins/macros/lib/macros/manager_controller.rb', line 11

def index
  rhtml = ERB.new(File.read(File.join(File.dirname(__FILE__), "..", "..", "views", "macro_manager.html.erb")))
  rhtml.result(binding)
end

- (Object) macro_steps(macro)



31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# File 'plugins/macros/lib/macros/manager_controller.rb', line 31

def macro_steps(macro)
  html = ""
  html << <<-HTML
  <tr style="display: none;" class="macro-actions">
    <td colspan="4">
      <table>
  HTML

  macro.actions.each do |action|
    case action
    when Fixnum
      a = " "
      a[0] = action
      s = "Insert: #{a.inspect}"
    when Symbol
      s = "Navigation: #{action}"
    when DocumentCommand
      s = "Command: #{action.inspect.gsub("<", "&lt;").gsub(">", "&gt;")}"
    else
      raise "don't know what kind of action #{action.inspect} is"
    end
    html << <<-HTML
      <tr><td>#{s}</td></tr>
    HTML
  end
  
  html << <<-HTML
      </table>
    </td>
  </tr>
  HTML
  
  html
end

- (Object) rename_macro(macro_name)



21
22
23
24
# File 'plugins/macros/lib/macros/manager_controller.rb', line 21

def rename_macro(macro_name)
  Macros.rename_macro(macro_name)
  nil
end

- (Object) title



7
8
9
# File 'plugins/macros/lib/macros/manager_controller.rb', line 7

def title
  "Macro Manager"
end