Skip to content

Instantly share code, notes, and snippets.

@elchele
elchele / subpanels.js
Last active August 29, 2015 14:06
Subpanel layout controller to hide empty subpanels
({
/* Author: Angel Magaña -- cheleguanaco@cheleguanaco.com
* File: ./custom/clients/base/layouts/subpanels/subpanels.js
*
* Extended subpanels layout controller for hiding
* subpanels without data upon parent record load (Sugar 7.2+)
*
* This customization applies to all modules
*/
@elchele
elchele / es_test.php
Last active July 5, 2016 17:56
PHP script for simple querying of Elasticsearch using Sugar default server settings
<?php
/* Author: Angel Magaña - cheleguanaco@cheleguanaco.com
* File: <sugar_root>/es_test.php
*
* Executes simple Elasticsearch query using
* Elasticsearch params from Sugar config files
* Usage: http://<sugar_url>/es_test.php?term=<your_search_term>
*
*/
@elchele
elchele / subpanel-list.js
Created August 20, 2014 21:20
Custom controller for suppressing "edit" button functionality on Calls subpanel
({
/* Author: Angel Magaña -- cheleguanaco@cheleguanaco.com
* File: ./custom/clients/base/views/subpanel-list/subpanel-list.js
*
* Extended Subpanel List controller to suppress "Edit" functionality
* on "Calls" subpanel throughout Sugar (Sugar 7.2+)
*
*/
extendsFrom: 'SubpanelListView',
({
/* Author: Angel Magaña -- cheleguanaco@cheleguanaco.com
* File: ./custom/modules/Contacts/clients/base/views/record/record.js
*
* Extended RecordView controller for applying custom
* RecordView metadata at initialize time (Sugar 7.2+)
*
*/
extendsFrom: 'RecordView',
@elchele
elchele / (pre-7.2) sidebartoggle.js
Last active August 29, 2015 14:00
Hiding the Sugar 7 intelligence pane by default
({
/* **** PRE-7.2 ONLY ****
place in /custom/modules/<Module>/clients/base/fields/sidebartoggle/ for module specific
place in /custom/clients/base/fields/sidebartoggle/ for global context */
extendsFrom: 'sidebartoggle',
/* Override existing _render method and call default toggle() method to mimic click of button to hide
the sidebar/intelligence pane */
_render: function() {
@elchele
elchele / UserRoles.js
Last active June 20, 2016 15:57
Sidecar: Retrieving User Roles
/* Author: Angel Magaña - cheleguanaco@cheleguanaco.com
*
* This Gist can be used within a Sugar 7 Controller to retrieve a user's
* security Roles
*
*/
/* To retrieve the Roles, we create a User object then
* retrieve the User's related Role records via the default Users <--> Roles relationship
*/