Skip to content

Commit 9958cee

Browse files
committed
error msg moved into results list and info message added describing how recommendations can be searched when the sidebar was loaded. #9 fixed
1 parent f724d23 commit 9958cee

3 files changed

Lines changed: 37 additions & 35 deletions

File tree

Scripts.html

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,12 @@
3030
* the sidebar UI with the results from the privacy proxy.
3131
*/
3232
function getRecommendationsFromInput() {
33+
removeInfo();
3334
removeError();
35+
3436
var keyword = $("#eexcess-search").val();
3537
if(keyword == "") {
36-
showError("Please enter some text.", $('#button-bar'));
38+
showError("Please enter some text.");
3739
} else {
3840
this.disabled = true;
3941
fetchAndDisplayRecommendations(keyword, this);
@@ -86,7 +88,7 @@
8688
removeAjaxLoader();
8789

8890
if (lastSearchedText == text)
89-
showError("The server timed out waiting for the request.", $('#button-bar'));
91+
showError("The server timed out waiting for the request.");
9092

9193
if (button)
9294
button.disabled = false;
@@ -110,7 +112,7 @@
110112
function(errorMsg, button) {
111113
if(!timeout && lastSearchedText == text) {
112114
removeAjaxLoader();
113-
showError(errorMsg, $('#button-bar'));
115+
showError(errorMsg);
114116

115117
if (button)
116118
button.disabled = false;
@@ -195,7 +197,7 @@
195197
container.append(template);
196198
})
197199
} else {
198-
showError("No results found", $('#button-bar'));
200+
showError("No results found");
199201
}
200202
}
201203

@@ -205,10 +207,10 @@
205207
* @param msg The error message to display.
206208
* @param element The element after which to display the error.
207209
*/
208-
function showError(msg, element) {
210+
function showError(msg) {
209211
removeError();
210212
var div = $('<div id="error" class="error">' + msg + '</div>');
211-
$(element).after(div);
213+
$("#eexcess-recommendations-list").after(div);
212214
}
213215

214216
/**
@@ -218,12 +220,21 @@
218220
$("#error").remove();
219221
}
220222

223+
/**
224+
* Removes the initially added info message.
225+
*/
226+
function removeInfo() {
227+
$("#info").remove();
228+
}
229+
221230
/**
222231
* Inserts the ajax loader icon.
223232
*/
224233
function showAjaxLoader() {
225-
if ($("#ajax-loader-container").length == 0)
226-
$('<div id="ajax-loader-container"><img src="http://mics.fim.uni-passau.de/wp-content/uploads/2014/10/ajax-loader.gif" width="16px" height="16px" alt="ajax loader"/></div>').insertAfter("#eexcess-recommendations-list");
234+
if ($("#ajax-loader-container").length == 0) {
235+
var div = $('<div id="ajax-loader-container"><img src="http://mics.fim.uni-passau.de/wp-content/uploads/2014/10/ajax-loader.gif" width="16px" height="16px" alt="ajax loader"/></div>');
236+
$("#eexcess-recommendations-list").after(div);
237+
}
227238
}
228239

229240
/**

Sidebar.html

Lines changed: 3 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,5 @@
11
<?!= include('Stylesheet') ?>
22

3-
<style>
4-
.fixed-top {
5-
position: fixed;
6-
top: 0;
7-
right: 0;
8-
left: 0;
9-
z-index: 1030;
10-
width: 100%;
11-
}
12-
#eexcess-recommendations {
13-
top:65px;
14-
padding-top:0px;
15-
}
16-
</style>
17-
183
<div class="sidebar fixed-top">
194
<div id="search-container" class="form-group inline-form">
205
<input id="eexcess-search" placeholder="Search" aria-label="Search" type="search" />
@@ -23,17 +8,14 @@
238
<div class="block"></div>
249
</div>
2510

26-
<div id="eexcess-recommendations" class="sidebar form-group height-75">
11+
<div id="eexcess-recommendations" class="sidebar form-group">
2712
<ul id="eexcess-recommendations-list">
2813
</ul>
29-
</div>
30-
31-
<div class="sidebar branding-below">
32-
<div class="block" id="button-bar">
33-
</div>
14+
<div id="info" class="gray">Please select some text or use the search bar.</div>
3415
</div>
3516

3617
<div class="sidebar bottom">
18+
<div id="bottom-separator" class="block"></div>
3719
<img alt="Add-on logo" class="logo" width="222" height="70" src="http://eexcess.eu/wp-content/uploads/2013/04/eexcess_Logo_neu1.jpg">
3820
<span class†="gray branding-text"> Recommendations by EEXCESS</span>
3921
</div>

Stylesheet.html

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,17 @@
22
<!-- The CSS package above applies Google styling to buttons and other elements. -->
33

44
<style>
5+
#bottom-separator {
6+
padding-top: 12px;
7+
}
8+
.fixed-top {
9+
position: fixed;
10+
top: 0;
11+
right: 0;
12+
left: 0;
13+
z-index: 1030;
14+
width: 100%;
15+
}
516
.inline-form {
617
width:100%;
718
}
@@ -14,9 +25,6 @@
1425
width: 72px;
1526
height: 29px;
1627
}
17-
.branding-below {
18-
bottom: 94px;
19-
}
2028
.branding-text {
2129
left: 7px;
2230
position: relative;
@@ -25,9 +33,6 @@
2533
.logo {
2634
vertical-align: middle;
2735
}
28-
.height-75 {
29-
height: 75%;
30-
}
3136
#ajax-loader-container {
3237
text-align: center;
3338
margin-top: 50px;
@@ -39,6 +44,10 @@
3944

4045
#eexcess-recommendations {
4146
clear: both;
47+
top:65px;
48+
padding-top:0;
49+
bottom: 125px;
50+
height: auto;
4251
}
4352

4453
.result-details {

0 commit comments

Comments
 (0)