Sha256: df8b170a0c27362d007e24e9e115d747bb29e753f22103ef6a84a80874e34a72

Contents?: true

Size: 1.5 KB

Versions: 20

Compression:

Stored size: 1.5 KB

Contents

module Redcar
  module Macros
    class ManagerController
      include Redcar::HtmlController

      def title
        "Macro Manager"
      end
      
      def index
        rhtml = ERB.new(File.read(File.join(File.dirname(__FILE__), "..", "..", "views", "macro_manager.html.erb")))
        rhtml.result(binding)
      end
      
      def assign_name(macro_name)
        Macros.name_macro(macro_name, "Assign a name:")        
        nil
      end
      
      def rename_macro(macro_name)
        Macros.rename_macro(macro_name)
        nil
      end
      
      def delete_macro(macro_name)
        Macros.delete_macro(macro_name)
        nil
      end
      
      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
    end
  end
end

Version data entries

20 entries across 20 versions & 2 rubygems

Version Path
redcar-0.13 plugins/macros/lib/macros/manager_controller.rb
redcar-dev-0.13.5dev plugins/macros/lib/macros/manager_controller.rb
redcar-dev-0.13.4dev plugins/macros/lib/macros/manager_controller.rb
redcar-dev-0.13.3dev plugins/macros/lib/macros/manager_controller.rb
redcar-dev-0.13.2dev plugins/macros/lib/macros/manager_controller.rb
redcar-dev-0.13.1dev plugins/macros/lib/macros/manager_controller.rb
redcar-0.12.1 plugins/macros/lib/macros/manager_controller.rb
redcar-dev-0.13.0dev plugins/macros/lib/macros/manager_controller.rb
redcar-0.12 plugins/macros/lib/macros/manager_controller.rb
redcar-dev-0.12.27dev plugins/macros/lib/macros/manager_controller.rb
redcar-dev-0.12.26dev plugins/macros/lib/macros/manager_controller.rb
redcar-dev-0.12.25dev plugins/macros/lib/macros/manager_controller.rb
redcar-dev-0.12.24dev plugins/macros/lib/macros/manager_controller.rb
redcar-dev-0.12.23dev plugins/macros/lib/macros/manager_controller.rb
redcar-dev-0.12.22dev plugins/macros/lib/macros/manager_controller.rb
redcar-dev-0.12.21dev plugins/macros/lib/macros/manager_controller.rb
redcar-dev-0.12.20dev plugins/macros/lib/macros/manager_controller.rb
redcar-dev-0.12.19dev plugins/macros/lib/macros/manager_controller.rb
redcar-dev-0.12.18dev plugins/macros/lib/macros/manager_controller.rb
redcar-dev-0.12.17dev plugins/macros/lib/macros/manager_controller.rb