-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
select color attribute (where colors set) #4
- Loading branch information
Showing
15 changed files
with
155 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
<span class="loading-animation hide-on-map-loaded"></span> | ||
<div id="map-container"></div> | ||
<div id="map-control"></div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
define([ | ||
'jquery', 'underscore', 'backbone', | ||
'text!./mapControl.html', | ||
'text!./mapControlColorSelect.html', | ||
], function ( | ||
$, _, Backbone, | ||
template, | ||
templateColorSelect | ||
) { | ||
|
||
return Backbone.View.extend({ | ||
events : { | ||
"change #select-color-attribute" : "colorColumnChanged" | ||
}, | ||
initialize : function () { | ||
|
||
this.render() | ||
this.listenTo(this.model, "change:outColorColumn", this.updateOutColorColumn); | ||
|
||
}, | ||
render: function () { | ||
this.$el.html(_.template(template)({ | ||
t:this.model.getLabels() | ||
})) | ||
return this | ||
}, | ||
update : function(){ | ||
this.$('#color-attribute-selector').html(_.template(templateColorSelect)({ | ||
options:_.map( | ||
_.filter( | ||
this.model.get("columnCollection").models, | ||
function(column){ | ||
return column.get("type") === "ordinal" | ||
|| (column.get("type") === "categorical" && typeof column.getValues().colors !== "undefined") | ||
}), | ||
function(column){ | ||
return { | ||
value:column.id, | ||
label:column.get("title"), | ||
selected:column.get("column") === this.model.getOutColorColumn().get("column") | ||
} | ||
},this) | ||
})) | ||
|
||
}, | ||
updateOutColorColumn:function(){ | ||
// this.views.control.set({outColorColumn:this.model.getOutColorColumn()}) | ||
this.update() | ||
}, | ||
colorColumnChanged:function(e){ | ||
e.preventDefault() | ||
this.$el.trigger('colorColumnChanged',{column:$(e.target).val()}) | ||
}, | ||
|
||
|
||
}); | ||
|
||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#map-control { | ||
position: absolute; | ||
top: 0; | ||
bottom: 0; | ||
right:0; | ||
width: 200px; | ||
overflow-y: auto; | ||
background:white; | ||
z-index: 1000; | ||
display: block; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<div id="map-control-header"> | ||
<h4>Map settings</h4> | ||
</div> | ||
<div id="map-control-marker-control"> | ||
<h5>Map marker</h5> | ||
<p>Select attribute to colour markers by value</p> | ||
<div id="color-attribute-selector"></div> | ||
</div> |
6 changes: 6 additions & 0 deletions
6
app/components/app/out/map/mapControl/mapControlColorSelect.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<select id="select-color-attribute" | ||
class="form-control"> | ||
<% _.each(options,function(option){ %> | ||
<option value="<%= option.value %>" <% if (option.selected) { %>selected<% } %> > <%= option.label %></option> | ||
<% }) %> | ||
</select> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
define([ | ||
'jquery', 'underscore', 'backbone', | ||
'models/ViewModel' | ||
], function($,_, Backbone,ViewModel) { | ||
|
||
return ViewModel.extend({ | ||
initialize : function(options){ | ||
this.options = options || {}; | ||
this.set('expanded',false) | ||
|
||
}, | ||
getOutColorColumn:function(){ | ||
return this.attributes.outColorColumn | ||
}, | ||
}); | ||
|
||
|
||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters