compony 0.6.0 → 0.6.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/CHANGELOG.md +4 -0
- data/Gemfile.lock +1 -1
- data/VERSION +1 -1
- data/compony.gemspec +2 -2
- data/doc/ComponentGenerator.html +1 -1
- data/doc/Components.html +1 -1
- data/doc/ComponentsGenerator.html +1 -1
- data/doc/Compony/Component.html +1 -1
- data/doc/Compony/ComponentMixins/Default/Labelling.html +1 -1
- data/doc/Compony/ComponentMixins/Default/Standalone/ResourcefulVerbDsl.html +1 -1
- data/doc/Compony/ComponentMixins/Default/Standalone/StandaloneDsl.html +1 -1
- data/doc/Compony/ComponentMixins/Default/Standalone/VerbDsl.html +1 -1
- data/doc/Compony/ComponentMixins/Default/Standalone.html +1 -1
- data/doc/Compony/ComponentMixins/Default.html +1 -1
- data/doc/Compony/ComponentMixins/Resourceful.html +1 -1
- data/doc/Compony/ComponentMixins.html +1 -1
- data/doc/Compony/Components/Button.html +1 -1
- data/doc/Compony/Components/Destroy.html +1 -1
- data/doc/Compony/Components/Edit.html +1 -1
- data/doc/Compony/Components/Form.html +1 -1
- data/doc/Compony/Components/Index.html +1 -1
- data/doc/Compony/Components/List.html +235 -146
- data/doc/Compony/Components/New.html +1 -1
- data/doc/Compony/Components/Show.html +1 -1
- data/doc/Compony/Components/WithForm.html +1 -1
- data/doc/Compony/Components.html +1 -1
- data/doc/Compony/ControllerMixin.html +1 -1
- data/doc/Compony/Engine.html +1 -1
- data/doc/Compony/MethodAccessibleHash.html +1 -1
- data/doc/Compony/ModelFields/Anchormodel.html +1 -1
- data/doc/Compony/ModelFields/Association.html +1 -1
- data/doc/Compony/ModelFields/Attachment.html +1 -1
- data/doc/Compony/ModelFields/Base.html +1 -1
- data/doc/Compony/ModelFields/Boolean.html +1 -1
- data/doc/Compony/ModelFields/Color.html +1 -1
- data/doc/Compony/ModelFields/Currency.html +1 -1
- data/doc/Compony/ModelFields/Date.html +1 -1
- data/doc/Compony/ModelFields/Datetime.html +1 -1
- data/doc/Compony/ModelFields/Decimal.html +1 -1
- data/doc/Compony/ModelFields/Email.html +1 -1
- data/doc/Compony/ModelFields/Float.html +1 -1
- data/doc/Compony/ModelFields/Integer.html +1 -1
- data/doc/Compony/ModelFields/Percentage.html +1 -1
- data/doc/Compony/ModelFields/Phone.html +1 -1
- data/doc/Compony/ModelFields/RichText.html +1 -1
- data/doc/Compony/ModelFields/String.html +1 -1
- data/doc/Compony/ModelFields/Text.html +1 -1
- data/doc/Compony/ModelFields/Time.html +1 -1
- data/doc/Compony/ModelFields/Url.html +1 -1
- data/doc/Compony/ModelFields.html +1 -1
- data/doc/Compony/ModelMixin.html +1 -1
- data/doc/Compony/NaturalOrdering.html +1 -1
- data/doc/Compony/RequestContext.html +1 -1
- data/doc/Compony/Version.html +1 -1
- data/doc/Compony/ViewHelpers.html +1 -1
- data/doc/Compony.html +1 -1
- data/doc/ComponyController.html +1 -1
- data/doc/_index.html +1 -1
- data/doc/file.README.html +1 -1
- data/doc/index.html +1 -1
- data/doc/method_list.html +182 -174
- data/doc/top-level-namespace.html +1 -1
- data/lib/compony/components/list.rb +10 -0
- metadata +1 -1
@@ -102,7 +102,7 @@
|
|
102
102
|
</div>
|
103
103
|
|
104
104
|
<div id="footer">
|
105
|
-
Generated on
|
105
|
+
Generated on Mon Sep 8 14:24:21 2025 by
|
106
106
|
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
107
107
|
0.9.34 (ruby-3.3.5).
|
108
108
|
</div>
|
@@ -16,6 +16,7 @@ module Compony
|
|
16
16
|
# @param skip_columns [Array] Column names to be skipped.
|
17
17
|
# @param skip_row_actions [Array] Row action names to be skipped.
|
18
18
|
# @param skip_filters [Array] Filter names to be skipped.
|
19
|
+
# @param default_sorting [String] Default sorting (only relevant for ransack based sorting)
|
19
20
|
def initialize(*,
|
20
21
|
skip_pagination: false,
|
21
22
|
results_per_page: 20,
|
@@ -26,6 +27,7 @@ module Compony
|
|
26
27
|
skip_columns: [],
|
27
28
|
skip_row_actions: [],
|
28
29
|
skip_filters: [],
|
30
|
+
default_sorting: 'id asc',
|
29
31
|
**)
|
30
32
|
@pagination = !skip_pagination
|
31
33
|
@results_per_page = results_per_page
|
@@ -39,6 +41,7 @@ module Compony
|
|
39
41
|
@filters = Compony::NaturalOrdering.new
|
40
42
|
@sorts = Compony::NaturalOrdering.new
|
41
43
|
@skipped_filters = skip_filters.map(&:to_sym)
|
44
|
+
@default_sorting = default_sorting
|
42
45
|
@filter_label_class = 'list-filter-label'
|
43
46
|
@filter_input_class = 'list-filter-input'
|
44
47
|
@filter_select_class = 'list-filter-select'
|
@@ -83,6 +86,12 @@ module Compony
|
|
83
86
|
@sorting_links = false
|
84
87
|
end
|
85
88
|
|
89
|
+
# DSL method
|
90
|
+
# Overrides the default sorting
|
91
|
+
def default_sorting(new_default_sorting)
|
92
|
+
@default_sorting = new_default_sorting
|
93
|
+
end
|
94
|
+
|
86
95
|
# DSL method
|
87
96
|
# Sets the CSS class attribute for form label elements in filters.
|
88
97
|
# @param class_str [String] Space-separated list of CSS classes
|
@@ -230,6 +239,7 @@ module Compony
|
|
230
239
|
# Filtering
|
231
240
|
if filtering_enabled?
|
232
241
|
@q = @data.ransack(controller.params[param_name(:q)], auth_object: controller.current_ability, search_key: param_name(:q))
|
242
|
+
@q.sorts = @default_sorting if @q.sorts.empty?
|
233
243
|
filtered_data = @q.result.accessible_by(controller.current_ability)
|
234
244
|
else
|
235
245
|
filtered_data = @data
|