Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
115 commits
Select commit Hold shift + click to select a range
844ce11
Dialog added.
YegorUdovchenko Mar 26, 2018
602b22b
Add empty book modal dialog to main app.
YegorUdovchenko Mar 26, 2018
c1026e3
Add book dialog styling.
YegorUdovchenko Mar 26, 2018
fb6668d
Merge branch 'add_book_grid' into book_modal_dialog
YegorUdovchenko Mar 26, 2018
c55486c
Merge branch 'add_book_grid' into book_modal_dialog
YegorUdovchenko Mar 27, 2018
783d539
Add book dialog open on book tile click.
YegorUdovchenko Mar 27, 2018
cb0fd94
Add book dialog narrow mode support.
YegorUdovchenko Mar 27, 2018
8d216e8
Add full book message to the book dialog.
YegorUdovchenko Mar 27, 2018
481dafb
Merge branch 'add_book_grid' into book_modal_dialog
YegorUdovchenko Mar 27, 2018
fc7784f
Add custom button to the book dialog.
YegorUdovchenko Mar 27, 2018
78ca524
Change book click handler.
YegorUdovchenko Mar 27, 2018
9005204
Add book-dialog docs, change dialog styles.
YegorUdovchenko Mar 27, 2018
18ca992
Fix lint issues.
YegorUdovchenko Mar 27, 2018
c7ae0f2
Add modal dialog close button.
YegorUdovchenko Mar 28, 2018
81f6d18
Add specific route for book modal dialog.
YegorUdovchenko Mar 28, 2018
69bd5e7
Merge branch 'add_book_grid' into book_modal_dialog
YegorUdovchenko Mar 28, 2018
c5b660d
Fix custom button in book modal dialog.
YegorUdovchenko Mar 28, 2018
f490daf
Add docs to the book dialog.
YegorUdovchenko Mar 29, 2018
b2712ea
Add dialog buttons fire events, complete dialog docs.
YegorUdovchenko Mar 29, 2018
1432d12
Rename book dialog events.
YegorUdovchenko Mar 29, 2018
6006e8f
Add book dialog content tests.
YegorUdovchenko Mar 29, 2018
8a3b05b
Complete book dialog buttons tests.
YegorUdovchenko Mar 29, 2018
562b4c3
Add placeholder image to the book dialog.
YegorUdovchenko Mar 30, 2018
9126861
Simplify book dialog routing.
YegorUdovchenko Mar 30, 2018
3a163ad
Add app show `view404` on unknown book id.
YegorUdovchenko Mar 30, 2018
15969e7
Merge branch 'add_book_grid' into book_modal_dialog
YegorUdovchenko Mar 30, 2018
90a6d88
Merge branch 'polymer_general_tasks' into book_modal_dialog
YegorUdovchenko Apr 3, 2018
21db042
Merge branch 'polymer_general_tasks' into book_modal_dialog
YegorUdovchenko Apr 3, 2018
40a2599
Change book-dialot to book details page.
YegorUdovchenko Apr 3, 2018
22b142e
Make book details page styles work with mobile screen view.
YegorUdovchenko Apr 3, 2018
957f3e5
Merge branch 'add_book_grid' into book_modal_dialog
YegorUdovchenko Apr 4, 2018
e10c747
Remove close dialog method.
YegorUdovchenko Apr 4, 2018
209584e
Add book tile click event listener.
YegorUdovchenko Apr 4, 2018
f6fca34
Add redux for book-details component to get selected book.
YegorUdovchenko Apr 4, 2018
223c007
Remove book details buttons fire events to exlibris app.
YegorUdovchenko Apr 4, 2018
58eba4e
Add book-details message calculation depending on book status.
YegorUdovchenko Apr 4, 2018
b6cae57
Refactor book status check methods.
YegorUdovchenko Apr 4, 2018
cb134f5
Remove multiple buttons, add button for narrow screen.
YegorUdovchenko Apr 4, 2018
100968e
Improve book-details styling.
YegorUdovchenko Apr 4, 2018
fa8e1ef
Add button click handler depending on book status.
YegorUdovchenko Apr 5, 2018
2855e23
Add button hidden state, add `reserved by someone` message.
YegorUdovchenko Apr 5, 2018
881938c
Improve book details card styling.
YegorUdovchenko Apr 5, 2018
04e1d20
Merge branch 'add_book_grid' into book_modal_dialog
YegorUdovchenko Apr 5, 2018
a7c89d9
Change font style property.
YegorUdovchenko Apr 5, 2018
1787033
Add book details methods jsdocs.
YegorUdovchenko Apr 5, 2018
864bce7
Change some css classes to refer by id.
YegorUdovchenko Apr 6, 2018
f825f4f
Add book property docs.
YegorUdovchenko Apr 6, 2018
dc5a7bd
Merge branch 'add_book_grid' into book_modal_dialog
YegorUdovchenko Apr 6, 2018
5a34507
Remove unnecessary book tile click handler.
YegorUdovchenko Apr 6, 2018
f7e1f68
Add jsdocs to button identify method.
YegorUdovchenko Apr 6, 2018
ba72ed2
Unite button title and click handler in single button property.
YegorUdovchenko Apr 6, 2018
08a0f4e
Add action dispatch on URL change.
YegorUdovchenko Apr 6, 2018
b2995dd
Add temp action handler to the reducer to find book by id.
YegorUdovchenko Apr 10, 2018
3074f7d
Separate button, status message and action unsupported message comput…
YegorUdovchenko Apr 10, 2018
a0fad93
Add book undefined check to the compute functions.
YegorUdovchenko Apr 10, 2018
555b33b
Add jsdocs for compute values methods.
YegorUdovchenko Apr 10, 2018
cac2381
Extract book redirect link into custom element.
YegorUdovchenko Apr 10, 2018
60ef5f6
Complete redirect link component docs, extract enums of code matchers…
YegorUdovchenko Apr 10, 2018
9a1626f
Replace on-click handler with link using target property.
YegorUdovchenko Apr 10, 2018
a87801f
Merge branch 'add_book_grid' into book_modal_dialog
YegorUdovchenko Apr 11, 2018
b18c0a5
Refactor namespace declaration in project.
YegorUdovchenko Apr 11, 2018
8da8727
Merge branch 'add_book_grid' into book_modal_dialog
YegorUdovchenko Apr 11, 2018
f725bcc
Merge branch 'add_book_grid' into book_modal_dialog
YegorUdovchenko Apr 11, 2018
3a78d11
Merge branch 'add_book_grid' into book_modal_dialog
YegorUdovchenko Apr 11, 2018
6221e9b
Fix exlibris-app test store mock issue. Fix test files imports due to…
YegorUdovchenko Apr 11, 2018
0d8e2d3
Merge branch 'add_book_grid' into book_modal_dialog
YegorUdovchenko Apr 11, 2018
21bb4b1
Change color declarations to paper-color values.
YegorUdovchenko Apr 12, 2018
d185e10
Add book-details work with store tests.
YegorUdovchenko Apr 12, 2018
30e6f32
Complete book-details store and buttons tests.
YegorUdovchenko Apr 12, 2018
ce0e8e8
Add route check before dispatching the `findBookById` action.
YegorUdovchenko Apr 12, 2018
2dd3c1e
Apply paper-styles to book-details page.
YegorUdovchenko Apr 13, 2018
2659219
Remove icon from the redirect link.
YegorUdovchenko Apr 13, 2018
4cbe117
Simplify redirect-link template and styles.
YegorUdovchenko Apr 13, 2018
138558c
Change book-details methods naming.
YegorUdovchenko Apr 13, 2018
d40efc6
Fix details-page tests.
YegorUdovchenko Apr 13, 2018
75ffdcd
Merge branch 'add_book_grid' into book_details_page
YegorUdovchenko Apr 16, 2018
4c0be8c
Resolve import path issues, fix tests to meet IE requirements.
YegorUdovchenko Apr 16, 2018
836a76c
Add book details loading status.
YegorUdovchenko Apr 16, 2018
0e63862
Create book-details fires event test.
YegorUdovchenko Apr 16, 2018
05a3248
Move book code patterns and redirect link templates to the book_values.
YegorUdovchenko Apr 16, 2018
e103a88
Replace Array.find() with function to add IE support.
YegorUdovchenko Apr 16, 2018
b9d814f
Remove temporal functions.
YegorUdovchenko Apr 16, 2018
0fa21d5
Merge branch 'add_book_grid' into book_details_page
YegorUdovchenko Apr 16, 2018
24bb392
Change files naming to dash case.
YegorUdovchenko Apr 16, 2018
d32e32e
Remove unnecessary dependencies.
YegorUdovchenko Apr 16, 2018
ed67f4b
Remove idea files.
YegorUdovchenko Apr 16, 2018
d198beb
Add jsdocs parameter definitions.
YegorUdovchenko Apr 16, 2018
8d4b540
Move redax actions to ExliprisApp namespace, improve book-details docs.
YegorUdovchenko Apr 16, 2018
3850a5b
Refactor book-details docs.
YegorUdovchenko Apr 16, 2018
5a52450
Refactor book-details css classes names, fix test query selectors due…
YegorUdovchenko Apr 17, 2018
14be2d7
Merge branch 'add_book_grid' into book_details_page
YegorUdovchenko Apr 17, 2018
9b99760
Refactor import statements.
YegorUdovchenko Apr 17, 2018
27fc865
Add actions dispatch on details-page buttons click, cover with tests.
YegorUdovchenko Apr 18, 2018
1970e5e
Merge branch 'master' into book_details_page
YegorUdovchenko Apr 27, 2018
f8e9154
Move book code patterns and link templates to redirect link component.
YegorUdovchenko May 4, 2018
2345bbd
Fix tests due to constants moved from book values.
YegorUdovchenko May 4, 2018
463350d
Fix test constants.
YegorUdovchenko May 4, 2018
805ab83
Improve docs.
YegorUdovchenko May 4, 2018
f01edf8
Merge branch 'master' into book_details_page
YegorUdovchenko May 4, 2018
577108f
Add missing import.
YegorUdovchenko May 4, 2018
9dc29c3
Merge branch 'master' into book_details_page
YegorUdovchenko May 4, 2018
adde348
Remove redundant `hidden` property.
YegorUdovchenko May 7, 2018
34e4924
Merge branch 'master' into book_details_page
YegorUdovchenko Jun 6, 2018
a8aabca
Remove book loading status. Improve docs.
YegorUdovchenko Jun 6, 2018
cbc7e17
Improve book-details styles.
YegorUdovchenko Jun 7, 2018
ea59f04
Improve redirect-link component, add fallback content section when th…
YegorUdovchenko Jun 7, 2018
45313a7
Implement book loading process imitation. Add `notFound` bool propert…
YegorUdovchenko Jun 11, 2018
8d43d95
Add spinner display while book is loading.
YegorUdovchenko Jun 11, 2018
dab8a04
Fix `book-redirect-link-tests`.
YegorUdovchenko Jun 11, 2018
221208a
Fix `book-details` buttons test, add test for `book-details` componen…
YegorUdovchenko Jun 11, 2018
12ddb9f
Separate `book-details` buttons test.
YegorUdovchenko Jun 11, 2018
5da31a1
Fix ES-lint issues, wrap loading spinner into `dom-if` to prevent `pa…
YegorUdovchenko Jun 12, 2018
7001524
Fix several code formatting mistakes.
YegorUdovchenko Jun 12, 2018
6a1d245
Make required changes.
YegorUdovchenko Jun 18, 2018
3e5a75a
Improve docs.
YegorUdovchenko Jun 18, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion client-web/bower.json
Original file line numberDiff line numberDiff line change
Expand Up@@ -12,7 +12,9 @@
"iron-icons": "PolymerElements/iron-icons#^2.1.1",
"iron-image": "PolymerElements/iron-image#^2.2.0",
"iron-scroll-threshold": "PolymerElements/iron-scroll-threshold#^2.0.0",
"iron-list": "PolymerElements/iron-list#^2.0.13"
"iron-list": "PolymerElements/iron-list#^2.0.13",
"paper-button": "PolymerElements/paper-button#^2.1.0",
"paper-spinner": "PolymerElements/paper-spinner#^2.1.0"
},
"devDependencies": {
"web-component-tester": "Polymer/web-component-tester#^6.0.0",
Expand Down
6 changes: 6 additions & 0 deletions client-web/src/exlibris-app/actions/exlibris-actions.html
Original file line numberDiff line numberDiff line change
Expand Up@@ -21,5 +21,11 @@
<script>
ExlibrisApp.ExlibrisActions = {
FETCH_BOOKS: "FETCH_BOOKS",
FIND_BOOK_BY_ID: "FIND_BOOK_BY_ID",
BOOK_RECEIVED: "BOOK_RECEIVED",
BOOK_NOT_FOUND: "BOOK_NOT_FOUND",
CANCEL_BOOK_RESERVATION: "CANCEL_BOOK_RESERVATION",
RESERVE_BOOK: "RESERVE_BOOK",
EXTEND_LOAN_PERIOD: "EXTEND_LOAN_PERIOD"
}
</script>
Original file line numberDiff line numberDiff line change
Expand Up@@ -19,7 +19,6 @@
-->

<script>

ExlibrisApp.BookStatus = {
OVERDUE: "OVERDUE",
BORROWED: "BORROWED",
Expand All@@ -30,5 +29,4 @@
EXPECTED: "EXPECTED",
READY_TO_PICK_UP: "READY_TO_PICK_UP",
};

</script>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,175 @@
<!--
~ Copyright 2018, TeamDev Ltd. All rights reserved.
~
~ Redistribution and use in source and/or binary forms, with or without
~ modification, must retain the above copyright notice and the following
~ disclaimer.
~
~ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
~ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
~ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
~ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
~ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
~ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
~ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
~ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
~ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
~ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
~ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-->

<link rel="import" href="../../../bower_components/polymer/polymer-element.html">
<link rel="import" href="../../../bower_components/polymer/lib/elements/dom-if.html">

<dom-module id="exlibris-book-details-redirect-link">
<template>
<style>
:host {
@apply --paper-font-body1;
white-space: nowrap;
margin: 5px 0 5px 0;
}

#link {
text-decoration: none;
color: var(--paper-blue-600);
}

#link:hover {
text-decoration: underline;
text-underline-position: under;
}
</style>

<template is="dom-if" if="[[_reference.value]]">
<a id="link" target="_blank" href="[[_reference.value]]">
[[_reference.title]]
</a>
</template>
<template is="dom-if" if="[[!_reference.value]]">
<span>[[_reference.title]]</span>
</template>
</template>

<script>
{
String.prototype.format = function () {
return [...arguments].reduce((p, c) => p.replace(/%s/, c), this);
};

const BOOK_CODE_PATTERN = {
ISBN_10: /^\d{10}$/g,
ISBN_13: /^\d{13}$/g,
ASIN: /^[\d, A-Z]{10}$/g
};

const EXTERNAL_LINK_TEMPLATE = {
AMAZON: 'https://www.amazon.com/%s/dp/%s/',
PLAY_BOOKS: 'https://play.google.com/store/search?q=%s&c=books'
};

/**
* The book external link component.
*
* Generates the link to the one of the global book services to
* open it in the new tab. The external service choice depends
* on the book code format. If the passed code does not satisfy
* any pattern, shows it as a plain text.
*
* @customElement
* @polymer
*/
class ExlibrisBookDetailsRedirectLink extends Polymer.Element {
static get is() {
return 'exlibris-book-details-redirect-link';
}

static get properties() {
return {
/**
* The book unique code.
* Can be presented in the form of ISBN10, ISBN13 or ASIN.
*/
bookCode: String,

/**
* The book title.
*/
bookTitle: String,

/**
* The enum of book code patterns for ISBN10, ISBN13 and ASIN.
*/
_bookCodePattern: {
type: Object,
value: BOOK_CODE_PATTERN
},

/**
* The enum of external links patterns. Each value is used to
* generate redirect link depending on book code format.
*/
_externalLinkTemplate: {
type: Object,
value: EXTERNAL_LINK_TEMPLATE
},

/**
* The book external link reference and its title.
*
* @property {string} title the reference title.
* @property {string} value the link to open in the new tab.
*/
_reference: {
type: Object,
computed: "_calculateReference(bookCode, bookTitle)"
}
};
}

/**
* Checks for the passed book code format.
*
* If the `bookCode` matches the `ISBN10` or `ASIN` pattern, generates
* the Amazon book search link.
*
* If the `bookCode` matches the `ISBN13` pattern, generates the Google Play Books
* search link.
*
* If the `bookCode` doesn't match any pattern, returns reference title and
* value of `undefined`.
*
* @param {string} bookCode the book unique code (ISBN, ASIN).
* @param {string} bookTitle the book title.
* @returns {Object} the title and the value of link.
* @private
*/
_calculateReference(bookCode, bookTitle) {
if (bookCode) {
if (bookCode.match(this._bookCodePattern.ISBN_10)) {
return {
title: 'ISBN: ' + bookCode,
value: this._externalLinkTemplate.AMAZON.format(bookTitle, bookCode)
};
}
if (bookCode.match(this._bookCodePattern.ISBN_13)) {
return {
title: 'ISBN: ' + bookCode,
value: this._externalLinkTemplate.PLAY_BOOKS.format(bookCode)
};
}
if (bookCode.match(this._bookCodePattern.ASIN)) {
return {
title: 'ASIN: ' + bookCode,
value: this._externalLinkTemplate.AMAZON.format(bookTitle, bookCode)
};
}
return {title: 'ISBN: ' + bookCode};
}
}
}

window.customElements.define(ExlibrisBookDetailsRedirectLink.is, ExlibrisBookDetailsRedirectLink);
}
</script>
</dom-module>
Loading