|
|
|
|
@ -20,11 +20,9 @@ const setFieldValue = function(settingId, value, type, editor) { |
|
|
|
|
input.next()[0].CodeMirror.setValue(value); |
|
|
|
|
break; |
|
|
|
|
case 'color': |
|
|
|
|
editor = value && value[0] === '#' ? 'color' : 'expression'; |
|
|
|
|
input.parents('.horizontal').find('select[name="color-editor"]').val(editor).change(); |
|
|
|
|
input.val(value).change(); |
|
|
|
|
if (editor === 'color') { |
|
|
|
|
new jscolor(input); //eslint-disable-line
|
|
|
|
|
} |
|
|
|
|
break; |
|
|
|
|
case 'roomPick': |
|
|
|
|
const selectedRooms = Template.instance().selectedRooms.get(); |
|
|
|
|
@ -341,6 +339,9 @@ Template.admin.events({ |
|
|
|
|
break; |
|
|
|
|
case 'boolean': |
|
|
|
|
value = value === '1'; |
|
|
|
|
break; |
|
|
|
|
case 'color': |
|
|
|
|
$(e.target).siblings('.colorpicker-swatch').css('background-color', value); |
|
|
|
|
} |
|
|
|
|
TempSettings.update({ |
|
|
|
|
_id: this._id |
|
|
|
|
@ -354,6 +355,7 @@ Template.admin.events({ |
|
|
|
|
'change select[name=color-editor]'(e) { |
|
|
|
|
const value = _.trim($(e.target).val()); |
|
|
|
|
TempSettings.update({ _id: this._id }, { $set: { editor: value }}); |
|
|
|
|
RocketChat.settings.collectionPrivate.update({ _id: this._id }, { $set: { editor: value }}); |
|
|
|
|
}, |
|
|
|
|
'click .submit .discard'() { |
|
|
|
|
const group = FlowRouter.getParam('group'); |
|
|
|
|
@ -566,14 +568,16 @@ Template.admin.onRendered(function() { |
|
|
|
|
SideNav.openFlex(); |
|
|
|
|
}); |
|
|
|
|
Tracker.autorun(function() { |
|
|
|
|
const hasColor = TempSettings.findOne({ |
|
|
|
|
const hasColor = TempSettings.find({ |
|
|
|
|
group: FlowRouter.getParam('group'), |
|
|
|
|
type: 'color' |
|
|
|
|
}, { fields: { _id: 1 }}); |
|
|
|
|
}, { fields: { _id: 1, editor: 1 }}).fetch().length; |
|
|
|
|
if (hasColor) { |
|
|
|
|
Meteor.setTimeout(function() { |
|
|
|
|
$('.colorpicker-input').each(function(index, el) { |
|
|
|
|
new jscolor(el); //eslint-disable-line
|
|
|
|
|
if (!el._jscLinkedInstance) { |
|
|
|
|
new jscolor(el); //eslint-disable-line
|
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
}, 400); |
|
|
|
|
} |
|
|
|
|
|