+
);
}
});
diff --git a/js/constants/api_urls.js b/js/constants/api_urls.js
index b056ee03..bad04be5 100644
--- a/js/constants/api_urls.js
+++ b/js/constants/api_urls.js
@@ -27,6 +27,7 @@ let ApiUrls = {
'note_private_piece': AppConstants.apiEndpoint + 'note/private/pieces/',
'note_public_edition': AppConstants.apiEndpoint + 'note/public/editions/',
'note_public_piece': AppConstants.apiEndpoint + 'note/public/pieces/',
+ 'ownership_contract_agreements': AppConstants.apiEndpoint + 'ownership/contract_agreements/',
'ownership_consigns': AppConstants.apiEndpoint + 'ownership/consigns/',
'ownership_consigns_confirm': AppConstants.apiEndpoint + 'ownership/consigns/confirm/',
'ownership_consigns_deny': AppConstants.apiEndpoint + 'ownership/consigns/deny/',
@@ -46,7 +47,8 @@ let ApiUrls = {
'ownership_unconsigns': AppConstants.apiEndpoint + 'ownership/unconsigns/',
'ownership_unconsigns_deny': AppConstants.apiEndpoint + 'ownership/unconsigns/deny/',
'ownership_unconsigns_request': AppConstants.apiEndpoint + 'ownership/unconsigns/request/',
- 'ownership_contract': AppConstants.apiEndpoint + 'ownership/contracts/',
+ 'ownership_contract':AppConstants.apiEndpoint + 'ownership/contracts/${contract_id}',
+ "ownership_contract_list": AppConstants.apiEndpoint + 'ownership/contracts/',
'piece': AppConstants.apiEndpoint + 'pieces/${piece_id}/',
'piece_extradata': AppConstants.apiEndpoint + 'pieces/${piece_id}/extradata/',
'piece_first_edition_id': AppConstants.apiEndpoint + 'pieces/${piece_id}/edition_index/',
diff --git a/js/fetchers/ownership_fetcher.js b/js/fetchers/ownership_fetcher.js
index 051f2d08..8f97add5 100644
--- a/js/fetchers/ownership_fetcher.js
+++ b/js/fetchers/ownership_fetcher.js
@@ -16,11 +16,16 @@ let OwnershipFetcher = {
* Fetch the contracts of the logged-in user from the API.
*/
fetchContractList(){
- return requests.get(ApiUrls.ownership_contract);
+ return requests.get(ApiUrls.ownership_contract_list);
},
fetchLoanPieceRequestList(){
return requests.get(ApiUrls.ownership_loans_pieces_request);
+ },
+
+ makeContractPublic(contractObj){
+ console.log(contractObj);
+ return requests.put('ownership_contract_list',{ body: contractObj, contract_id:contractObj.id });
}
};
diff --git a/js/stores/piece_list_store.js b/js/stores/piece_list_store.js
index bc2bba24..8b4254ac 100644
--- a/js/stores/piece_list_store.js
+++ b/js/stores/piece_list_store.js
@@ -28,6 +28,7 @@ class PieceListStore {
this.orderBy = 'artist_name';
this.orderAsc = true;
this.filterBy = {};
+ this.requestActions = {};
this.bindActions(PieceListActions);
}
@@ -71,10 +72,8 @@ class PieceListStore {
this.pieceList = pieceList;
}
- onUpdatePieceListRequestActions(requestActions) {
- this.pieceList.forEach((piece) => {
- piece.requestAction = requestActions.indexOf(piece.id) > -1;
- });
+ onUpdatePieceListRequestActions(res) {
+ this.requestActions = res.actions;
}
onUpdatePropertyForPiece({pieceId, key, value}) {
diff --git a/js/utils/general_utils.js b/js/utils/general_utils.js
index 15b0e85f..673a5509 100644
--- a/js/utils/general_utils.js
+++ b/js/utils/general_utils.js
@@ -52,6 +52,19 @@ export function sumNumList(l) {
return sum;
}
+export function excludePropFromObject(obj, propList){
+ let clonedObj = mergeOptions({},obj);
+ for (let item in propList){
+ console.log(item);
+ if (clonedObj[propList[item]]){
+ console.log('deleting... ');
+ delete clonedObj[propList[item]];
+ }
+ }
+ console.log(clonedObj);
+ return clonedObj;
+}
+
/*
Taken from http://stackoverflow.com/a/4795914/1263876
Behaves like C's format string function
diff --git a/js/utils/requests.js b/js/utils/requests.js
index 793e1f21..3cf84690 100644
--- a/js/utils/requests.js
+++ b/js/utils/requests.js
@@ -6,6 +6,7 @@ import { argsToQueryParams, getCookie } from '../utils/fetch_api_utils';
import AppConstants from '../constants/application_constants';
+import {excludePropFromObject} from '../utils/general_utils';
class Requests {
_merge(defaults, options) {
@@ -137,15 +138,25 @@ class Requests {
return this.request('delete', newUrl);
}
- post(url, params) {
- let paramsCopy = this._merge(params);
- let newUrl = this.prepareUrl(url, paramsCopy);
+ _putOrPost(url,paramsAndBody,method){
+ let paramsCopy = this._merge(paramsAndBody);
+ let params = excludePropFromObject(paramsAndBody,['body']);
+ let newUrl = this.prepareUrl(url, params);
let body = null;
-
if (paramsCopy && paramsCopy.body) {
+ console.log(paramsCopy.body);
body = JSON.stringify(paramsCopy.body);
}
- return this.request('post', newUrl, { body });
+ return this.request(method, newUrl, { body });
+ }
+
+ post(url, params) {
+ return this._putOrPost(url,params,'post')
+ }
+
+ put(url, params){
+ console.log(params);
+ return this._putOrPost(url,params,'put')
}
defaults(options) {
diff --git a/sass/ascribe_accordion_list.scss b/sass/ascribe_accordion_list.scss
index 4b4186eb..6412a598 100644
--- a/sass/ascribe_accordion_list.scss
+++ b/sass/ascribe_accordion_list.scss
@@ -166,7 +166,7 @@ $ascribe-accordion-list-item-height: 8em;
.request-action-badge {
color: $ascribe-color-green;
font-size: 1.2em;
- padding: .3em;
+ padding: .8em;
position: absolute;
right: 0;
top: 0;
diff --git a/sass/ascribe_global_action.scss b/sass/ascribe_global_action.scss
new file mode 100644
index 00000000..af4eca4a
--- /dev/null
+++ b/sass/ascribe_global_action.scss
@@ -0,0 +1,25 @@
+$break-small: 764px;
+$break-medium: 991px;
+$break-medium: 1200px;
+
+.ascribe-global-action-wrapper {
+ position: fixed;
+ width: 100%;
+ max-width: 500px;
+ height:3.5em;
+ left:0;
+ right: 0;
+ top:0;
+ z-index: 2000;
+ display:table;
+ margin: 1px auto;
+}
+
+.ascribe-global-action {
+ text-align: center;
+ padding: 1em;
+ color: black;
+ border: 1px solid #cccccc;
+ background-color: white;
+ margin-top: 1px;
+}
\ No newline at end of file
diff --git a/sass/ascribe_notification_list.scss b/sass/ascribe_notification_list.scss
new file mode 100644
index 00000000..bd3c0b20
--- /dev/null
+++ b/sass/ascribe_notification_list.scss
@@ -0,0 +1,65 @@
+$break-small: 764px;
+$break-medium: 991px;
+$break-medium: 1200px;
+
+.notification-wrapper {
+ width: 350px;
+ height:8em;
+ padding: 0.3em;
+ border-bottom: 1px solid #cccccc;
+ margin: -3px -20px;
+
+ // ToDo: Include media queries for thumbnail
+ .thumbnail-wrapper {
+ width: 7.4em;
+ height: 7.4em;
+ padding:0;
+ cursor: pointer;
+ text-align: center;
+ img {
+ max-width: 100%;
+ max-height: 100%;
+ }
+ &::before {
+ content: ' ';
+ display: inline-block;
+ vertical-align: middle; /* vertical alignment of the inline element */
+ height: 100%;
+ }
+ }
+ h1 {
+ margin-top: 0.3em;
+ margin-bottom: 0.15em;
+ font-size: 1.8em;
+ }
+ .sub-header{
+ margin-bottom: 1em;
+ }
+ .notification-action{
+ color: $ascribe-color-green;
+ }
+}
+
+.notification-menu {
+ .dropdown-menu {
+ padding: 0 !important;
+ li a {
+ padding-top: 0;
+ }
+ }
+}
+
+.notification-amount {
+ padding: 0.3em;
+ font-size: 1.2em;
+
+}
+
+.ascribe-global-action {
+ text-align: center;
+ padding: 1em;
+ color: black;
+ border: 1px solid #cccccc;
+ background-color: white;
+ margin-top: 1px;
+}
\ No newline at end of file
diff --git a/sass/main.scss b/sass/main.scss
index 6ec1d37d..fb71ff2a 100644
--- a/sass/main.scss
+++ b/sass/main.scss
@@ -22,7 +22,9 @@ $BASE_URL: '<%= BASE_URL %>';
@import 'ascribe_media_player';
@import 'ascribe_uploader';
@import 'ascribe_footer';
+@import 'ascribe_global_action';
@import 'ascribe_global_notification';
+@import 'ascribe_notification_list';
@import 'ascribe_piece_register';
@import 'offset_right';
@import 'ascribe_settings';