RocketChat / RocketChat/Rocket.Chat

Template files aren't replaced in custom theme created

Open
#20,157 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
46.1k
Forks
13.9k
Avg merge
3d 3h
Merged PRs (30d)
130

Description

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:
  • Version of Rocket.Chat Server: 3.11.0-develop
  • Operating System: MacOS BigSur 11.1
  • Deployment Method: local compile from source
  • Number of Running Instances: 1
  • DB Replicaset Oplog: Enabled
  • NodeJS Version: 12.18.4 - x64
  • MongoDB Version: 4.2.8
Client Setup Information
  • Desktop App or Browser Version: Safari
  • Operating System: MacOS BigSur 11.1
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:

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the custom package.js, client.coffee, and views/customCmsPage.html, then compare them with the templates under app/ui/client/views. Run the documented meteor npm start reproduction and inspect the generated page. Done means the customCmsPage template replaces cmsPage and the additional content appears at /home.

Written by the indexing model from the issue text.

Assessment

Tech stack
coffeescript, javascript
Domain
frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.