Commit b823997e authored by azul's avatar azul

cleanup: unused ui helpers

parent 78b58ef1
module Common::Ui::ColorPickerHelper
def include_color_picker
return if @color_picker_included
@color_picker_included = true
content_for :html_head do
output = []
output << javascript_include_tag('colorpicker/yahoo.color.js')
output << javascript_include_tag('colorpicker/colorpicker.js')
output << stylesheet_link_tag('colorpicker/colorpicker.css')
output * "\n"
end
end
def color_picker_tag(input_id, wait_for_dom = true)
# TODO: add {swatch: button} option
include_color_picker
colorpicker_code = %[new Control.ColorPicker("#{input_id}", { IMAGE_BASE : "/images/colorpicker/" })]
if wait_for_dom
javascript_tag(%[document.observe('dom:loaded', function() {
#{colorpicker_code}});])
else
javascript_tag(colorpicker_code)
end
end
end
#
# Helper methods for drawing the top navigation menus
#
# Available to all views
#
module Common::Ui::MenuHelper
def split_entities_into_columns(entities)
entities.sort! { |a, b| a.name <=> b.name }
cols = {}
if entities.size > 3
half = entities.size / 2.round
cols[:right_col] = entities.slice!(-half, half)
cols[:left_col] = entities
else
cols[:left_col] = entities
cols[:right_col] = []
end
cols
end
end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment