Skip to content
Snippets Groups Projects
Commit 694ea5a4 authored by Marco De Donno's avatar Marco De Donno
Browse files

Refactoring the general pattern generation

parent 8f77b0dc
No related branches found
No related tags found
No related merge requests found
......@@ -109,10 +109,10 @@
<div>General pattern</div>
<div id="general_pattern">
{% macro gp_div( gp_name ) %}
<div class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" id="general_pattern_{{ gp_name }}">
{% macro gp_div( gp_id, gp_name ) %}
<div class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" id="general_pattern_{{ gp_id }}">
<span class="ui-button-text">{{ gp_name|title }}</span>
<div class="gp_checked" id="gp_{{ gp_name }}_checked">
<div class="gp_checked" id="gp_{{ gp_id }}_checked">
<svg width="20px" height="20px" viewBox="0 0 54 54" version="1.1">
<g id="" fill-rule="evenodd">
<path
......@@ -126,10 +126,10 @@
</div>
{% endmacro %}
{{ gp_div( 'loop' ) }}
{{ gp_div( 'whorl' ) }}
{{ gp_div( 'arch' ) }}
{{ gp_div( 'unknown' ) }}
{{ gp_div( 'loop', 'loop' ) }}
{{ gp_div( 'whorl', 'whorl' ) }}
{{ gp_div( 'arch', 'arch' ) }}
{{ gp_div( 'unknown', 'unknown' ) }}
</div>
{% endif %}
......@@ -151,24 +151,19 @@
/*
* General pattern buttons
*/
$( '#general_pattern_loop' ).on( 'click', function()
{
update_general_pattern_db( 'loop' );
} );
$( '#general_pattern_whorl' ).on( 'click', function()
{
update_general_pattern_db( 'whorl' );
} );
$( '#general_pattern_arch' ).on( 'click', function()
{
update_general_pattern_db( 'arch' );
} );
$( '#general_pattern_arch' ).on( 'click', function()
{
update_general_pattern_db( 'arch' );
} );
{% macro gp_action( id ) %}
$( '#general_pattern_{{ id }}' ).on( 'click', function()
{
update_general_pattern_db( '{{ id }}' );
} );
{% endmacro %}
{{ gp_action( 'loop' ) }}
{{ gp_action( 'whorl' ) }}
{{ gp_action( 'arch' ) }}
{{ gp_action( 'unknown' ) }}
//
$( "#gp_{{ current_gp }}_checked" ).css( "visibility", "visible" );
/*
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment