cm-admin 3.0.15 → 3.0.16
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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f3debddacbd593b7ae649770a5237ea0af2f7c3481cfdb75f93adf833345c702
|
4
|
+
data.tar.gz: f2d63c47f670a66b78241fa45398edfac023c36acc89d079065734319e72bccd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7d04f7523d8e25ef11d45025a4e8adbb3f583c4d1c5b8e353cd30a7f0d055a79280cfe081a1120721f83377476ba074334d9ec01e822595b372e1c78f2c64217
|
7
|
+
data.tar.gz: 76b3873cc8a0bea1c6ec2bd435538c9e06304310000a77d7380e2fc9bbb46232734a6d1881ccb566ca7aa135679606dea7b374777b292092f1747a2736cc8adc
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
import * as bootstrap from "bootstrap";
|
2
2
|
window.bootstrap = bootstrap;
|
3
3
|
|
4
|
-
|
4
|
+
export function handleFetchModalClick() {
|
5
5
|
$('[data-action="fetch-modal"]').on("click", function (e) {
|
6
6
|
const actionName = $(this).attr("data-action_name");
|
7
7
|
const modelName = $(this).attr("data-model_name");
|
@@ -27,4 +27,8 @@ document.addEventListener("turbo:load", function () {
|
|
27
27
|
},
|
28
28
|
});
|
29
29
|
});
|
30
|
+
}
|
31
|
+
|
32
|
+
document.addEventListener("turbo:load", function () {
|
33
|
+
handleFetchModalClick();
|
30
34
|
});
|
@@ -1,3 +1,5 @@
|
|
1
|
+
import { handleFetchModalClick } from "./custom_action";
|
2
|
+
|
1
3
|
var currentRequest = null;
|
2
4
|
|
3
5
|
var CmFilter = {
|
@@ -123,6 +125,7 @@ var getFilteredData = function (
|
|
123
125
|
dropdown.show();
|
124
126
|
}
|
125
127
|
}
|
128
|
+
handleFetchModalClick();
|
126
129
|
},
|
127
130
|
error: function (jqxhr, textStatus, errorThrown) {
|
128
131
|
console.log(errorThrown, textStatus);
|
@@ -0,0 +1,53 @@
|
|
1
|
+
# Custom Filter Method
|
2
|
+
|
3
|
+
## Overview
|
4
|
+
|
5
|
+
We can add a custom filter method to filter records based on specific criteria. This is useful when the default filtering options do not meet the requirements. The custom filter method can be defined using the `filter_with` option.
|
6
|
+
|
7
|
+
## Usage
|
8
|
+
|
9
|
+
The custom filter method is implemented using the `filter` dsl_method with the `filter_with` option. Below are the key elements and their usage:
|
10
|
+
|
11
|
+
### Syntax
|
12
|
+
|
13
|
+
```ruby
|
14
|
+
filter :filter_name, :filter_type, filter_with: :custom_filter_method
|
15
|
+
```
|
16
|
+
|
17
|
+
### Example
|
18
|
+
|
19
|
+
**1. For Search and Select:**
|
20
|
+
|
21
|
+
Define the custom filter method in your model:
|
22
|
+
|
23
|
+
```ruby
|
24
|
+
class YourModel < ApplicationRecord
|
25
|
+
scope :custom_filter_method, ->(value) { where('column_name LIKE ?', "%#{value}%") }
|
26
|
+
end
|
27
|
+
```
|
28
|
+
|
29
|
+
Use the custom filter method in your cm admin:
|
30
|
+
|
31
|
+
```ruby
|
32
|
+
filter :filter_name, :search, filter_with: :custom_filter_method
|
33
|
+
```
|
34
|
+
|
35
|
+
```ruby
|
36
|
+
filter :filter_name, :single_select, helper_method: :options_for_select, filter_with: :custom_filter_method
|
37
|
+
```
|
38
|
+
|
39
|
+
**2. For Date and Range:**
|
40
|
+
|
41
|
+
Define the custom filter method in your model:
|
42
|
+
|
43
|
+
```ruby
|
44
|
+
class YourModel < ApplicationRecord
|
45
|
+
scope :custom_filter_method, ->(from, to) { where('column_name BETWEEN ? AND ?', from, to) }
|
46
|
+
end
|
47
|
+
```
|
48
|
+
|
49
|
+
Use the custom filter method in your cm admin:
|
50
|
+
|
51
|
+
```ruby
|
52
|
+
filter :filter_name, :date, filter_with: :custom_filter_method
|
53
|
+
```
|
data/lib/cm_admin/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cm-admin
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.
|
4
|
+
version: 3.0.16
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael
|
@@ -14,7 +14,7 @@ authors:
|
|
14
14
|
autorequire:
|
15
15
|
bindir: exe
|
16
16
|
cert_chain: []
|
17
|
-
date: 2024-11-
|
17
|
+
date: 2024-11-25 00:00:00.000000000 Z
|
18
18
|
dependencies:
|
19
19
|
- !ruby/object:Gem::Dependency
|
20
20
|
name: caxlsx_rails
|
@@ -426,6 +426,7 @@ files:
|
|
426
426
|
- config/webpack/test.js
|
427
427
|
- config/webpacker.yml
|
428
428
|
- docs/AddingAlert.md
|
429
|
+
- docs/CustomFilterMethod.md
|
429
430
|
- docs/ListingSelectTwoAjax.md
|
430
431
|
- docs/ListingSelectTwoItems.md
|
431
432
|
- docs/RoleManagement.md
|