mirror of
https://github.com/ascribe/onion.git
synced 2025-01-03 10:25:08 +01:00
remove edition list count in table
This commit is contained in:
parent
87bc6b3559
commit
2bb004d2fb
@ -53,7 +53,7 @@ gulp.task('js:build', function() {
|
|||||||
bundle(false);
|
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);
|
bundle(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -1,12 +1,9 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import Router from 'react-router';
|
|
||||||
|
|
||||||
import { getLangText } from '../../utils/lang_utils';
|
import { getLangText } from '../../utils/lang_utils';
|
||||||
|
|
||||||
let Link = Router.Link;
|
|
||||||
|
|
||||||
let AccordionListItem = React.createClass({
|
let AccordionListItem = React.createClass({
|
||||||
propTypes: {
|
propTypes: {
|
||||||
className: React.PropTypes.string,
|
className: React.PropTypes.string,
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import Router from 'react-router';
|
|
||||||
|
|
||||||
import EditionListStore from '../../stores/edition_list_store';
|
import EditionListStore from '../../stores/edition_list_store';
|
||||||
import EditionListActions from '../../actions/edition_list_actions';
|
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';
|
import { getLangText } from '../../utils/lang_utils';
|
||||||
|
|
||||||
let Link = Router.Link;
|
|
||||||
|
|
||||||
let AccordionListItemTableEditions = React.createClass({
|
let AccordionListItemTableEditions = React.createClass({
|
||||||
|
|
||||||
propTypes: {
|
propTypes: {
|
||||||
className: React.PropTypes.string,
|
className: React.PropTypes.string,
|
||||||
parentId: React.PropTypes.number,
|
parentId: React.PropTypes.number,
|
||||||
numOfEditions: React.PropTypes.number,
|
|
||||||
show: React.PropTypes.bool
|
show: React.PropTypes.bool
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -88,7 +84,7 @@ let AccordionListItemTableEditions = React.createClass({
|
|||||||
orderAsc = this.state.editionList[this.props.parentId].orderAsc;
|
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 = [
|
let columnList = [
|
||||||
new ColumnModel(
|
new ColumnModel(
|
||||||
@ -161,8 +157,7 @@ let AccordionListItemTableEditions = React.createClass({
|
|||||||
<AccordionListItemTableToggle
|
<AccordionListItemTableToggle
|
||||||
className="ascribe-accordion-list-table-toggle"
|
className="ascribe-accordion-list-table-toggle"
|
||||||
onClick={this.toggleTable}
|
onClick={this.toggleTable}
|
||||||
show={this.props.show}
|
show={this.props.show} />
|
||||||
numOfTableItems={this.props.numOfEditions} />
|
|
||||||
</AccordionListItemTable>
|
</AccordionListItemTable>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
@ -6,8 +6,7 @@ let AccordionListItemTableToggle = React.createClass({
|
|||||||
propTypes: {
|
propTypes: {
|
||||||
className: React.PropTypes.string,
|
className: React.PropTypes.string,
|
||||||
onClick: React.PropTypes.func,
|
onClick: React.PropTypes.func,
|
||||||
show: React.PropTypes.bool,
|
show: React.PropTypes.bool
|
||||||
numOfTableItems: React.PropTypes.number
|
|
||||||
},
|
},
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
@ -15,7 +14,7 @@ let AccordionListItemTableToggle = React.createClass({
|
|||||||
<span
|
<span
|
||||||
className={this.props.className}
|
className={this.props.className}
|
||||||
onClick={this.props.onClick}>
|
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>
|
</span>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -20,7 +20,6 @@ let Table = React.createClass({
|
|||||||
},
|
},
|
||||||
|
|
||||||
renderChildren() {
|
renderChildren() {
|
||||||
var that = this;
|
|
||||||
return ReactAddons.Children.map(this.props.children, (child, i) => {
|
return ReactAddons.Children.map(this.props.children, (child, i) => {
|
||||||
return ReactAddons.addons.cloneWithProps(child, {
|
return ReactAddons.addons.cloneWithProps(child, {
|
||||||
columnList: this.props.columnList,
|
columnList: this.props.columnList,
|
||||||
|
@ -4,7 +4,6 @@ import React from 'react';
|
|||||||
import Router from 'react-router';
|
import Router from 'react-router';
|
||||||
|
|
||||||
import { ColumnModel } from './models/table_models';
|
import { ColumnModel } from './models/table_models';
|
||||||
import TableColumnMixin from '../../mixins/table_column_mixin';
|
|
||||||
|
|
||||||
let Link = Router.Link;
|
let Link = Router.Link;
|
||||||
|
|
||||||
@ -15,7 +14,7 @@ let TableItemWrapper = React.createClass({
|
|||||||
columnWidth: React.PropTypes.number.isRequired
|
columnWidth: React.PropTypes.number.isRequired
|
||||||
},
|
},
|
||||||
|
|
||||||
mixins: [TableColumnMixin, Router.Navigation],
|
mixins: [Router.Navigation],
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
return (
|
return (
|
||||||
@ -25,8 +24,6 @@ let TableItemWrapper = React.createClass({
|
|||||||
let TypeElement = column.displayType;
|
let TypeElement = column.displayType;
|
||||||
let typeElementProps = column.transformFn(this.props.columnContent);
|
let typeElementProps = column.transformFn(this.props.columnContent);
|
||||||
|
|
||||||
let columnClass = this.calcColumnClasses(this.props.columnList, i, this.props.columnWidth);
|
|
||||||
|
|
||||||
if(!column.transition) {
|
if(!column.transition) {
|
||||||
return (
|
return (
|
||||||
<td
|
<td
|
||||||
|
@ -38,10 +38,10 @@ let Header = React.createClass({
|
|||||||
return (
|
return (
|
||||||
<Navbar>
|
<Navbar>
|
||||||
<Nav>
|
<Nav>
|
||||||
<a className="navbar-brand" href="/">
|
<Link className="navbar-brand" to="pieces" path="/">
|
||||||
<span>ascribe </span>
|
<span>ascribe </span>
|
||||||
<span className="glyph-ascribe-spool-chunked ascribe-color"></span>
|
<span className="glyph-ascribe-spool-chunked ascribe-color"></span>
|
||||||
</a>
|
</Link>
|
||||||
</Nav>
|
</Nav>
|
||||||
<Nav right>
|
<Nav right>
|
||||||
<DropdownButton eventKey="1" title={this.state.currentUser.username}>
|
<DropdownButton eventKey="1" title={this.state.currentUser.username}>
|
||||||
|
@ -78,8 +78,7 @@ let PieceList = React.createClass({
|
|||||||
<AccordionListItemTableEditions
|
<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"
|
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}
|
parentId={item.id}
|
||||||
show={item.show}
|
show={item.show} />
|
||||||
numOfEditions={item.num_editions}/>
|
|
||||||
</AccordionListItem>
|
</AccordionListItem>
|
||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
|
@ -21,6 +21,7 @@ class EditionListStore {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
this.editionList[pieceId] = editionListOfPiece;
|
this.editionList[pieceId] = editionListOfPiece;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -36,7 +37,7 @@ class EditionListStore {
|
|||||||
onSelectEdition({pieceId, editionId, toValue}) {
|
onSelectEdition({pieceId, editionId, toValue}) {
|
||||||
this.editionList[pieceId].forEach((edition) => {
|
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) {
|
if(typeof toValue !== 'undefined' && edition.id === editionId) {
|
||||||
edition.selected = toValue;
|
edition.selected = toValue;
|
||||||
} else if(edition.id === editionId) {
|
} else if(edition.id === editionId) {
|
||||||
@ -57,9 +58,7 @@ class EditionListStore {
|
|||||||
.forEach((edition) => {
|
.forEach((edition) => {
|
||||||
try {
|
try {
|
||||||
delete edition.selected;
|
delete edition.selected;
|
||||||
} catch(err) {
|
} catch(err) {/* ignore and keep going */}
|
||||||
//just ignore
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
import React from 'react';
|
||||||
import alt from '../alt';
|
import alt from '../alt';
|
||||||
|
|
||||||
import PieceListActions from '../actions/piece_list_actions';
|
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
|
* We did not implement this, as we're going to add pagination to pieceList at some
|
||||||
* point anyway. Then, this problem is automatically resolved.
|
* 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;
|
this.pieceList = pieceList;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user