Skip to content

Commit dbb1a86

Browse files
committedDec 15, 2018
- Admin Panel / Layout / Custom Product Name now changes webpage title.
Thanks to xet7 ! Related wekan#1196
1 parent c066883 commit dbb1a86

File tree

6 files changed

+55
-15
lines changed

6 files changed

+55
-15
lines changed
 

‎client/components/settings/settingBody.js

+2
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,8 @@ BlazeComponent.extendComponent({
155155
this.setLoading(false);
156156
}
157157

158+
DocHead.setTitle(productName);
159+
158160
saveMailServerInfo();
159161

160162
},

‎client/lib/utils.js

+20
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,26 @@ Utils = {
145145
});
146146
},
147147

148+
manageCustomUI(){
149+
Meteor.call('getCustomUI', (err, data) => {
150+
if (err && err.error[0] === 'var-not-exist'){
151+
Session.set('customUI', false); // siteId || address server not defined
152+
}
153+
if (!err){
154+
Utils.setCustomUI(data);
155+
}
156+
});
157+
},
158+
159+
setCustomUI(data){
160+
const currentBoard = Boards.findOne(Session.get('currentBoard'));
161+
if (currentBoard) {
162+
DocHead.setTitle(`${currentBoard.title } - ${ data.productName}`);
163+
} else {
164+
DocHead.setTitle(`${data.productName}`);
165+
}
166+
},
167+
148168
setMatomo(data){
149169
window._paq = window._paq || [];
150170
window._paq.push(['setDoNotTrack', data.doNotTrack]);

‎config/router.js

+16-11
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ FlowRouter.route('/', {
1414
Filter.reset();
1515
EscapeActions.executeAll();
1616

17+
Utils.manageCustomUI();
1718
Utils.manageMatomo();
1819

1920
BlazeLayout.render('defaultLayout', {
@@ -40,6 +41,7 @@ FlowRouter.route('/b/:id/:slug', {
4041
EscapeActions.executeUpTo('popup-close');
4142
}
4243

44+
Utils.manageCustomUI();
4345
Utils.manageMatomo();
4446

4547
BlazeLayout.render('defaultLayout', {
@@ -57,6 +59,7 @@ FlowRouter.route('/b/:boardId/:slug/:cardId', {
5759
Session.set('currentBoard', params.boardId);
5860
Session.set('currentCard', params.cardId);
5961

62+
Utils.manageCustomUI();
6063
Utils.manageMatomo();
6164

6265
BlazeLayout.render('defaultLayout', {
@@ -122,6 +125,7 @@ FlowRouter.route('/setting', {
122125
},
123126
],
124127
action() {
128+
Utils.manageCustomUI();
125129
BlazeLayout.render('defaultLayout', {
126130
headerBar: 'settingHeaderBar',
127131
content: 'setting',
@@ -199,20 +203,21 @@ _.each(redirections, (newPath, oldPath) => {
199203
// using the `kadira:dochead` package. Currently we only use it to display the
200204
// board title if we are in a board page (see #364) but we may want to support
201205
// some <meta> tags in the future.
202-
const appTitle = 'Wekan';
206+
//const appTitle = Utils.manageCustomUI();
203207

204208
// XXX The `Meteor.startup` should not be necessary -- we don't need to wait for
205209
// the complete DOM to be ready to call `DocHead.setTitle`. But the problem is
206210
// that the global variable `Boards` is undefined when this file loads so we
207211
// wait a bit until hopefully all files are loaded. This will be fixed in a
208212
// clean way once Meteor will support ES6 modules -- hopefully in Meteor 1.3.
209-
Meteor.isClient && Meteor.startup(() => {
210-
Tracker.autorun(() => {
211-
const currentBoard = Boards.findOne(Session.get('currentBoard'));
212-
const titleStack = [appTitle];
213-
if (currentBoard) {
214-
titleStack.push(currentBoard.title);
215-
}
216-
DocHead.setTitle(titleStack.reverse().join(' - '));
217-
});
218-
});
213+
//Meteor.isClient && Meteor.startup(() => {
214+
// Tracker.autorun(() => {
215+
216+
// const currentBoard = Boards.findOne(Session.get('currentBoard'));
217+
// const titleStack = [appTitle];
218+
// if (currentBoard) {
219+
// titleStack.push(currentBoard.title);
220+
// }
221+
// DocHead.setTitle(titleStack.reverse().join(' - '));
222+
// });
223+
//});

‎models/settings.js

+14-1
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ if (Meteor.isServer) {
7474
if(!setting){
7575
const now = new Date();
7676
const domain = process.env.ROOT_URL.match(/\/\/(?:www\.)?(.*)?(?:\/)?/)[1];
77-
const from = `Wekan <wekan@${domain}>`;
77+
const from = `Boards Support <support@${domain}>`;
7878
const defaultSetting = {disableRegistration: false, mailServer: {
7979
username: '', password: '', host: '', port: '', enableTLS: false, from,
8080
}, createdAt: now, modifiedAt: now};
@@ -210,6 +210,19 @@ if (Meteor.isServer) {
210210
};
211211
},
212212

213+
getCustomUI(){
214+
const setting = Settings.findOne({});
215+
if (!setting.productName) {
216+
return {
217+
productName: 'Wekan',
218+
};
219+
} else {
220+
return {
221+
productName: `${setting.productName}`,
222+
};
223+
}
224+
},
225+
213226
getMatomoConf(){
214227
return {
215228
address: getEnvVar('MATOMO_ADDRESS'),

‎models/trelloCreator.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ export class TrelloCreator {
268268
}
269269
// insert card
270270
const cardId = Cards.direct.insert(cardToCreate);
271-
// keep track of Trello id => WeKan id
271+
// keep track of Trello id => Wekan id
272272
this.cards[card.id] = cardId;
273273
// log activity
274274
// Activities.direct.insert({
@@ -431,7 +431,7 @@ export class TrelloCreator {
431431
sort: checklist.pos,
432432
};
433433
const checklistId = Checklists.direct.insert(checklistToCreate);
434-
// keep track of Trello id => WeKan id
434+
// keep track of Trello id => Wekan id
435435
this.checklists[checklist.id] = checklistId;
436436
// Now add the items to the checklistItems
437437
let counter = 0;

‎models/wekanCreator.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ export class WekanCreator {
300300
}
301301
// insert card
302302
const cardId = Cards.direct.insert(cardToCreate);
303-
// keep track of Wekan id => WeKan id
303+
// keep track of Wekan id => Wekan id
304304
this.cards[card._id] = cardId;
305305
// // log activity
306306
// Activities.direct.insert({

0 commit comments

Comments
 (0)
Please sign in to comment.