Skip to content

Commit 89e5964

Browse files
authored
Merge pull request #560 from better-together-org/fix/trix-uploads
Fix/trix attachment uploads
2 parents f55b7b6 + 8ec6476 commit 89e5964

File tree

6 files changed

+37
-5
lines changed

6 files changed

+37
-5
lines changed

Gemfile.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ GIT
1111
PATH
1212
remote: .
1313
specs:
14-
better_together (0.4.0)
14+
better_together (0.4.1)
1515
activerecord-import
1616
activerecord-postgis-adapter
1717
bootstrap (~> 5.3.2)

app/controllers/better_together/application_controller.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
module BetterTogether
44
# Base application controller for engine
55
class ApplicationController < ActionController::Base
6+
include ActiveStorage::SetCurrent
67
include Pundit::Authorization
78

89
protect_from_forgery with: :exception
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// app/javascripts/better_together/controllers/trix_controller.js
2+
3+
import { Controller } from "@hotwired/stimulus";
4+
5+
export default class TrixController extends Controller {
6+
7+
connect() {
8+
9+
// wait for the trix editor is attached to the DOM to do stuff
10+
addEventListener("trix-initialize", function (event) {
11+
console.log("im inititalized!");
12+
// ...
13+
// add underline code
14+
// remove buttons code
15+
// add custom icons code here
16+
// ...
17+
}, true);
18+
}
19+
}

app/views/better_together/pages/_form.html.erb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,11 @@
3939

4040
<div class="row mb-3">
4141
<%= form.label :content %>
42-
<%= form.rich_text_area :content, class: "form-control#{' is-invalid' if page.errors[:content].any?}" %>
42+
<%=
43+
form.rich_text_area :content,
44+
class: "form-control#{' is-invalid' if page.errors[:content].any?}",
45+
data: { controller: 'trix' }
46+
%>
4347
<% if page.errors[:content].any? %>
4448
<div class="invalid-feedback">
4549
<%= page.errors[:content].join(", ") %>

lib/better_together/engine.rb

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,19 @@ class Engine < ::Rails::Engine
4040
require_dependency 'rack/cors'
4141
end
4242

43-
config.action_mailer.default_url_options = {
43+
default_url_options = {
4444
host: ENV.fetch('APP_HOST', 'localhost:3000'),
45-
locale: I18n.locale
45+
protocol: ENV.fetch('APP_PROTOCOL', 'http'),
46+
locale: ENV.fetch('APP_LOCALE', I18n.locale)
4647
}
4748

49+
routes.default_url_options =
50+
config.action_mailer.default_url_options =
51+
config.default_url_options =
52+
default_url_options
53+
54+
config.time_zone = ENV.fetch('APP_TIME_ZONE', 'Newfoundland')
55+
4856
initializer 'better_together.importmap', before: 'importmap' do |app|
4957
app.config.importmap.paths << Engine.root.join('config/importmap.rb')
5058

lib/better_together/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# frozen_string_literal: true
22

33
module BetterTogether
4-
VERSION = '0.4.0'
4+
VERSION = '0.4.1'
55
end

0 commit comments

Comments
 (0)