Skip to content

Instantly share code, notes, and snippets.

@mmarum-sugarcrm
Last active August 29, 2015 14:20
Show Gist options
  • Save mmarum-sugarcrm/c2981f4d5e7d25dfbbed to your computer and use it in GitHub Desktop.
Save mmarum-sugarcrm/c2981f4d5e7d25dfbbed to your computer and use it in GitHub Desktop.
MyAppAction footer extension (tested on Sugar 7.5, 7.6)
<?php
// Append new View to Footer layout's list of components
$viewdefs['base']['layout']['footer']['components'][] = array (
'view' => 'my-app-action',
);
{{!
Define HTML for our new button. We will mimic the style of other buttons
in the footer so we remain consistent.
}}
<button data-action="chat" class="btn btn-invisible" aria-label="{{str "Chat"}}" role="link" type="button">
<i class="fa fa-comments icon-comments"></i><span class="action-label"> {{str "Chat"}}</span>
</button>
({
events: {
//On click of our "button" element
'click [data-action=chat]': 'chat'
},
// tagName attribute is inherited from Backbone.js.
// We set it to "span" instead of default "div" so that our "button" element is displayed inline.
tagName: "span",
chat: function(){
// Use Sugar 7 API to pop one of our standard alert message boxes.
app.alert.show('myapp-chat-alert', {
level: 'info',
messages: 'Send a chat message!',
autoClose: true
});
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment