RocketChat / Rocket.Chat

The communications platform that puts data protection first.
https://rocket.chat/
Other
39.95k stars 10.29k forks source link

Template files aren't replaced in custom theme created #20157

Open dmitri-vlasov opened 3 years ago

dmitri-vlasov commented 3 years ago

Description: Theme files aren't replaced in custom theme

I'm trying to create the custom Rocket.Chat theme to place a Rocket.Chat to the custom page layout following the official guide, the section "Adding and Modifying Templates". But Rocket.Chat continue to load original ones from app/ui/client/views

Trying to include a modules 'rocketchat:lib', 'rocketchat:theme'

api.use([ 'templating', 'rocketchat:lib', 'rocketchat:theme' ]);

generates an error:

While selecting package versions: error: unknown package: rocketchat:lib Required by: dmitry:custom-theme 0.0.1

Steps to reproduce:

  1. Create and compile a local copy of Rocket.Chat server
  2. Do: meteor create --package dmitry:custom-theme
  3. dmitry:custom-theme added to .meteor/packages
  4. package.js customized (see Additional context below)
  5. client.coffee file added inside package directory with content Template.customCmsPage.replaces 'cmsPage'
  6. File views/customCmsPage.html added inside package directory (see Additional context below)
  7. Do: meteor add coffeescript to avoid error of No plugin known to handle file 'client.coffee'
  8. meteor npm start
  9. Visit http://localhost:3000/home
  10. Inspect the code for the additional tag appeared.

Expected behavior:

See the additional tag <p>This is a custom content</p> inside the code in the page http://localhost:3000/home

Actual behavior:

Original Rocket.Chat version of home page is loaded and no additional tag appeared.

Server Setup Information:

Client Setup Information

Additional context

package.js content:

Package.describe({
    name: 'dmitry:custom-theme',
    version: '0.0.1',
    summary: 'Custom Rocket.Chat theme',
});
Package.onUse(function (api) {
    // api.versionsFrom('1.12');
    api.use([
        // 'rocketchat:lib',
        // 'rocketchat:theme',
        'templating',
        'coffeescript',
        'aldeed:template-extension',
    ]);
    api.use('templating', 'client');
    api.addFiles(['views/customCmsPage.html', 'client.coffee'], 'client');
});

views/customCmsPage.html content:

<template name="customCmsPage">
    <main id="rocket-chat">
        <div class="main-content cms-page">
            <div class="container cms-page content-background-color">
                <div class="cms-page-close">
                    <button class="rc-button rc-button--nude"><i class="icon-cancel"></i></button>
                </div>
                <div class="cms-page__content">
                    <p>This is a custom content</p>
                    {{{page}}}
                </div>
            </div>
        </div>
    </main>
</template>

Relevant logs:

stephko90 commented 3 years ago

I am having this issue as well, were you able to find a solution?