Skip to content

Commit

Permalink
Fixes #12418 - Correct dashboard behaviour for updated gridster
Browse files Browse the repository at this point in the history
Updated version of gridster changed the widget class from gs_w to gs-w:
ducksboard/gridster.js@c1668d9
This led to a bit of breakage in css and js which is fixed by this commit.
There was also a change in the way the total width of the gridster
element was calculated that required a change to the initialization.
  • Loading branch information
tbrisker authored and Dominic Cleal committed Nov 12, 2015
1 parent b2a959e commit e75ad04
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
6 changes: 3 additions & 3 deletions app/assets/javascripts/dashboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ function auto_refresh(){
function start_gridster(){
var gridster = $(".gridster>ul").gridster({
widget_margins: [10, 10],
widget_base_dimensions: [82, 340],
widget_base_dimensions: [75, 340],
max_size_x: 12,
min_cols: 12,
max_cols: 12,
Expand All @@ -37,7 +37,7 @@ function start_gridster(){

function hide_widget(item){
var gridster = $(".gridster>ul").gridster().data('gridster');
var widget = $(item).parents('li.gs_w');
var widget = $(item).parents('li.gs-w');

widget.attr('data-hide', 'true').hide();
gridster.remove_widget(widget);
Expand All @@ -46,7 +46,7 @@ function hide_widget(item){
}

function remove_widget(item){
var widget = $(item).parents('li.gs_w');
var widget = $(item).parents('li.gs-w');
var gridster = $(".gridster>ul").gridster().data('gridster');
if (confirm(__("Are you sure you want to delete this widget from your dashboard?"))){
$.ajax({
Expand Down
3 changes: 2 additions & 1 deletion app/assets/stylesheets/gridster.scss
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ $row-margin: 10px;
.gridster ul{
padding-left: 0;
list-style: none;
max-width: 100%;
}

$col-margin-left: 15px;
Expand Down Expand Up @@ -109,7 +110,7 @@ $col-margin-fallback: 1.5%;
}
}

.gs_w {
.gs-w {
padding: 19px;
margin-bottom: 10px;
border: 1px solid #e3e3e3;
Expand Down
2 changes: 1 addition & 1 deletion bundler.d/assets.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
# https://github.com/nubis/gettext_i18n_rails_js/pull/23
gem 'gettext', '~> 3.1', :require => false
gem 'multi-select-rails', '~> 0.9'
gem 'gridster-rails', '~> 0.1'
gem 'gridster-rails', '~> 0.5'
gem 'jquery_pwstrength_bootstrap', '~> 1.2'
gem 'jquery-turbolinks', '~> 2.1'
gem 'select2-rails', '~> 3.5'
Expand Down

0 comments on commit e75ad04

Please sign in to comment.