effective_messaging 0.7.4 → 0.8.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 78e95fc092d81efe4f4ff0db0c4d571ec86b7938400dcc7f378963f9e288aeb4
4
- data.tar.gz: b206a600a6fc26b75fdba1a26c86754e1ceb66d4be50f0d80b07aa158afec313
3
+ metadata.gz: 6d5586319e69df10977387b8dde4f21c28b6c091ba2d013c0aa92356c5d64612
4
+ data.tar.gz: 30780a50e3482bf8f66492f9b965f3dba832c2ccfd237753517214536484bc6c
5
5
  SHA512:
6
- metadata.gz: 85de886b3e80411543f91188ebaa4de3f750a020f61513e81c82f8ef26e5ea8a792cbabd512ef821e13f34374fd30639a1e97d11f1ec00583d952339e8a336b3
7
- data.tar.gz: 37f925c590a863999c61bd24008d96423d73a0aa9e2b10d3a914329e07c84589ece96b3aaba013557886d308895fbe544926c9941b951106018384de0197f17c
6
+ metadata.gz: 984b176a01cb8fb1e6935975f20fba184e0c4af16783faef38c6372dc76b85a9735b0b8d87723564026a22add1426c1a78b2c0d14c25f906d4b76470119a612e
7
+ data.tar.gz: 159df93437962685676e463ad350f91326de8d87efd440027b1da1e8f1b6061552a8d1bf307cdc8ba9fedc9faaf87574754421a2d3794a63410f7caf5518a27d
@@ -18,7 +18,7 @@ class EffectiveChatsDatatable < Effective::Datatable
18
18
  chats = Effective::Chat.deep.where(id: current_user.chats)
19
19
 
20
20
  if attributes[:year].present?
21
- chats = chats.where('created_at >= ?', Time.zone.local(attributes[:year]))
21
+ chats = chats.where(created_at: Time.zone.local(attributes[:year]).all_year)
22
22
  end
23
23
 
24
24
  chats
@@ -35,7 +35,13 @@ module Effective
35
35
  validates :body, presence: true
36
36
 
37
37
  def to_s
38
- body.presence || 'New Chat Message'
38
+ truncate(body.presence || 'New Chat Message')
39
+ end
40
+
41
+ private
42
+
43
+ def truncate(value)
44
+ value.length > 100 ? (value.first(100) + '...') : value
39
45
  end
40
46
 
41
47
  end
@@ -0,0 +1,9 @@
1
+ = effective_form_with(model: [:admin, chat_message], engine: true) do |f|
2
+ - unless inline_datatable?
3
+ = f.static_field :chat, label: et(f.object.chat)
4
+
5
+ = f.static_field :name, label: 'From'
6
+ = f.text_area :body
7
+
8
+ = f.submit 'Save'
9
+
@@ -3,6 +3,9 @@
3
3
  = render 'admin/chats/form_chat', chat: chat
4
4
 
5
5
  - if chat.persisted?
6
+ = tab(chat.chat_messages) do
7
+ = render_inline_datatable(Admin::EffectiveChatMessagesDatatable.new(chat: chat))
8
+
6
9
  - if chat.respond_to?(:logs_datatable)
7
10
  = tab "Logs" do
8
11
  = render_inline_datatable(chat.logs_datatable)
@@ -1,6 +1,6 @@
1
1
  %h2= t('effective_messaging.dashboard')
2
2
 
3
- - datatable = EffectiveResources.best('EffectiveChatsDatatable').new(self, namespace: :effective)
3
+ - datatable = EffectiveResources.best('EffectiveChatsDatatable').new(self, namespace: :effective, year: local_assigns[:year])
4
4
 
5
5
  - if datatable.present?
6
6
  %p You are a #{etd(Effective::ChatUser)} of #{pluralize(datatable.collection.length, etd(Effective::Chat))}.
data/config/routes.rb CHANGED
@@ -12,7 +12,7 @@ EffectiveMessaging::Engine.routes.draw do
12
12
 
13
13
  namespace :admin do
14
14
  resources :chats
15
- resources :chat_messages, only: [:index, :show, :destroy]
15
+ resources :chat_messages, except: [:new, :create]
16
16
 
17
17
  resources :notifications do
18
18
  post :enable, on: :member
@@ -1,3 +1,3 @@
1
1
  module EffectiveMessaging
2
- VERSION = '0.7.4'.freeze
2
+ VERSION = '0.8.0'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: effective_messaging
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.4
4
+ version: 0.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Code and Effect
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-03-20 00:00:00.000000000 Z
11
+ date: 2024-05-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -229,6 +229,7 @@ files:
229
229
  - app/models/effective/notification.rb
230
230
  - app/models/effective/notification_log.rb
231
231
  - app/views/admin/chat_messages/_chat_message.html.haml
232
+ - app/views/admin/chat_messages/_form.html.haml
232
233
  - app/views/admin/chats/_chat.html.haml
233
234
  - app/views/admin/chats/_form.html.haml
234
235
  - app/views/admin/chats/_form_chat.html.haml