Skip to content
Commits on Source (2)
...@@ -19,8 +19,8 @@ def search(): ...@@ -19,8 +19,8 @@ def search():
Provide the search page. Provide the search page.
""" """
marks = config.db.query_fetchall( "SELECT * FROM mark_info" ) marks = config.db.query_fetchall( "SELECT * FROM mark_info" )
all_detection_technics = config.db.query_fetchall( "SELECT * FROM detection_technics" ) all_detection_technics = config.db.query_fetchall( "SELECT * FROM detection_technics ORDER BY name ASC" )
surfaces = config.db.query_fetchall( "SELECT * FROM surfaces" ) surfaces = config.db.query_fetchall( "SELECT * FROM surfaces ORDER BY name ASC" )
for _, v in enumerate( marks ): for _, v in enumerate( marks ):
for col in [ "detection_technic", "surface" ]: for col in [ "detection_technic", "surface" ]:
......
...@@ -50,6 +50,14 @@ ...@@ -50,6 +50,14 @@
grid-column-gap: 20px; grid-column-gap: 20px;
grid-template-columns: auto 1fr; grid-template-columns: auto 1fr;
} }
.icnml_search_filters {
margin-bottom: 20px;
display: grid;
grid-gap 5px;
grid-column-gap: 20px;
grid-template-columns: auto 1fr;
}
</style> </style>
<script type="text/javascript"> <script type="text/javascript">
...@@ -58,6 +66,7 @@ ...@@ -58,6 +66,7 @@
var marks = {}; var marks = {};
{% for mark in marks %} {% for mark in marks %}
marks[ "{{ mark[ 'uuid' ] }}" ] = { marks[ "{{ mark[ 'uuid' ] }}" ] = {
"uuid": "{{ mark[ 'uuid' ] }}",
"id": "{{ mark[ 'id' ] }}", "id": "{{ mark[ 'id' ] }}",
"pfsp": "{{ mark[ 'pfsp' ] }}".split( "," ), "pfsp": "{{ mark[ 'pfsp' ] }}".split( "," ),
"dt": "{{ mark[ 'detection_technic' ] }}".split( "," ), "dt": "{{ mark[ 'detection_technic' ] }}".split( "," ),
...@@ -74,6 +83,25 @@ ...@@ -74,6 +83,25 @@
{% for dt in all_detection_technics %} {% for dt in all_detection_technics %}
all_detection_technics[ "{{ dt[ 'id' ] }}" ] = "{{ dt[ 'name' ] }}"; all_detection_technics[ "{{ dt[ 'id' ] }}" ] = "{{ dt[ 'name' ] }}";
{% endfor %} {% endfor %}
var update_filter_detection = function( arg )
{
var selected = $( this ).val();
_.forEach( marks, function( m ){
var tmp = [];
_.forEach( selected, function( s ) {
tmp.push( m[ "dt" ].indexOf( s ) );
} );
if( Math.max( ...tmp ) != -1 )
{
$( "#outer_div_mark_" + m[ "uuid" ] ).show();
} else {
$( "#outer_div_mark_" + m[ "uuid" ] ).hide();
}
} );
}
</script> </script>
</head> </head>
<body class="icnml_main_layout"> <body class="icnml_main_layout">
...@@ -81,6 +109,18 @@ ...@@ -81,6 +109,18 @@
{% include navigation %} {% include navigation %}
<div class="icnml_content"> <div class="icnml_content">
<div class="icnml_search_filters">
<div style="padding-top:5px; padding-bottom: 5px;">Detection technic</div>
<div id="filter_detection">
<select multiple id="filter_detection_select" data-placeholder="click to select the detection technic..." class="chosen-select">
{% for dt in all_detection_technics %}
<option value="{{ dt[ 'id' ] }}">{{ dt[ 'name' ] }}</option>
{% endfor %}
</select>
</div>
</div>
<div>
{% for mark in marks %} {% for mark in marks %}
<div id="outer_div_mark_{{ mark[ 'uuid' ] }}" class="mark_outer"> <div id="outer_div_mark_{{ mark[ 'uuid' ] }}" class="mark_outer">
<div class="icnml_img"> <div class="icnml_img">
...@@ -107,6 +147,7 @@ ...@@ -107,6 +147,7 @@
</div> </div>
{% endfor %} {% endfor %}
</div> </div>
</div>
<script type="text/javascript"> <script type="text/javascript">
{% for mark in marks %} {% for mark in marks %}
...@@ -131,6 +172,11 @@ ...@@ -131,6 +172,11 @@
{% endfor %} {% endfor %}
$( "#filter_detection_select" ).chosen( {
search_contains: true,
width: "100%"
} ).change( update_filter_detection );
$( "#icnml_navigation_trainersearch" ) $( "#icnml_navigation_trainersearch" )
.addClass( "activated" ); .addClass( "activated" );
</script> </script>
......