Lines 70-76
KOHA.OverDriveCirculation = new function() {
Link Here
|
70 |
error_div.text(error); |
70 |
error_div.text(error); |
71 |
} |
71 |
} |
72 |
|
72 |
|
73 |
var login_link = $('<a href="#">') |
73 |
var login_link = $('<a class="btn btn-primary" href="#">') |
74 |
.click(function(e) { |
74 |
.click(function(e) { |
75 |
e.preventDefault(); |
75 |
e.preventDefault(); |
76 |
if( OD_password_required ) { $("#overdrive-login").modal('show'); } |
76 |
if( OD_password_required ) { $("#overdrive-login").modal('show'); } |
Lines 120-143
KOHA.OverDriveCirculation = new function() {
Link Here
|
120 |
return; |
120 |
return; |
121 |
} |
121 |
} |
122 |
|
122 |
|
123 |
var overdrive_link = $('<a href="https://www.overdrive.com/account/" target="overdrive-account" class="overdrive-link" style="float:right">') |
123 |
var button_toolbar = $("<div/>").addClass("btn-toolbar").attr("role","toolbar"); |
124 |
.text( __( "OverDrive account page" ) ); |
|
|
125 |
$(container).append(overdrive_link); |
126 |
|
124 |
|
127 |
var logout_link = $('<a href="#logout" class="overdrive-logout" style="float:left">') |
125 |
var overdrive_link = $("<div/>").addClass("btn-group mr-2").attr("role", "group") |
128 |
.click(function(e) { |
126 |
.append( $('<a href="https://www.overdrive.com/account/" target="overdrive-account" class="btn btn-sm btn-primary overdrive-link">') |
129 |
e.preventDefault(); |
127 |
.text( __( "OverDrive account page" ) ) ); |
130 |
$(container).empty().append(error_div); |
128 |
button_toolbar.append(overdrive_link); |
131 |
logout(function(data) { |
129 |
|
132 |
display_account(container, data); |
130 |
var logout_link = $("<div/>").addClass("btn-group mr-2").attr("role", "group") |
133 |
}); |
131 |
.append( $('<a href="#logout" class="btn btn-sm btn-primary overdrive-logout">') |
134 |
}).text( __("Log out of your OverDrive account") ); |
132 |
.click(function(e) { |
135 |
$(container).append(logout_link); |
133 |
e.preventDefault(); |
136 |
$(container).append('<br style="clear:both;"/>'); |
134 |
$(container).empty().append(error_div); |
|
|
135 |
logout(function(data) { |
136 |
display_account(container, data); |
137 |
}); |
138 |
}).text( __("Log out of your OverDrive account") ) ); |
139 |
|
140 |
button_toolbar.append(logout_link); |
141 |
|
142 |
$(container).append( button_toolbar ); |
137 |
|
143 |
|
138 |
if (data.checkouts) { |
144 |
if (data.checkouts) { |
139 |
var checkouts_div = $('<div class="overdrive-div">').html('<h3>' + __("Checkouts") + '</h3>'); |
145 |
var checkouts_div = $('<div class="overdrive-div">').html('<h3>' + __("Checkouts") + '</h3>'); |
140 |
var checkouts_list = $('<ul class="overdrive-list">'); |
146 |
var checkouts_list = $('<div class="overdrive-list">'); |
141 |
data.checkouts.items.forEach(function(item) { |
147 |
data.checkouts.items.forEach(function(item) { |
142 |
item_line(checkouts_list, item); |
148 |
item_line(checkouts_list, item); |
143 |
}); |
149 |
}); |
Lines 147-153
KOHA.OverDriveCirculation = new function() {
Link Here
|
147 |
|
153 |
|
148 |
if (data.holds) { |
154 |
if (data.holds) { |
149 |
var holds_div = $('<div class="overdrive-div">').html('<h3>' + __("Holds") + '</h3>'); |
155 |
var holds_div = $('<div class="overdrive-div">').html('<h3>' + __("Holds") + '</h3>'); |
150 |
var holds_list = $('<ul class="overdrive-list">'); |
156 |
var holds_list = $('<div class="overdrive-list">'); |
151 |
data.holds.items.forEach(function(item) { |
157 |
data.holds.items.forEach(function(item) { |
152 |
item_line(holds_list, item); |
158 |
item_line(holds_list, item); |
153 |
}); |
159 |
}); |
Lines 157-186
KOHA.OverDriveCirculation = new function() {
Link Here
|
157 |
} |
163 |
} |
158 |
|
164 |
|
159 |
function item_line(ul_el, item) { |
165 |
function item_line(ul_el, item) { |
160 |
var line = $('<li class="overdrive-item">'); |
166 |
var line = $('<div class="overdrive-item">'); |
|
|
167 |
var image_container = $('<div class="overdrive-item-thumbnail">'); |
161 |
if (item.images) { |
168 |
if (item.images) { |
162 |
var thumb_url = item.images.thumbnail; |
169 |
var thumb_url = item.images.thumbnail; |
163 |
if (thumb_url) { |
170 |
if (thumb_url) { |
164 |
$('<img class="overdrive-item-thumbnail">') |
171 |
$('<img class="overdrive-thumbnail">') |
165 |
.attr("src", thumb_url) |
172 |
.attr("src", thumb_url) |
166 |
.appendTo(line); |
173 |
.appendTo( image_container ); |
167 |
} |
174 |
} |
168 |
} |
175 |
} |
169 |
$('<div class="overdrive-item-title">') |
176 |
image_container.appendTo( line ); |
170 |
.text(item.title) |
177 |
var item_details = $('<div class="overdrive-item-details">') |
171 |
.appendTo(line); |
178 |
.append( |
172 |
$('<div class="overdrive-item-subtitle">') |
179 |
$('<h4 class="overdrive-item-title">') |
173 |
.html(item.subtitle) |
180 |
.text(item.title) ) |
|
|
181 |
.append( $('<div class="overdrive-item-author">') |
182 |
.text(item.author) ) |
183 |
.append( |
184 |
$('<div class="overdrive-item-subtitle">') |
185 |
.html(item.subtitle) ) |
174 |
.appendTo(line); |
186 |
.appendTo(line); |
175 |
$('<div class="overdrive-item-author">') |
187 |
var actions = $('<div class="actions">'); |
176 |
.text(item.author) |
|
|
177 |
.appendTo(line); |
178 |
var actions = $('<span class="actions">'); |
179 |
display_actions(actions, item.id); |
188 |
display_actions(actions, item.id); |
180 |
$('<div id="action_'+item.id+'" class="actions-menu">') |
189 |
item_details.append( $('<div id="action_' + item.id + '" class="actions-menu">') |
181 |
.append(actions) |
190 |
.append(actions) ) |
182 |
.appendTo(line); |
191 |
.appendTo(line); |
183 |
|
|
|
184 |
$(ul_el).append(line); |
192 |
$(ul_el).append(line); |
185 |
} |
193 |
} |
186 |
|
194 |
|
Lines 278-284
KOHA.OverDriveCirculation = new function() {
Link Here
|
278 |
var item = item_is_checked_out(id); |
286 |
var item = item_is_checked_out(id); |
279 |
if (item) { |
287 |
if (item) { |
280 |
var expires = new Date(item.expires); |
288 |
var expires = new Date(item.expires); |
281 |
$('<span class="overdrive-item-status">') |
289 |
$('<div class="overdrive-item-status">') |
282 |
.text( __( "Checked out until: " ) + " " + expires.toLocaleString()) |
290 |
.text( __( "Checked out until: " ) + " " + expires.toLocaleString()) |
283 |
.appendTo(el); |
291 |
.appendTo(el); |
284 |
$(el).append(" "); |
292 |
$(el).append(" "); |
Lines 329-336
KOHA.OverDriveCirculation = new function() {
Link Here
|
329 |
|
337 |
|
330 |
item = item_is_on_hold(id); |
338 |
item = item_is_on_hold(id); |
331 |
if (item) { |
339 |
if (item) { |
332 |
$('<span class="overdrive-status">') |
340 |
$('<span class="overdrive-item-status">') |
333 |
.text( __("On hold") ) |
341 |
.text(__("On hold")) |
334 |
.appendTo(el); |
342 |
.appendTo(el); |
335 |
$(el).append(" "); |
343 |
$(el).append(" "); |
336 |
} |
344 |
} |
Lines 372-378
KOHA.OverDriveCirculation = new function() {
Link Here
|
372 |
} |
380 |
} |
373 |
|
381 |
|
374 |
if (item) { |
382 |
if (item) { |
375 |
$(el).append( ajax_button( __("Cancel"), function() { |
383 |
$(el).append( ajax_button( __("Cancel hold"), function() { |
376 |
if( confirm( __("Are you sure you want to cancel this hold?") ) ) { |
384 |
if( confirm( __("Are you sure you want to cancel this hold?") ) ) { |
377 |
item_action({action: "remove-hold", id: id}, el, copies_available); |
385 |
item_action({action: "remove-hold", id: id}, el, copies_available); |
378 |
} |
386 |
} |
Lines 394-400
KOHA.OverDriveCirculation = new function() {
Link Here
|
394 |
|
402 |
|
395 |
function decorate_button(button, label) { |
403 |
function decorate_button(button, label) { |
396 |
$(button) |
404 |
$(button) |
397 |
.addClass("btn btn-primary btn-mini") |
405 |
.addClass("btn btn-primary btn-sm") |
398 |
.css("color","white") |
406 |
.css("color","white") |
399 |
.text(label); |
407 |
.text(label); |
400 |
} |
408 |
} |
401 |
- |
|
|