module PropertyGrid
Constants
- VERSION
Public Instance Methods
generate_javascript_for_property_groups(grid)
click to toggle source
********************************** Helper functions
# File lib/property_grid.rb, line 136 def generate_javascript_for_property_groups(grid) javascript = '' grid.groups.each_with_index do |grp, index| javascript << get_javascript_for_group(index) end javascript end
get_javascript_for_group(index)
click to toggle source
# File lib/property_grid.rb, line 146 def get_javascript_for_group(index) js = %Q| $(".expandableGroup[idx]").click(function() { var hidden = $(".property_group[idx]").is(":hidden"); // get the value BEFORE making the slideToggle call. $(".property_group[idx]").slideToggle('slow'); // At this point, $(".property_group0").is(":hidden"); // ALWAYS RETURNS FALSE if (!hidden) // Remember, this is state that the div WAS in. { $(".expandableGroup[idx]").removeClass('expanded'); $(".expandableGroup[idx]").addClass('collapsed'); } else { $(".expandableGroup[idx]").removeClass('collapsed'); $(".expandableGroup[idx]").addClass('expanded'); } }); |.gsub('[idx]', index.to_s) js end
group(name)
click to toggle source
# File lib/property_grid.rb, line 119 def group(name) group = PropertyGridGroup.new group.name = name @__property_grid.groups << group group end
group_property(name, var, type = :string, collection = nil)
click to toggle source
# File lib/property_grid.rb, line 127 def group_property(name, var, type = :string, collection = nil) group_property = GroupProperty.new(var, name, type, collection) @__property_grid.groups.last.properties << group_property group_property end
new_property_grid(name = nil)
click to toggle source
********************************** DSL functions
# File lib/property_grid.rb, line 113 def new_property_grid(name = nil) @__property_grid = APropertyGrid.new @__property_grid end