diff --git a/js/actions/piece_list_actions.js b/js/actions/piece_list_actions.js index a4ab626c..2d5f6447 100644 --- a/js/actions/piece_list_actions.js +++ b/js/actions/piece_list_actions.js @@ -8,23 +8,34 @@ import PieceListFetcher from '../fetchers/piece_list_fetcher'; class PieceListActions { constructor() { this.generateActions( - 'updatePieceList' + 'updatePieceList', + 'updatePieceListRequestActions' ); } fetchPieceList(page, pageSize, search, orderBy, orderAsc) { - PieceListFetcher - .fetch(page, pageSize, search, orderBy, orderAsc) - .then((res) => { - this.actions.updatePieceList({ - page, - pageSize, - search, - orderBy, - orderAsc, - 'pieceList': res.pieces, - 'pieceListCount': res.count + return new Promise((resolve, reject) => { + PieceListFetcher + .fetch(page, pageSize, search, orderBy, orderAsc) + .then((res) => { + this.actions.updatePieceList({ + page, + pageSize, + search, + orderBy, + orderAsc, + 'pieceList': res.pieces, + 'pieceListCount': res.count + }); + resolve(); }); + }); + } + fetchPieceRequestActions() { + PieceListFetcher + .fetchRequestActions() + .then((res) => { + this.actions.updatePieceListRequestActions(res.piece_ids); }); } diff --git a/js/components/ascribe_accordion_list/accordion_list_item.js b/js/components/ascribe_accordion_list/accordion_list_item.js index 27eaf0d0..f7bfa925 100644 --- a/js/components/ascribe_accordion_list/accordion_list_item.js +++ b/js/components/ascribe_accordion_list/accordion_list_item.js @@ -1,30 +1,64 @@ 'use strict'; import React from 'react'; +import Router from 'react-router'; + +import Glyphicon from 'react-bootstrap/lib/Glyphicon'; +import OverlayTrigger from 'react-bootstrap/lib/OverlayTrigger'; +import Tooltip from 'react-bootstrap/lib/Tooltip'; + +import requests from '../../utils/requests'; import { getLangText } from '../../utils/lang_utils'; let AccordionListItem = React.createClass({ + mixins: [Router.Navigation], + propTypes: { className: React.PropTypes.string, content: React.PropTypes.object, children: React.PropTypes.object }, + handleClick(event){ + requests.get('piece_first_edition_id', {'piece_id': this.props.content.id}) + .then((res) => this.transitionTo('edition', {editionId: res.bitcoin_id})); + console.log(event.target); + }, + getGlyphicon(){ + if (this.props.content.requestAction){ + return ( + You have actions pending in one of your editions}> + + ); + } + return null; + }, render() { return (
-
- +
+
+ +
-
-

{this.props.content.title}

+
+

{this.props.content.title}

{getLangText('by %s', this.props.content.artist_name)}

-

{this.props.content.date_created.split('-')[0]}

+
+ {this.props.content.date_created.split('-')[0]} + + {this.props.content.license_type.code} license + +
+
+ {this.getGlyphicon()} +
{this.props.children} diff --git a/js/components/ascribe_accordion_list/accordion_list_item_table_editions.js b/js/components/ascribe_accordion_list/accordion_list_item_table_editions.js index a3fcc00d..7e030f1c 100644 --- a/js/components/ascribe_accordion_list/accordion_list_item_table_editions.js +++ b/js/components/ascribe_accordion_list/accordion_list_item_table_editions.js @@ -139,8 +139,12 @@ let AccordionListItemTableEditions = React.createClass({ ), new ColumnModel( (item) => { + let content = item.acl; + if (item.request_action){ + content = [item.request_action + ' request']; + } return { - 'content': item.acl + 'content': content }; }, 'acl', getLangText('Actions'), diff --git a/js/components/ascribe_buttons/delete_button.js b/js/components/ascribe_buttons/delete_button.js index 7077138d..37f3d862 100644 --- a/js/components/ascribe_buttons/delete_button.js +++ b/js/components/ascribe_buttons/delete_button.js @@ -42,11 +42,11 @@ let DeleteButton = React.createClass({ if (availableAcls.indexOf('delete') > -1) { content = ; - btnDelete = ; + btnDelete = ; } else if (availableAcls.indexOf('del_from_collection') > -1){ content = ; - btnDelete = ; + btnDelete = ; } else{ return null; diff --git a/js/components/ascribe_forms/form_request_action.js b/js/components/ascribe_forms/form_request_action.js index c355460f..8772871f 100644 --- a/js/components/ascribe_forms/form_request_action.js +++ b/js/components/ascribe_forms/form_request_action.js @@ -54,10 +54,10 @@ let RequestActionForm = React.createClass({ let buttons = ( -
ACCEPT
+
ACCEPT
-
REJECT
+
REJECT
); diff --git a/js/components/ascribe_piece_list_toolbar/piece_list_toolbar.js b/js/components/ascribe_piece_list_toolbar/piece_list_toolbar.js index 135a112d..49037991 100644 --- a/js/components/ascribe_piece_list_toolbar/piece_list_toolbar.js +++ b/js/components/ascribe_piece_list_toolbar/piece_list_toolbar.js @@ -21,7 +21,7 @@ let PieceListToolbar = React.createClass({ }, render() { - let searchIcon = ; + let searchIcon = ; return (
diff --git a/js/components/ascribe_piece_list_toolbar/piece_list_toolbar_filter_widget.js b/js/components/ascribe_piece_list_toolbar/piece_list_toolbar_filter_widget.js index d9d2b172..64974b41 100644 --- a/js/components/ascribe_piece_list_toolbar/piece_list_toolbar_filter_widget.js +++ b/js/components/ascribe_piece_list_toolbar/piece_list_toolbar_filter_widget.js @@ -8,7 +8,7 @@ import MenuItem from 'react-bootstrap/lib/MenuItem'; let PieceListToolbarFilterWidgetFilter = React.createClass({ render() { - let filterIcon = ; + let filterIcon = ; return ( diff --git a/js/components/ascribe_table/table_item_acl_filtered.js b/js/components/ascribe_table/table_item_acl_filtered.js index 10a419f0..562f1268 100644 --- a/js/components/ascribe_table/table_item_acl_filtered.js +++ b/js/components/ascribe_table/table_item_acl_filtered.js @@ -9,7 +9,7 @@ let TableItemAclFiltered = React.createClass({ }, render() { - var availableAcls = ['consign', 'loan', 'transfer', 'view']; + var availableAcls = ['consign', 'loan', 'transfer', 'view', 'consign request', 'unconsign request', 'loan request']; let filteredAcls = this.props.content.filter((v) => { return availableAcls.indexOf(v) > -1; diff --git a/js/components/header.js b/js/components/header.js index e4233a06..f1b1b8a3 100644 --- a/js/components/header.js +++ b/js/components/header.js @@ -80,6 +80,7 @@ let Header = React.createClass({ render() { let account = null; let signup = null; + let collection = null; if (this.state.currentUser.username){ account = ( @@ -91,6 +92,7 @@ let Header = React.createClass({ {getLangText('Log out')} ); + collection = COLLECTION; } else { account = LOGIN; @@ -101,11 +103,14 @@ let Header = React.createClass({
+ {this.getLogo()} } toggleNavKey={0}> +