1
0
mirror of https://github.com/ascribe/onion.git synced 2024-12-22 17:33:14 +01:00

Merge branch 'master' into AD-1315-implement-submission-flow

This commit is contained in:
Tim Daubenschütz 2015-11-16 09:41:06 +01:00
commit 8188e5ca2f
11 changed files with 36 additions and 32 deletions

View File

@ -43,7 +43,25 @@ For this project, we're using:
* We don't use ES6's class declaration for React components because it does not support Mixins as well as Autobinding ([Blog post about it](http://facebook.github.io/react/blog/2015/01/27/react-v0.13.0-beta-1.html#autobinding)) * We don't use ES6's class declaration for React components because it does not support Mixins as well as Autobinding ([Blog post about it](http://facebook.github.io/react/blog/2015/01/27/react-v0.13.0-beta-1.html#autobinding))
* We don't use camel case for file naming but in everything Javascript related * We don't use camel case for file naming but in everything Javascript related
* We use `let` instead of `var`: [SA Post](http://stackoverflow.com/questions/762011/javascript-let-keyword-vs-var-keyword) * We use `let` instead of `var`: [SA Post](http://stackoverflow.com/questions/762011/javascript-let-keyword-vs-var-keyword)
* We don't use Javascript's `Date` object, as its interface introduced bugs previously and we're including `momentjs` for other dependencies anyways
Branch names
=====================
Since we moved to Github, we cannot create branch names automatically with JIRA anymore.
To not lose context, but still be able to switch branches quickly using a ticket's number, we're recommending the following rules when naming our branches in onion.
```
AD-<JIRA-ticket-id>-brief-and-sane-description-of-the-ticket
```
where `brief-and-sane-description-of-the-ticket` does not need to equal to the ticket's title.
This allows JIRA to still track branches and pull-requests while allowing us to keep our peace of mind.
Example
-------------
**JIRA ticket name:** `AD-1242 - Frontend caching for simple endpoints to measure perceived page load <more useless information>`
**Github branch name:** `AD-1242-caching-solution-for-stores`
SCSS Code Conventions SCSS Code Conventions
===================== =====================

View File

@ -1,6 +1,7 @@
'use strict'; 'use strict';
import React from 'react'; import React from 'react';
import Moment from 'moment';
import Glyphicon from 'react-bootstrap/lib/Glyphicon'; import Glyphicon from 'react-bootstrap/lib/Glyphicon';
import OverlayTrigger from 'react-bootstrap/lib/OverlayTrigger'; import OverlayTrigger from 'react-bootstrap/lib/OverlayTrigger';
@ -129,7 +130,7 @@ let AccordionListItemWallet = React.createClass({
piece={this.props.content} piece={this.props.content}
subsubheading={ subsubheading={
<div className="pull-left"> <div className="pull-left">
<span>{new Date(this.props.content.date_created).getFullYear()}</span> <span>{Moment(this.props.content.date_created, 'YYYY-MM-DD').year()}</span>
{this.getLicences()} {this.getLicences()}
</div>} </div>}
buttons={ buttons={

View File

@ -2,6 +2,7 @@
import React from 'react'; import React from 'react';
import { Link, History } from 'react-router'; import { Link, History } from 'react-router';
import Moment from 'moment';
import Row from 'react-bootstrap/lib/Row'; import Row from 'react-bootstrap/lib/Row';
import Col from 'react-bootstrap/lib/Col'; import Col from 'react-bootstrap/lib/Col';
@ -85,7 +86,7 @@ let Edition = React.createClass({
<hr style={{marginTop: 0}}/> <hr style={{marginTop: 0}}/>
<h1 className="ascribe-detail-title">{this.props.edition.title}</h1> <h1 className="ascribe-detail-title">{this.props.edition.title}</h1>
<EditionDetailProperty label="BY" value={this.props.edition.artist_name} /> <EditionDetailProperty label="BY" value={this.props.edition.artist_name} />
<EditionDetailProperty label="DATE" value={ new Date(this.props.edition.date_created).getFullYear() } /> <EditionDetailProperty label="DATE" value={Moment(this.props.edition.date_created, 'YYYY-MM-DD').year()} />
<hr/> <hr/>
</div> </div>
<EditionSummary <EditionSummary

View File

@ -2,6 +2,7 @@
import React from 'react'; import React from 'react';
import { History } from 'react-router'; import { History } from 'react-router';
import Moment from 'moment';
import PieceActions from '../../actions/piece_actions'; import PieceActions from '../../actions/piece_actions';
import PieceStore from '../../stores/piece_store'; import PieceStore from '../../stores/piece_store';
@ -236,7 +237,7 @@ let PieceContainer = React.createClass({
<hr style={{marginTop: 0}}/> <hr style={{marginTop: 0}}/>
<h1 className="ascribe-detail-title">{this.state.piece.title}</h1> <h1 className="ascribe-detail-title">{this.state.piece.title}</h1>
<DetailProperty label="BY" value={this.state.piece.artist_name} /> <DetailProperty label="BY" value={this.state.piece.artist_name} />
<DetailProperty label="DATE" value={ new Date(this.state.piece.date_created).getFullYear() } /> <DetailProperty label="DATE" value={Moment(this.state.piece.date_created, 'YYYY-MM-DD').year() } />
{this.state.piece.num_editions > 0 ? <DetailProperty label="EDITIONS" value={ this.state.piece.num_editions } /> : null} {this.state.piece.num_editions > 0 ? <DetailProperty label="EDITIONS" value={ this.state.piece.num_editions } /> : null}
<hr/> <hr/>
</div> </div>

File diff suppressed because one or more lines are too long

View File

@ -3,6 +3,7 @@
import React from 'react'; import React from 'react';
import { Link } from 'react-router'; import { Link } from 'react-router';
import StarRating from 'react-star-rating'; import StarRating from 'react-star-rating';
import Moment from 'moment';
import PieceListActions from '../../../../../../actions/piece_list_actions'; import PieceListActions from '../../../../../../actions/piece_list_actions';
import PieceListStore from '../../../../../../stores/piece_list_store'; import PieceListStore from '../../../../../../stores/piece_list_store';
@ -182,7 +183,7 @@ let AccordionListItemPrize = React.createClass({
artistName={artistName} artistName={artistName}
subsubheading={ subsubheading={
<div> <div>
<span>{new Date(this.props.content.date_created).getFullYear()}</span> <span>{Moment(this.props.content.date_created, 'YYYY-MM-DD').year()}</span>
</div>} </div>}
buttons={this.getPrizeButtons()} buttons={this.getPrizeButtons()}
badge={this.getPrizeBadge()}> badge={this.getPrizeBadge()}>

View File

@ -150,7 +150,7 @@ let PieceContainer = React.createClass({
<h1 className="ascribe-detail-title">{this.state.piece.title}</h1> <h1 className="ascribe-detail-title">{this.state.piece.title}</h1>
<DetailProperty label={getLangText('BY')} value={artistName} /> <DetailProperty label={getLangText('BY')} value={artistName} />
<DetailProperty label={getLangText('DATE')} value={new Date(this.state.piece.date_created).getFullYear()} /> <DetailProperty label={getLangText('DATE')} value={Moment(this.state.piece.date_created, 'YYYY-MM-DD').year()} />
{artistEmail} {artistEmail}
{this.getActions()} {this.getActions()}
<hr/> <hr/>

View File

@ -1,6 +1,7 @@
'use strict'; 'use strict';
import React from 'react'; import React from 'react';
import Moment from 'moment';
import Piece from '../../../../../components/ascribe_detail/piece'; import Piece from '../../../../../components/ascribe_detail/piece';
@ -39,7 +40,7 @@ let WalletPieceContainer = React.createClass({
<hr style={{marginTop: 0}}/> <hr style={{marginTop: 0}}/>
<h1 className="ascribe-detail-title">{this.props.piece.title}</h1> <h1 className="ascribe-detail-title">{this.props.piece.title}</h1>
<DetailProperty label="BY" value={this.props.piece.artist_name} /> <DetailProperty label="BY" value={this.props.piece.artist_name} />
<DetailProperty label="DATE" value={new Date(this.props.piece.date_created).getFullYear()} /> <DetailProperty label="DATE" value={Moment(this.props.piece.date_created, 'YYYY-MM-DD').year()} />
<hr/> <hr/>
</div> </div>
} }

View File

@ -1,6 +1,7 @@
'use strict'; 'use strict';
import React from 'react'; import React from 'react';
import Moment from 'moment';
import AccordionListItemPiece from '../../../../../ascribe_accordion_list/accordion_list_item_piece'; import AccordionListItemPiece from '../../../../../ascribe_accordion_list/accordion_list_item_piece';
@ -100,7 +101,7 @@ let CylandAccordionListItem = React.createClass({
piece={this.props.content} piece={this.props.content}
subsubheading={ subsubheading={
<div className="pull-left"> <div className="pull-left">
<span>{new Date(this.props.content.date_created).getFullYear()}</span> <span>{Moment(this.props.content.date_created, 'YYYY-MM-DD').year()}</span>
</div>} </div>}
buttons={this.getSubmitButtons()}> buttons={this.getSubmitButtons()}>
{this.props.children} {this.props.children}

View File

@ -1,6 +1,7 @@
'use strict'; 'use strict';
import React from 'react'; import React from 'react';
import Moment from 'moment';
import AccordionListItemPiece from '../../../../../ascribe_accordion_list/accordion_list_item_piece'; import AccordionListItemPiece from '../../../../../ascribe_accordion_list/accordion_list_item_piece';
@ -106,7 +107,7 @@ let IkonotvAccordionListItem = React.createClass({
piece={this.props.content} piece={this.props.content}
subsubheading={ subsubheading={
<div className="pull-left"> <div className="pull-left">
<span>{new Date(this.props.content.date_created).getFullYear()}</span> <span>{Moment(this.props.content.date_created, 'YYYY-MM-DD').year()}</span>
</div>} </div>}
buttons={this.getSubmitButtons()}> buttons={this.getSubmitButtons()}>
{this.props.children} {this.props.children}

View File

@ -2,6 +2,7 @@
import Q from 'q'; import Q from 'q';
import SparkMD5 from 'spark-md5'; import SparkMD5 from 'spark-md5';
import Moment from 'moment';
import { getLangText } from './lang_utils'; import { getLangText } from './lang_utils';
@ -37,7 +38,7 @@ export function computeHashOfFile(file) {
let spark = new SparkMD5.ArrayBuffer(); let spark = new SparkMD5.ArrayBuffer();
let fileReader = new FileReader(); let fileReader = new FileReader();
let startTime = new Date(); let startTime = new Moment();
// comment: We should convert this to es6 at some point, however if so please consider that // comment: We should convert this to es6 at some point, however if so please consider that
// an arrow function will get rid of the function's scope... // an arrow function will get rid of the function's scope...
@ -53,7 +54,7 @@ export function computeHashOfFile(file) {
console.info('computed hash %s (took %d s)', console.info('computed hash %s (took %d s)',
fileHash, fileHash,
Math.round(((new Date() - startTime) / 1000) % 60)); // Compute hash Math.round(((new Moment() - startTime) / 1000) % 60)); // Compute hash
let blobTextFile = makeTextFile(fileHash, file); let blobTextFile = makeTextFile(fileHash, file);
resolve(blobTextFile); resolve(blobTextFile);