Skip to content

Commit

Permalink
Merge branch 'release/0.3.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
Hector Castro committed Jul 26, 2017
2 parents 0ef44a8 + 471289a commit e9e8481
Show file tree
Hide file tree
Showing 47 changed files with 985 additions and 1,009 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# bee-pollinator

## URLs

Staging: https://staging.app.pollinationmapper.org

Production: https://app.pollinationmapper.org

## Local Development

A combination of Vagrant 1.6+ and Ansible 1.8+ is used to setup the development environment for this project. The project consists of the following virtual machines:
Expand Down
2 changes: 1 addition & 1 deletion deployment/ansible/group_vars/all
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ nodejs_npm_version: 2.1.17

apache_version: "2.4.7-*"

java_version: "7u121-*"
java_version: "7u131-*"

graphite_carbon_version: "0.9.13-pre1"
graphite_whisper_version: "0.9.13-pre1"
Expand Down
2 changes: 1 addition & 1 deletion src/icp/apps/core/templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<html lang="en">
<head>
{% block metatitle %}
<title>Pollination Mapper</title>
<title>Pollination Mapper - BETA</title>
{% endblock metatitle %}
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
Expand Down
18 changes: 11 additions & 7 deletions src/icp/bundle.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ STATIC_CSS_DIR="${DJANGO_STATIC_ROOT}css/"
STATIC_IMAGES_DIR="${DJANGO_STATIC_ROOT}images/"
STATIC_FONTS_DIR="${DJANGO_STATIC_ROOT}fonts/"

# The hopscotch css src looks for images in "../img"
HOPSCOTCH_IMAGES_SYMLINK="${DJANGO_STATIC_ROOT}img"

BROWSERIFY="$BIN/browserify"
ENTRY_JS_FILES="./js/src/main.js"

Expand Down Expand Up @@ -85,33 +88,35 @@ COPY_IMAGES_COMMAND="cp -r \
./img/* \
./node_modules/leaflet/dist/images/* \
./node_modules/leaflet-draw/dist/images/* \
./node_modules/hopscotch/dist/img/* \
$STATIC_IMAGES_DIR"

COPY_FONTS_COMMAND="cp -r \
./node_modules/font-awesome/fonts/* \
$STATIC_FONTS_DIR"

COPY_ZEROCLIPBOARD_COMMAND="cp \
./node_modules/zeroclipboard/dist/ZeroClipboard.swf \
$STATIC_JS_DIR"

CONCAT_VENDOR_CSS_COMMAND="cat \
./node_modules/leaflet/dist/leaflet.css \
./node_modules/leaflet-draw/dist/leaflet.draw.css \
./node_modules/font-awesome/css/font-awesome.min.css \
./node_modules/bootstrap-table/dist/bootstrap-table.min.css \
./node_modules/hopscotch/dist/css/hopscotch.min.css \
./css/shim/nv.d3.min.css \
> $VENDOR_CSS_FILE"

SYMLINK_HOPSCOTCH_IMG_DIR_COMMAND="ln -s $STATIC_IMAGES_DIR $HOPSCOTCH_IMAGES_SYMLINK"

JS_DEPS=(backbone
backbone.marionette
blueimp-md5
bootstrap
bootstrap-select
bootstrap-table/dist/bootstrap-table.js
clipboard
d3
./js/shim/marionette.transition-region.js
./js/shim/nv.d3.js
hopscotch
jquery
leaflet
leaflet-draw
Expand All @@ -125,8 +130,7 @@ JS_DEPS=(backbone
turf-erase
turf-intersect
turf-kinks
underscore
zeroclipboard)
underscore)

BROWSERIFY_EXT=""
BROWSERIFY_REQ=""
Expand All @@ -150,8 +154,8 @@ if [ -n "$BUILD_VENDOR_BUNDLE" ]; then
VENDOR_COMMAND="
$COPY_IMAGES_COMMAND &
$COPY_FONTS_COMMAND &
$COPY_ZEROCLIPBOARD_COMMAND &
$CONCAT_VENDOR_CSS_COMMAND &
$SYMLINK_HOPSCOTCH_IMG_DIR_COMMAND &
$BROWSERIFY $BROWSERIFY_REQ \
-o ${STATIC_JS_DIR}vendor.js $EXTRA_ARGS &
$BROWSERIFY $BROWSERIFY_REQ $BROWSERIFY_TEST_REQ \
Expand Down
7 changes: 6 additions & 1 deletion src/icp/js/src/compare/controllers.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
"use strict";

var App = require('../app'),
var hopscotch = require('hopscotch'),
App = require('../app'),
router = require('../router').router,
views = require('./views'),
tours = require('./tours'),
modelingModels = require('../modeling/models.js');

var CompareController = {
Expand Down Expand Up @@ -35,6 +37,8 @@ var CompareController = {
}

App.rootView.footerRegion.empty();

hopscotch.endTour();
}
};

Expand Down Expand Up @@ -65,6 +69,7 @@ function showCompareWindow() {
model: App.currentProject
});
App.rootView.footerRegion.show(compareWindow);
tours.compareTour.showTourIfNecessary();
}

module.exports = {
Expand Down
2 changes: 1 addition & 1 deletion src/icp/js/src/compare/templates/compareModeling.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ <h3>Model Output</h3>
{% if polling %}
<i class="fa fa-circle-o-notch fa-spin"></i>
{% endif %}
<div class="pull-right">
<div class="pull-right" id="compare-crop-dropdown">
<select class="form-control btn btn-small btn-primary">
<option value="all">All Crops</option>
{% for crop in chartableCrops %}
Expand Down
2 changes: 1 addition & 1 deletion src/icp/js/src/compare/templates/compareWindow.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<div id="compare-scenarios-region"></div>
<div id="compare-footer">
<div class="back"> <!-- Back -->
<div id="back-to-model" class="back"> <!-- Back -->
<a data-url="/project" class="btn btn-md btn-icon">
<i class="fa fa-arrow-left"></i>
<h3 class="back-text">Go Back</h3>
Expand Down
33 changes: 33 additions & 0 deletions src/icp/js/src/compare/tours.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
"use strict";

var createTour = require('../core/createTour');

var compareTour = createTour(
{
id: "compare-tour",
steps: [
{
target: "compare-crop-dropdown",
content: "Use drop down menus to view one crop at a time.",
placement: "bottom",
},
{
target: "slide-controls",
content: "Use these arrows to scroll through your scenarios.",
placement: "top",
arrowOffset: 250,
xOffset: -230,
},
{
target: "back-to-model",
content: "Click here to return to the scenario tab.",
placement: "top",
xOffset: 40,
},
]
}
);

module.exports = {
compareTour: compareTour,
};
72 changes: 72 additions & 0 deletions src/icp/js/src/core/createTour.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
"use strict";

var _ = require('lodash'),
hopscotch = require('hopscotch'),
App = require('../app'),
modelingModels = require('../modeling/models');

var Tour = {
getStatus: function() {
var step = localStorage.getItem(this.id);
return step !== null ? parseInt(step) : null;
},

shouldResume: function() {
return localStorage.getItem(this.id) < this.steps.length;
},

showTour: function() {
if (hopscotch.getState()) {
hopscotch.endTour();
}

var step = this.getStatus();
if (step === null) {
hopscotch.startTour(this);
} else if (this.shouldResume()) {
hopscotch.startTour(this, step);
}
},

showTourIfNecessary: function() {
if (App.user.get('guest')) {
this.showTour();
} else {
var projects = new modelingModels.ProjectCollection();
projects
.fetch()
.done(_.bind(function() {
if (projects.length > 1) {
// Assume if the user has more than one project,
// they don't need to see the tour
return;
}

this.showTour();
}, this));
}
},

initTour: function() {
localStorage.setItem(this.id, 0);
},

incrementStep: function() {
localStorage.setItem(this.id, hopscotch.getCurrStepNum());
},

finishTour: function() {
localStorage.setItem(this.id, this.steps.length);
},
};

module.exports = function createTour(tour) {
var tourObject = _.assign(Object.create(Tour), tour);

// Make sure the hopscotch callbacks bind to the tour object
tourObject.onStart = _.bind(tourObject.initTour, tourObject);
tourObject.onNext = _.bind(tourObject.incrementStep, tourObject);
tourObject.onEnd = _.bind(tourObject.finishTour, tourObject);
tourObject.onClose = _.bind(tourObject.finishTour, tourObject);
return tourObject;
};
48 changes: 24 additions & 24 deletions src/icp/js/src/core/cropTypes.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,52 +3,52 @@
"10":"Alfalfa",
"11":"Grassland/Pasture",
"12":"Buckwheat",
"13":"Root Vegs",
"14":"Solanums",
"15":"Other Crops",
"16":"Vegs & Fruits",
"13":"Root Vegetables",
"14":"Solanum Crops",
"15":"Crops (other)",
"16":"Misc. Vegetables and Fruits",
"17":"Watermelons",
"18":"Melons",
"19":"Vegs",
"19":"Vegetables (other)",
"2":"Cotton",
"20":"Berries",
"20":"Berries (Other)",
"21":"Wildflowers",
"22":"Grass",
"23":"Idle Crops",
"24":"Mixed Forest",
"22":"Grass Crops",
"23":"Fallow",
"24":"Forest (mixed)",
"25":"Shrubland",
"26":"Barren",
"27":"Cherries",
"28":"Orchard",
"28":"Tree Fruit (other)",
"29":"Apples",
"3":"Grains",
"30":"Grapes",
"31":"Christmas Trees",
"32":"Tree Crops",
"32":"Tree Crops (other)",
"33":"Citrus",
"34":"Nuts",
"34":"Nuts (other)",
"35":"Almonds",
"36":"Open Water",
"37":"Wetlands",
"38":"Developed/Open Space",
"39":"Developed/Low Intensity",
"37":"Wetlands (other)",
"38":"Developed (open space)",
"39":"Developed (low intensity)",
"4":"Beans",
"40":"Developed/Med Intensity",
"41":"Developed/High Intensity",
"42":"Deciduous Forest",
"43":"Evergreen Forest",
"44":"Woody Wetlands",
"45":"Herbaceous Wetlands",
"40":"Developed (medium intensity)",
"41":"Developed (high intensity)",
"42":"Forest (deciduous)",
"43":"Forest (evergreen)",
"44":"Wetland (woody)",
"45":"Wetlands (herbaceous)",
"46":"Asparagus",
"47":"Olives",
"48":"Strawberries",
"49":"Cucurbits",
"5":"Flowers",
"49":"Cucurbits (other)",
"5":"Flower Crops",
"50":"Pumpkins",
"51":"Blueberries",
"52":"Raspberry",
"6":"Tobacco",
"7":"Herbs",
"8":"Dbl Crop",
"8":"Double Crop",
"9":"Oilseed"
}
4 changes: 2 additions & 2 deletions src/icp/js/src/core/modals/templates/shareModal.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ <h2>Share {{ text }}</h2>
<p>Sorry, only saved {{ text }}s are able to be shared. Please log in to share your work.</p>
{% else %}
<div class="custom-input-group">
<input type="text" required value="{{ url }}">
<input id="share-url" type="text" required value="{{ url }}">
<span class="highlight"></span>
<span class="bar"></span>
<label>URL</label>
Expand All @@ -21,7 +21,7 @@ <h2>Share {{ text }}</h2>
<button type="button" class="btn btn-md btn-default signin" data-dismiss="modal">Sign In</button>
{% else %}
<button type="button" class="btn btn-md btn-default" data-dismiss="modal">Cancel</button>
<button type="button" class="btn btn-md btn-default copy" data-dismiss="modal" data-clipboard-text="{{ url }}">Copy Link</button>
<button type="button" class="btn btn-md btn-default copy" data-dismiss="modal" data-clipboard-target="#share-url">Copy Link</button>
{% endif %}
</div>
</div>
Expand Down
10 changes: 3 additions & 7 deletions src/icp/js/src/core/modals/views.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
var _ = require('underscore'),
coreUtils = require('../utils.js'),
Marionette = require('../../../shim/backbone.marionette'),
ZeroClipboard = require('zeroclipboard'),
Clipboard = require('clipboard'),
models = require('./models'),
modalConfirmTmpl = require('./templates/confirmModal.html'),
modalInputTmpl = require('./templates/inputModal.html'),
Expand Down Expand Up @@ -167,16 +167,12 @@ var ShareView = ModalBaseView.extend({
'click @ui.signin': 'signIn'
}, ModalBaseView.prototype.events),

initialize: function() {
this.zc = new ZeroClipboard();
},

// Override to attach ZeroClipboard to ui.copy button
// Override to attach Clipboard to ui.copy button
onRender: function() {
var self = this;

this.$el.on('shown.bs.modal', function() {
self.zc.clip(self.ui.copy);
new Clipboard(self.ui.copy[0]);
});

if (this.model.get('is_private')) {
Expand Down
4 changes: 2 additions & 2 deletions src/icp/js/src/core/modificationConfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,11 @@
"woody": {
"value": 61,
"name": "Woody",
"summary": "Flowering shrub and tree planting designed to provide bees with pollen, nectar, and ground and tunnel nesting sites."
"summary": "Flowering shrub and tree planting, such as hedgerows or riparian plantings, designed to provide bees with pollen, nectar, and ground and tunnel nesting sites."
},
"wildflower_woody_mix": {
"value": 62,
"name": "Wildflower-Woody Mix",
"summary": "Wildflower, flowering shrub, and tree planting designed to provide bees with pollen, nectar, and ground and tunnel nesting sites."
"summary": "Wildflower, flowering shrub, and tree planting, such as a hedgerow with a wildflower understory, designed to provide bees with pollen, nectar, and ground and tunnel nesting sites."
},
}
6 changes: 0 additions & 6 deletions src/icp/js/src/core/setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,3 @@ L.Icon.Default.imagePath = '/static/images/';

var csrf = require('./csrf');
$.ajaxSetup(csrf.jqueryAjaxSetupOptions);

var ZeroClipboard = require('zeroclipboard');
ZeroClipboard.config({
hoverClass: 'focus',
activeClass: 'active'
});
Loading

0 comments on commit e9e8481

Please sign in to comment.