mirror of
https://github.com/cryptpad/cryptpad.git
synced 2026-09-12 19:49:59 +05:00
Sidebar layout improvements
This commit is contained in:
parent
b135e815e7
commit
7c816f488c
@ -236,6 +236,12 @@
|
||||
margin-bottom: 0;
|
||||
}
|
||||
}
|
||||
.cp-sidebarlayout-description-item {
|
||||
display: block;
|
||||
color: @cp_sidebar-hint;
|
||||
margin-top: @sidebar_base-margin;
|
||||
margin-bottom: 0;
|
||||
}
|
||||
label.noTitle {
|
||||
display: inline-flex;
|
||||
.fa {
|
||||
|
||||
@ -40,7 +40,6 @@ Decrees.create = (name, commands) => {
|
||||
var args = line[1];
|
||||
|
||||
if (typeof(commands[command]) !== 'function') {
|
||||
console.log('ici', command, commands);
|
||||
throw new Error("DECREE_UNSUPPORTED_COMMAND");
|
||||
}
|
||||
|
||||
|
||||
@ -156,6 +156,35 @@ define([
|
||||
return box;
|
||||
};
|
||||
|
||||
// opts.values = { key1:label1, key2:label2 }
|
||||
blocks.radio = (key, state, opts, onChange) => {
|
||||
if (!opts?.values) {
|
||||
return void console.error('NO_VALUES');
|
||||
}
|
||||
let all = Object.keys(opts.values).map(k => {
|
||||
let v = opts.values[k];
|
||||
let r = UI.createRadio(
|
||||
`cp-${app}-${key}`,
|
||||
`cp-${app}-${key}-${k}`,
|
||||
v, state === k, {
|
||||
input: { value: k },
|
||||
label: { class: 'noTitle' }
|
||||
}
|
||||
);
|
||||
if (typeof(onChange) === "function"){
|
||||
$(r).find('input').on('change', function() {
|
||||
onChange(k);
|
||||
});
|
||||
}
|
||||
return r;
|
||||
});
|
||||
let block = h('div.cp-sidebar-flex-block', all);
|
||||
if (opts && opts.spinner) {
|
||||
block.spinner = UI.makeSpinner($(block));
|
||||
}
|
||||
return block;
|
||||
};
|
||||
|
||||
blocks.table = function (header, entries) {
|
||||
const table = h('table.cp-sidebar-table');
|
||||
if (header) {
|
||||
@ -255,6 +284,13 @@ define([
|
||||
return box;
|
||||
};
|
||||
|
||||
blocks.hintItem = (hint, item) => {
|
||||
return blocks.form([
|
||||
h('span.cp-sidebarlayout-description-item', hint),
|
||||
item
|
||||
]);
|
||||
};
|
||||
|
||||
return blocks;
|
||||
};
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user