Skip to content
Snippets Groups Projects
Commit 36a9c3ad authored by Martin Schoeler's avatar Martin Schoeler Committed by Rodrigo Nascimento
Browse files

Convert ChatOps Package to JavaScript (#6425)

* convert chatops to js

* remove coffe from package
parent f98507dc
No related branches found
No related tags found
No related merge requests found
Showing
with 80 additions and 64 deletions
Meteor.startup ->
console.log('startup hooked')
GoogleMaps.load()
/* globals GoogleMaps */
Meteor.startup(function() {
console.log('startup hooked');
return GoogleMaps.load();
});
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'
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');
}
}
})
);
Template.chatops.helpers
Template.chatops.helpers;
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});";
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});';
}
});
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')
/* 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');
})
);
......@@ -7,7 +7,6 @@ Package.describe({
Package.onUse(function(api) {
api.use([
'coffeescript',
'ecmascript',
'rocketchat:lib',
'dburles:google-maps@1.1.5'
......@@ -16,19 +15,19 @@ Package.onUse(function(api) {
api.use('templating', 'client');
api.addFiles([
'client/startup.coffee',
'client/tabBar.coffee',
'client/startup.js',
'client/tabBar.js',
'client/views/chatops.html',
'client/views/chatops.coffee',
'client/views/chatops.js',
'client/views/codemirror.html',
'client/views/codemirror.coffee',
'client/views/codemirror.js',
'client/views/droneflight.html',
'client/views/droneflight.coffee',
'client/views/droneflight.js',
'client/views/dynamicUI.html',
'client/views/stylesheets/chatops.css'
], 'client');
api.addFiles([
'server/settings.coffee'
'server/settings.js'
], 'server');
});
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 }
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 });
});
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment