administrate-serialized_fields 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: c1a95937e38cd100cc1beac6fd30497de78987ca14a18dc7d50e72c2e7085da0
4
+ data.tar.gz: 93891c65872a619e851aacb7ba595b516a9146c46523b7a8e0494c3e54098f9e
5
+ SHA512:
6
+ metadata.gz: 93b096af15d46c1fb82b2b9ed837cdb17eb98065d7f0b018529e69a23ce1ccc2aafea3211e8e853ef0036b2fd1b6c0cc391bf0c0a5e231409f8ed8fff1b3f488
7
+ data.tar.gz: 9a0ddf2b0f6ecb6fe84b766298bfb30892a6e10a94bd99516534930705e64b95149fdad0e5d6d9dbe27ea50dd8842d5b0af8ac8b5feeec16632db930aa43f7be
data/.gitignore ADDED
@@ -0,0 +1,8 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
@@ -0,0 +1,17 @@
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="jdk" jdkName="ruby-2.6.1-p33" jdkType="RUBY_SDK" />
9
+ <orderEntry type="sourceFolder" forTests="false" />
10
+ <orderEntry type="library" scope="PROVIDED" name="activesupport (v6.0.0.beta3, ruby-2.6.1-p33) [gem]" level="application" />
11
+ <orderEntry type="library" scope="PROVIDED" name="concurrent-ruby (v1.1.5, ruby-2.6.1-p33) [gem]" level="application" />
12
+ <orderEntry type="library" scope="PROVIDED" name="i18n (v1.6.0, ruby-2.6.1-p33) [gem]" level="application" />
13
+ <orderEntry type="library" scope="PROVIDED" name="minitest (v5.11.3, ruby-2.6.1-p33) [gem]" level="application" />
14
+ <orderEntry type="library" scope="PROVIDED" name="thread_safe (v0.3.6, ruby-2.6.1-p33) [gem]" level="application" />
15
+ <orderEntry type="library" scope="PROVIDED" name="tzinfo (v1.2.5, ruby-2.6.1-p33) [gem]" level="application" />
16
+ </component>
17
+ </module>
@@ -0,0 +1,6 @@
1
+ <component name="InspectionProjectProfileManager">
2
+ <profile version="1.0">
3
+ <option name="myName" value="Project Default" />
4
+ <inspection_tool class="Rubocop" enabled="false" level="WARNING" enabled_by_default="false" />
5
+ </profile>
6
+ </component>
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.5.3-p105" 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/administrate-serialized_fields.iml" filepath="$PROJECT_DIR$/.idea/administrate-serialized_fields.iml" />
6
+ </modules>
7
+ </component>
8
+ </project>
data/.idea/vcs.xml ADDED
@@ -0,0 +1,6 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="VcsDirectoryMappings">
4
+ <mapping directory="$PROJECT_DIR$" vcs="Git" />
5
+ </component>
6
+ </project>
@@ -0,0 +1,244 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="ChangeListManager">
4
+ <list default="true" id="1a09d8ce-2813-4f89-8120-e33f2aa09757" name="Default Changelist" comment="">
5
+ <change afterPath="$PROJECT_DIR$/.gitignore" afterDir="false" />
6
+ <change afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
7
+ <change afterPath="$PROJECT_DIR$/.travis.yml" afterDir="false" />
8
+ <change afterPath="$PROJECT_DIR$/CODE_OF_CONDUCT.md" afterDir="false" />
9
+ <change afterPath="$PROJECT_DIR$/Gemfile" afterDir="false" />
10
+ <change afterPath="$PROJECT_DIR$/LICENSE.txt" afterDir="false" />
11
+ <change afterPath="$PROJECT_DIR$/README.md" afterDir="false" />
12
+ <change afterPath="$PROJECT_DIR$/Rakefile" afterDir="false" />
13
+ <change afterPath="$PROJECT_DIR$/administrate-serialized_fields.gemspec" afterDir="false" />
14
+ <change afterPath="$PROJECT_DIR$/bin/console" afterDir="false" />
15
+ <change afterPath="$PROJECT_DIR$/bin/setup" afterDir="false" />
16
+ <change afterPath="$PROJECT_DIR$/lib/administrate/serialized_fields.rb" afterDir="false" />
17
+ <change afterPath="$PROJECT_DIR$/lib/administrate/serialized_fields/version.rb" afterDir="false" />
18
+ <change afterPath="$PROJECT_DIR$/test/administrate/serialized_fields_test.rb" afterDir="false" />
19
+ <change afterPath="$PROJECT_DIR$/test/test_helper.rb" afterDir="false" />
20
+ </list>
21
+ <option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
22
+ <option name="SHOW_DIALOG" value="false" />
23
+ <option name="HIGHLIGHT_CONFLICTS" value="true" />
24
+ <option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
25
+ <option name="LAST_RESOLUTION" value="IGNORE" />
26
+ </component>
27
+ <component name="FileEditorManager">
28
+ <leaf>
29
+ <file pinned="false" current-in-tab="false">
30
+ <entry file="file://$PROJECT_DIR$/lib/administrate/serialized_fields.rb">
31
+ <provider selected="true" editor-type-id="text-editor">
32
+ <state relative-caret-position="391">
33
+ <caret line="23" column="33" selection-start-line="23" selection-start-column="10" selection-end-line="23" selection-end-column="33" />
34
+ </state>
35
+ </provider>
36
+ </entry>
37
+ </file>
38
+ <file pinned="false" current-in-tab="false">
39
+ <entry file="file://$PROJECT_DIR$/.travis.yml">
40
+ <provider selected="true" editor-type-id="text-editor" />
41
+ </entry>
42
+ </file>
43
+ <file pinned="false" current-in-tab="true">
44
+ <entry file="file://$PROJECT_DIR$/README.md">
45
+ <provider selected="true" editor-type-id="split-provider[text-editor;markdown-preview-editor]">
46
+ <state split_layout="SPLIT">
47
+ <first_editor relative-caret-position="306">
48
+ <caret line="87" column="72" lean-forward="true" selection-start-line="87" selection-start-column="72" selection-end-line="87" selection-end-column="72" />
49
+ </first_editor>
50
+ <second_editor />
51
+ </state>
52
+ </provider>
53
+ </entry>
54
+ </file>
55
+ </leaf>
56
+ </component>
57
+ <component name="FindInProjectRecents">
58
+ <findStrings>
59
+ <find>&quot;</find>
60
+ <find>default_order</find>
61
+ </findStrings>
62
+ <replaceStrings>
63
+ <replace>'</replace>
64
+ <replace>serialized_fields</replace>
65
+ </replaceStrings>
66
+ </component>
67
+ <component name="Git.Settings">
68
+ <option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
69
+ </component>
70
+ <component name="IdeDocumentHistory">
71
+ <option name="CHANGED_PATHS">
72
+ <list>
73
+ <option value="$PROJECT_DIR$/test/administrate/serialized_fields_test.rb" />
74
+ <option value="$PROJECT_DIR$/lib/administrate/serialized_fields.rb" />
75
+ <option value="$PROJECT_DIR$/administrate-serialized_fields.gemspec" />
76
+ <option value="$PROJECT_DIR$/README.md" />
77
+ </list>
78
+ </option>
79
+ </component>
80
+ <component name="ProjectConfigurationFiles">
81
+ <option name="files">
82
+ <list>
83
+ <option value="$PROJECT_DIR$/.idea/inspectionProfiles/Project_Default.xml" />
84
+ <option value="$PROJECT_DIR$/.idea/administrate-serialized_fields.iml" />
85
+ <option value="$PROJECT_DIR$/.idea/misc.xml" />
86
+ <option value="$PROJECT_DIR$/.idea/vcs.xml" />
87
+ <option value="$PROJECT_DIR$/.idea/modules.xml" />
88
+ </list>
89
+ </option>
90
+ </component>
91
+ <component name="ProjectFrameBounds" extendedState="6">
92
+ <option name="x" value="-1928" />
93
+ <option name="y" value="-8" />
94
+ <option name="width" value="1936" />
95
+ <option name="height" value="1066" />
96
+ </component>
97
+ <component name="ProjectLevelVcsManager" settingsEditedManually="true" />
98
+ <component name="ProjectView">
99
+ <navigator proportions="" version="1">
100
+ <foldersAlwaysOnTop value="true" />
101
+ </navigator>
102
+ <panes>
103
+ <pane id="Scope" />
104
+ <pane id="ProjectPane">
105
+ <subPane>
106
+ <expand>
107
+ <path>
108
+ <item name="administrate-serialized_fields" type="b2602c69:ProjectViewProjectNode" />
109
+ <item name="administrate-serialized_fields" type="462c0819:PsiDirectoryNode" />
110
+ </path>
111
+ </expand>
112
+ <select />
113
+ </subPane>
114
+ </pane>
115
+ </panes>
116
+ </component>
117
+ <component name="PropertiesComponent">
118
+ <property name="WebServerToolWindowFactoryState" value="false" />
119
+ <property name="nodejs_interpreter_path.stuck_in_default_project" value="undefined stuck path" />
120
+ <property name="nodejs_npm_path_reset_for_default_project" value="true" />
121
+ <property name="settings.editor.selected.configurable" value="preferences.lookFeel" />
122
+ </component>
123
+ <component name="RecentsManager">
124
+ <key name="CopyFile.RECENT_KEYS">
125
+ <recent name="C:\Users\Derk-Jan\Documents\Github\administrate-serialized_fields" />
126
+ </key>
127
+ </component>
128
+ <component name="RunDashboard">
129
+ <option name="ruleStates">
130
+ <list>
131
+ <RuleState>
132
+ <option name="name" value="ConfigurationTypeDashboardGroupingRule" />
133
+ </RuleState>
134
+ <RuleState>
135
+ <option name="name" value="StatusDashboardGroupingRule" />
136
+ </RuleState>
137
+ </list>
138
+ </option>
139
+ </component>
140
+ <component name="SpringUtil" SPRING_PRE_LOADER_OPTION="true" />
141
+ <component name="SvnConfiguration">
142
+ <configuration />
143
+ </component>
144
+ <component name="TaskManager">
145
+ <task active="true" id="Default" summary="Default task">
146
+ <changelist id="1a09d8ce-2813-4f89-8120-e33f2aa09757" name="Default Changelist" comment="" />
147
+ <created>1552655310691</created>
148
+ <option name="number" value="Default" />
149
+ <option name="presentableId" value="Default" />
150
+ <updated>1552655310691</updated>
151
+ <workItem from="1552655312063" duration="2134000" />
152
+ </task>
153
+ <servers />
154
+ </component>
155
+ <component name="TimeTrackingManager">
156
+ <option name="totallyTimeSpent" value="2134000" />
157
+ </component>
158
+ <component name="ToolWindowManager">
159
+ <frame x="-1928" y="-8" width="1936" height="1066" extended-state="6" />
160
+ <layout>
161
+ <window_info id="Favorites" side_tool="true" />
162
+ <window_info active="true" content_ui="combo" id="Project" order="0" visible="true" weight="0.25" />
163
+ <window_info id="Structure" order="1" side_tool="true" weight="0.25" />
164
+ <window_info anchor="bottom" id="Docker" show_stripe_button="false" />
165
+ <window_info anchor="bottom" id="Database Changes" />
166
+ <window_info anchor="bottom" id="Version Control" />
167
+ <window_info anchor="bottom" id="Terminal" visible="true" weight="0.3290461" />
168
+ <window_info anchor="bottom" id="Event Log" side_tool="true" />
169
+ <window_info anchor="bottom" id="Message" order="0" />
170
+ <window_info anchor="bottom" id="Find" order="1" />
171
+ <window_info anchor="bottom" id="Run" order="2" weight="0.3290461" />
172
+ <window_info anchor="bottom" id="Debug" order="3" weight="0.4" />
173
+ <window_info anchor="bottom" id="Cvs" order="4" weight="0.25" />
174
+ <window_info anchor="bottom" id="Inspection" order="5" weight="0.4" />
175
+ <window_info anchor="bottom" id="TODO" order="6" />
176
+ <window_info anchor="right" id="Database" />
177
+ <window_info anchor="right" id="Commander" order="0" 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
+ </layout>
181
+ </component>
182
+ <component name="TypeScriptGeneratedFilesManager">
183
+ <option name="version" value="1" />
184
+ </component>
185
+ <component name="editorHistoryManager">
186
+ <entry file="file://C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/activesupport-6.0.0.beta3/lib/active_support/core_ext/module/attribute_accessors.rb">
187
+ <provider selected="true" editor-type-id="text-editor">
188
+ <state relative-caret-position="374">
189
+ <caret line="206" column="6" selection-start-line="206" selection-start-column="6" selection-end-line="206" selection-end-column="6" />
190
+ </state>
191
+ </provider>
192
+ </entry>
193
+ <entry file="file://C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/activesupport-6.0.0.beta3/lib/active_support/core_ext/class/attribute_accessors.rb">
194
+ <provider selected="true" editor-type-id="text-editor" />
195
+ </entry>
196
+ <entry file="file://$PROJECT_DIR$/test/administrate/serialized_fields_test.rb">
197
+ <provider selected="true" editor-type-id="text-editor">
198
+ <state relative-caret-position="85">
199
+ <caret line="5" column="5" selection-start-line="5" selection-start-column="5" selection-end-line="5" selection-end-column="5" />
200
+ </state>
201
+ </provider>
202
+ </entry>
203
+ <entry file="file://$PROJECT_DIR$/test/test_helper.rb">
204
+ <provider selected="true" editor-type-id="text-editor" />
205
+ </entry>
206
+ <entry file="file://$PROJECT_DIR$/Gemfile">
207
+ <provider selected="true" editor-type-id="text-editor">
208
+ <state relative-caret-position="102">
209
+ <caret line="6" selection-start-line="6" selection-end-line="6" />
210
+ </state>
211
+ </provider>
212
+ </entry>
213
+ <entry file="file://$PROJECT_DIR$/Rakefile">
214
+ <provider selected="true" editor-type-id="text-editor" />
215
+ </entry>
216
+ <entry file="file://$PROJECT_DIR$/.travis.yml">
217
+ <provider selected="true" editor-type-id="text-editor" />
218
+ </entry>
219
+ <entry file="file://$PROJECT_DIR$/lib/administrate/serialized_fields.rb">
220
+ <provider selected="true" editor-type-id="text-editor">
221
+ <state relative-caret-position="391">
222
+ <caret line="23" column="33" selection-start-line="23" selection-start-column="10" selection-end-line="23" selection-end-column="33" />
223
+ </state>
224
+ </provider>
225
+ </entry>
226
+ <entry file="file://$PROJECT_DIR$/administrate-serialized_fields.gemspec">
227
+ <provider selected="true" editor-type-id="text-editor">
228
+ <state relative-caret-position="323">
229
+ <caret line="19" selection-start-line="19" selection-end-line="19" />
230
+ </state>
231
+ </provider>
232
+ </entry>
233
+ <entry file="file://$PROJECT_DIR$/README.md">
234
+ <provider selected="true" editor-type-id="split-provider[text-editor;markdown-preview-editor]">
235
+ <state split_layout="SPLIT">
236
+ <first_editor relative-caret-position="306">
237
+ <caret line="87" column="72" lean-forward="true" selection-start-line="87" selection-start-column="72" selection-end-line="87" selection-end-column="72" />
238
+ </first_editor>
239
+ <second_editor />
240
+ </state>
241
+ </provider>
242
+ </entry>
243
+ </component>
244
+ </project>
data/.travis.yml ADDED
@@ -0,0 +1,17 @@
1
+ ---
2
+ sudo: false
3
+ language: ruby
4
+ cache: bundler
5
+ rvm:
6
+ - 2.5
7
+ - 2.6
8
+ - ruby-head
9
+ before_install:
10
+ - gem install bundler -v 2.0.1
11
+ - gem update --system
12
+ - gem --version
13
+ matrix:
14
+ allow_failures:
15
+ - rvm: ruby-head
16
+ install:
17
+ - bundle install --with development --jobs=3 --retry=3 --path=${BUNDLE_PATH:-vendor/bundle}
@@ -0,0 +1,74 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to making participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, gender identity and expression, level of experience,
9
+ nationality, personal appearance, race, religion, or sexual identity and
10
+ orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ * Using welcoming and inclusive language
18
+ * Being respectful of differing viewpoints and experiences
19
+ * Gracefully accepting constructive criticism
20
+ * Focusing on what is best for the community
21
+ * Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ * The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ * Trolling, insulting/derogatory comments, and personal or political attacks
28
+ * Public or private harassment
29
+ * Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ * Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or
41
+ reject comments, commits, code, wiki edits, issues, and other contributions
42
+ that are not aligned to this Code of Conduct, or to ban temporarily or
43
+ permanently any contributor for other behaviors that they deem inappropriate,
44
+ threatening, offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies both within project spaces and in public spaces
49
+ when an individual is representing the project or its community. Examples of
50
+ representing a project or community include using an official project e-mail
51
+ address, posting via an official social media account, or acting as an appointed
52
+ representative at an online or offline event. Representation of a project may be
53
+ further defined and clarified by project maintainers.
54
+
55
+ ## Enforcement
56
+
57
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+ reported by contacting the project team at derk-jan+github@karrenbeld.info. All
59
+ complaints will be reviewed and investigated and will result in a response that
60
+ is deemed necessary and appropriate to the circumstances. The project team is
61
+ obligated to maintain confidentiality with regard to the reporter of an incident.
62
+ Further details of specific enforcement policies may be posted separately.
63
+
64
+ Project maintainers who do not follow or enforce the Code of Conduct in good
65
+ faith may face temporary or permanent repercussions as determined by other
66
+ members of the project's leadership.
67
+
68
+ ## Attribution
69
+
70
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
+ available at [http://contributor-covenant.org/version/1/4][version]
72
+
73
+ [homepage]: http://contributor-covenant.org
74
+ [version]: http://contributor-covenant.org/version/1/4/
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ source "https://rubygems.org"
2
+
3
+ git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
4
+
5
+ # Specify your gem's dependencies in administrate-serialized_fields.gemspec
6
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,34 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ administrate-serialized_fields (0.1.0)
5
+ activesupport (>= 4)
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ activesupport (5.2.2.1)
11
+ concurrent-ruby (~> 1.0, >= 1.0.2)
12
+ i18n (>= 0.7, < 2)
13
+ minitest (~> 5.1)
14
+ tzinfo (~> 1.1)
15
+ concurrent-ruby (1.1.5)
16
+ i18n (1.6.0)
17
+ concurrent-ruby (~> 1.0)
18
+ minitest (5.11.3)
19
+ rake (10.5.0)
20
+ thread_safe (0.3.6)
21
+ tzinfo (1.2.5)
22
+ thread_safe (~> 0.1)
23
+
24
+ PLATFORMS
25
+ x64-mingw32
26
+
27
+ DEPENDENCIES
28
+ administrate-serialized_fields!
29
+ bundler (~> 2)
30
+ minitest (~> 5.0)
31
+ rake (~> 10.0)
32
+
33
+ BUNDLED WITH
34
+ 2.0.1
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2019 Derk-Jan Karrenbeld
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,101 @@
1
+ # Administrate::SerializedFields
2
+
3
+ [![Build Status: master](https://travis-ci.com/XPBytes/administrate-serialized_fields.svg)](https://travis-ci.com/XPBytes/administrate-serialized_fields)
4
+ [![Gem Version](https://badge.fury.io/rb/administrate-serialized_fields.svg)](https://badge.fury.io/rb/administrate-serialized_fields)
5
+ [![MIT license](http://img.shields.io/badge/license-MIT-brightgreen.svg)](http://opensource.org/licenses/MIT)
6
+
7
+ Automatically deserialize administrate fields on form submit.
8
+
9
+ ## Installation
10
+
11
+ Add this line to your application's Gemfile:
12
+
13
+ ```ruby
14
+ gem 'administrate-serialized_fields'
15
+ ```
16
+
17
+ And then execute:
18
+
19
+ $ bundle
20
+
21
+ Or install it yourself as:
22
+
23
+ $ gem install administrate-serialized_fields
24
+
25
+ ## Usage
26
+
27
+ In order to use this, `include 'Administrate::SerializedFields'` in your base admin `ApplicationController`.
28
+
29
+ ```ruby
30
+ require 'administrate/serialized_fields'
31
+
32
+ class ApplicationController < Administrate::ApplicationController
33
+ include Administrate::SerializedFields
34
+ end
35
+
36
+ class NotificationController < ApplicationController
37
+ deserialize_json_fields :options, :messages, :settings
38
+ end
39
+ ```
40
+
41
+ The `deserialize_json_fields` by default looks for `Oj` and falls back to `JSON`. Use `load:` or `deserialize_fields` to
42
+ apply custom behaviour or a different deserializer.
43
+
44
+ You _must_ ensure there is a method `read_param` that takes **2** arguments (key and value), as opposed to the 0.11.0
45
+ administrate one param (value). Alternatively, use the [`administrate-base_controller` gem](https://github.com/XPBytes/administrate-base_controller)
46
+ and get this addition for free.
47
+
48
+ ```ruby
49
+ class Application < Administrate::ApplicationController
50
+ protected
51
+
52
+ def resource_params
53
+ permitted = params.require(resource_class.model_name.param_key)
54
+ .permit(dashboard.permitted_attributes)
55
+ .to_h
56
+
57
+ permitted.each_with_object(permitted) do |(k, v), result|
58
+ result[k] = read_param(k, v)
59
+ end
60
+ end
61
+
62
+ def read_param(_, data)
63
+ if data.is_a?(ActionController::Parameters) && data[:type]
64
+ return read_param_value(data)
65
+ end
66
+
67
+ data
68
+ end
69
+ end
70
+ ```
71
+
72
+ ## Related
73
+
74
+ - [`Administrate`](https://github.com/thoughtbot/administrate): A Rails engine that helps you put together a super-flexible admin dashboard.
75
+ - [`Administrate::BaseController`](https://github.com/XPBytes/administrate-base_controller): :stars: A set of application controller improvements.
76
+
77
+ ### Concerns
78
+
79
+ - [`Administrate::DefaultOrder`](https://github.com/XPBytes/administrate-default_order): :1234: Sets the default order for a resource in a administrate controller.
80
+
81
+ ### Fields
82
+
83
+ - [`Administrate::Field::Code`](https://github.com/XPBytes/administrate-field-code): :pencil: A `text` field that shows code.
84
+ - [`Administrate::Field::Hyperlink`](https://github.com/XPBytes/administrate-field-hyperlink): :pencil: A `string` field that is shows a hyperlink.
85
+ - [`Adminisrtate::Field::JsonEditor`](https://github.com/XPBytes/administrate-field-json_editor): :pencil: A `text` field that shows a [JSON editor](https://github.com/josdejong/jsoneditor).
86
+ - [`Administrate::Field::ScopedBelongsTo`](https://github.com/XPBytes/administrate-field-scoped_belongs_to): :pencil: A `belongs_to` field that yields itself to the scope `lambda`.
87
+ - [`Administrate::Field::ScopedHasMany`](https://github.com/XPBytes/administrate-field-scoped_has_many): :pencil: A `has_many` field that yields itself to the scope `lambda`.
88
+ - [`Administrate::Field::TimeAgo`](https://github.com/XPBytes/administrate-field-time_ago): :pencil: A `date_time` field that shows its data as `time_ago` since.
89
+
90
+ ## Development
91
+
92
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can
93
+ also run `bin/console` for an interactive prompt that will allow you to experiment.
94
+
95
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the
96
+ version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version,
97
+ push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
98
+
99
+ ## Contributing
100
+
101
+ Bug reports and pull requests are welcome on GitHub at [XPBytes/administrate-serialized_fields](https://github.com/XPBytes/administrate-serialized_fields).
data/Rakefile ADDED
@@ -0,0 +1,10 @@
1
+ require "bundler/gem_tasks"
2
+ require "rake/testtask"
3
+
4
+ Rake::TestTask.new(:test) do |t|
5
+ t.libs << "test"
6
+ t.libs << "lib"
7
+ t.test_files = FileList["test/**/*_test.rb"]
8
+ end
9
+
10
+ task :default => :test
@@ -0,0 +1,43 @@
1
+
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'administrate/serialized_fields/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = 'administrate-serialized_fields'
8
+ spec.version = Administrate::SerializedFields::VERSION
9
+ spec.authors = ['Derk-Jan Karrenbeld']
10
+ spec.email = ['derk-jan+github@karrenbeld.info']
11
+
12
+ spec.summary = 'Automatically deserialize administrate fields on form submit.'
13
+ spec.homepage = 'https://github.com/XPBytes/administrate-serialized_fields'
14
+ spec.license = 'MIT'
15
+
16
+ # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
17
+ # to allow pushing to a single host or delete this section to allow pushing to any host.
18
+ if spec.respond_to?(:metadata)
19
+ # spec.metadata['allowed_push_host'] = 'TODO: Set to 'http://mygemserver.com''
20
+
21
+ spec.metadata['homepage_uri'] = spec.homepage
22
+ spec.metadata['source_code_uri'] = spec.homepage
23
+ spec.metadata['changelog_uri'] = spec.homepage + '/blob/master/CHANGELOG.md'
24
+ else
25
+ raise 'RubyGems 2.0 or newer is required to protect against ' \
26
+ 'public gem pushes.'
27
+ end
28
+
29
+ # Specify which files should be added to the gem when it is released.
30
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
31
+ spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
32
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
33
+ end
34
+ spec.bindir = 'exe'
35
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
36
+ spec.require_paths = ['lib']
37
+
38
+ spec.add_dependency 'activesupport', '>= 4'
39
+
40
+ spec.add_development_dependency 'bundler', '~> 2'
41
+ spec.add_development_dependency 'rake', '~> 10.0'
42
+ spec.add_development_dependency 'minitest', '~> 5.0'
43
+ end
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "administrate/serialized_fields"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start(__FILE__)
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,29 @@
1
+ require 'administrate/serialized_fields/version'
2
+
3
+ require 'active_support/concern'
4
+ require 'active_support/core_ext/module/attribute_accessors'
5
+
6
+ module Admin
7
+ module SerializedFields
8
+ extend ActiveSupport::Concern
9
+
10
+ mattr_accessor :load_json
11
+ self.load_json = defined?(Oj) ? -> (data) { Oj.load(data) } : -> (data) { JSON.parse(data) }
12
+
13
+ class_methods do
14
+ def deserialize_fields(*fields, load:)
15
+ fields = Array(fields).map(&:to_s).freeze
16
+
17
+ define_method(:read_param) do |key, data|
18
+ return load.call(data) if fields.include?(String(key))
19
+ # noinspection RubySuperCallWithoutSuperclassInspection
20
+ super(key, data)
21
+ end
22
+ end
23
+
24
+ def deserialize_json_fields(*fields)
25
+ deserialize_fields(*fields, load: SerializedFields.load_json)
26
+ end
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,5 @@
1
+ module Administrate
2
+ module SerializedFields
3
+ VERSION = "0.1.0"
4
+ end
5
+ end
metadata ADDED
@@ -0,0 +1,122 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: administrate-serialized_fields
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Derk-Jan Karrenbeld
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2019-03-22 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: activesupport
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '4'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '4'
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '2'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '2'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '10.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '10.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: minitest
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '5.0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '5.0'
69
+ description:
70
+ email:
71
+ - derk-jan+github@karrenbeld.info
72
+ executables: []
73
+ extensions: []
74
+ extra_rdoc_files: []
75
+ files:
76
+ - ".gitignore"
77
+ - ".idea/administrate-serialized_fields.iml"
78
+ - ".idea/inspectionProfiles/Project_Default.xml"
79
+ - ".idea/misc.xml"
80
+ - ".idea/modules.xml"
81
+ - ".idea/vcs.xml"
82
+ - ".idea/workspace.xml"
83
+ - ".travis.yml"
84
+ - CODE_OF_CONDUCT.md
85
+ - Gemfile
86
+ - Gemfile.lock
87
+ - LICENSE.txt
88
+ - README.md
89
+ - Rakefile
90
+ - administrate-serialized_fields.gemspec
91
+ - bin/console
92
+ - bin/setup
93
+ - lib/administrate/serialized_fields.rb
94
+ - lib/administrate/serialized_fields/version.rb
95
+ homepage: https://github.com/XPBytes/administrate-serialized_fields
96
+ licenses:
97
+ - MIT
98
+ metadata:
99
+ homepage_uri: https://github.com/XPBytes/administrate-serialized_fields
100
+ source_code_uri: https://github.com/XPBytes/administrate-serialized_fields
101
+ changelog_uri: https://github.com/XPBytes/administrate-serialized_fields/blob/master/CHANGELOG.md
102
+ post_install_message:
103
+ rdoc_options: []
104
+ require_paths:
105
+ - lib
106
+ required_ruby_version: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ required_rubygems_version: !ruby/object:Gem::Requirement
112
+ requirements:
113
+ - - ">="
114
+ - !ruby/object:Gem::Version
115
+ version: '0'
116
+ requirements: []
117
+ rubyforge_project:
118
+ rubygems_version: 2.7.6
119
+ signing_key:
120
+ specification_version: 4
121
+ summary: Automatically deserialize administrate fields on form submit.
122
+ test_files: []