Convert ChatOps Package to JavaScript (#6425)

* convert chatops to js

* remove coffe from package
pull/6430/head
Martin Schoeler 8 years ago committed by Rodrigo Nascimento
parent f98507dc68
commit 36a9c3ad8d
  1. 3
      packages/rocketchat-chatops/client/startup.coffee
  2. 5
      packages/rocketchat-chatops/client/startup.js
  3. 24
      packages/rocketchat-chatops/client/tabBar.coffee
  4. 31
      packages/rocketchat-chatops/client/tabBar.js
  5. 1
      packages/rocketchat-chatops/client/views/chatops.coffee
  6. 1
      packages/rocketchat-chatops/client/views/chatops.js
  7. 7
      packages/rocketchat-chatops/client/views/codemirror.coffee
  8. 9
      packages/rocketchat-chatops/client/views/codemirror.js
  9. 18
      packages/rocketchat-chatops/client/views/droneflight.coffee
  10. 23
      packages/rocketchat-chatops/client/views/droneflight.js
  11. 13
      packages/rocketchat-chatops/package.js
  12. 4
      packages/rocketchat-chatops/server/settings.coffee
  13. 5
      packages/rocketchat-chatops/server/settings.js

@ -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,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');
})
);

@ -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');
});

@ -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…
Cancel
Save