add tags from drive
This commit is contained in:
@@ -28,6 +28,20 @@ define([
|
||||
* - createDropdown
|
||||
*/
|
||||
|
||||
UI.updateTags = function (common, href) {
|
||||
var sframeChan = common.getSframeChannel();
|
||||
sframeChan.query('Q_TAGS_GET', href || null, function (err, res) {
|
||||
if (err || res.error) { return void console.error(err || res.error); }
|
||||
Cryptpad.dialog.tagPrompt(res.data, function (tags) {
|
||||
if (!Array.isArray(tags)) { return; }
|
||||
sframeChan.event('EV_TAGS_SET', {
|
||||
tags: tags,
|
||||
href: href,
|
||||
});
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
UI.createButton = function (common, type, rightside, data, callback) {
|
||||
var AppConfig = common.getAppConfig();
|
||||
var button;
|
||||
@@ -202,16 +216,7 @@ define([
|
||||
title: Messages.tags_title,
|
||||
})
|
||||
.click(common.prepareFeedback(type))
|
||||
.click(function () {
|
||||
sframeChan.query('Q_TAGS_GET', null, function (err, res) {
|
||||
if (err || res.error) { return void console.error(err || res.error); }
|
||||
Cryptpad.dialog.tagPrompt(res.data, function (tags) {
|
||||
if (!Array.isArray(tags)) { return; }
|
||||
console.error(tags);
|
||||
sframeChan.event('EV_TAGS_SET', tags);
|
||||
});
|
||||
});
|
||||
});
|
||||
.click(function () { UI.updateTags(null); });
|
||||
break;
|
||||
default:
|
||||
button = $('<button>', {
|
||||
|
||||
@@ -401,7 +401,7 @@ define([
|
||||
});
|
||||
|
||||
sframeChan.on('Q_TAGS_GET', function (data, cb) {
|
||||
Cryptpad.getPadTags(null, function (err, data) {
|
||||
Cryptpad.getPadTags(data, function (err, data) {
|
||||
cb({
|
||||
error: err,
|
||||
data: data
|
||||
@@ -410,8 +410,7 @@ define([
|
||||
});
|
||||
|
||||
sframeChan.on('EV_TAGS_SET', function (data) {
|
||||
console.log(data);
|
||||
Cryptpad.resetTags(null, data);
|
||||
Cryptpad.resetTags(data.href, data.tags);
|
||||
});
|
||||
|
||||
sframeChan.on('Q_PIN_GET_USAGE', function (data, cb) {
|
||||
|
||||
@@ -78,6 +78,7 @@ define([
|
||||
funcs.displayAvatar = callWithCommon(UI.displayAvatar);
|
||||
funcs.createButton = callWithCommon(UI.createButton);
|
||||
funcs.createUsageBar = callWithCommon(UI.createUsageBar);
|
||||
funcs.updateTags = callWithCommon(UI.updateTags);
|
||||
|
||||
// History
|
||||
funcs.getHistory = callWithCommon(History.create);
|
||||
|
||||
Reference in New Issue
Block a user