mirror of
https://github.com/wekan/wekan.git
synced 2025-12-16 23:40:13 +01:00
- Admin Panel / Layout / Custom Product Name now changes webpage title.
Thanks to xet7 ! Related #1196
This commit is contained in:
parent
c066883dbd
commit
dbb1a86ca3
6 changed files with 55 additions and 15 deletions
|
|
@ -155,6 +155,8 @@ BlazeComponent.extendComponent({
|
||||||
this.setLoading(false);
|
this.setLoading(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DocHead.setTitle(productName);
|
||||||
|
|
||||||
saveMailServerInfo();
|
saveMailServerInfo();
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -145,6 +145,26 @@ Utils = {
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
manageCustomUI(){
|
||||||
|
Meteor.call('getCustomUI', (err, data) => {
|
||||||
|
if (err && err.error[0] === 'var-not-exist'){
|
||||||
|
Session.set('customUI', false); // siteId || address server not defined
|
||||||
|
}
|
||||||
|
if (!err){
|
||||||
|
Utils.setCustomUI(data);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
setCustomUI(data){
|
||||||
|
const currentBoard = Boards.findOne(Session.get('currentBoard'));
|
||||||
|
if (currentBoard) {
|
||||||
|
DocHead.setTitle(`${currentBoard.title } - ${ data.productName}`);
|
||||||
|
} else {
|
||||||
|
DocHead.setTitle(`${data.productName}`);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
setMatomo(data){
|
setMatomo(data){
|
||||||
window._paq = window._paq || [];
|
window._paq = window._paq || [];
|
||||||
window._paq.push(['setDoNotTrack', data.doNotTrack]);
|
window._paq.push(['setDoNotTrack', data.doNotTrack]);
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,7 @@ FlowRouter.route('/', {
|
||||||
Filter.reset();
|
Filter.reset();
|
||||||
EscapeActions.executeAll();
|
EscapeActions.executeAll();
|
||||||
|
|
||||||
|
Utils.manageCustomUI();
|
||||||
Utils.manageMatomo();
|
Utils.manageMatomo();
|
||||||
|
|
||||||
BlazeLayout.render('defaultLayout', {
|
BlazeLayout.render('defaultLayout', {
|
||||||
|
|
@ -40,6 +41,7 @@ FlowRouter.route('/b/:id/:slug', {
|
||||||
EscapeActions.executeUpTo('popup-close');
|
EscapeActions.executeUpTo('popup-close');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Utils.manageCustomUI();
|
||||||
Utils.manageMatomo();
|
Utils.manageMatomo();
|
||||||
|
|
||||||
BlazeLayout.render('defaultLayout', {
|
BlazeLayout.render('defaultLayout', {
|
||||||
|
|
@ -57,6 +59,7 @@ FlowRouter.route('/b/:boardId/:slug/:cardId', {
|
||||||
Session.set('currentBoard', params.boardId);
|
Session.set('currentBoard', params.boardId);
|
||||||
Session.set('currentCard', params.cardId);
|
Session.set('currentCard', params.cardId);
|
||||||
|
|
||||||
|
Utils.manageCustomUI();
|
||||||
Utils.manageMatomo();
|
Utils.manageMatomo();
|
||||||
|
|
||||||
BlazeLayout.render('defaultLayout', {
|
BlazeLayout.render('defaultLayout', {
|
||||||
|
|
@ -122,6 +125,7 @@ FlowRouter.route('/setting', {
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
action() {
|
action() {
|
||||||
|
Utils.manageCustomUI();
|
||||||
BlazeLayout.render('defaultLayout', {
|
BlazeLayout.render('defaultLayout', {
|
||||||
headerBar: 'settingHeaderBar',
|
headerBar: 'settingHeaderBar',
|
||||||
content: 'setting',
|
content: 'setting',
|
||||||
|
|
@ -199,20 +203,21 @@ _.each(redirections, (newPath, oldPath) => {
|
||||||
// using the `kadira:dochead` package. Currently we only use it to display the
|
// using the `kadira:dochead` package. Currently we only use it to display the
|
||||||
// board title if we are in a board page (see #364) but we may want to support
|
// board title if we are in a board page (see #364) but we may want to support
|
||||||
// some <meta> tags in the future.
|
// some <meta> tags in the future.
|
||||||
const appTitle = 'Wekan';
|
//const appTitle = Utils.manageCustomUI();
|
||||||
|
|
||||||
// XXX The `Meteor.startup` should not be necessary -- we don't need to wait for
|
// XXX The `Meteor.startup` should not be necessary -- we don't need to wait for
|
||||||
// the complete DOM to be ready to call `DocHead.setTitle`. But the problem is
|
// the complete DOM to be ready to call `DocHead.setTitle`. But the problem is
|
||||||
// that the global variable `Boards` is undefined when this file loads so we
|
// that the global variable `Boards` is undefined when this file loads so we
|
||||||
// wait a bit until hopefully all files are loaded. This will be fixed in a
|
// wait a bit until hopefully all files are loaded. This will be fixed in a
|
||||||
// clean way once Meteor will support ES6 modules -- hopefully in Meteor 1.3.
|
// clean way once Meteor will support ES6 modules -- hopefully in Meteor 1.3.
|
||||||
Meteor.isClient && Meteor.startup(() => {
|
//Meteor.isClient && Meteor.startup(() => {
|
||||||
Tracker.autorun(() => {
|
// Tracker.autorun(() => {
|
||||||
const currentBoard = Boards.findOne(Session.get('currentBoard'));
|
|
||||||
const titleStack = [appTitle];
|
// const currentBoard = Boards.findOne(Session.get('currentBoard'));
|
||||||
if (currentBoard) {
|
// const titleStack = [appTitle];
|
||||||
titleStack.push(currentBoard.title);
|
// if (currentBoard) {
|
||||||
}
|
// titleStack.push(currentBoard.title);
|
||||||
DocHead.setTitle(titleStack.reverse().join(' - '));
|
// }
|
||||||
});
|
// DocHead.setTitle(titleStack.reverse().join(' - '));
|
||||||
});
|
// });
|
||||||
|
//});
|
||||||
|
|
|
||||||
|
|
@ -74,7 +74,7 @@ if (Meteor.isServer) {
|
||||||
if(!setting){
|
if(!setting){
|
||||||
const now = new Date();
|
const now = new Date();
|
||||||
const domain = process.env.ROOT_URL.match(/\/\/(?:www\.)?(.*)?(?:\/)?/)[1];
|
const domain = process.env.ROOT_URL.match(/\/\/(?:www\.)?(.*)?(?:\/)?/)[1];
|
||||||
const from = `Wekan <wekan@${domain}>`;
|
const from = `Boards Support <support@${domain}>`;
|
||||||
const defaultSetting = {disableRegistration: false, mailServer: {
|
const defaultSetting = {disableRegistration: false, mailServer: {
|
||||||
username: '', password: '', host: '', port: '', enableTLS: false, from,
|
username: '', password: '', host: '', port: '', enableTLS: false, from,
|
||||||
}, createdAt: now, modifiedAt: now};
|
}, createdAt: now, modifiedAt: now};
|
||||||
|
|
@ -210,6 +210,19 @@ if (Meteor.isServer) {
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
|
getCustomUI(){
|
||||||
|
const setting = Settings.findOne({});
|
||||||
|
if (!setting.productName) {
|
||||||
|
return {
|
||||||
|
productName: 'Wekan',
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
return {
|
||||||
|
productName: `${setting.productName}`,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
getMatomoConf(){
|
getMatomoConf(){
|
||||||
return {
|
return {
|
||||||
address: getEnvVar('MATOMO_ADDRESS'),
|
address: getEnvVar('MATOMO_ADDRESS'),
|
||||||
|
|
|
||||||
|
|
@ -268,7 +268,7 @@ export class TrelloCreator {
|
||||||
}
|
}
|
||||||
// insert card
|
// insert card
|
||||||
const cardId = Cards.direct.insert(cardToCreate);
|
const cardId = Cards.direct.insert(cardToCreate);
|
||||||
// keep track of Trello id => WeKan id
|
// keep track of Trello id => Wekan id
|
||||||
this.cards[card.id] = cardId;
|
this.cards[card.id] = cardId;
|
||||||
// log activity
|
// log activity
|
||||||
// Activities.direct.insert({
|
// Activities.direct.insert({
|
||||||
|
|
@ -431,7 +431,7 @@ export class TrelloCreator {
|
||||||
sort: checklist.pos,
|
sort: checklist.pos,
|
||||||
};
|
};
|
||||||
const checklistId = Checklists.direct.insert(checklistToCreate);
|
const checklistId = Checklists.direct.insert(checklistToCreate);
|
||||||
// keep track of Trello id => WeKan id
|
// keep track of Trello id => Wekan id
|
||||||
this.checklists[checklist.id] = checklistId;
|
this.checklists[checklist.id] = checklistId;
|
||||||
// Now add the items to the checklistItems
|
// Now add the items to the checklistItems
|
||||||
let counter = 0;
|
let counter = 0;
|
||||||
|
|
|
||||||
|
|
@ -300,7 +300,7 @@ export class WekanCreator {
|
||||||
}
|
}
|
||||||
// insert card
|
// insert card
|
||||||
const cardId = Cards.direct.insert(cardToCreate);
|
const cardId = Cards.direct.insert(cardToCreate);
|
||||||
// keep track of Wekan id => WeKan id
|
// keep track of Wekan id => Wekan id
|
||||||
this.cards[card._id] = cardId;
|
this.cards[card._id] = cardId;
|
||||||
// // log activity
|
// // log activity
|
||||||
// Activities.direct.insert({
|
// Activities.direct.insert({
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue