recourse 4.4.4 → 4.6.0
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 +41 -0
- data/README.md +6 -1
- data/app/javascript/recourse/density_controller.js +17 -0
- data/app/javascript/recourse/scheme_controller.js +64 -16
- data/app/stylesheets/recourse/themes/bootstrap.css +11 -0
- data/app/stylesheets/recourse/themes/dawn.css +189 -0
- data/app/stylesheets/recourse/themes/dracula.css +189 -0
- data/app/stylesheets/recourse/themes/gruvbox.css +189 -0
- data/app/stylesheets/recourse/themes/monokai.css +190 -0
- data/app/stylesheets/recourse/themes/nord.css +189 -0
- data/app/stylesheets/recourse/themes/one_dark.css +189 -0
- data/app/stylesheets/recourse/themes/solarized.css +188 -0
- data/app/stylesheets/recourse/themes/tokyo_night.css +189 -0
- data/app/views/layouts/recourses.html.erb +105 -83
- data/app/views/recourses/_footer.html.erb +3 -2
- data/app/views/recourses/_scheme.html.erb +18 -4
- data/app/views/recourses/_sidebar.html.erb +18 -1
- data/config/locales/recourse.en.yml +7 -2
- data/lib/recourse/colors.rb +7 -1
- data/lib/recourse/controllers.rb +31 -4
- data/lib/recourse/densities.rb +7 -0
- data/lib/recourse/engine.rb +6 -2
- data/lib/recourse/helpers/bookmarks.rb +3 -1
- data/lib/recourse/helpers/densities.rb +17 -0
- data/lib/recourse/helpers/formats.rb +11 -5
- data/lib/recourse/helpers/navigation.rb +5 -3
- data/lib/recourse/helpers/themes.rb +36 -0
- data/lib/recourse/helpers.rb +4 -3
- data/lib/recourse/routes/nested.rb +4 -3
- data/lib/recourse/themes.rb +49 -0
- data/lib/recourse/version.rb +1 -1
- data/lib/recourse.rb +2 -1
- metadata +17 -5
- data/lib/recourse/helpers/schemes.rb +0 -14
- data/lib/recourse/schemes.rb +0 -6
data/lib/recourse/helpers.rb
CHANGED
|
@@ -9,6 +9,7 @@ require_relative 'helpers/comboboxes'
|
|
|
9
9
|
require_relative 'helpers/constraints'
|
|
10
10
|
require_relative 'helpers/counters'
|
|
11
11
|
require_relative 'helpers/deletions'
|
|
12
|
+
require_relative 'helpers/densities'
|
|
12
13
|
require_relative 'helpers/details'
|
|
13
14
|
require_relative 'helpers/examples'
|
|
14
15
|
require_relative 'helpers/fields'
|
|
@@ -26,7 +27,7 @@ require_relative 'helpers/resources'
|
|
|
26
27
|
require_relative 'helpers/refreshes'
|
|
27
28
|
require_relative 'helpers/routing'
|
|
28
29
|
require_relative 'helpers/rows'
|
|
29
|
-
require_relative 'helpers/
|
|
30
|
+
require_relative 'helpers/themes'
|
|
30
31
|
require_relative 'helpers/searches'
|
|
31
32
|
require_relative 'helpers/shortcuts'
|
|
32
33
|
require_relative 'helpers/sidebars'
|
|
@@ -40,12 +41,12 @@ module Recourse
|
|
|
40
41
|
# View helpers for the pages the gem renders, and what the parts share.
|
|
41
42
|
module Helpers
|
|
42
43
|
include Actions, Bookmarks, Buttons, Cards,
|
|
43
|
-
Cells, Choices, Colors, Comboboxes, Constraints, Counters, Deletions,
|
|
44
|
+
Cells, Choices, Colors, Comboboxes, Constraints, Counters, Deletions, Densities,
|
|
44
45
|
Details,
|
|
45
46
|
Examples, Fields, Filters, Formats, Inputs, Kinds, Limits,
|
|
46
47
|
Names, Navigation, Parents, Pictures, References, Refreshes,
|
|
47
48
|
Routing,
|
|
48
|
-
Resources, Rows,
|
|
49
|
+
Resources, Rows, Searches, Shortcuts, Sidebars, Sorts, Tabs, Themes,
|
|
49
50
|
Times, Values, Zones
|
|
50
51
|
|
|
51
52
|
# The grid a record's own two pages lay an attribute out in: two columns on a large
|
|
@@ -18,8 +18,9 @@ module Recourse
|
|
|
18
18
|
# Whether this resource has rows to address one at a time. A bookmark names one
|
|
19
19
|
# row, which means nothing for a name with no class behind it at all — and one was
|
|
20
20
|
# drawn anyway, at `/placeholders/:placeholder_id/bookmark`, where nothing linked
|
|
21
|
-
# to it and anything reaching it raised.
|
|
22
|
-
|
|
21
|
+
# to it and anything reaching it raised. Asked of the constant rather than the
|
|
22
|
+
# class: loading a model while the routes draw is what Rails 8.2 warns about.
|
|
23
|
+
def addressable_rows? = Object.const_defined? Recourse.model_name(parent_resource.name)
|
|
23
24
|
|
|
24
25
|
# The row a table's bookmark square writes: one record kept by whoever is looking,
|
|
25
26
|
# at `/places/5/bookmark`. Deliberately not recorded through `Recourse.nest` — it
|
|
@@ -28,7 +29,7 @@ module Recourse
|
|
|
28
29
|
# since the gem drew it: one segment under the resource, always.
|
|
29
30
|
def draw_bookmark
|
|
30
31
|
path = [current_module, 'bookmarks'].compact.join '/'
|
|
31
|
-
Controllers.define_missing
|
|
32
|
+
Controllers.define_missing(path) { ::BookmarksController }
|
|
32
33
|
resource :bookmark, only: %i[create destroy]
|
|
33
34
|
end
|
|
34
35
|
end
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# Reopened for the other thing a host says about how every page looks.
|
|
2
|
+
module Recourse
|
|
3
|
+
# Palettes a host may draw its pages in: eight color schemes from code editors, and
|
|
4
|
+
# Bootstrap's own — which is what a page wears when none is named at all, so nil and
|
|
5
|
+
# `:bootstrap` are two spellings of one look. It is named all the same, because the
|
|
6
|
+
# sidebar's toggle rotates through this list and a reader who never finds upstream's
|
|
7
|
+
# palette in it can never get back to it.
|
|
8
|
+
#
|
|
9
|
+
# Each is mapped to the families whose 500 step its palette puts dark text on rather
|
|
10
|
+
# than white. That is the one thing about a palette the gem reads; everything else
|
|
11
|
+
# about it — every ramp, and the accent it leads with — is in its stylesheet, which
|
|
12
|
+
# is the only place it could be true.
|
|
13
|
+
THEMES = {
|
|
14
|
+
bootstrap: DARK_INKS,
|
|
15
|
+
dawn: %i[brown cyan gray orange pink purple yellow],
|
|
16
|
+
dracula: %i[blue brown cyan green orange pink purple red yellow],
|
|
17
|
+
gruvbox: %i[cyan gray green yellow],
|
|
18
|
+
monokai: %i[blue brown cyan green orange purple yellow],
|
|
19
|
+
nord: %i[brown cyan green orange pink purple yellow],
|
|
20
|
+
one_dark: %i[blue brown cyan gray green orange pink purple red yellow],
|
|
21
|
+
solarized: %i[blue brown cyan gray green yellow],
|
|
22
|
+
tokyo_night: %i[blue brown cyan gray green orange pink purple red yellow],
|
|
23
|
+
}.freeze
|
|
24
|
+
|
|
25
|
+
# Where the palettes are served from, named once: the layout links one, the layout's
|
|
26
|
+
# own script puts back the one a reader chose, and the sidebar's controller swaps it.
|
|
27
|
+
THEMES_PATH = '/recourse/themes'
|
|
28
|
+
|
|
29
|
+
# Where a reader's chosen palette and mode are kept in their browser. Named once for
|
|
30
|
+
# the same reason: the sidebar's controller writes it and the layout reads it back.
|
|
31
|
+
SCHEME_STORAGE = 'recourse-scheme'
|
|
32
|
+
|
|
33
|
+
class << self
|
|
34
|
+
# Which editor scheme the pages are drawn in, or nil for Bootstrap's own palette.
|
|
35
|
+
attr_reader :theme
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
# Picks the scheme, and says which eight there are when handed anything else. A name
|
|
39
|
+
# nobody ships would otherwise ask the browser for a stylesheet that is not there and
|
|
40
|
+
# go unnoticed until somebody looked at a page.
|
|
41
|
+
def self.theme=(theme)
|
|
42
|
+
name = theme&.to_sym
|
|
43
|
+
unless name.nil? || THEMES.key?(name)
|
|
44
|
+
raise Error, I18n.t('recourse.unknown_theme', theme:, themes: THEMES.keys.to_sentence)
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
@theme = name
|
|
48
|
+
end
|
|
49
|
+
end
|
data/lib/recourse/version.rb
CHANGED
data/lib/recourse.rb
CHANGED
|
@@ -7,9 +7,10 @@ require_relative 'recourse/version'
|
|
|
7
7
|
require_relative 'recourse/bookmarks'
|
|
8
8
|
require_relative 'recourse/colors'
|
|
9
9
|
require_relative 'recourse/columns'
|
|
10
|
-
require_relative 'recourse/
|
|
10
|
+
require_relative 'recourse/themes'
|
|
11
11
|
require_relative 'recourse/icons'
|
|
12
12
|
require_relative 'recourse/controllers'
|
|
13
|
+
require_relative 'recourse/densities'
|
|
13
14
|
require_relative 'recourse/helpers'
|
|
14
15
|
require_relative 'recourse/limits'
|
|
15
16
|
require_relative 'recourse/orders'
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: recourse
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 4.
|
|
4
|
+
version: 4.6.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- claudiob
|
|
@@ -99,14 +99,14 @@ dependencies:
|
|
|
99
99
|
requirements:
|
|
100
100
|
- - ">="
|
|
101
101
|
- !ruby/object:Gem::Version
|
|
102
|
-
version: '3.
|
|
102
|
+
version: '3.6'
|
|
103
103
|
type: :runtime
|
|
104
104
|
prerelease: false
|
|
105
105
|
version_requirements: !ruby/object:Gem::Requirement
|
|
106
106
|
requirements:
|
|
107
107
|
- - ">="
|
|
108
108
|
- !ruby/object:Gem::Version
|
|
109
|
-
version: '3.
|
|
109
|
+
version: '3.6'
|
|
110
110
|
description: Recourse adds a `recourses` method to config/routes.rb. One line draws
|
|
111
111
|
the routes, controllers and views needed to browse and edit a resource, with no
|
|
112
112
|
files added to the host app. Any controller, view or partial can be overridden by
|
|
@@ -136,6 +136,7 @@ files:
|
|
|
136
136
|
- app/javascript/recourse/clear_controller.js
|
|
137
137
|
- app/javascript/recourse/combobox_controller.js
|
|
138
138
|
- app/javascript/recourse/confirm.js
|
|
139
|
+
- app/javascript/recourse/density_controller.js
|
|
139
140
|
- app/javascript/recourse/deselect_controller.js
|
|
140
141
|
- app/javascript/recourse/flash.js
|
|
141
142
|
- app/javascript/recourse/limit_controller.js
|
|
@@ -150,6 +151,15 @@ files:
|
|
|
150
151
|
- app/javascript/recourse/tooltip_controller.js
|
|
151
152
|
- app/javascript/recourse/written.js
|
|
152
153
|
- app/javascript/recourse/written_controller.js
|
|
154
|
+
- app/stylesheets/recourse/themes/bootstrap.css
|
|
155
|
+
- app/stylesheets/recourse/themes/dawn.css
|
|
156
|
+
- app/stylesheets/recourse/themes/dracula.css
|
|
157
|
+
- app/stylesheets/recourse/themes/gruvbox.css
|
|
158
|
+
- app/stylesheets/recourse/themes/monokai.css
|
|
159
|
+
- app/stylesheets/recourse/themes/nord.css
|
|
160
|
+
- app/stylesheets/recourse/themes/one_dark.css
|
|
161
|
+
- app/stylesheets/recourse/themes/solarized.css
|
|
162
|
+
- app/stylesheets/recourse/themes/tokyo_night.css
|
|
153
163
|
- app/views/layouts/recourses.html.erb
|
|
154
164
|
- app/views/recourses/_breadcrumb.html.erb
|
|
155
165
|
- app/views/recourses/_card.html.erb
|
|
@@ -179,6 +189,7 @@ files:
|
|
|
179
189
|
- lib/recourse/colors.rb
|
|
180
190
|
- lib/recourse/columns.rb
|
|
181
191
|
- lib/recourse/controllers.rb
|
|
192
|
+
- lib/recourse/densities.rb
|
|
182
193
|
- lib/recourse/engine.rb
|
|
183
194
|
- lib/recourse/helpers.rb
|
|
184
195
|
- lib/recourse/helpers/actions.rb
|
|
@@ -192,6 +203,7 @@ files:
|
|
|
192
203
|
- lib/recourse/helpers/constraints.rb
|
|
193
204
|
- lib/recourse/helpers/counters.rb
|
|
194
205
|
- lib/recourse/helpers/deletions.rb
|
|
206
|
+
- lib/recourse/helpers/densities.rb
|
|
195
207
|
- lib/recourse/helpers/details.rb
|
|
196
208
|
- lib/recourse/helpers/examples.rb
|
|
197
209
|
- lib/recourse/helpers/fields.rb
|
|
@@ -209,12 +221,12 @@ files:
|
|
|
209
221
|
- lib/recourse/helpers/resources.rb
|
|
210
222
|
- lib/recourse/helpers/routing.rb
|
|
211
223
|
- lib/recourse/helpers/rows.rb
|
|
212
|
-
- lib/recourse/helpers/schemes.rb
|
|
213
224
|
- lib/recourse/helpers/searches.rb
|
|
214
225
|
- lib/recourse/helpers/shortcuts.rb
|
|
215
226
|
- lib/recourse/helpers/sidebars.rb
|
|
216
227
|
- lib/recourse/helpers/sorts.rb
|
|
217
228
|
- lib/recourse/helpers/tabs.rb
|
|
229
|
+
- lib/recourse/helpers/themes.rb
|
|
218
230
|
- lib/recourse/helpers/times.rb
|
|
219
231
|
- lib/recourse/helpers/values.rb
|
|
220
232
|
- lib/recourse/helpers/zones.rb
|
|
@@ -226,13 +238,13 @@ files:
|
|
|
226
238
|
- lib/recourse/routes.rb
|
|
227
239
|
- lib/recourse/routes/nested.rb
|
|
228
240
|
- lib/recourse/routing.rb
|
|
229
|
-
- lib/recourse/schemes.rb
|
|
230
241
|
- lib/recourse/scopes.rb
|
|
231
242
|
- lib/recourse/search.rb
|
|
232
243
|
- lib/recourse/searchable.rb
|
|
233
244
|
- lib/recourse/searchable/columns.rb
|
|
234
245
|
- lib/recourse/searchable/filters.rb
|
|
235
246
|
- lib/recourse/searchable/terms.rb
|
|
247
|
+
- lib/recourse/themes.rb
|
|
236
248
|
- lib/recourse/titles.rb
|
|
237
249
|
- lib/recourse/version.rb
|
|
238
250
|
- lib/recourse/writes.rb
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
module Recourse
|
|
2
|
-
module Helpers
|
|
3
|
-
# The reader's own say in whether a page is light or dark.
|
|
4
|
-
module Schemes
|
|
5
|
-
private
|
|
6
|
-
|
|
7
|
-
# What the sidebar's toggle needs to flip the mode: where to keep what the reader
|
|
8
|
-
# picked, so the layout's script can put it back on the next visit.
|
|
9
|
-
def scheme_data
|
|
10
|
-
{ controller: 'scheme', action: 'scheme#rotate', scheme_storage_value: Recourse::SCHEME_STORAGE }
|
|
11
|
-
end
|
|
12
|
-
end
|
|
13
|
-
end
|
|
14
|
-
end
|
data/lib/recourse/schemes.rb
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
# Reopened for the one thing a reader says about how every page looks.
|
|
2
|
-
module Recourse
|
|
3
|
-
# Where a reader's chosen mode is kept in their browser. Named once: the sidebar's
|
|
4
|
-
# controller writes it and the layout's own script reads it back before the first paint.
|
|
5
|
-
SCHEME_STORAGE = 'recourse-scheme'
|
|
6
|
-
end
|