parse tree-comments user out of ;h2:code:""

urbit/tree@6bdd46e
This commit is contained in:
Anton Dyudin 2016-05-23 18:33:41 -07:00
parent a60f32a8cf
commit 61026b95dc
3 changed files with 22 additions and 22 deletions

View File

@ -6,7 +6,7 @@
!:
::::
::
|_ all/(list (pair time manx))
|_ all/(list (pair time {ship marl}))
::
++ grow :: convert to
|%
@ -14,9 +14,9 @@
:- %a
%+ turn
(sort all |=({a/* b/*} (lor b a)))
|= {a/time b/manx} ^- ^json
=. a.g.b [id+(time-to-id a) a.g.b]
(jobe time+(jode a) body+(react-to-json:react b) ~)
|= {a/time b/ship c/marl} ^- ^json
=+ bod=[[%div id+(time-to-id a) ~] c]
(jobe time+(jode a) user+(jape +:<b>) body+(react-to-json:react bod) ~)
--
++ grab |% :: convert from
++ noun (list {time manx}) :: clam from %noun

View File

@ -2,8 +2,14 @@
:::: /hoon/comments/tree/ren
::
/? 310
/: /%/comments /_ @da /&elem&/md/
/: /%/comments /_ @da
/; |= a/manx ^- {ship marl}
~| a
?> ?=(_[/div ;/(~) ~[[%h2 **] ~[[%code **] ;/(who=**)]] kid=**] a)
=> .(a ^+([/div ;/(~) ~[[%h2 **] ~[[%code **] ;/(who=*tape)]] kid=*marl] a))
[(slav %p (crip who.a)) kid.a]
/&elem&/md/
::
::::
::
`(list (pair time manx))`-.-
`(list (pair time {ship marl}))`-.-

View File

@ -563,7 +563,7 @@ module.exports = recl({
},{}],5:[function(require,module,exports){
var Comment, Ship, TreeActions, a, clas, code, div, form, img, input, load, p, query, reactify, recl, ref, rele, textarea, util;
var Comment, Ship, TreeActions, a, clas, code, div, form, h2, img, input, load, p, query, reactify, recl, ref, rele, textarea, util;
clas = require('classnames');
@ -581,7 +581,7 @@ recl = React.createClass;
rele = React.createElement;
ref = React.DOM, div = ref.div, p = ref.p, img = ref.img, a = ref.a, form = ref.form, textarea = ref.textarea, input = ref.input, code = ref.code;
ref = React.DOM, div = ref.div, p = ref.p, h2 = ref.h2, img = ref.img, a = ref.a, form = ref.form, textarea = ref.textarea, input = ref.input, code = ref.code;
Ship = function(name) {
return code({
@ -590,13 +590,13 @@ Ship = function(name) {
};
Comment = function(arg) {
var body, loading, ref1, time;
time = arg.time, body = arg.body, loading = (ref1 = arg.loading) != null ? ref1 : false;
var body, loading, ref1, time, user;
time = arg.time, user = arg.user, body = arg.body, loading = (ref1 = arg.loading) != null ? ref1 : false;
return div({
className: clas("comment", {
loading: loading
})
}, "" + (window.urb.util.toDate(new Date(time))), reactify(body, "comt", {
}, "" + (window.urb.util.toDate(new Date(time))), h2({}, Ship(user)), reactify(body, "comt", {
components: {}
}));
};
@ -621,26 +621,20 @@ module.exports = query({
}
},
onSubmit: function(e) {
var body, value;
var body, user, value;
value = this.refs["in"].comment.value;
TreeActions.addComment(this.props.path, this.props.spur, value);
body = {
gn: 'div',
c: [
{
gn: 'h2',
c: ["~" + urb.user]
}, {
gn: 'p',
c: [value]
}
]
gn: 'p',
c: [value]
};
user = urb.user;
this.setState({
value: "",
loading: {
'loading': 'loading',
body: body,
user: urb.user,
time: Date.now()
}
});