Skip to content

Instantly share code, notes, and snippets.

View gundisalwa's full-sized avatar

Gonçalo Neto gundisalwa

  • Lisboa, Portugal
View GitHub Profile
@gundisalwa
gundisalwa / poll.js
Last active August 29, 2015 14:17
Mock for a CDE dashboard watcher
function isEditorActive(){
return document.hasFocus();
}
function getActiveDashboardStateId (){
// Returns an identifier for the current saved state of the dashboard.
}
function getSavedDashboardStateId( ){
return $.ajax('dashboard_state_endpoint_url');
/* jshint devel:true */
// Main wrapper
//window.componentTest = ( function ( Backbone , _ , Mustache , Base , $ ) {
// BaseBone: returns Base.js modification that includes Backbone.Events.
// Also has several static helpers to augment constructors with .extend
// and events functionality.
@gundisalwa
gundisalwa / README.md
Last active August 29, 2015 14:07
Local UI Blockers for CDF

Local UI Blockers for CDF

Description

This proto-module adds the possibility of blocking certain UI regions from the user, by adding an overlay and a spinning wheel on top of them. It allows several blockers to be registered and maintains separate counters for each of them.

Dependencies

  • jQuery
  • jQueryUI (particularly blockUI)
  • Underscore
  • Dashboards object
@gundisalwa
gundisalwa / README.md
Last active August 29, 2015 14:07
Unmanaged Query Component (CDF)

Unmanaged Query Component

Description

Adds a simple version of a query component but that runs asynchronously, extending the base asynchronous component class for CDF, Unmanaged Component.

Instalation

  • Create a folder inside JCR on /public/cde/components (I suggest naming the folder UnmanagedQueryComponent).
@gundisalwa
gundisalwa / dynamicColTypeAddIn.js
Created June 22, 2014 15:08
Dynamic Coltype addIn
/*
* Dynamic colType (AddIn)
*
* This addIn allows a control of the addIn called on a cell basis, rather than on a
* column basis only.
*
* Options:
* - colType: 'formattedText' by default. This can be controlled by passing a state
* dependant function to the registered addIn options.
* - compName: atm the addIn needs to have access to the component where the options
@gundisalwa
gundisalwa / cccChartAddIn.js
Last active August 29, 2015 14:02
cccChart addIn
/*
* CCC Chart (AddIn)
*
* This addIn allows you to render a generic ccc chart inside the addIn container.
*
* Options:
* - type: the chartType, which is expected to be a registered ccc type.
* - chartOpts: the object of options passed to the chart constructor. Charts are created
* by doing: var chart = new pvc[type](chartOpts).
* - getData: function that transforms the container values in a forma that can be
@gundisalwa
gundisalwa / liquidDataBarAddIn.js
Last active August 29, 2015 14:02
Liquid dataBar addIn - SVG only
/*
* Liquid Data Bar (AddIn)
*
* This modified dataBar addIn will calculate the widths of the bar as percentage based,
* and will inherently adapt to the container's size, fixing any issues with table while
* rendering, a common problem with dataBar, and also adapting to viewport/container resize
* in the process.
*
* Options:
* - The same as dataBar, with width now accepting a css-like string (see Raphael docs)