carte-server 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/carte/client/tasks.coffee +2 -0
- data/lib/carte/client/views/content.cjsx +5 -7
- data/lib/carte/client/views/slideshow.cjsx +70 -33
- data/package.json +2 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 38ff867c838212facdf04eceb6479aba9f084adf
|
4
|
+
data.tar.gz: e366d1aefe102821f4a010548f44ea82e22e7685
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2076727a9393edaa380e0deee1d8f7342889e4ab45409aec58691fd129c6a3cfa3ba14b1c29a48feba6540c791d3f8f3ca611eddc9b5bf8a68528f36503242e8
|
7
|
+
data.tar.gz: 5835726ec6f54293d5cd70f9915c557aabaf1205ca518b7b29e685300634bf5626921a993cf284098c79a3e535c6e24baab5906759e12b27246404ed8de552f1
|
@@ -3,6 +3,7 @@ path = require 'path'
|
|
3
3
|
gulp = require 'gulp'
|
4
4
|
gulpUtil = require 'gulp-util'
|
5
5
|
gulpIf = require 'gulp-if'
|
6
|
+
gulpGzip = require 'gulp-gzip'
|
6
7
|
sourceStream = require 'vinyl-source-stream'
|
7
8
|
browserify = require 'browserify'
|
8
9
|
watchify = require 'watchify'
|
@@ -75,4 +76,5 @@ module.exports = class Carte
|
|
75
76
|
.bundle()
|
76
77
|
.pipe sourceStream file
|
77
78
|
.pipe gulpIf(!@watching, streamify(uglify(compress: {drop_console: !@watching})))
|
79
|
+
.pipe gulpIf(!@watching, gulpGzip())
|
78
80
|
.pipe gulp.dest dir
|
@@ -21,21 +21,19 @@ module.exports = React.createClass
|
|
21
21
|
@props.router.off "route", @callback
|
22
22
|
|
23
23
|
render: ->
|
24
|
+
console.log '[views/content] render'
|
24
25
|
<div className="carte-content">
|
25
26
|
{
|
26
27
|
switch @props.router.current
|
27
28
|
when "list"
|
29
|
+
console.log '[views/content] list', @props
|
28
30
|
cards = new CardCollection()
|
29
31
|
cards.query = $.extend {}, config.default_query, @props.router.query
|
30
32
|
cards.fetching = true
|
31
33
|
cards.fetch success: ()-> cards.fetching = false
|
32
|
-
#title = []
|
33
|
-
#for k, v of cards.query
|
34
|
-
# title.push(String(k).capitalize() + ': ' + v)
|
35
|
-
#title = title.join(', ')
|
36
|
-
#title = config.title + ' (' + title + ')'
|
37
|
-
#document.title = title
|
38
34
|
if cards.query.mode == 'flash'
|
35
|
+
cards.query.auto = 'off' if !cards.query.auto
|
36
|
+
cards.query.hide = 'none' if !cards.query.hide
|
39
37
|
document.title = config.title + '、スライドショー'
|
40
38
|
<Slideshow key='slideshow' router={@props.router} cards={cards} />
|
41
39
|
else
|
@@ -63,6 +61,6 @@ module.exports = React.createClass
|
|
63
61
|
document.title = config.title + '、' + card.get('title')
|
64
62
|
<List key='show' cards={cards} card={card} />
|
65
63
|
else
|
66
|
-
|
64
|
+
null
|
67
65
|
}
|
68
66
|
</div>
|
@@ -1,31 +1,43 @@
|
|
1
1
|
# @cjsx React.DOM
|
2
2
|
$ = require('jquery')
|
3
|
-
Backbone = require('backbone')
|
4
3
|
React = require('react')
|
5
4
|
CardCollection = require('../models/cards')
|
6
5
|
config = require('../config')
|
7
6
|
helpers = require('../helpers')
|
8
7
|
classnames = require('classnames')
|
9
8
|
markdownIt = require('markdown-it')(linkify: true)
|
9
|
+
DropdownButton = require('react-bootstrap').DropdownButton
|
10
|
+
MenuItem = require('react-bootstrap').MenuItem
|
11
|
+
ButtonGroup = require('react-bootstrap').ButtonGroup
|
12
|
+
Button = require('react-bootstrap').Button
|
10
13
|
|
11
14
|
#window.onerror = (error, url, line) -> alert error
|
12
15
|
|
13
|
-
|
16
|
+
Flash = React.createClass
|
14
17
|
componentDidMount: ->
|
15
|
-
console.log '[views/
|
16
|
-
@setState currCards: @props.cards
|
18
|
+
console.log '[views/flash] componentDidMount', @props
|
17
19
|
$(document).on 'keydown', @onKeyDown
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
@
|
20
|
+
|
21
|
+
@setState currCards: @props.cards
|
22
|
+
|
23
|
+
if @props.cards.at(0)
|
24
|
+
@setState currCard: @props.cards.at(0), =>
|
25
|
+
@loadNextCards()
|
26
|
+
@loadPrevCards()
|
27
|
+
@forceUpdate.bind(@, null)
|
28
|
+
else
|
29
|
+
@props.cards.on 'sync', =>
|
30
|
+
@setState currCard: @props.cards.at(0), =>
|
31
|
+
@loadNextCards()
|
32
|
+
@loadPrevCards()
|
33
|
+
@forceUpdate.bind(@, null)
|
23
34
|
|
24
35
|
componentWillUnmount: ->
|
25
36
|
$(document).off 'keydown', @onKeyDown
|
26
37
|
|
27
38
|
onKeyDown: (event)->
|
28
39
|
switch event.keyCode
|
40
|
+
when 27 then @props.router.navigate(@closeLink())
|
29
41
|
when 37 then @onClickPrev()
|
30
42
|
when 39 then @onClickNext()
|
31
43
|
|
@@ -34,8 +46,9 @@ Portal = React.createClass
|
|
34
46
|
currCards: null
|
35
47
|
nextCards: null
|
36
48
|
prevCards: null
|
37
|
-
hideValue: 'none'
|
38
49
|
hiding: true
|
50
|
+
showTools: false
|
51
|
+
menuOpen: false
|
39
52
|
|
40
53
|
prevCard: ->
|
41
54
|
_prevCard = @state.currCards.at(@currCardIndex() - 1)
|
@@ -100,7 +113,7 @@ Portal = React.createClass
|
|
100
113
|
@onClickPrev()
|
101
114
|
|
102
115
|
onClickNext: ->
|
103
|
-
if @
|
116
|
+
if @props.cards.query.hide != 'none' && @state.hiding
|
104
117
|
@setState hiding: false
|
105
118
|
else
|
106
119
|
@setState hiding: true
|
@@ -113,7 +126,7 @@ Portal = React.createClass
|
|
113
126
|
@loadNextCards()
|
114
127
|
|
115
128
|
onClickPrev: ->
|
116
|
-
if @
|
129
|
+
if @props.cards.query.hide != 'none' && @state.hiding
|
117
130
|
@setState hiding: false
|
118
131
|
else
|
119
132
|
@setState hiding: true
|
@@ -128,19 +141,52 @@ Portal = React.createClass
|
|
128
141
|
closeLink: ->
|
129
142
|
params = $.extend {}, @props.cards.query
|
130
143
|
delete params.mode
|
144
|
+
delete params.auto
|
145
|
+
delete params.hide
|
131
146
|
'#/?' + $.param(params)
|
132
147
|
|
133
148
|
onChangeHide: (event)->
|
134
149
|
@setState hideValue: event.target.value
|
135
150
|
|
151
|
+
onMouseOverTools: ()->
|
152
|
+
@setState showTools: true
|
153
|
+
|
154
|
+
onMouseLeaveTools: ()->
|
155
|
+
@setState showTools: false
|
156
|
+
|
157
|
+
onClick: ->
|
158
|
+
@setState showTools: !@state.showTools
|
159
|
+
|
160
|
+
queryParam: (query)->
|
161
|
+
query = $.extend {}, @props.cards.query, query
|
162
|
+
$.param(query)
|
163
|
+
|
136
164
|
render: ->
|
137
|
-
<div
|
165
|
+
<div onClick={@onClick} onTouchStart={@onTouchStart} onTouchEnd={@onTouchEnd} style={overflow:'hidden'}>
|
166
|
+
<div style={position:'absolute',bottom:0,width:'100%',padding:'47px 0px 0px 0px'} onMouseOver={@onMouseOverTools} onMouseLeave={@onMouseLeaveTools}>
|
167
|
+
<span className={classnames("pull-right":true, 'carte-hidden': !@state.showTools)}>
|
168
|
+
<ButtonGroup>
|
169
|
+
<DropdownButton bsSize='large' bsStyle='default' title={'Auto: ' + @props.cards.query.auto} dropup pullRight className={classnames('open': @state.menuOpen)}>
|
170
|
+
<MenuItem href={'#/?' + @queryParam(auto: "off")} eventKey='1'>off</MenuItem>
|
171
|
+
<MenuItem href={'#/?' + @queryParam(auto: "fast")} eventKey='2'>fast</MenuItem>
|
172
|
+
<MenuItem href={'#/?' + @queryParam(auto: "normal")} eventKey='3'>normal</MenuItem>
|
173
|
+
<MenuItem href={'#/?' + @queryParam(auto: "slow")} eventKey='4'>slow</MenuItem>
|
174
|
+
</DropdownButton>
|
175
|
+
<DropdownButton bsSize='large' bsStyle='default' title={'Hide: ' + @props.cards.query.hide} dropup pullRight className={classnames('open': @state.menuOpen)}>
|
176
|
+
<MenuItem href={'#/?' + @queryParam(hide: "none")} eventKey='1'>none</MenuItem>
|
177
|
+
<MenuItem href={'#/?' + @queryParam(hide: "title")} eventKey='2'>title</MenuItem>
|
178
|
+
<MenuItem href={'#/?' + @queryParam(hide: "content")} eventKey='3'>content</MenuItem>
|
179
|
+
</DropdownButton>
|
180
|
+
<Button bsSize='large' href={@closeLink()}><strong>×</strong></Button>
|
181
|
+
</ButtonGroup>
|
182
|
+
</span>
|
183
|
+
</div>
|
138
184
|
<div style={fontSize:'10vh',padding:'1vh 5vh',overflow:'hidden'}>
|
139
185
|
<div>
|
140
186
|
<strong>
|
141
187
|
{
|
142
188
|
if @state.currCard
|
143
|
-
if @
|
189
|
+
if @props.cards.query.hide == 'title' && @state.hiding == true
|
144
190
|
'?????'
|
145
191
|
else
|
146
192
|
@state.currCard.get('title')
|
@@ -148,22 +194,11 @@ Portal = React.createClass
|
|
148
194
|
<i className="glyphicon glyphicon-refresh glyphicon-refresh-animate" />
|
149
195
|
}
|
150
196
|
</strong>
|
151
|
-
<span className="pull-right tools" style={fontSize:'0.5em'}>
|
152
|
-
hide:
|
153
|
-
<select value={@state.hideValue} onChange={@onChangeHide}>
|
154
|
-
<option value="none">none</option>
|
155
|
-
<option value="title">title</option>
|
156
|
-
<option value="content">content</option>
|
157
|
-
</select>
|
158
|
-
<a href={@closeLink()}>
|
159
|
-
<strong>×</strong>
|
160
|
-
</a>
|
161
|
-
</span>
|
162
197
|
</div>
|
163
|
-
<div style={paddingTop:'5vh'}>
|
198
|
+
<div style={paddingTop:'5vh',overflow:'hidden'}>
|
164
199
|
{
|
165
200
|
if @state.currCard
|
166
|
-
if @
|
201
|
+
if @props.cards.query.hide == 'content' && @state.hiding == true
|
167
202
|
'???????'
|
168
203
|
else
|
169
204
|
<div dangerouslySetInnerHTML={__html: markdownIt.render @state.currCard.get('content')} />
|
@@ -174,14 +209,13 @@ Portal = React.createClass
|
|
174
209
|
</div>
|
175
210
|
</div>
|
176
211
|
|
177
|
-
|
212
|
+
flash = React.createFactory Flash
|
178
213
|
|
179
214
|
module.exports = React.createClass
|
180
|
-
displayName: '
|
215
|
+
displayName: 'FlashWrapper'
|
181
216
|
|
182
217
|
componentDidMount: ->
|
183
218
|
console.log '[views/slideshow] componentDidMount'
|
184
|
-
@props.cards.on 'sync', @forceUpdate.bind(@, null)
|
185
219
|
@node = document.createElement('div')
|
186
220
|
@node.className = 'carte-slideshow'
|
187
221
|
document.body.appendChild(@node)
|
@@ -189,15 +223,18 @@ module.exports = React.createClass
|
|
189
223
|
|
190
224
|
componentWillReceiveProps: (nextProps)->
|
191
225
|
console.log '[views/slideshow] componentWillReceiveProps', nextProps
|
192
|
-
|
226
|
+
document.body.removeChild(@node) if @node
|
227
|
+
@node = document.createElement('div')
|
228
|
+
@node.className = 'carte-slideshow'
|
229
|
+
document.body.appendChild(@node)
|
230
|
+
React.render(flash(nextProps), @node)
|
193
231
|
|
194
232
|
componentWillUnmount: ->
|
195
233
|
console.log '[views/slideshow] componentWillUnmount'
|
196
234
|
document.body.removeChild(@node)
|
197
235
|
|
198
236
|
renderSlideshow: ->
|
199
|
-
React.render(
|
237
|
+
React.render(flash(@props), @node)
|
200
238
|
|
201
239
|
render: ->
|
202
|
-
console.log '[views/slideshow] render', @props
|
203
240
|
null
|
data/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "carte-client",
|
3
3
|
"description": "something like dictionary, wiki, or information card",
|
4
|
-
"version": "1.0.
|
4
|
+
"version": "1.0.2",
|
5
5
|
"main": "lib/carte.coffee",
|
6
6
|
"scripts": {
|
7
7
|
"test": "echo \"Error: no test specified\" && exit 1"
|
@@ -30,6 +30,7 @@
|
|
30
30
|
"font-awesome": "^4.3.0",
|
31
31
|
"fs-extra": "^0.18.2",
|
32
32
|
"gulp": "^3.8.11",
|
33
|
+
"gulp-gzip": "^1.1.0",
|
33
34
|
"gulp-if": "^1.2.5",
|
34
35
|
"gulp-jade": "^1.0.0",
|
35
36
|
"gulp-rename": "^1.2.2",
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: carte-server
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- tily
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-05-
|
11
|
+
date: 2015-05-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|