diff --git a/app/javascript/controllers/dashboard_controller.js b/app/javascript/controllers/dashboard_controller.js index 95ce8f1f2..637c751d9 100644 --- a/app/javascript/controllers/dashboard_controller.js +++ b/app/javascript/controllers/dashboard_controller.js @@ -4,8 +4,6 @@ import 'daterangepicker'; export default class extends Controller { initialize() { - $('[data-toggle="tooltip"]').tooltip(); - $('#reportrange').daterangepicker({ opens: 'left', locale: { diff --git a/app/javascript/packs/comfy/admin/cms.js b/app/javascript/packs/comfy/admin/cms.js index 7d045a1c0..a6d86d195 100644 --- a/app/javascript/packs/comfy/admin/cms.js +++ b/app/javascript/packs/comfy/admin/cms.js @@ -1,6 +1,7 @@ import Sortable from 'sortablejs'; import jQuery from 'jquery'; -import "controllers" +import "controllers"; +import "chartkick/chart.js"; global.$ = global.jQuery = jQuery; @@ -71,7 +72,7 @@ function resetIndex(containerId) { }); } - - +require("../../trix") +require("../../select2") require("../../common") require("../../turbo") diff --git a/app/javascript/subscriptions/room_subscription.js b/app/javascript/subscriptions/room_subscription.js index edea32c97..e6f134a11 100644 --- a/app/javascript/subscriptions/room_subscription.js +++ b/app/javascript/subscriptions/room_subscription.js @@ -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 }) { diff --git a/app/javascript/subscriptions/signaling_subscription.js b/app/javascript/subscriptions/signaling_subscription.js index d1ea8825f..4c65adea2 100644 --- a/app/javascript/subscriptions/signaling_subscription.js +++ b/app/javascript/subscriptions/signaling_subscription.js @@ -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 }) { diff --git a/app/views/comfy/admin/blog/partials/_navigation.html.haml b/app/views/comfy/admin/blog/partials/_navigation.html.haml new file mode 100644 index 000000000..754d6e0d8 --- /dev/null +++ b/app/views/comfy/admin/blog/partials/_navigation.html.haml @@ -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') diff --git a/app/views/comfy/admin/v2/dashboard/dashboard.html.haml b/app/views/comfy/admin/v2/dashboard/dashboard.html.haml index 7cf591ca8..0c309402a 100644 --- a/app/views/comfy/admin/v2/dashboard/dashboard.html.haml +++ b/app/views/comfy/admin/v2/dashboard/dashboard.html.haml @@ -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(); + }) diff --git a/app/views/layouts/comfy/admin/cms.html.haml b/app/views/layouts/comfy/admin/cms.html.haml index 134c50dc1..0cd68ec5e 100644 --- a/app/views/layouts/comfy/admin/cms.html.haml +++ b/app/views/layouts/comfy/admin/cms.html.haml @@ -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' diff --git a/app/views/layouts/comfy/admin/cms/_footer_js.html.haml b/app/views/layouts/comfy/admin/cms/_footer_js.html.haml new file mode 100644 index 000000000..e7623cfcb --- /dev/null +++ b/app/views/layouts/comfy/admin/cms/_footer_js.html.haml @@ -0,0 +1,4 @@ += comfy_admin_partial "comfy/admin/cms/partials/html_footer" + +- if content_for(:javascript) + = yield :javascript \ No newline at end of file diff --git a/app/views/layouts/comfy/admin/cms/_head.html.haml b/app/views/layouts/comfy/admin/cms/_head.html.haml new file mode 100644 index 000000000..348b022b7 --- /dev/null +++ b/app/views/layouts/comfy/admin/cms/_head.html.haml @@ -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" \ No newline at end of file diff --git a/app/views/layouts/comfy/admin/cms/_left.html.haml b/app/views/layouts/comfy/admin/cms/_left.html.haml new file mode 100644 index 000000000..c7e666cd8 --- /dev/null +++ b/app/views/layouts/comfy/admin/cms/_left.html.haml @@ -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 \ No newline at end of file