trek 0.1.11 → 0.1.13
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/.stylelintrc.json +7 -2
- data/.yarnrc.yml +1 -1
- data/Gemfile.lock +3 -3
- data/Makefile +12 -0
- data/README.md +8 -9
- data/app/assets/stylesheets/trek/_colors.css +26 -26
- data/app/assets/stylesheets/trek/base.css +3 -3
- data/app/components/trek/form/content_editor_component/content_editor_component.css +2 -2
- data/app/components/trek/form/content_editor_component/content_editor_component.html.slim +3 -3
- data/app/components/trek/form/content_editor_component.rb +2 -1
- data/app/components/trek/list/item_component/item_component.css +2 -0
- data/app/models/concerns/trek/contentable.rb +21 -2
- data/app/models/concerns/trek/pages/pathable.rb +2 -0
- data/config/locales/trek.fr.yml +3 -1
- data/lib/generators/trek/templates/policies/admin/scaffold_policy.rb.tt +1 -1
- data/lib/generators/trek/templates/policies/admin/tag_category_policy.rb +30 -2
- data/lib/generators/trek/templates/policies/admin/tag_policy.rb +36 -6
- data/lib/trek/version.rb +1 -1
- data/package.json +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 55936551def2bb25e098d7f095626b1c65851faced1f73d8421337b660c35dfc
|
|
4
|
+
data.tar.gz: a55b3f4506ed2cb97258790e8a67194b32a5c409c311625d92aacc7c5bfe78d6
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 4eed1f56dace0fc8327f31f86294e2e1a3d394b25bcd662298191d4fd9f1c6a08442088c81cb7889e827ca66e9137c8f4498d6c9d614671daa78da6f4fd2fdc1
|
|
7
|
+
data.tar.gz: '06689e0c0b07925a1095ac88d17dc0eba1b0f4db8cbb9664162fc259fb58d795b71653c1f1cc3307fa420bd287d7f78983ce5efa73f412e23d5e98c71cbb3964'
|
data/.stylelintrc.json
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"extends": ["stylelint-config-standard"],
|
|
3
|
-
"ignoreFiles": [
|
|
3
|
+
"ignoreFiles": [
|
|
4
|
+
"app/assets/builds/**/*.css",
|
|
5
|
+
"node_modules/**/*.css",
|
|
6
|
+
"vendor/**/*.css"
|
|
7
|
+
],
|
|
4
8
|
"plugins": ["stylelint-order"],
|
|
5
9
|
"rules": {
|
|
6
10
|
"custom-property-pattern": "^[a-z0-9A-]+$",
|
|
@@ -8,6 +12,7 @@
|
|
|
8
12
|
"order/properties-alphabetical-order": true,
|
|
9
13
|
"selector-class-pattern": "^[a-z0-9-]+$",
|
|
10
14
|
"selector-pseudo-class-no-unknown": null,
|
|
11
|
-
"selector-id-pattern": "^[a-z0-9-]+$"
|
|
15
|
+
"selector-id-pattern": "^[a-z0-9-]+$",
|
|
16
|
+
"import-notation": "string"
|
|
12
17
|
}
|
|
13
18
|
}
|
data/.yarnrc.yml
CHANGED
data/Gemfile.lock
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
trek (0.1.
|
|
4
|
+
trek (0.1.13)
|
|
5
5
|
action_policy (~> 0.6)
|
|
6
6
|
actioncable
|
|
7
7
|
acts_as_list (~> 1.1)
|
|
@@ -204,7 +204,7 @@ GEM
|
|
|
204
204
|
zeitwerk (~> 2.6)
|
|
205
205
|
erb (6.0.1)
|
|
206
206
|
erubi (1.13.1)
|
|
207
|
-
faraday (2.14.
|
|
207
|
+
faraday (2.14.1)
|
|
208
208
|
faraday-net_http (>= 2.0, < 3.5)
|
|
209
209
|
json
|
|
210
210
|
logger
|
|
@@ -245,7 +245,7 @@ GEM
|
|
|
245
245
|
rdoc (>= 4.0.0)
|
|
246
246
|
reline (>= 0.4.2)
|
|
247
247
|
jmespath (1.6.2)
|
|
248
|
-
json (2.18.
|
|
248
|
+
json (2.18.1)
|
|
249
249
|
jwt (3.1.2)
|
|
250
250
|
base64
|
|
251
251
|
kaminari (1.2.2)
|
data/Makefile
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
.PHONY: all
|
|
2
|
+
|
|
3
|
+
release:
|
|
4
|
+
@read -p "New version (current: $$(sed -n 's/.*VERSION = "\(.*\)"/\1/p' lib/trek/version.rb)): " version; \
|
|
5
|
+
if [ -z "$$version" ]; then echo "Version cannot be empty"; exit 1; fi; \
|
|
6
|
+
sed -i '' "s/VERSION = \".*\"/VERSION = \"$$version\"/" lib/trek/version.rb; \
|
|
7
|
+
sed -i '' "s/\"version\": \".*\"/\"version\": \"$$version\"/" package.json; \
|
|
8
|
+
bundle; \
|
|
9
|
+
git add -A; \
|
|
10
|
+
git commit -m "Version $$version"; \
|
|
11
|
+
bundle exec rake release; \
|
|
12
|
+
yarn npm publish
|
data/README.md
CHANGED
|
@@ -205,14 +205,13 @@ When you're done, disable the local package:
|
|
|
205
205
|
|
|
206
206
|
### Publishing a new version
|
|
207
207
|
|
|
208
|
-
|
|
208
|
+
make release
|
|
209
209
|
|
|
210
|
-
|
|
210
|
+
This will:
|
|
211
211
|
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
NPM_TOKEN=YOUR_PERSONAL_TOKEN yarn npm publish
|
|
212
|
+
1. Prompt for the new version number (showing the current version)
|
|
213
|
+
2. Update the version in `lib/trek/version.rb` and `package.json`
|
|
214
|
+
3. Run `bundle` to update the lockfile
|
|
215
|
+
4. Commit all changes with message "Version X.Y.Z"
|
|
216
|
+
5. Run `bundle exec rake release` (creates git tag, pushes commits/tag, pushes gem to [rubygems.org](https://rubygems.org))
|
|
217
|
+
6. Run `yarn npm publish` (publishes the npm package). This requires a [personal token](https://git.etaminstud.io/-/user_settings/personal_access_tokens) with the `api` scope to be present in `NPM_AUTH_TOKEN`,
|
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
@import
|
|
2
|
-
@import
|
|
3
|
-
@import
|
|
4
|
-
@import
|
|
5
|
-
@import
|
|
6
|
-
@import
|
|
7
|
-
@import
|
|
8
|
-
@import
|
|
9
|
-
@import
|
|
10
|
-
@import
|
|
11
|
-
@import
|
|
12
|
-
@import
|
|
13
|
-
@import
|
|
14
|
-
@import
|
|
15
|
-
@import
|
|
16
|
-
@import
|
|
17
|
-
@import
|
|
18
|
-
@import
|
|
19
|
-
@import
|
|
20
|
-
@import
|
|
21
|
-
@import
|
|
22
|
-
@import
|
|
23
|
-
@import
|
|
24
|
-
@import
|
|
25
|
-
@import
|
|
26
|
-
@import
|
|
1
|
+
@import "@radix-ui/colors/amber.css";
|
|
2
|
+
@import "@radix-ui/colors/amber-dark.css";
|
|
3
|
+
@import "@radix-ui/colors/blue.css";
|
|
4
|
+
@import "@radix-ui/colors/blue-dark.css";
|
|
5
|
+
@import "@radix-ui/colors/cyan.css";
|
|
6
|
+
@import "@radix-ui/colors/cyan-dark.css";
|
|
7
|
+
@import "@radix-ui/colors/grass.css";
|
|
8
|
+
@import "@radix-ui/colors/grass-dark.css";
|
|
9
|
+
@import "@radix-ui/colors/lime.css";
|
|
10
|
+
@import "@radix-ui/colors/lime-dark.css";
|
|
11
|
+
@import "@radix-ui/colors/mint.css";
|
|
12
|
+
@import "@radix-ui/colors/mint-dark.css";
|
|
13
|
+
@import "@radix-ui/colors/purple.css";
|
|
14
|
+
@import "@radix-ui/colors/purple-dark.css";
|
|
15
|
+
@import "@radix-ui/colors/sky.css";
|
|
16
|
+
@import "@radix-ui/colors/sky-dark.css";
|
|
17
|
+
@import "@radix-ui/colors/slate.css";
|
|
18
|
+
@import "@radix-ui/colors/slate-alpha.css";
|
|
19
|
+
@import "@radix-ui/colors/slate-dark.css";
|
|
20
|
+
@import "@radix-ui/colors/slate-dark-alpha.css";
|
|
21
|
+
@import "@radix-ui/colors/teal.css";
|
|
22
|
+
@import "@radix-ui/colors/teal-dark.css";
|
|
23
|
+
@import "@radix-ui/colors/tomato.css";
|
|
24
|
+
@import "@radix-ui/colors/tomato-dark.css";
|
|
25
|
+
@import "@radix-ui/colors/violet.css";
|
|
26
|
+
@import "@radix-ui/colors/violet-dark.css";
|
|
27
27
|
|
|
28
28
|
:root {
|
|
29
29
|
--white: #fff;
|
|
@@ -142,7 +142,7 @@
|
|
|
142
142
|
width: 2rem;
|
|
143
143
|
}
|
|
144
144
|
|
|
145
|
-
@svg-load arrow-bar-left url("
|
|
145
|
+
@svg-load arrow-bar-left url("trek/arrow-bar-left.svg") {
|
|
146
146
|
}
|
|
147
147
|
|
|
148
148
|
.content-image[data-size="larger"]::before {
|
|
@@ -150,7 +150,7 @@
|
|
|
150
150
|
margin-right: 1rem;
|
|
151
151
|
}
|
|
152
152
|
|
|
153
|
-
@svg-load arrow-bar-right url("
|
|
153
|
+
@svg-load arrow-bar-right url("trek/arrow-bar-right.svg") {
|
|
154
154
|
}
|
|
155
155
|
|
|
156
156
|
.content-image[data-size="larger"]::after {
|
|
@@ -202,9 +202,9 @@ div(
|
|
|
202
202
|
)
|
|
203
203
|
|
|
204
204
|
= form.text_area method_name,
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
205
|
+
value: content_json,
|
|
206
|
+
data: stimulus_target_hash("editorJson"),
|
|
207
|
+
style: "display: none"
|
|
208
208
|
|
|
209
209
|
- if floating
|
|
210
210
|
div(
|
|
@@ -26,6 +26,7 @@
|
|
|
26
26
|
border-radius: 0.2rem;
|
|
27
27
|
color: var(--slate-8);
|
|
28
28
|
display: flex;
|
|
29
|
+
flex-shrink: 0;
|
|
29
30
|
height: 5rem;
|
|
30
31
|
justify-content: center;
|
|
31
32
|
margin-right: 2rem;
|
|
@@ -58,6 +59,7 @@
|
|
|
58
59
|
font-size: 0.8em;
|
|
59
60
|
letter-spacing: 0.01rem;
|
|
60
61
|
text-transform: uppercase;
|
|
62
|
+
white-space: nowrap;
|
|
61
63
|
}
|
|
62
64
|
|
|
63
65
|
.dot {
|
|
@@ -5,7 +5,7 @@ module Trek
|
|
|
5
5
|
def parsed_content
|
|
6
6
|
return if content.blank?
|
|
7
7
|
|
|
8
|
-
JSON.parse(content)
|
|
8
|
+
content.is_a?(Hash) ? content : JSON.parse(content)
|
|
9
9
|
end
|
|
10
10
|
|
|
11
11
|
def formatted_content
|
|
@@ -14,8 +14,27 @@ module Trek
|
|
|
14
14
|
Prosemirror.new.format_content(parsed_content)
|
|
15
15
|
end
|
|
16
16
|
|
|
17
|
+
def content_text
|
|
18
|
+
return if content.blank?
|
|
19
|
+
|
|
20
|
+
extract_text(parsed_content)
|
|
21
|
+
end
|
|
22
|
+
|
|
17
23
|
def prosemirror_content?
|
|
18
|
-
content
|
|
24
|
+
case content
|
|
25
|
+
when Hash then content["type"] == "doc"
|
|
26
|
+
when String then content.start_with?('{"type":"doc"')
|
|
27
|
+
else false
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
private
|
|
32
|
+
|
|
33
|
+
def extract_text(node)
|
|
34
|
+
return node["text"].to_s if node["type"] == "text"
|
|
35
|
+
return "" unless node["content"]
|
|
36
|
+
|
|
37
|
+
node["content"].map { |child| extract_text(child) }.join
|
|
19
38
|
end
|
|
20
39
|
end
|
|
21
40
|
end
|
|
@@ -9,7 +9,9 @@ module Trek
|
|
|
9
9
|
optional: true,
|
|
10
10
|
inverse_of: :current_page
|
|
11
11
|
has_many :paths,
|
|
12
|
+
->(page) { order(Arel.sql("page_paths.id = #{page.current_path_id&.to_i} DESC"), path: :asc) },
|
|
12
13
|
class_name: "PagePath",
|
|
14
|
+
inverse_of: :page,
|
|
13
15
|
dependent: :destroy
|
|
14
16
|
|
|
15
17
|
after_save_commit :save_path
|
data/config/locales/trek.fr.yml
CHANGED
|
@@ -39,16 +39,18 @@ fr:
|
|
|
39
39
|
logout: Se déconnecter
|
|
40
40
|
manage: Gérer
|
|
41
41
|
new_resource:
|
|
42
|
-
"n": Nouveau %{resource}
|
|
42
|
+
"n": Nouveau ou nouvelle %{resource}
|
|
43
43
|
f: Nouvelle %{resource}
|
|
44
44
|
m: Nouveau %{resource}
|
|
45
45
|
m_alt: Nouvel %{resource}
|
|
46
46
|
reorder_resource:
|
|
47
|
+
"n": Réorganiser les %{resources}
|
|
47
48
|
f: Réorganiser les %{resources}
|
|
48
49
|
m: Réorganiser les %{resources}
|
|
49
50
|
m_alt: Réorganiser les %{resources}
|
|
50
51
|
replace: Remplacer
|
|
51
52
|
search_resource:
|
|
53
|
+
"n": Rechercher un·e %{resources}
|
|
52
54
|
f: Rechercher une %{resource}
|
|
53
55
|
m: Rechercher un %{resource}
|
|
54
56
|
m_alt: Rechercher un %{resource}
|
|
@@ -1,11 +1,39 @@
|
|
|
1
1
|
module Admin
|
|
2
2
|
class TagCategoryPolicy < Trek::ResourcePolicy
|
|
3
3
|
def index?
|
|
4
|
-
user.
|
|
4
|
+
user.privileged?
|
|
5
|
+
end
|
|
6
|
+
|
|
7
|
+
def create?
|
|
8
|
+
user.privileged?
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def manage?
|
|
12
|
+
user.privileged?
|
|
5
13
|
end
|
|
6
14
|
|
|
7
15
|
def destroy?
|
|
8
|
-
user.
|
|
16
|
+
user.privileged? && record.tags.empty?
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def reorder?
|
|
20
|
+
false
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def permitted_attributes
|
|
24
|
+
if user.privileged?
|
|
25
|
+
%i[name key position]
|
|
26
|
+
else
|
|
27
|
+
[]
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
# Scoping
|
|
32
|
+
# See https://actionpolicy.evilmartians.io/#/scoping
|
|
33
|
+
relation_scope do |relation|
|
|
34
|
+
next relation if user.privileged?
|
|
35
|
+
|
|
36
|
+
relation.none
|
|
9
37
|
end
|
|
10
38
|
end
|
|
11
39
|
end
|
|
@@ -1,9 +1,39 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
module Admin
|
|
2
|
+
class TagPolicy < Trek::ResourcePolicy
|
|
3
|
+
def index?
|
|
4
|
+
user.privileged?
|
|
5
|
+
end
|
|
6
|
+
|
|
7
|
+
def create?
|
|
8
|
+
user.privileged?
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def manage?
|
|
12
|
+
user.privileged?
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def destroy?
|
|
16
|
+
user.privileged? && record.taggables.empty?
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def reorder?
|
|
20
|
+
false
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def permitted_attributes
|
|
24
|
+
if user.privileged?
|
|
25
|
+
%i[name key category_id]
|
|
26
|
+
else
|
|
27
|
+
[]
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
# Scoping
|
|
32
|
+
# See https://actionpolicy.evilmartians.io/#/scoping
|
|
33
|
+
relation_scope do |relation|
|
|
34
|
+
next relation if user.privileged?
|
|
5
35
|
|
|
6
|
-
|
|
7
|
-
|
|
36
|
+
relation.none
|
|
37
|
+
end
|
|
8
38
|
end
|
|
9
39
|
end
|
data/lib/trek/version.rb
CHANGED
data/package.json
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: trek
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.13
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Mohamed Bengrich
|
|
@@ -459,6 +459,7 @@ files:
|
|
|
459
459
|
- Gemfile
|
|
460
460
|
- Gemfile.lock
|
|
461
461
|
- LICENSE
|
|
462
|
+
- Makefile
|
|
462
463
|
- README.md
|
|
463
464
|
- Rakefile
|
|
464
465
|
- app/assets/icons/trek/add.svg
|
|
@@ -909,7 +910,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
909
910
|
- !ruby/object:Gem::Version
|
|
910
911
|
version: '0'
|
|
911
912
|
requirements: []
|
|
912
|
-
rubygems_version: 4.0.
|
|
913
|
+
rubygems_version: 4.0.3
|
|
913
914
|
specification_version: 4
|
|
914
915
|
summary: A modern CMS for Ruby on Rails
|
|
915
916
|
test_files: []
|