Skip to content

Commit

Permalink
[Bug Fix] "tooltip is not a function" in analytics V2 (#1611)
Browse files Browse the repository at this point in the history
  • Loading branch information
donrestarone authored Sep 26, 2023
1 parent 21184ab commit c5299c1
Show file tree
Hide file tree
Showing 10 changed files with 84 additions and 12 deletions.
2 changes: 0 additions & 2 deletions app/javascript/controllers/dashboard_controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ import 'daterangepicker';

export default class extends Controller {
initialize() {
$('[data-toggle="tooltip"]').tooltip();

$('#reportrange').daterangepicker({
opens: 'left',
locale: {
Expand Down
7 changes: 4 additions & 3 deletions app/javascript/packs/comfy/admin/cms.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import Sortable from 'sortablejs';
import jQuery from 'jquery';
import "controllers"
import "controllers";
import "chartkick/chart.js";

global.$ = global.jQuery = jQuery;

Expand Down Expand Up @@ -71,7 +72,7 @@ function resetIndex(containerId) {
});
}



require("../../trix")
require("../../select2")
require("../../common")
require("../../turbo")
4 changes: 3 additions & 1 deletion app/javascript/subscriptions/room_subscription.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import { cable } from '@hotwired/turbo-rails'
// importing 'cable' in typical way from @hotwired/turbo-rails attempts to register "turbo-frame" element multiple times. Due to this, imported cable in a peculiar way.
// This is fixed in newer version but breaks the API's "search by properties" functionality.
import * as cable from '@hotwired/turbo-rails/app/javascript/turbo/cable'

export default class RoomSubscription {
constructor ({ delegate, id, clientId }) {
Expand Down
4 changes: 3 additions & 1 deletion app/javascript/subscriptions/signaling_subscription.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import { cable } from '@hotwired/turbo-rails'
// importing 'cable' in typical way from @hotwired/turbo-rails attempts to register "turbo-frame" element multiple times. Due to this, imported cable in a peculiar way.
// This is fixed in newer version but breaks the API's "search by properties" functionality.
import * as cable from '@hotwired/turbo-rails/app/javascript/turbo/cable'

export default class SignalingSubscription {
constructor({ delegate, id, clientId }) {
Expand Down
4 changes: 4 additions & 0 deletions app/views/comfy/admin/blog/partials/_navigation.html.haml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
- if @site && @site.persisted?
%li{class: 'nav-item', data: { turbo: 'false' }}
= active_link_to comfy_admin_blog_posts_path(@site), class: "nav-link" do
= t('comfy.admin.cms.base.posts')
5 changes: 5 additions & 0 deletions app/views/comfy/admin/v2/dashboard/dashboard.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -246,3 +246,8 @@

%hr.m-0
= render partial: 'events', locals: (@legacy_and_system_events.present? ? @legacy_and_system_events : { events_exists: false }).merge({ event_category: 'system_events' })

:javascript
$(document).ready(function() {
$('[data-toggle="tooltip"]').tooltip();
})
5 changes: 0 additions & 5 deletions app/views/layouts/comfy/admin/cms.html.haml
Original file line number Diff line number Diff line change
@@ -1,14 +1,9 @@
!!!
%html{lang: I18n.locale}
= stylesheet_link_tag 'application', media: 'all', 'data-turbo-track': 'reload'
= javascript_pack_tag 'trix'
= javascript_pack_tag 'select2'
= javascript_pack_tag 'comfy/admin/cms'
%link{:crossorigin => "anonymous", :href => "https://cdnjs.cloudflare.com/ajax/libs/jsoneditor/9.0.0/jsoneditor.css", :integrity => "sha512-Mfp9P5Ln+lF/PmixCJBHUNHXoBKJwKY2i7oZ29iu/mnN47puo0TH/ORb3vgrdkyuBkLaDytv80480FNZxllpyQ==", :referrerpolicy => "no-referrer", :rel => "stylesheet"}/
%script{:crossorigin => "anonymous", :integrity => "sha512-xEv8uIENS4DGY7Ml/Cv6+sbcPXiRAguIgU8Sv0FCUUdrNC7aRhWbOglm7lnzhnA3spqCr8DnTMTMNFW4jhM8gA==", :referrerpolicy => "no-referrer", :src => "https://cdnjs.cloudflare.com/ajax/libs/jsoneditor/9.0.0/jsoneditor.js"}
-# this is a hack until I figure out how to get chartkick working without importing the whole application js pack
- if controller_name == 'dashboard'
= javascript_pack_tag 'application', 'data-turbo-track': 'reload'


= render 'layouts/comfy/admin/cms/head'
Expand Down
4 changes: 4 additions & 0 deletions app/views/layouts/comfy/admin/cms/_footer_js.html.haml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
= comfy_admin_partial "comfy/admin/cms/partials/html_footer"

- if content_for(:javascript)
= yield :javascript
22 changes: 22 additions & 0 deletions app/views/layouts/comfy/admin/cms/_head.html.haml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
%head
%title= ComfortableMexicanSofa.config.cms_title

%meta{"http-equiv" => "Content-type", content: "text/html; charset=utf-8"}
%meta{charset: "utf-8"}
%meta{name: "viewport", content: "width=device-width, initial-scale=1, shrink-to-fit=no"}
= csrf_meta_tag
- if @site && @site.persisted?
%meta{name: "cms-file-upload-path", content: comfy_admin_cms_site_files_path(@site)}
%meta{name: "cms-pages-path", content: comfy_admin_cms_site_pages_path(@site)}
%meta{name: "cms-locale", content: I18n.locale}
= stylesheet_link_tag "comfy/admin/cms/application", media: "all", "data-turbolinks-track": "reload"
-# moved from _footer_js.html.haml since the pack file was being loaded multiple times when included inside body tag
= javascript_include_tag "comfy/admin/cms/application", "data-turbo-track": "reload"
= yield :head
= comfy_admin_partial "comfy/admin/cms/partials/html_head"
39 changes: 39 additions & 0 deletions app/views/layouts/comfy/admin/cms/_left.html.haml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
= comfy_admin_partial "comfy/admin/cms/partials/navigation_before"

%nav.navbar.navbar-expand-lg
%button.navbar-toggler{type: "button", data: {toggle:"collapse", target: "#leftnav"}, aria: {controls: "navbarSupportedContent", expanded: "false", label: "Toggle navigation"}}
%i.fas.fa-bars

#leftnav.navbar-collapse.collapse

%ul.nav.nav-pills
%li.nav-item
= active_link_to comfy_admin_cms_sites_path, class: "nav-link", active: ['comfy/admin/cms/sites'] do
= t('comfy.admin.cms.base.sites')

- if @site && !@site.new_record?
%li{class: 'nav-item', data: {turbo: 'false'}}
= active_link_to comfy_admin_cms_site_layouts_path(@site), class: "nav-link" do
= t('comfy.admin.cms.base.layouts')
%li{class: 'nav-item', data: {turbo: 'false'}}
= active_link_to comfy_admin_cms_site_pages_path(@site), class: "nav-link" do
= t('comfy.admin.cms.base.pages')
%li{class: 'nav-item', data: {turbo: 'false'}}
= active_link_to comfy_admin_cms_site_snippets_path(@site), class: "nav-link" do
= t('comfy.admin.cms.base.snippets')
%li.nav-item
- unless is_active_link?(comfy_admin_cms_site_files_path(@site))
%a.cms-files-open-modal{href: comfy_admin_cms_site_files_path(@site), title: "Open library"}
%i.fas.fa-bars
= active_link_to comfy_admin_cms_site_files_path(@site), class: "nav-link" do
= t('comfy.admin.cms.base.files')

= cms_hook :navigation

= comfy_admin_partial "comfy/admin/cms/partials/navigation_inner"

= comfy_admin_partial "comfy/admin/cms/partials/navigation_after"

.left-footer
= link_to 'ComfortableMexicanSofa', 'https://github.com/comfy', target: '_blank'
%span.version= ComfortableMexicanSofa::VERSION

0 comments on commit c5299c1

Please sign in to comment.