Skip to content

Commit fe5b201

Browse files
committed
add form design tool pallet toggle on small devices
1 parent 403d570 commit fe5b201

6 files changed

Lines changed: 393 additions & 308 deletions

File tree

framework/modules/forms/assets/less/designer_bs3.less

Lines changed: 36 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -122,24 +122,43 @@ div#trash.trash {
122122
text-align: center;
123123
}
124124

125-
//attempt to make usable on small devices
126-
@media screen and (max-width: 500px) {
127-
div#trash.trash {
128-
right: 30px;
129-
}
125+
#design_form .checkbox,
126+
#design_form .radio {
127+
padding-left: 1.25em;
128+
}
130129

131-
ul#controls.controls {
132-
max-height: 70%;
133-
right: 2px;
134-
-webkit-overflow-scrolling:touch; /* So iOS Safari gets the inertia & rubber-band effect */
135-
}
130+
// mobiel tool palette
131+
div#palette-button {
132+
top: 72px;
133+
right: 10px;
134+
position: fixed;
135+
z-index: 1030;
136+
}
136137

137-
ul#controls.controls li {
138-
margin-right: 25px;
139-
}
138+
div#palette-button {
139+
display: none;
140140
}
141141

142-
#design_form .checkbox,
143-
#design_form .radio {
144-
padding-left: 1.25em;
145-
}
142+
@media screen and (max-width: 500px) {
143+
ul#controls.controls {
144+
max-height: 70%;
145+
right: 2px;
146+
-webkit-overflow-scrolling:touch; /* So iOS Safari gets the inertia & rubber-band effect */
147+
}
148+
149+
ul#controls.controls li {
150+
margin-right: 25px;
151+
}
152+
153+
div#trash.trash {
154+
right: 70px;
155+
}
156+
157+
div#palette {
158+
display: none;
159+
}
160+
161+
div#palette-button {
162+
display: block;
163+
}
164+
}

framework/modules/forms/views/forms/design_form.bootstrap3.tpl

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,11 @@
8585
{*<a class="{button_style}" href="{$backlink}">{'Done'|gettext}</a>*}
8686
{br}{icon button=true class=reply link=$backlink text='Exit Forms Designer'|gettext}
8787
</p>
88+
<div id="palette-button" class="btn btn-secondary">
89+
Tools
90+
<i class="fas fa-bars bi bi-list"></i>
91+
</div>
92+
<div id="palette">
8893
<div id="trash" class="trash" title="{'Drag a control from the form and drop it on this box to remove it'|gettext}">
8994
<strong>{'Trash Can'|gettext}</strong>{br}
9095
{img class="img-center" src="`$smarty.const.PATH_RELATIVE`framework/modules/recyclebin/assets/images/trashcan_full_large.png"}
@@ -98,6 +103,7 @@
98103
{/foreach}
99104
</ul>
100105
</div>
106+
</div>
101107

102108
{script unique="design-form" jquery="Sortable,bootstrap-dialog" bootstrap="modal,transition"}
103109
{literal}
@@ -141,6 +147,12 @@
141147
});
142148
});
143149

150+
// display tool palette on/off
151+
$('#palette-button').on('click', function(evt) {
152+
evt.preventDefault();
153+
$('#palette').toggle();
154+
});
155+
144156
// we need to catch 'edit' button clicks
145157
$('#fakeform').on('click', '.edit', function(evt) {
146158
evt.preventDefault();

framework/modules/forms/views/forms/design_form.bootstrap5.tpl

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -85,18 +85,24 @@
8585
{*<a class="{button_style}" href="{$backlink}">{'Done'|gettext}</a>*}
8686
{br}{icon button=true class=reply link=$backlink text='Exit Forms Designer'|gettext}
8787
</p>
88-
<div id="trash" class="trash" title="{'Drag a control from the form and drop it on this box to remove it'|gettext}">
89-
<strong>{'Trash Can'|gettext}</strong>{br}
90-
{img class="img-center" src="`$smarty.const.PATH_RELATIVE`framework/modules/recyclebin/assets/images/trashcan_full_large.png"}
88+
<div id="palette-button" class="btn btn-secondary">
89+
Tools
90+
<i class="fas fa-bars bi bi-list"></i>
91+
</div>
92+
<div id="palette">
93+
<div id="trash" class="trash" title="{'Drag a control from the form and drop it on this box to remove it'|gettext}">
94+
<strong>{'Trash Can'|gettext}</strong>{br}
95+
{img class="img-center" src="`$smarty.const.PATH_RELATIVE`framework/modules/recyclebin/assets/images/trashcan_full_large.png"}
96+
</div>
97+
<ul id="controls" class="controls" title="{'Drag a control from this box and drop it on the form to add it to the selected location'|gettext}">
98+
<strong>{'Available Form Controls'|gettext}</strong>
99+
{foreach from=$types key=value item=caption}
100+
<li class="item" type="{$value}"{if $smarty.const.DEVELOPMENT} title="{$value}"{/if}>
101+
{$caption}
102+
</li>
103+
{/foreach}
104+
</ul>
91105
</div>
92-
<ul id="controls" class="controls" title="{'Drag a control from this box and drop it on the form to add it to the selected location'|gettext}">
93-
<strong>{'Available Form Controls'|gettext}</strong>
94-
{foreach from=$types key=value item=caption}
95-
<li class="item" type="{$value}"{if $smarty.const.DEVELOPMENT} title="{$value}"{/if}>
96-
{$caption}
97-
</li>
98-
{/foreach}
99-
</ul>
100106
</div>
101107

102108
{script unique="design-form" jquery="Sortable,bootbox.all" bootstrap="modal"}
@@ -141,6 +147,12 @@
141147
});
142148
});
143149

150+
// display tool palette on/off
151+
$('#palette-button').on('click', function(evt) {
152+
evt.preventDefault();
153+
$('#palette').toggle();
154+
});
155+
144156
// we need to catch 'edit' button clicks
145157
$('#fakeform').on('click', '.edit', function(evt) {
146158
evt.preventDefault();

0 commit comments

Comments
 (0)