#A hash of arrays:
widget[]=first-widget&gadget[]=a-gadget&widget[]=another%20widget
Resulting Params:
{
:widget => [ "first-widget", "another widget"],
:gadget => [ "a-gadget" ]
}
#As coded this is suiteable for adding to ApplicationController, or an included controller module | |
#It would also be cool to refactor this code to be added to fat models instead | |
def object_graph | |
@prune_nodes = params[:prune_nodes] #When the crawler hits a node of this class, it will stop | |
model_name = controller_name.classify | |
root_object = model_name.classify.constantize.find(params[:id]) | |
edge_list = {} #This is implemented as an object instead of an array for lookup performance reasons | |
nodes = {} | |
object_ident = ->(object){"#{object.id}-#{object.class}"} #helper function | |
fill_object_data = ->(object, ident) do #add some data to the JSON object that will be used by the renderer |
#A hash of arrays:
widget[]=first-widget&gadget[]=a-gadget&widget[]=another%20widget
Resulting Params:
{
:widget => [ "first-widget", "another widget"],
:gadget => [ "a-gadget" ]
}
# Is there a coffeescript way of doing this? | |
(function($, exports){ | |
# doing random stuff here | |
})(jQuery, window); | |
# Other than this: | |
( ($, exports) -> | |
# doing random stuff here |
/* | |
* update the events rendering in the calendar. Add if does not yet exist. | |
*/ | |
_updateEventInCalendar : function (calEvent) { | |
var self = this; | |
self._cleanEvent(calEvent); | |
if (calEvent.id) { | |
self.element.find(".wc-cal-event").each(function() { |