Skip to content

Commit d11eaba

Browse files
committed
placeholder_text option
1 parent aff5ce5 commit d11eaba

8 files changed

+22
-16
lines changed

README.md

+2
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,7 @@ $(function () {
141141
- `item_class` - widget class (default: `'grid-stack-item'`)
142142
- `min_width` - minimal width. If window width is less, grid will be shown in one-column mode. You need also update your css file (`@media (max-width: 768px) {...}`) with corresponding value (default: `768`)
143143
- `placeholder_class` - class for placeholder (default: `'grid-stack-placeholder'`)
144+
- `placeholder_text` - placeholder default content (default: `''`)
144145
- `resizable` - allows to override jQuery UI resizable options. (default: `{autoHide: true, handles: 'se'}`)
145146
- `static_grid` - makes grid static (default `false`). If true widgets are not movable/resizable. You don't even need jQueryUI draggable/resizable. A CSS class `grid-stack-static` is also added to the container.
146147
- `vertical_margin` - vertical gap size (default: `20`)
@@ -735,6 +736,7 @@ Changes
735736
- add `static_grid` option.
736737
- add `min_width`/`min_height` methods (Thanks to @cvillemure)
737738
- add `destroy` method (Thanks to @zspitzer)
739+
- add `placeholder_text` option (Thanks to @slauyama)
738740

739741
#### v0.2.3 (2015-06-23)
740742

dist/gridstack.css

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
bottom: 0;
1717
width: auto;
1818
z-index: 0 !important;
19+
text-align: center;
1920
}
2021

2122
.grid-stack > .grid-stack-item {

dist/gridstack.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -400,6 +400,7 @@
400400
height: parseInt(this.container.attr('data-gs-height')) || 0,
401401
item_class: 'grid-stack-item',
402402
placeholder_class: 'grid-stack-placeholder',
403+
placeholder_text: '',
403404
handle: '.grid-stack-item-content',
404405
handle_class: null,
405406
cell_height: 60,
@@ -470,7 +471,7 @@
470471

471472
this.placeholder = $(
472473
'<div class="' + this.opts.placeholder_class + ' ' + this.opts.item_class + '">' +
473-
'<div class="placeholder-content" /></div>').hide();
474+
'<div class="placeholder-content">' + this.opts.placeholder_text + '</div></div>').hide();
474475

475476
this.container.height(
476477
this.grid.get_grid_height() * (this.opts.cell_height + this.opts.vertical_margin) -

dist/gridstack.min.css

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/gridstack.min.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/gridstack.min.map

+1-1
Large diffs are not rendered by default.

src/gridstack.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -400,6 +400,7 @@
400400
height: parseInt(this.container.attr('data-gs-height')) || 0,
401401
item_class: 'grid-stack-item',
402402
placeholder_class: 'grid-stack-placeholder',
403+
placeholder_text: '',
403404
handle: '.grid-stack-item-content',
404405
handle_class: null,
405406
cell_height: 60,
@@ -470,7 +471,7 @@
470471

471472
this.placeholder = $(
472473
'<div class="' + this.opts.placeholder_class + ' ' + this.opts.item_class + '">' +
473-
'<div class="placeholder-content" /></div>').hide();
474+
'<div class="placeholder-content">' + this.opts.placeholder_text + '</div></div>').hide();
474475

475476
this.container.height(
476477
this.grid.get_grid_height() * (this.opts.cell_height + this.opts.vertical_margin) -

src/gridstack.scss

+12-11
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ $animation_speed: .3s !default;
2626
bottom: 0;
2727
width: auto;
2828
z-index: 0 !important;
29+
text-align: center;
2930
}
3031

3132
> .grid-stack-item {
@@ -53,21 +54,21 @@ $animation_speed: .3s !default;
5354
-ms-touch-action: none;
5455
touch-action: none;
5556
}
56-
57+
5758
&.ui-resizable-disabled > .ui-resizable-handle,
5859
&.ui-resizable-autohide > .ui-resizable-handle { display: none; }
59-
60+
6061
&.ui-draggable-dragging,
6162
&.ui-resizable-resizing {
6263
z-index: 100;
63-
64+
6465
> .grid-stack-item-content,
6566
> .grid-stack-item-content {
6667
box-shadow: 1px 4px 6px rgba(0, 0, 0, 0.2);
6768
opacity: 0.8;
6869
}
6970
}
70-
71+
7172
> .ui-resizable-se,
7273
> .ui-resizable-sw {
7374
text-align: right;
@@ -81,15 +82,15 @@ $animation_speed: .3s !default;
8182
text-rendering: auto;
8283
-webkit-font-smoothing: antialiased;
8384
-moz-osx-font-smoothing: grayscale;
84-
85+
8586
&::before { content: "\f065"; }
8687
}
87-
88+
8889
> .ui-resizable-se {
8990
display: inline-block;
9091
@include vendor(transform, rotate(90deg));
9192
}
92-
93+
9394
> .ui-resizable-nw { cursor: nw-resize; width: 20px; height: 20px; left: 10px; top: 0; }
9495
> .ui-resizable-n { cursor: n-resize; height: 10px; top: 0; left: 25px; right: 25px; }
9596
> .ui-resizable-ne { cursor: ne-resize; width: 20px; height: 20px; right: 10px; top: 0; }
@@ -98,16 +99,16 @@ $animation_speed: .3s !default;
9899
> .ui-resizable-s { cursor: s-resize; height: 10px; left: 25px; bottom: 0; right: 25px; }
99100
> .ui-resizable-sw { cursor: sw-resize; width: 20px; height: 20px; left: 10px; bottom: 0; }
100101
> .ui-resizable-w { cursor: w-resize; width: 10px; left: $horizontal_padding / 2; top: 15px; bottom: 15px; }
101-
102+
102103
@for $i from 1 through $gridstack-columns {
103104
&[data-gs-width='#{$i}'] { width: (100% / $gridstack-columns) * $i; }
104105
&[data-gs-x='#{$i}'] { left: (100% / $gridstack-columns) * $i; }
105106
&[data-gs-min-width='#{$i}'] { min-width: (100% / $gridstack-columns) * $i; }
106107
&[data-gs-max-width='#{$i}'] { max-width: (100% / $gridstack-columns) * $i; }
107108
}
108109
}
109-
110-
&.grid-stack-animate,
110+
111+
&.grid-stack-animate,
111112
&.grid-stack-animate .grid-stack-item {
112113
@include vendor(transition, left $animation_speed, top $animation_speed, height $animation_speed, width $animation_speed);
113114
}
@@ -134,7 +135,7 @@ $animation_speed: .3s !default;
134135
left: 0 !important;
135136
top: auto !important;
136137
margin-bottom: $vertical_padding;
137-
138+
138139
.ui-resizable-handle { display: none; }
139140
}
140141

0 commit comments

Comments
 (0)