From a29bc8846fac5d7bcbe37ed306eb612bfc74acee Mon Sep 17 00:00:00 2001 From: Dave Lawrence Date: Thu, 3 Jan 2013 14:41:44 -0500 Subject: More MyDashboard work --- extensions/MyDashboard/web/js/query.js | 43 ++++++++++++++++++++++++++++------ 1 file changed, 36 insertions(+), 7 deletions(-) (limited to 'extensions/MyDashboard/web/js/query.js') diff --git a/extensions/MyDashboard/web/js/query.js b/extensions/MyDashboard/web/js/query.js index 746717e75..865d255a6 100644 --- a/extensions/MyDashboard/web/js/query.js +++ b/extensions/MyDashboard/web/js/query.js @@ -9,9 +9,17 @@ // Main query code YUI({ base: 'js/yui3/', - combine: false + combine: false, + groups: { + gallery: { + combine: false, + base: 'js/yui3/', + patterns: { 'gallery-': {} } + } + } }).use("node", "datatable", "datatable-sort", "datatable-message", "json-stringify", - "datatable-datasource", "datasource-io", "datasource-jsonschema", "cookie", function (Y) { + "datatable-datasource", "datasource-io", "datasource-jsonschema", "cookie", + "gallery-datatable-row-expansion-bmo", "handlebars", function (Y) { var counter = 0, dataSource = null, dataTable = null, @@ -83,7 +91,8 @@ YUI({ dataSource.plug(Y.Plugin.DataSourceJSONSchema, { schema: { resultListLocator: "result.result.bugs", - resultFields: ["bug_id", "changeddate", "bug_status", "short_desc"], + resultFields: ["bug_id", "changeddate", "bug_status", + "short_desc", "last_changes"], metaFields: { description: "result.result.description", heading: "result.result.heading", @@ -94,14 +103,34 @@ YUI({ dataTable = new Y.DataTable({ columns: [ - { key:"bug_id", label:"Bug", sortable:true, + { key: Y.Plugin.DataTableRowExpansion.column_key, label: ' ' }, + { key: "bug_id", label: "Bug", sortable: true, formatter: '{value}', allowHTML: true }, - { key:"changeddate", label:"Updated", sortable:true }, - { key:"bug_status", label:"Status", sortable:true }, - { key:"short_desc", label:"Summary", sortable:true }, + { key: "changeddate", label: "Updated", sortable: true }, + { key: "bug_status", label: "Status", sortable: true }, + { key: "short_desc", label: "Summary", sortable: true }, ], }); + var last_changes_source = Y.one('#last-changes-template').getHTML(), + last_changes_template = Y.Handlebars.compile(last_changes_source); + + dataTable.plug(Y.Plugin.DataTableRowExpansion, { + uniqueIdKey: 'bug_id', + template: function(data) { + var last_changes = {}; + if (data.last_changes.email) { + last_changes = { + activity: data.last_changes.activity, + email: data.last_changes.email, + when: data.last_changes.when, + comment: data.last_changes.comment, + }; + } + return last_changes_template(last_changes); + } + }); + dataTable.plug(Y.Plugin.DataTableSort); dataTable.plug(Y.Plugin.DataTableDataSource, { -- cgit v1.2.3-24-g4f1b