super 0.0.10 → 0.0.11
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/Rakefile +16 -14
- data/app/assets/javascripts/super/application.js +191 -1
- data/app/controllers/super/application_controller.rb +14 -8
- data/app/helpers/super/form_builder_helper.rb +2 -0
- data/app/views/super/application/_filter.html.erb +5 -13
- data/app/views/super/application/_filter_type_select.html.erb +4 -1
- data/app/views/super/application/_filter_type_text.html.erb +5 -3
- data/app/views/super/application/_filter_type_timestamp.html.erb +5 -4
- data/app/views/super/application/_query.html.erb +18 -0
- data/app/views/super/application/_sort.html.erb +18 -0
- data/app/views/super/application/_sort_expression.html.erb +25 -0
- data/app/views/super/feather/README.md +1 -0
- data/app/views/super/feather/_x.html +15 -0
- data/config/routes.rb +2 -0
- data/docs/action_text.md +1 -1
- data/docs/yard_customizations.rb +2 -0
- data/frontend/super-frontend/dist/application.js +191 -1
- data/lib/generators/super/action_text/action_text_generator.rb +2 -0
- data/lib/generators/super/install/install_generator.rb +2 -0
- data/lib/generators/super/resource/resource_generator.rb +2 -0
- data/lib/generators/super/webpacker/webpacker_generator.rb +2 -0
- data/lib/super.rb +4 -1
- data/lib/super/action_inquirer.rb +2 -0
- data/lib/super/assets.rb +2 -0
- data/lib/super/client_error.rb +2 -0
- data/lib/super/compatibility.rb +2 -0
- data/lib/super/configuration.rb +2 -1
- data/lib/super/controls.rb +4 -0
- data/lib/super/controls/optional.rb +34 -1
- data/lib/super/controls/required.rb +2 -0
- data/lib/super/controls/steps.rb +27 -35
- data/lib/super/controls/view.rb +55 -0
- data/lib/super/display.rb +13 -5
- data/lib/super/display/guesser.rb +2 -0
- data/lib/super/display/schema_types.rb +2 -0
- data/lib/super/engine.rb +2 -0
- data/lib/super/error.rb +5 -0
- data/lib/super/filter.rb +2 -0
- data/lib/super/filter/form_object.rb +5 -8
- data/lib/super/filter/guesser.rb +2 -0
- data/lib/super/filter/operator.rb +2 -0
- data/lib/super/filter/schema_types.rb +2 -0
- data/lib/super/form.rb +2 -0
- data/lib/super/form/builder.rb +2 -0
- data/lib/super/form/guesser.rb +2 -0
- data/lib/super/form/inline_errors.rb +2 -0
- data/lib/super/form/schema_types.rb +2 -0
- data/lib/super/form/strong_params.rb +2 -0
- data/lib/super/layout.rb +2 -0
- data/lib/super/link.rb +2 -0
- data/lib/super/navigation/automatic.rb +2 -0
- data/lib/super/pagination.rb +2 -0
- data/lib/super/panel.rb +2 -0
- data/lib/super/partial.rb +2 -0
- data/lib/super/partial/resolving.rb +2 -0
- data/lib/super/plugin.rb +2 -0
- data/lib/super/query/form_object.rb +48 -0
- data/lib/super/schema.rb +2 -0
- data/lib/super/schema/common.rb +2 -0
- data/lib/super/schema/guesser.rb +2 -0
- data/lib/super/sort.rb +110 -0
- data/lib/super/version.rb +3 -1
- data/lib/super/view_helper.rb +2 -0
- metadata +23 -3
- data/lib/super/filter/plugin.rb +0 -47
@@ -0,0 +1,18 @@
|
|
1
|
+
<h1 class="text-lg mt-6">Sort</h1>
|
2
|
+
<div data-controller="apply-template">
|
3
|
+
<% sort.exprs.each.with_index do |expr, index| %>
|
4
|
+
<%= form.fields_for("exprs[]", expr.with_index(index)) do |expr_fields| %>
|
5
|
+
<%= render "sort_expression", expr_fields: expr_fields, sort: sort %>
|
6
|
+
<% end %>
|
7
|
+
<% end %>
|
8
|
+
|
9
|
+
<%= form.fields_for("exprs[]", sort.new_expr.with_index("TEMPLATEINDEX")) do |expr_fields| %>
|
10
|
+
<template data-apply-template-target="template">
|
11
|
+
<%= render "sort_expression", expr_fields: expr_fields, sort: sort %>
|
12
|
+
</template>
|
13
|
+
<% end %>
|
14
|
+
|
15
|
+
<a href="#" data-action="apply-template#call" class="block mt-2 text-sm">
|
16
|
+
Add
|
17
|
+
</a>
|
18
|
+
</div>
|
@@ -0,0 +1,25 @@
|
|
1
|
+
<div data-controller="delete clean-filter-param" class="mt-4">
|
2
|
+
<div class="flex items-center">
|
3
|
+
<div class="flex-auto">
|
4
|
+
<%= expr_fields.super.select(
|
5
|
+
:a,
|
6
|
+
sort.sortable_columns,
|
7
|
+
{},
|
8
|
+
{}
|
9
|
+
) %>
|
10
|
+
</div>
|
11
|
+
<div class="flex-none w-2">
|
12
|
+
</div>
|
13
|
+
<div class="flex-auto">
|
14
|
+
<%= expr_fields.super.select(
|
15
|
+
:d,
|
16
|
+
sort.class::DIRECTIONS,
|
17
|
+
{ include_blank: false },
|
18
|
+
{}
|
19
|
+
) %>
|
20
|
+
</div>
|
21
|
+
<div class="flex-none pl-2">
|
22
|
+
<a href="#" data-action="delete#call" class="block text-black hover:text-red-600 h-4 w-4"><%= render("super/feather/x") %></a>
|
23
|
+
</div>
|
24
|
+
</div>
|
25
|
+
</div>
|
@@ -0,0 +1,15 @@
|
|
1
|
+
<svg
|
2
|
+
xmlns="http://www.w3.org/2000/svg"
|
3
|
+
width="24"
|
4
|
+
height="24"
|
5
|
+
viewBox="0 0 24 24"
|
6
|
+
fill="none"
|
7
|
+
stroke="currentColor"
|
8
|
+
stroke-width="2"
|
9
|
+
stroke-linecap="round"
|
10
|
+
stroke-linejoin="round"
|
11
|
+
class="feather feather-x"
|
12
|
+
>
|
13
|
+
<line x1="18" y1="6" x2="6" y2="18" />
|
14
|
+
<line x1="6" y1="6" x2="18" y2="18" />
|
15
|
+
</svg>
|
data/config/routes.rb
CHANGED
data/docs/action_text.md
CHANGED
data/docs/yard_customizations.rb
CHANGED
@@ -4332,6 +4332,187 @@ var _default = /*#__PURE__*/function (_Controller) {
|
|
4332
4332
|
return _default;
|
4333
4333
|
}(_stimulus.Controller);
|
4334
4334
|
|
4335
|
+
exports.default = _default;
|
4336
|
+
},{"stimulus":"../node_modules/stimulus/index.js"}],"javascripts/super/clean_filter_param_controller.js":[function(require,module,exports) {
|
4337
|
+
"use strict";
|
4338
|
+
|
4339
|
+
Object.defineProperty(exports, "__esModule", {
|
4340
|
+
value: true
|
4341
|
+
});
|
4342
|
+
exports.default = void 0;
|
4343
|
+
|
4344
|
+
var _stimulus = require("stimulus");
|
4345
|
+
|
4346
|
+
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
4347
|
+
|
4348
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
4349
|
+
|
4350
|
+
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); } }
|
4351
|
+
|
4352
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
4353
|
+
|
4354
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
4355
|
+
|
4356
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
4357
|
+
|
4358
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
4359
|
+
|
4360
|
+
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
|
4361
|
+
|
4362
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
4363
|
+
|
4364
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
|
4365
|
+
|
4366
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
4367
|
+
|
4368
|
+
var _default = /*#__PURE__*/function (_Controller) {
|
4369
|
+
_inherits(_default, _Controller);
|
4370
|
+
|
4371
|
+
var _super = _createSuper(_default);
|
4372
|
+
|
4373
|
+
function _default() {
|
4374
|
+
_classCallCheck(this, _default);
|
4375
|
+
|
4376
|
+
return _super.apply(this, arguments);
|
4377
|
+
}
|
4378
|
+
|
4379
|
+
_createClass(_default, [{
|
4380
|
+
key: "call",
|
4381
|
+
value: function call() {
|
4382
|
+
var allControlsBlank = this.controlTargets.every(function (el) {
|
4383
|
+
return el.value === "";
|
4384
|
+
});
|
4385
|
+
|
4386
|
+
if (!allControlsBlank) {
|
4387
|
+
return;
|
4388
|
+
}
|
4389
|
+
|
4390
|
+
this.candidateTargets.forEach(function (el) {
|
4391
|
+
el.disabled = true;
|
4392
|
+
});
|
4393
|
+
}
|
4394
|
+
}], [{
|
4395
|
+
key: "targets",
|
4396
|
+
get: function get() {
|
4397
|
+
return ["candidate", "control"];
|
4398
|
+
}
|
4399
|
+
}]);
|
4400
|
+
|
4401
|
+
return _default;
|
4402
|
+
}(_stimulus.Controller);
|
4403
|
+
|
4404
|
+
exports.default = _default;
|
4405
|
+
},{"stimulus":"../node_modules/stimulus/index.js"}],"javascripts/super/clean_filter_params_controller.js":[function(require,module,exports) {
|
4406
|
+
"use strict";
|
4407
|
+
|
4408
|
+
Object.defineProperty(exports, "__esModule", {
|
4409
|
+
value: true
|
4410
|
+
});
|
4411
|
+
exports.default = void 0;
|
4412
|
+
|
4413
|
+
var _stimulus = require("stimulus");
|
4414
|
+
|
4415
|
+
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
4416
|
+
|
4417
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
4418
|
+
|
4419
|
+
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); } }
|
4420
|
+
|
4421
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
4422
|
+
|
4423
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
4424
|
+
|
4425
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
4426
|
+
|
4427
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
4428
|
+
|
4429
|
+
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
|
4430
|
+
|
4431
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
4432
|
+
|
4433
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
|
4434
|
+
|
4435
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
4436
|
+
|
4437
|
+
var _default = /*#__PURE__*/function (_Controller) {
|
4438
|
+
_inherits(_default, _Controller);
|
4439
|
+
|
4440
|
+
var _super = _createSuper(_default);
|
4441
|
+
|
4442
|
+
function _default() {
|
4443
|
+
_classCallCheck(this, _default);
|
4444
|
+
|
4445
|
+
return _super.apply(this, arguments);
|
4446
|
+
}
|
4447
|
+
|
4448
|
+
_createClass(_default, [{
|
4449
|
+
key: "call",
|
4450
|
+
value: function call(event) {
|
4451
|
+
this.element.querySelectorAll("[data-controller='clean-filter-param']").forEach(function (el) {
|
4452
|
+
var controller = this.application.getControllerForElementAndIdentifier(el, "clean-filter-param");
|
4453
|
+
controller.call();
|
4454
|
+
}.bind(this));
|
4455
|
+
}
|
4456
|
+
}]);
|
4457
|
+
|
4458
|
+
return _default;
|
4459
|
+
}(_stimulus.Controller);
|
4460
|
+
|
4461
|
+
exports.default = _default;
|
4462
|
+
},{"stimulus":"../node_modules/stimulus/index.js"}],"javascripts/super/delete_controller.js":[function(require,module,exports) {
|
4463
|
+
"use strict";
|
4464
|
+
|
4465
|
+
Object.defineProperty(exports, "__esModule", {
|
4466
|
+
value: true
|
4467
|
+
});
|
4468
|
+
exports.default = void 0;
|
4469
|
+
|
4470
|
+
var _stimulus = require("stimulus");
|
4471
|
+
|
4472
|
+
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
4473
|
+
|
4474
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
4475
|
+
|
4476
|
+
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); } }
|
4477
|
+
|
4478
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
4479
|
+
|
4480
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
4481
|
+
|
4482
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
4483
|
+
|
4484
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
4485
|
+
|
4486
|
+
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
|
4487
|
+
|
4488
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
4489
|
+
|
4490
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
|
4491
|
+
|
4492
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
4493
|
+
|
4494
|
+
var _default = /*#__PURE__*/function (_Controller) {
|
4495
|
+
_inherits(_default, _Controller);
|
4496
|
+
|
4497
|
+
var _super = _createSuper(_default);
|
4498
|
+
|
4499
|
+
function _default() {
|
4500
|
+
_classCallCheck(this, _default);
|
4501
|
+
|
4502
|
+
return _super.apply(this, arguments);
|
4503
|
+
}
|
4504
|
+
|
4505
|
+
_createClass(_default, [{
|
4506
|
+
key: "call",
|
4507
|
+
value: function call(event) {
|
4508
|
+
event.preventDefault();
|
4509
|
+
this.element.remove();
|
4510
|
+
}
|
4511
|
+
}]);
|
4512
|
+
|
4513
|
+
return _default;
|
4514
|
+
}(_stimulus.Controller);
|
4515
|
+
|
4335
4516
|
exports.default = _default;
|
4336
4517
|
},{"stimulus":"../node_modules/stimulus/index.js"}],"javascripts/super/toggle_pending_destruction_controller.js":[function(require,module,exports) {
|
4337
4518
|
"use strict";
|
@@ -4415,6 +4596,12 @@ var _stimulus = require("stimulus");
|
|
4415
4596
|
|
4416
4597
|
var _apply_template_controller = _interopRequireDefault(require("./apply_template_controller"));
|
4417
4598
|
|
4599
|
+
var _clean_filter_param_controller = _interopRequireDefault(require("./clean_filter_param_controller"));
|
4600
|
+
|
4601
|
+
var _clean_filter_params_controller = _interopRequireDefault(require("./clean_filter_params_controller"));
|
4602
|
+
|
4603
|
+
var _delete_controller = _interopRequireDefault(require("./delete_controller"));
|
4604
|
+
|
4418
4605
|
var _toggle_pending_destruction_controller = _interopRequireDefault(require("./toggle_pending_destruction_controller"));
|
4419
4606
|
|
4420
4607
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
@@ -4425,5 +4612,8 @@ var StimulusApplication = _stimulus.Application.start();
|
|
4425
4612
|
|
4426
4613
|
exports.StimulusApplication = StimulusApplication;
|
4427
4614
|
StimulusApplication.register("apply-template", _apply_template_controller.default);
|
4615
|
+
StimulusApplication.register("clean-filter-param", _clean_filter_param_controller.default);
|
4616
|
+
StimulusApplication.register("clean-filter-params", _clean_filter_params_controller.default);
|
4617
|
+
StimulusApplication.register("delete", _delete_controller.default);
|
4428
4618
|
StimulusApplication.register("toggle-pending-destruction", _toggle_pending_destruction_controller.default);
|
4429
|
-
},{"@rails/ujs":"../node_modules/@rails/ujs/lib/assets/compiled/rails-ujs.js","stimulus":"../node_modules/stimulus/index.js","./apply_template_controller":"javascripts/super/apply_template_controller.js","./toggle_pending_destruction_controller":"javascripts/super/toggle_pending_destruction_controller.js"}]},{},["javascripts/super/application.js"], "Super")
|
4619
|
+
},{"@rails/ujs":"../node_modules/@rails/ujs/lib/assets/compiled/rails-ujs.js","stimulus":"../node_modules/stimulus/index.js","./apply_template_controller":"javascripts/super/apply_template_controller.js","./clean_filter_param_controller":"javascripts/super/clean_filter_param_controller.js","./clean_filter_params_controller":"javascripts/super/clean_filter_params_controller.js","./delete_controller":"javascripts/super/delete_controller.js","./toggle_pending_destruction_controller":"javascripts/super/toggle_pending_destruction_controller.js"}]},{},["javascripts/super/application.js"], "Super")
|
data/lib/super.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require "tsort"
|
2
4
|
|
3
5
|
require "rails/engine"
|
@@ -18,7 +20,6 @@ require "super/filter"
|
|
18
20
|
require "super/filter/form_object"
|
19
21
|
require "super/filter/guesser"
|
20
22
|
require "super/filter/operator"
|
21
|
-
require "super/filter/plugin"
|
22
23
|
require "super/filter/schema_types"
|
23
24
|
require "super/form"
|
24
25
|
require "super/form/builder"
|
@@ -33,8 +34,10 @@ require "super/pagination"
|
|
33
34
|
require "super/panel"
|
34
35
|
require "super/partial"
|
35
36
|
require "super/plugin"
|
37
|
+
require "super/query/form_object"
|
36
38
|
require "super/schema"
|
37
39
|
require "super/schema/guesser"
|
40
|
+
require "super/sort"
|
38
41
|
require "super/version"
|
39
42
|
require "super/view_helper"
|
40
43
|
|
data/lib/super/assets.rb
CHANGED
data/lib/super/client_error.rb
CHANGED
data/lib/super/compatibility.rb
CHANGED
data/lib/super/configuration.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Super
|
2
4
|
# @yield [Configuration]
|
3
5
|
# @return [Configuration]
|
@@ -25,7 +27,6 @@ module Super
|
|
25
27
|
self.controller_namespace = "admin"
|
26
28
|
self.route_namespace = :admin
|
27
29
|
|
28
|
-
controller_plugins.use(prepend: Super::Filter::ControllerMethods)
|
29
30
|
controller_plugins.use(prepend: Super::Pagination::ControllerMethods)
|
30
31
|
|
31
32
|
self.javascripts = [Super::Assets.auto("super/application")]
|
data/lib/super/controls.rb
CHANGED
@@ -1,6 +1,9 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require "super/controls/optional"
|
2
4
|
require "super/controls/required"
|
3
5
|
require "super/controls/steps"
|
6
|
+
require "super/controls/view"
|
4
7
|
|
5
8
|
module Super
|
6
9
|
# The base Controls class. Most parts of Super can be configured by
|
@@ -9,5 +12,6 @@ module Super
|
|
9
12
|
include Required
|
10
13
|
include Optional
|
11
14
|
include Steps
|
15
|
+
include View
|
12
16
|
end
|
13
17
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Super
|
2
4
|
class Controls
|
3
5
|
# Methods for `Controls` that have a sane default implementation
|
@@ -24,7 +26,7 @@ module Super
|
|
24
26
|
# @param action [ActionInquirer]
|
25
27
|
# @return [Display]
|
26
28
|
def display_schema(action:)
|
27
|
-
Display.new
|
29
|
+
Display.new do |fields, type|
|
28
30
|
Display::Guesser.new(model: model, action: action, fields: fields, type: type).call
|
29
31
|
end
|
30
32
|
end
|
@@ -74,6 +76,37 @@ module Super
|
|
74
76
|
Super::Link.find_all(:show, :edit, :destroy)
|
75
77
|
end
|
76
78
|
end
|
79
|
+
|
80
|
+
def filters_enabled?
|
81
|
+
true
|
82
|
+
end
|
83
|
+
|
84
|
+
def filter_schema
|
85
|
+
Super::Filter.new do |fields, type|
|
86
|
+
Super::Filter::Guesser.new(model: model, fields: fields, type: type).call
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
90
|
+
def sort_enabled?
|
91
|
+
true
|
92
|
+
end
|
93
|
+
|
94
|
+
def sortable_columns
|
95
|
+
action = ActionInquirer.new(
|
96
|
+
ActionInquirer.default_for_resources,
|
97
|
+
"index"
|
98
|
+
)
|
99
|
+
attribute_names =
|
100
|
+
display_schema(action: action).each_attribute.map do |key, val|
|
101
|
+
key if val.real?
|
102
|
+
end
|
103
|
+
|
104
|
+
attribute_names.compact
|
105
|
+
end
|
106
|
+
|
107
|
+
def default_sort
|
108
|
+
{ id: :desc }
|
109
|
+
end
|
77
110
|
end
|
78
111
|
end
|
79
112
|
end
|