swop 0.1.1 → 1.0.1
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 +47 -9
- data/app/assets/images/swop/favicon.ico +0 -0
- data/app/assets/stylesheets/rails_admin/application.scss.erb +11 -20
- data/app/assets/stylesheets/{rails_admin/themes/base/base.scss → swop/swop-base/swop-base.scss} +1 -5
- data/app/assets/stylesheets/swop/swop-base/swop-typography.scss +11 -0
- data/app/assets/stylesheets/swop/swop-colors/swop-colors.scss +2 -0
- data/app/assets/stylesheets/swop/swop-core/swop-bootstrap-variables.scss +172 -0
- data/app/assets/stylesheets/swop/swop-core/swop-variables.scss +34 -0
- data/app/assets/stylesheets/swop/swop-themes/swop-simple/swop-base/swop-base.scss +3 -0
- data/app/assets/stylesheets/swop/swop-themes/swop-simple/swop-base/swop-main.scss +25 -0
- data/app/assets/stylesheets/swop/swop-themes/swop-simple/swop-base/swop-typography.scss +4 -0
- data/app/assets/stylesheets/swop/swop-themes/swop-simple/swop-colors/swop-amethyst.scss +29 -0
- data/app/assets/stylesheets/swop/swop-themes/swop-simple/swop-colors/swop-dark.scss +29 -0
- data/app/assets/stylesheets/swop/swop-themes/swop-simple/swop-colors/swop-forest.scss +29 -0
- data/app/assets/stylesheets/swop/swop-themes/swop-simple/swop-colors/swop-light.scss +29 -0
- data/app/assets/stylesheets/swop/swop-themes/swop-simple/swop-colors/swop-royal.scss +29 -0
- data/app/assets/stylesheets/swop/swop-themes/swop-simple/swop-components/swop-alerts.scss +12 -0
- data/app/assets/stylesheets/swop/swop-themes/swop-simple/swop-components/swop-badges.scss +31 -0
- data/app/assets/stylesheets/swop/swop-themes/swop-simple/swop-components/swop-buttons.scss +133 -0
- data/app/assets/stylesheets/swop/swop-themes/swop-simple/swop-components/swop-dropdowns.scss +26 -0
- data/app/assets/stylesheets/swop/swop-themes/swop-simple/swop-components/swop-filters.scss +57 -0
- data/app/assets/stylesheets/swop/swop-themes/swop-simple/swop-components/swop-forms.scss +158 -0
- data/app/assets/stylesheets/swop/swop-themes/swop-simple/swop-components/swop-images.scss +31 -0
- data/app/assets/stylesheets/swop/swop-themes/swop-simple/swop-components/swop-input-groups.scss +18 -0
- data/app/assets/stylesheets/swop/swop-themes/swop-simple/swop-components/swop-loading.scss +14 -0
- data/app/assets/stylesheets/swop/swop-themes/swop-simple/swop-components/swop-navbar.scss +15 -0
- data/app/assets/stylesheets/swop/swop-themes/swop-simple/swop-components/swop-navs.scss +77 -0
- data/app/assets/stylesheets/swop/swop-themes/swop-simple/swop-components/swop-offcanvas.scss +64 -0
- data/app/assets/stylesheets/swop/swop-themes/swop-simple/swop-components/swop-pagination.scss +21 -0
- data/app/assets/stylesheets/swop/swop-themes/swop-simple/swop-components/swop-progress.scss +3 -0
- data/app/assets/stylesheets/swop/swop-themes/swop-simple/swop-components/swop-sidebars.scss +49 -0
- data/app/assets/stylesheets/swop/swop-themes/swop-simple/swop-components/swop-tables.scss +82 -0
- data/app/assets/stylesheets/swop/swop-themes/swop-simple/swop-components/swop-tiles.scss +20 -0
- data/app/assets/stylesheets/swop/swop-themes/swop-simple/swop-core/swop-bootstrap-variables.scss +149 -0
- data/app/assets/stylesheets/swop/swop-themes/swop-simple/swop-core/swop-variables.scss +41 -0
- data/app/assets/stylesheets/{rails_admin/themes/simple/components/containers.scss → swop/swop-themes/swop-simple/swop-layouts/swop-containers.scss} +9 -0
- data/app/assets/stylesheets/swop/swop-themes/swop-simple/swop-layouts/swop-header.scss +15 -0
- data/app/assets/stylesheets/swop/swop-themes/swop-simple/swop-simple-amethyst.scss +35 -0
- data/app/assets/stylesheets/swop/swop-themes/swop-simple/swop-simple-base.scss +3 -0
- data/app/assets/stylesheets/swop/swop-themes/swop-simple/swop-simple-components.scss +17 -0
- data/app/assets/stylesheets/swop/swop-themes/swop-simple/swop-simple-dark.scss +35 -0
- data/app/assets/stylesheets/swop/swop-themes/swop-simple/swop-simple-forest.scss +35 -0
- data/app/assets/stylesheets/swop/swop-themes/swop-simple/swop-simple-layouts.scss +2 -0
- data/app/assets/stylesheets/swop/swop-themes/swop-simple/swop-simple-light.scss +35 -0
- data/app/assets/stylesheets/swop/swop-themes/swop-simple/swop-simple-royal.scss +35 -0
- data/app/assets/stylesheets/swop/swop.scss +8 -0
- data/app/views/kaminari/ra-twitter-bootstrap/_next_page.html.erb +7 -0
- data/app/views/kaminari/ra-twitter-bootstrap/_prev_page.html.erb +5 -0
- data/app/views/kaminari/ra-twitter-bootstrap/default/_next_page.html.erb +9 -0
- data/app/views/kaminari/ra-twitter-bootstrap/default/_prev_page.html.erb +9 -0
- data/app/views/kaminari/ra-twitter-bootstrap/swop-simple/_next_page.html.erb +9 -0
- data/app/views/kaminari/ra-twitter-bootstrap/swop-simple/_prev_page.html.erb +9 -0
- data/app/views/layouts/rails_admin/_head.html.erb +5 -32
- data/app/views/layouts/rails_admin/_sidebar_navigation.html.erb +5 -3
- data/app/views/layouts/rails_admin/application.html.erb +5 -27
- data/app/views/layouts/rails_admin/content.html.erb +4 -11
- data/app/views/layouts/rails_admin/default/_application.html.erb +27 -0
- data/app/views/layouts/rails_admin/default/_content.html.erb +22 -0
- data/app/views/layouts/rails_admin/default/_head.html.erb +32 -0
- data/app/views/layouts/rails_admin/default/_sidebar_navigation.html.erb +5 -0
- data/app/views/layouts/rails_admin/swop-simple/_application.html.erb +17 -0
- data/app/views/layouts/rails_admin/swop-simple/_content.html.erb +41 -0
- data/app/views/layouts/rails_admin/swop-simple/_head.html.erb +42 -0
- data/app/views/layouts/rails_admin/swop-simple/_sidebar_navigation.html.erb +12 -0
- data/app/views/rails_admin/main/_delete_notice.html.erb +7 -0
- data/app/views/rails_admin/main/default/_delete.html.erb +21 -0
- data/app/views/rails_admin/main/default/_delete_notice.html.erb +34 -0
- data/app/views/rails_admin/main/default/_edit.html.erb +3 -0
- data/app/views/rails_admin/main/default/_export.html.erb +149 -0
- data/app/views/rails_admin/main/default/_history.html.erb +80 -0
- data/app/views/rails_admin/main/default/_index.html.erb +184 -0
- data/app/views/rails_admin/main/default/_new.html.erb +3 -0
- data/app/views/rails_admin/main/default/_show.html.erb +30 -0
- data/app/views/rails_admin/main/delete.html.erb +5 -0
- data/app/views/rails_admin/main/edit.html.erb +5 -0
- data/app/views/rails_admin/main/export.html.erb +5 -128
- data/app/views/rails_admin/main/history.html.erb +4 -86
- data/app/views/rails_admin/main/index.html.erb +4 -173
- data/app/views/rails_admin/main/new.html.erb +5 -0
- data/app/views/rails_admin/main/show.html.erb +5 -20
- data/app/views/rails_admin/main/swop-simple/_delete.html.erb +11 -0
- data/app/views/rails_admin/main/swop-simple/_delete_notice.html.erb +23 -0
- data/app/views/rails_admin/main/swop-simple/_edit.html.erb +3 -0
- data/app/views/rails_admin/main/swop-simple/_export.html.erb +90 -0
- data/app/views/rails_admin/main/swop-simple/_history.html.erb +80 -0
- data/app/views/rails_admin/main/swop-simple/_index.html.erb +169 -0
- data/app/views/rails_admin/main/swop-simple/_new.html.erb +3 -0
- data/app/views/rails_admin/main/swop-simple/_show.html.erb +18 -0
- data/lib/swop/engine.rb +8 -3
- data/lib/swop/railtie.rb +7 -0
- data/lib/swop/version.rb +1 -1
- data/lib/swop.rb +20 -2
- metadata +102 -98
- data/CHANGELOG.md +0 -5
- data/CODE_OF_CONDUCT.md +0 -132
- data/LICENSE +0 -201
- data/Rakefile +0 -4
- data/app/assets/javascripts/rails_admin/application.js.erb +0 -33
- data/app/assets/javascripts/rails_admin/custom/abstract-select.js +0 -30
- data/app/assets/javascripts/rails_admin/custom/filter-box.js +0 -363
- data/app/assets/javascripts/rails_admin/custom/filtering-multiselect.js +0 -387
- data/app/assets/javascripts/rails_admin/custom/filtering-select.js +0 -304
- data/app/assets/stylesheets/rails_admin/themes/base/bootstrap-variables.scss +0 -252
- data/app/assets/stylesheets/rails_admin/themes/base/theming.scss +0 -22
- data/app/assets/stylesheets/rails_admin/themes/base/variables.scss +0 -71
- data/app/assets/stylesheets/rails_admin/themes/simple/base/typography.scss +0 -22
- data/app/assets/stylesheets/rails_admin/themes/simple/base/variables-dark.scss +0 -74
- data/app/assets/stylesheets/rails_admin/themes/simple/base/variables-light.scss +0 -77
- data/app/assets/stylesheets/rails_admin/themes/simple/base/variables-navy.scss +0 -74
- data/app/assets/stylesheets/rails_admin/themes/simple/base/variables.scss +0 -129
- data/app/assets/stylesheets/rails_admin/themes/simple/components/alerts.scss +0 -88
- data/app/assets/stylesheets/rails_admin/themes/simple/components/breadcrumbs.scss +0 -44
- data/app/assets/stylesheets/rails_admin/themes/simple/components/buttons.scss +0 -138
- data/app/assets/stylesheets/rails_admin/themes/simple/components/dropdowns.scss +0 -12
- data/app/assets/stylesheets/rails_admin/themes/simple/components/filter-box.scss +0 -8
- data/app/assets/stylesheets/rails_admin/themes/simple/components/filtering-multiselect.scss +0 -40
- data/app/assets/stylesheets/rails_admin/themes/simple/components/filtering-select.scss +0 -42
- data/app/assets/stylesheets/rails_admin/themes/simple/components/forms.scss +0 -27
- data/app/assets/stylesheets/rails_admin/themes/simple/components/images.scss +0 -19
- data/app/assets/stylesheets/rails_admin/themes/simple/components/links.scss +0 -25
- data/app/assets/stylesheets/rails_admin/themes/simple/components/navs.scss +0 -73
- data/app/assets/stylesheets/rails_admin/themes/simple/components/progress.scss +0 -4
- data/app/assets/stylesheets/rails_admin/themes/simple/components/sidebar.scss +0 -84
- data/app/assets/stylesheets/rails_admin/themes/simple/components/tables.scss +0 -84
- data/app/assets/stylesheets/rails_admin/themes/simple/layouts/rows.scss +0 -34
- data/app/assets/stylesheets/rails_admin/themes/simple/light/components/links.scss +0 -15
- data/app/assets/stylesheets/rails_admin/themes/simple/light/components/sidebar.scss +0 -25
- data/app/assets/stylesheets/rails_admin/themes/simple.scss.erb +0 -37
- data/app/helpers/rails_admin/application_helper.rb +0 -258
- data/app/helpers/rails_admin/form_builder.rb +0 -166
- data/app/views/layouts/rails_admin/_custom_navigation.html.erb +0 -10
- data/app/views/layouts/rails_admin/_header.html.erb +0 -43
- data/app/views/rails_admin/main/_form_polymorphic_association.html.erb +0 -15
- data/app/views/rails_admin/main/_submit_buttons.html.erb +0 -29
- data/app/views/rails_admin/main/dashboard.html.erb +0 -64
- data/config/locales/rails_admin.en.yml +0 -158
- data/sig/swop.rbs +0 -4
- /data/app/assets/stylesheets/{rails_admin/themes/base/mixins.scss → swop/swop-core/swop-mixins.scss} +0 -0
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import jQuery from "jquery";
|
|
2
|
-
import "jquery-ui/ui/widget.js";
|
|
3
|
-
|
|
4
|
-
(function ($) {
|
|
5
|
-
"use strict";
|
|
6
|
-
|
|
7
|
-
$.widget("ra.abstractSelect", {
|
|
8
|
-
options: {
|
|
9
|
-
createQuery: function (query) {
|
|
10
|
-
if ($.isEmptyObject(this.scopeBy)) {
|
|
11
|
-
return { query: query };
|
|
12
|
-
} else {
|
|
13
|
-
const filterQuery = {};
|
|
14
|
-
for (var field in this.scopeBy) {
|
|
15
|
-
const targetField = this.scopeBy[field];
|
|
16
|
-
const targetValue = $(`[name$="[${field}]"]`).val();
|
|
17
|
-
if (!filterQuery[targetField]) {
|
|
18
|
-
filterQuery[targetField] = [];
|
|
19
|
-
}
|
|
20
|
-
filterQuery[targetField].push(
|
|
21
|
-
targetValue ? { o: "is", v: targetValue } : { o: "_blank" }
|
|
22
|
-
);
|
|
23
|
-
}
|
|
24
|
-
return { query: query, f: filterQuery };
|
|
25
|
-
}
|
|
26
|
-
},
|
|
27
|
-
scopeBy: {},
|
|
28
|
-
},
|
|
29
|
-
});
|
|
30
|
-
})(jQuery);
|
|
@@ -1,363 +0,0 @@
|
|
|
1
|
-
import jQuery from "jquery";
|
|
2
|
-
import I18n from "./i18n";
|
|
3
|
-
import flatpickr from "flatpickr";
|
|
4
|
-
|
|
5
|
-
(function ($) {
|
|
6
|
-
var filters;
|
|
7
|
-
|
|
8
|
-
$.filters = filters = {
|
|
9
|
-
append: function (options) {
|
|
10
|
-
var field_label = options["label"];
|
|
11
|
-
var field_name = options["name"];
|
|
12
|
-
var field_type = options["type"];
|
|
13
|
-
var field_value = options["value"] || "";
|
|
14
|
-
var field_operator = options["operator"];
|
|
15
|
-
var operators = options["operators"];
|
|
16
|
-
var index = options["index"];
|
|
17
|
-
var value_name = "f[" + field_name + "][" + index + "][v]";
|
|
18
|
-
var operator_name = "f[" + field_name + "][" + index + "][o]";
|
|
19
|
-
var control = null;
|
|
20
|
-
var additional_control = null;
|
|
21
|
-
|
|
22
|
-
if (operators.length > 0) {
|
|
23
|
-
control = $(
|
|
24
|
-
'<select class="form-control form-select form-select-sm"></select>'
|
|
25
|
-
).prop("name", operator_name);
|
|
26
|
-
|
|
27
|
-
operators.forEach((operator) => {
|
|
28
|
-
var element = this.build_operator(operator, options);
|
|
29
|
-
if (!element) {
|
|
30
|
-
return;
|
|
31
|
-
}
|
|
32
|
-
if (element.prop("value") === field_operator) {
|
|
33
|
-
element.prop("selected", true);
|
|
34
|
-
}
|
|
35
|
-
control.append(element);
|
|
36
|
-
});
|
|
37
|
-
|
|
38
|
-
if (control.find("[data-additional-fieldset]").length > 0) {
|
|
39
|
-
control.addClass("switch-additional-fieldsets");
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
switch (field_type) {
|
|
44
|
-
case "boolean":
|
|
45
|
-
control &&
|
|
46
|
-
control
|
|
47
|
-
.prop("name", value_name)
|
|
48
|
-
.find("option")
|
|
49
|
-
.each(function () {
|
|
50
|
-
if ($(this).attr("value") === field_value)
|
|
51
|
-
$(this).attr("selected", true);
|
|
52
|
-
});
|
|
53
|
-
break;
|
|
54
|
-
case "date":
|
|
55
|
-
case "datetime":
|
|
56
|
-
case "timestamp":
|
|
57
|
-
case "time":
|
|
58
|
-
additional_control = $.map(
|
|
59
|
-
[undefined, "-∞", "∞"],
|
|
60
|
-
function (placeholder, index) {
|
|
61
|
-
var visible =
|
|
62
|
-
index == 0
|
|
63
|
-
? !field_operator || field_operator == "default"
|
|
64
|
-
: field_operator == "between";
|
|
65
|
-
return $('<span class="additional-fieldset"></span>')
|
|
66
|
-
.addClass(index == 0 ? "default" : "between")
|
|
67
|
-
.css("display", visible ? "inline-block" : "none")
|
|
68
|
-
.html(
|
|
69
|
-
$(
|
|
70
|
-
'<input class="input-sm form-control form-control-sm" type="text" />'
|
|
71
|
-
)
|
|
72
|
-
.addClass(field_type == "date" ? "date" : "datetime")
|
|
73
|
-
.prop("name", value_name + "[]")
|
|
74
|
-
.prop("value", field_value[index] || "")
|
|
75
|
-
.prop(
|
|
76
|
-
"size",
|
|
77
|
-
field_type == "date" || field_type == "time" ? 20 : 25
|
|
78
|
-
)
|
|
79
|
-
.prop("placeholder", placeholder)
|
|
80
|
-
);
|
|
81
|
-
}
|
|
82
|
-
);
|
|
83
|
-
break;
|
|
84
|
-
case "enum":
|
|
85
|
-
if (control) {
|
|
86
|
-
var multiple = field_value instanceof Array;
|
|
87
|
-
control = control
|
|
88
|
-
.prop("name", multiple ? value_name + "[]" : value_name)
|
|
89
|
-
.prop("multiple", multiple)
|
|
90
|
-
.add(
|
|
91
|
-
$('<a href="#" class="switch-select"></a>').append(
|
|
92
|
-
$("<i></i>").addClass(
|
|
93
|
-
"fas fa-" + (multiple ? "minus" : "plus")
|
|
94
|
-
)
|
|
95
|
-
)
|
|
96
|
-
);
|
|
97
|
-
control.find("option").each(function () {
|
|
98
|
-
const value = $(this).attr("value");
|
|
99
|
-
if (
|
|
100
|
-
multiple ? field_value.includes(value) : value === field_value
|
|
101
|
-
)
|
|
102
|
-
$(this).attr("selected", true);
|
|
103
|
-
});
|
|
104
|
-
if (multiple)
|
|
105
|
-
control.find("option[value^=_],option[disabled]").hide();
|
|
106
|
-
}
|
|
107
|
-
break;
|
|
108
|
-
case "citext":
|
|
109
|
-
case "string":
|
|
110
|
-
case "text":
|
|
111
|
-
case "belongs_to_association":
|
|
112
|
-
case "has_one_association":
|
|
113
|
-
additional_control = $(
|
|
114
|
-
'<input class="additional-fieldset form-control form-control-sm" type="text" />'
|
|
115
|
-
)
|
|
116
|
-
.css(
|
|
117
|
-
"display",
|
|
118
|
-
field_operator == "_present" || field_operator == "_blank"
|
|
119
|
-
? "none"
|
|
120
|
-
: "inline-block"
|
|
121
|
-
)
|
|
122
|
-
.prop("name", value_name)
|
|
123
|
-
.prop("value", field_value);
|
|
124
|
-
break;
|
|
125
|
-
case "integer":
|
|
126
|
-
case "decimal":
|
|
127
|
-
case "float":
|
|
128
|
-
additional_control = $(
|
|
129
|
-
'<input class="additional-fieldset default form-control form-control-sm" type="text" />'
|
|
130
|
-
)
|
|
131
|
-
.css(
|
|
132
|
-
"display",
|
|
133
|
-
!field_operator || field_operator == "default"
|
|
134
|
-
? "inline-block"
|
|
135
|
-
: "none"
|
|
136
|
-
)
|
|
137
|
-
.prop("type", field_type)
|
|
138
|
-
.prop("name", value_name + "[]")
|
|
139
|
-
.prop("value", field_value[0] || "")
|
|
140
|
-
.add(
|
|
141
|
-
$(
|
|
142
|
-
'<input placeholder="-∞" class="additional-fieldset between form-control form-control-sm" />'
|
|
143
|
-
)
|
|
144
|
-
.css(
|
|
145
|
-
"display",
|
|
146
|
-
field_operator == "between" ? "inline-block" : "none"
|
|
147
|
-
)
|
|
148
|
-
.prop("type", field_type)
|
|
149
|
-
.prop("name", value_name + "[]")
|
|
150
|
-
.prop("value", field_value[1] || "")
|
|
151
|
-
)
|
|
152
|
-
.add(
|
|
153
|
-
$(
|
|
154
|
-
'<input placeholder="∞" class="additional-fieldset between form-control form-control-sm" />'
|
|
155
|
-
)
|
|
156
|
-
.css(
|
|
157
|
-
"display",
|
|
158
|
-
field_operator == "between" ? "inline-block" : "none"
|
|
159
|
-
)
|
|
160
|
-
.prop("type", field_type)
|
|
161
|
-
.prop("name", value_name + "[]")
|
|
162
|
-
.prop("value", field_value[2] || "")
|
|
163
|
-
);
|
|
164
|
-
break;
|
|
165
|
-
default:
|
|
166
|
-
control = $(
|
|
167
|
-
'<input type="text" class="form-control form-control-sm" />'
|
|
168
|
-
)
|
|
169
|
-
.prop("name", value_name)
|
|
170
|
-
.prop("value", field_value);
|
|
171
|
-
break;
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
var filterContainerId = field_name + "-" + index + "-filter-container";
|
|
175
|
-
$("#" + filterContainerId).remove();
|
|
176
|
-
|
|
177
|
-
var $content = $("<div>")
|
|
178
|
-
.attr("id", filterContainerId)
|
|
179
|
-
.addClass("filter d-flex align-items-center gap-3 mb-3")
|
|
180
|
-
.append(
|
|
181
|
-
$(
|
|
182
|
-
"<div></div>"
|
|
183
|
-
)
|
|
184
|
-
.append(document.createTextNode(field_label))
|
|
185
|
-
)
|
|
186
|
-
.append(control)
|
|
187
|
-
.append(additional_control)
|
|
188
|
-
.append(
|
|
189
|
-
$(
|
|
190
|
-
'<button type="button" class="btn btn-white btn-sm delete"></button>'
|
|
191
|
-
)
|
|
192
|
-
.append('<i class="fas fa-times"></i>')
|
|
193
|
-
);
|
|
194
|
-
|
|
195
|
-
$("#filters_box").append($content);
|
|
196
|
-
|
|
197
|
-
$content.find(".date, .datetime").each(function () {
|
|
198
|
-
flatpickr(
|
|
199
|
-
this,
|
|
200
|
-
$.extend(
|
|
201
|
-
{
|
|
202
|
-
dateFormat: "Y-m-dTH:i:S",
|
|
203
|
-
altInput: true,
|
|
204
|
-
locale: I18n.locale,
|
|
205
|
-
},
|
|
206
|
-
options["datetimepicker_options"]
|
|
207
|
-
)
|
|
208
|
-
);
|
|
209
|
-
});
|
|
210
|
-
|
|
211
|
-
$("hr.filters_box:hidden").show("slow");
|
|
212
|
-
},
|
|
213
|
-
build_operator: function (operator, options) {
|
|
214
|
-
if (operator instanceof Object) {
|
|
215
|
-
var element = $("<option></option>");
|
|
216
|
-
element.text(operator.label);
|
|
217
|
-
delete operator.label;
|
|
218
|
-
for (const key in operator) {
|
|
219
|
-
element.attr(key, operator[key]);
|
|
220
|
-
}
|
|
221
|
-
return element;
|
|
222
|
-
}
|
|
223
|
-
switch (operator) {
|
|
224
|
-
case "_discard":
|
|
225
|
-
return $('<option value="_discard">...</option>');
|
|
226
|
-
case "_separator":
|
|
227
|
-
return $('<option disabled="disabled">---------</option>');
|
|
228
|
-
case "_present":
|
|
229
|
-
return $('<option value="_present"></option>').text(
|
|
230
|
-
I18n.t("is_present")
|
|
231
|
-
);
|
|
232
|
-
case "_blank":
|
|
233
|
-
return $('<option value="_blank"></option>').text(I18n.t("is_blank"));
|
|
234
|
-
case "_not_null":
|
|
235
|
-
return $('<option value="_not_null"></option>').text(
|
|
236
|
-
I18n.t("is_present")
|
|
237
|
-
);
|
|
238
|
-
case "_null":
|
|
239
|
-
return $('<option value="_null"></option>').text(I18n.t("is_blank"));
|
|
240
|
-
|
|
241
|
-
case "true":
|
|
242
|
-
return $('<option value="true"></option>').text(I18n.t("true"));
|
|
243
|
-
case "false":
|
|
244
|
-
return $('<option value="false"></option>').text(I18n.t("false"));
|
|
245
|
-
|
|
246
|
-
case "today":
|
|
247
|
-
return $('<option value="today"></option>').text(I18n.t("today"));
|
|
248
|
-
case "yesterday":
|
|
249
|
-
return $('<option value="yesterday"></option>').text(
|
|
250
|
-
I18n.t("yesterday")
|
|
251
|
-
);
|
|
252
|
-
case "this_week":
|
|
253
|
-
return $('<option value="this_week"></option>').text(
|
|
254
|
-
I18n.t("this_week")
|
|
255
|
-
);
|
|
256
|
-
case "last_week":
|
|
257
|
-
return $('<option value="last_week"></option>').text(
|
|
258
|
-
I18n.t("last_week")
|
|
259
|
-
);
|
|
260
|
-
|
|
261
|
-
case "like":
|
|
262
|
-
return $(
|
|
263
|
-
'<option data-additional-fieldset="additional-fieldset" value="like"></option>'
|
|
264
|
-
).text(I18n.t("contains"));
|
|
265
|
-
case "not_like":
|
|
266
|
-
return $(
|
|
267
|
-
'<option data-additional-fieldset="additional-fieldset" value="not_like"></option>'
|
|
268
|
-
).text(I18n.t("does_not_contain"));
|
|
269
|
-
case "is":
|
|
270
|
-
return $(
|
|
271
|
-
'<option data-additional-fieldset="additional-fieldset" value="is"></option>'
|
|
272
|
-
).text(I18n.t("is_exactly"));
|
|
273
|
-
case "starts_with":
|
|
274
|
-
return $(
|
|
275
|
-
'<option data-additional-fieldset="additional-fieldset" value="starts_with"></option>'
|
|
276
|
-
).text(I18n.t("starts_with"));
|
|
277
|
-
case "ends_with":
|
|
278
|
-
return $(
|
|
279
|
-
'<option data-additional-fieldset="additional-fieldset" value="ends_with"></option>'
|
|
280
|
-
).text(I18n.t("ends_with"));
|
|
281
|
-
|
|
282
|
-
case "default":
|
|
283
|
-
var label;
|
|
284
|
-
switch (options.type) {
|
|
285
|
-
case "date":
|
|
286
|
-
case "datetime":
|
|
287
|
-
case "timestamp":
|
|
288
|
-
label = I18n.t("date");
|
|
289
|
-
break;
|
|
290
|
-
case "time":
|
|
291
|
-
label = I18n.t("time");
|
|
292
|
-
break;
|
|
293
|
-
case "integer":
|
|
294
|
-
case "decimal":
|
|
295
|
-
case "float":
|
|
296
|
-
label = I18n.t("number");
|
|
297
|
-
break;
|
|
298
|
-
}
|
|
299
|
-
return $(
|
|
300
|
-
'<option data-additional-fieldset="default" value="default"></option>'
|
|
301
|
-
).text(label);
|
|
302
|
-
case "between":
|
|
303
|
-
return $(
|
|
304
|
-
'<option data-additional-fieldset="between" value="between"></option>'
|
|
305
|
-
).text(I18n.t("between_and_"));
|
|
306
|
-
|
|
307
|
-
default:
|
|
308
|
-
return null;
|
|
309
|
-
}
|
|
310
|
-
},
|
|
311
|
-
};
|
|
312
|
-
|
|
313
|
-
$(document).on("click", "#filters a", function (e) {
|
|
314
|
-
e.preventDefault();
|
|
315
|
-
$.filters.append(
|
|
316
|
-
$.extend(
|
|
317
|
-
{ index: $.now().toString().slice(6, 11) },
|
|
318
|
-
$(this).data("options")
|
|
319
|
-
)
|
|
320
|
-
);
|
|
321
|
-
});
|
|
322
|
-
|
|
323
|
-
$(document).on("click", "#filters_box .delete", function (e) {
|
|
324
|
-
e.preventDefault();
|
|
325
|
-
var form = $(this).parents("form");
|
|
326
|
-
$(this).parents(".filter").remove();
|
|
327
|
-
!$("#filters_box").children().length &&
|
|
328
|
-
$("hr.filters_box:visible").hide("slow");
|
|
329
|
-
});
|
|
330
|
-
|
|
331
|
-
$(document).on("click", "#filters_box .switch-select", function (e) {
|
|
332
|
-
e.preventDefault();
|
|
333
|
-
var select = $(this).siblings("select");
|
|
334
|
-
select.attr("multiple", !select.attr("multiple"));
|
|
335
|
-
select.attr(
|
|
336
|
-
"name",
|
|
337
|
-
select.attr("multiple")
|
|
338
|
-
? select.attr("name") + "[]"
|
|
339
|
-
: select.attr("name").replace(/\[\]$/, "")
|
|
340
|
-
);
|
|
341
|
-
select.find("option[value^=_],option[disabled]").toggle();
|
|
342
|
-
$(this).find("i").toggleClass("fa-plus fa-minus");
|
|
343
|
-
});
|
|
344
|
-
|
|
345
|
-
$(document).on(
|
|
346
|
-
"change",
|
|
347
|
-
"#filters_box .switch-additional-fieldsets",
|
|
348
|
-
function (e) {
|
|
349
|
-
var selected_option = $(this).find("option:selected");
|
|
350
|
-
var klass = $(selected_option).data("additional-fieldset");
|
|
351
|
-
if (klass) {
|
|
352
|
-
$(this)
|
|
353
|
-
.siblings(".additional-fieldset:not(." + klass + ")")
|
|
354
|
-
.hide("slow");
|
|
355
|
-
$(this)
|
|
356
|
-
.siblings("." + klass)
|
|
357
|
-
.show("slow");
|
|
358
|
-
} else {
|
|
359
|
-
$(this).siblings(".additional-fieldset").hide("slow");
|
|
360
|
-
}
|
|
361
|
-
}
|
|
362
|
-
);
|
|
363
|
-
})(jQuery);
|