Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
alukach committed Oct 26, 2015
1 parent 3dcf162 commit 10df739
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 25 deletions.
25 changes: 7 additions & 18 deletions src/js/menus.layer-context-menu.dropchop.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,6 @@ var dropchop = (function(dc) {
var geoContainer = $('<div>').addClass('operations-geo');
dc.$elem.append(geoContainer);

// wire up signal handlers
// $(dc).on('layer:selected', dc.menus.layerContextMenu.geoCheck);
// $(dc).on('layer:unselected', dc.menus.layerContextMenu.geoCheck);
// $(dc).on('operation:geo', dc.menus.layerContextMenu.geoExecute);

// Bind the context-menu handler on any item added to layerlist
$(dc).on('layerlist:added', function(e, layer){
$(layer).bind("contextmenu", function(e) {
Expand Down Expand Up @@ -47,7 +42,7 @@ var dropchop = (function(dc) {

e.preventDefault();
});
})
});

// Remove open menus
$('html').bind('click', function (e) {
Expand All @@ -63,27 +58,20 @@ var dropchop = (function(dc) {
dc.menus.layerContextMenu._getMenuOperations = function() {
return {
/* jshint ignore:start */

// TODO: DUPLICATE IN CONTEXT-MENU
'extent': dc.ops.file['extent'],

// TODO: MOVE TO CONTEXT-MENU
'expand': dc.ops.file['expand'],

// TODO: When layer-context-menu supports multiple layers, mv to
// context menu
'combine': dc.ops.file['combine'],

// TODO: MOVE TO CONTEXT-MENU
'rename': dc.ops.file['rename'],
'remove': dc.ops.file['remove'],

/* jshint ignore:end */
}
};
};

/* jshint ignore:start */
/* ignoring these functions in jshint because we are getting
an unecessary strict violation warning, but our usage of `this`
is proper here. */
function _handleBtnClick(event) {
console.log(event);
event.preventDefault();
var operation = $(this).attr('data-operation');
console.log(operation);
Expand All @@ -94,6 +82,7 @@ var dropchop = (function(dc) {
throw err;
}
};
/* jshint ignore:end */

return dc;

Expand Down
10 changes: 3 additions & 7 deletions src/js/menus.left.dropchop.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,13 @@ var dropchop = (function(dc) {
dc.menus.left = dc.menus.left || {};

dc.menus.left.init = function() {
// build ops.geo container
var geoContainer = $('<div>').addClass('operations-geo');
dc.$elem.append(geoContainer);

// wire up signal handlers
$(dc).on('operation:file:load-gist', dc.ops.file['load-gist'].get);
$(dc).on('operation:file:load-url', dc.ops.file['load-url'].get);
$(dc).on('operation:file:load-overpass', dc.ops.file['load-overpass'].get);
$(dc).on('operation:file:rename', dc.ops.file.rename.callback);

dc.ops.setup = [
dc.menus.left.setup = [
{
name: 'import',
icon: '<i class="fa fa-plus"></i>',
Expand Down Expand Up @@ -53,7 +49,7 @@ var dropchop = (function(dc) {

// setup ops file
var leftMenu = $('<div>').addClass('dropchop-menu-left');
var setup = dc.ops.setup;
var setup = dc.menus.left.setup;

for (var i = 0; i < setup.length; i++) {
var action = setup[i];
Expand All @@ -78,7 +74,7 @@ var dropchop = (function(dc) {
// loop through each action and build a button for it, just like above,
// but append it to the menu-collapse-inner element
for (var a = 0; a < setup[i].actions.length; a++) {
var actn = dc.ops.setup[i].actions[a];
var actn = setup[i].actions[a];
collapseInner.append(buildMenuButton(actn));
}
collapseBtn.append(collapseInner);
Expand Down

0 comments on commit 10df739

Please sign in to comment.