uchi 0.1.3 → 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.
Files changed (283) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +222 -0
  3. data/app/assets/config/uchi_manifest.js +2 -0
  4. data/app/assets/javascripts/uchi/application.js +6095 -0
  5. data/app/assets/javascripts/uchi.js +4 -0
  6. data/app/assets/stylesheets/uchi/application.css +3971 -0
  7. data/app/assets/stylesheets/uchi/uchi.css +17 -0
  8. data/app/assets/tailwind/uchi.css +21 -0
  9. data/app/components/flowbite/breadcrumb.rb +33 -0
  10. data/app/components/flowbite/breadcrumb_home.rb +26 -0
  11. data/app/components/flowbite/breadcrumb_item/current.rb +33 -0
  12. data/app/components/flowbite/breadcrumb_item/first.rb +35 -0
  13. data/app/components/flowbite/breadcrumb_item.rb +48 -0
  14. data/app/components/flowbite/breadcrumb_separator.rb +30 -0
  15. data/app/components/flowbite/button/outline.rb +22 -0
  16. data/app/components/flowbite/button/pill.rb +40 -0
  17. data/app/components/flowbite/button.rb +92 -0
  18. data/app/components/flowbite/card.rb +45 -0
  19. data/app/components/flowbite/input/checkbox.rb +73 -0
  20. data/app/components/flowbite/input/date.rb +11 -0
  21. data/app/components/flowbite/input/date_time.rb +11 -0
  22. data/app/components/flowbite/input/email.rb +12 -0
  23. data/app/components/flowbite/input/field.rb +117 -0
  24. data/app/components/flowbite/input/file.rb +30 -0
  25. data/app/components/flowbite/input/hint.rb +57 -0
  26. data/app/components/flowbite/input/label.rb +82 -0
  27. data/app/components/flowbite/input/number.rb +11 -0
  28. data/app/components/flowbite/input/password.rb +11 -0
  29. data/app/components/flowbite/input/phone.rb +11 -0
  30. data/app/components/flowbite/input/radio_button.rb +50 -0
  31. data/app/components/flowbite/input/select.rb +49 -0
  32. data/app/components/flowbite/input/textarea.rb +42 -0
  33. data/app/components/flowbite/input/url.rb +12 -0
  34. data/app/components/flowbite/input/validation_error.rb +11 -0
  35. data/app/components/flowbite/input_field/checkbox.html.erb +14 -0
  36. data/app/components/flowbite/input_field/checkbox.rb +54 -0
  37. data/app/components/flowbite/input_field/date.rb +13 -0
  38. data/app/components/flowbite/input_field/date_time.rb +13 -0
  39. data/app/components/flowbite/input_field/email.rb +13 -0
  40. data/app/components/flowbite/input_field/file.rb +13 -0
  41. data/app/components/flowbite/input_field/input_field.html.erb +8 -0
  42. data/app/components/flowbite/input_field/number.rb +13 -0
  43. data/app/components/flowbite/input_field/password.rb +13 -0
  44. data/app/components/flowbite/input_field/phone.rb +13 -0
  45. data/app/components/flowbite/input_field/radio_button.html.erb +14 -0
  46. data/app/components/flowbite/input_field/radio_button.rb +86 -0
  47. data/app/components/flowbite/input_field/select.rb +31 -0
  48. data/app/components/flowbite/input_field/text.rb +8 -0
  49. data/app/components/flowbite/input_field/textarea.rb +13 -0
  50. data/app/components/flowbite/input_field/url.rb +13 -0
  51. data/app/components/flowbite/input_field.rb +192 -0
  52. data/app/components/flowbite/link.rb +21 -0
  53. data/app/components/flowbite/style.rb +13 -0
  54. data/app/components/flowbite/toast/icon.html.erb +5 -0
  55. data/app/components/flowbite/toast/icon.rb +57 -0
  56. data/app/components/flowbite/toast/toast.html.erb +11 -0
  57. data/app/components/flowbite/toast.rb +34 -0
  58. data/app/components/uchi/field/base.rb +57 -0
  59. data/app/components/uchi/field/belongs_to/edit.html.erb +1 -0
  60. data/app/components/uchi/field/belongs_to/index.html.erb +1 -0
  61. data/app/components/uchi/field/belongs_to/show.html.erb +3 -0
  62. data/app/components/uchi/field/belongs_to.rb +105 -0
  63. data/app/components/uchi/field/blank/edit.html.erb +1 -0
  64. data/app/components/uchi/field/blank/index.html.erb +1 -0
  65. data/app/components/uchi/field/blank/show.html.erb +1 -0
  66. data/app/components/uchi/field/blank.rb +16 -0
  67. data/app/components/uchi/field/boolean/edit.html.erb +1 -0
  68. data/app/components/uchi/field/boolean/index.html.erb +9 -0
  69. data/app/components/uchi/field/boolean/show.html.erb +9 -0
  70. data/app/components/uchi/field/boolean.rb +27 -0
  71. data/app/components/uchi/field/date/edit.html.erb +1 -0
  72. data/app/components/uchi/field/date/index.html.erb +1 -0
  73. data/app/components/uchi/field/date/show.html.erb +1 -0
  74. data/app/components/uchi/field/date.rb +27 -0
  75. data/app/components/uchi/field/date_time/edit.html.erb +1 -0
  76. data/app/components/uchi/field/date_time/index.html.erb +1 -0
  77. data/app/components/uchi/field/date_time/show.html.erb +1 -0
  78. data/app/components/uchi/field/date_time.rb +27 -0
  79. data/app/components/uchi/field/file/edit.html.erb +1 -0
  80. data/app/components/uchi/field/file/index.html.erb +6 -0
  81. data/app/components/uchi/field/file/show.html.erb +8 -0
  82. data/app/components/uchi/field/file.rb +37 -0
  83. data/app/components/uchi/field/has_and_belongs_to_many/edit.html.erb +9 -0
  84. data/app/components/uchi/field/has_and_belongs_to_many/index.html.erb +1 -0
  85. data/app/components/uchi/field/has_and_belongs_to_many/show.html.erb +28 -0
  86. data/app/components/uchi/field/has_and_belongs_to_many.rb +131 -0
  87. data/app/components/uchi/field/has_many/edit.html.erb +1 -0
  88. data/app/components/uchi/field/has_many/index.html.erb +1 -0
  89. data/app/components/uchi/field/has_many/show.html.erb +28 -0
  90. data/app/components/uchi/field/has_many.rb +107 -0
  91. data/app/components/uchi/field/id/index.html.erb +4 -0
  92. data/app/components/uchi/field/id/show.html.erb +4 -0
  93. data/app/components/uchi/field/id.rb +26 -0
  94. data/app/components/uchi/field/image/edit.html.erb +1 -0
  95. data/app/components/uchi/field/image/index.html.erb +6 -0
  96. data/app/components/uchi/field/image/show.html.erb +6 -0
  97. data/app/components/uchi/field/image.rb +38 -0
  98. data/app/components/uchi/field/number/edit.html.erb +1 -0
  99. data/app/components/uchi/field/number/index.html.erb +1 -0
  100. data/app/components/uchi/field/number/show.html.erb +1 -0
  101. data/app/components/uchi/field/number.rb +32 -0
  102. data/app/components/uchi/field/string/edit.html.erb +1 -0
  103. data/app/components/uchi/field/string/index.html.erb +1 -0
  104. data/app/components/uchi/field/string/show.html.erb +1 -0
  105. data/app/components/uchi/field/string.rb +33 -0
  106. data/app/components/uchi/field/text/edit.html.erb +1 -0
  107. data/app/components/uchi/field/text/index.html.erb +1 -0
  108. data/app/components/uchi/field/text/show.html.erb +1 -0
  109. data/app/components/uchi/field/text.rb +38 -0
  110. data/app/components/uchi/ui/breadcrumb/breadcrumb.html.erb +13 -0
  111. data/app/components/uchi/ui/breadcrumb.rb +14 -0
  112. data/app/components/uchi/ui/form/footer/footer.html.erb +5 -0
  113. data/app/components/uchi/ui/form/footer.rb +15 -0
  114. data/app/components/uchi/ui/form/input/collection_checkboxes.html.erb +32 -0
  115. data/app/components/uchi/ui/form/input/collection_checkboxes.rb +125 -0
  116. data/app/components/uchi/ui/frame/frame.html.erb +3 -0
  117. data/app/components/uchi/ui/frame.rb +10 -0
  118. data/app/components/uchi/ui/index/records_table/records_table.html.erb +67 -0
  119. data/app/components/uchi/ui/index/records_table/search_form/search_form.html.erb +21 -0
  120. data/app/components/uchi/ui/index/records_table/search_form.rb +49 -0
  121. data/app/components/uchi/ui/index/records_table.rb +29 -0
  122. data/app/components/uchi/ui/index/turbo_frame.rb +50 -0
  123. data/app/components/uchi/ui/page_header/page_header.html.erb +24 -0
  124. data/app/components/uchi/ui/page_header.rb +18 -0
  125. data/app/components/uchi/ui/pagination/current_link.html.erb +3 -0
  126. data/app/components/uchi/ui/pagination/current_link.rb +10 -0
  127. data/app/components/uchi/ui/pagination/gap.html.erb +3 -0
  128. data/app/components/uchi/ui/pagination/gap.rb +10 -0
  129. data/app/components/uchi/ui/pagination/item.rb +24 -0
  130. data/app/components/uchi/ui/pagination/link.html.erb +3 -0
  131. data/app/components/uchi/ui/pagination/link.rb +10 -0
  132. data/app/components/uchi/ui/pagination/next_link.html.erb +8 -0
  133. data/app/components/uchi/ui/pagination/next_link.rb +22 -0
  134. data/app/components/uchi/ui/pagination/pagination.html.erb +15 -0
  135. data/app/components/uchi/ui/pagination/previous_link.html.erb +8 -0
  136. data/app/components/uchi/ui/pagination/previous_link.rb +22 -0
  137. data/app/components/uchi/ui/pagination.rb +48 -0
  138. data/app/components/uchi/ui/show/attribute_fields/attribute_fields.html.erb +14 -0
  139. data/app/components/uchi/ui/show/attribute_fields.rb +18 -0
  140. data/app/components/uchi/ui/spinner/spinner.html.erb +7 -0
  141. data/app/components/uchi/ui/spinner.rb +15 -0
  142. data/app/controllers/uchi/application_controller.rb +4 -0
  143. data/app/controllers/uchi/controller.rb +13 -0
  144. data/app/controllers/uchi/repository_controller.rb +166 -0
  145. data/app/helpers/uchi/application_helper.rb +17 -0
  146. data/app/jobs/uchi/application_job.rb +4 -0
  147. data/app/mailers/uchi/application_mailer.rb +6 -0
  148. data/app/views/layouts/uchi/_flash_messages.html.erb +10 -0
  149. data/app/views/layouts/uchi/application.html.erb +33 -0
  150. data/app/views/uchi/repository/edit.html.erb +40 -0
  151. data/app/views/uchi/repository/index.html.erb +49 -0
  152. data/app/views/uchi/repository/new.html.erb +37 -0
  153. data/app/views/uchi/repository/show.html.erb +41 -0
  154. data/lib/generators/uchi/controller/controller_generator.rb +16 -0
  155. data/lib/generators/uchi/controller/templates/controller.rb.tt +11 -0
  156. data/lib/generators/uchi/install/install_generator.rb +13 -0
  157. data/lib/generators/uchi/repository/repository_generator.rb +16 -0
  158. data/lib/generators/uchi/repository/templates/repository.rb.tt +11 -0
  159. data/lib/tasks/uchi_tasks.rake +4 -0
  160. data/lib/uchi/application_record.rb +5 -0
  161. data/lib/uchi/engine.rb +24 -0
  162. data/lib/uchi/field/configuration.rb +142 -0
  163. data/lib/uchi/field.rb +80 -0
  164. data/lib/uchi/i18n.rb +13 -0
  165. data/lib/uchi/pagination/controller.rb +26 -0
  166. data/lib/uchi/pagination/page.rb +20 -0
  167. data/lib/uchi/pagy/LICENSE.txt +21 -0
  168. data/lib/uchi/pagy/classes/exceptions.rb +35 -0
  169. data/lib/uchi/pagy/classes/offset/offset.rb +56 -0
  170. data/lib/uchi/pagy/classes/request.rb +38 -0
  171. data/lib/uchi/pagy/modules/abilities/configurable.rb +38 -0
  172. data/lib/uchi/pagy/modules/abilities/linkable.rb +62 -0
  173. data/lib/uchi/pagy/modules/abilities/rangeable.rb +17 -0
  174. data/lib/uchi/pagy/modules/abilities/shiftable.rb +14 -0
  175. data/lib/uchi/pagy/modules/console.rb +40 -0
  176. data/lib/uchi/pagy/toolbox/helpers/loader.rb +19 -0
  177. data/lib/uchi/pagy/toolbox/helpers/page_url.rb +25 -0
  178. data/lib/uchi/pagy/toolbox/paginators/method.rb +21 -0
  179. data/lib/uchi/pagy/toolbox/paginators/offset.rb +35 -0
  180. data/lib/uchi/pagy.rb +60 -0
  181. data/lib/uchi/repository/routes.rb +62 -0
  182. data/lib/uchi/repository/translate.rb +284 -0
  183. data/lib/uchi/repository.rb +156 -0
  184. data/lib/uchi/sort_order.rb +35 -0
  185. data/lib/uchi/version.rb +5 -0
  186. data/lib/uchi.rb +18 -0
  187. data/uchi.gemspec +35 -0
  188. metadata +189 -97
  189. data/.github/dependabot.yml +0 -17
  190. data/.github/workflows/build.yml +0 -23
  191. data/.github/workflows/lint.yml +0 -30
  192. data/CHANGELOG.md +0 -29
  193. data/docs/fields.md +0 -82
  194. data/docs/repositories.md +0 -63
  195. data/package.json +0 -31
  196. data/sig/uchi.rbs +0 -4
  197. data/test/components/uchi/field/belongs_to_test.rb +0 -134
  198. data/test/components/uchi/field/blank_test.rb +0 -119
  199. data/test/components/uchi/field/boolean_test.rb +0 -163
  200. data/test/components/uchi/field/date_test.rb +0 -163
  201. data/test/components/uchi/field/date_time_test.rb +0 -152
  202. data/test/components/uchi/field/has_and_belongs_to_many_test.rb +0 -144
  203. data/test/components/uchi/field/has_many_test.rb +0 -138
  204. data/test/components/uchi/field/id_test.rb +0 -113
  205. data/test/components/uchi/field/number_test.rb +0 -163
  206. data/test/components/uchi/field/string_test.rb +0 -159
  207. data/test/components/uchi/field/text_test.rb +0 -160
  208. data/test/components/uchi/ui/form/input/collection_checkboxes_test.rb +0 -171
  209. data/test/controllers/uchi/authors_controller_test.rb +0 -120
  210. data/test/controllers/uchi/repository_controller_test.rb +0 -93
  211. data/test/controllers/uchi/scoped_repository_controller_test.rb +0 -73
  212. data/test/dummy/Rakefile +0 -6
  213. data/test/dummy/app/assets/images/.keep +0 -0
  214. data/test/dummy/app/assets/stylesheets/application.css +0 -15
  215. data/test/dummy/app/controllers/application_controller.rb +0 -4
  216. data/test/dummy/app/controllers/concerns/.keep +0 -0
  217. data/test/dummy/app/controllers/uchi/authors_controller.rb +0 -7
  218. data/test/dummy/app/controllers/uchi/books_controller.rb +0 -7
  219. data/test/dummy/app/controllers/uchi/titles_controller.rb +0 -7
  220. data/test/dummy/app/helpers/application_helper.rb +0 -2
  221. data/test/dummy/app/jobs/application_job.rb +0 -7
  222. data/test/dummy/app/mailers/application_mailer.rb +0 -4
  223. data/test/dummy/app/models/application_record.rb +0 -3
  224. data/test/dummy/app/models/author.rb +0 -5
  225. data/test/dummy/app/models/book.rb +0 -4
  226. data/test/dummy/app/models/concerns/.keep +0 -0
  227. data/test/dummy/app/models/title.rb +0 -3
  228. data/test/dummy/app/uchi/repositories/author.rb +0 -20
  229. data/test/dummy/app/uchi/repositories/book.rb +0 -16
  230. data/test/dummy/app/uchi/repositories/title.rb +0 -17
  231. data/test/dummy/app/views/layouts/application.html.erb +0 -27
  232. data/test/dummy/app/views/layouts/mailer.html.erb +0 -13
  233. data/test/dummy/app/views/layouts/mailer.text.erb +0 -1
  234. data/test/dummy/app/views/pwa/manifest.json.erb +0 -22
  235. data/test/dummy/app/views/pwa/service-worker.js +0 -26
  236. data/test/dummy/bin/dev +0 -2
  237. data/test/dummy/bin/rails +0 -4
  238. data/test/dummy/bin/rake +0 -4
  239. data/test/dummy/bin/setup +0 -34
  240. data/test/dummy/config/application.rb +0 -29
  241. data/test/dummy/config/boot.rb +0 -5
  242. data/test/dummy/config/cable.yml +0 -10
  243. data/test/dummy/config/database.yml +0 -32
  244. data/test/dummy/config/environment.rb +0 -5
  245. data/test/dummy/config/environments/development.rb +0 -69
  246. data/test/dummy/config/environments/production.rb +0 -89
  247. data/test/dummy/config/environments/test.rb +0 -53
  248. data/test/dummy/config/initializers/content_security_policy.rb +0 -25
  249. data/test/dummy/config/initializers/filter_parameter_logging.rb +0 -8
  250. data/test/dummy/config/initializers/inflections.rb +0 -16
  251. data/test/dummy/config/locales/da.yml +0 -52
  252. data/test/dummy/config/locales/en.yml +0 -31
  253. data/test/dummy/config/puma.rb +0 -38
  254. data/test/dummy/config/routes.rb +0 -9
  255. data/test/dummy/config/storage.yml +0 -34
  256. data/test/dummy/config.ru +0 -6
  257. data/test/dummy/db/migrate/20251002183635_create_authors.rb +0 -11
  258. data/test/dummy/db/migrate/20251005131726_create_books.rb +0 -9
  259. data/test/dummy/db/migrate/20251005131811_create_titles.rb +0 -11
  260. data/test/dummy/db/migrate/20251031140958_add_author_books_join_table.rb +0 -9
  261. data/test/dummy/db/schema.rb +0 -44
  262. data/test/dummy/log/.keep +0 -0
  263. data/test/dummy/public/400.html +0 -114
  264. data/test/dummy/public/404.html +0 -114
  265. data/test/dummy/public/406-unsupported-browser.html +0 -114
  266. data/test/dummy/public/422.html +0 -114
  267. data/test/dummy/public/500.html +0 -114
  268. data/test/dummy/public/icon.png +0 -0
  269. data/test/dummy/public/icon.svg +0 -3
  270. data/test/dummy/storage/.keep +0 -0
  271. data/test/dummy/test/fixtures/authors.yml +0 -11
  272. data/test/dummy/test/models/author_test.rb +0 -7
  273. data/test/dummy/tmp/.keep +0 -0
  274. data/test/dummy/tmp/pids/.keep +0 -0
  275. data/test/dummy/tmp/storage/.keep +0 -0
  276. data/test/test_helper.rb +0 -15
  277. data/test/uchi/field_test.rb +0 -77
  278. data/test/uchi/i18n_test.rb +0 -18
  279. data/test/uchi/repository/routes_test.rb +0 -49
  280. data/test/uchi/repository/translate_test.rb +0 -272
  281. data/test/uchi/repository_test.rb +0 -137
  282. data/test/uchi/sort_order_test.rb +0 -47
  283. data/test/uchi_test.rb +0 -7
data/lib/uchi.rb ADDED
@@ -0,0 +1,18 @@
1
+ gem "turbo-rails"
2
+ require "turbo-rails"
3
+
4
+ gem "view_component"
5
+ require "view_component"
6
+
7
+ require "uchi/version"
8
+ require "uchi/engine"
9
+
10
+ require "uchi/field"
11
+ require "uchi/i18n"
12
+ require "uchi/repository"
13
+ require "uchi/sort_order"
14
+ require "uchi/repository/translate"
15
+
16
+ module Uchi
17
+ # Your code goes here...
18
+ end
data/uchi.gemspec ADDED
@@ -0,0 +1,35 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "lib/uchi/version"
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = "uchi"
7
+ spec.version = Uchi::VERSION
8
+ spec.authors = ["Jakob Skjerning"]
9
+ spec.email = ["jakob@substancelab.com"]
10
+
11
+ spec.summary = "Build usable and extensible admin panels for your Ruby on Rails application in minutes."
12
+ spec.description = "Level up your scaffolds with a modern admin backend framework, designed for Rails developers who demand both beauty, functionality, and extensibility. Uchi provides a set of components and conventions for creating user interfaces that are both powerful and easy to use."
13
+ spec.homepage = "https://www.uchiadmin.com/"
14
+ spec.required_ruby_version = ">= 3.2.0"
15
+
16
+ spec.metadata["changelog_uri"] = "https://github.com/substancelab/uchi/blob/main/CHANGELOG.md"
17
+ spec.metadata["homepage_uri"] = spec.homepage
18
+ spec.metadata["source_code_uri"] = "https://github.com/substancelab/uchi"
19
+
20
+ # Specify which files should be added to the gem when it is released.
21
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
22
+ spec.files = \
23
+ Dir["app/**/*"] +
24
+ Dir["lib/**/*"] +
25
+ [
26
+ "README.md",
27
+ "uchi.gemspec"
28
+ ]
29
+
30
+ spec.require_paths = ["lib"]
31
+
32
+ spec.add_dependency "rails", ">= 7.2"
33
+ spec.add_dependency "turbo-rails"
34
+ spec.add_dependency "view_component", ">= 4.0"
35
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: uchi
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jakob Skjerning
@@ -61,104 +61,196 @@ executables: []
61
61
  extensions: []
62
62
  extra_rdoc_files: []
63
63
  files:
64
- - ".github/dependabot.yml"
65
- - ".github/workflows/build.yml"
66
- - ".github/workflows/lint.yml"
67
- - CHANGELOG.md
68
- - docs/fields.md
69
- - docs/repositories.md
70
- - package.json
71
- - sig/uchi.rbs
72
- - test/components/uchi/field/belongs_to_test.rb
73
- - test/components/uchi/field/blank_test.rb
74
- - test/components/uchi/field/boolean_test.rb
75
- - test/components/uchi/field/date_test.rb
76
- - test/components/uchi/field/date_time_test.rb
77
- - test/components/uchi/field/has_and_belongs_to_many_test.rb
78
- - test/components/uchi/field/has_many_test.rb
79
- - test/components/uchi/field/id_test.rb
80
- - test/components/uchi/field/number_test.rb
81
- - test/components/uchi/field/string_test.rb
82
- - test/components/uchi/field/text_test.rb
83
- - test/components/uchi/ui/form/input/collection_checkboxes_test.rb
84
- - test/controllers/uchi/authors_controller_test.rb
85
- - test/controllers/uchi/repository_controller_test.rb
86
- - test/controllers/uchi/scoped_repository_controller_test.rb
87
- - test/dummy/Rakefile
88
- - test/dummy/app/assets/images/.keep
89
- - test/dummy/app/assets/stylesheets/application.css
90
- - test/dummy/app/controllers/application_controller.rb
91
- - test/dummy/app/controllers/concerns/.keep
92
- - test/dummy/app/controllers/uchi/authors_controller.rb
93
- - test/dummy/app/controllers/uchi/books_controller.rb
94
- - test/dummy/app/controllers/uchi/titles_controller.rb
95
- - test/dummy/app/helpers/application_helper.rb
96
- - test/dummy/app/jobs/application_job.rb
97
- - test/dummy/app/mailers/application_mailer.rb
98
- - test/dummy/app/models/application_record.rb
99
- - test/dummy/app/models/author.rb
100
- - test/dummy/app/models/book.rb
101
- - test/dummy/app/models/concerns/.keep
102
- - test/dummy/app/models/title.rb
103
- - test/dummy/app/uchi/repositories/author.rb
104
- - test/dummy/app/uchi/repositories/book.rb
105
- - test/dummy/app/uchi/repositories/title.rb
106
- - test/dummy/app/views/layouts/application.html.erb
107
- - test/dummy/app/views/layouts/mailer.html.erb
108
- - test/dummy/app/views/layouts/mailer.text.erb
109
- - test/dummy/app/views/pwa/manifest.json.erb
110
- - test/dummy/app/views/pwa/service-worker.js
111
- - test/dummy/bin/dev
112
- - test/dummy/bin/rails
113
- - test/dummy/bin/rake
114
- - test/dummy/bin/setup
115
- - test/dummy/config.ru
116
- - test/dummy/config/application.rb
117
- - test/dummy/config/boot.rb
118
- - test/dummy/config/cable.yml
119
- - test/dummy/config/database.yml
120
- - test/dummy/config/environment.rb
121
- - test/dummy/config/environments/development.rb
122
- - test/dummy/config/environments/production.rb
123
- - test/dummy/config/environments/test.rb
124
- - test/dummy/config/initializers/content_security_policy.rb
125
- - test/dummy/config/initializers/filter_parameter_logging.rb
126
- - test/dummy/config/initializers/inflections.rb
127
- - test/dummy/config/locales/da.yml
128
- - test/dummy/config/locales/en.yml
129
- - test/dummy/config/puma.rb
130
- - test/dummy/config/routes.rb
131
- - test/dummy/config/storage.yml
132
- - test/dummy/db/migrate/20251002183635_create_authors.rb
133
- - test/dummy/db/migrate/20251005131726_create_books.rb
134
- - test/dummy/db/migrate/20251005131811_create_titles.rb
135
- - test/dummy/db/migrate/20251031140958_add_author_books_join_table.rb
136
- - test/dummy/db/schema.rb
137
- - test/dummy/log/.keep
138
- - test/dummy/public/400.html
139
- - test/dummy/public/404.html
140
- - test/dummy/public/406-unsupported-browser.html
141
- - test/dummy/public/422.html
142
- - test/dummy/public/500.html
143
- - test/dummy/public/icon.png
144
- - test/dummy/public/icon.svg
145
- - test/dummy/storage/.keep
146
- - test/dummy/test/fixtures/authors.yml
147
- - test/dummy/test/models/author_test.rb
148
- - test/dummy/tmp/.keep
149
- - test/dummy/tmp/pids/.keep
150
- - test/dummy/tmp/storage/.keep
151
- - test/test_helper.rb
152
- - test/uchi/field_test.rb
153
- - test/uchi/i18n_test.rb
154
- - test/uchi/repository/routes_test.rb
155
- - test/uchi/repository/translate_test.rb
156
- - test/uchi/repository_test.rb
157
- - test/uchi/sort_order_test.rb
158
- - test/uchi_test.rb
159
- homepage: https://github.com/substancelab/uchi
64
+ - README.md
65
+ - app/assets/config/uchi_manifest.js
66
+ - app/assets/javascripts/uchi.js
67
+ - app/assets/javascripts/uchi/application.js
68
+ - app/assets/stylesheets/uchi/application.css
69
+ - app/assets/stylesheets/uchi/uchi.css
70
+ - app/assets/tailwind/uchi.css
71
+ - app/components/flowbite/breadcrumb.rb
72
+ - app/components/flowbite/breadcrumb_home.rb
73
+ - app/components/flowbite/breadcrumb_item.rb
74
+ - app/components/flowbite/breadcrumb_item/current.rb
75
+ - app/components/flowbite/breadcrumb_item/first.rb
76
+ - app/components/flowbite/breadcrumb_separator.rb
77
+ - app/components/flowbite/button.rb
78
+ - app/components/flowbite/button/outline.rb
79
+ - app/components/flowbite/button/pill.rb
80
+ - app/components/flowbite/card.rb
81
+ - app/components/flowbite/input/checkbox.rb
82
+ - app/components/flowbite/input/date.rb
83
+ - app/components/flowbite/input/date_time.rb
84
+ - app/components/flowbite/input/email.rb
85
+ - app/components/flowbite/input/field.rb
86
+ - app/components/flowbite/input/file.rb
87
+ - app/components/flowbite/input/hint.rb
88
+ - app/components/flowbite/input/label.rb
89
+ - app/components/flowbite/input/number.rb
90
+ - app/components/flowbite/input/password.rb
91
+ - app/components/flowbite/input/phone.rb
92
+ - app/components/flowbite/input/radio_button.rb
93
+ - app/components/flowbite/input/select.rb
94
+ - app/components/flowbite/input/textarea.rb
95
+ - app/components/flowbite/input/url.rb
96
+ - app/components/flowbite/input/validation_error.rb
97
+ - app/components/flowbite/input_field.rb
98
+ - app/components/flowbite/input_field/checkbox.html.erb
99
+ - app/components/flowbite/input_field/checkbox.rb
100
+ - app/components/flowbite/input_field/date.rb
101
+ - app/components/flowbite/input_field/date_time.rb
102
+ - app/components/flowbite/input_field/email.rb
103
+ - app/components/flowbite/input_field/file.rb
104
+ - app/components/flowbite/input_field/input_field.html.erb
105
+ - app/components/flowbite/input_field/number.rb
106
+ - app/components/flowbite/input_field/password.rb
107
+ - app/components/flowbite/input_field/phone.rb
108
+ - app/components/flowbite/input_field/radio_button.html.erb
109
+ - app/components/flowbite/input_field/radio_button.rb
110
+ - app/components/flowbite/input_field/select.rb
111
+ - app/components/flowbite/input_field/text.rb
112
+ - app/components/flowbite/input_field/textarea.rb
113
+ - app/components/flowbite/input_field/url.rb
114
+ - app/components/flowbite/link.rb
115
+ - app/components/flowbite/style.rb
116
+ - app/components/flowbite/toast.rb
117
+ - app/components/flowbite/toast/icon.html.erb
118
+ - app/components/flowbite/toast/icon.rb
119
+ - app/components/flowbite/toast/toast.html.erb
120
+ - app/components/uchi/field/base.rb
121
+ - app/components/uchi/field/belongs_to.rb
122
+ - app/components/uchi/field/belongs_to/edit.html.erb
123
+ - app/components/uchi/field/belongs_to/index.html.erb
124
+ - app/components/uchi/field/belongs_to/show.html.erb
125
+ - app/components/uchi/field/blank.rb
126
+ - app/components/uchi/field/blank/edit.html.erb
127
+ - app/components/uchi/field/blank/index.html.erb
128
+ - app/components/uchi/field/blank/show.html.erb
129
+ - app/components/uchi/field/boolean.rb
130
+ - app/components/uchi/field/boolean/edit.html.erb
131
+ - app/components/uchi/field/boolean/index.html.erb
132
+ - app/components/uchi/field/boolean/show.html.erb
133
+ - app/components/uchi/field/date.rb
134
+ - app/components/uchi/field/date/edit.html.erb
135
+ - app/components/uchi/field/date/index.html.erb
136
+ - app/components/uchi/field/date/show.html.erb
137
+ - app/components/uchi/field/date_time.rb
138
+ - app/components/uchi/field/date_time/edit.html.erb
139
+ - app/components/uchi/field/date_time/index.html.erb
140
+ - app/components/uchi/field/date_time/show.html.erb
141
+ - app/components/uchi/field/file.rb
142
+ - app/components/uchi/field/file/edit.html.erb
143
+ - app/components/uchi/field/file/index.html.erb
144
+ - app/components/uchi/field/file/show.html.erb
145
+ - app/components/uchi/field/has_and_belongs_to_many.rb
146
+ - app/components/uchi/field/has_and_belongs_to_many/edit.html.erb
147
+ - app/components/uchi/field/has_and_belongs_to_many/index.html.erb
148
+ - app/components/uchi/field/has_and_belongs_to_many/show.html.erb
149
+ - app/components/uchi/field/has_many.rb
150
+ - app/components/uchi/field/has_many/edit.html.erb
151
+ - app/components/uchi/field/has_many/index.html.erb
152
+ - app/components/uchi/field/has_many/show.html.erb
153
+ - app/components/uchi/field/id.rb
154
+ - app/components/uchi/field/id/index.html.erb
155
+ - app/components/uchi/field/id/show.html.erb
156
+ - app/components/uchi/field/image.rb
157
+ - app/components/uchi/field/image/edit.html.erb
158
+ - app/components/uchi/field/image/index.html.erb
159
+ - app/components/uchi/field/image/show.html.erb
160
+ - app/components/uchi/field/number.rb
161
+ - app/components/uchi/field/number/edit.html.erb
162
+ - app/components/uchi/field/number/index.html.erb
163
+ - app/components/uchi/field/number/show.html.erb
164
+ - app/components/uchi/field/string.rb
165
+ - app/components/uchi/field/string/edit.html.erb
166
+ - app/components/uchi/field/string/index.html.erb
167
+ - app/components/uchi/field/string/show.html.erb
168
+ - app/components/uchi/field/text.rb
169
+ - app/components/uchi/field/text/edit.html.erb
170
+ - app/components/uchi/field/text/index.html.erb
171
+ - app/components/uchi/field/text/show.html.erb
172
+ - app/components/uchi/ui/breadcrumb.rb
173
+ - app/components/uchi/ui/breadcrumb/breadcrumb.html.erb
174
+ - app/components/uchi/ui/form/footer.rb
175
+ - app/components/uchi/ui/form/footer/footer.html.erb
176
+ - app/components/uchi/ui/form/input/collection_checkboxes.html.erb
177
+ - app/components/uchi/ui/form/input/collection_checkboxes.rb
178
+ - app/components/uchi/ui/frame.rb
179
+ - app/components/uchi/ui/frame/frame.html.erb
180
+ - app/components/uchi/ui/index/records_table.rb
181
+ - app/components/uchi/ui/index/records_table/records_table.html.erb
182
+ - app/components/uchi/ui/index/records_table/search_form.rb
183
+ - app/components/uchi/ui/index/records_table/search_form/search_form.html.erb
184
+ - app/components/uchi/ui/index/turbo_frame.rb
185
+ - app/components/uchi/ui/page_header.rb
186
+ - app/components/uchi/ui/page_header/page_header.html.erb
187
+ - app/components/uchi/ui/pagination.rb
188
+ - app/components/uchi/ui/pagination/current_link.html.erb
189
+ - app/components/uchi/ui/pagination/current_link.rb
190
+ - app/components/uchi/ui/pagination/gap.html.erb
191
+ - app/components/uchi/ui/pagination/gap.rb
192
+ - app/components/uchi/ui/pagination/item.rb
193
+ - app/components/uchi/ui/pagination/link.html.erb
194
+ - app/components/uchi/ui/pagination/link.rb
195
+ - app/components/uchi/ui/pagination/next_link.html.erb
196
+ - app/components/uchi/ui/pagination/next_link.rb
197
+ - app/components/uchi/ui/pagination/pagination.html.erb
198
+ - app/components/uchi/ui/pagination/previous_link.html.erb
199
+ - app/components/uchi/ui/pagination/previous_link.rb
200
+ - app/components/uchi/ui/show/attribute_fields.rb
201
+ - app/components/uchi/ui/show/attribute_fields/attribute_fields.html.erb
202
+ - app/components/uchi/ui/spinner.rb
203
+ - app/components/uchi/ui/spinner/spinner.html.erb
204
+ - app/controllers/uchi/application_controller.rb
205
+ - app/controllers/uchi/controller.rb
206
+ - app/controllers/uchi/repository_controller.rb
207
+ - app/helpers/uchi/application_helper.rb
208
+ - app/jobs/uchi/application_job.rb
209
+ - app/mailers/uchi/application_mailer.rb
210
+ - app/views/layouts/uchi/_flash_messages.html.erb
211
+ - app/views/layouts/uchi/application.html.erb
212
+ - app/views/uchi/repository/edit.html.erb
213
+ - app/views/uchi/repository/index.html.erb
214
+ - app/views/uchi/repository/new.html.erb
215
+ - app/views/uchi/repository/show.html.erb
216
+ - lib/generators/uchi/controller/controller_generator.rb
217
+ - lib/generators/uchi/controller/templates/controller.rb.tt
218
+ - lib/generators/uchi/install/install_generator.rb
219
+ - lib/generators/uchi/repository/repository_generator.rb
220
+ - lib/generators/uchi/repository/templates/repository.rb.tt
221
+ - lib/tasks/uchi_tasks.rake
222
+ - lib/uchi.rb
223
+ - lib/uchi/application_record.rb
224
+ - lib/uchi/engine.rb
225
+ - lib/uchi/field.rb
226
+ - lib/uchi/field/configuration.rb
227
+ - lib/uchi/i18n.rb
228
+ - lib/uchi/pagination/controller.rb
229
+ - lib/uchi/pagination/page.rb
230
+ - lib/uchi/pagy.rb
231
+ - lib/uchi/pagy/LICENSE.txt
232
+ - lib/uchi/pagy/classes/exceptions.rb
233
+ - lib/uchi/pagy/classes/offset/offset.rb
234
+ - lib/uchi/pagy/classes/request.rb
235
+ - lib/uchi/pagy/modules/abilities/configurable.rb
236
+ - lib/uchi/pagy/modules/abilities/linkable.rb
237
+ - lib/uchi/pagy/modules/abilities/rangeable.rb
238
+ - lib/uchi/pagy/modules/abilities/shiftable.rb
239
+ - lib/uchi/pagy/modules/console.rb
240
+ - lib/uchi/pagy/toolbox/helpers/loader.rb
241
+ - lib/uchi/pagy/toolbox/helpers/page_url.rb
242
+ - lib/uchi/pagy/toolbox/paginators/method.rb
243
+ - lib/uchi/pagy/toolbox/paginators/offset.rb
244
+ - lib/uchi/repository.rb
245
+ - lib/uchi/repository/routes.rb
246
+ - lib/uchi/repository/translate.rb
247
+ - lib/uchi/sort_order.rb
248
+ - lib/uchi/version.rb
249
+ - uchi.gemspec
250
+ homepage: https://www.uchiadmin.com/
160
251
  licenses: []
161
252
  metadata:
253
+ changelog_uri: https://github.com/substancelab/uchi/blob/main/CHANGELOG.md
162
254
  homepage_uri: https://www.uchiadmin.com/
163
255
  source_code_uri: https://github.com/substancelab/uchi
164
256
  rdoc_options: []
@@ -1,17 +0,0 @@
1
- # To get started with Dependabot version updates, you'll need to specify which
2
- # package ecosystems to update and where the package manifests are located.
3
- # Please see the documentation for all configuration options:
4
- # https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file
5
-
6
- version: 2
7
- updates:
8
- - package-ecosystem: "bundler"
9
- directory: "/"
10
- schedule:
11
- interval: "weekly"
12
-
13
- - package-ecosystem: "npm"
14
- directory: "/"
15
- schedule:
16
- interval: "weekly"
17
-
@@ -1,23 +0,0 @@
1
- name: "Build"
2
- on:
3
- push:
4
- branches: [ "main" ]
5
- pull_request:
6
- branches: [ "main" ]
7
- jobs:
8
- test:
9
- runs-on: ubuntu-latest
10
- env:
11
- RAILS_ENV: test
12
- steps:
13
- - name: Checkout code
14
- uses: actions/checkout@v5
15
- - name: Install Ruby and gems
16
- uses: ruby/setup-ruby@v1
17
- with:
18
- bundler-cache: true
19
- ruby-version: '3.4.5'
20
- - name: Set up database schema
21
- run: bundle exec rake app:db:schema:load
22
- - name: Run tests
23
- run: bundle exec rake app:test
@@ -1,30 +0,0 @@
1
- name: "Lint"
2
- on:
3
- push:
4
- branches: [ "main" ]
5
- pull_request:
6
- branches: [ "main" ]
7
- jobs:
8
- erb:
9
- runs-on: ubuntu-latest
10
- steps:
11
- - name: Checkout code
12
- uses: actions/checkout@v5
13
- - name: Install Node
14
- uses: actions/setup-node@v5
15
- - name: Install dependencies
16
- run: npm install
17
- - name: Herb
18
- run: npm run herb:lint
19
- ruby:
20
- runs-on: ubuntu-latest
21
- steps:
22
- - name: Checkout code
23
- uses: actions/checkout@v5
24
- - name: Install Ruby and gems
25
- uses: ruby/setup-ruby@v1
26
- with:
27
- bundler-cache: true
28
- ruby-version: '3.4.5'
29
- - name: Standard
30
- run: bundle exec rake standard
data/CHANGELOG.md DELETED
@@ -1,29 +0,0 @@
1
- # Changelog
2
-
3
- All notable changes to this project will be documented in this file.
4
-
5
- The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
- and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
-
8
- ## [Unreleased]
9
-
10
- ### Added
11
-
12
- ### Fixed
13
-
14
- ### Removed
15
-
16
-
17
- ## [0.1.3]
18
-
19
- ### Added
20
-
21
- - Field::Text for multi-line text content like descriptions, biographies, notes, and comments.
22
- - Field for HasAndBelongsToMany associations.
23
- - Better blank slate when a RecordsTable has no records; we also no longer show page navigation when there are no records.
24
- - A changelog!
25
- - Everything else up until now ;)
26
-
27
- ### Fixed
28
-
29
- - uchi:controller generator now generates proper controller names when name contains multiple words.
data/docs/fields.md DELETED
@@ -1,82 +0,0 @@
1
- # Fields
2
-
3
- ## Only show a field on specific pages
4
-
5
- Use the `on` method to control what pages to show a field on. For example if your id field should only be visible on the index listing, you can configure it as
6
-
7
- ```ruby
8
- Field::Number.new(:id).on(:index)
9
- ```
10
-
11
- Possible actions are
12
-
13
- - `:index`
14
- - `:show`
15
- - `:new`
16
- - `:edit`
17
-
18
- The default is to show all fields on all pages.
19
-
20
- ## Search
21
-
22
- If a repository contains at least one searchable `Field` a search field appears on the index page. By default all text-based fields are considered searchable.
23
-
24
- The search is fairly naive and is a bunch of `LIKE '%query%'` (`ILIKE` in PostgreSQL) clauses strung together by `OR`.
25
-
26
- ### Disable search
27
-
28
- To toggle searchability for a field use the `:searchable` option:
29
-
30
- ```ruby
31
- Field::String.new(:password).searchable(false)
32
- ```
33
-
34
- ### Enable search
35
-
36
- You can also enable search for fields that don't enable it by default:
37
-
38
- ```ruby
39
- Field::Number.new(:id).searchable(true)
40
- ```
41
-
42
- Uchi casts whatever datatype the field uses into a string when searching and perform a partial match on it using `LIKE` (`ILIKE` in PostgreSQL), which may or may not yield the results you expect.
43
-
44
-
45
- ## Sorting
46
-
47
- All fields are considered sortable by default. This means that a link to toggle the order of a column appears for all columns on index pages. How to sort a specific field - or to disable it entirely - is configured using the `:sortable` option.
48
-
49
- ### Disable sorting
50
-
51
- To disable sorting a specific field:
52
-
53
- ```ruby
54
- Field::Number.new(:calculated_sum).sortable(false)
55
- ```
56
-
57
- ### Customize sorting
58
-
59
- To customize the query used to sort by a given field, pass a lambda to the `sortable` method:
60
-
61
- ```ruby
62
- Field::Number.new(:users_count).sortable(lambda { |query, direction|
63
- query.joins(:users).group(:id).order("COUNT(users.id) #{direction}")
64
- })
65
- ```
66
-
67
- The lambda receives 2 arguments:
68
-
69
- 1. `query`: The `ActiveRecord::Relation` that makes up the current database query
70
- 2. `direction`: A symbol indicating what order to sort; either `:asc` or `:desc`.
71
-
72
- The lambda should return an `ActiveRecord::Relation` with the desired sort order added.
73
-
74
- ### Sorting by columns in another table
75
-
76
- Thanks to ActiveRecord we can even sort by columns in other tables/models. If you have an `Employee` model that belongs to a `Company` and you want to allow your users to sort the employee list by company name, you can configure the field like this:
77
-
78
- ```ruby
79
- Field::BelongsTo.new(:company).sortable(lambda { |query, direction|
80
- query.joins(:office).order(:offices => {:name => direction})
81
- })
82
- ```
data/docs/repositories.md DELETED
@@ -1,63 +0,0 @@
1
- # Repositories
2
-
3
- The cornerstones of Uchi are the repositories. This is where you configure what parts of your models you want to expose and how to do it.
4
-
5
- ## Models
6
-
7
- There's a one-to-one mapping between a repository and a model. So if you have a `User` model that you want to include in Uchi, you must have a `User` repository as well.
8
-
9
- ## Routes
10
-
11
- In order to expose your requests to your users, you need a route for each of them. These routes are added to `config/routes.rb` in your main application under the `uchi` namespace:
12
-
13
- ```ruby
14
- namespace :uchi do
15
- resources :companies
16
- end
17
- ```
18
-
19
- See [Rails' routing documentation](https://guides.rubyonrails.org/routing.html) for more details.
20
-
21
- ### Root URL
22
-
23
- If you want to expose a repository at the root URL (ie `/uchi/`) you can configure a [`root`](https://guides.rubyonrails.org/routing.html#using-root) for the namespace:
24
-
25
- ```ruby
26
- namespace :uchi do
27
- root "companies#index"
28
- end
29
- ```
30
-
31
- ## Default sort order
32
-
33
- Lists of records in a repository are by default sorted by a column called `id`. To customize the default sort order, which is used when a user hasn’t explicitly chosen to sort by a specific field, you can create a `default_sort_order` method in the repository:
34
-
35
- ```ruby
36
- module Uchi
37
- class CustomersRepository < Uchi::Repository
38
- def default_sort_order
39
- SortOrder.new(:name, :desc)
40
- end
41
- end
42
- end
43
- ```
44
-
45
- `default_sort_order` should return a `Uchi::Repository::SortOrder`.
46
-
47
- ## Avoiding n+1
48
-
49
- To avoid n+1 performance issues on your index pages and other lists, you can set up includes for the repository.
50
-
51
- ```ruby
52
- module Uchi
53
- module Repositories
54
- class User < Repository
55
- def includes
56
- [:account]
57
- end
58
- end
59
- end
60
- end
61
- ```
62
-
63
- See https://api.rubyonrails.org/classes/ActiveRecord/QueryMethods.html#method-i-includes for details.
data/package.json DELETED
@@ -1,31 +0,0 @@
1
- {
2
- "name": "uchi",
3
- "version": "0.0.1",
4
- "description": "## Installation",
5
- "main": "index.js",
6
- "directories": {
7
- "lib": "lib",
8
- "test": "test"
9
- },
10
- "scripts": {
11
- "assets:build": "npm run build:css && npm run build:js",
12
- "build:css": "node_modules/.bin/tailwindcss -i ./app/assets/tailwind/uchi.css -o ./app/assets/stylesheets/uchi/application.css",
13
- "build:js": "node_modules/.bin/esbuild --bundle --outfile=app/assets/javascripts/uchi/application.js app/assets/javascripts/uchi.js",
14
- "herb:lint": "herb-lint '**/*.html.erb'",
15
- "test": "echo \"Error: no test specified\" && exit 1",
16
- "watch:css": "node_modules/.bin/tailwindcss --watch -i ./app/assets/tailwind/uchi.css -o ./app/assets/stylesheets/uchi/application.css",
17
- "watch:js": "node_modules/.bin/esbuild --watch --bundle --outfile=app/assets/javascripts/uchi/application.js app/assets/javascripts/uchi.js"
18
- },
19
- "author": "",
20
- "license": "ISC",
21
- "dependencies": {
22
- "@hotwired/turbo-rails": "^8.0.16",
23
- "@tailwindcss/cli": "^4.1.13",
24
- "flowbite": "^3.1.2",
25
- "tailwindcss": "^4.1.13"
26
- },
27
- "devDependencies": {
28
- "@herb-tools/linter": "^0.7.4",
29
- "esbuild": "0.25.11"
30
- }
31
- }