Convert ChatOps Package to JavaScript (#6425)
* convert chatops to js * remove coffe from packagepull/6430/head
parent
f98507dc68
commit
36a9c3ad8d
@ -1,3 +0,0 @@ |
||||
Meteor.startup -> |
||||
console.log('startup hooked') |
||||
GoogleMaps.load() |
@ -0,0 +1,5 @@ |
||||
/* globals GoogleMaps */ |
||||
Meteor.startup(function() { |
||||
console.log('startup hooked'); |
||||
return GoogleMaps.load(); |
||||
}); |
@ -1,24 +0,0 @@ |
||||
Meteor.startup -> |
||||
Tracker.autorun -> |
||||
if RocketChat.settings.get('Chatops_Enabled') |
||||
console.log 'Adding chatops to tabbar' |
||||
RocketChat.TabBar.addButton |
||||
groups: ['channel', 'group', 'direct'] |
||||
id: 'chatops-button2' |
||||
i18nTitle: 'rocketchat-chatops:Chatops_Title' |
||||
icon: 'icon-hubot' |
||||
template: 'chatops-dynamicUI' |
||||
order: 4 |
||||
|
||||
console.log 'Adding chatops to tabbar' |
||||
RocketChat.TabBar.addButton |
||||
groups: ['channel', 'group', 'direct'] |
||||
id: 'chatops-button3' |
||||
i18nTitle: 'rocketchat-chatops:Chatops_Title' |
||||
icon: 'icon-inbox' |
||||
template: 'chatops_droneflight' |
||||
width: 675 |
||||
order: 5 |
||||
else |
||||
RocketChat.TabBar.removeButton 'chatops-button2' |
||||
RocketChat.TabBar.removeButton 'chatops-button3' |
@ -0,0 +1,31 @@ |
||||
Meteor.startup(() => |
||||
Tracker.autorun(function() { |
||||
if (RocketChat.TabBar) { |
||||
if (RocketChat.settings && RocketChat.settings.get('Chatops_Enabled')) { |
||||
console.log('Adding chatops to tabbar'); |
||||
RocketChat.TabBar.addButton({ |
||||
groups: ['channel', 'group', 'direct'], |
||||
id: 'chatops-button2', |
||||
i18nTitle: 'rocketchat-chatops:Chatops_Title', |
||||
icon: 'icon-hubot', |
||||
template: 'chatops-dynamicUI', |
||||
order: 4 |
||||
}); |
||||
|
||||
console.log('Adding chatops to tabbar'); |
||||
return RocketChat.TabBar.addButton({ |
||||
groups: ['channel', 'group', 'direct'], |
||||
id: 'chatops-button3', |
||||
i18nTitle: 'rocketchat-chatops:Chatops_Title', |
||||
icon: 'icon-inbox', |
||||
template: 'chatops_droneflight', |
||||
width: 675, |
||||
order: 5 |
||||
}); |
||||
} else { |
||||
RocketChat.TabBar.removeButton('chatops-button2'); |
||||
return RocketChat.TabBar.removeButton('chatops-button3'); |
||||
} |
||||
} |
||||
}) |
||||
); |
@ -1 +0,0 @@ |
||||
Template.chatops.helpers |
@ -0,0 +1 @@ |
||||
Template.chatops.helpers; |
@ -1,7 +0,0 @@ |
||||
Template.chatops_codemirror.helpers |
||||
editorOptions: -> |
||||
return {lineNumbers: true, mode:"javascript"} |
||||
|
||||
editorCode: -> |
||||
return "# This is a full featured, syntax highlighted editor\n# BOTs can fetch, edit, commit, and save source code\n#\n\nvar express = require('express');\nvar app = express();\n// respond with \"hello world\" when a GET request is made to the homepage |
||||
+\napp.get('/', function(req, res) {\nres.send('hello world');\n});"; |
@ -0,0 +1,9 @@ |
||||
Template.chatops_codemirror.helpers({ |
||||
editorOptions() { |
||||
return {lineNumbers: true, mode:'javascript'}; |
||||
}, |
||||
|
||||
editorCode() { |
||||
return '# This is a full featured, syntax highlighted editor\n# BOTs can fetch, edit, commit, and save source code\n#\n\nvar express = require("express");\nvar app = express();\n// respond with \"hello world\" when a GET request is made to the homepage \ +\napp.get("/", function(req, res) {\nres.send("hello world");\n});'; |
||||
} |
||||
}); |
@ -1,18 +0,0 @@ |
||||
|
||||
Template.chatops_droneflight.helpers |
||||
flightMapOptions: -> |
||||
if GoogleMaps.loaded() |
||||
console.log('helper run') |
||||
return {center: new google.maps.LatLng(35.6609285,-78.8456125), zoom: 17} |
||||
|
||||
|
||||
Template.chatops_droneflight.onCreated () -> |
||||
GoogleMaps.ready 'flightMap', (map) -> |
||||
console.log('ready') |
||||
redicon = { path: google.maps.SymbolPath.CIRCLE, fillColor: "red", fillOpacity: 0.8, strokeColor: "gold", strokeWeight: 2, scale: 10} |
||||
greenicon = {path: google.maps.SymbolPath.CIRCLE, fillColor: "green", fillOpacity: 0.8, strokeColor: "gold", strokeWeight: 2, scale: 10} |
||||
|
||||
marker = new google.maps.Marker({position: new google.maps.LatLng(35.661848,-78.843165), icon: redicon, map: map.instance}) |
||||
marker.setLabel('1') |
||||
marker2 = new google.maps.Marker({position: new google.maps.LatLng(35.660537,-78.846959), icon: greenicon, map: map.instance}) |
||||
marker2.setLabel('2') |
@ -0,0 +1,23 @@ |
||||
/* globals GoogleMaps google*/ |
||||
Template.chatops_droneflight.helpers({ |
||||
flightMapOptions() { |
||||
if (GoogleMaps.loaded()) { |
||||
console.log('helper run'); |
||||
return {center: new google.maps.LatLng(35.6609285, -78.8456125), zoom: 17}; |
||||
} |
||||
} |
||||
}); |
||||
|
||||
|
||||
Template.chatops_droneflight.onCreated(() => |
||||
GoogleMaps.ready('flightMap', function(map) { |
||||
console.log('ready'); |
||||
const redicon = { path: google.maps.SymbolPath.CIRCLE, fillColor: 'red', fillOpacity: 0.8, strokeColor: 'gold', strokeWeight: 2, scale: 10}; |
||||
const greenicon = {path: google.maps.SymbolPath.CIRCLE, fillColor: 'green', fillOpacity: 0.8, strokeColor: 'gold', strokeWeight: 2, scale: 10}; |
||||
|
||||
const marker = new google.maps.Marker({position: new google.maps.LatLng(35.661848, -78.843165), icon: redicon, map: map.instance}); |
||||
marker.setLabel('1'); |
||||
const marker2 = new google.maps.Marker({position: new google.maps.LatLng(35.660537, -78.846959), icon: greenicon, map: map.instance}); |
||||
return marker2.setLabel('2'); |
||||
}) |
||||
); |
@ -1,4 +0,0 @@ |
||||
Meteor.startup -> |
||||
RocketChat.settings.addGroup 'Chatops' |
||||
RocketChat.settings.add 'Chatops_Enabled', false, { type: 'boolean', group: 'Chatops', public: true } |
||||
RocketChat.settings.add 'Chatops_Username', false, { type: 'string', group: 'Chatops', public: true } |
@ -0,0 +1,5 @@ |
||||
Meteor.startup(function() { |
||||
RocketChat.settings.addGroup('Chatops'); |
||||
RocketChat.settings.add('Chatops_Enabled', false, { type: 'boolean', group: 'Chatops', public: true }); |
||||
return RocketChat.settings.add('Chatops_Username', false, { type: 'string', group: 'Chatops', public: true }); |
||||
}); |
Loading…
Reference in new issue