classic_acts_as_list 0.5.3 → 0.5.4
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/.gemtest +0 -0
- data/.gitignore +7 -0
- data/.idea/.rakeTasks +7 -0
- data/.idea/classic_acts_as_list.iml +23 -0
- data/.idea/encodings.xml +4 -0
- data/.idea/misc.xml +7 -0
- data/.idea/modules.xml +8 -0
- data/.idea/workspace.xml +230 -0
- data/.travis.yml +15 -0
- data/Gemfile +19 -0
- data/MIT-LICENSE +19 -0
- data/README.md +115 -0
- data/Rakefile +35 -0
- data/classic_acts_as_list.gemspec +30 -0
- data/gemfiles/rails3/Gemfile +21 -0
- data/gemfiles/rails4/Gemfile +21 -0
- data/gemfiles/rails5/Gemfile +21 -0
- data/init.rb +2 -0
- data/lib/acts_as_list.rb +17 -0
- data/lib/acts_as_list/active_record/acts/list.rb +487 -0
- data/lib/acts_as_list/version.rb +7 -0
- data/test/helper.rb +14 -0
- data/test/shared.rb +9 -0
- data/test/shared_array_scope_list.rb +160 -0
- data/test/shared_list.rb +250 -0
- data/test/shared_list_sub.rb +122 -0
- data/test/shared_no_addition.rb +25 -0
- data/test/shared_top_addition.rb +87 -0
- data/test/shared_zero_based.rb +91 -0
- data/test/test_list.rb +517 -0
- metadata +42 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: d22b433f5ab29f5ca7ff30930db3b01c33c111429978989c381ac0f5e835fb50
|
|
4
|
+
data.tar.gz: 8b08997da4151da6209b6c99c33713ef2af608905845c308fa5d196fa5456167
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 113e1639c0bde332bafd30a1e408f0966145acc19a4d9568ab171a08720362940abcc023b2588dc1108985585ad2cc689d9e370f1d9e0aac071bc5874e7f48bb
|
|
7
|
+
data.tar.gz: eab8a8f08857e1b854578ca120fb5cc57b18288e2ad2e41d4e759dadca76a4c94c038bd642b04e1d3fb36ce829c5fbd4c14cb8e476a19cff08363ace22d3aa8f
|
data/.gemtest
ADDED
|
File without changes
|
data/.gitignore
ADDED
data/.idea/.rakeTasks
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<Settings><!--This file was automatically generated by Ruby plugin.
|
|
3
|
+
You are allowed to:
|
|
4
|
+
1. Remove rake task
|
|
5
|
+
2. Add existing rake tasks
|
|
6
|
+
To add existing rake tasks automatically delete this file and reload the project.
|
|
7
|
+
--><RakeGroup description="" fullCmd="" taksId="rake"><RakeTask description="Build classic_acts_as_list-0.5.0.gem into the pkg directory" fullCmd="build" taksId="build" /><RakeTask description="Remove RDoc HTML files" fullCmd="clobber_rdoc" taksId="clobber_rdoc" /><RakeTask description="Default: run acts_as_list unit tests" fullCmd="default" taksId="default" /><RakeTask description="Build and install classic_acts_as_list-0.5.0.gem into system gems" fullCmd="install" taksId="install" /><RakeGroup description="" fullCmd="" taksId="install"><RakeTask description="Build and install classic_acts_as_list-0.5.0.gem into system gems without network access" fullCmd="install:local" taksId="local" /></RakeGroup><RakeTask description="Build RDoc HTML files" fullCmd="rdoc" taksId="rdoc" /><RakeTask description="Create tag v0.5.0 and build and push classic_acts_as_list-0.5.0.gem to rubygems.org" fullCmd="release[remote]" taksId="release[remote]" /><RakeTask description="Rebuild RDoc HTML files" fullCmd="rerdoc" taksId="rerdoc" /><RakeTask description="Run tests" fullCmd="test" taksId="test" /><RakeTask description="" fullCmd="clobber" taksId="clobber" /><RakeTask description="" fullCmd="rdoc/created.rid" taksId="rdoc/created.rid" /><RakeTask description="" fullCmd="release" taksId="release" /><RakeGroup description="" fullCmd="" taksId="release"><RakeTask description="" fullCmd="release:guard_clean" taksId="guard_clean" /><RakeTask description="" fullCmd="release:rubygem_push" taksId="rubygem_push" /><RakeTask description="" fullCmd="release:source_control_push" taksId="source_control_push" /></RakeGroup></RakeGroup></Settings>
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<module type="RUBY_MODULE" version="4">
|
|
3
|
+
<component name="ModuleRunConfigurationManager">
|
|
4
|
+
<shared />
|
|
5
|
+
</component>
|
|
6
|
+
<component name="NewModuleRootManager">
|
|
7
|
+
<content url="file://$MODULE_DIR$" />
|
|
8
|
+
<orderEntry type="inheritedJdk" />
|
|
9
|
+
<orderEntry type="sourceFolder" forTests="false" />
|
|
10
|
+
<orderEntry type="library" scope="PROVIDED" name="activemodel (v6.0.3.2, ruby-2.6.3-p62) [gem]" level="application" />
|
|
11
|
+
<orderEntry type="library" scope="PROVIDED" name="activerecord (v6.0.3.2, ruby-2.6.3-p62) [gem]" level="application" />
|
|
12
|
+
<orderEntry type="library" scope="PROVIDED" name="activesupport (v6.0.3.2, ruby-2.6.3-p62) [gem]" level="application" />
|
|
13
|
+
<orderEntry type="library" scope="PROVIDED" name="bundler (v2.1.4, ruby-2.6.3-p62) [gem]" level="application" />
|
|
14
|
+
<orderEntry type="library" scope="PROVIDED" name="concurrent-ruby (v1.1.6, ruby-2.6.3-p62) [gem]" level="application" />
|
|
15
|
+
<orderEntry type="library" scope="PROVIDED" name="i18n (v1.8.3, ruby-2.6.3-p62) [gem]" level="application" />
|
|
16
|
+
<orderEntry type="library" scope="PROVIDED" name="minitest (v5.14.1, ruby-2.6.3-p62) [gem]" level="application" />
|
|
17
|
+
<orderEntry type="library" scope="PROVIDED" name="rake (v13.0.1, ruby-2.6.3-p62) [gem]" level="application" />
|
|
18
|
+
<orderEntry type="library" scope="PROVIDED" name="sqlite3 (v1.4.2, ruby-2.6.3-p62) [gem]" level="application" />
|
|
19
|
+
<orderEntry type="library" scope="PROVIDED" name="thread_safe (v0.3.6, ruby-2.6.3-p62) [gem]" level="application" />
|
|
20
|
+
<orderEntry type="library" scope="PROVIDED" name="tzinfo (v1.2.7, ruby-2.6.3-p62) [gem]" level="application" />
|
|
21
|
+
<orderEntry type="library" scope="PROVIDED" name="zeitwerk (v2.3.0, ruby-2.6.3-p62) [gem]" level="application" />
|
|
22
|
+
</component>
|
|
23
|
+
</module>
|
data/.idea/encodings.xml
ADDED
data/.idea/misc.xml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<project version="4">
|
|
3
|
+
<component name="JavaScriptSettings">
|
|
4
|
+
<option name="languageLevel" value="ES6" />
|
|
5
|
+
</component>
|
|
6
|
+
<component name="ProjectRootManager" version="2" project-jdk-name="ruby-2.6.3-p62" project-jdk-type="RUBY_SDK" />
|
|
7
|
+
</project>
|
data/.idea/modules.xml
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<project version="4">
|
|
3
|
+
<component name="ProjectModuleManager">
|
|
4
|
+
<modules>
|
|
5
|
+
<module fileurl="file://$PROJECT_DIR$/.idea/classic_acts_as_list.iml" filepath="$PROJECT_DIR$/.idea/classic_acts_as_list.iml" />
|
|
6
|
+
</modules>
|
|
7
|
+
</component>
|
|
8
|
+
</project>
|
data/.idea/workspace.xml
ADDED
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<project version="4">
|
|
3
|
+
<component name="ChangeListManager">
|
|
4
|
+
<list default="true" id="bfeab213-f823-4ce6-87e6-bfcaaf760cdd" name="Default Changelist" comment="" />
|
|
5
|
+
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
|
|
6
|
+
<option name="SHOW_DIALOG" value="false" />
|
|
7
|
+
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
|
8
|
+
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
|
|
9
|
+
<option name="LAST_RESOLUTION" value="IGNORE" />
|
|
10
|
+
</component>
|
|
11
|
+
<component name="FileEditorManager">
|
|
12
|
+
<leaf SIDE_TABS_SIZE_LIMIT_KEY="300">
|
|
13
|
+
<file pinned="false" current-in-tab="false">
|
|
14
|
+
<entry file="file://$PROJECT_DIR$/classic_acts_as_list.gemspec">
|
|
15
|
+
<provider selected="true" editor-type-id="text-editor" />
|
|
16
|
+
</entry>
|
|
17
|
+
</file>
|
|
18
|
+
<file pinned="false" current-in-tab="false">
|
|
19
|
+
<entry file="file://$PROJECT_DIR$/lib/acts_as_list/version.rb">
|
|
20
|
+
<provider selected="true" editor-type-id="text-editor">
|
|
21
|
+
<state relative-caret-position="45">
|
|
22
|
+
<caret line="3" column="22" selection-start-line="3" selection-start-column="22" selection-end-line="3" selection-end-column="22" />
|
|
23
|
+
</state>
|
|
24
|
+
</provider>
|
|
25
|
+
</entry>
|
|
26
|
+
</file>
|
|
27
|
+
<file pinned="false" current-in-tab="true">
|
|
28
|
+
<entry file="file://$PROJECT_DIR$/classic_acts_as_list-0.5.3.gem">
|
|
29
|
+
<provider selected="true" editor-type-id="text-editor" />
|
|
30
|
+
</entry>
|
|
31
|
+
</file>
|
|
32
|
+
<file pinned="false" current-in-tab="false">
|
|
33
|
+
<entry file="file://$PROJECT_DIR$/lib/acts_as_list/active_record/acts/list.rb">
|
|
34
|
+
<provider selected="true" editor-type-id="text-editor">
|
|
35
|
+
<state relative-caret-position="302">
|
|
36
|
+
<caret line="125" column="39" selection-start-line="125" selection-start-column="39" selection-end-line="125" selection-end-column="39" />
|
|
37
|
+
</state>
|
|
38
|
+
</provider>
|
|
39
|
+
</entry>
|
|
40
|
+
</file>
|
|
41
|
+
<file pinned="false" current-in-tab="false">
|
|
42
|
+
<entry file="file://$PROJECT_DIR$/Gemfile.lock">
|
|
43
|
+
<provider selected="true" editor-type-id="text-editor" />
|
|
44
|
+
</entry>
|
|
45
|
+
</file>
|
|
46
|
+
<file pinned="false" current-in-tab="false">
|
|
47
|
+
<entry file="file://$PROJECT_DIR$/.travis.yml">
|
|
48
|
+
<provider selected="true" editor-type-id="text-editor" />
|
|
49
|
+
</entry>
|
|
50
|
+
</file>
|
|
51
|
+
<file pinned="false" current-in-tab="false">
|
|
52
|
+
<entry file="file://$PROJECT_DIR$/init.rb">
|
|
53
|
+
<provider selected="true" editor-type-id="text-editor">
|
|
54
|
+
<state relative-caret-position="30">
|
|
55
|
+
<caret line="2" selection-start-line="2" selection-end-line="2" />
|
|
56
|
+
</state>
|
|
57
|
+
</provider>
|
|
58
|
+
</entry>
|
|
59
|
+
</file>
|
|
60
|
+
<file pinned="false" current-in-tab="false">
|
|
61
|
+
<entry file="file://$PROJECT_DIR$/lib/classic_acts_as_list.rb">
|
|
62
|
+
<provider selected="true" editor-type-id="text-editor" />
|
|
63
|
+
</entry>
|
|
64
|
+
</file>
|
|
65
|
+
<file pinned="false" current-in-tab="false">
|
|
66
|
+
<entry file="file://$PROJECT_DIR$/Gemfile">
|
|
67
|
+
<provider selected="true" editor-type-id="text-editor" />
|
|
68
|
+
</entry>
|
|
69
|
+
</file>
|
|
70
|
+
<file pinned="false" current-in-tab="false">
|
|
71
|
+
<entry file="file://$PROJECT_DIR$/gemfiles/rails4/Gemfile">
|
|
72
|
+
<provider selected="true" editor-type-id="text-editor" />
|
|
73
|
+
</entry>
|
|
74
|
+
</file>
|
|
75
|
+
</leaf>
|
|
76
|
+
</component>
|
|
77
|
+
<component name="IdeDocumentHistory">
|
|
78
|
+
<option name="CHANGED_PATHS">
|
|
79
|
+
<list>
|
|
80
|
+
<option value="$PROJECT_DIR$/lib/acts_as_list/active_record/acts/list.rb" />
|
|
81
|
+
<option value="$PROJECT_DIR$/init.rb" />
|
|
82
|
+
<option value="$PROJECT_DIR$/lib/acts_as_list/version.rb" />
|
|
83
|
+
</list>
|
|
84
|
+
</option>
|
|
85
|
+
</component>
|
|
86
|
+
<component name="ProjectFrameBounds" fullScreen="true">
|
|
87
|
+
<option name="y" value="23" />
|
|
88
|
+
<option name="width" value="2048" />
|
|
89
|
+
<option name="height" value="1177" />
|
|
90
|
+
</component>
|
|
91
|
+
<component name="ProjectView">
|
|
92
|
+
<navigator proportions="" version="1">
|
|
93
|
+
<foldersAlwaysOnTop value="true" />
|
|
94
|
+
</navigator>
|
|
95
|
+
<panes>
|
|
96
|
+
<pane id="Scope" />
|
|
97
|
+
<pane id="ProjectPane">
|
|
98
|
+
<subPane>
|
|
99
|
+
<expand>
|
|
100
|
+
<path>
|
|
101
|
+
<item name="classic_acts_as_list" type="b2602c69:ProjectViewProjectNode" />
|
|
102
|
+
<item name="classic_acts_as_list" type="462c0819:PsiDirectoryNode" />
|
|
103
|
+
</path>
|
|
104
|
+
<path>
|
|
105
|
+
<item name="classic_acts_as_list" type="b2602c69:ProjectViewProjectNode" />
|
|
106
|
+
<item name="classic_acts_as_list" type="462c0819:PsiDirectoryNode" />
|
|
107
|
+
<item name="lib" type="462c0819:PsiDirectoryNode" />
|
|
108
|
+
</path>
|
|
109
|
+
<path>
|
|
110
|
+
<item name="classic_acts_as_list" type="b2602c69:ProjectViewProjectNode" />
|
|
111
|
+
<item name="classic_acts_as_list" type="462c0819:PsiDirectoryNode" />
|
|
112
|
+
<item name="lib" type="462c0819:PsiDirectoryNode" />
|
|
113
|
+
<item name="acts_as_list" type="462c0819:PsiDirectoryNode" />
|
|
114
|
+
</path>
|
|
115
|
+
</expand>
|
|
116
|
+
<select />
|
|
117
|
+
</subPane>
|
|
118
|
+
</pane>
|
|
119
|
+
</panes>
|
|
120
|
+
</component>
|
|
121
|
+
<component name="PropertiesComponent">
|
|
122
|
+
<property name="WebServerToolWindowFactoryState" value="false" />
|
|
123
|
+
<property name="last_opened_file_path" value="$PROJECT_DIR$" />
|
|
124
|
+
<property name="nodejs_interpreter_path.stuck_in_default_project" value="undefined stuck path" />
|
|
125
|
+
<property name="nodejs_npm_path_reset_for_default_project" value="true" />
|
|
126
|
+
</component>
|
|
127
|
+
<component name="RunDashboard">
|
|
128
|
+
<option name="ruleStates">
|
|
129
|
+
<list>
|
|
130
|
+
<RuleState>
|
|
131
|
+
<option name="name" value="ConfigurationTypeDashboardGroupingRule" />
|
|
132
|
+
</RuleState>
|
|
133
|
+
<RuleState>
|
|
134
|
+
<option name="name" value="StatusDashboardGroupingRule" />
|
|
135
|
+
</RuleState>
|
|
136
|
+
</list>
|
|
137
|
+
</option>
|
|
138
|
+
</component>
|
|
139
|
+
<component name="SpringUtil" SPRING_PRE_LOADER_OPTION="true" />
|
|
140
|
+
<component name="SvnConfiguration">
|
|
141
|
+
<configuration />
|
|
142
|
+
</component>
|
|
143
|
+
<component name="TaskManager">
|
|
144
|
+
<task active="true" id="Default" summary="Default task">
|
|
145
|
+
<changelist id="bfeab213-f823-4ce6-87e6-bfcaaf760cdd" name="Default Changelist" comment="" />
|
|
146
|
+
<created>1594749748626</created>
|
|
147
|
+
<option name="number" value="Default" />
|
|
148
|
+
<option name="presentableId" value="Default" />
|
|
149
|
+
<updated>1594749748626</updated>
|
|
150
|
+
<workItem from="1594749749800" duration="129000" />
|
|
151
|
+
<workItem from="1594752537653" duration="1631000" />
|
|
152
|
+
</task>
|
|
153
|
+
<servers />
|
|
154
|
+
</component>
|
|
155
|
+
<component name="TimeTrackingManager">
|
|
156
|
+
<option name="totallyTimeSpent" value="1760000" />
|
|
157
|
+
</component>
|
|
158
|
+
<component name="ToolWindowManager">
|
|
159
|
+
<frame x="0" y="0" width="2048" height="1280" extended-state="0" />
|
|
160
|
+
<layout>
|
|
161
|
+
<window_info content_ui="combo" id="Project" order="0" visible="true" weight="0.25224328" />
|
|
162
|
+
<window_info id="Structure" order="1" side_tool="true" weight="0.25" />
|
|
163
|
+
<window_info id="Favorites" order="2" side_tool="true" />
|
|
164
|
+
<window_info anchor="bottom" id="Message" order="0" />
|
|
165
|
+
<window_info anchor="bottom" id="Find" order="1" />
|
|
166
|
+
<window_info anchor="bottom" id="Run" order="2" />
|
|
167
|
+
<window_info anchor="bottom" id="Debug" order="3" weight="0.4" />
|
|
168
|
+
<window_info anchor="bottom" id="Cvs" order="4" weight="0.25" />
|
|
169
|
+
<window_info anchor="bottom" id="Inspection" order="5" weight="0.4" />
|
|
170
|
+
<window_info anchor="bottom" id="TODO" order="6" />
|
|
171
|
+
<window_info anchor="bottom" id="Docker" order="7" show_stripe_button="false" />
|
|
172
|
+
<window_info anchor="bottom" id="Database Changes" order="8" />
|
|
173
|
+
<window_info anchor="bottom" id="Version Control" order="9" />
|
|
174
|
+
<window_info active="true" anchor="bottom" id="Terminal" order="10" visible="true" weight="0.32940185" />
|
|
175
|
+
<window_info anchor="bottom" id="Event Log" order="11" side_tool="true" />
|
|
176
|
+
<window_info anchor="bottom" id="Messages" order="12" weight="0.32940185" />
|
|
177
|
+
<window_info anchor="right" id="Commander" internal_type="SLIDING" order="0" type="SLIDING" weight="0.4" />
|
|
178
|
+
<window_info anchor="right" id="Ant Build" order="1" weight="0.25" />
|
|
179
|
+
<window_info anchor="right" content_ui="combo" id="Hierarchy" order="2" weight="0.25" />
|
|
180
|
+
<window_info anchor="right" id="Database" order="3" />
|
|
181
|
+
</layout>
|
|
182
|
+
</component>
|
|
183
|
+
<component name="TypeScriptGeneratedFilesManager">
|
|
184
|
+
<option name="version" value="1" />
|
|
185
|
+
</component>
|
|
186
|
+
<component name="editorHistoryManager">
|
|
187
|
+
<entry file="file://$PROJECT_DIR$/lib/acts_as_list/active_record/acts/list.rb">
|
|
188
|
+
<provider selected="true" editor-type-id="text-editor">
|
|
189
|
+
<state relative-caret-position="302">
|
|
190
|
+
<caret line="125" column="39" selection-start-line="125" selection-start-column="39" selection-end-line="125" selection-end-column="39" />
|
|
191
|
+
</state>
|
|
192
|
+
</provider>
|
|
193
|
+
</entry>
|
|
194
|
+
<entry file="file://$PROJECT_DIR$/gemfiles/rails4/Gemfile">
|
|
195
|
+
<provider selected="true" editor-type-id="text-editor" />
|
|
196
|
+
</entry>
|
|
197
|
+
<entry file="file://$PROJECT_DIR$/Gemfile.lock">
|
|
198
|
+
<provider selected="true" editor-type-id="text-editor" />
|
|
199
|
+
</entry>
|
|
200
|
+
<entry file="file://$PROJECT_DIR$/.travis.yml">
|
|
201
|
+
<provider selected="true" editor-type-id="text-editor" />
|
|
202
|
+
</entry>
|
|
203
|
+
<entry file="file://$PROJECT_DIR$/Gemfile">
|
|
204
|
+
<provider selected="true" editor-type-id="text-editor" />
|
|
205
|
+
</entry>
|
|
206
|
+
<entry file="file://$PROJECT_DIR$/classic_acts_as_list.gemspec">
|
|
207
|
+
<provider selected="true" editor-type-id="text-editor" />
|
|
208
|
+
</entry>
|
|
209
|
+
<entry file="file://$PROJECT_DIR$/lib/classic_acts_as_list.rb">
|
|
210
|
+
<provider selected="true" editor-type-id="text-editor" />
|
|
211
|
+
</entry>
|
|
212
|
+
<entry file="file://$PROJECT_DIR$/init.rb">
|
|
213
|
+
<provider selected="true" editor-type-id="text-editor">
|
|
214
|
+
<state relative-caret-position="30">
|
|
215
|
+
<caret line="2" selection-start-line="2" selection-end-line="2" />
|
|
216
|
+
</state>
|
|
217
|
+
</provider>
|
|
218
|
+
</entry>
|
|
219
|
+
<entry file="file://$PROJECT_DIR$/lib/acts_as_list/version.rb">
|
|
220
|
+
<provider selected="true" editor-type-id="text-editor">
|
|
221
|
+
<state relative-caret-position="45">
|
|
222
|
+
<caret line="3" column="22" selection-start-line="3" selection-start-column="22" selection-end-line="3" selection-end-column="22" />
|
|
223
|
+
</state>
|
|
224
|
+
</provider>
|
|
225
|
+
</entry>
|
|
226
|
+
<entry file="file://$PROJECT_DIR$/classic_acts_as_list-0.5.3.gem">
|
|
227
|
+
<provider selected="true" editor-type-id="text-editor" />
|
|
228
|
+
</entry>
|
|
229
|
+
</component>
|
|
230
|
+
</project>
|
data/.travis.yml
ADDED
data/Gemfile
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
source "http://rubygems.org"
|
|
2
|
+
|
|
3
|
+
gem 'sqlite3', :platforms => [:ruby]
|
|
4
|
+
gem 'activerecord-jdbcsqlite3-adapter', :platforms => [:jruby]
|
|
5
|
+
|
|
6
|
+
platforms :rbx do
|
|
7
|
+
gem 'rubysl', '~> 2.0'
|
|
8
|
+
gem 'rubinius-developer_tools'
|
|
9
|
+
gem 'rubysl-test-unit'
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
# Specify your gem's dependencies in acts_as_list-rails3.gemspec
|
|
13
|
+
gemspec
|
|
14
|
+
|
|
15
|
+
gem 'rake'
|
|
16
|
+
|
|
17
|
+
group :test do
|
|
18
|
+
gem 'minitest', '~> 5'
|
|
19
|
+
end
|
data/MIT-LICENSE
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
Copyright (c) 2007 David Heinemeier Hansson
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
4
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
5
|
+
in the Software without restriction, including without limitation the rights
|
|
6
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
7
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
8
|
+
furnished to do so, subject to the following conditions:
|
|
9
|
+
|
|
10
|
+
The above copyright notice and this permission notice shall be included in
|
|
11
|
+
all copies or substantial portions of the Software.
|
|
12
|
+
|
|
13
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
14
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
15
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
16
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
17
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
18
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
19
|
+
THE SOFTWARE.
|
data/README.md
ADDED
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
# ActsAsList
|
|
2
|
+
|
|
3
|
+
## Description
|
|
4
|
+
|
|
5
|
+
This `acts_as` extension provides the capabilities for sorting and reordering a number of objects in a list. The class that has this specified needs to have a `position` column defined as an integer on the mapped database table.
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
In your Gemfile:
|
|
10
|
+
|
|
11
|
+
gem 'acts_as_list'
|
|
12
|
+
|
|
13
|
+
Or, from the command line:
|
|
14
|
+
|
|
15
|
+
gem install acts_as_list
|
|
16
|
+
|
|
17
|
+
## Example
|
|
18
|
+
|
|
19
|
+
At first, you need to add a `position` column to desired table:
|
|
20
|
+
|
|
21
|
+
rails g migration AddPositionToTodoItem position:integer
|
|
22
|
+
rake db:migrate
|
|
23
|
+
|
|
24
|
+
After that you can use `acts_as_list` method in the model:
|
|
25
|
+
|
|
26
|
+
```ruby
|
|
27
|
+
class TodoList < ActiveRecord::Base
|
|
28
|
+
has_many :todo_items, -> { order("position ASC") }
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
class TodoItem < ActiveRecord::Base
|
|
32
|
+
belongs_to :todo_list
|
|
33
|
+
acts_as_list scope: :todo_list
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
todo_list.first.move_to_bottom
|
|
37
|
+
todo_list.last.move_higher
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Instance Methods Added To ActiveRecord Models
|
|
41
|
+
|
|
42
|
+
You'll have a number of methods added to each instance of the ActiveRecord model that to which `acts_as_list` is added.
|
|
43
|
+
|
|
44
|
+
In `acts_as_list`, "higher" means further up the list (a lower `position`), and "lower" means further down the list (a higher `position`). That can be confusing, so it might make sense to add tests that validate that you're using the right method given your context.
|
|
45
|
+
|
|
46
|
+
### Methods That Change Position and Reorder List
|
|
47
|
+
|
|
48
|
+
- `list_item.insert_at(2)`
|
|
49
|
+
- `list_item.move_lower` will do nothing if the item is the lowest item
|
|
50
|
+
- `list_item.move_higher` will do nothing if the item is the highest item
|
|
51
|
+
- `list_item.move_to_bottom`
|
|
52
|
+
- `list_item.move_to_top`
|
|
53
|
+
- `list_item.remove_from_list`
|
|
54
|
+
|
|
55
|
+
### Methods That Change Position Without Reordering List
|
|
56
|
+
|
|
57
|
+
- `list_item.increment_position`
|
|
58
|
+
- `list_item.decrement_position`
|
|
59
|
+
- `list_item.set_list_position(3)`
|
|
60
|
+
|
|
61
|
+
### Methods That Return Attributes of the Item's List Position
|
|
62
|
+
- `list_item.first?`
|
|
63
|
+
- `list_item.last?`
|
|
64
|
+
- `list_item.in_list?`
|
|
65
|
+
- `list_item.not_in_list?`
|
|
66
|
+
- `list_item.default_position?`
|
|
67
|
+
- `list_item.higher_item`
|
|
68
|
+
- `list_item.higher_items` will return all the items above `list_item` in the list (ordered by the position, ascending)
|
|
69
|
+
- `list_item.lower_item`
|
|
70
|
+
- `list_item.lower_items` will return all the items below `list_item` in the list (ordered by the position, ascending)
|
|
71
|
+
|
|
72
|
+
## Notes
|
|
73
|
+
If the `position` column has a default value, then there is a slight change in behavior, i.e if you have 4 items in the list, and you insert 1, with a default position 0, it would be pushed to the bottom of the list. Please look at the tests for this and some recent pull requests for discussions related to this.
|
|
74
|
+
|
|
75
|
+
All `position` queries (select, update, etc.) inside gem methods are executed without the default scope (i.e. `Model.unscoped`), this will prevent nasty issues when the default scope is different from `acts_as_list` scope.
|
|
76
|
+
|
|
77
|
+
The `position` column is set after validations are called, so you should not put a `presence` validation on the `position` column.
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
If you need a scope by a non-association field you should pass an array, containing field name, to a scope:
|
|
81
|
+
```ruby
|
|
82
|
+
class TodoItem < ActiveRecord::Base
|
|
83
|
+
# `kind` is a plain text field (e.g. 'work', 'shopping', 'meeting'), not an association
|
|
84
|
+
acts_as_list scope: [:kind]
|
|
85
|
+
end
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
## Versions
|
|
89
|
+
All versions `0.1.5` onwards require Rails 3.0.x and higher.
|
|
90
|
+
|
|
91
|
+
## Build Status
|
|
92
|
+
[](https://secure.travis-ci.org/swanandp/acts_as_list)
|
|
93
|
+
|
|
94
|
+
## Workflow Status
|
|
95
|
+
[](http://waffle.io/swanandp/acts_as_list)
|
|
96
|
+
|
|
97
|
+
## Roadmap
|
|
98
|
+
|
|
99
|
+
1. Sort based feature
|
|
100
|
+
2. Rails 4 compatibility and bye bye Rails 2! Older versions would of course continue to work with Rails 2, but there won't be any support on those.
|
|
101
|
+
|
|
102
|
+
## Contributing to `acts_as_list`
|
|
103
|
+
|
|
104
|
+
- Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
|
|
105
|
+
- Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
|
|
106
|
+
- Fork the project
|
|
107
|
+
- Start a feature/bugfix branch
|
|
108
|
+
- Commit and push until you are happy with your contribution
|
|
109
|
+
- Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
|
|
110
|
+
- Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
|
|
111
|
+
- I would recommend using Rails 3.1.x and higher for testing the build before a pull request. The current test harness does not quite work with 3.0.x. The plugin itself works, but the issue lies with testing infrastructure.
|
|
112
|
+
|
|
113
|
+
## Copyright
|
|
114
|
+
|
|
115
|
+
Copyright (c) 2020 Steven Bong, released under the MIT license
|