File tree 5 files changed +27
-9
lines changed
5 files changed +27
-9
lines changed Original file line number Diff line number Diff line change 20
20
"SEARCH" : {
21
21
"PLACEHOLDER" : " Ist mein Projekt bei metacollect?" ,
22
22
"NO_MATCHES" : " Es wurden keine Einträge gefunden." ,
23
- "REGISTER" : " Jetzt anmelden"
23
+ "REGISTER" : " Jetzt anmelden" ,
24
+ "MORE_MATCHES" : " Mehr Ergebnisse anzeigen"
24
25
}
25
26
},
26
27
Original file line number Diff line number Diff line change 20
20
"SEARCH" : {
21
21
"PLACEHOLDER" : " Is my project with metacollect?" ,
22
22
"NO_MATCHES" : " No results found." ,
23
- "REGISTER" : " Enter your information now."
23
+ "REGISTER" : " Enter your information now." ,
24
+ "MORE_MATCHES" : " Show more results"
24
25
}
25
26
},
26
27
Original file line number Diff line number Diff line change @@ -6,25 +6,33 @@ angular.module('mcControllers', [])
6
6
'$http' ,
7
7
8
8
function ( $scope , $http ) {
9
- $scope . data = undefined
10
- $scope . search = ''
9
+ $scope . data = undefined ;
10
+ $scope . search = '' ;
11
+
12
+ // number of shown result-items
13
+ $scope . limitResults = 10 ;
14
+
15
+ // increase number of shown items
16
+ $scope . moreResults = function ( ) {
17
+ $scope . limitResults += 10 ;
18
+ }
11
19
12
20
13
21
$scope . getData = function ( ) {
14
22
15
23
var search = $scope . search . replace ( / [ ^ a - z A - Z 0 - 9 ] / g, " " )
16
24
17
- $scope . data = true
25
+ $scope . data = true ;
18
26
19
27
var long_search = ( " " + search ) . replace ( / \s + / g, "&title*icontains=" )
20
28
21
29
$http . get ( 'http://django.dsini20.schedar.uberspace.de/api/search/project?format=json' + long_search )
22
30
. then (
23
31
function ( result ) {
24
- $scope . data = result . data
32
+ $scope . data = result . data ;
25
33
} ,
26
34
function ( error ) {
27
- $scope . data = [ ]
35
+ $scope . data = [ ] ;
28
36
}
29
37
)
30
38
}
Original file line number Diff line number Diff line change @@ -37,7 +37,7 @@ <h1 translate = "DATABASE.HEADING"></h2>
37
37
>
38
38
</ a >
39
39
</ li >
40
- < li ng-repeat = "item in data | limitTo:10 ">
40
+ < li ng-repeat = "item in data | limitTo:limitResults ">
41
41
< span class ="logo " style ="background-image: url('{{item.logo}}') "> </ span > <!--
42
42
--> < span class ="title "> < a href ="http://django.dsini20.schedar.uberspace.de/mainApp/{{item.id}}/ "> {{item.title | htmlToPlaintext}}</ a > </ span >
43
43
< div class ="description ">
@@ -50,6 +50,7 @@ <h1 translate = "DATABASE.HEADING"></h2>
50
50
</ div >
51
51
</ li >
52
52
</ ul >
53
+ < button ng-if ="data.length > 10 " ng-hide ="data.length > 10 && data.length < limitResults " id ="button__more-results " ng-click ="moreResults() " translate = "DATABASE.SEARCH.MORE_MATCHES "> </ button >
53
54
</ div >
54
- </ articlle >
55
+ </ article >
55
56
Original file line number Diff line number Diff line change @@ -853,4 +853,11 @@ a.logo:hover{
853
853
width : 24rem ;
854
854
}
855
855
856
+ /* show more result button */
857
+ # button__more-results {
858
+ line-height : 30px ;
859
+ border : 1px solid # 333 ;
860
+ width : 100% ;
861
+ }
862
+
856
863
You can’t perform that action at this time.
0 commit comments