inline_forms 8.1.75 → 8.1.78
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 +56 -1
- data/README.rdoc +1 -1
- data/app/assets/stylesheets/inline_forms/inline_forms.scss +3 -1
- data/app/controllers/inline_forms_controller.rb +61 -14
- data/app/views/inline_forms/_header.html.erb +1 -1
- data/app/views/inline_forms/row_close.html.erb +5 -0
- data/inline_forms.gemspec +0 -1
- data/lib/generators/USAGE +1 -1
- data/lib/generators/inline_forms_addto/USAGE +1 -1
- data/lib/generators/inline_forms_addto_generator.rb +30 -139
- data/lib/generators/inline_forms_attribute_list_editor.rb +211 -0
- data/lib/generators/inline_forms_attribute_overrides.rb +9 -0
- data/lib/generators/inline_forms_generator.rb +16 -35
- data/lib/inline_forms/form_elements/check_list_helper.rb +22 -6
- data/lib/inline_forms/form_elements/dropdown_helper.rb +22 -8
- data/lib/inline_forms/gem_files.rb +20 -17
- data/lib/inline_forms/refused_values.rb +33 -0
- data/lib/inline_forms/version.rb +1 -1
- data/lib/inline_forms.rb +10 -0
- data/lib/locales/inline_forms.en.yml +2 -0
- data/lib/locales/inline_forms.nl.yml +2 -0
- metadata +4 -142
- data/.document +0 -5
- data/.forgejo/brakeman-engine.sh +0 -51
- data/.forgejo/brakeman.ignore +0 -211
- data/.forgejo/workflows/ci.yml +0 -74
- data/.forgejo/workflows/full-gate.yml +0 -104
- data/.gitignore +0 -39
- data/.rubocop.yml +0 -31
- data/.rubocop_todo.yml +0 -151
- data/.ruby-version +0 -1
- data/Gemfile +0 -28
- data/Rakefile +0 -103
- data/script/migrate_form_elements.rb +0 -62
- data/test/archived_form_elements_test.rb +0 -101
- data/test/attribute_list_test.rb +0 -165
- data/test/dummy/app/controllers/application_controller.rb +0 -32
- data/test/dummy/app/controllers/daily_reports_controller.rb +0 -4
- data/test/dummy/app/controllers/documents_controller.rb +0 -4
- data/test/dummy/app/controllers/dossiers_controller.rb +0 -4
- data/test/dummy/app/controllers/gizmos_controller.rb +0 -4
- data/test/dummy/app/controllers/machines_controller.rb +0 -4
- data/test/dummy/app/controllers/parts_controller.rb +0 -4
- data/test/dummy/app/controllers/stats_controller.rb +0 -10
- data/test/dummy/app/controllers/widgets_controller.rb +0 -4
- data/test/dummy/app/helpers/application_helper.rb +0 -13
- data/test/dummy/app/models/ability.rb +0 -15
- data/test/dummy/app/models/application_record.rb +0 -27
- data/test/dummy/app/models/daily_report.rb +0 -21
- data/test/dummy/app/models/document.rb +0 -33
- data/test/dummy/app/models/dossier.rb +0 -38
- data/test/dummy/app/models/gizmo.rb +0 -25
- data/test/dummy/app/models/kind.rb +0 -8
- data/test/dummy/app/models/machine.rb +0 -24
- data/test/dummy/app/models/part.rb +0 -17
- data/test/dummy/app/models/phase.rb +0 -9
- data/test/dummy/app/models/widget.rb +0 -40
- data/test/dummy/app/views/_gizmos_search.html.erb +0 -3
- data/test/dummy/app/views/stats/show.html.erb +0 -1
- data/test/dummy/config/application.rb +0 -49
- data/test/dummy/config/database.yml +0 -3
- data/test/dummy/config/environment.rb +0 -5
- data/test/dummy/config/initializers/inline_forms.rb +0 -6
- data/test/dummy/config/initializers/paper_trail_yaml_safe_load.rb +0 -28
- data/test/dummy/config/routes.rb +0 -51
- data/test/form_element_from_callee_test.rb +0 -73
- data/test/gem_package_modes_test.rb +0 -86
- data/test/inline_edit_polymorphic_path_test.rb +0 -81
- data/test/inline_forms_addto_generator_test.rb +0 -584
- data/test/inline_forms_generator_test.rb +0 -301
- data/test/integration/csp_nonce_test.rb +0 -50
- data/test/integration/dropdown_test.rb +0 -186
- data/test/integration/field_authorization_test.rb +0 -131
- data/test/integration/file_slots_test.rb +0 -665
- data/test/integration/html_refusal_test.rb +0 -152
- data/test/integration/inline_forms_crud_test.rb +0 -165
- data/test/integration/layout_title_test.rb +0 -56
- data/test/integration/legacy_elements_test.rb +0 -99
- data/test/integration/list_params_test.rb +0 -200
- data/test/integration/locale_test.rb +0 -234
- data/test/integration/model_top_bar_test.rb +0 -85
- data/test/integration/native_inputs_test.rb +0 -138
- data/test/integration/open_after_create_test.rb +0 -85
- data/test/integration/pending_migration_gate_test.rb +0 -75
- data/test/integration/presentation_escaping_test.rb +0 -80
- data/test/integration/revert_skipped_columns_test.rb +0 -59
- data/test/integration/schema_batch_pipeline_test.rb +0 -189
- data/test/integration/schema_edit_test.rb +0 -141
- data/test/integration/schema_preview_test.rb +0 -65
- data/test/integration/turbo_menu_test.rb +0 -60
- data/test/integration_test_helper.rb +0 -203
- data/test/plain_text_configuration_test.rb +0 -90
- data/test/schema_apply_test.rb +0 -73
- data/test/schema_intent_test.rb +0 -53
- data/test/schema_label_test.rb +0 -61
- data/test/tabs_test.rb +0 -98
- data/test/test_helper.rb +0 -10
- data/test/user_model_config_test.rb +0 -44
data/.rubocop.yml
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
# RuboCop with the Rails "omakase" preset (same recipe as Papiamentu).
|
|
2
|
-
# All heredoc-free files are clean. The remaining violations (grandfathered in
|
|
3
|
-
# .rubocop_todo.yml) live in files with heredocs that emit generated-app code
|
|
4
|
-
# (installer core, generators, form-element helpers); those files are left
|
|
5
|
-
# untouched on purpose — autocorrect near heredocs risks changing emitted code.
|
|
6
|
-
# Run with: bundle exec rubocop
|
|
7
|
-
inherit_gem:
|
|
8
|
-
rubocop-rails-omakase: rubocop.yml
|
|
9
|
-
|
|
10
|
-
inherit_from: .rubocop_todo.yml
|
|
11
|
-
|
|
12
|
-
AllCops:
|
|
13
|
-
# The engine targets Ruby >= 4.0 (gemspec).
|
|
14
|
-
TargetRubyVersion: 3.3
|
|
15
|
-
Exclude:
|
|
16
|
-
- "pkg/**/*"
|
|
17
|
-
- "inline_forms_schema_edit/pkg/**/*"
|
|
18
|
-
- "vendor/**/*"
|
|
19
|
-
- "archived/**/*" # frozen historical code; linting defeats the purpose
|
|
20
|
-
- "lib/installer_templates/**/*" # templates for *generated apps*, not engine style
|
|
21
|
-
- "lib/vagrant/**/*"
|
|
22
|
-
- "lib/otherstuff/**/*"
|
|
23
|
-
- "stuff/**/*"
|
|
24
|
-
- "test/dummy/log/**/*"
|
|
25
|
-
- "test/dummy/tmp/**/*"
|
|
26
|
-
- "script/**/*" # one-off maintainer migration script
|
|
27
|
-
|
|
28
|
-
# Heredoc bodies are generated-file content (installer/form-element templates);
|
|
29
|
-
# whitespace there is part of the emitted output and is never auto-fixed.
|
|
30
|
-
Layout/TrailingWhitespace:
|
|
31
|
-
AllowInHeredoc: true
|
data/.rubocop_todo.yml
DELETED
|
@@ -1,151 +0,0 @@
|
|
|
1
|
-
# This configuration was generated by
|
|
2
|
-
# `rubocop --auto-gen-config --auto-gen-only-exclude --exclude-limit 60 --no-auto-gen-timestamp`
|
|
3
|
-
# using RuboCop version 1.88.1.
|
|
4
|
-
# The point is for the user to remove these configuration records
|
|
5
|
-
# one by one as the offenses are removed from the code base.
|
|
6
|
-
# Note that changes in the inspected code, or installation of new
|
|
7
|
-
# versions of RuboCop, may require this file to be generated again.
|
|
8
|
-
|
|
9
|
-
# Offense count: 1
|
|
10
|
-
# This cop supports safe autocorrection (--autocorrect).
|
|
11
|
-
# Configuration parameters: EnforcedStyle, IndentOneStep, IndentationWidth.
|
|
12
|
-
# SupportedStyles: case, end
|
|
13
|
-
Layout/CaseIndentation:
|
|
14
|
-
Exclude:
|
|
15
|
-
- 'lib/generators/inline_forms_generator.rb'
|
|
16
|
-
|
|
17
|
-
# Offense count: 3
|
|
18
|
-
# This cop supports safe autocorrection (--autocorrect).
|
|
19
|
-
Layout/ElseAlignment:
|
|
20
|
-
Exclude:
|
|
21
|
-
- 'lib/inline_forms_installer/installer_core.rb'
|
|
22
|
-
|
|
23
|
-
# Offense count: 37
|
|
24
|
-
# This cop supports safe autocorrection (--autocorrect).
|
|
25
|
-
Layout/EmptyLineAfterMagicComment:
|
|
26
|
-
Exclude:
|
|
27
|
-
- 'lib/generators/inline_forms_addto_generator.rb'
|
|
28
|
-
- 'lib/generators/inline_forms_generator.rb'
|
|
29
|
-
- 'lib/inline_forms/form_elements/audio_field_helper.rb'
|
|
30
|
-
- 'lib/inline_forms/form_elements/check_box_helper.rb'
|
|
31
|
-
- 'lib/inline_forms/form_elements/check_list_helper.rb'
|
|
32
|
-
- 'lib/inline_forms/form_elements/color_field_helper.rb'
|
|
33
|
-
- 'lib/inline_forms/form_elements/date_helper.rb'
|
|
34
|
-
- 'lib/inline_forms/form_elements/decimal_field_helper.rb'
|
|
35
|
-
- 'lib/inline_forms/form_elements/devise_password_field_helper.rb'
|
|
36
|
-
- 'lib/inline_forms/form_elements/dropdown_helper.rb'
|
|
37
|
-
- 'lib/inline_forms/form_elements/dropdown_with_integers_helper.rb'
|
|
38
|
-
- 'lib/inline_forms/form_elements/dropdown_with_other_helper.rb'
|
|
39
|
-
- 'lib/inline_forms/form_elements/dropdown_with_values_helper.rb'
|
|
40
|
-
- 'lib/inline_forms/form_elements/dropdown_with_values_with_stars_helper.rb'
|
|
41
|
-
- 'lib/inline_forms/form_elements/file_field_helper.rb'
|
|
42
|
-
- 'lib/inline_forms/form_elements/header_helper.rb'
|
|
43
|
-
- 'lib/inline_forms/form_elements/image_field_helper.rb'
|
|
44
|
-
- 'lib/inline_forms/form_elements/info_helper.rb'
|
|
45
|
-
- 'lib/inline_forms/form_elements/info_list_helper.rb'
|
|
46
|
-
- 'lib/inline_forms/form_elements/integer_field_helper.rb'
|
|
47
|
-
- 'lib/inline_forms/form_elements/money_field_helper.rb'
|
|
48
|
-
- 'lib/inline_forms/form_elements/month_select_helper.rb'
|
|
49
|
-
- 'lib/inline_forms/form_elements/month_year_picker_helper.rb'
|
|
50
|
-
- 'lib/inline_forms/form_elements/multi_image_field_helper.rb'
|
|
51
|
-
- 'lib/inline_forms/form_elements/pdf_link_helper.rb'
|
|
52
|
-
- 'lib/inline_forms/form_elements/plain_text_area_helper.rb'
|
|
53
|
-
- 'lib/inline_forms/form_elements/plain_text_helper.rb'
|
|
54
|
-
- 'lib/inline_forms/form_elements/radio_button_helper.rb'
|
|
55
|
-
- 'lib/inline_forms/form_elements/rich_text_helper.rb'
|
|
56
|
-
- 'lib/inline_forms/form_elements/scale_with_integers_helper.rb'
|
|
57
|
-
- 'lib/inline_forms/form_elements/scale_with_values_helper.rb'
|
|
58
|
-
- 'lib/inline_forms/form_elements/simple_file_field_helper.rb'
|
|
59
|
-
- 'lib/inline_forms/form_elements/slider_with_values_helper.rb'
|
|
60
|
-
- 'lib/inline_forms/form_elements/text_area_helper.rb'
|
|
61
|
-
- 'lib/inline_forms/form_elements/text_field_helper.rb'
|
|
62
|
-
- 'lib/inline_forms/form_elements/time_helper.rb'
|
|
63
|
-
- 'lib/inline_forms_installer/create_log.rb'
|
|
64
|
-
|
|
65
|
-
# Offense count: 1
|
|
66
|
-
# This cop supports safe autocorrection (--autocorrect).
|
|
67
|
-
# Configuration parameters: EnforcedStyle.
|
|
68
|
-
# SupportedStyles: empty_lines, empty_lines_except_namespace, empty_lines_special, no_empty_lines, beginning_only, ending_only
|
|
69
|
-
Layout/EmptyLinesAroundClassBody:
|
|
70
|
-
Exclude:
|
|
71
|
-
- 'lib/generators/inline_forms_generator.rb'
|
|
72
|
-
|
|
73
|
-
# Offense count: 2
|
|
74
|
-
# This cop supports safe autocorrection (--autocorrect).
|
|
75
|
-
# Configuration parameters: EnforcedStyleAlignWith.
|
|
76
|
-
# SupportedStylesAlignWith: keyword, variable, start_of_line
|
|
77
|
-
Layout/EndAlignment:
|
|
78
|
-
Exclude:
|
|
79
|
-
- 'lib/inline_forms_installer/installer_core.rb'
|
|
80
|
-
|
|
81
|
-
# Offense count: 1
|
|
82
|
-
# This cop supports safe autocorrection (--autocorrect).
|
|
83
|
-
# Configuration parameters: AllowDoxygenCommentStyle, AllowGemfileRubyComment, AllowRBSInlineAnnotation, AllowSteepAnnotation.
|
|
84
|
-
Layout/LeadingCommentSpace:
|
|
85
|
-
Exclude:
|
|
86
|
-
- 'lib/inline_forms_installer/installer_core.rb'
|
|
87
|
-
|
|
88
|
-
# Offense count: 4
|
|
89
|
-
# This cop supports safe autocorrection (--autocorrect).
|
|
90
|
-
Layout/SpaceAfterComma:
|
|
91
|
-
Exclude:
|
|
92
|
-
- 'lib/inline_forms_installer/installer_core.rb'
|
|
93
|
-
|
|
94
|
-
# Offense count: 2
|
|
95
|
-
# This cop supports safe autocorrection (--autocorrect).
|
|
96
|
-
# Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBrackets.
|
|
97
|
-
# SupportedStyles: space, no_space, compact
|
|
98
|
-
# SupportedStylesForEmptyBrackets: space, no_space
|
|
99
|
-
Layout/SpaceInsideArrayLiteralBrackets:
|
|
100
|
-
Exclude:
|
|
101
|
-
- 'lib/inline_forms_installer/create_log.rb'
|
|
102
|
-
|
|
103
|
-
# Offense count: 1
|
|
104
|
-
# This cop supports safe autocorrection (--autocorrect).
|
|
105
|
-
Lint/RedundantStringCoercion:
|
|
106
|
-
Exclude:
|
|
107
|
-
- 'lib/generators/inline_forms_generator.rb'
|
|
108
|
-
|
|
109
|
-
# Offense count: 8
|
|
110
|
-
# This cop supports safe autocorrection (--autocorrect).
|
|
111
|
-
# Configuration parameters: EnforcedStyle, EnforcedShorthandSyntax, UseHashRocketsWithSymbolValues, PreferHashRocketsForNonAlnumEndingSymbols.
|
|
112
|
-
# SupportedStyles: ruby19, hash_rockets, no_mixed_keys, ruby19_no_mixed_keys
|
|
113
|
-
# SupportedShorthandSyntax: always, never, either, consistent, either_consistent
|
|
114
|
-
Style/HashSyntax:
|
|
115
|
-
Exclude:
|
|
116
|
-
- 'lib/generators/inline_forms_generator.rb'
|
|
117
|
-
- 'lib/inline_forms_installer/installer_core.rb'
|
|
118
|
-
|
|
119
|
-
# Offense count: 2
|
|
120
|
-
# This cop supports safe autocorrection (--autocorrect).
|
|
121
|
-
# Configuration parameters: PreferredDelimiters.
|
|
122
|
-
Style/PercentLiteralDelimiters:
|
|
123
|
-
Exclude:
|
|
124
|
-
- 'lib/inline_forms_installer/installer_core.rb'
|
|
125
|
-
|
|
126
|
-
# Offense count: 131
|
|
127
|
-
# This cop supports safe autocorrection (--autocorrect).
|
|
128
|
-
# Configuration parameters: EnforcedStyle, ConsistentQuotesInMultiline.
|
|
129
|
-
# SupportedStyles: single_quotes, double_quotes
|
|
130
|
-
Style/StringLiterals:
|
|
131
|
-
Exclude:
|
|
132
|
-
- 'lib/generators/inline_forms_generator.rb'
|
|
133
|
-
- 'lib/inline_forms_installer/installer_core.rb'
|
|
134
|
-
- 'test/inline_forms_addto_generator_test.rb'
|
|
135
|
-
- 'test/inline_forms_generator_test.rb'
|
|
136
|
-
|
|
137
|
-
# Offense count: 1
|
|
138
|
-
# This cop supports safe autocorrection (--autocorrect).
|
|
139
|
-
# Configuration parameters: EnforcedStyleForMultiline.
|
|
140
|
-
# SupportedStylesForMultiline: comma, consistent_comma, diff_comma, no_comma
|
|
141
|
-
Style/TrailingCommaInArrayLiteral:
|
|
142
|
-
Exclude:
|
|
143
|
-
- 'lib/inline_forms_installer/installer_core.rb'
|
|
144
|
-
|
|
145
|
-
# Offense count: 2
|
|
146
|
-
# This cop supports safe autocorrection (--autocorrect).
|
|
147
|
-
# Configuration parameters: EnforcedStyleForMultiline.
|
|
148
|
-
# SupportedStylesForMultiline: comma, consistent_comma, diff_comma, no_comma
|
|
149
|
-
Style/TrailingCommaInHashLiteral:
|
|
150
|
-
Exclude:
|
|
151
|
-
- 'lib/inline_forms_installer/installer_core.rb'
|
data/.ruby-version
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
ruby-4.0.10
|
data/Gemfile
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
source "https://rubygems.org"
|
|
2
|
-
|
|
3
|
-
gemspec name: "inline_forms"
|
|
4
|
-
|
|
5
|
-
# Local sibling until validation_hints 8.0.0 is on RubyGems (maintainer dev only).
|
|
6
|
-
gem "validation_hints", path: "../validation_hints"
|
|
7
|
-
|
|
8
|
-
# test/dummy host-app stand-ins: the engine expects the host to supply these
|
|
9
|
-
# (generated apps get them from the installer Gemfile). Used only by the
|
|
10
|
-
# integration tests under test/integration/.
|
|
11
|
-
group :test do
|
|
12
|
-
gem "sqlite3", ">= 2.1"
|
|
13
|
-
gem "will_paginate", "~> 4.0"
|
|
14
|
-
gem "paper_trail", "~> 17.0"
|
|
15
|
-
gem "turbo-rails"
|
|
16
|
-
# Generated apps always authorize through CanCanCan; the dummy loads it so
|
|
17
|
-
# the controller's attribute-level checks run (test/dummy/app/models/ability.rb).
|
|
18
|
-
gem "cancancan", "~> 3.6"
|
|
19
|
-
# The schema-GUI engine gem (same repo, own gemspec). Test group so the
|
|
20
|
-
# dummy app's `Bundler.require(*Rails.groups)` loads it and the engine's
|
|
21
|
-
# schema_edit integration tests exercise the extracted controller/views.
|
|
22
|
-
gem "inline_forms_schema_edit", path: "inline_forms_schema_edit"
|
|
23
|
-
end
|
|
24
|
-
|
|
25
|
-
group :development, :test do
|
|
26
|
-
# Rails omakase style; offenses grandfathered in .rubocop_todo.yml.
|
|
27
|
-
gem "rubocop-rails-omakase", require: false
|
|
28
|
-
end
|
data/Rakefile
DELETED
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
require "bundler"
|
|
2
|
-
require_relative "lib/inline_forms/version"
|
|
3
|
-
|
|
4
|
-
Bundler::GemHelper.install_tasks name: "inline_forms"
|
|
5
|
-
|
|
6
|
-
namespace :installer do
|
|
7
|
-
Bundler::GemHelper.install_tasks name: "inline_forms_installer"
|
|
8
|
-
end
|
|
9
|
-
|
|
10
|
-
namespace :schema_edit do
|
|
11
|
-
# The schema-GUI gem lives in its own subdirectory (own gemspec, own pkg/).
|
|
12
|
-
Bundler::GemHelper.install_tasks dir: File.expand_path("inline_forms_schema_edit", __dir__),
|
|
13
|
-
name: "inline_forms_schema_edit"
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
def inline_forms_pkg_gems
|
|
17
|
-
version = InlineForms::VERSION
|
|
18
|
-
{ "inline_forms" => "pkg",
|
|
19
|
-
"inline_forms_installer" => "pkg",
|
|
20
|
-
"inline_forms_schema_edit" => "inline_forms_schema_edit/pkg" }.map do |name, pkg|
|
|
21
|
-
path = File.expand_path(File.join(pkg, "#{name}-#{version}.gem"), __dir__)
|
|
22
|
-
raise "Missing #{path}. Run rake build:all first." unless File.file?(path)
|
|
23
|
-
path
|
|
24
|
-
end
|
|
25
|
-
end
|
|
26
|
-
|
|
27
|
-
def validation_hints_pkg_gem
|
|
28
|
-
version = InlineForms::VERSION
|
|
29
|
-
[
|
|
30
|
-
File.expand_path("../validation_hints/pkg/validation_hints-#{version}.gem", __dir__),
|
|
31
|
-
File.expand_path("~/code/validation_hints/pkg/validation_hints-#{version}.gem")
|
|
32
|
-
].find { |path| File.file?(path) }
|
|
33
|
-
end
|
|
34
|
-
|
|
35
|
-
desc "Build inline_forms, inline_forms_installer and inline_forms_schema_edit"
|
|
36
|
-
task "build:all" => [ "build", "installer:build", "schema_edit:build" ]
|
|
37
|
-
|
|
38
|
-
desc "Install freshly built gems from pkg/ into the current gemset (required before inline_forms create)"
|
|
39
|
-
task "install:local" => [ "build:all" ] do
|
|
40
|
-
gems = inline_forms_pkg_gems
|
|
41
|
-
vh = validation_hints_pkg_gem
|
|
42
|
-
gems << vh if vh
|
|
43
|
-
sh "gem install #{gems.shelljoin}"
|
|
44
|
-
puts "Installed: #{gems.map { |g| File.basename(g) }.join(', ')}"
|
|
45
|
-
puts "Verify: inline_forms --version 2>/dev/null || gem which inline_forms_installer"
|
|
46
|
-
end
|
|
47
|
-
|
|
48
|
-
# Release inline_forms + inline_forms_installer + inline_forms_schema_edit
|
|
49
|
-
# (build, git tag/push, RubyGems push). Does not run inline_forms create,
|
|
50
|
-
# MyApp, or tests. validation_hints is a separate repo:
|
|
51
|
-
# cd ../validation_hints && rake release (same version number).
|
|
52
|
-
# Release git-push ALWAYS targets `origin` (GitHub) only.
|
|
53
|
-
#
|
|
54
|
-
# Do NOT use Bundler's stock `release:source_control_push`: it pushes to the
|
|
55
|
-
# CURRENT BRANCH's tracking remote (`git config branch.<branch>.remote`).
|
|
56
|
-
# Feature branches in this repo track `forgejo` (dev02) because that's where
|
|
57
|
-
# CI runs, so a release cut from a feature branch would push the release commit
|
|
58
|
-
# and version tag to forgejo instead of GitHub. `origin` is the only place
|
|
59
|
-
# release commits/tags belong; `forgejo` is CI-only. This task is also
|
|
60
|
-
# idempotent on the tag, so a re-run after a failed push still lands the tag on
|
|
61
|
-
# origin (Bundler's version skips entirely once the tag exists locally).
|
|
62
|
-
# Also override the bare `release` task (from install_tasks above) so a stray
|
|
63
|
-
# `rake release` can't push to a feature branch's forgejo tracking remote
|
|
64
|
-
# either. The intended entry point is `release:all`, but this closes the
|
|
65
|
-
# footgun on both.
|
|
66
|
-
Rake::Task["release"].clear if Rake::Task.task_defined?("release")
|
|
67
|
-
desc "Build inline_forms, tag, push to origin (GitHub) and push the gem to RubyGems"
|
|
68
|
-
task "release" => [ "build", "release:guard_clean",
|
|
69
|
-
"release:push_to_origin", "release:rubygem_push" ]
|
|
70
|
-
|
|
71
|
-
desc "Tag the release and push the commit + tag to origin (GitHub) only"
|
|
72
|
-
task "release:push_to_origin" do
|
|
73
|
-
version = InlineForms::VERSION
|
|
74
|
-
tag = "v#{version}"
|
|
75
|
-
branch = `git rev-parse --abbrev-ref HEAD`.strip
|
|
76
|
-
unless system("git", "rev-parse", "-q", "--verify", "refs/tags/#{tag}",
|
|
77
|
-
out: File::NULL, err: File::NULL)
|
|
78
|
-
sh "git", "tag", tag
|
|
79
|
-
end
|
|
80
|
-
sh "git", "push", "origin", "refs/heads/#{branch}"
|
|
81
|
-
sh "git", "push", "origin", "refs/tags/#{tag}"
|
|
82
|
-
end
|
|
83
|
-
|
|
84
|
-
desc "Release inline_forms, inline_forms_installer and inline_forms_schema_edit to RubyGems (no app generation)"
|
|
85
|
-
task "release:all" => [
|
|
86
|
-
"build:all",
|
|
87
|
-
"release:guard_clean",
|
|
88
|
-
"release:push_to_origin",
|
|
89
|
-
"release:rubygem_push",
|
|
90
|
-
"installer:release:rubygem_push",
|
|
91
|
-
"schema_edit:release:rubygem_push"
|
|
92
|
-
]
|
|
93
|
-
|
|
94
|
-
require "rake/testtask"
|
|
95
|
-
|
|
96
|
-
Rake::TestTask.new(:test) do |t|
|
|
97
|
-
t.libs << "test"
|
|
98
|
-
t.test_files = FileList["test/**/*_test.rb"]
|
|
99
|
-
t.verbose = true
|
|
100
|
-
t.warning = true
|
|
101
|
-
end
|
|
102
|
-
|
|
103
|
-
task default: :test
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require "fileutils"
|
|
4
|
-
require "active_support/core_ext/string/inflections"
|
|
5
|
-
|
|
6
|
-
root = File.expand_path("..", __dir__)
|
|
7
|
-
src = File.join(root, "app/helpers/form_elements")
|
|
8
|
-
dst = File.join(root, "app/helpers/inline_forms/form_elements")
|
|
9
|
-
registry = {}
|
|
10
|
-
|
|
11
|
-
Dir.chdir(src)
|
|
12
|
-
Dir.glob("*.rb").sort.each do |basename|
|
|
13
|
-
content = File.read(basename)
|
|
14
|
-
content.scan(/InlineForms::SPECIAL_COLUMN_TYPES\[:(\w+)\]\s*=\s*:(\w+)/) do |k, v|
|
|
15
|
-
registry[k.to_sym] = v.to_sym
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
body = content.lines.reject do |l|
|
|
19
|
-
l =~ /InlineForms::SPECIAL_COLUMN_TYPES/ ||
|
|
20
|
-
l =~ /^#.*SPECIAL_COLUMN_TYPES/ ||
|
|
21
|
-
l =~ /^#\s*-*\s*encoding/
|
|
22
|
-
end.join
|
|
23
|
-
body = body.strip
|
|
24
|
-
next if body.empty?
|
|
25
|
-
|
|
26
|
-
mod = File.basename(basename, ".rb").camelize + "Helper"
|
|
27
|
-
out = <<~RUBY
|
|
28
|
-
# -*- encoding : utf-8 -*-
|
|
29
|
-
module InlineForms
|
|
30
|
-
module FormElements
|
|
31
|
-
module #{mod}
|
|
32
|
-
module_eval(<<~'INLINE_FORMS_FORM_ELEMENT', __FILE__, __LINE__ + 1)
|
|
33
|
-
#{body.gsub(/^/, " ")}
|
|
34
|
-
INLINE_FORMS_FORM_ELEMENT
|
|
35
|
-
end
|
|
36
|
-
end
|
|
37
|
-
end
|
|
38
|
-
RUBY
|
|
39
|
-
|
|
40
|
-
FileUtils.mkdir_p(dst)
|
|
41
|
-
File.write(File.join(dst, "#{File.basename(basename, '.rb')}_helper.rb"), out)
|
|
42
|
-
end
|
|
43
|
-
|
|
44
|
-
registry_path = File.join(root, "lib/inline_forms/form_element_registry.rb")
|
|
45
|
-
entries = registry.map { |k, v| " #{k.inspect} => #{v.inspect}," }.join("\n")
|
|
46
|
-
File.write(registry_path, <<~RUBY)
|
|
47
|
-
# frozen_string_literal: true
|
|
48
|
-
|
|
49
|
-
module InlineForms
|
|
50
|
-
module FormElementRegistry
|
|
51
|
-
ENTRIES = {
|
|
52
|
-
#{entries}
|
|
53
|
-
}.freeze
|
|
54
|
-
|
|
55
|
-
def self.apply!
|
|
56
|
-
SPECIAL_COLUMN_TYPES.merge!(ENTRIES)
|
|
57
|
-
end
|
|
58
|
-
end
|
|
59
|
-
end
|
|
60
|
-
RUBY
|
|
61
|
-
|
|
62
|
-
puts "Migrated #{Dir.glob(File.join(dst, '*_helper.rb')).size} helpers"
|
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require_relative "test_helper"
|
|
4
|
-
require "inline_forms/archived_form_elements"
|
|
5
|
-
|
|
6
|
-
class ArchivedFormElementsTest < Minitest::Test
|
|
7
|
-
class ModelWithArchivedElement
|
|
8
|
-
def inline_forms_attribute_list
|
|
9
|
-
[ [ :address, :geo_code_curacao ] ]
|
|
10
|
-
end
|
|
11
|
-
end
|
|
12
|
-
|
|
13
|
-
class ModelWithArchivedTree
|
|
14
|
-
def inline_forms_attribute_list
|
|
15
|
-
[ [ :children, :tree ] ]
|
|
16
|
-
end
|
|
17
|
-
end
|
|
18
|
-
|
|
19
|
-
class ModelWithArchivedCkeditor
|
|
20
|
-
def inline_forms_attribute_list
|
|
21
|
-
[ [ :body, :ckeditor ] ]
|
|
22
|
-
end
|
|
23
|
-
end
|
|
24
|
-
|
|
25
|
-
class ModelWithArchivedTextAreaWithoutCkeditor
|
|
26
|
-
def inline_forms_attribute_list
|
|
27
|
-
[ [ :notes, :text_area_without_ckeditor ] ]
|
|
28
|
-
end
|
|
29
|
-
end
|
|
30
|
-
|
|
31
|
-
def test_raises_when_model_declares_archived_geo_code_curacao
|
|
32
|
-
err = assert_raises(InlineForms::ArchivedFormElementError) do
|
|
33
|
-
InlineForms.validate_no_archived_form_elements_for!(ModelWithArchivedElement)
|
|
34
|
-
end
|
|
35
|
-
assert_includes err.message, "geo_code_curacao"
|
|
36
|
-
assert_includes err.message, "7.6.0"
|
|
37
|
-
assert_includes err.message, "archived/form_elements/geo_code_curacao"
|
|
38
|
-
end
|
|
39
|
-
|
|
40
|
-
def test_raises_when_model_declares_archived_tree
|
|
41
|
-
err = assert_raises(InlineForms::ArchivedFormElementError) do
|
|
42
|
-
InlineForms.validate_no_archived_form_elements_for!(ModelWithArchivedTree)
|
|
43
|
-
end
|
|
44
|
-
assert_includes err.message, "tree"
|
|
45
|
-
assert_includes err.message, "archived/form_elements/tree"
|
|
46
|
-
end
|
|
47
|
-
|
|
48
|
-
def test_raises_when_model_declares_archived_ckeditor
|
|
49
|
-
err = assert_raises(InlineForms::ArchivedFormElementError) do
|
|
50
|
-
InlineForms.validate_no_archived_form_elements_for!(ModelWithArchivedCkeditor)
|
|
51
|
-
end
|
|
52
|
-
assert_includes err.message, "ckeditor"
|
|
53
|
-
assert_includes err.message, "8.1.21"
|
|
54
|
-
assert_includes err.message, "archived/form_elements/ckeditor"
|
|
55
|
-
end
|
|
56
|
-
|
|
57
|
-
def test_raises_when_model_declares_archived_text_area_without_ckeditor
|
|
58
|
-
err = assert_raises(InlineForms::ArchivedFormElementError) do
|
|
59
|
-
InlineForms.validate_no_archived_form_elements_for!(ModelWithArchivedTextAreaWithoutCkeditor)
|
|
60
|
-
end
|
|
61
|
-
assert_includes err.message, "text_area_without_ckeditor"
|
|
62
|
-
assert_includes err.message, "8.1.21"
|
|
63
|
-
assert_includes err.message, "archived/form_elements/ckeditor"
|
|
64
|
-
end
|
|
65
|
-
|
|
66
|
-
def test_archived_registry_documents_absence_list_without_path
|
|
67
|
-
meta = InlineForms::ARCHIVED_FORM_ELEMENTS[:absence_list]
|
|
68
|
-
assert_equal "6.3.0", meta[:removed_in_version]
|
|
69
|
-
assert_nil meta[:archive_path]
|
|
70
|
-
end
|
|
71
|
-
|
|
72
|
-
class ModelWithArchivedQuestionList
|
|
73
|
-
def inline_forms_attribute_list
|
|
74
|
-
[ [ :questions, :question_list ] ]
|
|
75
|
-
end
|
|
76
|
-
end
|
|
77
|
-
|
|
78
|
-
class ModelWithArchivedDnsrecords
|
|
79
|
-
def inline_forms_attribute_list
|
|
80
|
-
[ [ :records, :dnsrecords ] ]
|
|
81
|
-
end
|
|
82
|
-
end
|
|
83
|
-
|
|
84
|
-
def test_raises_when_model_declares_archived_question_list
|
|
85
|
-
err = assert_raises(InlineForms::ArchivedFormElementError) do
|
|
86
|
-
InlineForms.validate_no_archived_form_elements_for!(ModelWithArchivedQuestionList)
|
|
87
|
-
end
|
|
88
|
-
assert_includes err.message, "question_list"
|
|
89
|
-
assert_includes err.message, "8.1.30"
|
|
90
|
-
assert_includes err.message, "archived/form_elements/question_list"
|
|
91
|
-
end
|
|
92
|
-
|
|
93
|
-
def test_raises_when_model_declares_archived_dnsrecords
|
|
94
|
-
err = assert_raises(InlineForms::ArchivedFormElementError) do
|
|
95
|
-
InlineForms.validate_no_archived_form_elements_for!(ModelWithArchivedDnsrecords)
|
|
96
|
-
end
|
|
97
|
-
assert_includes err.message, "dnsrecords"
|
|
98
|
-
assert_includes err.message, "8.1.30"
|
|
99
|
-
assert_includes err.message, "archived/form_elements/dns_records"
|
|
100
|
-
end
|
|
101
|
-
end
|
data/test/attribute_list_test.rb
DELETED
|
@@ -1,165 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require_relative "test_helper"
|
|
4
|
-
|
|
5
|
-
class AttributeListTest < Minitest::Test
|
|
6
|
-
def build_sample
|
|
7
|
-
InlineForms::AttributeList.build do
|
|
8
|
-
header :basics
|
|
9
|
-
field :name, :text_field
|
|
10
|
-
field :priority, :dropdown_with_values, values: { 1 => "low", 2 => "high" }
|
|
11
|
-
field :flag, :dropdown_with_values, values: { 1 => "a", 2 => "b" }, disabled: [ 2 ]
|
|
12
|
-
info :created_at, :updated_at
|
|
13
|
-
end
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
# -- array compatibility (the whole point) -----------------------------
|
|
17
|
-
|
|
18
|
-
def test_is_an_array
|
|
19
|
-
assert_kind_of Array, build_sample
|
|
20
|
-
end
|
|
21
|
-
|
|
22
|
-
def test_destructures_like_the_legacy_literal
|
|
23
|
-
seen = []
|
|
24
|
-
build_sample.each { |attribute, form_element| seen << [ attribute, form_element ] }
|
|
25
|
-
assert_includes seen, [ :name, :text_field ]
|
|
26
|
-
assert_includes seen, [ :priority, :dropdown_with_values ]
|
|
27
|
-
end
|
|
28
|
-
|
|
29
|
-
def test_assoc_positional_values_hash_still_works
|
|
30
|
-
list = build_sample
|
|
31
|
-
# Consumers fetch the values hash as list.assoc(attr)[2].
|
|
32
|
-
assert_equal({ 1 => "low", 2 => "high" }, list.assoc(:priority)[2])
|
|
33
|
-
assert_equal([ 2 ], list.assoc(:flag)[3])
|
|
34
|
-
assert_nil list.assoc(:name)[2]
|
|
35
|
-
end
|
|
36
|
-
|
|
37
|
-
def test_build_produces_expected_rows
|
|
38
|
-
list = build_sample
|
|
39
|
-
assert_equal(
|
|
40
|
-
[
|
|
41
|
-
[ :basics, :header ],
|
|
42
|
-
[ :name, :text_field ],
|
|
43
|
-
[ :priority, :dropdown_with_values, { 1 => "low", 2 => "high" } ],
|
|
44
|
-
[ :flag, :dropdown_with_values, { 1 => "a", 2 => "b" }, [ 2 ] ],
|
|
45
|
-
[ :created_at, :info ],
|
|
46
|
-
[ :updated_at, :info ]
|
|
47
|
-
],
|
|
48
|
-
list.to_a
|
|
49
|
-
)
|
|
50
|
-
end
|
|
51
|
-
|
|
52
|
-
# -- append -------------------------------------------------------------
|
|
53
|
-
|
|
54
|
-
def test_field_appends_and_returns_self_for_chaining
|
|
55
|
-
list = InlineForms::AttributeList.new
|
|
56
|
-
result = list.field(:a, :text_field).field(:b, :check_box)
|
|
57
|
-
assert_same list, result
|
|
58
|
-
assert_equal %i[a b], list.names
|
|
59
|
-
end
|
|
60
|
-
|
|
61
|
-
def test_disabled_without_values_raises
|
|
62
|
-
assert_raises(ArgumentError) do
|
|
63
|
-
InlineForms::AttributeList.new.field(:x, :dropdown_with_values, disabled: [ 1 ])
|
|
64
|
-
end
|
|
65
|
-
end
|
|
66
|
-
|
|
67
|
-
# -- insertion ----------------------------------------------------------
|
|
68
|
-
|
|
69
|
-
def test_insert_after
|
|
70
|
-
list = build_sample.insert_after(:name, :nickname, :text_field)
|
|
71
|
-
assert_equal :nickname, list.names[list.index_of(:name) + 1]
|
|
72
|
-
end
|
|
73
|
-
|
|
74
|
-
def test_insert_before
|
|
75
|
-
list = build_sample.insert_before(:priority, :urgent, :check_box)
|
|
76
|
-
assert_equal :urgent, list.names[list.index_of(:priority) - 1]
|
|
77
|
-
end
|
|
78
|
-
|
|
79
|
-
def test_insert_after_missing_anchor_raises
|
|
80
|
-
assert_raises(ArgumentError) { build_sample.insert_after(:nope, :x, :text_field) }
|
|
81
|
-
end
|
|
82
|
-
|
|
83
|
-
# -- removal ------------------------------------------------------------
|
|
84
|
-
|
|
85
|
-
def test_remove_present
|
|
86
|
-
list = build_sample.remove(:priority)
|
|
87
|
-
refute list.include_attribute?(:priority)
|
|
88
|
-
end
|
|
89
|
-
|
|
90
|
-
def test_remove_absent_is_noop
|
|
91
|
-
list = build_sample
|
|
92
|
-
before = list.dup
|
|
93
|
-
list.remove(:does_not_exist)
|
|
94
|
-
assert_equal before.to_a, list.to_a
|
|
95
|
-
end
|
|
96
|
-
|
|
97
|
-
# -- reordering ---------------------------------------------------------
|
|
98
|
-
|
|
99
|
-
def test_move_after
|
|
100
|
-
list = build_sample.move_after(:name, :updated_at)
|
|
101
|
-
assert_equal :name, list.names.last
|
|
102
|
-
assert_equal 1, list.names.count(:name)
|
|
103
|
-
end
|
|
104
|
-
|
|
105
|
-
def test_move_before
|
|
106
|
-
list = build_sample.move_before(:updated_at, :basics)
|
|
107
|
-
assert_equal 0, list.index_of(:updated_at)
|
|
108
|
-
assert_equal 1, list.names.count(:updated_at)
|
|
109
|
-
end
|
|
110
|
-
|
|
111
|
-
def test_move_relative_to_itself_raises
|
|
112
|
-
assert_raises(ArgumentError) { build_sample.move_after(:name, :name) }
|
|
113
|
-
end
|
|
114
|
-
|
|
115
|
-
# -- replacement --------------------------------------------------------
|
|
116
|
-
|
|
117
|
-
def test_replace_element_preserves_position
|
|
118
|
-
list = build_sample
|
|
119
|
-
pos = list.index_of(:priority)
|
|
120
|
-
list.replace_element(:priority, :radio_button, values: { 1 => "x" })
|
|
121
|
-
assert_equal pos, list.index_of(:priority)
|
|
122
|
-
assert_equal :radio_button, list.form_element_for(:priority)
|
|
123
|
-
assert_equal({ 1 => "x" }, list.values_for(:priority))
|
|
124
|
-
end
|
|
125
|
-
|
|
126
|
-
def test_replace_element_absent_is_noop
|
|
127
|
-
list = build_sample
|
|
128
|
-
before = list.dup
|
|
129
|
-
list.replace_element(:nope, :text_field)
|
|
130
|
-
assert_equal before.to_a, list.to_a
|
|
131
|
-
end
|
|
132
|
-
|
|
133
|
-
# -- queries ------------------------------------------------------------
|
|
134
|
-
|
|
135
|
-
def test_query_helpers
|
|
136
|
-
list = build_sample
|
|
137
|
-
assert_equal 1, list.index_of(:name)
|
|
138
|
-
assert list.include_attribute?(:flag)
|
|
139
|
-
refute list.include_attribute?(:ghost)
|
|
140
|
-
assert_equal :dropdown_with_values, list.form_element_for(:priority)
|
|
141
|
-
assert_equal({ 1 => "low", 2 => "high" }, list.values_for(:priority))
|
|
142
|
-
assert_equal [ :name, :text_field ], list.row_for(:name)
|
|
143
|
-
end
|
|
144
|
-
|
|
145
|
-
# -- wrap ---------------------------------------------------------------
|
|
146
|
-
|
|
147
|
-
def test_wrap_existing_array_enables_editing
|
|
148
|
-
legacy = [ [ :name, :text_field ], [ :email, :text_field ] ]
|
|
149
|
-
list = InlineForms::AttributeList.wrap(legacy)
|
|
150
|
-
assert_kind_of InlineForms::AttributeList, list
|
|
151
|
-
list.insert_after(:name, :phone, :text_field)
|
|
152
|
-
assert_equal %i[name phone email], list.names
|
|
153
|
-
end
|
|
154
|
-
|
|
155
|
-
def test_wrap_is_idempotent_for_attribute_list
|
|
156
|
-
list = build_sample
|
|
157
|
-
assert_same list, InlineForms::AttributeList.wrap(list)
|
|
158
|
-
end
|
|
159
|
-
|
|
160
|
-
def test_module_level_builder
|
|
161
|
-
list = InlineForms.attribute_list { field :a, :text_field }
|
|
162
|
-
assert_kind_of InlineForms::AttributeList, list
|
|
163
|
-
assert_equal %i[a], list.names
|
|
164
|
-
end
|
|
165
|
-
end
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
class ApplicationController < ActionController::Base
|
|
4
|
-
# Devise/role stand-in. The full `layouts/inline_forms` chrome (rendered by
|
|
5
|
-
# create/new HTML responses) calls `current_user.name` and
|
|
6
|
-
# `current_user.role?`, so a nil current_user cannot render it. The stub is
|
|
7
|
-
# superadmin so `destroy_permitted?` allows hard destroy, matching the
|
|
8
|
-
# generated apps' test user. A test can switch that off with
|
|
9
|
-
# dummy_user_superadmin (reset in InlineFormsIntegrationTestCase#setup).
|
|
10
|
-
mattr_accessor :dummy_user_superadmin, default: true
|
|
11
|
-
|
|
12
|
-
DummyUser = Struct.new(:id, :name) do
|
|
13
|
-
def role?(role)
|
|
14
|
-
role.to_sym == :superadmin && ApplicationController.dummy_user_superadmin
|
|
15
|
-
end
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
helper_method :current_user
|
|
19
|
-
|
|
20
|
-
# Generated apps redirect HTML with a notice; a bare 403 is easier to assert.
|
|
21
|
-
rescue_from CanCan::AccessDenied do
|
|
22
|
-
head :forbidden
|
|
23
|
-
end
|
|
24
|
-
|
|
25
|
-
def current_user
|
|
26
|
-
@current_user ||= DummyUser.new(1, "Dummy User")
|
|
27
|
-
end
|
|
28
|
-
|
|
29
|
-
def devise_controller?
|
|
30
|
-
false
|
|
31
|
-
end
|
|
32
|
-
end
|