Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
64 commits
Select commit Hold shift + click to select a range
bb4fd07
Test tagnav component
impactmass May 3, 2017
85377be
Use existing tag component
impactmass May 4, 2017
4c36547
Update component setup
impactmass May 4, 2017
6f43661
Use existing tagsList container
impactmass May 8, 2017
fc33ca0
Remove debugging
impactmass May 8, 2017
03a028b
Edit button
impactmass May 8, 2017
694534b
Use tagItem loop to match styles instead of existing
impactmass May 8, 2017
407f101
Base tagTree init
impactmass May 8, 2017
ad9f3b9
Fix structure
impactmass May 8, 2017
d9aa11d
Fix dropdown mouseover event
impactmass May 8, 2017
abf96c6
Edit conditional
impactmass May 8, 2017
76f55d4
Base tag editatble
impactmass May 9, 2017
5faa153
Button switch fix
impactmass May 9, 2017
b60df6a
On edit fix
impactmass May 9, 2017
65ec5ba
Selectable button icon
impactmass May 9, 2017
6548442
Enable drop of tagtree by icon
impactmass May 9, 2017
1f39a0a
Init edit mode for tagTree
impactmass May 9, 2017
bf5caa2
Tagtree second level new tag
impactmass May 9, 2017
1125017
Typo fix
impactmass May 10, 2017
00f77e1
Fix top level width and classes
impactmass May 10, 2017
10a8d82
Show Base tagList
impactmass May 11, 2017
128a15e
Lint clean up
impactmass May 11, 2017
ce75132
Remove commented code
impactmass May 11, 2017
7fd28fe
Style fix and show new tag on edit
impactmass May 11, 2017
4e07759
i18n
impactmass May 11, 2017
4b7c1fe
Init saving top level tags
impactmass May 11, 2017
3d341e9
Saving tags - cont
impactmass May 11, 2017
ec93983
New tag save fix
impactmass May 16, 2017
b1161e0
Switching to Taglist custom
impactmass May 16, 2017
25ceca4
Saving top level
impactmass May 16, 2017
ec168b3
Enable new tag option
impactmass May 16, 2017
d40b882
Move class names to base comp
impactmass May 16, 2017
978f155
Style on create new tag item
impactmass May 16, 2017
2041825
Fix Hover back
impactmass May 16, 2017
9552bc0
Move file
impactmass May 16, 2017
4bd395f
Tag select prop
impactmass May 17, 2017
75bd0ff
Rename files
impactmass May 17, 2017
c0c5081
Fix save and delete
impactmass May 17, 2017
985b2a4
Reorder element wrapper
impactmass May 17, 2017
1f6db1f
Init passing the functions down
impactmass May 17, 2017
a69d314
Init editing new tag item on tree
impactmass May 18, 2017
650ba58
Separate the two new tagItems
impactmass May 18, 2017
9eadf5f
Adding new tags on tree + refactor 🎉
impactmass May 18, 2017
3eeb161
Fix delete on subtags
impactmass May 18, 2017
97e9543
Reset form after save and prevent saving empty tags
impactmass May 18, 2017
1bc29d4
Prevent close of tree after save
impactmass May 18, 2017
4614c86
Restructure tree state to fix input
impactmass May 18, 2017
bfe84a3
Init refactor on tagTree
impactmass May 19, 2017
b3bccfd
Props setup after refactor
impactmass May 19, 2017
8000258
Reposition button
impactmass May 19, 2017
c47d211
Autocompletion fixing
impactmass May 21, 2017
e8767d7
Add componentWillReceiveProps to fix re-render and reset
impactmass May 21, 2017
8c47ccc
Refactor into container comp
impactmass May 22, 2017
6d51661
Remove debugs
impactmass May 22, 2017
79448ff
Merge brent-milestone-54 into seun-convert-tagnav-react-2043
impactmass May 22, 2017
f6f9ab0
Use composewithTracker
impactmass May 22, 2017
91d1ceb
Remove props with spread
impactmass May 22, 2017
c2d8f07
Update props list
impactmass May 23, 2017
9a3ac59
Fix logic breaking new tag style
impactmass May 23, 2017
0e4d11d
Tag sort order after drag
impactmass May 23, 2017
142e788
Clean un-used vars
impactmass May 23, 2017
d641ff8
Merge brent-milestone-54 into seun-convert-tagnav-react-2043
impactmass May 23, 2017
a50318b
Add react tagNav to main navbar container
impactmass May 23, 2017
214df04
Fix lint issue
impactmass May 23, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Props setup after refactor
  • Loading branch information
impactmass committed May 19, 2017
commit b3bccfd868f15f91c1558c9e8164628934d478aa
12 changes: 6 additions & 6 deletions imports/plugins/core/ui-tagnav/client/components/tagNav.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ const TagNavHelpers = {
const foundTag = this.tagById(tagId, tags);

if (foundTag) {
if (_.isArray(foundTag.relatedTagIds) && foundTag.relatedTagIds.length) {
if (Array.isArray(foundTag.relatedTagIds) && foundTag.relatedTagIds.length) {
return true;
}
}
Expand Down Expand Up @@ -158,6 +158,10 @@ class TagNav extends Component {
this.setState(newState);
}

handleTagSave = (tag) => {
TagNavHelpers.onTagUpdate(tag._id, tag.name);
}

handleMoveTag = () => {
}

Expand Down Expand Up @@ -270,16 +274,12 @@ class TagNav extends Component {
}

hasDropdownClassName(tag) {
if (_.isArray(tag.relatedTagIds)) {
if (Array.isArray(tag.relatedTagIds)) {
return "has-dropdown";
}
return null;
}

handleTagSave = (tag) => {
TagNavHelpers.onTagUpdate(tag._id, tag.name);
}

navbarSelectedClassName = (tag) => {
const currentSelectedTag = this.state.selectedTag;

Expand Down
24 changes: 12 additions & 12 deletions imports/plugins/core/ui-tagnav/client/components/tagTree.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,16 +37,13 @@ class TagTree extends Component {
}

// setting up the func before passing to TagItem
handleNewTagSave = (parentTag) => {
return (event, tag) => {
event.preventDefault();
if (this.props.onNewTagSave) {
this.props.onNewTagSave(tag, parentTag);
this.setState({
newTag: { name: "" }
});
}
};
handleNewTagSave = (event, tag) => {
if (this.props.onNewTagSave) {
this.props.onNewTagSave(tag, this.props.tagTreeProps.parentTag);
this.setState({
newTag: { name: "" }
});
}
}

handleTagUpdate = (event, tag) => {
Expand All @@ -71,9 +68,12 @@ class TagTree extends Component {
<div className={`rui grouptag ${this.className}`} data-id={tag._id} key={tag._id}>
<TagTreeHeader
tag={tag}
parentTag={this.state.parentTag}
editable={this.props.editable}
onTagRemove={this.props.onTagRemove}
/>
<TagTreeBody
{...this.props}
tags={TagHelpers.subTags(tag)}
parentTag={tag}
editable={this.props.editable}
Expand Down Expand Up @@ -104,8 +104,8 @@ class TagTree extends Component {
suggestions={this.state.suggestions}
onClearSuggestions={this.handleClearSuggestions}
onGetSuggestions={this.handleGetSuggestions}
onTagInputBlur={this.handleNewTagSave(this.props.parentTag)}
onTagSave={this.handleNewTagSave(this.props.parentTag)}
onTagInputBlur={this.handleNewTagSave}
onTagSave={this.handleNewTagSave}
onTagUpdate={this.handleNewTagUpdate}
/>
</div>
Expand Down
41 changes: 35 additions & 6 deletions imports/plugins/core/ui-tagnav/client/components/tagTreeBody.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,39 @@ class TagTreeBody extends Component {
super(props);
this.state = {
suggestions: [],
tags: this.props.tags,
newTag: {
name: ""
}
};
}

// setting up the func before passing to TagItem
handleNewTagSave = (event, tag) => {
if (this.props.onNewTagSave) {
this.props.onNewTagSave(tag, this.props.parentTag);
this.setState({
newTag: { name: "" }
});
}
}

handleTagUpdate = (event, tag) => {
// const newState = update(this.state, {
// tagsByKey: {
// [tag._id]: {
// $set: tag
// }
// }
// });

// this.setState(newState);
}

handleNewTagUpdate = (event, tag) => { // updates blank tag state being edited
this.setState({ newTag: tag });
}

genTagsList(tags, parentTag) {
if (Array.isArray(tags)) {
return tags.map((tag, index) => {
Expand All @@ -28,8 +55,6 @@ class TagTreeBody extends Component {
draggable={true}
selectable={true}
suggestions={this.state.suggestions}
onClearSuggestions={this.handleClearSuggestions}
onGetSuggestions={this.handleGetSuggestions}
onMove={this.handleMoveTag}
onTagInputBlur={this.handleTagSave}
onTagMouseOut={this.handleTagMouseOut}
Expand All @@ -47,7 +72,7 @@ class TagTreeBody extends Component {
return (
<div className="content">
<div className="rui tags" data-id={this.props.parentTag._id}>
{this.genTagsList(this.props.tags, this.props.parentTag)}
{this.genTagsList(this.state.tags, this.props.parentTag)}
{this.props.editable &&
<div className="rui item create">
<TagItem
Expand All @@ -59,9 +84,9 @@ class TagTreeBody extends Component {
suggestions={this.state.suggestions}
onClearSuggestions={this.props.onClearSuggestions}
onGetSuggestions={this.props.onGetSuggestions}
onTagInputBlur={this.handleNewTagSave(this.props.parentTag)}
onTagSave={this.handleNewTagSave(this.props.parentTag)}
onTagUpdate={this.handleNewTagUpdate(this.props.parentTag.name)}
onTagInputBlur={this.handleNewTagSave}
onTagSave={this.handleNewTagSave}
onTagUpdate={this.handleNewTagUpdate}
/>
</div>
}
Expand All @@ -73,6 +98,10 @@ class TagTreeBody extends Component {

TagTreeBody.propTypes = {
editable: PropTypes.bool,
onClearSuggestions: PropTypes.func,
onGetSuggestions: PropTypes.func,
onNewTagSave: PropTypes.func,
onTagRemove: PropTypes.func,
parentTag: PropTypes.object,
tags: ReactionPropTypes.arrayOfTags
};
Expand Down
27 changes: 21 additions & 6 deletions imports/plugins/core/ui-tagnav/client/components/tagTreeHeader.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,29 +5,40 @@ class TagTreeHeader extends Component {
constructor(props) {
super(props);
this.state = {
suggestions: []
suggestions: [],
tag: this.props.tag
};
}

handleTagUpdate = (event, tag) => {
this.setState({ tag: tag });
}

handleTagSave = (event, tag) => {
if (this.props.onTagSave) {
this.props.onTagSave(tag);
}
}

render() {
return (
<div className="header">
<TagItem
tag={this.props.tag}
tag={this.state.tag}
parentTag={this.props.parentTag}
selectable={true}
className="js-tagNav-item"
editable={this.props.editable}
isSelected={this.isSelected}
suggestions={this.state.suggestions}
parentTag={this.props.parentTag}
onClearSuggestions={this.props.onClearSuggestions}
onGetSuggestions={this.props.onGetSuggestions}
onMove={this.props.onMove}
onTagInputBlur={this.props.onTagInputBlur}
onTagMouseOut={this.props.onTagMouseOut}
onTagMouseOver={this.props.onTagMouseOver}
onTagRemove={this.props.onTagRemove}
onTagSave={this.props.onTagSave}
onTagSave={this.handleTagSave}
onTagInputBlur={this.handleTagSave}
onTagUpdate={this.handleTagUpdate}
/>
</div>
Expand All @@ -36,7 +47,11 @@ class TagTreeHeader extends Component {
}

TagTreeHeader.propTypes = {
parentTag: PropTypes.object
editable: PropTypes.bool,
onTagRemove: PropTypes.func,
onTagSave: PropTypes.func,
parentTag: PropTypes.object,
tag: PropTypes.object
};

export default TagTreeHeader;
3 changes: 1 addition & 2 deletions imports/plugins/core/ui/client/components/tags/tags.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,7 @@ class Tags extends Component {
}

tagTreeProps = (tag) => {
const subTagGroups = TagHelpers.subTags(tag);

const subTagGroups = _.compact(TagHelpers.subTags(tag));
const tagsByKey = {};

if (Array.isArray(subTagGroups)) {
Expand Down