Skip to content

Commit

Permalink
Transfering all the json in one point
Browse files Browse the repository at this point in the history
  • Loading branch information
mistercrunch committed Feb 29, 2016
1 parent bd06f99 commit 22327e2
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
9 changes: 4 additions & 5 deletions panoramix/assets/javascripts/dashboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ require('../node_modules/gridster/dist/jquery.gridster.min.js');
var dashboard;

var Dashboard = function(obj){
obj['slices'] = [];
//obj['slices'] = [];
obj['filters'] = {};
obj['addFilter'] = function(slice_id, filters) {
this.filters[slice_id] = filters;
Expand All @@ -41,16 +41,15 @@ var Dashboard = function(obj){
return this.slices[i];
}
}

$('.dashboard li.widget').each(function() {
var data = $(this).data('slice');
obj.slices.forEach(function(data, i){
var slice = px.Slice(data, obj);
$(this).find('a.refresh').click(function(){
$("#slice_" + data.slice_id).find('a.refresh').click(function(){
slice.render();
});
obj.slices.push(slice);
slice.render();
});

dashboard = obj;
return obj;
}
Expand Down
6 changes: 4 additions & 2 deletions panoramix/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,12 +219,14 @@ def css_files(self):

@property
def json_data(self):
return json.dumps({
d = {
'id': self.id,
'metadata': self.metadata_dejson,
'dashboard_title': self.dashboard_title,
'slug': self.slug,
})
'slices': [slc.data for slc in self.slices],
}
return json.dumps(d)


class Queryable(object):
Expand Down
1 change: 0 additions & 1 deletion panoramix/templates/panoramix/dashboard.html
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ <h2>
id="slice_{{ slice.id }}"
slice_id="{{ slice.id }}"
class="widget {{ slice.viz.viz_type }}"
data-slice="{{ slice.json_data }}"
data-row="{{ pos.row or 1 }}"
data-col="{{ pos.col or loop.index }}"
data-sizex="{{ pos.size_x or 4 }}"
Expand Down

0 comments on commit 22327e2

Please sign in to comment.