Merge branch 'staging' of github.com:xwiki-labs/cryptpad into staging

pull/1/head
yflory 7 years ago
commit 50eb803c95

@ -2,8 +2,9 @@ define([
'/api/config', '/api/config',
'/common/hyperscript.js', '/common/hyperscript.js',
'/customize/messages.js', '/customize/messages.js',
'jquery' 'jquery',
], function (Config, h, Msg, $) { '/customize/application_config.js',
], function (Config, h, Msg, $, AppConfig) {
var Pages = {}; var Pages = {};
var urlArgs = Config.requireConf.urlArgs; var urlArgs = Config.requireConf.urlArgs;
@ -374,36 +375,39 @@ define([
]); ]);
}; };
var isAvailableType = function (x) {
if (!Array.isArray(AppConfig.availablePadTypes)) { return true; }
return AppConfig.availablePadTypes.some(function (type, i) {
return x.indexOf(type) > -1;
});
};
Pages['/'] = Pages['/index.html'] = function () { Pages['/'] = Pages['/index.html'] = function () {
var showingMore = false; var showingMore = false;
return [
h('div#cp-main', [ var icons = [
infopageTopbar(),
h('div.container.cp-container', [
h('div.row', [
h('div.cp-title.col-12.col-sm-6', [
h('img', { src: '/customize/cryptpad-new-logo-colors-logoonly.png?' + urlArgs }),
h('h1', 'CryptPad'),
h('p', Msg.main_catch_phrase)
]),
h('div.col-12.col-sm-6', [
[
[ 'pad', '/pad/', Msg.main_richTextPad, 'fa-file-word-o' ], [ 'pad', '/pad/', Msg.main_richTextPad, 'fa-file-word-o' ],
[ 'code', '/code/', Msg.main_codePad, 'fa-file-code-o' ], [ 'code', '/code/', Msg.main_codePad, 'fa-file-code-o' ],
[ 'slide', '/slide/', Msg.main_slidePad, 'fa-file-powerpoint-o' ], [ 'slide', '/slide/', Msg.main_slidePad, 'fa-file-powerpoint-o' ],
[ 'poll.cp-more.cp-hidden', '/poll/', Msg.main_pollPad, 'fa-calendar' ], [ 'poll', '/poll/', Msg.main_pollPad, 'fa-calendar' ],
[ 'whiteboard.cp-more.cp-hidden', '/whiteboard/', Msg.main_whiteboardPad, 'fa-paint-brush' ], [ 'whiteboard', '/whiteboard/', Msg.main_whiteboardPad, 'fa-paint-brush' ],
[ 'recent.cp-more.cp-hidden', '/drive/', Msg.main_localPads, 'fa-hdd-o' ] [ 'recent', '/drive/', Msg.main_localPads, 'fa-hdd-o' ]
].map(function (x) { ].filter(function (x) {
return isAvailableType(x[1]);
})
.map(function (x, i) {
var s = 'div.bs-callout.cp-callout-' + x[0];
if (i > 2) { s += '.cp-more.cp-hidden'; }
return h('a', [ return h('a', [
{ href: x[1] }, { href: x[1] },
h('div.bs-callout.cp-callout-' + x[0], [ h(s, [
h('i.fa.' + x[3]), h('i.fa.' + x[3]),
h('div.pad-button-text', [ h('h4', x[2]) ]) h('div.pad-button-text', [ h('h4', x[2]) ])
]) ])
]); ]);
}), });
h('div.bs-callout.cp-callout-more', [
var more = icons.length < 4? undefined: h('div.bs-callout.cp-callout-more', [
h('div.cp-callout-more-lessmsg.cp-hidden', [ h('div.cp-callout-more-lessmsg.cp-hidden', [
"see less ", "see less ",
h('i.fa.fa-caret-up') h('i.fa.fa-caret-up')
@ -424,7 +428,21 @@ define([
showingMore = !showingMore; showingMore = !showingMore;
} }
} }
]) ]);
return [
h('div#cp-main', [
infopageTopbar(),
h('div.container.cp-container', [
h('div.row', [
h('div.cp-title.col-12.col-sm-6', [
h('img', { src: '/customize/cryptpad-new-logo-colors-logoonly.png?' + urlArgs }),
h('h1', 'CryptPad'),
h('p', Msg.main_catch_phrase)
]),
h('div.col-12.col-sm-6', [
icons,
more
]) ])
]) ])
]), ]),

Loading…
Cancel
Save