five-two-nw-olivander 0.2.0.48 → 0.2.0.50
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/app/assets/javascripts/controllers/datatable_index_charts_controller.js +5 -2
- data/app/channels/presence_channel.rb +38 -0
- data/app/components/olivander/components/tabs_component.html.haml +33 -0
- data/app/components/olivander/components/tabs_component.rb +38 -0
- data/app/datatables/olivander/datatable.rb +2 -0
- data/app/views/application/index.html.haml +4 -1
- data/lib/olivander/version.rb +1 -1
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fdf7c68c926c6c55749c67baa2a31d09a1a9b6599dc01213a3bbc182ec2d5400
|
4
|
+
data.tar.gz: 0dc80273f37685bdf97b9ac00ba9ab99e1b9a6959edc5d2bcd367656072624e2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f3595baa37801f0cb3f87f09c8053b5cfe83434758e5d44ab5c9c1396d7ff1a836e747eb118b74c300c8fd8d37a7404b63276787f1e38d07c0c9a28366fef472
|
7
|
+
data.tar.gz: 707ce0907e54b4137021e78edec417cd7ff3d2155ed1ba4798fd2519d3712c64d9a6c7a25fab99a8b7fbcfbd4fc00333a0b36db14c26bcebaaea636f87f4eb98
|
@@ -20,8 +20,11 @@ export default class extends Controller {
|
|
20
20
|
transformData(chart) {
|
21
21
|
var self = this
|
22
22
|
if (chart.as == 'LineChart') {
|
23
|
-
|
24
|
-
|
23
|
+
var transformed = chart.data.map(([name, obj]) => ({
|
24
|
+
name,
|
25
|
+
data: Object.entries(obj || {})
|
26
|
+
}));
|
27
|
+
return transformed
|
25
28
|
} else {
|
26
29
|
return chart.data
|
27
30
|
}
|
@@ -0,0 +1,38 @@
|
|
1
|
+
class PresenceChannel < ApplicationCable::Channel
|
2
|
+
def subscribed
|
3
|
+
chs = 'presence_channel'
|
4
|
+
stream_from chs
|
5
|
+
ActionCable.server.broadcast(chs, { message: 'Welcome to Olivander!!!' })
|
6
|
+
|
7
|
+
Rails.logger.debug 'subscribed'
|
8
|
+
channel_user.mark_online! if channel_user.present? && channel_user.respond_to?('mark_online!')
|
9
|
+
Rails.logger.debug 'marked online'
|
10
|
+
broadcast_presence
|
11
|
+
end
|
12
|
+
|
13
|
+
def unsubscribed
|
14
|
+
Rails.logger.debug 'unsubscribed'
|
15
|
+
channel_user.mark_offline! if channel_user.present? && channel_user.respond_to?('mark_offline!')
|
16
|
+
Rails.logger.debug 'marked offline'
|
17
|
+
broadcast_presence
|
18
|
+
end
|
19
|
+
|
20
|
+
def speak(data)
|
21
|
+
ActionCable.server.broadcast('presence_channel', data)
|
22
|
+
broadcast_presence
|
23
|
+
end
|
24
|
+
|
25
|
+
private
|
26
|
+
|
27
|
+
def broadcast_presence
|
28
|
+
return unless channel_user.present?
|
29
|
+
|
30
|
+
ActionCable.server.broadcast('presence_channel',
|
31
|
+
{ online_users: channel_user.class.online_users.map do |u|
|
32
|
+
{
|
33
|
+
id: u.id,
|
34
|
+
email: u.email
|
35
|
+
}
|
36
|
+
end })
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
- content_for tab_strip_id do
|
2
|
+
%ul.nav.nav-tabs{id: id, role: "tablist"}
|
3
|
+
- tabs.each_with_index do |tab, index|
|
4
|
+
%li.nav-item
|
5
|
+
%a.nav-link{
|
6
|
+
id: "#{tab.id}-tab",
|
7
|
+
href: "##{tab.id}",
|
8
|
+
"data-toggle": "tab",
|
9
|
+
role: "tab",
|
10
|
+
"aria-controls": tab.id,
|
11
|
+
"aria-selected": tab.active,
|
12
|
+
class: ("nav-link active" if tab.active)
|
13
|
+
}
|
14
|
+
= tab.title
|
15
|
+
- content_for tab_content_id do
|
16
|
+
.tab-content.mt-2{id: "#{id}-content"}
|
17
|
+
- tabs.each do |tab|
|
18
|
+
.tab-pane.fade{
|
19
|
+
id: tab.id,
|
20
|
+
role: "tabpanel",
|
21
|
+
"aria-labelledby": "#{tab.id}-tab",
|
22
|
+
class: ("tab-pane fade show active" if tab.active)
|
23
|
+
}
|
24
|
+
= tab
|
25
|
+
- if card
|
26
|
+
.card.card-tabs{ class: card_class }
|
27
|
+
.card-header.p-0.pt-1
|
28
|
+
= content_for tab_strip_id
|
29
|
+
.card-body
|
30
|
+
= content_for tab_content_id
|
31
|
+
- else
|
32
|
+
= content_for tab_strip_id
|
33
|
+
= content_for tab_content_id
|
@@ -0,0 +1,38 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# app/components/tab_component.rb
|
4
|
+
module Olivander
|
5
|
+
module Components
|
6
|
+
# component to render tabs
|
7
|
+
class TabsComponent < ViewComponent::Base
|
8
|
+
renders_many :tabs, '::Olivander::Components::TabsComponent::Tab'
|
9
|
+
|
10
|
+
attr_reader :id, :card, :card_class, :tab_strip_id, :tab_content_id
|
11
|
+
|
12
|
+
def initialize(*args)
|
13
|
+
super
|
14
|
+
options = args.extract_options!
|
15
|
+
@id = options[:id] || "tabs-#{SecureRandom.hex(4)}"
|
16
|
+
@card = options.key?(:card) ? !!options[:card] : true
|
17
|
+
@card_class = options.key?(:card_class) ? options[:card_class] : 'card-primary'
|
18
|
+
@tab_strip_id = "tab-strip-#{SecureRandom.hex(4)}"
|
19
|
+
@tab_content_id = "tab-strip-#{SecureRandom.hex(4)}"
|
20
|
+
end
|
21
|
+
|
22
|
+
class Tab < ViewComponent::Base
|
23
|
+
attr_reader :title, :id, :active
|
24
|
+
|
25
|
+
def initialize(title:, id: "tab-#{SecureRandom.hex(6)}", active: false)
|
26
|
+
super
|
27
|
+
@title = title
|
28
|
+
@id = id
|
29
|
+
@active = active
|
30
|
+
end
|
31
|
+
|
32
|
+
def call
|
33
|
+
content
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -41,6 +41,8 @@ module Olivander
|
|
41
41
|
dc = collection.nil? ? klazz.all : collection
|
42
42
|
|
43
43
|
attributes.each do |att|
|
44
|
+
next if att[0].to_s == 'deleted_at' && klazz.respond_to?(:paranoid?) && klazz.paranoid?
|
45
|
+
|
44
46
|
dc = dc.where("#{att[0]} = ?", att[1]) if klazz_attributes.include?(att[0].to_s)
|
45
47
|
end
|
46
48
|
|
@@ -23,7 +23,10 @@
|
|
23
23
|
%button.btn.btn-tool{ type: :button, 'data-card-widget': :maximize }
|
24
24
|
%i.fas.fa-expand
|
25
25
|
.card-body{ style: 'height: 220px' }
|
26
|
-
|
26
|
+
- if chart[:as] == 'LineChart'
|
27
|
+
= send(chart[:as].underscore, @datatable.to_json[:charts][k][:data].map{ |x| {name: x[0], data: x[1]}}, id: chart[:name], height: '90%')
|
28
|
+
- else
|
29
|
+
= send(chart[:as].underscore, @datatable.to_json[:charts][k][:data], id: chart[:name], height: '90%', adapter: 'google')
|
27
30
|
|
28
31
|
= content_for :datatable_charts
|
29
32
|
|
data/lib/olivander/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: five-two-nw-olivander
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.0.
|
4
|
+
version: 0.2.0.50
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eric Dennis
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-
|
11
|
+
date: 2025-09-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: chartkick
|
@@ -253,6 +253,7 @@ files:
|
|
253
253
|
- app/assets/stylesheets/adminlte.css
|
254
254
|
- app/assets/stylesheets/fa-fix.scss
|
255
255
|
- app/assets/stylesheets/olivander/application.css
|
256
|
+
- app/channels/presence_channel.rb
|
256
257
|
- app/components/olivander/components/menu_item_component.html.haml
|
257
258
|
- app/components/olivander/components/menu_item_component.rb
|
258
259
|
- app/components/olivander/components/portlet_component.html.haml
|
@@ -268,6 +269,8 @@ files:
|
|
268
269
|
- app/components/olivander/components/table_portlet_component.html.haml
|
269
270
|
- app/components/olivander/components/table_portlet_component.rb
|
270
271
|
- app/components/olivander/components/table_portlet_component/table_component.html.haml
|
272
|
+
- app/components/olivander/components/tabs_component.html.haml
|
273
|
+
- app/components/olivander/components/tabs_component.rb
|
271
274
|
- app/controllers/concerns/olivander/resources/application_record.rb
|
272
275
|
- app/controllers/concerns/olivander/resources/auto_form_attributes.rb
|
273
276
|
- app/controllers/concerns/olivander/resources/crud_controller.rb
|