helios-press 0.1.0 → 0.2
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 +61 -16
- data/app/controllers/helios/press/admin/base_controller.rb +1 -2
- data/app/controllers/helios/press/admin/blocks_controller.rb +1 -1
- data/app/controllers/helios/press/admin/posts_controller.rb +5 -5
- data/app/controllers/helios/press/posts_controller.rb +5 -1
- data/app/models/helios/press/block_image.rb +18 -0
- data/app/views/helios/press/admin/blocks/_image_block.html.erb +2 -2
- data/app/views/helios/press/admin/blocks/_image_item.html.erb +14 -2
- data/app/views/helios/press/admin/blocks/_text_block.html.erb +2 -2
- data/app/views/helios/press/admin/blocks/_video_block.html.erb +11 -3
- data/app/views/helios/press/admin/posts/_form.html.erb +2 -2
- data/app/views/helios/press/admin/posts/edit.html.erb +1 -1
- data/app/views/helios/press/admin/posts/index.html.erb +32 -21
- data/app/views/helios/press/posts/blocks/_image_container.html.erb +20 -3
- data/app/views/helios/press/posts/index.html.erb +21 -0
- data/config/routes/admin.rb +17 -0
- data/config/routes/api.rb +5 -0
- data/config/routes/public.rb +6 -0
- data/config/routes.rb +0 -19
- data/lib/helios/press/configuration.rb +2 -0
- data/lib/helios/press/engine.rb +42 -0
- data/lib/helios/press/version.rb +1 -1
- data/lib/helios/press.rb +1 -0
- data/lib/helios-press.rb +1 -0
- metadata +6 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: ff787a0ede62265b58f025dbcd37aab9b35203b691cd74252dfd6df108669fc2
|
|
4
|
+
data.tar.gz: 505c0b5583ebbb5c8277fcd2a295abcc12747c3cb1462ec770e53ccf29acdcd4
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: fee9b6adf0321cf285cd49c2eda7446771c62e5b57a183962efcdf513026a82187602832fa1a8597c3e5aaa47790fc9dd6ca7944170541d2eeb949cce8710486
|
|
7
|
+
data.tar.gz: dfec9a5447b75c2536d8548daa69c530ba1db54d30e6fdffcec2bcfc0447d3ee129b57642ab0d9e67196aa33d6847f1958924aaf020bec6205fb297746ff5141
|
data/README.md
CHANGED
|
@@ -32,6 +32,9 @@ Helios::Press.configure do |config|
|
|
|
32
32
|
# Parent controller for admin views (must provide authentication)
|
|
33
33
|
config.admin_parent_controller = "Admin::BaseController"
|
|
34
34
|
|
|
35
|
+
# Parent controller for public views (blog index/show)
|
|
36
|
+
config.public_parent_controller = "ApplicationController"
|
|
37
|
+
|
|
35
38
|
# Optional slug prefix for posts
|
|
36
39
|
config.post_slug_prefix = nil # e.g., "blog/" for /blog/my-post
|
|
37
40
|
|
|
@@ -49,16 +52,40 @@ end
|
|
|
49
52
|
|
|
50
53
|
## Routes
|
|
51
54
|
|
|
52
|
-
|
|
55
|
+
Helios::Press provides three independent engines that you can mount wherever you want:
|
|
56
|
+
|
|
57
|
+
```ruby
|
|
58
|
+
# Admin block editor — mount behind your auth
|
|
59
|
+
mount Helios::Press::Admin::Engine, at: "/admin/press"
|
|
60
|
+
|
|
61
|
+
# Public blog index/show — mount at your preferred public path
|
|
62
|
+
mount Helios::Press::Public::Engine, at: "/blog"
|
|
63
|
+
|
|
64
|
+
# API for external post ingestion
|
|
65
|
+
mount Helios::Press::Api::Engine, at: "/api/press"
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
Mount only the engines you need. For example, if you only want the admin editor and will build your own public views:
|
|
53
69
|
|
|
54
70
|
```ruby
|
|
55
|
-
mount Helios::Press::Engine, at: "/
|
|
71
|
+
mount Helios::Press::Admin::Engine, at: "/admin/press"
|
|
56
72
|
```
|
|
57
73
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
-
|
|
74
|
+
### Routes provided
|
|
75
|
+
|
|
76
|
+
**Admin Engine:**
|
|
77
|
+
- `GET /` — Posts list
|
|
78
|
+
- `GET /posts/new` — New post form
|
|
79
|
+
- `GET /posts/:id/edit` — Block editor
|
|
80
|
+
- `POST/PATCH/DELETE /posts/:id` — CRUD
|
|
81
|
+
- Block and image sub-resources
|
|
82
|
+
|
|
83
|
+
**Public Engine:**
|
|
84
|
+
- `GET /` — Published posts index
|
|
85
|
+
- `GET /:slug` — Single post view
|
|
86
|
+
|
|
87
|
+
**API Engine:**
|
|
88
|
+
- `POST /posts` — Upsert a post by `external_id`
|
|
62
89
|
|
|
63
90
|
## JavaScript Setup
|
|
64
91
|
|
|
@@ -69,15 +96,11 @@ import {
|
|
|
69
96
|
HeliosPressBlocksController,
|
|
70
97
|
HeliosPressTextBlockController,
|
|
71
98
|
HeliosPressImageBlockController
|
|
72
|
-
} from "helios
|
|
99
|
+
} from "helios/press"
|
|
73
100
|
|
|
74
101
|
application.register("helios-press-blocks", HeliosPressBlocksController)
|
|
75
102
|
application.register("helios-press-text-block", HeliosPressTextBlockController)
|
|
76
103
|
application.register("helios-press-image-block", HeliosPressImageBlockController)
|
|
77
|
-
|
|
78
|
-
// If using helios-videos:
|
|
79
|
-
import { HeliosVideoBlockController } from "helios-videos"
|
|
80
|
-
application.register("helios-video-block", HeliosVideoBlockController)
|
|
81
104
|
```
|
|
82
105
|
|
|
83
106
|
**npm dependencies** (add to your host app's package.json):
|
|
@@ -86,13 +109,35 @@ application.register("helios-video-block", HeliosVideoBlockController)
|
|
|
86
109
|
- `@rails/activestorage`
|
|
87
110
|
- `trix` and `@rails/actiontext`
|
|
88
111
|
|
|
112
|
+
### Vite
|
|
113
|
+
|
|
114
|
+
If your host app uses Vite, add an alias so Vite can resolve the gem's JavaScript:
|
|
115
|
+
|
|
116
|
+
```typescript
|
|
117
|
+
// vite.config.mts
|
|
118
|
+
resolve: {
|
|
119
|
+
alias: {
|
|
120
|
+
'helios/press': resolve(__dirname, '/path/to/helios-press/app/javascript/helios/press'),
|
|
121
|
+
},
|
|
122
|
+
},
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
When using a local path gem, point to the local checkout. When using the published gem, point to the installed gem path (e.g., via `bundle show helios-press`).
|
|
126
|
+
|
|
89
127
|
## CSS
|
|
90
128
|
|
|
91
|
-
Include the block editor styles in your
|
|
129
|
+
Include the block editor styles in your stylesheet:
|
|
130
|
+
|
|
131
|
+
```scss
|
|
132
|
+
@import 'helios_press_blocks';
|
|
133
|
+
```
|
|
92
134
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
135
|
+
You can either symlink or copy the file from the gem:
|
|
136
|
+
|
|
137
|
+
```bash
|
|
138
|
+
# Symlink (local development)
|
|
139
|
+
ln -s /path/to/helios-press/app/assets/stylesheets/helios/press/blocks.css \
|
|
140
|
+
app/assets/stylesheets/_helios_press_blocks.scss
|
|
96
141
|
```
|
|
97
142
|
|
|
98
143
|
## Block Types
|
|
@@ -103,7 +148,7 @@ Include the block editor styles in your asset pipeline:
|
|
|
103
148
|
|
|
104
149
|
## API Ingestion
|
|
105
150
|
|
|
106
|
-
POST to
|
|
151
|
+
POST to your mounted API path with `X-API-Key` header:
|
|
107
152
|
|
|
108
153
|
```json
|
|
109
154
|
{
|
|
@@ -30,7 +30,7 @@ module Helios
|
|
|
30
30
|
|
|
31
31
|
# Handle video upload for video_container blocks (when helios-videos is present)
|
|
32
32
|
if @block.video_container? && params[:video_signed_id].present? && Helios::Press.videos_enabled?
|
|
33
|
-
video = Helios::Videos
|
|
33
|
+
video = Helios::Videos.video_class.new(name: params[:video_name], block: @block)
|
|
34
34
|
video.video_file.attach(params[:video_signed_id])
|
|
35
35
|
video.save!
|
|
36
36
|
end
|
|
@@ -23,7 +23,7 @@ module Helios
|
|
|
23
23
|
@post = Post.new(post_params)
|
|
24
24
|
|
|
25
25
|
if @post.save
|
|
26
|
-
redirect_to
|
|
26
|
+
redirect_to helios_press_admin.edit_post_path(@post), notice: "Post was successfully created."
|
|
27
27
|
else
|
|
28
28
|
render :new, status: :unprocessable_entity
|
|
29
29
|
end
|
|
@@ -42,7 +42,7 @@ module Helios
|
|
|
42
42
|
end
|
|
43
43
|
|
|
44
44
|
if @post.update(update_params)
|
|
45
|
-
redirect_to
|
|
45
|
+
redirect_to helios_press_admin.edit_post_path(@post), notice: success_message
|
|
46
46
|
else
|
|
47
47
|
render :edit, status: :unprocessable_entity
|
|
48
48
|
end
|
|
@@ -50,7 +50,7 @@ module Helios
|
|
|
50
50
|
|
|
51
51
|
def destroy
|
|
52
52
|
@post.destroy
|
|
53
|
-
redirect_to
|
|
53
|
+
redirect_to helios_press_admin.posts_path, notice: "Post was successfully deleted."
|
|
54
54
|
end
|
|
55
55
|
|
|
56
56
|
private
|
|
@@ -63,8 +63,8 @@ module Helios
|
|
|
63
63
|
params.require(:post).permit(:name, :published, :slug, :keywords, :description)
|
|
64
64
|
end
|
|
65
65
|
|
|
66
|
-
def
|
|
67
|
-
Helios::Press::Engine.routes.url_helpers
|
|
66
|
+
def helios_press_admin
|
|
67
|
+
Helios::Press::Admin::Engine.routes.url_helpers
|
|
68
68
|
end
|
|
69
69
|
end
|
|
70
70
|
end
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
module Helios
|
|
2
2
|
module Press
|
|
3
|
-
class PostsController < ::
|
|
3
|
+
class PostsController < Helios::Press.configuration.public_parent_controller.constantize
|
|
4
|
+
def index
|
|
5
|
+
@posts = Post.published.reverse_sorted
|
|
6
|
+
end
|
|
7
|
+
|
|
4
8
|
def show
|
|
5
9
|
@post = Post.published.find_by!(slug: params[:slug])
|
|
6
10
|
end
|
|
@@ -11,6 +11,24 @@ module Helios
|
|
|
11
11
|
validates :file, presence: true
|
|
12
12
|
|
|
13
13
|
acts_as_list scope: :block
|
|
14
|
+
|
|
15
|
+
DOCUMENT_CONTENT_TYPES = %w[
|
|
16
|
+
application/pdf
|
|
17
|
+
application/msword
|
|
18
|
+
application/vnd.openxmlformats-officedocument.wordprocessingml.document
|
|
19
|
+
].freeze
|
|
20
|
+
|
|
21
|
+
def svg?
|
|
22
|
+
file.attached? && file.content_type == "image/svg+xml"
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def document?
|
|
26
|
+
file.attached? && DOCUMENT_CONTENT_TYPES.include?(file.content_type)
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def variable?
|
|
30
|
+
file.attached? && file.variable?
|
|
31
|
+
end
|
|
14
32
|
end
|
|
15
33
|
end
|
|
16
34
|
end
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
<div data-controller="helios-press-image-block"
|
|
2
2
|
data-helios-press-image-block-id-value="<%= block.id %>"
|
|
3
3
|
data-helios-press-image-block-post-id-value="<%= post.id %>"
|
|
4
|
-
data-helios-press-image-block-base-url-value="<%=
|
|
5
|
-
data-helios-press-image-block-block-url-value="<%=
|
|
4
|
+
data-helios-press-image-block-base-url-value="<%= helios_press_admin.post_block_images_path(post, block) %>"
|
|
5
|
+
data-helios-press-image-block-block-url-value="<%= helios_press_admin.post_block_path(post, block) %>"
|
|
6
6
|
class="image-block-container">
|
|
7
7
|
|
|
8
8
|
<!-- Block Controls -->
|
|
@@ -2,10 +2,22 @@
|
|
|
2
2
|
data-helios-press-image-block-target="image"
|
|
3
3
|
data-image-id="<%= block_image.id %>">
|
|
4
4
|
|
|
5
|
-
<!-- Image -->
|
|
5
|
+
<!-- Image / Document -->
|
|
6
6
|
<div class="image-wrapper">
|
|
7
7
|
<% if block_image.file.attached? %>
|
|
8
|
-
|
|
8
|
+
<% if block_image.svg? %>
|
|
9
|
+
<%= image_tag url_for(block_image.file), class: "block-image" %>
|
|
10
|
+
<% elsif block_image.document? %>
|
|
11
|
+
<div class="document-preview d-flex flex-column align-items-center justify-content-center h-100">
|
|
12
|
+
<i class="bi <%= block_image.file.content_type.include?('pdf') ? 'bi-file-earmark-pdf' : 'bi-file-earmark-word' %>" style="font-size: 3rem; color: #6c757d;"></i>
|
|
13
|
+
<small class="text-muted mt-1"><%= block_image.file.filename %></small>
|
|
14
|
+
<%= link_to "Download", url_for(block_image.file), class: "btn btn-sm btn-outline-secondary mt-1", download: true %>
|
|
15
|
+
</div>
|
|
16
|
+
<% elsif block_image.variable? %>
|
|
17
|
+
<%= image_tag block_image.file.variant(resize_to_limit: [800, 800]), class: "block-image" %>
|
|
18
|
+
<% else %>
|
|
19
|
+
<%= image_tag url_for(block_image.file), class: "block-image" %>
|
|
20
|
+
<% end %>
|
|
9
21
|
<% end %>
|
|
10
22
|
|
|
11
23
|
<!-- Delete button -->
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<div data-controller="helios-press-text-block"
|
|
2
2
|
data-helios-press-text-block-id-value="<%= block.id %>"
|
|
3
3
|
data-helios-press-text-block-post-id-value="<%= post.id %>"
|
|
4
|
-
data-helios-press-text-block-base-url-value="<%=
|
|
4
|
+
data-helios-press-text-block-base-url-value="<%= helios_press_admin.post_block_path(post, block) %>"
|
|
5
5
|
data-helios-press-text-block-mode-value="view">
|
|
6
6
|
|
|
7
7
|
<!-- View Mode -->
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
<!-- Edit Mode -->
|
|
19
19
|
<div data-helios-press-text-block-target="editMode" class="block-edit-mode d-none">
|
|
20
20
|
<%= form_with(model: block,
|
|
21
|
-
url:
|
|
21
|
+
url: helios_press_admin.post_block_path(post, block),
|
|
22
22
|
data: { helios_press_text_block_target: "form" }) do |f| %>
|
|
23
23
|
<%= f.rich_text_area :content,
|
|
24
24
|
data: { helios_press_text_block_target: "editor" },
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
<% if block.respond_to?(:video) && block.video.present? %>
|
|
2
2
|
<% video = block.video %>
|
|
3
|
+
<% video_ready = video.key.present? && video.playback_urls.present? %>
|
|
3
4
|
<div data-controller="helios-video-block"
|
|
4
5
|
data-helios-video-block-video-id-value="<%= video.id %>"
|
|
6
|
+
data-helios-video-block-ready-value="<%= video_ready %>"
|
|
7
|
+
data-helios-video-block-status-url-value="<%= helios_videos.admin_video_path(video) %>"
|
|
5
8
|
class="video-block-container">
|
|
6
9
|
<!-- Block Controls -->
|
|
7
10
|
<div class="d-flex justify-content-end mb-2">
|
|
@@ -32,12 +35,17 @@
|
|
|
32
35
|
</div>
|
|
33
36
|
|
|
34
37
|
<!-- Video Player -->
|
|
35
|
-
<div class="video-player-wrapper">
|
|
38
|
+
<div class="video-player-wrapper" data-helios-video-block-target="player">
|
|
36
39
|
<%= video.player_component.html_safe %>
|
|
37
40
|
</div>
|
|
38
41
|
</div>
|
|
39
42
|
<% else %>
|
|
40
|
-
<div class="alert alert-warning mb-0">
|
|
41
|
-
No video found for this block
|
|
43
|
+
<div class="alert alert-warning mb-0 d-flex justify-content-between align-items-center">
|
|
44
|
+
<span>No video found for this block.</span>
|
|
45
|
+
<button type="button"
|
|
46
|
+
class="btn btn-sm btn-danger"
|
|
47
|
+
data-action="click->helios-press-blocks#deleteBlock">
|
|
48
|
+
Delete Block
|
|
49
|
+
</button>
|
|
42
50
|
</div>
|
|
43
51
|
<% end %>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<%= form_with(model: post, url: post.persisted? ?
|
|
1
|
+
<%= form_with(model: post, url: post.persisted? ? helios_press_admin.post_path(post) : helios_press_admin.posts_path, local: true) do |form| %>
|
|
2
2
|
<% if post.errors.any? %>
|
|
3
3
|
<div class="alert alert-danger">
|
|
4
4
|
<h4><%= pluralize(post.errors.count, "error") %> prohibited this post from being saved:</h4>
|
|
@@ -43,6 +43,6 @@
|
|
|
43
43
|
<% if post.persisted? && !post.published? %>
|
|
44
44
|
<%= form.submit "Publish Now", name: "publish", class: "btn btn-success", data: { turbo_confirm: "Publish this post now?" } %>
|
|
45
45
|
<% end %>
|
|
46
|
-
<%= link_to "Cancel",
|
|
46
|
+
<%= link_to "Cancel", helios_press_admin.posts_path, class: "btn btn-secondary" %>
|
|
47
47
|
</div>
|
|
48
48
|
<% end %>
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
<h5 class="mb-0">Content Blocks</h5>
|
|
17
17
|
</div>
|
|
18
18
|
<div class="card-body">
|
|
19
|
-
<div data-controller="helios-press-blocks" data-helios-press-blocks-post-id-value="<%= @post.id %>" data-helios-press-blocks-base-url-value="<%=
|
|
19
|
+
<div data-controller="helios-press-blocks" data-helios-press-blocks-post-id-value="<%= @post.id %>" data-helios-press-blocks-base-url-value="<%= helios_press_admin.post_blocks_path(@post) %>">
|
|
20
20
|
<%= render "blocks_container", post: @post %>
|
|
21
21
|
</div>
|
|
22
22
|
</div>
|
|
@@ -1,30 +1,41 @@
|
|
|
1
1
|
<div class="container py-5">
|
|
2
2
|
<div class="d-flex justify-content-between align-items-center mb-4">
|
|
3
3
|
<h1>Posts</h1>
|
|
4
|
-
<%= link_to "New Post",
|
|
4
|
+
<%= link_to "New Post", helios_press_admin.new_post_path, class: "btn btn-primary" %>
|
|
5
5
|
</div>
|
|
6
6
|
|
|
7
7
|
<% if @posts.any? %>
|
|
8
|
-
<
|
|
9
|
-
|
|
10
|
-
<
|
|
11
|
-
<
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
<
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
8
|
+
<table class="table">
|
|
9
|
+
<thead>
|
|
10
|
+
<tr>
|
|
11
|
+
<th>Title</th>
|
|
12
|
+
<th>Slug</th>
|
|
13
|
+
<th>Status</th>
|
|
14
|
+
<th>Last Updated</th>
|
|
15
|
+
<th>Actions</th>
|
|
16
|
+
</tr>
|
|
17
|
+
</thead>
|
|
18
|
+
<tbody>
|
|
19
|
+
<% @posts.each do |post| %>
|
|
20
|
+
<tr>
|
|
21
|
+
<td><%= link_to post.name, helios_press_admin.edit_post_path(post) %></td>
|
|
22
|
+
<td><small class="text-muted">/<%= post.slug %></small></td>
|
|
23
|
+
<td>
|
|
24
|
+
<% if post.published? %>
|
|
25
|
+
<span class="badge bg-success">Published</span>
|
|
26
|
+
<% else %>
|
|
27
|
+
<span class="badge bg-secondary">Draft</span>
|
|
28
|
+
<% end %>
|
|
29
|
+
</td>
|
|
30
|
+
<td><%= post.updated_at.strftime("%m/%d/%y") %></td>
|
|
31
|
+
<td>
|
|
32
|
+
<%= link_to "Edit", helios_press_admin.edit_post_path(post), class: "btn btn-sm btn-outline-primary" %>
|
|
33
|
+
<%= link_to "Delete", helios_press_admin.post_path(post), data: { turbo_method: :delete, turbo_confirm: "Are you sure?" }, class: "btn btn-sm btn-outline-danger" %>
|
|
34
|
+
</td>
|
|
35
|
+
</tr>
|
|
36
|
+
<% end %>
|
|
37
|
+
</tbody>
|
|
38
|
+
</table>
|
|
28
39
|
<% else %>
|
|
29
40
|
<p class="text-muted">No posts yet. Create your first post!</p>
|
|
30
41
|
<% end %>
|
|
@@ -3,9 +3,26 @@
|
|
|
3
3
|
<% block.block_images.each do |block_image| %>
|
|
4
4
|
<div class="image-item">
|
|
5
5
|
<% if block_image.file.attached? %>
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
<% if block_image.svg? %>
|
|
7
|
+
<%= image_tag url_for(block_image.file),
|
|
8
|
+
class: "img-fluid rounded",
|
|
9
|
+
alt: block_image.caption.presence || "" %>
|
|
10
|
+
<% elsif block_image.document? %>
|
|
11
|
+
<div class="document-download text-center p-3">
|
|
12
|
+
<i class="bi <%= block_image.file.content_type.include?('pdf') ? 'bi-file-earmark-pdf' : 'bi-file-earmark-word' %>" style="font-size: 3rem;"></i>
|
|
13
|
+
<p class="mt-2 mb-0">
|
|
14
|
+
<%= link_to block_image.file.filename, url_for(block_image.file), download: true %>
|
|
15
|
+
</p>
|
|
16
|
+
</div>
|
|
17
|
+
<% elsif block_image.variable? %>
|
|
18
|
+
<%= image_tag block_image.file.variant(resize_to_limit: [1200, 1200]),
|
|
19
|
+
class: "img-fluid rounded",
|
|
20
|
+
alt: block_image.caption.presence || "" %>
|
|
21
|
+
<% else %>
|
|
22
|
+
<%= image_tag url_for(block_image.file),
|
|
23
|
+
class: "img-fluid rounded",
|
|
24
|
+
alt: block_image.caption.presence || "" %>
|
|
25
|
+
<% end %>
|
|
9
26
|
<% end %>
|
|
10
27
|
<% if block_image.caption.present? %>
|
|
11
28
|
<p class="image-caption text-muted mt-2 small">
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
<div class="container my-5">
|
|
2
|
+
<h1>Blog</h1>
|
|
3
|
+
|
|
4
|
+
<% if @posts.any? %>
|
|
5
|
+
<% @posts.each do |post| %>
|
|
6
|
+
<article class="mb-4">
|
|
7
|
+
<h2><%= link_to post.name, helios_press_public.post_path(post.slug) %></h2>
|
|
8
|
+
<p class="text-muted">
|
|
9
|
+
<time datetime="<%= post.updated_at.iso8601 %>">
|
|
10
|
+
<%= post.updated_at.strftime("%m/%d/%y") %>
|
|
11
|
+
</time>
|
|
12
|
+
</p>
|
|
13
|
+
<% if post.description.present? %>
|
|
14
|
+
<p><%= post.description %></p>
|
|
15
|
+
<% end %>
|
|
16
|
+
</article>
|
|
17
|
+
<% end %>
|
|
18
|
+
<% else %>
|
|
19
|
+
<p>No posts yet.</p>
|
|
20
|
+
<% end %>
|
|
21
|
+
</div>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
Helios::Press::Admin::Engine.routes.draw do
|
|
2
|
+
scope module: "helios/press/admin" do
|
|
3
|
+
root to: "posts#index"
|
|
4
|
+
resources :posts do
|
|
5
|
+
resources :blocks, only: [:create, :update, :destroy] do
|
|
6
|
+
collection do
|
|
7
|
+
patch :reorder
|
|
8
|
+
end
|
|
9
|
+
resources :images, controller: "block_images", only: [:create, :update, :destroy] do
|
|
10
|
+
collection do
|
|
11
|
+
patch :reorder
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
data/config/routes.rb
CHANGED
|
@@ -1,21 +1,2 @@
|
|
|
1
1
|
Helios::Press::Engine.routes.draw do
|
|
2
|
-
namespace :admin do
|
|
3
|
-
root to: "posts#index"
|
|
4
|
-
resources :posts do
|
|
5
|
-
resources :blocks, only: [:create, :update, :destroy] do
|
|
6
|
-
collection do
|
|
7
|
-
patch :reorder
|
|
8
|
-
end
|
|
9
|
-
resources :images, controller: "block_images", only: [:create, :update, :destroy] do
|
|
10
|
-
collection do
|
|
11
|
-
patch :reorder
|
|
12
|
-
end
|
|
13
|
-
end
|
|
14
|
-
end
|
|
15
|
-
end
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
namespace :api do
|
|
19
|
-
resources :posts, only: [:create]
|
|
20
|
-
end
|
|
21
2
|
end
|
|
@@ -2,12 +2,14 @@ module Helios
|
|
|
2
2
|
module Press
|
|
3
3
|
class Configuration
|
|
4
4
|
attr_accessor :admin_parent_controller,
|
|
5
|
+
:public_parent_controller,
|
|
5
6
|
:api_parent_controller,
|
|
6
7
|
:api_authentication,
|
|
7
8
|
:post_slug_prefix
|
|
8
9
|
|
|
9
10
|
def initialize
|
|
10
11
|
@admin_parent_controller = "ApplicationController"
|
|
12
|
+
@public_parent_controller = "ApplicationController"
|
|
11
13
|
@api_parent_controller = "ActionController::API"
|
|
12
14
|
@api_authentication = nil
|
|
13
15
|
@post_slug_prefix = nil
|
data/lib/helios/press/engine.rb
CHANGED
|
@@ -6,6 +6,48 @@ module Helios
|
|
|
6
6
|
initializer "helios_press.assets" do |app|
|
|
7
7
|
app.config.assets.precompile += %w[helios/press/blocks.css] if app.config.respond_to?(:assets)
|
|
8
8
|
end
|
|
9
|
+
|
|
10
|
+
initializer "helios_press.helpers" do
|
|
11
|
+
ActiveSupport.on_load(:action_controller) do
|
|
12
|
+
helper Rails.application.routes.url_helpers
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
module Admin
|
|
18
|
+
class Engine < ::Rails::Engine
|
|
19
|
+
engine_name "helios_press_admin"
|
|
20
|
+
|
|
21
|
+
self.paths["config/routes.rb"] = "config/routes/admin.rb"
|
|
22
|
+
|
|
23
|
+
initializer "helios_press_admin.helpers" do
|
|
24
|
+
ActiveSupport.on_load(:action_controller) do
|
|
25
|
+
helper Rails.application.routes.url_helpers
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
module Public
|
|
32
|
+
class Engine < ::Rails::Engine
|
|
33
|
+
engine_name "helios_press_public"
|
|
34
|
+
|
|
35
|
+
self.paths["config/routes.rb"] = "config/routes/public.rb"
|
|
36
|
+
|
|
37
|
+
initializer "helios_press_public.helpers" do
|
|
38
|
+
ActiveSupport.on_load(:action_controller) do
|
|
39
|
+
helper Rails.application.routes.url_helpers
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
module Api
|
|
46
|
+
class Engine < ::Rails::Engine
|
|
47
|
+
engine_name "helios_press_api"
|
|
48
|
+
|
|
49
|
+
self.paths["config/routes.rb"] = "config/routes/api.rb"
|
|
50
|
+
end
|
|
9
51
|
end
|
|
10
52
|
end
|
|
11
53
|
end
|
data/lib/helios/press/version.rb
CHANGED
data/lib/helios/press.rb
CHANGED
data/lib/helios-press.rb
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
require "helios/press"
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: helios-press
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: '0.2'
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Jason Fleetwood-Boldt
|
|
@@ -110,13 +110,18 @@ files:
|
|
|
110
110
|
- app/views/helios/press/posts/blocks/_image_container.html.erb
|
|
111
111
|
- app/views/helios/press/posts/blocks/_text.html.erb
|
|
112
112
|
- app/views/helios/press/posts/blocks/_video_container.html.erb
|
|
113
|
+
- app/views/helios/press/posts/index.html.erb
|
|
113
114
|
- app/views/helios/press/posts/show.html.erb
|
|
114
115
|
- app/views/layouts/helios/press/admin.html.erb
|
|
115
116
|
- app/views/layouts/helios/press/application.html.erb
|
|
116
117
|
- config/routes.rb
|
|
118
|
+
- config/routes/admin.rb
|
|
119
|
+
- config/routes/api.rb
|
|
120
|
+
- config/routes/public.rb
|
|
117
121
|
- db/migrate/20250510000001_create_helios_press_posts.rb
|
|
118
122
|
- db/migrate/20250510000002_create_helios_press_blocks.rb
|
|
119
123
|
- db/migrate/20250510000003_create_helios_press_block_images.rb
|
|
124
|
+
- lib/helios-press.rb
|
|
120
125
|
- lib/helios/press.rb
|
|
121
126
|
- lib/helios/press/configuration.rb
|
|
122
127
|
- lib/helios/press/engine.rb
|