1084

Which files are responsible for the trongate-pages-dock's creation in Trongate Pages?

Comments for “Which files are responsible for the trongate-pages-dock's creation in Trongate...”
 

Posted by Josh1985 on Friday 23rd February 2024 at 09:25 GMT

Hello all!

I am having kind of a weird issue, I don't quite understand why it is happening. Once I am logged into the admin side of Trongate, I attempt to edit a page listed in the CMS. I do get the "View Page" dialog popup. Then, I click "View Page In 'Edit' Mode". Then, I get the trongate-pages-dock to display on the page in the page's edit view. BUT, if I click on any of the buttons in the dock, the only thing that does anything is the back button.

So, I was going to go through the trongate pages files and see if somehow, something got changed or edited in a required file needed for the dock. But, this is where I get lost. I have no idea which files are responsible for building that dock.

The only thing I have really changed is some CSS changes. I don't know if that helps at all.

Any help anyone could offer would be greatly appreciated.

Josh1985

User Level: Guest

Date Joined: 13/09/2022

Posted by DaFa on Friday 23rd February 2024 at 12:29 GMT

Hi Josh, the Trongate pages dock is controlled by the JavaScript file. Not sure why you are having those issues. Maybe try sharing a bit more detail.
Founding Member

DaFa

User Level: Founding Member

Date Joined: 30/11/2018

Posted by Josh1985 on Friday 23rd February 2024 at 13:01 GMT

Thank you for your response, Dafa!

I am not quite sure which JavaScript file you are referring to? You just simply said "the JavaScript file". Are you referring to the "dock_manager.js" javascript file, or something else?

More info you say? I am not sure what else I can do to describe what is happening... When I try to click on any of the options from the dock nothing happens. Except, the back button works but nothing else. I have even tried copying and pasting the js files for the Trongate Pages module from another Trongate project into the current one with no change in the dock at all.

Also, I suppose if worse comes to worse, I could rebuild the entire project since it is basically an empty site right now with only one unpublished "Test" page. But, I thought I would ask here first and see if it is some kind of file I just need to replace, before I have to do a full backup and replacement of the custom CSS. That was why I was wondering what were the complete files (js, views, controllers, etc) that have anything to do with the dock so I could try replacing those with working files and see if that is my issue. But, if the only file that builds the dock is a single js file, and it is the ones I already replaced, I am at a complete loss.

Any other ideas?

This comment was edited by Josh1985 on Friday 23rd February 2024 at 13:05 GMT

Josh1985

User Level: Guest

Date Joined: 13/09/2022

Posted by DaFa on Friday 23rd February 2024 at 20:55 GMT

Sorry for being so vague before. What I meant is that the dock for Trongate pages is all JavaScript broken up into individual script files. If you display the source on the Trongate pages view, you should see an array like this
const tgpScriptUrls = [
    'http://localhost/a_6/trongate_pages_module/js/button_manager.js',
    'http://localhost/a_6/trongate_pages_module/js/camera_manager.js',
    'http://localhost/a_6/trongate_pages_module/js/code_view.js',
    'http://localhost/a_6/trongate_pages_module/js/divider_manager.js',
    'http://localhost/a_6/trongate_pages_module/js/dock_manager.js',
    'http://localhost/a_6/trongate_pages_module/js/element_adder_manager.js',
    'http://localhost/a_6/trongate_pages_module/js/folder_manager.js',
    'http://localhost/a_6/trongate_pages_module/js/headline_manager.js',
    'http://localhost/a_6/trongate_pages_module/js/image_manager.js',
    'http://localhost/a_6/trongate_pages_module/js/text_manager.js',
    'http://localhost/a_6/trongate_pages_module/js/trongate_pages.js',
    'http://localhost/a_6/trongate_pages_module/js/toolbar_manager.js',
    'http://localhost/a_6/trongate_pages_module/js/youtube_manager.js'
      ];
Also, open dev tools and do a hard reload to see if they are all loading properly. Another way is to create a new app and slowly import your code over to see where things may have gone wrong.

This comment was edited by DaFa on Friday 23rd February 2024 at 20:56 GMT

Founding Member

DaFa

User Level: Founding Member

Date Joined: 30/11/2018

Posted by Josh1985 on Saturday 24th February 2024 at 00:46 GMT

Thank you for your response, Dafa!

I think I figured it out!

As it turns out, the problem wasn't with any of the core js files in the "trongate_pages" module (oddly enough).

The file causing all the issues was a file that wasn't loading called "app.js". Which, I didn't even think to check the "console" of the dev menu until you mentioned doing a hard reload.

This file normally lives in "public/js/app.js". I had moved most of the stray assets (css, js, themes, etc) into an "assets" folder inside public to kind of make resources easier to find. I thought I had repaired all the broken links to these resources by that very move, apparently I missed app.js's redirect to it's new home. Silly me!

P.S. Some parts of Trongate are a bit scattered about. If there ever is a new version of the framework, might I suggest having your resources compiled into an assets folder for public elements. This is made even more apparent with js and css being mixed in with some files as embedded code or embedded css. Embedded css and js gets really confusing to debug, when the file that loads these critical resources is so vague and really nothing to point you to where that code or stylesheet is. Preferrably, I would like to request seeing those resources placed in a separate file containing one script or one stylesheet at a time for each, then link to them in the file it goes to. For example, I have added the following to the top of ALL code (php, js, css), for easier debugging with different css, as needed of course:
<?php
 /*
  * -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  * COPYRIGHT & LICENSE NOTICE
  * -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  * This file is part of Trongate Framework.
  * Copyright (c) 2019, David Connelly
  * For the full copyright and license information, please view the LICENSE file that was distributed with this source code.
  *
  * The full license and copyright details are located in "\public\assets\static\license.php"
  * -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  * CURRENT FILE LOCATION
  * -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  * \modules\trongate_pages\views\display.php
 */
?>
<link rel="stylesheet" href="<?= BASE_URL ?>/assets/css/editconsole.css">


Thanks again!

This comment was edited by Josh1985 on Saturday 24th February 2024 at 01:06 GMT

Josh1985

User Level: Guest

Date Joined: 13/09/2022

Posted by DaFa on Saturday 24th February 2024 at 13:11 GMT

Hi Josh, glad we found the issue. My thoughts were It was always going to be something that wasn't loading in, hence my suggestion to check the dev console and do a hard reset. Please close this thread off when you get a moment.

On your post script comments. Most people think v1 forever means Trongate is not being updated, well that can't be further from the truth. Trongate is always being updated, improved and evolving. It's just doing it without introducing breaking changes and avoiding the rewrite culture of all those other frameworks.

I do recall your previous post on moving assets into the public folder. For me that's a backwards step, as Trongate is designed to be modular and is not constrained like most MVC frameworks to place all their assets in one place. Trongate is a HAVC framework, where each module can have its own assets folder for drag and drop development. If that makes it hard for you to debug, I don't see it as an issue but more of a help to find where things belong.

Don't get me wrong, I'm not trying to tell you how to structure your app. If that works for you, that's fine. I'm just trying to point out this is intentional and not a 'messy' haphazard approach.

Cheers,
Simon

This comment was edited by DaFa on Saturday 24th February 2024 at 13:15 GMT

Founding Member

DaFa

User Level: Founding Member

Date Joined: 30/11/2018

×