1
0
mirror of https://github.com/ascribe/onion.git synced 2024-12-22 09:23:13 +01:00

remove edition list count in table

This commit is contained in:
Tim Daubenschütz 2015-06-12 15:00:26 +02:00
parent 87bc6b3559
commit 2bb004d2fb
10 changed files with 24 additions and 28 deletions

View File

@ -53,7 +53,7 @@ gulp.task('js:build', function() {
bundle(false);
});
gulp.task('serve', ['browser-sync', 'run-server', 'sass:build', 'sass:watch', 'copy'], function() {
gulp.task('serve', ['browser-sync', 'run-server', 'lint:watch', 'sass:build', 'sass:watch', 'copy'], function() {
bundle(true);
});

View File

@ -1,12 +1,9 @@
'use strict';
import React from 'react';
import Router from 'react-router';
import { getLangText } from '../../utils/lang_utils';
let Link = Router.Link;
let AccordionListItem = React.createClass({
propTypes: {
className: React.PropTypes.string,

View File

@ -1,7 +1,6 @@
'use strict';
import React from 'react';
import Router from 'react-router';
import EditionListStore from '../../stores/edition_list_store';
import EditionListActions from '../../actions/edition_list_actions';
@ -19,14 +18,11 @@ import TableItemAclFiltered from '../ascribe_table/table_item_acl_filtered';
import { getLangText } from '../../utils/lang_utils';
let Link = Router.Link;
let AccordionListItemTableEditions = React.createClass({
propTypes: {
className: React.PropTypes.string,
parentId: React.PropTypes.number,
numOfEditions: React.PropTypes.number,
show: React.PropTypes.bool
},
@ -88,7 +84,7 @@ let AccordionListItemTableEditions = React.createClass({
orderAsc = this.state.editionList[this.props.parentId].orderAsc;
}
let transition = new TransitionModel('edition', 'editionId', 'bitcoin_id', PieceListActions.closeAllEditionLists);
let transition = new TransitionModel('edition', 'editionId', 'bitcoin_id');
let columnList = [
new ColumnModel(
@ -161,8 +157,7 @@ let AccordionListItemTableEditions = React.createClass({
<AccordionListItemTableToggle
className="ascribe-accordion-list-table-toggle"
onClick={this.toggleTable}
show={this.props.show}
numOfTableItems={this.props.numOfEditions} />
show={this.props.show} />
</AccordionListItemTable>
</div>

View File

@ -6,8 +6,7 @@ let AccordionListItemTableToggle = React.createClass({
propTypes: {
className: React.PropTypes.string,
onClick: React.PropTypes.func,
show: React.PropTypes.bool,
numOfTableItems: React.PropTypes.number
show: React.PropTypes.bool
},
render() {
@ -15,7 +14,7 @@ let AccordionListItemTableToggle = React.createClass({
<span
className={this.props.className}
onClick={this.props.onClick}>
{this.props.show ? 'Hide all ' + this.props.numOfTableItems + ' Editions' : 'Show all ' + this.props.numOfTableItems + ' Editions'}
{this.props.show ? 'Hide all Editions' : 'Show all Editions'}
</span>
);
}

View File

@ -20,7 +20,6 @@ let Table = React.createClass({
},
renderChildren() {
var that = this;
return ReactAddons.Children.map(this.props.children, (child, i) => {
return ReactAddons.addons.cloneWithProps(child, {
columnList: this.props.columnList,

View File

@ -4,7 +4,6 @@ import React from 'react';
import Router from 'react-router';
import { ColumnModel } from './models/table_models';
import TableColumnMixin from '../../mixins/table_column_mixin';
let Link = Router.Link;
@ -15,7 +14,7 @@ let TableItemWrapper = React.createClass({
columnWidth: React.PropTypes.number.isRequired
},
mixins: [TableColumnMixin, Router.Navigation],
mixins: [Router.Navigation],
render() {
return (
@ -25,8 +24,6 @@ let TableItemWrapper = React.createClass({
let TypeElement = column.displayType;
let typeElementProps = column.transformFn(this.props.columnContent);
let columnClass = this.calcColumnClasses(this.props.columnList, i, this.props.columnWidth);
if(!column.transition) {
return (
<td

View File

@ -38,10 +38,10 @@ let Header = React.createClass({
return (
<Navbar>
<Nav>
<a className="navbar-brand" href="/">
<Link className="navbar-brand" to="pieces" path="/">
<span>ascribe </span>
<span className="glyph-ascribe-spool-chunked ascribe-color"></span>
</a>
</Link>
</Nav>
<Nav right>
<DropdownButton eventKey="1" title={this.state.currentUser.username}>

View File

@ -78,8 +78,7 @@ let PieceList = React.createClass({
<AccordionListItemTableEditions
className="ascribe-accordion-list-item-table col-xs-12 col-sm-8 col-md-6 col-lg-6 col-sm-offset-2 col-md-offset-3 col-lg-offset-3"
parentId={item.id}
show={item.show}
numOfEditions={item.num_editions}/>
show={item.show} />
</AccordionListItem>
);
})}

View File

@ -16,11 +16,12 @@ class EditionListStore {
this.editionList[pieceId].forEach((edition, i) => {
// This uses the index of the new editionList for determining the edition.
// If the list of editions can be sorted in the future, this needs to be changed!
if (editionListOfPiece[i]){
if (editionListOfPiece[i]) {
editionListOfPiece[i] = React.addons.update(edition, {$merge: editionListOfPiece[i]});
}
});
}
this.editionList[pieceId] = editionListOfPiece;
/**
@ -36,7 +37,7 @@ class EditionListStore {
onSelectEdition({pieceId, editionId, toValue}) {
this.editionList[pieceId].forEach((edition) => {
// http://stackoverflow.com/a/519157/1263876
// Taken from: http://stackoverflow.com/a/519157/1263876
if(typeof toValue !== 'undefined' && edition.id === editionId) {
edition.selected = toValue;
} else if(edition.id === editionId) {
@ -57,9 +58,7 @@ class EditionListStore {
.forEach((edition) => {
try {
delete edition.selected;
} catch(err) {
//just ignore
}
} catch(err) {/* ignore and keep going */}
});
});
}

View File

@ -1,5 +1,6 @@
'use strict';
import React from 'react';
import alt from '../alt';
import PieceListActions from '../actions/piece_list_actions';
@ -72,6 +73,16 @@ class PieceListStore {
* We did not implement this, as we're going to add pagination to pieceList at some
* point anyway. Then, this problem is automatically resolved.
*/
pieceList.forEach((piece, i) => {
let oldPiece = this.pieceList[i];
if(oldPiece) {
piece = React.addons.update(piece, {
show: { $set: oldPiece.show }
});
}
});
this.pieceList = pieceList;
}
}