super 0.0.14 → 0.18.0
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 +2 -2
- data/app/assets/javascripts/super/application.js +148 -15
- data/app/assets/stylesheets/super/application.css +15 -22
- data/app/controllers/super/application_controller.rb +44 -42
- data/app/controllers/super/substructure_controller.rb +313 -0
- data/app/helpers/super/form_builder_helper.rb +7 -0
- data/app/views/layouts/super/application.html.erb +3 -21
- data/app/views/super/application/_collection_header.html.erb +2 -2
- data/app/views/super/application/_display_actions.html.erb +1 -1
- data/app/views/super/application/_display_index.html.erb +2 -2
- data/app/views/super/application/_display_show.html.erb +1 -1
- data/app/views/super/application/_filter.html.erb +62 -2
- data/app/views/super/application/_form_field.html.erb +5 -0
- data/app/views/super/application/_member_header.html.erb +2 -2
- data/app/views/super/application/_pagination.html.erb +1 -1
- data/app/views/super/application/_site_footer.html.erb +3 -0
- data/app/views/super/application/_site_header.html.erb +17 -0
- data/app/views/super/application/_sort_expression.html.erb +2 -2
- data/app/views/super/application/index.csv.erb +14 -0
- data/app/views/super/feather/README.md +0 -1
- data/frontend/super-frontend/dist/application.css +15 -22
- data/frontend/super-frontend/dist/application.js +148 -15
- data/lib/generators/super/install/install_generator.rb +0 -16
- data/lib/generators/super/install/templates/base_controller.rb.tt +0 -8
- data/lib/generators/super/resource/templates/resources_controller.rb.tt +4 -4
- data/lib/super/action_inquirer.rb +18 -3
- data/lib/super/badge.rb +60 -0
- data/lib/super/cheat.rb +6 -6
- data/lib/super/display/guesser.rb +1 -1
- data/lib/super/display/schema_types.rb +49 -1
- data/lib/super/display.rb +2 -1
- data/lib/super/error.rb +3 -0
- data/lib/super/filter/form_object.rb +74 -48
- data/lib/super/filter/guesser.rb +2 -0
- data/lib/super/filter/operator.rb +90 -64
- data/lib/super/filter/schema_types.rb +63 -80
- data/lib/super/filter.rb +1 -1
- data/lib/super/form/builder.rb +30 -39
- data/lib/super/form/field_transcript.rb +43 -0
- data/lib/super/form/guesser.rb +4 -4
- data/lib/super/form/schema_types.rb +66 -22
- data/lib/super/link.rb +2 -2
- data/lib/super/pagination.rb +2 -44
- data/lib/super/reset.rb +25 -0
- data/lib/super/schema.rb +4 -0
- data/lib/super/useful/builder.rb +4 -4
- data/lib/super/version.rb +1 -1
- data/lib/super.rb +3 -1
- data/lib/tasks/super/cheat.rake +1 -1
- metadata +25 -19
- data/app/views/super/application/_filter_type_select.html.erb +0 -21
- data/app/views/super/application/_filter_type_text.html.erb +0 -18
- data/app/views/super/application/_filter_type_timestamp.html.erb +0 -24
- data/app/views/super/application/_form_field_checkbox.html.erb +0 -1
- data/app/views/super/application/_form_field_flatpickr_date.html.erb +0 -8
- data/app/views/super/application/_form_field_flatpickr_datetime.html.erb +0 -8
- data/app/views/super/application/_form_field_flatpickr_time.html.erb +0 -8
- data/app/views/super/application/_form_field_rich_text_area.html.erb +0 -1
- data/app/views/super/application/_form_field_select.html.erb +0 -1
- data/app/views/super/application/_form_field_text.html.erb +0 -1
- data/app/views/super/feather/_chevron_down.html +0 -1
- data/docs/cheat.md +0 -41
- data/lib/super/controls/optional.rb +0 -113
- data/lib/super/controls/steps.rb +0 -106
- data/lib/super/controls/view.rb +0 -55
- data/lib/super/controls.rb +0 -22
@@ -1,9 +1,9 @@
|
|
1
1
|
<header class="flex justify-between content-end">
|
2
2
|
<h1 class="text-xl">
|
3
|
-
<%=
|
3
|
+
<%= title %>
|
4
4
|
</h1>
|
5
5
|
<div>
|
6
|
-
<%
|
6
|
+
<% member_actions(@record).each do |link| %>
|
7
7
|
<%= link.to_s(
|
8
8
|
default_options: {
|
9
9
|
class: "super-button super-button--border-blue super-button-sm inline-block ml-2"
|
@@ -0,0 +1,17 @@
|
|
1
|
+
<header class="pt-4">
|
2
|
+
<h1 class="text-lg font-bold mr-6 mb-1"><%= site_title %></h1>
|
3
|
+
<% site_navigation.definition.each do |link_or_menu| %>
|
4
|
+
<% if link_or_menu.is_a?(Super::Link) %>
|
5
|
+
<%= link_or_menu.to_s(default_options: { class: "inline-block mr-6" }) %>
|
6
|
+
<% else %>
|
7
|
+
<details class="details-reset select-none inline-block mr-6" data-controller="click-outside-to-close" data-action="click@window->click-outside-to-close#close">
|
8
|
+
<summary class="text-blue-700"><%= link_or_menu.title %></summary>
|
9
|
+
<ul class="absolute bg-white shadow-md px-4 py-3">
|
10
|
+
<% link_or_menu.links.each do |link| %>
|
11
|
+
<li><%= link.to_s(default_options: { class: "" }) %></li>
|
12
|
+
<% end %>
|
13
|
+
</ul>
|
14
|
+
</details>
|
15
|
+
<% end %>
|
16
|
+
<% end %>
|
17
|
+
</header>
|
@@ -5,7 +5,7 @@
|
|
5
5
|
:a,
|
6
6
|
sort.sortable_columns,
|
7
7
|
{},
|
8
|
-
{}
|
8
|
+
{ class: "w-full" }
|
9
9
|
) %>
|
10
10
|
</div>
|
11
11
|
<div class="flex-none w-2">
|
@@ -15,7 +15,7 @@
|
|
15
15
|
:d,
|
16
16
|
sort.class::DIRECTIONS,
|
17
17
|
{ include_blank: false },
|
18
|
-
{}
|
18
|
+
{ class: "w-full" }
|
19
19
|
) %>
|
20
20
|
</div>
|
21
21
|
<div class="flex-none pl-2">
|
@@ -0,0 +1,14 @@
|
|
1
|
+
<%=
|
2
|
+
attribute_names = @display.each_attribute_name.to_a
|
3
|
+
|
4
|
+
CSV
|
5
|
+
.generate(write_headers: true, headers: attribute_names) do |csv|
|
6
|
+
@records.each do |record|
|
7
|
+
row = attribute_names.map do |attribute_name|
|
8
|
+
@display.render_attribute(template: self, record: record, column: attribute_name)
|
9
|
+
end
|
10
|
+
csv << row
|
11
|
+
end
|
12
|
+
end
|
13
|
+
.html_safe
|
14
|
+
-%>
|
@@ -1,6 +1,6 @@
|
|
1
|
-
/*! tailwindcss v2.1.
|
1
|
+
/*! tailwindcss v2.1.2 | MIT License | https://tailwindcss.com */
|
2
2
|
|
3
|
-
/*! modern-normalize v1.
|
3
|
+
/*! modern-normalize v1.1.0 | MIT License | https://github.com/sindresorhus/modern-normalize */
|
4
4
|
|
5
5
|
/*
|
6
6
|
Document
|
@@ -12,8 +12,8 @@ Use a better box model (opinionated).
|
|
12
12
|
*/
|
13
13
|
|
14
14
|
*,
|
15
|
-
|
16
|
-
|
15
|
+
::before,
|
16
|
+
::after {
|
17
17
|
box-sizing: border-box;
|
18
18
|
}
|
19
19
|
|
@@ -21,7 +21,7 @@ Use a better box model (opinionated).
|
|
21
21
|
Use a more readable tab size (opinionated).
|
22
22
|
*/
|
23
23
|
|
24
|
-
|
24
|
+
html {
|
25
25
|
-moz-tab-size: 4;
|
26
26
|
-o-tab-size: 4;
|
27
27
|
tab-size: 4;
|
@@ -1475,28 +1475,21 @@ span.flatpickr-day.selected {
|
|
1475
1475
|
.super-input:focus {
|
1476
1476
|
--tw-border-opacity: 1;
|
1477
1477
|
border-color: rgba(99, 179, 237, var(--tw-border-opacity));
|
1478
|
+
outline: 2px solid transparent;
|
1479
|
+
outline-offset: 2px;
|
1478
1480
|
}
|
1479
1481
|
|
1480
|
-
.super-input
|
1481
|
-
|
1482
|
+
.super-input:disabled {
|
1483
|
+
opacity: 0.5;
|
1484
|
+
--tw-bg-opacity: 1;
|
1485
|
+
background-color: rgba(247, 250, 252, var(--tw-bg-opacity));
|
1482
1486
|
}
|
1483
1487
|
|
1484
|
-
.super-input-select
|
1488
|
+
.super-input-select {
|
1485
1489
|
padding-right: 2rem;
|
1486
|
-
|
1487
|
-
|
1488
|
-
|
1489
|
-
.super-input-select-icon {
|
1490
|
-
pointer-events: none;
|
1491
|
-
position: absolute;
|
1492
|
-
top: 0px;
|
1493
|
-
bottom: 0px;
|
1494
|
-
right: 0px;
|
1495
|
-
display: flex;
|
1496
|
-
align-items: center;
|
1497
|
-
padding-left: 0.5rem;
|
1498
|
-
padding-right: 0.5rem;
|
1499
|
-
fill: currentColor;
|
1490
|
+
background-repeat: no-repeat;
|
1491
|
+
background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%232b6cb0' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E %3Cpolyline points='6 9 12 15 18 9'/%3E %3C/svg%3E");
|
1492
|
+
background-position: right 0.5rem center;
|
1500
1493
|
}
|
1501
1494
|
|
1502
1495
|
.super-button {
|
@@ -237,7 +237,7 @@ var Super = (function (exports) {
|
|
237
237
|
|
238
238
|
/*
|
239
239
|
Unobtrusive JavaScript
|
240
|
-
https://github.com/rails/rails/blob/
|
240
|
+
https://github.com/rails/rails/blob/main/actionview/app/assets/javascripts
|
241
241
|
Released under the MIT license
|
242
242
|
*/
|
243
243
|
createCommonjsModule(function (module) {
|
@@ -413,7 +413,7 @@ var Super = (function (exports) {
|
|
413
413
|
}).call(this);
|
414
414
|
(function () {
|
415
415
|
var AcceptHeaders, CSRFProtection, createXHR, cspNonce, prepareOptions, processResponse;
|
416
|
-
cspNonce = Rails.cspNonce, CSRFProtection = Rails.CSRFProtection
|
416
|
+
cspNonce = Rails.cspNonce, CSRFProtection = Rails.CSRFProtection;
|
417
417
|
AcceptHeaders = {
|
418
418
|
'*': '*/*',
|
419
419
|
text: 'text/plain',
|
@@ -489,9 +489,9 @@ var Super = (function (exports) {
|
|
489
489
|
|
490
490
|
if (!options.crossDomain) {
|
491
491
|
xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest');
|
492
|
+
CSRFProtection(xhr);
|
492
493
|
}
|
493
494
|
|
494
|
-
CSRFProtection(xhr);
|
495
495
|
xhr.withCredentials = !!options.withCredentials;
|
496
496
|
|
497
497
|
xhr.onreadystatechange = function () {
|
@@ -3975,7 +3975,7 @@ var Super = (function (exports) {
|
|
3975
3975
|
};
|
3976
3976
|
}
|
3977
3977
|
|
3978
|
-
var _default$
|
3978
|
+
var _default$8 = /*#__PURE__*/function (_Controller) {
|
3979
3979
|
_inherits(_default, _Controller);
|
3980
3980
|
|
3981
3981
|
var _super = _createSuper(_default);
|
@@ -4004,7 +4004,7 @@ var Super = (function (exports) {
|
|
4004
4004
|
return _default;
|
4005
4005
|
}(Controller);
|
4006
4006
|
|
4007
|
-
var _default$
|
4007
|
+
var _default$7 = /*#__PURE__*/function (_Controller) {
|
4008
4008
|
_inherits(_default, _Controller);
|
4009
4009
|
|
4010
4010
|
var _super = _createSuper(_default);
|
@@ -4040,7 +4040,7 @@ var Super = (function (exports) {
|
|
4040
4040
|
return _default;
|
4041
4041
|
}(Controller);
|
4042
4042
|
|
4043
|
-
var _default$
|
4043
|
+
var _default$6 = /*#__PURE__*/function (_Controller) {
|
4044
4044
|
_inherits(_default, _Controller);
|
4045
4045
|
|
4046
4046
|
var _super = _createSuper(_default);
|
@@ -4064,7 +4064,7 @@ var Super = (function (exports) {
|
|
4064
4064
|
return _default;
|
4065
4065
|
}(Controller);
|
4066
4066
|
|
4067
|
-
var _default$
|
4067
|
+
var _default$5 = /*#__PURE__*/function (_Controller) {
|
4068
4068
|
_inherits(_default, _Controller);
|
4069
4069
|
|
4070
4070
|
var _super = _createSuper(_default);
|
@@ -4094,7 +4094,7 @@ var Super = (function (exports) {
|
|
4094
4094
|
return _default;
|
4095
4095
|
}(Controller);
|
4096
4096
|
|
4097
|
-
var _default$
|
4097
|
+
var _default$4 = /*#__PURE__*/function (_Controller) {
|
4098
4098
|
_inherits(_default, _Controller);
|
4099
4099
|
|
4100
4100
|
var _super = _createSuper(_default);
|
@@ -6354,7 +6354,7 @@ var Super = (function (exports) {
|
|
6354
6354
|
window.flatpickr = flatpickr;
|
6355
6355
|
}
|
6356
6356
|
|
6357
|
-
var _default$
|
6357
|
+
var _default$3 = /*#__PURE__*/function (_Controller) {
|
6358
6358
|
_inherits(_default, _Controller);
|
6359
6359
|
|
6360
6360
|
var _super = _createSuper(_default);
|
@@ -6382,6 +6382,137 @@ var Super = (function (exports) {
|
|
6382
6382
|
return _default;
|
6383
6383
|
}(Controller);
|
6384
6384
|
|
6385
|
+
var _default$2 = /*#__PURE__*/function (_Controller) {
|
6386
|
+
_inherits(_default, _Controller);
|
6387
|
+
|
6388
|
+
var _super = _createSuper(_default);
|
6389
|
+
|
6390
|
+
function _default() {
|
6391
|
+
_classCallCheck(this, _default);
|
6392
|
+
|
6393
|
+
return _super.apply(this, arguments);
|
6394
|
+
}
|
6395
|
+
|
6396
|
+
_createClass(_default, [{
|
6397
|
+
key: "connect",
|
6398
|
+
value: function connect() {
|
6399
|
+
var _this = this;
|
6400
|
+
|
6401
|
+
this.tabTargets.forEach(function (tab) {
|
6402
|
+
tab.tabContainer = _this;
|
6403
|
+
});
|
6404
|
+
}
|
6405
|
+
}, {
|
6406
|
+
key: "activeTabIdentifier",
|
6407
|
+
get: function get() {
|
6408
|
+
return this.controlTarget.value;
|
6409
|
+
}
|
6410
|
+
}, {
|
6411
|
+
key: "change",
|
6412
|
+
value: function change(event) {
|
6413
|
+
this.update(event.target.value);
|
6414
|
+
}
|
6415
|
+
}, {
|
6416
|
+
key: "update",
|
6417
|
+
value: function update(newActiveTabIdentifier) {
|
6418
|
+
var _this2 = this;
|
6419
|
+
|
6420
|
+
this.tabTargets.forEach(function (tab) {
|
6421
|
+
var tabController = _this2.application.getControllerForElementAndIdentifier(tab, _this2.tabControllerNameValue);
|
6422
|
+
|
6423
|
+
if (tab.dataset[_this2.tabIdentifierGetterValue] == newActiveTabIdentifier) {
|
6424
|
+
tabController.show();
|
6425
|
+
} else {
|
6426
|
+
tabController.hide();
|
6427
|
+
}
|
6428
|
+
});
|
6429
|
+
}
|
6430
|
+
}], [{
|
6431
|
+
key: "targets",
|
6432
|
+
get: function get() {
|
6433
|
+
return ["control", "tab"];
|
6434
|
+
}
|
6435
|
+
}, {
|
6436
|
+
key: "values",
|
6437
|
+
get: function get() {
|
6438
|
+
return {
|
6439
|
+
tabIdentifierGetter: String,
|
6440
|
+
tabControllerName: String
|
6441
|
+
};
|
6442
|
+
}
|
6443
|
+
}]);
|
6444
|
+
|
6445
|
+
return _default;
|
6446
|
+
}(Controller);
|
6447
|
+
|
6448
|
+
var _default$1 = /*#__PURE__*/function (_Controller) {
|
6449
|
+
_inherits(_default, _Controller);
|
6450
|
+
|
6451
|
+
var _super = _createSuper(_default);
|
6452
|
+
|
6453
|
+
function _default() {
|
6454
|
+
_classCallCheck(this, _default);
|
6455
|
+
|
6456
|
+
return _super.apply(this, arguments);
|
6457
|
+
}
|
6458
|
+
|
6459
|
+
_createClass(_default, [{
|
6460
|
+
key: "connect",
|
6461
|
+
value: function connect() {
|
6462
|
+
var tabContainer = this.element[this.tabContainerGetterValue];
|
6463
|
+
|
6464
|
+
if (tabContainer.activeTabIdentifier === this.identifierValue) {
|
6465
|
+
this.show();
|
6466
|
+
} else {
|
6467
|
+
this.hide();
|
6468
|
+
}
|
6469
|
+
}
|
6470
|
+
}, {
|
6471
|
+
key: "toggle",
|
6472
|
+
value: function toggle() {
|
6473
|
+
if (this.hasContentTarget) {
|
6474
|
+
this.hide();
|
6475
|
+
} else {
|
6476
|
+
this.show();
|
6477
|
+
}
|
6478
|
+
}
|
6479
|
+
}, {
|
6480
|
+
key: "show",
|
6481
|
+
value: function show() {
|
6482
|
+
if (this.hasContentTarget) {
|
6483
|
+
return;
|
6484
|
+
}
|
6485
|
+
|
6486
|
+
var pocketContent = this.pocketTarget.content.cloneNode(true);
|
6487
|
+
this.element.appendChild(pocketContent);
|
6488
|
+
}
|
6489
|
+
}, {
|
6490
|
+
key: "hide",
|
6491
|
+
value: function hide() {
|
6492
|
+
if (!this.hasContentTarget) {
|
6493
|
+
return;
|
6494
|
+
}
|
6495
|
+
|
6496
|
+
this.contentTarget.remove();
|
6497
|
+
}
|
6498
|
+
}], [{
|
6499
|
+
key: "targets",
|
6500
|
+
get: function get() {
|
6501
|
+
return ["pocket", "content"];
|
6502
|
+
}
|
6503
|
+
}, {
|
6504
|
+
key: "values",
|
6505
|
+
get: function get() {
|
6506
|
+
return {
|
6507
|
+
identifier: String,
|
6508
|
+
tabContainerGetter: String
|
6509
|
+
};
|
6510
|
+
}
|
6511
|
+
}]);
|
6512
|
+
|
6513
|
+
return _default;
|
6514
|
+
}(Controller);
|
6515
|
+
|
6385
6516
|
var _default = /*#__PURE__*/function (_Controller) {
|
6386
6517
|
_inherits(_default, _Controller);
|
6387
6518
|
|
@@ -6412,12 +6543,14 @@ var Super = (function (exports) {
|
|
6412
6543
|
}(Controller);
|
6413
6544
|
|
6414
6545
|
var StimulusApplication = Application.start();
|
6415
|
-
StimulusApplication.register("apply-template", _default$
|
6416
|
-
StimulusApplication.register("clean-filter-param", _default$
|
6417
|
-
StimulusApplication.register("clean-filter-params", _default$
|
6418
|
-
StimulusApplication.register("click-outside-to-close", _default$
|
6419
|
-
StimulusApplication.register("delete", _default$
|
6420
|
-
StimulusApplication.register("flatpickr", _default$
|
6546
|
+
StimulusApplication.register("apply-template", _default$8);
|
6547
|
+
StimulusApplication.register("clean-filter-param", _default$7);
|
6548
|
+
StimulusApplication.register("clean-filter-params", _default$6);
|
6549
|
+
StimulusApplication.register("click-outside-to-close", _default$5);
|
6550
|
+
StimulusApplication.register("delete", _default$4);
|
6551
|
+
StimulusApplication.register("flatpickr", _default$3);
|
6552
|
+
StimulusApplication.register("tab-container", _default$2);
|
6553
|
+
StimulusApplication.register("tab", _default$1);
|
6421
6554
|
StimulusApplication.register("toggle-pending-destruction", _default);
|
6422
6555
|
|
6423
6556
|
exports.StimulusApplication = StimulusApplication;
|
@@ -36,22 +36,6 @@ module Super
|
|
36
36
|
create_file("app/controllers/#{controller_namespace}/.keep", "")
|
37
37
|
end
|
38
38
|
|
39
|
-
def copy_cheatsheet
|
40
|
-
super_path = Pathname.new(Gem.loaded_specs["super"].full_gem_path).expand_path
|
41
|
-
super_cheat_path = super_path.join("docs", "cheat.md")
|
42
|
-
|
43
|
-
path =
|
44
|
-
if options["controller_namespace"].present?
|
45
|
-
"app/controllers/#{controller_namespace}/README.md"
|
46
|
-
else
|
47
|
-
"app/controllers/README.md"
|
48
|
-
end
|
49
|
-
|
50
|
-
create_file(path) do
|
51
|
-
super_cheat_path.read.sub(%r{<!--.*?-->}m, "").strip + "\n"
|
52
|
-
end
|
53
|
-
end
|
54
|
-
|
55
39
|
def setup_sprockets4_manifest
|
56
40
|
append_to_file "app/assets/config/manifest.js", "//= link super_manifest.js\n"
|
57
41
|
end
|
@@ -1,9 +1,9 @@
|
|
1
1
|
<% module_namespacing do -%>
|
2
2
|
class <%= controller_class_name %>Controller < <%= parent_controller_name.classify %>Controller
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
3
|
+
private
|
4
|
+
|
5
|
+
def model
|
6
|
+
<%= class_name %>
|
7
7
|
end
|
8
8
|
end
|
9
9
|
<% end -%>
|