mirror of
https://github.com/urbit/shrub.git
synced 2024-12-14 11:08:45 +03:00
Merge remote-tracking branch 'anton/tree404' into pending
This commit is contained in:
commit
84bae67929
@ -1 +1 @@
|
||||
;list(data-source "default");
|
||||
;list(data-source "default", is404 "true");
|
||||
|
@ -4,7 +4,7 @@ reactify = require './Reactify.coffee'
|
||||
query = require './Async.coffee'
|
||||
|
||||
recl = React.createClass
|
||||
{div,a,ul,li,h1} = React.DOM
|
||||
{div,pre,span,a,ul,li,h1} = React.DOM
|
||||
|
||||
module.exports = query {
|
||||
path:'t'
|
||||
@ -21,7 +21,15 @@ module.exports = query {
|
||||
@props.dataType
|
||||
posts: @props.dataType is 'post' # needs css update
|
||||
default: @props['data-source'] is 'default'
|
||||
(ul {className:k}, @renderList())
|
||||
kids = @renderList()
|
||||
unless kids.length is 0 and @props.is404?
|
||||
return (ul {className:k}, kids)
|
||||
|
||||
div {className:k},
|
||||
h1 {className:'error'}, 'Error: Empty path'
|
||||
div {},
|
||||
pre {}, @props.path
|
||||
span {}, 'is either empty or does not exist.'
|
||||
|
||||
renderList: ->
|
||||
# check if kids all have a sort meta tag
|
||||
|
@ -35,6 +35,7 @@ module.exports = {
|
||||
};
|
||||
|
||||
|
||||
|
||||
},{"../dispatcher/Dispatcher.coffee":14,"../persistence/TreePersistence.coffee":20}],2:[function(require,module,exports){
|
||||
var BodyComponent, CLICK, Links, TreeActions, TreeStore, a, clas, div, query, reactify, recl, ref;
|
||||
|
||||
@ -314,6 +315,7 @@ module.exports = query({
|
||||
}), div);
|
||||
|
||||
|
||||
|
||||
},{"../actions/TreeActions.coffee":1,"../stores/TreeStore.coffee":21,"./Async.coffee":3,"./BodyComponent.coffee":4,"./Reactify.coffee":11,"classnames":16}],3:[function(require,module,exports){
|
||||
var TreeActions, TreeStore, _load, code, div, recl, ref, span;
|
||||
|
||||
@ -424,6 +426,7 @@ module.exports = function(queries, Child, load) {
|
||||
};
|
||||
|
||||
|
||||
|
||||
},{"../actions/TreeActions.coffee":1,"../stores/TreeStore.coffee":21,"./LoadComponent.coffee":10}],4:[function(require,module,exports){
|
||||
var Logo, Next, a, clas, div, img, p, query, reactify, recl, ref;
|
||||
|
||||
@ -529,6 +532,7 @@ module.exports = query({
|
||||
}));
|
||||
|
||||
|
||||
|
||||
},{"./Async.coffee":3,"./Reactify.coffee":11,"classnames":16}],5:[function(require,module,exports){
|
||||
var div, recl, ref, textarea;
|
||||
|
||||
@ -552,6 +556,7 @@ module.exports = recl({
|
||||
});
|
||||
|
||||
|
||||
|
||||
},{}],6:[function(require,module,exports){
|
||||
var div, recl;
|
||||
|
||||
@ -574,6 +579,7 @@ module.exports = {
|
||||
};
|
||||
|
||||
|
||||
|
||||
},{"./CodeMirror.coffee":5,"./EmailComponent.coffee":7,"./KidsComponent.coffee":8,"./ListComponent.coffee":9,"./SearchComponent.coffee":12,"./TocComponent.coffee":13}],7:[function(require,module,exports){
|
||||
var button, div, input, p, reactify, recl, ref;
|
||||
|
||||
@ -654,6 +660,7 @@ module.exports = recl({
|
||||
});
|
||||
|
||||
|
||||
|
||||
},{"./Reactify.coffee":11}],8:[function(require,module,exports){
|
||||
var a, div, hr, li, query, reactify, recl, ref, ul;
|
||||
|
||||
@ -725,8 +732,9 @@ module.exports = query({
|
||||
}));
|
||||
|
||||
|
||||
|
||||
},{"./Async.coffee":3,"./Reactify.coffee":11}],9:[function(require,module,exports){
|
||||
var a, clas, div, h1, li, query, reactify, recl, ref, ul;
|
||||
var a, clas, div, h1, li, pre, query, reactify, recl, ref, span, ul;
|
||||
|
||||
clas = require('classnames');
|
||||
|
||||
@ -736,7 +744,7 @@ query = require('./Async.coffee');
|
||||
|
||||
recl = React.createClass;
|
||||
|
||||
ref = React.DOM, div = ref.div, a = ref.a, ul = ref.ul, li = ref.li, h1 = ref.h1;
|
||||
ref = React.DOM, div = ref.div, pre = ref.pre, span = ref.span, a = ref.a, ul = ref.ul, li = ref.li, h1 = ref.h1;
|
||||
|
||||
module.exports = query({
|
||||
path: 't',
|
||||
@ -748,16 +756,24 @@ module.exports = query({
|
||||
}, recl({
|
||||
displayName: "List",
|
||||
render: function() {
|
||||
var k;
|
||||
var k, kids;
|
||||
k = clas({
|
||||
list: true
|
||||
}, this.props.dataType, {
|
||||
posts: this.props.dataType === 'post',
|
||||
"default": this.props['data-source'] === 'default'
|
||||
});
|
||||
return ul({
|
||||
kids = this.renderList();
|
||||
if (!(kids.length === 0 && (this.props.is404 != null))) {
|
||||
return ul({
|
||||
className: k
|
||||
}, kids);
|
||||
}
|
||||
return div({
|
||||
className: k
|
||||
}, this.renderList());
|
||||
}, h1({
|
||||
className: 'error'
|
||||
}, 'Error: Empty path'), div({}, pre({}, this.props.path), span({}, 'is either empty or does not exist.')));
|
||||
},
|
||||
renderList: function() {
|
||||
var _date, _k, _keys, date, elem, href, i, item, k, len, parts, path, preview, ref1, ref2, ref3, ref4, ref5, ref6, ref7, results, sorted, title, v;
|
||||
@ -872,6 +888,7 @@ module.exports = query({
|
||||
}));
|
||||
|
||||
|
||||
|
||||
},{"./Async.coffee":3,"./Reactify.coffee":11,"classnames":16}],10:[function(require,module,exports){
|
||||
var div, input, recl, ref, textarea;
|
||||
|
||||
@ -912,6 +929,7 @@ module.exports = recl({
|
||||
});
|
||||
|
||||
|
||||
|
||||
},{}],11:[function(require,module,exports){
|
||||
var Virtual, div, load, reactify, recl, ref, rele, span, walk;
|
||||
|
||||
@ -979,6 +997,7 @@ module.exports = _.extend(reactify, {
|
||||
});
|
||||
|
||||
|
||||
|
||||
},{"./LoadComponent.coffee":10}],12:[function(require,module,exports){
|
||||
var a, div, input, query, reactify, recl, ref,
|
||||
slice = [].slice;
|
||||
@ -1117,6 +1136,7 @@ module.exports = query({
|
||||
}));
|
||||
|
||||
|
||||
|
||||
},{"./Async.coffee":3,"./Reactify.coffee":11}],13:[function(require,module,exports){
|
||||
var div, query, reactify, recl,
|
||||
slice = [].slice;
|
||||
@ -1245,6 +1265,7 @@ module.exports = query({
|
||||
}));
|
||||
|
||||
|
||||
|
||||
},{"./Async.coffee":3,"./Reactify.coffee":11}],14:[function(require,module,exports){
|
||||
var Dispatcher;
|
||||
|
||||
@ -1266,6 +1287,7 @@ module.exports = _.extend(new Dispatcher(), {
|
||||
});
|
||||
|
||||
|
||||
|
||||
},{"flux":17}],15:[function(require,module,exports){
|
||||
var rend;
|
||||
|
||||
@ -1439,6 +1461,7 @@ $(function() {
|
||||
});
|
||||
|
||||
|
||||
|
||||
},{"./actions/TreeActions.coffee":1,"./components/AnchorComponent.coffee":2,"./components/BodyComponent.coffee":4,"./components/Components.coffee":6,"./persistence/TreePersistence.coffee":20}],16:[function(require,module,exports){
|
||||
/*!
|
||||
Copyright (c) 2015 Jed Watson.
|
||||
@ -1866,6 +1889,7 @@ module.exports = {
|
||||
};
|
||||
|
||||
|
||||
|
||||
},{}],21:[function(require,module,exports){
|
||||
var EventEmitter, MessageDispatcher, QUERIES, TreeStore, _curr, _data, _tree, clog;
|
||||
|
||||
@ -1924,7 +1948,7 @@ TreeStore = _.extend(EventEmitter.prototype, {
|
||||
data[k] = have[k];
|
||||
}
|
||||
if (query.kids) {
|
||||
if (have.EMPTY) {
|
||||
if (have.kids === false) {
|
||||
data.kids = {};
|
||||
} else {
|
||||
for (k in tree) {
|
||||
@ -1987,7 +2011,7 @@ TreeStore = _.extend(EventEmitter.prototype, {
|
||||
this.loadValues(tree[k], path + "/" + k, v);
|
||||
}
|
||||
if (data.kids && _.isEmpty(data.kids)) {
|
||||
old.EMPTY = true;
|
||||
old.kids = false;
|
||||
}
|
||||
return _data[path] = old;
|
||||
},
|
||||
@ -2091,6 +2115,7 @@ TreeStore.dispatchToken = MessageDispatcher.register(function(payload) {
|
||||
module.exports = TreeStore;
|
||||
|
||||
|
||||
|
||||
},{"../dispatcher/Dispatcher.coffee":14,"events":22}],22:[function(require,module,exports){
|
||||
// Copyright Joyent, Inc. and other Node contributors.
|
||||
//
|
||||
|
@ -29,7 +29,7 @@ TreeStore = _.extend EventEmitter.prototype, {
|
||||
if t isnt QUERIES[k] then throw TypeError "Wrong query type: #{k}, '#{t}'"
|
||||
data[k] = have[k]
|
||||
if query.kids
|
||||
if have.EMPTY
|
||||
if have.kids is false
|
||||
data.kids = {}
|
||||
else for k,sub of tree
|
||||
data.kids ?= {}
|
||||
@ -60,16 +60,7 @@ TreeStore = _.extend EventEmitter.prototype, {
|
||||
@loadValues tree[k], path+"/"+k, v
|
||||
|
||||
if data.kids && _.isEmpty data.kids
|
||||
old.EMPTY = true
|
||||
# XX why here?
|
||||
# old.body =
|
||||
# gn: 'div'
|
||||
# c: [ {gn:'h1', ga:{className:'error'}, c:['Error: Empty path']}
|
||||
# {gn:'div', c:[
|
||||
# {gn:'pre', c:[@getCurr()]}
|
||||
# {gn:'span', c:['is either empty or does not exist.']}
|
||||
# # {gn:'list'} XX handle empty snip
|
||||
# ] }]
|
||||
old.kids = false
|
||||
|
||||
_data[path] = old
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user