Merge branch 'apps' of https://github.com/urbit/urbit into apps

This commit is contained in:
Anton Dyudin 2015-08-27 16:20:41 -07:00
commit 328a015800
10 changed files with 230 additions and 52 deletions

View File

@ -510,6 +510,9 @@
;html
;head
;meta(charset "utf-8");
;meta(name "viewport", content "width=device-width, ".
"height=device-height, initial-scale=1.0, user-scalable=0, ".
"minimum-scale=1.0, maximum-scale=1.0");
;title:"{(trip a)}"
;script(type "text/javascript", src "//cdnjs.cloudflare.com/ajax/".
"libs/jquery/2.1.1/jquery.min.js");

View File

@ -166,3 +166,17 @@ input {
outline: none;
border-bottom: 3px solid #555;
}
@media only screen and (min-device-width: 320px) and (max-device-width: 480px) {
#c {
width: 16rem;
margin-left: -8rem;
}
#pass {
width: 16rem;
}
input {
-webkit-appearance: none;
border-radius: 0;
}
}

View File

@ -167,9 +167,12 @@ h1.leader:after {
}
.input-bool,
.item .done {
width: 0.7rem;
height: 0.7rem;
width: 1rem;
height: 1rem;
border: 0.2rem solid #ccc;
padding: 0;
outline: none;
background-color: #fff;
}
.input-bool.true,
.item .done-true {
@ -205,9 +208,11 @@ h1.leader:after {
cursor: pointer;
transform-origin: 6px 12px;
transition: transform 200ms linear;
-webkit-transform-origin: 6px 12px;
}
.item.expand .expand {
transform: rotate(90deg);
-webkit-transform: rotate(90deg);
transition: transform 200ms linear;
}
.item .header {
@ -314,11 +319,12 @@ h1.leader:after {
}
.item .submit {
font-size: 0.7rem;
text-transform: uppercase;
font-weight: 500;
display: inline-block;
background-color: #b9b9b9;
letter-spacing: 0.07rem;
color: #fff;
border: 0;
padding: 0 0.3rem;
margin-top: 0.5rem;
}
@ -358,7 +364,10 @@ h1.leader:after {
border: 0;
font: inherit;
resize: none;
-webkit-user-select: text;
user-select: text;
}
textarea:focus,
.input:focus {
background-color: #e6e6e6;
}
@ -397,3 +406,78 @@ h1.leader:after {
width: 3rem;
background-color: #ccc;
}
@media only screen and (min-device-width: 320px) and (max-device-width: 480px) {
#c {
width: 100%;
margin: 0;
left: 0.6rem;
}
h1 {
font-size: 1rem;
}
input,
textarea {
-webkit-appearance: none;
border-radius: 0;
}
.input {
padding: 0 0.3rem 0 0.1rem;
}
.ctrl {
margin-top: 1rem;
}
.ctrl .sorts,
.ctrl .filters {
margin-left: 0;
}
.ctrl .filters .done label {
display: none;
}
.ctrl .sort {
padding: 0.2rem 0.3rem;
}
.ctrl .filter {
line-height: 1.3rem;
}
.ctrl .sort label,
.ctrl .filter label {
font-size: 0.7rem;
letter-spacing: 0.05rem;
line-height: 1.3rem;
}
.items {
margin-left: 0;
}
.item {
width: auto;
}
.item .sort {
display: none;
}
.item .title,
.item .date,
.item .tags {
min-width: 4rem;
max-width: 4rem;
margin-left: 0.3rem;
}
.item .expand {
float: right;
margin-right: 0.6rem;
}
.item .description,
.item .discussion {
margin: 0.5rem 0;
}
.item .description textarea {
min-width: 18rem;
margin: 0;
}
.item .comment.new {
max-width: 18rem;
}
.item .submit {
line-height: 1.6rem;
letter-spacing: 0;
}
}

View File

@ -91,9 +91,12 @@ h1.leader:after
.input-bool
.item .done
width .7rem
height .7rem
width 1rem
height 1rem
border .2rem solid #ccc
padding 0
outline none
background-color #fff
.input-bool.true
.item .done-true
@ -129,9 +132,11 @@ h1.leader:after
cursor pointer
transform-origin 6px 12px
transition transform 200ms linear
-webkit-transform-origin 6px 12px
&.expand .expand
transform rotate(90deg)
-webkit-transform rotate(90deg)
transition transform 200ms linear
.header
@ -237,11 +242,12 @@ h1.leader:after
.submit
font-size .7rem
text-transform uppercase
font-weight 500
display inline-block
background-color #b9b9b9
letter-spacing .07rem
color #fff
border 0
padding 0 .3rem
margin-top .5rem
@ -282,7 +288,10 @@ h1.leader:after
border 0
font inherit
resize none
-webkit-user-select text
user-select text
textarea:focus
.input:focus
background-color #e6e6e6

View File

@ -10,4 +10,76 @@
// @media only screen and (min-width: 320px) and (max-width: 1024px)
/* phones portrait and landscape ----------- */
// @media only screen and (min-device-width: 320px) and (max-device-width: 480px)
@media only screen and (min-device-width: 320px) and (max-device-width: 480px)
#c
width 100%
margin 0
left .6rem
h1
font-size 1rem
input
textarea
-webkit-appearance none
border-radius 0
.input
padding 0 .3rem 0 .1rem
.ctrl
margin-top 1rem
.ctrl .sorts
.ctrl .filters
margin-left 0
.ctrl .filters .done label
display none
.ctrl .sort
padding .2rem .3rem
.ctrl .filter
line-height 1.3rem
.ctrl .sort label
.ctrl .filter label
font-size .7rem
letter-spacing .05rem
line-height 1.3rem
.items
margin-left 0
.item
width auto
.item .sort
display none
.item .title
.item .date
.item .tags
min-width 4rem
max-width 4rem
margin-left .3rem
.item .expand
float right
margin-right .6rem
.item .description
.item .discussion
margin .5rem 0
.item .description textarea
min-width 18rem
margin 0
.item .comment.new
max-width 18rem
.item .submit
line-height 1.6rem
letter-spacing 0

View File

@ -31,8 +31,7 @@ module.exports =
key = key.split('_').join '-'
set = "#{key}": val
Persistence.put old:{id,version,dif:{set}}
Dispatcher.handleViewAction {type:'updateItem',id,version}
Dispatcher.handleViewAction {type:'updateItem',id,version,key,val}
ownItem: ({id,version},act) ->
version += 1

View File

@ -1,6 +1,6 @@
recl = React.createClass
rece = React.createElement
{div,h1,label} = React.DOM
{div,h1,label,button} = React.DOM
module.exports = recl
onClick: (e) ->
@ -41,7 +41,7 @@ module.exports = recl
(label {}, title)
switch filter
when 'done'
(div {
(button {
className:'input-bool ib '+@props.filters[key],
@onClick
},"")

View File

@ -1,6 +1,6 @@
recl = React.createClass
rece = React.createElement
{div,textarea} = React.DOM
{div,textarea,button} = React.DOM
WorkActions = require '../actions/WorkActions.coffee'
Field = require './FieldComponent.coffee'
@ -37,10 +37,12 @@ module.exports = recl
e.preventDefault()
return
onFocus: (e) -> @props._focus e,@
onFocus: (e) ->
@props._focus e,@
return true
_markDone: (e) ->
WorkActions.setItem @props.item,'done',(not @props.item.done?)
WorkActions.setItem @props.item,'done',(not (@props.item.done is true))
getAction: -> switch @props.item.doer
when null
@ -52,7 +54,7 @@ module.exports = recl
_changeStatus: (e) ->
return if @props.item.status is 'released'
if @props.item.status is 'accepted' and
@formatOwner(@props.item.creator) isnt window.urb.ship
@formatCreator(@props.item.creator) isnt window.urb.ship
return
WorkActions.ownItem @props.item,@getAction()
@ -71,9 +73,9 @@ module.exports = recl
_d += "..#{d.getHours()}.#{d.getMinutes()}.#{d.getSeconds()}"
_d
formatOwner: (o="") -> o.replace /\~/g,""
formatCreator: (o="") -> o.replace /\~/g,""
formatAudience: (a=[]) -> @formatOwner a.join(" ")
formatAudience: (a=[]) -> @formatCreator a.join(" ")
getInitialState: -> {expand:false}
@ -108,7 +110,7 @@ module.exports = recl
(div {
className:'header'
},
(div {className:'creator ib'}, @formatOwner(@props.item.owner))
(div {className:'creator ib'}, @formatCreator(@props.item.creator))
(div {
className:'status ib action-'+(action.length > 0)
'data-key':'status'
@ -120,7 +122,7 @@ module.exports = recl
(@renderField 'audience', {}, @formatAudience)
)
(div {className:'sort ib top'}, @props.item.sort)
(div {className:'done ib done-'+@props.item.done?, onClick:@_markDone}, '')
(button {className:'done ib done-'+(@props.item.done is true), onClick:@_markDone}, '')
(@renderTopField 'title', {@onFocus,@onKeyDown})
(@renderTopField 'date_due', {className:'date'}, @formatDate)
(@renderTopField 'tags', {}, (tags=[])-> tags.join(" "))
@ -149,7 +151,7 @@ module.exports = recl
(div {
contentEditable:true,
className:'input'})
(div {className:'submit',onClick:@_submitComment},'Post')
(button {className:'submit',onClick:@_submitComment},'Post')
)
)
)

View File

@ -62,7 +62,9 @@ module.exports = {
return Dispatcher.handleViewAction({
type: 'updateItem',
id: id,
version: version
version: version,
key: key,
val: val
});
},
ownItem: function(arg, act) {
@ -169,7 +171,6 @@ module.exports = {
};
},{"../dispatcher/Dispatcher.coffee":9,"../persistence/Persistence.coffee":15,"../util.coffee":17}],2:[function(require,module,exports){
var WorkActions, div, rece, recl, ref, textarea,
slice = [].slice;
@ -334,15 +335,14 @@ module.exports = recl({
});
},{"../actions/WorkActions.coffee":1}],3:[function(require,module,exports){
var div, h1, label, rece, recl, ref;
var button, div, h1, label, rece, recl, ref;
recl = React.createClass;
rece = React.createElement;
ref = React.DOM, div = ref.div, h1 = ref.h1, label = ref.label;
ref = React.DOM, div = ref.div, h1 = ref.h1, label = ref.label, button = ref.button;
module.exports = recl({
onClick: function(e) {
@ -427,7 +427,7 @@ module.exports = recl({
}, label({}, title), (function() {
switch (filter) {
case 'done':
return div({
return button({
className: 'input-bool ib ' + this.props.filters[key],
onClick: this.onClick
}, "");
@ -446,15 +446,14 @@ module.exports = recl({
});
},{}],4:[function(require,module,exports){
var Field, WorkActions, div, rece, recl, ref, textarea;
var Field, WorkActions, button, div, rece, recl, ref, textarea;
recl = React.createClass;
rece = React.createElement;
ref = React.DOM, div = ref.div, textarea = ref.textarea;
ref = React.DOM, div = ref.div, textarea = ref.textarea, button = ref.button;
WorkActions = require('../actions/WorkActions.coffee');
@ -499,10 +498,11 @@ module.exports = recl({
}
},
onFocus: function(e) {
return this.props._focus(e, this);
this.props._focus(e, this);
return true;
},
_markDone: function(e) {
return WorkActions.setItem(this.props.item, 'done', this.props.item.done == null);
return WorkActions.setItem(this.props.item, 'done', !(this.props.item.done === true));
},
getAction: function() {
var action;
@ -519,7 +519,7 @@ module.exports = recl({
if (this.props.item.status === 'released') {
return;
}
if (this.props.item.status === 'accepted' && this.formatOwner(this.props.item.creator) !== window.urb.ship) {
if (this.props.item.status === 'accepted' && this.formatCreator(this.props.item.creator) !== window.urb.ship) {
return;
}
return WorkActions.ownItem(this.props.item, this.getAction());
@ -545,7 +545,7 @@ module.exports = recl({
}
return _d;
},
formatOwner: function(o) {
formatCreator: function(o) {
if (o == null) {
o = "";
}
@ -555,7 +555,7 @@ module.exports = recl({
if (a == null) {
a = [];
}
return this.formatOwner(a.join(" "));
return this.formatCreator(a.join(" "));
},
getInitialState: function() {
return {
@ -609,7 +609,7 @@ module.exports = recl({
className: 'header'
}, div({
className: 'creator ib'
}, this.formatOwner(this.props.item.owner)), div({
}, this.formatCreator(this.props.item.creator)), div({
className: 'status ib action-' + (action.length > 0),
'data-key': 'status',
onClick: this._changeStatus
@ -619,8 +619,8 @@ module.exports = recl({
className: 'action a'
}, action)), this.renderField('audience', {}, this.formatAudience)), div({
className: 'sort ib top'
}, this.props.item.sort), div({
className: 'done ib done-' + (this.props.item.done != null),
}, this.props.item.sort), button({
className: 'done ib done-' + (this.props.item.done === true),
onClick: this._markDone
}, ''), this.renderTopField('title', {
onFocus: this.onFocus,
@ -677,7 +677,7 @@ module.exports = recl({
}, this.formatDate(new Date)), div({
contentEditable: true,
className: 'input'
}), div({
}), button({
className: 'submit',
onClick: this._submitComment
}, 'Post'))) : void 0);
@ -685,7 +685,6 @@ module.exports = recl({
});
},{"../actions/WorkActions.coffee":1,"./FieldComponent.coffee":2}],5:[function(require,module,exports){
var FilterComponent, ItemComponent, ListeningComponent, SortComponent, WorkActions, WorkStore, div, h1, input, rece, recl, ref, textarea;
@ -930,7 +929,6 @@ module.exports = recl({
});
},{"../actions/WorkActions.coffee":1,"../stores/WorkStore.coffee":16,"./FilterComponent.coffee":3,"./ItemComponent.coffee":4,"./ListeningComponent.coffee":6,"./SortComponent.coffee":7}],6:[function(require,module,exports){
var div, h1, input, rece, recl, ref, textarea;
@ -949,7 +947,6 @@ module.exports = recl({
});
},{}],7:[function(require,module,exports){
var button, div, h1, label, rece, recl, ref;
@ -994,7 +991,6 @@ module.exports = recl({
});
},{}],8:[function(require,module,exports){
var ListComponent, div, h1, rece, recl, ref;
@ -1017,7 +1013,6 @@ module.exports = recl({
});
},{"./ListComponent.coffee":5}],9:[function(require,module,exports){
var Dispatcher;
@ -1039,7 +1034,6 @@ module.exports = _.merge(new Dispatcher(), {
});
},{"flux":11}],10:[function(require,module,exports){
var WorkComponent;
@ -1052,7 +1046,6 @@ $(function() {
});
},{"./components/WorkComponent.coffee":8,"./util.coffee":17}],11:[function(require,module,exports){
/**
* Copyright (c) 2014-2015, Facebook, Inc.
@ -1450,7 +1443,6 @@ module.exports = {
};
},{}],16:[function(require,module,exports){
var Dispatcher, EventEmitter, WorkStore, _filters, _ghost, _list, _listening, _sorts, _tasks, _updated, assign, uuid32;
@ -1681,9 +1673,12 @@ WorkStore = assign({}, EventEmitter.prototype, {
return _tasks[id].archived = true;
},
updateItem: function(arg) {
var id, version;
id = arg.id, version = arg.version;
return _tasks[id].version = version;
var id, key, val, version;
id = arg.id, version = arg.version, key = arg.key, val = arg.val;
_tasks[id].version = version;
if (key === 'done') {
return _tasks[id].done = val;
}
}
});
@ -1701,7 +1696,6 @@ WorkStore.dispatchToken = Dispatcher.register(function(p) {
module.exports = WorkStore;
},{"../dispatcher/Dispatcher.coffee":9,"../util.coffee":17,"events":18,"object-assign":14}],17:[function(require,module,exports){
module.exports = {
uuid32: function() {
@ -1760,7 +1754,6 @@ module.exports = {
};
},{}],18:[function(require,module,exports){
// Copyright Joyent, Inc. and other Node contributors.
//

View File

@ -118,7 +118,9 @@ WorkStore = assign {},EventEmitter.prototype,{
_list = list
setAudience: ({id,to})-> _tasks[id].audience = to
archiveItem: ({id})-> _tasks[id].archived = true
updateItem: ({id,version})-> _tasks[id].version = version
updateItem: ({id,version,key,val})->
_tasks[id].version = version
_tasks[id].done = val if key is 'done'
}