Skip to content

Instantly share code, notes, and snippets.

@thinkjson
Forked from anonymous/reportdesigner plugin
Created September 20, 2011 20:12
Show Gist options
  • Select an option

  • Save thinkjson/1230185 to your computer and use it in GitHub Desktop.

Select an option

Save thinkjson/1230185 to your computer and use it in GitHub Desktop.
var ReportDesigner = Backbone.View.extend({
initialize: function(args) {
this.workspace = args.workspace;
// Create a unique ID for use as the CSS selector
this.id = _.uniqueId("report_");
$(this.el).attr({ id: this.id });
this.add_button();
this.workspace.toolbar.report = this.show;
[...]
},
add_button: function() {
var $chart_button =
$('<a href="#report" class="report button disabled_toolbar i18n" title="Report Designer"></a>')
.css({ 'background':
"url('js/querybuilder/plugins/ReportDesigner/report.png') 50% 50% no-repeat" });
var $report_li = $('<li class="seperator"></li>').append($chart_button);
$(this.workspace.toolbar.el).find("ul").append($report_li);
},
[...]
/**
* init the reportdesigner plugin
*/
(function() {
alert("hello reportdesigner");
function new_workspace(args) {
args.workspace.report = new ReportDesigner({ workspace: args.workspace });
}
for(var i = 0; i < Application.tabs._tabs.length; i++) {
var tab = Application.tabs._tabs[i];
new_workspace({
workspace: tab.content
});
};
Application.session.bind("workspace:new", new_workspace);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment