binda 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +3 -3
- data/app/assets/javascripts/binda/components/{form_item_choice.js → field_setting_choices.js} +13 -12
- data/app/assets/javascripts/binda/components/form_item_repeater.js +34 -30
- data/app/assets/javascripts/binda/components/login_form.js +15 -15
- data/app/assets/javascripts/binda/components/sortable.js +22 -20
- data/app/assets/javascripts/binda/dist/binda.bundle.js +154 -140
- data/app/assets/javascripts/binda/index.js +20 -20
- data/app/assets/stylesheets/binda/components/field_setting_choices.scss +90 -0
- data/app/assets/stylesheets/binda/components/form_item.scss +0 -50
- data/app/assets/stylesheets/binda/components/{form_item_choice.scss → form_item_choices.scss} +1 -7
- data/app/assets/stylesheets/binda/components/main_sortable_table.scss +68 -0
- data/app/assets/stylesheets/binda/components/main_table.scss +2 -5
- data/app/assets/stylesheets/binda/components/sortable.scss +1 -2
- data/app/assets/stylesheets/binda/components/standard-form.scss +5 -6
- data/app/assets/stylesheets/binda/index.scss +3 -1
- data/app/controllers/binda/field_groups_controller.rb +22 -75
- data/app/controllers/binda/manage/users_controller.rb +18 -13
- data/app/controllers/binda/structures_controller.rb +12 -11
- data/app/models/binda/choice.rb +10 -5
- data/app/models/binda/field_setting.rb +16 -6
- data/app/models/concerns/binda/fieldable_associations.rb +24 -12
- data/app/views/binda/components/sort_index.html.erb +21 -25
- data/app/views/binda/field_groups/_form_body.html.erb +5 -5
- data/app/views/binda/field_groups/_form_item_choice.erb +49 -66
- data/app/views/binda/structures/_form_section.html.erb +1 -1
- data/app/views/binda/structures/index.html.erb +2 -2
- data/app/views/binda/structures/sort_index.html.erb +28 -21
- data/config/locales/en.yml +7 -5
- data/lib/binda/version.rb +1 -1
- metadata +6 -4
@@ -195,6 +195,95 @@ function setupSelect2(target) {
|
|
195
195
|
/* 4 */
|
196
196
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
197
197
|
|
198
|
+
"use strict";
|
199
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _FieldSettingChoices; });
|
200
|
+
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__form_item_editor__ = __webpack_require__(0);
|
201
|
+
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
202
|
+
|
203
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
204
|
+
|
205
|
+
/**
|
206
|
+
* FORM ITEM CHOICE
|
207
|
+
*/
|
208
|
+
|
209
|
+
|
210
|
+
|
211
|
+
var FieldSettingChoices = function () {
|
212
|
+
function FieldSettingChoices() {
|
213
|
+
_classCallCheck(this, FieldSettingChoices);
|
214
|
+
|
215
|
+
this.target = '.field-setting-choices--choice';
|
216
|
+
}
|
217
|
+
|
218
|
+
_createClass(FieldSettingChoices, [{
|
219
|
+
key: 'isSet',
|
220
|
+
value: function isSet() {
|
221
|
+
if ($(this.target).length > 0) {
|
222
|
+
return true;
|
223
|
+
} else {
|
224
|
+
return false;
|
225
|
+
}
|
226
|
+
}
|
227
|
+
}, {
|
228
|
+
key: 'setEvents',
|
229
|
+
value: function setEvents() {
|
230
|
+
$(document).on('click', '.field-setting-choices--add-choice', addChoice);
|
231
|
+
|
232
|
+
$(document).on('click', '.field-setting-choices--delete-choice', deleteChoice);
|
233
|
+
$(document).on('click', '.field-setting-choices--js-delete-choice', function (event) {
|
234
|
+
event.preventDefault();
|
235
|
+
$(this).closest('.field-setting-choices--choice').remove();
|
236
|
+
// Update form item editor size
|
237
|
+
__WEBPACK_IMPORTED_MODULE_0__form_item_editor__["a" /* _FormItemEditor */].resize();
|
238
|
+
});
|
239
|
+
}
|
240
|
+
}]);
|
241
|
+
|
242
|
+
return FieldSettingChoices;
|
243
|
+
}();
|
244
|
+
|
245
|
+
var _FieldSettingChoices = new FieldSettingChoices();
|
246
|
+
|
247
|
+
/**
|
248
|
+
* HELPER FUNCTIONS
|
249
|
+
*/
|
250
|
+
|
251
|
+
function addChoice(event) {
|
252
|
+
event.preventDefault();
|
253
|
+
// Clone the new choice field
|
254
|
+
var choices_id = $(this).data('choices-id');
|
255
|
+
var choices = $('#' + choices_id);
|
256
|
+
var newchoice = choices.find('.field-setting-choices--new-choice');
|
257
|
+
var clone = newchoice.clone().removeClass('field-setting-choices--new-choice').toggle();
|
258
|
+
clone.find('.field-setting-choices--toggle-choice').toggle();
|
259
|
+
// Append the clone right after
|
260
|
+
choices.prepend(clone);
|
261
|
+
// Update form item editor size
|
262
|
+
__WEBPACK_IMPORTED_MODULE_0__form_item_editor__["a" /* _FormItemEditor */].resize();
|
263
|
+
}
|
264
|
+
|
265
|
+
function deleteChoice(event) {
|
266
|
+
event.preventDefault();
|
267
|
+
|
268
|
+
var choice = $(this).closest('.field-setting-choices--choice');
|
269
|
+
var destination = $(this).attr('href');
|
270
|
+
var self = this;
|
271
|
+
|
272
|
+
$.ajax({
|
273
|
+
url: destination,
|
274
|
+
type: 'DELETE',
|
275
|
+
success: function success() {
|
276
|
+
choice.remove();
|
277
|
+
// Update form item editor size
|
278
|
+
__WEBPACK_IMPORTED_MODULE_0__form_item_editor__["a" /* _FormItemEditor */].resize();
|
279
|
+
}
|
280
|
+
});
|
281
|
+
}
|
282
|
+
|
283
|
+
/***/ }),
|
284
|
+
/* 5 */
|
285
|
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
286
|
+
|
198
287
|
"use strict";
|
199
288
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _FileUpload; });
|
200
289
|
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
@@ -386,7 +475,7 @@ function setup_video_preview(data, id) {
|
|
386
475
|
}
|
387
476
|
|
388
477
|
/***/ }),
|
389
|
-
/*
|
478
|
+
/* 6 */
|
390
479
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
391
480
|
|
392
481
|
"use strict";
|
@@ -512,94 +601,6 @@ function collapseToggle(event) {
|
|
512
601
|
}
|
513
602
|
}
|
514
603
|
|
515
|
-
/***/ }),
|
516
|
-
/* 6 */
|
517
|
-
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
518
|
-
|
519
|
-
"use strict";
|
520
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _FormItemChoice; });
|
521
|
-
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__form_item_editor__ = __webpack_require__(0);
|
522
|
-
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
523
|
-
|
524
|
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
525
|
-
|
526
|
-
/**
|
527
|
-
* FORM ITEM CHOICE
|
528
|
-
*/
|
529
|
-
|
530
|
-
|
531
|
-
|
532
|
-
var FormItemChoice = function () {
|
533
|
-
function FormItemChoice() {
|
534
|
-
_classCallCheck(this, FormItemChoice);
|
535
|
-
|
536
|
-
this.target = '.form-item--choice';
|
537
|
-
}
|
538
|
-
|
539
|
-
_createClass(FormItemChoice, [{
|
540
|
-
key: 'isSet',
|
541
|
-
value: function isSet() {
|
542
|
-
if ($(this.target).length > 0) {
|
543
|
-
return true;
|
544
|
-
} else {
|
545
|
-
return false;
|
546
|
-
}
|
547
|
-
}
|
548
|
-
}, {
|
549
|
-
key: 'setEvents',
|
550
|
-
value: function setEvents() {
|
551
|
-
$(document).on('click', '.form-item--add-choice', addChoice);
|
552
|
-
|
553
|
-
$(document).on('click', '.form-item--delete-choice', deleteChoice);
|
554
|
-
$(document).on('click', '.form-item--js-delete-choice', function (event) {
|
555
|
-
event.preventDefault();
|
556
|
-
$(this).closest('.form-item--choice').remove();
|
557
|
-
// Update form item editor size
|
558
|
-
__WEBPACK_IMPORTED_MODULE_0__form_item_editor__["a" /* _FormItemEditor */].resize();
|
559
|
-
});
|
560
|
-
}
|
561
|
-
}]);
|
562
|
-
|
563
|
-
return FormItemChoice;
|
564
|
-
}();
|
565
|
-
|
566
|
-
var _FormItemChoice = new FormItemChoice();
|
567
|
-
|
568
|
-
/**
|
569
|
-
* HELPER FUNCTIONS
|
570
|
-
*/
|
571
|
-
|
572
|
-
function addChoice(event) {
|
573
|
-
event.preventDefault();
|
574
|
-
// Clone the new choice field
|
575
|
-
var choices = $(this).closest('.form-item--choices');
|
576
|
-
var newchoice = choices.find('.form-item--new-choice');
|
577
|
-
var clone = newchoice.clone().removeClass('form-item--new-choice').toggle();
|
578
|
-
clone.find('.form-item--toggle-choice').toggle();
|
579
|
-
// Append the clone right after
|
580
|
-
choices.prepend(clone);
|
581
|
-
// Update form item editor size
|
582
|
-
__WEBPACK_IMPORTED_MODULE_0__form_item_editor__["a" /* _FormItemEditor */].resize();
|
583
|
-
}
|
584
|
-
|
585
|
-
function deleteChoice(event) {
|
586
|
-
event.preventDefault();
|
587
|
-
|
588
|
-
var choice = $(this).closest('.form-item--choice');
|
589
|
-
var destination = $(this).attr('href');
|
590
|
-
var self = this;
|
591
|
-
|
592
|
-
$.ajax({
|
593
|
-
url: destination,
|
594
|
-
type: 'DELETE',
|
595
|
-
success: function success() {
|
596
|
-
choice.remove();
|
597
|
-
// Update form item editor size
|
598
|
-
__WEBPACK_IMPORTED_MODULE_0__form_item_editor__["a" /* _FormItemEditor */].resize();
|
599
|
-
}
|
600
|
-
});
|
601
|
-
}
|
602
|
-
|
603
604
|
/***/ }),
|
604
605
|
/* 7 */
|
605
606
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
@@ -712,39 +713,42 @@ function addNewItem(event) {
|
|
712
713
|
// the code contained between the two SPLIT comments
|
713
714
|
var parts = data.split('<!-- SPLIT -->');
|
714
715
|
var newRepeater = parts[1];
|
716
|
+
setupAndAppend(newRepeater, $list);
|
717
|
+
});
|
718
|
+
}
|
715
719
|
|
716
|
-
|
717
|
-
|
718
|
-
|
720
|
+
function setupAndAppend(newRepeater, $list) {
|
721
|
+
// Append the item
|
722
|
+
$list.prepend(newRepeater);
|
723
|
+
var new_repeater_item = $list.find('.form-item--repeater').get(0);
|
719
724
|
|
720
|
-
|
721
|
-
|
725
|
+
// Prepare animation
|
726
|
+
new_repeater_item.style.maxHeight = 0;
|
722
727
|
|
723
|
-
|
724
|
-
|
725
|
-
|
726
|
-
|
727
|
-
|
728
|
-
|
728
|
+
// Group fields if sotrable is enabled
|
729
|
+
if ($list.hasClass('sortable--enabled')) {
|
730
|
+
$(new_repeater_item).find('.form-item--repeater-fields').each(function () {
|
731
|
+
this.style.maxHeight = 0 + 'px';
|
732
|
+
});
|
733
|
+
}
|
729
734
|
|
730
|
-
|
731
|
-
|
732
|
-
|
735
|
+
// Setup TinyMCE for the newly created item
|
736
|
+
var textarea_editor_id = $list.find('textarea').last('textarea').attr('id');
|
737
|
+
tinyMCE.EditorManager.execCommand('mceAddEditor', true, textarea_editor_id);
|
733
738
|
|
734
|
-
|
735
|
-
|
739
|
+
// Resize the editor (is it needed with the new configuration?)
|
740
|
+
// _FormItemEditor.resize()
|
736
741
|
|
737
|
-
|
738
|
-
|
742
|
+
// Update select input for Select2 plugin
|
743
|
+
__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1__select2__["b" /* setupSelect2 */])($list.find('select'));
|
739
744
|
|
740
|
-
|
741
|
-
|
745
|
+
// Refresh Sortable to update the added item with Sortable features
|
746
|
+
$list.sortable('refresh');
|
742
747
|
|
743
|
-
|
744
|
-
|
745
|
-
|
746
|
-
|
747
|
-
});
|
748
|
+
// Run animation 50ms after previous style declaration (see above) otherwise animation doesn't get triggered
|
749
|
+
setTimeout(function () {
|
750
|
+
new_repeater_item.style.maxHeight = new_repeater_item.scrollHeight + 'px';
|
751
|
+
}, 50);
|
748
752
|
}
|
749
753
|
|
750
754
|
function deleteRepeter(event) {
|
@@ -1030,8 +1034,8 @@ var LoginForm = function () {
|
|
1030
1034
|
}
|
1031
1035
|
}
|
1032
1036
|
}, {
|
1033
|
-
key: '
|
1034
|
-
value: function
|
1037
|
+
key: 'init',
|
1038
|
+
value: function init() {
|
1035
1039
|
this.$form = $('.login--form');
|
1036
1040
|
this.$questions = $('ol.login--questions > li');
|
1037
1041
|
this.questionsCount = this.$questions.length;
|
@@ -1042,6 +1046,12 @@ var LoginForm = function () {
|
|
1042
1046
|
|
1043
1047
|
//disable form autocomplete
|
1044
1048
|
this.$form.attr('autocomplete', 'off');
|
1049
|
+
this.setEvents();
|
1050
|
+
}
|
1051
|
+
}, {
|
1052
|
+
key: 'setEvents',
|
1053
|
+
value: function setEvents() {
|
1054
|
+
var _this = this;
|
1045
1055
|
|
1046
1056
|
var self = this;
|
1047
1057
|
|
@@ -1058,17 +1068,19 @@ var LoginForm = function () {
|
|
1058
1068
|
|
1059
1069
|
// show next question
|
1060
1070
|
this.$nextButton.on('click', function (event) {
|
1071
|
+
|
1061
1072
|
event.preventDefault();
|
1062
|
-
|
1073
|
+
_this._nextQuestion();
|
1063
1074
|
});
|
1064
1075
|
|
1065
1076
|
// pressing enter will jump to next question
|
1066
1077
|
this.$form.on('keydown', function (event) {
|
1078
|
+
|
1067
1079
|
var keyCode = event.keyCode || event.which;
|
1068
1080
|
// enter
|
1069
1081
|
if (keyCode === 13) {
|
1070
1082
|
event.preventDefault();
|
1071
|
-
|
1083
|
+
_this._nextQuestion();
|
1072
1084
|
}
|
1073
1085
|
});
|
1074
1086
|
}
|
@@ -1190,22 +1202,7 @@ var sortableOptions = {
|
|
1190
1202
|
|
1191
1203
|
// Add event to any sortable toggle button
|
1192
1204
|
// TODO: make this event available to element which aren't standard form repeaters
|
1193
|
-
$(document).on('click', '.standard-form--repeater .sortable--toggle',
|
1194
|
-
event.preventDefault();
|
1195
|
-
var id = '#' + $(this).data('repeater-id');
|
1196
|
-
|
1197
|
-
if ($(id).hasClass('sortable--disabled')) {
|
1198
|
-
$(id).sortable('enable');
|
1199
|
-
$(id).find('.form-item--repeater-fields').each(close);
|
1200
|
-
$(id).find('.form-item--collapsable').addClass('form-item--collapsed');
|
1201
|
-
} else {
|
1202
|
-
$(id).sortable('disable');
|
1203
|
-
}
|
1204
|
-
|
1205
|
-
$(id).toggleClass('sortable--disabled');
|
1206
|
-
$(id).toggleClass('sortable--enabled');
|
1207
|
-
$(this).children('.sortable--toggle-text').toggle();
|
1208
|
-
});
|
1205
|
+
$(document).on('click', '.standard-form--repeater .sortable--toggle', toggleSortable);
|
1209
1206
|
});
|
1210
1207
|
|
1211
1208
|
function setupSortableToggle() {
|
@@ -1224,18 +1221,35 @@ function open() {
|
|
1224
1221
|
this.style.maxHeight = this.scrollHeight + "px";
|
1225
1222
|
}
|
1226
1223
|
|
1224
|
+
function toggleSortable(event) {
|
1225
|
+
event.preventDefault();
|
1226
|
+
var id = '#' + $(this).data('repeater-id');
|
1227
|
+
|
1228
|
+
if ($(id).hasClass('sortable--disabled')) {
|
1229
|
+
$(id).sortable('enable');
|
1230
|
+
$(id).find('.form-item--repeater-fields').each(close);
|
1231
|
+
$(id).find('.form-item--collapsable').addClass('form-item--collapsed');
|
1232
|
+
} else {
|
1233
|
+
$(id).sortable('disable');
|
1234
|
+
}
|
1235
|
+
|
1236
|
+
$(id).toggleClass('sortable--disabled');
|
1237
|
+
$(id).toggleClass('sortable--enabled');
|
1238
|
+
$(this).children('.sortable--toggle-text').toggle();
|
1239
|
+
}
|
1240
|
+
|
1227
1241
|
/***/ }),
|
1228
1242
|
/* 13 */
|
1229
1243
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
1230
1244
|
|
1231
1245
|
"use strict";
|
1232
1246
|
Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
|
1233
|
-
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__components_form_item__ = __webpack_require__(
|
1247
|
+
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__components_form_item__ = __webpack_require__(6);
|
1234
1248
|
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__components_form_item_repeater__ = __webpack_require__(8);
|
1235
1249
|
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__components_form_item_image__ = __webpack_require__(7);
|
1236
|
-
/* harmony import */ var
|
1250
|
+
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__components_field_setting_choices__ = __webpack_require__(4);
|
1237
1251
|
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__components_form_item_editor__ = __webpack_require__(0);
|
1238
|
-
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__components_fileupload__ = __webpack_require__(
|
1252
|
+
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__components_fileupload__ = __webpack_require__(5);
|
1239
1253
|
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__components_login_shader__ = __webpack_require__(9);
|
1240
1254
|
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__components_login_form__ = __webpack_require__(10);
|
1241
1255
|
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__components_sortable__ = __webpack_require__(12);
|
@@ -1271,8 +1285,8 @@ $(document).ready(function () {
|
|
1271
1285
|
if (__WEBPACK_IMPORTED_MODULE_2__components_form_item_image__["a" /* _FormItemImage */].isSet()) {
|
1272
1286
|
__WEBPACK_IMPORTED_MODULE_2__components_form_item_image__["a" /* _FormItemImage */].setEvents();
|
1273
1287
|
}
|
1274
|
-
if (
|
1275
|
-
|
1288
|
+
if (__WEBPACK_IMPORTED_MODULE_3__components_field_setting_choices__["a" /* _FieldSettingChoices */].isSet()) {
|
1289
|
+
__WEBPACK_IMPORTED_MODULE_3__components_field_setting_choices__["a" /* _FieldSettingChoices */].setEvents();
|
1276
1290
|
}
|
1277
1291
|
if (__WEBPACK_IMPORTED_MODULE_4__components_form_item_editor__["a" /* _FormItemEditor */].isSet()) {
|
1278
1292
|
__WEBPACK_IMPORTED_MODULE_4__components_form_item_editor__["a" /* _FormItemEditor */].setEvents();
|
@@ -1281,7 +1295,7 @@ $(document).ready(function () {
|
|
1281
1295
|
__WEBPACK_IMPORTED_MODULE_5__components_fileupload__["a" /* _FileUpload */].setEvents();
|
1282
1296
|
}
|
1283
1297
|
if (__WEBPACK_IMPORTED_MODULE_7__components_login_form__["a" /* _LoginForm */].isSet()) {
|
1284
|
-
__WEBPACK_IMPORTED_MODULE_7__components_login_form__["a" /* _LoginForm */].
|
1298
|
+
__WEBPACK_IMPORTED_MODULE_7__components_login_form__["a" /* _LoginForm */].init();
|
1285
1299
|
}
|
1286
1300
|
if (__WEBPACK_IMPORTED_MODULE_6__components_login_shader__["a" /* _Shader */].isSet()) {
|
1287
1301
|
__WEBPACK_IMPORTED_MODULE_6__components_login_shader__["a" /* _Shader */].setup();
|
@@ -2,29 +2,29 @@
|
|
2
2
|
/// INDEX OF BINDA'S SCRIPTS
|
3
3
|
///- - - - - - - - - - - - - - - - - - - -
|
4
4
|
|
5
|
-
import { _FormItem }
|
6
|
-
import { _FormItemRepeater }
|
7
|
-
import { _FormItemImage }
|
8
|
-
import {
|
9
|
-
import { _FormItemEditor }
|
10
|
-
import { _FileUpload }
|
11
|
-
import { _Shader }
|
12
|
-
import { _LoginForm }
|
13
|
-
import setupSortable
|
14
|
-
import setupFieldGroupEditor
|
15
|
-
import setupBootstrap
|
16
|
-
import setupSelect2
|
17
|
-
import setupRadioToggle
|
5
|
+
import { _FormItem } from './components/form_item'
|
6
|
+
import { _FormItemRepeater } from './components/form_item_repeater'
|
7
|
+
import { _FormItemImage } from './components/form_item_image'
|
8
|
+
import { _FieldSettingChoices } from './components/field_setting_choices'
|
9
|
+
import { _FormItemEditor } from './components/form_item_editor'
|
10
|
+
import { _FileUpload } from './components/fileupload'
|
11
|
+
import { _Shader } from './components/login-shader'
|
12
|
+
import { _LoginForm } from './components/login_form'
|
13
|
+
import setupSortable from './components/sortable'
|
14
|
+
import setupFieldGroupEditor from './components/field_group_editor'
|
15
|
+
import setupBootstrap from './components/bootstrap'
|
16
|
+
import setupSelect2 from './components/select2'
|
17
|
+
import setupRadioToggle from './components/radio-toggle'
|
18
18
|
|
19
19
|
$(document).ready( function()
|
20
20
|
{
|
21
|
-
if ( _FormItem.isSet() )
|
22
|
-
if ( _FormItemRepeater.isSet() )
|
23
|
-
if ( _FormItemImage.isSet() )
|
24
|
-
if (
|
25
|
-
if ( _FormItemEditor.isSet() )
|
26
|
-
if ( _FileUpload.isSet() )
|
27
|
-
if ( _LoginForm.isSet() )
|
21
|
+
if ( _FormItem.isSet() ) { _FormItem.setEvents() }
|
22
|
+
if ( _FormItemRepeater.isSet() ) { _FormItemRepeater.setEvents() }
|
23
|
+
if ( _FormItemImage.isSet() ) { _FormItemImage.setEvents() }
|
24
|
+
if ( _FieldSettingChoices.isSet() ) { _FieldSettingChoices.setEvents() }
|
25
|
+
if ( _FormItemEditor.isSet() ) { _FormItemEditor.setEvents() }
|
26
|
+
if ( _FileUpload.isSet() ) { _FileUpload.setEvents() }
|
27
|
+
if ( _LoginForm.isSet() ) { _LoginForm.init() }
|
28
28
|
if ( _Shader.isSet() )
|
29
29
|
{
|
30
30
|
_Shader.setup()
|
@@ -0,0 +1,90 @@
|
|
1
|
+
.field-setting-choices
|
2
|
+
{
|
3
|
+
position: relative;
|
4
|
+
margin: 12px;
|
5
|
+
margin-top: 0;
|
6
|
+
background-color: $color-gray-lightest;
|
7
|
+
|
8
|
+
.form-control
|
9
|
+
{
|
10
|
+
background-color: $color-white;
|
11
|
+
}
|
12
|
+
}
|
13
|
+
|
14
|
+
.field-setting-choices--header
|
15
|
+
{
|
16
|
+
position: relative;
|
17
|
+
padding: 20px 12px 8px;
|
18
|
+
border-top: 1px solid $color-gray-lightest;
|
19
|
+
|
20
|
+
p.control-label
|
21
|
+
{
|
22
|
+
margin: 0;
|
23
|
+
}
|
24
|
+
}
|
25
|
+
|
26
|
+
.field-setting-choices--add-choice
|
27
|
+
{
|
28
|
+
float: right;
|
29
|
+
}
|
30
|
+
|
31
|
+
.form-item--editor .field-setting-choices--choice
|
32
|
+
{
|
33
|
+
position: relative;
|
34
|
+
clear: left;
|
35
|
+
|
36
|
+
.form-group
|
37
|
+
{
|
38
|
+
padding-bottom: 0;
|
39
|
+
}
|
40
|
+
|
41
|
+
&:last-child
|
42
|
+
{
|
43
|
+
margin-bottom: 16px;
|
44
|
+
padding-bottom: 8px;
|
45
|
+
border-bottom: 1px solid $color-gray-lightest;
|
46
|
+
}
|
47
|
+
|
48
|
+
&:last-child .form-group
|
49
|
+
{
|
50
|
+
padding-bottom: 20px;
|
51
|
+
}
|
52
|
+
}
|
53
|
+
|
54
|
+
.field-setting-choices--new-choice
|
55
|
+
{
|
56
|
+
display: none;
|
57
|
+
}
|
58
|
+
|
59
|
+
.field-setting-choices--choice-label,
|
60
|
+
.field-setting-choices--choice-value
|
61
|
+
{
|
62
|
+
position: relative;
|
63
|
+
float: left;
|
64
|
+
width: calc(50% - 16px);
|
65
|
+
}
|
66
|
+
|
67
|
+
.field-setting-choices--delete-choice,
|
68
|
+
.field-setting-choices--js-delete-choice
|
69
|
+
{
|
70
|
+
position: absolute;
|
71
|
+
top: 30px;
|
72
|
+
right: 16px;
|
73
|
+
transition: color .3s;
|
74
|
+
color: $color-danger;
|
75
|
+
|
76
|
+
&:hover
|
77
|
+
{
|
78
|
+
color: $color-danger-hover;
|
79
|
+
}
|
80
|
+
}
|
81
|
+
|
82
|
+
.field-setting-choices--new-choice .field-setting-choices--delete-choice
|
83
|
+
{
|
84
|
+
display: none;
|
85
|
+
}
|
86
|
+
|
87
|
+
.field-setting-choices--allow-null
|
88
|
+
{
|
89
|
+
border-top: 1px solid $color-gray-lightest;
|
90
|
+
}
|
@@ -246,54 +246,4 @@ a.form-item--delete-repeater-item
|
|
246
246
|
{
|
247
247
|
display: block;
|
248
248
|
}
|
249
|
-
}
|
250
|
-
|
251
|
-
.form-item--choices
|
252
|
-
{
|
253
|
-
position: relative;
|
254
|
-
}
|
255
|
-
|
256
|
-
.form-item--editor .form-item--choice
|
257
|
-
{
|
258
|
-
position: relative;
|
259
|
-
clear: left;
|
260
|
-
|
261
|
-
|
262
|
-
&:last-child
|
263
|
-
{
|
264
|
-
margin-bottom: $font-size-base;
|
265
|
-
padding-bottom: $font-size-base/2;
|
266
|
-
border-bottom: 1px solid $color-gray-lightest;
|
267
|
-
}
|
268
|
-
}
|
269
|
-
|
270
|
-
.form-item--new-choice
|
271
|
-
{
|
272
|
-
display: none;
|
273
|
-
}
|
274
|
-
|
275
|
-
.form-item--choice-label,
|
276
|
-
.form-item--choice-value
|
277
|
-
{
|
278
|
-
@extend .form-item--half-size;
|
279
|
-
}
|
280
|
-
|
281
|
-
.form-item--delete-choice,
|
282
|
-
.form-item--js-delete-choice
|
283
|
-
{
|
284
|
-
position: absolute;
|
285
|
-
top: 32px;
|
286
|
-
right: 0;
|
287
|
-
}
|
288
|
-
|
289
|
-
.form-item--add-choice
|
290
|
-
{
|
291
|
-
position: absolute;
|
292
|
-
top: 0;
|
293
|
-
right: 0;
|
294
|
-
}
|
295
|
-
|
296
|
-
.form-item--new-choice .form-item--delete-choice
|
297
|
-
{
|
298
|
-
display: none;
|
299
249
|
}
|
data/app/assets/stylesheets/binda/components/{form_item_choice.scss → form_item_choices.scss}
RENAMED
@@ -6,15 +6,9 @@
|
|
6
6
|
}
|
7
7
|
}
|
8
8
|
|
9
|
-
.form-group.allow-null {
|
10
|
-
|
11
|
-
padding-left: 12px;
|
12
|
-
padding-bottom: 0px;
|
13
|
-
}
|
14
|
-
|
15
9
|
.field_group_field_settings_allow_null {
|
16
10
|
|
17
11
|
border-top: none !important;
|
18
12
|
padding-bottom: 10px !important;
|
19
13
|
padding-top: 10px !important;
|
20
|
-
}
|
14
|
+
}
|
@@ -0,0 +1,68 @@
|
|
1
|
+
.main-sortable-table {
|
2
|
+
margin-bottom: 48px;
|
3
|
+
border-bottom: 1px solid $color-gray-lighter;
|
4
|
+
}
|
5
|
+
|
6
|
+
.main-sortable-table--header-row
|
7
|
+
{
|
8
|
+
display: flex;
|
9
|
+
border-right: 1px solid $color-gray-darker;
|
10
|
+
border-left: 1px solid $color-gray-darker;
|
11
|
+
background-image: linear-gradient(to right, #333, #424242);
|
12
|
+
}
|
13
|
+
|
14
|
+
.main-sortable-table--header-title
|
15
|
+
{
|
16
|
+
margin-bottom: 0;
|
17
|
+
padding: 6px 12px;
|
18
|
+
|
19
|
+
flex: 1;
|
20
|
+
|
21
|
+
p
|
22
|
+
{
|
23
|
+
margin: 0 !important;
|
24
|
+
color: white;
|
25
|
+
}
|
26
|
+
}
|
27
|
+
|
28
|
+
.main-sortable-table--row
|
29
|
+
{
|
30
|
+
display: flex;
|
31
|
+
transition: box-shadow .3s ease, background .3s ease, transform .3s ease;
|
32
|
+
border-right: 1px solid $color-gray-darker;
|
33
|
+
border-bottom: 1px solid $color-gray-lighter;
|
34
|
+
border-left: 1px solid $color-gray-darker;
|
35
|
+
background: transparent;
|
36
|
+
box-shadow: 0 0 26px 0 rgba(0, 0, 0, 0);
|
37
|
+
|
38
|
+
&:last-child
|
39
|
+
{
|
40
|
+
border-bottom: 1px solid $color-gray-darker;
|
41
|
+
}
|
42
|
+
|
43
|
+
&:hover
|
44
|
+
{
|
45
|
+
background: $color-white;
|
46
|
+
}
|
47
|
+
}
|
48
|
+
|
49
|
+
.main-sortable-table--row.ui-sortable-handle:hover
|
50
|
+
{
|
51
|
+
cursor: move;
|
52
|
+
transform: scale(1.01);
|
53
|
+
border: 1px solid transparent;
|
54
|
+
box-shadow: 0 10px 26px 0 rgba(0, 0, 0, .25);
|
55
|
+
}
|
56
|
+
|
57
|
+
.main-sortable-table--row-cell
|
58
|
+
{
|
59
|
+
display: table-cell;
|
60
|
+
padding: 12px;
|
61
|
+
|
62
|
+
flex: 1;
|
63
|
+
|
64
|
+
p
|
65
|
+
{
|
66
|
+
margin: 0 !important;
|
67
|
+
}
|
68
|
+
}
|