Make sure that accounts and tags both can handle locations.

This commit is contained in:
James Cole
2019-12-30 17:43:04 +01:00
parent 7e5d0d455a
commit becab15ab8
13 changed files with 123 additions and 124 deletions

View File

@@ -58,7 +58,7 @@
{# only correct way to do active checkbox #}
{{ ExpandedForm.checkbox('include_net_worth', 1) }}
{{ ExpandedForm.textarea('notes',null,{helpText: trans('firefly.field_supports_markdown')}) }}
{{ ExpandedForm.location('location', null, {locations:locations}) }}
{{ ExpandedForm.location('location', null, {locations: locations}) }}
</div>
</div>

View File

@@ -160,12 +160,12 @@
// location stuff
{% if location %}
var latitude = {{ location.latitude|default("52.3167") }};
var longitude = {{ location.longitude|default("5.5500") }};
var zoomLevel = {{ location.zoom_level|default("6") }};
var doPlaceMarker = true;
// token for Mapbox:
var mapboxToken = "{{ config('firefly.mapbox_api_key') }}";
var latitude = {{ location.latitude|default("52.3167") }};
var longitude = {{ location.longitude|default("5.5500") }};
var zoomLevel = {{ location.zoom_level|default("6") }};
var doPlaceMarker = true;
// token for Mapbox:
var mapboxToken = "{{ config('firefly.mapbox_api_key') }}";
{% endif %}
var showAll = true;

View File

@@ -5,6 +5,11 @@
{% endblock %}
{% block content %}
<!-- set location data high up -->
<script type="text/javascript">
var locations = {{ locations|json_encode|raw }};
var mapboxToken = "{{ config('firefly.mapbox_api_key') }}";
</script>
<form method="POST" action="{{ route('tags.store') }}" accept-charset="UTF-8" class="form-horizontal" id="store">
<input name="_token" type="hidden" value="{{ csrf_token() }}">
<div class="row">
@@ -28,7 +33,7 @@
<div class="box-body">
{{ ExpandedForm.date('date') }}
{{ ExpandedForm.textarea('description') }}
{{ ExpandedForm.location('tag_position') }}
{{ ExpandedForm.location('location', null, {locations: locations}) }}
</div>
</div>
@@ -52,39 +57,6 @@
</form>
{% endblock %}
{% block scripts %}
<script type="text/javascript">
// pre-set latitude:
{% if old('tag_position_latitude') %}
var tag_position_latitude = "{{ old('tag_position_latitude') }}";
{% else %}
var tag_position_latitude = "52.3167";
{% endif %}
// pre-set longitude
{% if old('tag_position_longitude') %}
var tag_position_longitude = "{{ old('tag_position_longitude') }}";
{% else %}
var tag_position_longitude = "5.5500";
{% endif %}
// pre-set zoom level
{% if old('tag_position_zoomlevel') %}
var tag_position_zoomlevel = "{{ old('tag_position_zoomlevel') }}";
{% else %}
var tag_position_zoomlevel = "6";
{% endif %}
// must draw a tag?
{% if old('tag_position_latitude') and old('tag_position_longitude') and old('tag_position_zoomlevel') %}
var tag_position_set_tag = true;
{% else %}
var tag_position_set_tag = false;
{% endif %}
// token for Mapbox:
var mapboxToken = "{{ config('firefly.mapbox_api_key') }}";
</script>
<script src="v1/lib/leaflet/leaflet.js?v={{ FF_VERSION }}"></script>
<script type="text/javascript" src="v1/js/lib/modernizr-custom.js?v={{ FF_VERSION }}"></script>
<script type="text/javascript" src="v1/js/lib/jquery-ui.min.js?v={{ FF_VERSION }}"></script>

View File

@@ -5,6 +5,12 @@
{% endblock %}
{% block content %}
<!-- set location data high up -->
<script type="text/javascript">
var locations = {{ locations|json_encode|raw }};
var mapboxToken = "{{ config('firefly.mapbox_api_key') }}";
</script>
{{ Form.model(tag, {'class' : 'form-horizontal','id' : 'update','url' : route('tags.update',tag.id)}) }}
<input type="hidden" name="id" value="{{ tag.id }}"/>
@@ -30,7 +36,7 @@
<div class="box-body">
{{ ExpandedForm.date('date', tag.date.format('Y-m-d')) }}
{{ ExpandedForm.textarea('description', tag.description) }}
{{ ExpandedForm.location('tag_position') }}
{{ ExpandedForm.location('location', null, {locations: locations}) }}
</div>
</div>
@@ -56,39 +62,6 @@
{% endblock %}
{% block scripts %}
<script type="text/javascript">
// pre-set latitude:
{% if old('tag_position_latitude') %}
var tag_position_latitude = "{{ old('tag_position_latitude') }}";
{% else %}
var tag_position_latitude = {{ tag.latitude|default("52.3167") }};
{% endif %}
// pre-set longitude
{% if old('tag_position_longitude') %}
var tag_position_longitude = "{{ old('tag_position_longitude') }}";
{% else %}
var tag_position_longitude = {{ tag.longitude|default("5.5500") }};
{% endif %}
// pre-set zoom level
{% if old('tag_position_zoomlevel') %}
var tag_position_zoomlevel = "{{ old('tag_position_zoomlevel') }}";
{% else %}
var tag_position_zoomlevel = {{ tag.zoomLevel|default("6") }};
{% endif %}
{% if tag.zoomLevel and tag.longitude and tag.latitude %}
var tag_position_set_tag = true;
{% else %}
var tag_position_set_tag = false;
{% endif %}
// token for Mapbox:
var mapboxToken = "{{ config('firefly.mapbox_api_key') }}";
</script>
<script src="v1/lib/leaflet/leaflet.js?v={{ FF_VERSION }}"></script>
<script type="text/javascript" src="v1/js/lib/modernizr-custom.js?v={{ FF_VERSION }}"></script>
<script type="text/javascript" src="v1/js/lib/jquery-ui.min.js?v={{ FF_VERSION }}"></script>

View File

@@ -102,8 +102,8 @@
</div>
</div>
<div class="box-body">
{% if tag.latitude and tag.longitude and tag.zoomLevel %}
<div id="tag_location_map" style="width:100%;height:300px;"></div>
{% if(location) %}
<div id="location_map" style="width:100%;height:300px;"></div>
{% else %}
<p>{{ 'no_location_set'|_ }}</p>
{% endif %}
@@ -178,19 +178,15 @@
{% endblock %}
{% block scripts %}
<script type="text/javascript">
var latitude = {{ tag.latitude|default("52.3167") }};
var longitude = {{ tag.longitude|default("5.5500") }};
var zoomLevel = {{ tag.zoomLevel|default("6") }};
{% if tag.latitude and tag.longitude and tag.zoomLevel %}
var doPlaceMarker = true;
{% else %}
var doPlaceMarker = false;
// location stuff
{% if location %}
var latitude = {{ location.latitude|default("52.3167") }};
var longitude = {{ location.longitude|default("5.5500") }};
var zoomLevel = {{ location.zoom_level|default("6") }};
var doPlaceMarker = true;
// token for Mapbox:
var mapboxToken = "{{ config('firefly.mapbox_api_key') }}";
{% endif %}
// token for Mapbox:
var mapboxToken = "{{ config('firefly.mapbox_api_key') }}";
</script>
<script src="v1/lib/leaflet/leaflet.js?v={{ FF_VERSION }}"></script>
<script src="v1/js/ff/tags/show.js?v={{ FF_VERSION }}"></script>