mirror of
https://github.com/ascribe/onion.git
synced 2025-02-14 21:10:27 +01:00
Merge remote-tracking branch 'origin/AD-419-decouple-piece-registration-from-' into AD-551-work-on-burn-down-list
This commit is contained in:
commit
cbb965c264
@ -37,7 +37,7 @@ let AccordionListItem = React.createClass({
|
|||||||
},
|
},
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
if(this.props.content.num_editions !== 0) {
|
if(this.props.content.num_editions > 0) {
|
||||||
PieceListActions.fetchFirstEditionForPiece(this.props.content.id);
|
PieceListActions.fetchFirstEditionForPiece(this.props.content.id);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -72,6 +72,7 @@ let AccordionListItem = React.createClass({
|
|||||||
handleEditionCreationSuccess(response) {
|
handleEditionCreationSuccess(response) {
|
||||||
let notification = new GlobalNotificationModel(response.notification, 'success', 10000);
|
let notification = new GlobalNotificationModel(response.notification, 'success', 10000);
|
||||||
GlobalNotificationActions.appendGlobalNotification(notification);
|
GlobalNotificationActions.appendGlobalNotification(notification);
|
||||||
|
PieceListActions.updatePropertyForPiece({pieceId: this.props.content.id, key: 'num_editions', value: 0});
|
||||||
|
|
||||||
this.setState({
|
this.setState({
|
||||||
creatingEditions: true
|
creatingEditions: true
|
||||||
@ -116,7 +117,7 @@ let AccordionListItem = React.createClass({
|
|||||||
render() {
|
render() {
|
||||||
let linkData;
|
let linkData;
|
||||||
|
|
||||||
if(this.props.content.num_editions === 0) {
|
if(this.props.content.num_editions < 1) {
|
||||||
linkData = {
|
linkData = {
|
||||||
to: 'piece',
|
to: 'piece',
|
||||||
params: {
|
params: {
|
||||||
@ -167,7 +168,7 @@ let AccordionListItem = React.createClass({
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{this.props.content.num_editions === 0 && this.state.showCreateEditionsDialog ? <AccordionListItemCreateEditions pieceId={this.props.content.id} handleSuccess={this.handleEditionCreationSuccess}/> : null}
|
{this.props.content.num_editions < 1 && this.state.showCreateEditionsDialog ? <AccordionListItemCreateEditions pieceId={this.props.content.id} handleSuccess={this.handleEditionCreationSuccess}/> : null}
|
||||||
|
|
||||||
{/* this.props.children is AccordionListItemTableEditions */}
|
{/* this.props.children is AccordionListItemTableEditions */}
|
||||||
{this.props.children}
|
{this.props.children}
|
||||||
|
@ -16,12 +16,9 @@ let AccordionListItemCreateEditions = React.createClass({
|
|||||||
},
|
},
|
||||||
|
|
||||||
getFormData(){
|
getFormData(){
|
||||||
let data = {};
|
return {
|
||||||
for (let ref in this.refs.form.refs){
|
piece_id: parseInt(this.props.pieceId, 10)
|
||||||
data[this.refs.form.refs[ref].props.name] = this.refs.form.refs[ref].state.value;
|
};
|
||||||
}
|
|
||||||
data.piece_id = parseInt(this.props.pieceId, 10);
|
|
||||||
return data;
|
|
||||||
},
|
},
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
|
@ -75,23 +75,23 @@ let AccordionListItemEditionWidget = React.createClass({
|
|||||||
let piece = this.props.piece;
|
let piece = this.props.piece;
|
||||||
let numEditions = piece.num_editions;
|
let numEditions = piece.num_editions;
|
||||||
|
|
||||||
if(numEditions === 0) {
|
if(numEditions === -1) {
|
||||||
if(this.props.creatingEditions) {
|
return (
|
||||||
return (
|
<span
|
||||||
|
onClick={this.props.toggleCreateEditionsDialog}
|
||||||
|
className="ascribe-accordion-list-item-edition-widget">
|
||||||
|
+ Editions
|
||||||
|
</span>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else if(numEditions === 0) {
|
||||||
|
return (
|
||||||
<span>
|
<span>
|
||||||
Creating Editions <span className="glyph-ascribe-spool-chunked ascribe-color spin"/>
|
Creating Editions <span className="glyph-ascribe-spool-chunked ascribe-color spin"/>
|
||||||
</span>
|
</span>
|
||||||
);
|
);
|
||||||
} else {
|
}
|
||||||
return (
|
else if(numEditions === 1) {
|
||||||
<span
|
|
||||||
onClick={this.props.toggleCreateEditionsDialog}
|
|
||||||
className="ascribe-accordion-list-item-edition-widget">
|
|
||||||
+ Editions
|
|
||||||
</span>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
} else if(numEditions === 1) {
|
|
||||||
let editionMapping = piece && piece.firstEdition ? piece.firstEdition.edition_number + '/' + piece.num_editions : '';
|
let editionMapping = piece && piece.firstEdition ? piece.firstEdition.edition_number + '/' + piece.num_editions : '';
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
@ -84,7 +84,8 @@ let Edition = React.createClass({
|
|||||||
<CollapsibleParagraph
|
<CollapsibleParagraph
|
||||||
title="Notes"
|
title="Notes"
|
||||||
show={(this.state.currentUser.username && true || false) ||
|
show={(this.state.currentUser.username && true || false) ||
|
||||||
(this.props.edition.acl.indexOf('edit') > -1 || this.props.edition.public_note)}>
|
(this.props.edition.acl.indexOf('edit') > -1 || this.props.edition.public_note)}
|
||||||
|
defaultExpanded={true}>
|
||||||
<EditionPersonalNote
|
<EditionPersonalNote
|
||||||
currentUser={this.state.currentUser}
|
currentUser={this.state.currentUser}
|
||||||
handleSuccess={this.props.loadEdition}
|
handleSuccess={this.props.loadEdition}
|
||||||
|
@ -56,7 +56,8 @@ let Piece = React.createClass({
|
|||||||
title="Further Details"
|
title="Further Details"
|
||||||
show={this.props.piece.acl.indexOf('edit') > -1
|
show={this.props.piece.acl.indexOf('edit') > -1
|
||||||
|| Object.keys(this.props.piece.extra_data).length > 0
|
|| Object.keys(this.props.piece.extra_data).length > 0
|
||||||
|| this.props.piece.other_data !== null}>
|
|| this.props.piece.other_data !== null}
|
||||||
|
defaultExpanded={true}>
|
||||||
<FurtherDetails
|
<FurtherDetails
|
||||||
editable={this.props.piece.acl.indexOf('edit') > -1}
|
editable={this.props.piece.acl.indexOf('edit') > -1}
|
||||||
pieceId={this.props.piece.id}
|
pieceId={this.props.piece.id}
|
||||||
|
@ -7,6 +7,7 @@ import Button from 'react-bootstrap/lib/Button';
|
|||||||
|
|
||||||
import requests from '../../utils/requests';
|
import requests from '../../utils/requests';
|
||||||
import { getLangText } from '../../utils/lang_utils';
|
import { getLangText } from '../../utils/lang_utils';
|
||||||
|
import { mergeOptionsWithDuplicates } from '../../utils/general_utils';
|
||||||
import AlertDismissable from './alert';
|
import AlertDismissable from './alert';
|
||||||
|
|
||||||
|
|
||||||
@ -54,13 +55,13 @@ let Form = React.createClass({
|
|||||||
},
|
},
|
||||||
|
|
||||||
getFormData(){
|
getFormData(){
|
||||||
if ('getFormData' in this.props){
|
|
||||||
return this.props.getFormData();
|
|
||||||
}
|
|
||||||
let data = {};
|
let data = {};
|
||||||
for (let ref in this.refs){
|
for (let ref in this.refs){
|
||||||
data[this.refs[ref].props.name] = this.refs[ref].state.value;
|
data[this.refs[ref].props.name] = this.refs[ref].state.value;
|
||||||
}
|
}
|
||||||
|
if ('getFormData' in this.props){
|
||||||
|
data = mergeOptionsWithDuplicates(data, this.props.getFormData());
|
||||||
|
}
|
||||||
return data;
|
return data;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -19,7 +19,8 @@ let InputCheckbox = React.createClass({
|
|||||||
handleFocus() {
|
handleFocus() {
|
||||||
this.refs.checkbox.getDOMNode().checked = !this.refs.checkbox.getDOMNode().checked;
|
this.refs.checkbox.getDOMNode().checked = !this.refs.checkbox.getDOMNode().checked;
|
||||||
this.setState({
|
this.setState({
|
||||||
show: this.refs.checkbox.getDOMNode().checked
|
show: this.refs.checkbox.getDOMNode().checked,
|
||||||
|
value: this.refs.checkbox.getDOMNode().checked
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -66,12 +66,16 @@ let Header = React.createClass({
|
|||||||
getPoweredBy(){
|
getPoweredBy(){
|
||||||
if (this.state.whitelabel.logo) {
|
if (this.state.whitelabel.logo) {
|
||||||
return (
|
return (
|
||||||
<div className="row no-margin ascribe-subheader">
|
<div className="row ascribe-subheader">
|
||||||
<a className="pull-right" href="https://www.ascribe.io/" target="_blank">
|
<div className="col-xs-12 col-sm-10 col-md-8 col-lg-8 col-sm-offset-1 col-md-offset-2 col-lg-offset-2">
|
||||||
<span id="powered">{getLangText('powered by')} </span>
|
<div className="row">
|
||||||
<span>ascribe </span>
|
<a className="pull-right" href="https://www.ascribe.io/" target="_blank">
|
||||||
<span className="glyph-ascribe-spool-chunked ascribe-color"></span>
|
<span id="powered">{getLangText('powered by')} </span>
|
||||||
</a>
|
<span>ascribe </span>
|
||||||
|
<span className="glyph-ascribe-spool-chunked ascribe-color"></span>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>);
|
</div>);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
@ -105,13 +105,10 @@ let PasswordResetForm = React.createClass({
|
|||||||
mixins: [Router.Navigation],
|
mixins: [Router.Navigation],
|
||||||
|
|
||||||
getFormData(){
|
getFormData(){
|
||||||
let data = {};
|
return {
|
||||||
for (let ref in this.refs.form.refs){
|
email: this.props.email,
|
||||||
data[this.refs.form.refs[ref].props.name] = this.refs.form.refs[ref].state.value;
|
token: this.props.token
|
||||||
}
|
};
|
||||||
data.email = this.props.email;
|
|
||||||
data.token = this.props.token;
|
|
||||||
return data;
|
|
||||||
},
|
},
|
||||||
handleSuccess() {
|
handleSuccess() {
|
||||||
this.transitionTo('pieces');
|
this.transitionTo('pieces');
|
||||||
|
@ -98,12 +98,9 @@ let RegisterPiece = React.createClass( {
|
|||||||
},
|
},
|
||||||
|
|
||||||
getFormData(){
|
getFormData(){
|
||||||
let data = {};
|
return {
|
||||||
for (let ref in this.refs.form.refs){
|
digital_work_key: this.state.digitalWorkKey
|
||||||
data[this.refs.form.refs[ref].props.name] = this.refs.form.refs[ref].state.value;
|
};
|
||||||
}
|
|
||||||
data.digital_work_key = this.state.digitalWorkKey;
|
|
||||||
return data;
|
|
||||||
},
|
},
|
||||||
|
|
||||||
submitKey(key){
|
submitKey(key){
|
||||||
|
@ -91,6 +91,9 @@ let SignupForm = React.createClass({
|
|||||||
', ' + getLangText('please confirm') + '.');
|
', ' + getLangText('please confirm') + '.');
|
||||||
|
|
||||||
},
|
},
|
||||||
|
getFormData(){
|
||||||
|
return {terms: this.refs.form.refs.terms.refs.input.state.value};
|
||||||
|
},
|
||||||
render() {
|
render() {
|
||||||
let tooltipPassword = getLangText('Your password must be at least 10 characters') + '.\n ' +
|
let tooltipPassword = getLangText('Your password must be at least 10 characters') + '.\n ' +
|
||||||
getLangText('This password is securing your digital property like a bank account') + '.\n ' +
|
getLangText('This password is securing your digital property like a bank account') + '.\n ' +
|
||||||
@ -101,6 +104,7 @@ let SignupForm = React.createClass({
|
|||||||
ref='form'
|
ref='form'
|
||||||
url={apiUrls.users_signup}
|
url={apiUrls.users_signup}
|
||||||
handleSuccess={this.handleSuccess}
|
handleSuccess={this.handleSuccess}
|
||||||
|
getFormData={this.getFormData}
|
||||||
buttons={
|
buttons={
|
||||||
<button type="submit" className="btn ascribe-btn ascribe-btn-login">
|
<button type="submit" className="btn ascribe-btn ascribe-btn-login">
|
||||||
{getLangText('Sign up to ascribe')}
|
{getLangText('Sign up to ascribe')}
|
||||||
@ -153,7 +157,7 @@ let SignupForm = React.createClass({
|
|||||||
name="terms"
|
name="terms"
|
||||||
className="ascribe-settings-property-collapsible-toggle"
|
className="ascribe-settings-property-collapsible-toggle"
|
||||||
style={{paddingBottom: 0}}>
|
style={{paddingBottom: 0}}>
|
||||||
<InputCheckbox />
|
<InputCheckbox/>
|
||||||
</Property>
|
</Property>
|
||||||
</Form>
|
</Form>
|
||||||
);
|
);
|
||||||
|
@ -112,6 +112,24 @@ export function mergeOptions(...l) {
|
|||||||
return newObj;
|
return newObj;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Takes a list of object and merges their keys to one object.
|
||||||
|
* Uses mergeOptions for two objects.
|
||||||
|
* @param {[type]} l [description]
|
||||||
|
* @return {[type]} [description]
|
||||||
|
*/
|
||||||
|
export function mergeOptionsWithDuplicates(...l) {
|
||||||
|
// If the objects submitted in the list have duplicates,in their key names,
|
||||||
|
// abort the merge and tell the function's user to check his objects.
|
||||||
|
let newObj = {};
|
||||||
|
|
||||||
|
for(let i = 1; i < l.length; i++) {
|
||||||
|
newObj = _mergeOptions(newObj, _mergeOptions(l[i - 1], l[i]));
|
||||||
|
}
|
||||||
|
|
||||||
|
return newObj;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Overwrites obj1's values with obj2's and adds obj2's if non existent in obj1
|
* Overwrites obj1's values with obj2's and adds obj2's if non existent in obj1
|
||||||
* @param obj1
|
* @param obj1
|
||||||
|
@ -62,6 +62,11 @@ hr {
|
|||||||
font-size: 0.8em;
|
font-size: 0.8em;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.img-brand {
|
||||||
|
padding: 0;
|
||||||
|
height: 45px;
|
||||||
|
margin: 5px 0 5px 0;
|
||||||
|
}
|
||||||
.truncate {
|
.truncate {
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
width: 4em;
|
width: 4em;
|
||||||
@ -101,10 +106,6 @@ hr {
|
|||||||
color: $ascribe-color;
|
color: $ascribe-color;
|
||||||
}
|
}
|
||||||
|
|
||||||
.img-brand{
|
|
||||||
height: 25px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.ascribe-subheader{
|
.ascribe-subheader{
|
||||||
padding-bottom: 10px;
|
padding-bottom: 10px;
|
||||||
margin-top: -10px;
|
margin-top: -10px;
|
||||||
|
Loading…
Reference in New Issue
Block a user