File tree 5 files changed +47
-6
lines changed
5 files changed +47
-6
lines changed Original file line number Diff line number Diff line change 9
9
{%- assign thumb_base = "" -%}
10
10
{%- assign thumb = "/images/asset-nothumb.jpg" -%}
11
11
{%- endif -%}
12
- < div class ='asset clickable left light-text compact {{ asset.tags | join: "%%" | replace: " ", "" | split: "%%" | join: " " | downcase }} '>
12
+ < div class ='asset clickable left light-text compact {{ asset.tags | join: "%%" | replace: " ", "" | split: "%%" | join: " " | downcase }} ' data-name =" {{ asset.name }} " data-description =" {{ asset.description }} " >
13
13
< a href ="/assets/{{ include.id }} ">
14
14
< div id ="image " style ="background: url('{{thumb_base}}{{ thumb }}') center/cover; padding: 0; margin: 0; height: 190px ">
15
15
</ div >
Original file line number Diff line number Diff line change 2
2
3
3
< div class ="row ">
4
4
< h4 > {{ include.title }}</ h4 >
5
+
6
+ < input id ="search " class ="assetsearch " type ="text " placeholder ="Type to filter... "/>
7
+ < script type ="text/javascript ">
8
+ const search = document . getElementById ( 'search' ) ;
9
+ const inputHandler = function ( e ) {
10
+ const assets = document . getElementsByClassName ( "asset" ) ;
11
+ const searchFor = e . target . value . toLowerCase ( ) ;
12
+ for ( var i = 0 ; i < assets . length ; i ++ ) {
13
+ const asset = assets [ i ] ;
14
+ const name = asset . dataset . name . toString ( ) . toLowerCase ( ) ;
15
+ const description = asset . dataset . description . toString ( ) . toLowerCase ( ) ;
16
+ const visible = ( searchFor == "" || name . indexOf ( searchFor ) != - 1 || description . indexOf ( searchFor ) != - 1 ) ;
17
+ asset . style . display = visible ? "block" : "none" ;
18
+ } ;
19
+ }
20
+ search . addEventListener ( 'input' , inputHandler ) ;
21
+ search . addEventListener ( 'propertychange' , inputHandler ) ; // for IE8
22
+ </ script >
23
+
5
24
< div style ="display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); grid-gap: 2rem; padding: 0px; ">
6
25
{%- for id in assetids -%}
7
26
{% include asset.html id=id %}
Original file line number Diff line number Diff line change 1
1
< div class ="row compact " style ="margin-bottom: 30px ">
2
2
{%- assign alltags = site.data.assetindex | map: "tags" -%}
3
3
{%- assign tags = alltags | uniq | sort -%}
4
- < p > FILTER </ p >
4
+ < p > TAGS </ p >
5
5
< div style ="display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); grid-gap: 0 1rem; font-size: 0.9em; ">
6
6
{%- if include.tag -%}
7
7
{%- assign class="" -%}
20
20
< a class ="filter {{ class }} " href ="/tags/{{ include.sort }}/{{ tag | replace: ' ' | downcase }} "> {{ tag }} ({{ tagged_assets.size }})</ a >
21
21
{%- endfor -%}
22
22
</ div >
23
+
23
24
< br />
24
25
{%- if include.tag -%}
25
26
< p > SORT BY: < a href ="/tags/stars/{{ include.tag }} "> Stars</ a > , < a href ="/tags/timestamp/{{ include.tag }} "> Latest</ a > </ p >
Original file line number Diff line number Diff line change @@ -16,21 +16,27 @@ <h1>Asset portal</h1>
16
16
{% include secondary_button.html link="/submit_asset" text="Submit asset" %}
17
17
</ div >
18
18
</ div >
19
+
19
20
{%- assign sort_order = page.sort | default: "stars" -%}
20
21
{%- if page.tag -%}
21
22
{%- assign tag = site.data.tags[page.tag] -%}
22
23
{%- assign tagid = tag.id -%}
24
+ {%- include tagfilter.html tag=tagid sort=sort_order -%}
25
+ {%- else -%}
26
+ {%- include tagfilter.html sort=sort_order -%}
27
+ {%- endif -%}
28
+
29
+ {%- assign sort_order = page.sort | default: "stars" -%}
30
+ {%- if page.tag -%}
31
+ {%- assign tag = site.data.tags[page.tag] -%}
23
32
{%- assign assetname = tag.name -%}
24
33
{%- assign assetids = tag.assets | sort: sort_order | reverse | map: "id" -%}
25
-
26
- {%- include tagfilter.html tag=tagid sort=sort_order -%}
27
34
{%- include assetgrid.html assetids=assetids showfilter=true title=assetname -%}
28
35
{%- else -%}
29
36
{%- assign assetids = site.data.assetindex | sort: sort_order | reverse | map: "id" -%}
30
-
31
- {%- include tagfilter.html sort=sort_order -%}
32
37
{%- include assetgrid.html assetids=assetids showfilter=true title="All" -%}
33
38
{%- endif -%}
39
+
34
40
< div class ="row " style ="margin-top: 30px ">
35
41
< div class ="columns ten "> < br /> </ div >
36
42
< div class ="columns two "> {% include secondary_button.html link="/submit_asset" text="Submit asset" %}</ div >
Original file line number Diff line number Diff line change @@ -542,6 +542,21 @@ input[type="submit"]:hover {
542
542
border-color : var (--lightest ) !important ;
543
543
}
544
544
545
+ /* ******************************************************************************
546
+ * Text input styling
547
+ ******************************************************************************/
548
+
549
+ input [type = text ].assetsearch {
550
+ color : var (--lighter ) !important ;
551
+ background-color : transparent !important ;
552
+ border-top : none !important ;
553
+ border-left : none !important ;
554
+ border-right : none !important ;
555
+ border-bottom : 1px solid var (--lighter );
556
+ line-height : 80% ;
557
+ padding : 0px ;
558
+ }
559
+
545
560
/* ******************************************************************************
546
561
* Limit width of images in examples, manuals and tutorials.
547
562
* Also center them
You can’t perform that action at this time.
0 commit comments