Module: Pakyow::Presenter::Renderer::Behavior::InsertPrototypeBar Private

Extended by:
Support::Extension
Defined in:
lib/pakyow/presenter/renderer/behavior/insert_prototype_bar.rb

This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.

Class Method Summary collapse

Class Method Details

.ui_modes_html(view, current_modes) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
# File 'lib/pakyow/presenter/renderer/behavior/insert_prototype_bar.rb', line 72

def self.ui_modes_html(view, current_modes)
  current_modes = current_modes.map(&:to_sym)

  modes = view.object.each_significant_node(:mode).map { |node|
    node.label(:mode)
  }

  modes.unshift(
    (view.info(:mode) || :default).to_sym
  ).uniq!

  options = modes.map { |each_mode|
    selected = if current_modes.include?(each_mode)
      " selected=\"selected\""
    else
      ""
    end

    nice_mode = Support.inflector.humanize(Support.inflector.underscore(each_mode))
    "<option value=\"#{each_mode}\"#{selected}>#{nice_mode}</option>"
  }.join

  "    UI Mode: <select onchange=\"document.location = window.location.pathname + '?modes[]=' + this.value \" style=\"-webkit-appearance: none; -moz-appearance: none; -ms-appearance: none; -o-appearance: none; appearance: none; font-size: 11px; font-weight: 500; line-height: 20px; background: none; border: none; color: #fff; outline: none; margin: 0; margin-left: 5px;\">\n      \#{options}\n    </select>\n  HTML\nend\n"