From f90d0e6159de8bd80eb2fe504585fbf9a78dda7f Mon Sep 17 00:00:00 2001 From: Yohan Boniface <yb@enix.org> Date: Tue, 22 Jan 2013 22:39:25 +0100 Subject: [PATCH] Handle path styling options See https://github.com/yohanboniface/Leaflet.Storage/issues/26 --- umap/static/umap/umap.css | 26 +++++++++++++++++++++++ umap/templates/base.html | 13 ++++++++++++ umap/templates/umap/styles_fieldset.html | 27 ++++++++++++++++++++---- 3 files changed, 62 insertions(+), 4 deletions(-) diff --git a/umap/static/umap/umap.css b/umap/static/umap/umap.css index e4adfcc..fffb563 100644 --- a/umap/static/umap/umap.css +++ b/umap/static/umap/umap.css @@ -80,6 +80,32 @@ input:-moz-placeholder, :-moz-placeholder { background-color: #970b0e; } +#style_options > * { + display: none; +} + +#style_options .more_style_options, +#style_options legend { + display: block; + cursor: pointer; +} +#style_options .more_style_options:before { + content: "…"; +} +#style_options legend:before { + content: "▶"; + padding-right: 5px; +} +#style_options.on legend:before { + content: "▼"; +} +#style_options.on > * { + display: block; +} +#style_options.on .more_style_options { + display: none; +} + /* Map infos */ .category_color { display: inline-block; diff --git a/umap/templates/base.html b/umap/templates/base.html index f46ebd9..d341456 100644 --- a/umap/templates/base.html +++ b/umap/templates/base.html @@ -45,6 +45,19 @@ {% endcompress js %} {% block bottom_js %} <script src="{{ STATIC_URL }}storage/contrib/js/storage.ui.default.js"></script> + <script type="text/javascript"> + function fn (e) { + var styleDiv = L.DomUtil.get("style_options"); + if (L.DomUtil.hasClass(styleDiv, "on")) { + L.DomUtil.removeClass(styleDiv, "on"); + } + else { + L.DomUtil.addClass(styleDiv, "on"); + } + } + $(document).on('click', '#style_options_toggle', fn); + $(document).on('click', '.more_style_options', fn); + </script> {% endblock %} <div id="storage-ui-container"></div> <div id="storage-alert-container"></div> diff --git a/umap/templates/umap/styles_fieldset.html b/umap/templates/umap/styles_fieldset.html index b905773..a494a5c 100644 --- a/umap/templates/umap/styles_fieldset.html +++ b/umap/templates/umap/styles_fieldset.html @@ -1,7 +1,8 @@ {% load umap_tags i18n %} -<fieldset> - <legend>{% trans "Styles" %}</legend> - {% foundation_field form.color %} +<fieldset id="style_options"> + <legend id="style_options_toggle">{% trans "Styles options" %}</legend> + <label class="more_style_options"></label> + {% foundation_field form.options_color %} {% if form.icon_class and form.pictogram %} <div class="formbox columns twelve"> <div class="six columns"> @@ -12,4 +13,22 @@ </div> </div> {% endif %} -</fieldset> + {% foundation_field form.options_weight %} + {% if form.options_stroke %} + <div class="formbox"> + <span>{{ form.options_stroke.label }}</span>{{ form.options_stroke }} + </div> + <small class="help-text">{{ form.options_stroke.help_text }}</small> + {% endif %} + {% foundation_field form.options_smoothFactor %} + {% foundation_field form.options_opacity %} + {% if form.options_fill %} + <div class="formbox"> + <span>{{ form.options_fill.label }}</span>{{ form.options_fill }} + </div> + <small class="help-text">{{ form.options_fill.help_text }}</small> + {% endif %} + {% foundation_field form.options_fillOpacity %} + {% foundation_field form.options_fillColor %} + {% foundation_field form.options_dashArray %} +</fieldset> \ No newline at end of file -- GitLab