uchi 0.1.2 → 0.1.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/README.md +222 -0
- data/app/assets/config/uchi_manifest.js +2 -0
- data/app/assets/javascripts/uchi/application.js +6095 -0
- data/app/assets/javascripts/uchi.js +4 -0
- data/app/assets/stylesheets/uchi/application.css +3971 -0
- data/app/assets/stylesheets/uchi/uchi.css +17 -0
- data/app/assets/tailwind/uchi.css +21 -0
- data/app/components/flowbite/breadcrumb.rb +33 -0
- data/app/components/flowbite/breadcrumb_home.rb +26 -0
- data/app/components/flowbite/breadcrumb_item/current.rb +33 -0
- data/app/components/flowbite/breadcrumb_item/first.rb +35 -0
- data/app/components/flowbite/breadcrumb_item.rb +48 -0
- data/app/components/flowbite/breadcrumb_separator.rb +30 -0
- data/app/components/flowbite/button/outline.rb +22 -0
- data/app/components/flowbite/button/pill.rb +40 -0
- data/app/components/flowbite/button.rb +92 -0
- data/app/components/flowbite/card.rb +45 -0
- data/app/components/flowbite/input/checkbox.rb +73 -0
- data/app/components/flowbite/input/date.rb +11 -0
- data/app/components/flowbite/input/date_time.rb +11 -0
- data/app/components/flowbite/input/email.rb +12 -0
- data/app/components/flowbite/input/field.rb +117 -0
- data/app/components/flowbite/input/file.rb +30 -0
- data/app/components/flowbite/input/hint.rb +57 -0
- data/app/components/flowbite/input/label.rb +82 -0
- data/app/components/flowbite/input/number.rb +11 -0
- data/app/components/flowbite/input/password.rb +11 -0
- data/app/components/flowbite/input/phone.rb +11 -0
- data/app/components/flowbite/input/radio_button.rb +50 -0
- data/app/components/flowbite/input/select.rb +49 -0
- data/app/components/flowbite/input/textarea.rb +42 -0
- data/app/components/flowbite/input/url.rb +12 -0
- data/app/components/flowbite/input/validation_error.rb +11 -0
- data/app/components/flowbite/input_field/checkbox.html.erb +14 -0
- data/app/components/flowbite/input_field/checkbox.rb +54 -0
- data/app/components/flowbite/input_field/date.rb +13 -0
- data/app/components/flowbite/input_field/date_time.rb +13 -0
- data/app/components/flowbite/input_field/email.rb +13 -0
- data/app/components/flowbite/input_field/file.rb +13 -0
- data/app/components/flowbite/input_field/input_field.html.erb +8 -0
- data/app/components/flowbite/input_field/number.rb +13 -0
- data/app/components/flowbite/input_field/password.rb +13 -0
- data/app/components/flowbite/input_field/phone.rb +13 -0
- data/app/components/flowbite/input_field/radio_button.html.erb +14 -0
- data/app/components/flowbite/input_field/radio_button.rb +86 -0
- data/app/components/flowbite/input_field/select.rb +31 -0
- data/app/components/flowbite/input_field/text.rb +8 -0
- data/app/components/flowbite/input_field/textarea.rb +13 -0
- data/app/components/flowbite/input_field/url.rb +13 -0
- data/app/components/flowbite/input_field.rb +192 -0
- data/app/components/flowbite/link.rb +21 -0
- data/app/components/flowbite/style.rb +13 -0
- data/app/components/flowbite/toast/icon.html.erb +5 -0
- data/app/components/flowbite/toast/icon.rb +57 -0
- data/app/components/flowbite/toast/toast.html.erb +11 -0
- data/app/components/flowbite/toast.rb +34 -0
- data/app/components/uchi/field/base.rb +57 -0
- data/app/components/uchi/field/belongs_to/edit.html.erb +1 -0
- data/app/components/uchi/field/belongs_to/index.html.erb +1 -0
- data/app/components/uchi/field/belongs_to/show.html.erb +3 -0
- data/app/components/uchi/field/belongs_to.rb +105 -0
- data/app/components/uchi/field/blank/edit.html.erb +1 -0
- data/app/components/uchi/field/blank/index.html.erb +1 -0
- data/app/components/uchi/field/blank/show.html.erb +1 -0
- data/app/components/uchi/field/blank.rb +16 -0
- data/app/components/uchi/field/boolean/edit.html.erb +1 -0
- data/app/components/uchi/field/boolean/index.html.erb +9 -0
- data/app/components/uchi/field/boolean/show.html.erb +9 -0
- data/app/components/uchi/field/boolean.rb +27 -0
- data/app/components/uchi/field/date/edit.html.erb +1 -0
- data/app/components/uchi/field/date/index.html.erb +1 -0
- data/app/components/uchi/field/date/show.html.erb +1 -0
- data/app/components/uchi/field/date.rb +27 -0
- data/app/components/uchi/field/date_time/edit.html.erb +1 -0
- data/app/components/uchi/field/date_time/index.html.erb +1 -0
- data/app/components/uchi/field/date_time/show.html.erb +1 -0
- data/app/components/uchi/field/date_time.rb +27 -0
- data/app/components/uchi/field/file/edit.html.erb +1 -0
- data/app/components/uchi/field/file/index.html.erb +6 -0
- data/app/components/uchi/field/file/show.html.erb +8 -0
- data/app/components/uchi/field/file.rb +37 -0
- data/app/components/uchi/field/has_and_belongs_to_many/edit.html.erb +9 -0
- data/app/components/uchi/field/has_and_belongs_to_many/index.html.erb +1 -0
- data/app/components/uchi/field/has_and_belongs_to_many/show.html.erb +28 -0
- data/app/components/uchi/field/has_and_belongs_to_many.rb +131 -0
- data/app/components/uchi/field/has_many/edit.html.erb +1 -0
- data/app/components/uchi/field/has_many/index.html.erb +1 -0
- data/app/components/uchi/field/has_many/show.html.erb +28 -0
- data/app/components/uchi/field/has_many.rb +107 -0
- data/app/components/uchi/field/id/index.html.erb +4 -0
- data/app/components/uchi/field/id/show.html.erb +4 -0
- data/app/components/uchi/field/id.rb +26 -0
- data/app/components/uchi/field/image/edit.html.erb +1 -0
- data/app/components/uchi/field/image/index.html.erb +6 -0
- data/app/components/uchi/field/image/show.html.erb +6 -0
- data/app/components/uchi/field/image.rb +38 -0
- data/app/components/uchi/field/number/edit.html.erb +1 -0
- data/app/components/uchi/field/number/index.html.erb +1 -0
- data/app/components/uchi/field/number/show.html.erb +1 -0
- data/app/components/uchi/field/number.rb +32 -0
- data/app/components/uchi/field/string/edit.html.erb +1 -0
- data/app/components/uchi/field/string/index.html.erb +1 -0
- data/app/components/uchi/field/string/show.html.erb +1 -0
- data/app/components/uchi/field/string.rb +33 -0
- data/app/components/uchi/field/text/edit.html.erb +1 -0
- data/app/components/uchi/field/text/index.html.erb +1 -0
- data/app/components/uchi/field/text/show.html.erb +1 -0
- data/app/components/uchi/field/text.rb +38 -0
- data/app/components/uchi/ui/breadcrumb/breadcrumb.html.erb +13 -0
- data/app/components/uchi/ui/breadcrumb.rb +14 -0
- data/app/components/uchi/ui/form/footer/footer.html.erb +5 -0
- data/app/components/uchi/ui/form/footer.rb +15 -0
- data/app/components/uchi/ui/form/input/collection_checkboxes.html.erb +32 -0
- data/app/components/uchi/ui/form/input/collection_checkboxes.rb +125 -0
- data/app/components/uchi/ui/frame/frame.html.erb +3 -0
- data/app/components/uchi/ui/frame.rb +10 -0
- data/app/components/uchi/ui/index/records_table/records_table.html.erb +67 -0
- data/app/components/uchi/ui/index/records_table/search_form/search_form.html.erb +21 -0
- data/app/components/uchi/ui/index/records_table/search_form.rb +49 -0
- data/app/components/uchi/ui/index/records_table.rb +29 -0
- data/app/components/uchi/ui/index/turbo_frame.rb +50 -0
- data/app/components/uchi/ui/page_header/page_header.html.erb +24 -0
- data/app/components/uchi/ui/page_header.rb +18 -0
- data/app/components/uchi/ui/pagination/current_link.html.erb +3 -0
- data/app/components/uchi/ui/pagination/current_link.rb +10 -0
- data/app/components/uchi/ui/pagination/gap.html.erb +3 -0
- data/app/components/uchi/ui/pagination/gap.rb +10 -0
- data/app/components/uchi/ui/pagination/item.rb +24 -0
- data/app/components/uchi/ui/pagination/link.html.erb +3 -0
- data/app/components/uchi/ui/pagination/link.rb +10 -0
- data/app/components/uchi/ui/pagination/next_link.html.erb +8 -0
- data/app/components/uchi/ui/pagination/next_link.rb +22 -0
- data/app/components/uchi/ui/pagination/pagination.html.erb +15 -0
- data/app/components/uchi/ui/pagination/previous_link.html.erb +8 -0
- data/app/components/uchi/ui/pagination/previous_link.rb +22 -0
- data/app/components/uchi/ui/pagination.rb +48 -0
- data/app/components/uchi/ui/show/attribute_fields/attribute_fields.html.erb +14 -0
- data/app/components/uchi/ui/show/attribute_fields.rb +18 -0
- data/app/components/uchi/ui/spinner/spinner.html.erb +7 -0
- data/app/components/uchi/ui/spinner.rb +15 -0
- data/app/controllers/uchi/application_controller.rb +4 -0
- data/app/controllers/uchi/controller.rb +13 -0
- data/app/controllers/uchi/repository_controller.rb +166 -0
- data/app/helpers/uchi/application_helper.rb +17 -0
- data/app/jobs/uchi/application_job.rb +4 -0
- data/app/mailers/uchi/application_mailer.rb +6 -0
- data/app/views/layouts/uchi/_flash_messages.html.erb +10 -0
- data/app/views/layouts/uchi/application.html.erb +33 -0
- data/app/views/uchi/repository/edit.html.erb +40 -0
- data/app/views/uchi/repository/index.html.erb +49 -0
- data/app/views/uchi/repository/new.html.erb +37 -0
- data/app/views/uchi/repository/show.html.erb +41 -0
- data/lib/generators/uchi/controller/controller_generator.rb +16 -0
- data/lib/generators/uchi/controller/templates/controller.rb.tt +11 -0
- data/lib/generators/uchi/install/install_generator.rb +13 -0
- data/lib/generators/uchi/repository/repository_generator.rb +16 -0
- data/lib/generators/uchi/repository/templates/repository.rb.tt +11 -0
- data/lib/tasks/uchi_tasks.rake +4 -0
- data/lib/uchi/application_record.rb +5 -0
- data/lib/uchi/engine.rb +24 -0
- data/lib/uchi/field/configuration.rb +142 -0
- data/lib/uchi/field.rb +80 -0
- data/lib/uchi/i18n.rb +13 -0
- data/lib/uchi/pagination/controller.rb +26 -0
- data/lib/uchi/pagination/page.rb +20 -0
- data/lib/uchi/pagy/LICENSE.txt +21 -0
- data/lib/uchi/pagy/classes/exceptions.rb +35 -0
- data/lib/uchi/pagy/classes/offset/offset.rb +56 -0
- data/lib/uchi/pagy/classes/request.rb +38 -0
- data/lib/uchi/pagy/modules/abilities/configurable.rb +38 -0
- data/lib/uchi/pagy/modules/abilities/linkable.rb +62 -0
- data/lib/uchi/pagy/modules/abilities/rangeable.rb +17 -0
- data/lib/uchi/pagy/modules/abilities/shiftable.rb +14 -0
- data/lib/uchi/pagy/modules/console.rb +40 -0
- data/lib/uchi/pagy/toolbox/helpers/loader.rb +19 -0
- data/lib/uchi/pagy/toolbox/helpers/page_url.rb +25 -0
- data/lib/uchi/pagy/toolbox/paginators/method.rb +21 -0
- data/lib/uchi/pagy/toolbox/paginators/offset.rb +35 -0
- data/lib/uchi/pagy.rb +60 -0
- data/lib/uchi/repository/routes.rb +62 -0
- data/lib/uchi/repository/translate.rb +284 -0
- data/lib/uchi/repository.rb +156 -0
- data/lib/uchi/sort_order.rb +35 -0
- data/lib/uchi/version.rb +5 -0
- data/lib/uchi.rb +18 -0
- data/uchi.gemspec +35 -0
- metadata +197 -107
- data/.github/dependabot.yml +0 -17
- data/.github/workflows/build.yml +0 -23
- data/.github/workflows/lint.yml +0 -30
- data/package.json +0 -31
- data/sig/uchi.rbs +0 -4
- data/test/components/uchi/field/belongs_to_test.rb +0 -134
- data/test/components/uchi/field/blank_test.rb +0 -119
- data/test/components/uchi/field/boolean_test.rb +0 -163
- data/test/components/uchi/field/date_test.rb +0 -163
- data/test/components/uchi/field/date_time_test.rb +0 -152
- data/test/components/uchi/field/has_many_test.rb +0 -138
- data/test/components/uchi/field/id_test.rb +0 -113
- data/test/components/uchi/field/number_test.rb +0 -163
- data/test/components/uchi/field/string_test.rb +0 -159
- data/test/controllers/uchi/authors_controller_test.rb +0 -119
- data/test/controllers/uchi/repository_controller_test.rb +0 -93
- data/test/controllers/uchi/scoped_repository_controller_test.rb +0 -73
- data/test/dummy/Rakefile +0 -6
- data/test/dummy/app/assets/images/.keep +0 -0
- data/test/dummy/app/assets/stylesheets/application.css +0 -15
- data/test/dummy/app/controllers/application_controller.rb +0 -4
- data/test/dummy/app/controllers/concerns/.keep +0 -0
- data/test/dummy/app/controllers/uchi/authors_controller.rb +0 -7
- data/test/dummy/app/controllers/uchi/books_controller.rb +0 -7
- data/test/dummy/app/controllers/uchi/titles_controller.rb +0 -7
- data/test/dummy/app/helpers/application_helper.rb +0 -2
- data/test/dummy/app/jobs/application_job.rb +0 -7
- data/test/dummy/app/mailers/application_mailer.rb +0 -4
- data/test/dummy/app/models/application_record.rb +0 -3
- data/test/dummy/app/models/author.rb +0 -3
- data/test/dummy/app/models/book.rb +0 -3
- data/test/dummy/app/models/concerns/.keep +0 -0
- data/test/dummy/app/models/title.rb +0 -3
- data/test/dummy/app/uchi/repositories/author.rb +0 -20
- data/test/dummy/app/uchi/repositories/book.rb +0 -16
- data/test/dummy/app/uchi/repositories/title.rb +0 -17
- data/test/dummy/app/views/layouts/application.html.erb +0 -27
- data/test/dummy/app/views/layouts/mailer.html.erb +0 -13
- data/test/dummy/app/views/layouts/mailer.text.erb +0 -1
- data/test/dummy/app/views/pwa/manifest.json.erb +0 -22
- data/test/dummy/app/views/pwa/service-worker.js +0 -26
- data/test/dummy/bin/dev +0 -2
- data/test/dummy/bin/rails +0 -4
- data/test/dummy/bin/rake +0 -4
- data/test/dummy/bin/setup +0 -34
- data/test/dummy/config/application.rb +0 -29
- data/test/dummy/config/boot.rb +0 -5
- data/test/dummy/config/cable.yml +0 -10
- data/test/dummy/config/database.yml +0 -32
- data/test/dummy/config/environment.rb +0 -5
- data/test/dummy/config/environments/development.rb +0 -69
- data/test/dummy/config/environments/production.rb +0 -89
- data/test/dummy/config/environments/test.rb +0 -53
- data/test/dummy/config/initializers/content_security_policy.rb +0 -25
- data/test/dummy/config/initializers/filter_parameter_logging.rb +0 -8
- data/test/dummy/config/initializers/inflections.rb +0 -16
- data/test/dummy/config/locales/da.yml +0 -51
- data/test/dummy/config/locales/en.yml +0 -31
- data/test/dummy/config/puma.rb +0 -38
- data/test/dummy/config/routes.rb +0 -9
- data/test/dummy/config/storage.yml +0 -34
- data/test/dummy/config.ru +0 -6
- data/test/dummy/db/migrate/20251002183635_create_authors.rb +0 -11
- data/test/dummy/db/migrate/20251005131726_create_books.rb +0 -9
- data/test/dummy/db/migrate/20251005131811_create_titles.rb +0 -11
- data/test/dummy/db/schema.rb +0 -38
- data/test/dummy/log/.keep +0 -0
- data/test/dummy/public/400.html +0 -114
- data/test/dummy/public/404.html +0 -114
- data/test/dummy/public/406-unsupported-browser.html +0 -114
- data/test/dummy/public/422.html +0 -114
- data/test/dummy/public/500.html +0 -114
- data/test/dummy/public/icon.png +0 -0
- data/test/dummy/public/icon.svg +0 -3
- data/test/dummy/storage/.keep +0 -0
- data/test/dummy/test/fixtures/authors.yml +0 -11
- data/test/dummy/test/models/author_test.rb +0 -7
- data/test/dummy/tmp/.keep +0 -0
- data/test/dummy/tmp/pids/.keep +0 -0
- data/test/dummy/tmp/storage/.keep +0 -0
- data/test/test_helper.rb +0 -15
- data/test/uchi/field_test.rb +0 -63
- data/test/uchi/i18n_test.rb +0 -18
- data/test/uchi/repository/routes_test.rb +0 -49
- data/test/uchi/repository/translate_test.rb +0 -263
- data/test/uchi/repository_test.rb +0 -137
- data/test/uchi/sort_order_test.rb +0 -47
- data/test/uchi_test.rb +0 -7
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
require "test_helper"
|
|
2
|
-
|
|
3
|
-
module Uchi
|
|
4
|
-
class RepositoryControllerTest < ActionDispatch::IntegrationTest
|
|
5
|
-
setup do
|
|
6
|
-
@book = Book.create!(original_title: "The Hobbit")
|
|
7
|
-
end
|
|
8
|
-
|
|
9
|
-
test "DELETE destroy deletes the record" do
|
|
10
|
-
delete uchi_book_url(id: @book.id)
|
|
11
|
-
|
|
12
|
-
assert_not Book.exists?(@book.id)
|
|
13
|
-
end
|
|
14
|
-
|
|
15
|
-
test "DELETE destroy redirects to index" do
|
|
16
|
-
delete uchi_book_url(id: @book.id)
|
|
17
|
-
|
|
18
|
-
assert_redirected_to uchi_books_url
|
|
19
|
-
end
|
|
20
|
-
|
|
21
|
-
test "GET edit responds successfully" do
|
|
22
|
-
get edit_uchi_book_url(id: @book.id)
|
|
23
|
-
assert_response :success
|
|
24
|
-
end
|
|
25
|
-
|
|
26
|
-
test "GET edit renders a form for updating the model" do
|
|
27
|
-
get edit_uchi_book_url(id: @book.id)
|
|
28
|
-
assert_select "form[action=?][method='post']", uchi_book_path(id: @book.id)
|
|
29
|
-
end
|
|
30
|
-
|
|
31
|
-
test "GET edit links back to the model" do
|
|
32
|
-
get edit_uchi_book_url(id: @book.id)
|
|
33
|
-
assert_select "a[href=?]", uchi_book_path(id: @book.id), text: "Cancel"
|
|
34
|
-
end
|
|
35
|
-
|
|
36
|
-
test "GET index links to show for each record" do
|
|
37
|
-
get uchi_books_url
|
|
38
|
-
|
|
39
|
-
assert_select "tr td a[data-turbo-frame='_top'][href=?]", uchi_book_path(id: @book.id)
|
|
40
|
-
end
|
|
41
|
-
|
|
42
|
-
test "GET index links to edit for each record" do
|
|
43
|
-
get uchi_books_url
|
|
44
|
-
assert_select "tr td a[data-turbo-frame='_top'][href=?]", edit_uchi_book_path(id: @book.id)
|
|
45
|
-
end
|
|
46
|
-
|
|
47
|
-
test "GET new responds successfully" do
|
|
48
|
-
get new_uchi_book_url
|
|
49
|
-
assert_response :success
|
|
50
|
-
end
|
|
51
|
-
|
|
52
|
-
test "GET new renders a form to create a new model" do
|
|
53
|
-
get new_uchi_book_url
|
|
54
|
-
assert_select "form[action=?][method='post']", uchi_books_path
|
|
55
|
-
end
|
|
56
|
-
|
|
57
|
-
test "GET new links back to the index" do
|
|
58
|
-
get new_uchi_book_url
|
|
59
|
-
assert_select "a[href=?]", uchi_books_path, text: "Cancel"
|
|
60
|
-
end
|
|
61
|
-
|
|
62
|
-
test "GET show responds successfully" do
|
|
63
|
-
get uchi_book_url(id: @book.id)
|
|
64
|
-
assert_response :success
|
|
65
|
-
end
|
|
66
|
-
|
|
67
|
-
test "GET show renders the show view" do
|
|
68
|
-
get uchi_book_url(id: @book.id)
|
|
69
|
-
assert_template :show
|
|
70
|
-
end
|
|
71
|
-
|
|
72
|
-
test "GET show includes a button to delete the record" do
|
|
73
|
-
get uchi_book_url(id: @book.id)
|
|
74
|
-
assert_select "form[action=?]", uchi_book_path(id: @book.id), text: "Delete"
|
|
75
|
-
end
|
|
76
|
-
|
|
77
|
-
test "GET show includes a turbo-frame that loads the titles in a scoped index view" do
|
|
78
|
-
get uchi_book_url(id: @book.id)
|
|
79
|
-
|
|
80
|
-
assert_select "turbo-frame[src]" do |node_set|
|
|
81
|
-
tag = node_set.first
|
|
82
|
-
src = tag.attributes["src"].value
|
|
83
|
-
expected_src = uchi_titles_path(scope: {
|
|
84
|
-
model: "Book",
|
|
85
|
-
id: @book.id,
|
|
86
|
-
field: "titles",
|
|
87
|
-
inverse_of: "book"
|
|
88
|
-
})
|
|
89
|
-
assert_equal expected_src, src
|
|
90
|
-
end
|
|
91
|
-
end
|
|
92
|
-
end
|
|
93
|
-
end
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
require "test_helper"
|
|
2
|
-
|
|
3
|
-
module Uchi
|
|
4
|
-
class ScopedRepositoryControllerTest < ActionDispatch::IntegrationTest
|
|
5
|
-
setup do
|
|
6
|
-
@book = Book.create!(original_title: "The Hobbit")
|
|
7
|
-
@dk_title = Title.create!(book: @book, locale: "da-DK", title: "Hobbitten")
|
|
8
|
-
@de_title = Title.create!(locale: "de-DE", title: "Der Hobbit", book: @book)
|
|
9
|
-
|
|
10
|
-
@scope = {model: "Book", id: @book.id, field: "titles"}
|
|
11
|
-
end
|
|
12
|
-
|
|
13
|
-
test "GET edit responds successfully" do
|
|
14
|
-
get edit_uchi_title_url(id: @dk_title.id, scope: @scope)
|
|
15
|
-
assert_response :success
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
test "GET edit renders a form for updating the model" do
|
|
19
|
-
get edit_uchi_title_url(id: @dk_title.id, scope: @scope)
|
|
20
|
-
assert_select "form[action=?][method='post']", uchi_title_path(id: @dk_title.id)
|
|
21
|
-
end
|
|
22
|
-
|
|
23
|
-
test "GET edit links back to the scoped model" do
|
|
24
|
-
get edit_uchi_title_url(id: @dk_title.id, scope: @scope)
|
|
25
|
-
assert_select "a[href=?]", uchi_book_path(id: @book.id), text: "Cancel"
|
|
26
|
-
end
|
|
27
|
-
|
|
28
|
-
test "GET new responds successfully" do
|
|
29
|
-
get new_uchi_title_url(scope: @scope)
|
|
30
|
-
assert_response :success
|
|
31
|
-
end
|
|
32
|
-
|
|
33
|
-
test "GET new renders a form to create a new model" do
|
|
34
|
-
get new_uchi_title_url(scope: @scope)
|
|
35
|
-
assert_select "form[action=?][method='post']", uchi_titles_path
|
|
36
|
-
end
|
|
37
|
-
|
|
38
|
-
test "GET new links back to the scoped model" do
|
|
39
|
-
get new_uchi_title_url(scope: @scope)
|
|
40
|
-
assert_select "a[href=?]", uchi_book_path(id: @book.id), text: "Cancel"
|
|
41
|
-
end
|
|
42
|
-
|
|
43
|
-
test "GET index responds successfully" do
|
|
44
|
-
get uchi_titles_url(scope: @scope)
|
|
45
|
-
assert_response :success
|
|
46
|
-
end
|
|
47
|
-
|
|
48
|
-
test "GET index renders the index view" do
|
|
49
|
-
get uchi_titles_url(scope: @scope)
|
|
50
|
-
assert_template :index
|
|
51
|
-
end
|
|
52
|
-
|
|
53
|
-
test "GET index includes a turbo-frame" do
|
|
54
|
-
get uchi_titles_url(scope: @scope)
|
|
55
|
-
assert_select "turbo-frame"
|
|
56
|
-
end
|
|
57
|
-
|
|
58
|
-
test "GET index lists only the records associated with the parent record" do
|
|
59
|
-
other_book = Book.create!(original_title: "1984")
|
|
60
|
-
Title.create!(locale: "de-DE", title: "1984", book: other_book)
|
|
61
|
-
|
|
62
|
-
get uchi_titles_url(scope: @scope.merge(inverse_of: "book"))
|
|
63
|
-
|
|
64
|
-
assert_equal assigns(:records), [@dk_title, @de_title]
|
|
65
|
-
end
|
|
66
|
-
|
|
67
|
-
test "GET index does not include the field for the parent record" do
|
|
68
|
-
get uchi_titles_url(scope: @scope.merge(inverse_of: "book"))
|
|
69
|
-
|
|
70
|
-
assert_not assigns(:columns).find { |column| column.name == :book }
|
|
71
|
-
end
|
|
72
|
-
end
|
|
73
|
-
end
|
data/test/dummy/Rakefile
DELETED
|
File without changes
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* This is a manifest file that'll be compiled into application.css, which will include all the files
|
|
3
|
-
* listed below.
|
|
4
|
-
*
|
|
5
|
-
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
|
|
6
|
-
* or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
|
|
7
|
-
*
|
|
8
|
-
* You're free to add application-wide styles to this file and they'll appear at the bottom of the
|
|
9
|
-
* compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS
|
|
10
|
-
* files in this directory. Styles in this file should be added after the last require_* statement.
|
|
11
|
-
* It is generally better to create a new file per style scope.
|
|
12
|
-
*
|
|
13
|
-
*= require_tree .
|
|
14
|
-
*= require_self
|
|
15
|
-
*/
|
|
File without changes
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
class ApplicationJob < ActiveJob::Base
|
|
2
|
-
# Automatically retry jobs that encountered a deadlock
|
|
3
|
-
# retry_on ActiveRecord::Deadlocked
|
|
4
|
-
|
|
5
|
-
# Most jobs are safe to ignore if the underlying records are no longer available
|
|
6
|
-
# discard_on ActiveJob::DeserializationError
|
|
7
|
-
end
|
|
File without changes
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
module Uchi
|
|
2
|
-
module Repositories
|
|
3
|
-
class Author < Repository
|
|
4
|
-
def fields
|
|
5
|
-
[
|
|
6
|
-
Field::Number.new(:id, on: [:index, :show]),
|
|
7
|
-
Field::String.new(:name),
|
|
8
|
-
Field::Date.new(:born_on),
|
|
9
|
-
Field::String.new(:biography, on: [:edit, :new, :show])
|
|
10
|
-
]
|
|
11
|
-
end
|
|
12
|
-
|
|
13
|
-
def title(model)
|
|
14
|
-
return nil unless model
|
|
15
|
-
|
|
16
|
-
model.name
|
|
17
|
-
end
|
|
18
|
-
end
|
|
19
|
-
end
|
|
20
|
-
end
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html>
|
|
3
|
-
<head>
|
|
4
|
-
<title><%= content_for(:title) || "Dummy" %></title>
|
|
5
|
-
<meta name="viewport" content="width=device-width,initial-scale=1">
|
|
6
|
-
<meta name="apple-mobile-web-app-capable" content="yes">
|
|
7
|
-
<meta name="mobile-web-app-capable" content="yes">
|
|
8
|
-
<%= csrf_meta_tags %>
|
|
9
|
-
<%= csp_meta_tag %>
|
|
10
|
-
|
|
11
|
-
<%= yield :head %>
|
|
12
|
-
|
|
13
|
-
<%# Enable PWA manifest for installable apps (make sure to enable in config/routes.rb too!) %>
|
|
14
|
-
<%#= tag.link rel: "manifest", href: pwa_manifest_path(format: :json) %>
|
|
15
|
-
|
|
16
|
-
<link rel="icon" href="/icon.png" type="image/png">
|
|
17
|
-
<link rel="icon" href="/icon.svg" type="image/svg+xml">
|
|
18
|
-
<link rel="apple-touch-icon" href="/icon.png">
|
|
19
|
-
|
|
20
|
-
<%# Includes all stylesheet files in app/assets/stylesheets %>
|
|
21
|
-
<%= stylesheet_link_tag :app %>
|
|
22
|
-
</head>
|
|
23
|
-
|
|
24
|
-
<body>
|
|
25
|
-
<%= yield %>
|
|
26
|
-
</body>
|
|
27
|
-
</html>
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
<%= yield %>
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "Dummy",
|
|
3
|
-
"icons": [
|
|
4
|
-
{
|
|
5
|
-
"src": "/icon.png",
|
|
6
|
-
"type": "image/png",
|
|
7
|
-
"sizes": "512x512"
|
|
8
|
-
},
|
|
9
|
-
{
|
|
10
|
-
"src": "/icon.png",
|
|
11
|
-
"type": "image/png",
|
|
12
|
-
"sizes": "512x512",
|
|
13
|
-
"purpose": "maskable"
|
|
14
|
-
}
|
|
15
|
-
],
|
|
16
|
-
"start_url": "/",
|
|
17
|
-
"display": "standalone",
|
|
18
|
-
"scope": "/",
|
|
19
|
-
"description": "Dummy.",
|
|
20
|
-
"theme_color": "red",
|
|
21
|
-
"background_color": "red"
|
|
22
|
-
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
// Add a service worker for processing Web Push notifications:
|
|
2
|
-
//
|
|
3
|
-
// self.addEventListener("push", async (event) => {
|
|
4
|
-
// const { title, options } = await event.data.json()
|
|
5
|
-
// event.waitUntil(self.registration.showNotification(title, options))
|
|
6
|
-
// })
|
|
7
|
-
//
|
|
8
|
-
// self.addEventListener("notificationclick", function(event) {
|
|
9
|
-
// event.notification.close()
|
|
10
|
-
// event.waitUntil(
|
|
11
|
-
// clients.matchAll({ type: "window" }).then((clientList) => {
|
|
12
|
-
// for (let i = 0; i < clientList.length; i++) {
|
|
13
|
-
// let client = clientList[i]
|
|
14
|
-
// let clientPath = (new URL(client.url)).pathname
|
|
15
|
-
//
|
|
16
|
-
// if (clientPath == event.notification.data.path && "focus" in client) {
|
|
17
|
-
// return client.focus()
|
|
18
|
-
// }
|
|
19
|
-
// }
|
|
20
|
-
//
|
|
21
|
-
// if (clients.openWindow) {
|
|
22
|
-
// return clients.openWindow(event.notification.data.path)
|
|
23
|
-
// }
|
|
24
|
-
// })
|
|
25
|
-
// )
|
|
26
|
-
// })
|
data/test/dummy/bin/dev
DELETED
data/test/dummy/bin/rails
DELETED
data/test/dummy/bin/rake
DELETED
data/test/dummy/bin/setup
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env ruby
|
|
2
|
-
require "fileutils"
|
|
3
|
-
|
|
4
|
-
APP_ROOT = File.expand_path("..", __dir__)
|
|
5
|
-
|
|
6
|
-
def system!(*args)
|
|
7
|
-
system(*args, exception: true)
|
|
8
|
-
end
|
|
9
|
-
|
|
10
|
-
FileUtils.chdir APP_ROOT do
|
|
11
|
-
# This script is a way to set up or update your development environment automatically.
|
|
12
|
-
# This script is idempotent, so that you can run it at any time and get an expectable outcome.
|
|
13
|
-
# Add necessary setup steps to this file.
|
|
14
|
-
|
|
15
|
-
puts "== Installing dependencies =="
|
|
16
|
-
system("bundle check") || system!("bundle install")
|
|
17
|
-
|
|
18
|
-
# puts "\n== Copying sample files =="
|
|
19
|
-
# unless File.exist?("config/database.yml")
|
|
20
|
-
# FileUtils.cp "config/database.yml.sample", "config/database.yml"
|
|
21
|
-
# end
|
|
22
|
-
|
|
23
|
-
puts "\n== Preparing database =="
|
|
24
|
-
system! "bin/rails db:prepare"
|
|
25
|
-
|
|
26
|
-
puts "\n== Removing old logs and tempfiles =="
|
|
27
|
-
system! "bin/rails log:clear tmp:clear"
|
|
28
|
-
|
|
29
|
-
unless ARGV.include?("--skip-server")
|
|
30
|
-
puts "\n== Starting development server =="
|
|
31
|
-
$stdout.flush # flush the output before exec(2) so that it displays
|
|
32
|
-
exec "bin/dev"
|
|
33
|
-
end
|
|
34
|
-
end
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
require_relative "boot"
|
|
2
|
-
|
|
3
|
-
require "rails/all"
|
|
4
|
-
|
|
5
|
-
# Require the gems listed in Gemfile, including any gems
|
|
6
|
-
# you've limited to :test, :development, or :production.
|
|
7
|
-
Bundler.require(*Rails.groups)
|
|
8
|
-
|
|
9
|
-
module Dummy
|
|
10
|
-
class Application < Rails::Application
|
|
11
|
-
config.load_defaults Rails::VERSION::STRING.to_f
|
|
12
|
-
|
|
13
|
-
# For compatibility with applications that use this config
|
|
14
|
-
config.action_controller.include_all_helpers = false
|
|
15
|
-
|
|
16
|
-
# Please, add to the `ignore` list any other `lib` subdirectories that do
|
|
17
|
-
# not contain `.rb` files, or that should not be reloaded or eager loaded.
|
|
18
|
-
# Common ones are `templates`, `generators`, or `middleware`, for example.
|
|
19
|
-
config.autoload_lib(ignore: %w[assets tasks])
|
|
20
|
-
|
|
21
|
-
# Configuration for the application, engines, and railties goes here.
|
|
22
|
-
#
|
|
23
|
-
# These settings can be overridden in specific environments using the files
|
|
24
|
-
# in config/environments, which are processed later.
|
|
25
|
-
#
|
|
26
|
-
# config.time_zone = "Central Time (US & Canada)"
|
|
27
|
-
# config.eager_load_paths << Rails.root.join("extras")
|
|
28
|
-
end
|
|
29
|
-
end
|
data/test/dummy/config/boot.rb
DELETED
data/test/dummy/config/cable.yml
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
# SQLite. Versions 3.8.0 and up are supported.
|
|
2
|
-
# gem install sqlite3
|
|
3
|
-
#
|
|
4
|
-
# Ensure the SQLite 3 gem is defined in your Gemfile
|
|
5
|
-
# gem "sqlite3"
|
|
6
|
-
#
|
|
7
|
-
default: &default
|
|
8
|
-
adapter: sqlite3
|
|
9
|
-
pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
|
|
10
|
-
timeout: 5000
|
|
11
|
-
|
|
12
|
-
development:
|
|
13
|
-
<<: *default
|
|
14
|
-
database: storage/development.sqlite3
|
|
15
|
-
|
|
16
|
-
# Warning: The database defined as "test" will be erased and
|
|
17
|
-
# re-generated from your development database when you run "rake".
|
|
18
|
-
# Do not set this db to the same as development or production.
|
|
19
|
-
test:
|
|
20
|
-
<<: *default
|
|
21
|
-
database: storage/test.sqlite3
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
# SQLite3 write its data on the local filesystem, as such it requires
|
|
25
|
-
# persistent disks. If you are deploying to a managed service, you should
|
|
26
|
-
# make sure it provides disk persistence, as many don't.
|
|
27
|
-
#
|
|
28
|
-
# Similarly, if you deploy your application as a Docker container, you must
|
|
29
|
-
# ensure the database is located in a persisted volume.
|
|
30
|
-
production:
|
|
31
|
-
<<: *default
|
|
32
|
-
# database: path/to/persistent/storage/production.sqlite3
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
require "active_support/core_ext/integer/time"
|
|
2
|
-
|
|
3
|
-
Rails.application.configure do
|
|
4
|
-
# Settings specified here will take precedence over those in config/application.rb.
|
|
5
|
-
|
|
6
|
-
# Make code changes take effect immediately without server restart.
|
|
7
|
-
config.enable_reloading = true
|
|
8
|
-
|
|
9
|
-
# Do not eager load code on boot.
|
|
10
|
-
config.eager_load = false
|
|
11
|
-
|
|
12
|
-
# Show full error reports.
|
|
13
|
-
config.consider_all_requests_local = true
|
|
14
|
-
|
|
15
|
-
# Enable server timing.
|
|
16
|
-
config.server_timing = true
|
|
17
|
-
|
|
18
|
-
# Enable/disable Action Controller caching. By default Action Controller caching is disabled.
|
|
19
|
-
# Run rails dev:cache to toggle Action Controller caching.
|
|
20
|
-
if Rails.root.join("tmp/caching-dev.txt").exist?
|
|
21
|
-
config.action_controller.perform_caching = true
|
|
22
|
-
config.action_controller.enable_fragment_cache_logging = true
|
|
23
|
-
config.public_file_server.headers = {"cache-control" => "public, max-age=#{2.days.to_i}"}
|
|
24
|
-
else
|
|
25
|
-
config.action_controller.perform_caching = false
|
|
26
|
-
end
|
|
27
|
-
|
|
28
|
-
# Change to :null_store to avoid any caching.
|
|
29
|
-
config.cache_store = :memory_store
|
|
30
|
-
|
|
31
|
-
# Store uploaded files on the local file system (see config/storage.yml for options).
|
|
32
|
-
config.active_storage.service = :local
|
|
33
|
-
|
|
34
|
-
# Don't care if the mailer can't send.
|
|
35
|
-
config.action_mailer.raise_delivery_errors = false
|
|
36
|
-
|
|
37
|
-
# Make template changes take effect immediately.
|
|
38
|
-
config.action_mailer.perform_caching = false
|
|
39
|
-
|
|
40
|
-
# Set localhost to be used by links generated in mailer templates.
|
|
41
|
-
config.action_mailer.default_url_options = {host: "localhost", port: 3000}
|
|
42
|
-
|
|
43
|
-
# Print deprecation notices to the Rails logger.
|
|
44
|
-
config.active_support.deprecation = :log
|
|
45
|
-
|
|
46
|
-
# Raise an error on page load if there are pending migrations.
|
|
47
|
-
config.active_record.migration_error = :page_load
|
|
48
|
-
|
|
49
|
-
# Highlight code that triggered database queries in logs.
|
|
50
|
-
config.active_record.verbose_query_logs = true
|
|
51
|
-
|
|
52
|
-
# Append comments with runtime information tags to SQL queries in logs.
|
|
53
|
-
config.active_record.query_log_tags_enabled = true
|
|
54
|
-
|
|
55
|
-
# Highlight code that enqueued background job in logs.
|
|
56
|
-
config.active_job.verbose_enqueue_logs = true
|
|
57
|
-
|
|
58
|
-
# Raises error for missing translations.
|
|
59
|
-
# config.i18n.raise_on_missing_translations = true
|
|
60
|
-
|
|
61
|
-
# Annotate rendered view with file names.
|
|
62
|
-
config.action_view.annotate_rendered_view_with_filenames = true
|
|
63
|
-
|
|
64
|
-
# Uncomment if you wish to allow Action Cable access from any origin.
|
|
65
|
-
# config.action_cable.disable_request_forgery_protection = true
|
|
66
|
-
|
|
67
|
-
# Raise error when a before_action's only/except options reference missing actions.
|
|
68
|
-
config.action_controller.raise_on_missing_callback_actions = true
|
|
69
|
-
end
|