carte-server 1.0.9 → 1.0.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/carte.gemspec +1 -0
- data/config.ru +2 -2
- data/lib/carte/client.css +5 -1
- data/lib/carte/client/helpers.coffee +7 -0
- data/lib/carte/client/tasks.coffee +1 -1
- data/lib/carte/client/views/card.cjsx +7 -6
- data/lib/carte/client/views/content.cjsx +2 -2
- data/lib/carte/client/views/edit.cjsx +4 -3
- data/lib/carte/client/views/flash.cjsx +13 -0
- data/lib/carte/client/views/{slideshow.cjsx → flash_content.cjsx} +15 -46
- data/lib/carte/client/views/list.cjsx +26 -59
- data/lib/carte/server.rb +13 -1
- data/package.json +1 -1
- metadata +18 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4c5c8c38fa59498853115a057fe4fbe657ed3010
|
4
|
+
data.tar.gz: 382ae22af54b789f2ed191b31613cad17a445630
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3e880ee9df09645de4c8cd440390efc58a88347ba96eaea38119287e23be8f59b1d96860c839a18f5a8b863eca8598710e7532ffafd2b4f78183fc8fc8996d7c
|
7
|
+
data.tar.gz: 7e3a84bd65e7b09ca4336a394ced5172c6594a06e67f525029b750b9cf7592230caea138bf97246fa3658bed4ff4c9c83a2f8aaa8a8f4dd2400a699953a3c511
|
data/carte.gemspec
CHANGED
@@ -23,6 +23,7 @@ Gem::Specification.new do |spec|
|
|
23
23
|
spec.add_development_dependency "shotgun"
|
24
24
|
spec.add_development_dependency "rspec"
|
25
25
|
spec.add_development_dependency "httparty"
|
26
|
+
spec.add_development_dependency "rack-gzip-file"
|
26
27
|
|
27
28
|
spec.add_dependency "sinatra"
|
28
29
|
spec.add_dependency "sinatra-contrib"
|
data/config.ru
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'carte/server'
|
2
|
+
require 'rack/gzip_static'
|
2
3
|
require 'json'
|
3
4
|
|
4
5
|
$config = JSON.parse(File.read('config.json'))
|
@@ -11,8 +12,7 @@ class Carte::Server
|
|
11
12
|
end
|
12
13
|
|
13
14
|
map('/') do
|
14
|
-
use Rack::
|
15
|
-
use Rack::Static, urls: [""], root: $config['root_dir'], index: $config['html_path']
|
15
|
+
use Rack::GzipStatic, urls: [""], root: $config['root_dir'], index: $config['html_path']
|
16
16
|
run lambda {}
|
17
17
|
end
|
18
18
|
|
data/lib/carte/client.css
CHANGED
@@ -105,7 +105,7 @@ ul.nav-pills li a {
|
|
105
105
|
padding-right: 5px;
|
106
106
|
}
|
107
107
|
|
108
|
-
.carte-
|
108
|
+
.carte-flash {
|
109
109
|
background-color: white;
|
110
110
|
position : absolute;
|
111
111
|
left: 0;
|
@@ -114,6 +114,10 @@ ul.nav-pills li a {
|
|
114
114
|
bottom: 0;
|
115
115
|
}
|
116
116
|
|
117
|
+
.carte-strong {
|
118
|
+
font-weight: bold;
|
119
|
+
}
|
120
|
+
|
117
121
|
/* http://stackoverflow.com/questions/24511887/css-animation-works-in-chrome-but-not-in-firefox-resolved */
|
118
122
|
.glyphicon-refresh-animate {
|
119
123
|
-moz-animation: spin-moz .7s infinite linear;
|
@@ -5,3 +5,10 @@ module.exports =
|
|
5
5
|
|
6
6
|
isMobile: ()->
|
7
7
|
/(iPhone|iPod|iPad).*AppleWebKit/i.test(navigator.userAgent)
|
8
|
+
|
9
|
+
parseCardLink: (html)->
|
10
|
+
html.replace /\[\[(.+?)\]\]/g, (match, p1)->
|
11
|
+
if p1.match /<("[^"]*"|'[^']*'|[^'">])*>/g
|
12
|
+
match
|
13
|
+
else
|
14
|
+
['<a href="#/', encodeURIComponent(p1), '">', p1, '</a>'].join('')
|
@@ -2,6 +2,7 @@
|
|
2
2
|
React = require('react')
|
3
3
|
Edit = require('./edit')
|
4
4
|
ModalTrigger = require('react-bootstrap/lib/ModalTrigger')
|
5
|
+
Glyphicon = require('react-bootstrap/lib/Glyphicon')
|
5
6
|
markdownIt = require('markdown-it')(linkify: true)
|
6
7
|
helpers = require('../helpers')
|
7
8
|
classnames = require('classnames')
|
@@ -46,7 +47,7 @@ module.exports = React.createClass
|
|
46
47
|
<div className="carte-card-header">
|
47
48
|
{
|
48
49
|
if @props.card.get('focused') || @props.card.query.context == 'none'
|
49
|
-
<
|
50
|
+
<Glyphicon glyph='star' />
|
50
51
|
}
|
51
52
|
<strong>
|
52
53
|
{@props.card.get('title')}
|
@@ -56,13 +57,13 @@ module.exports = React.createClass
|
|
56
57
|
<span className={classnames('pull-right': true, 'tools': true, 'carte-hidden': !@showTools())}>
|
57
58
|
<ModalTrigger modal={<Edit card={@props.card} />}>
|
58
59
|
<a href="javascript:void(0)">
|
59
|
-
<
|
60
|
+
<Glyphicon glyph='edit' />
|
60
61
|
</a>
|
61
62
|
</ModalTrigger>
|
62
63
|
|
63
64
|
|
64
65
|
<a href={'#/' + encodeURIComponent(@props.card.get('title'))}>
|
65
|
-
<
|
66
|
+
<Glyphicon glyph='link' />
|
66
67
|
</a>
|
67
68
|
</span>
|
68
69
|
else
|
@@ -76,9 +77,9 @@ module.exports = React.createClass
|
|
76
77
|
<div className="carte-card-content">
|
77
78
|
{
|
78
79
|
if @props.card.fetching
|
79
|
-
<
|
80
|
+
<Glyphicon glyph='refresh' className='glyphicon-refresh-animate' />
|
80
81
|
else
|
81
|
-
<div dangerouslySetInnerHTML={__html: markdownIt.render @props.card.get('content') || ''} />
|
82
|
+
<div dangerouslySetInnerHTML={__html: helpers.parseCardLink markdownIt.render @props.card.get('content') || ''} />
|
82
83
|
}
|
83
84
|
</div>
|
84
85
|
<div className={classnames('carte-hidden': !@showTools())}>
|
@@ -88,7 +89,7 @@ module.exports = React.createClass
|
|
88
89
|
<span className="pull-right tools">
|
89
90
|
|
90
91
|
<a href={"#/?tags=" + tag}>
|
91
|
-
<
|
92
|
+
<Glyphicon glyph='tag' />
|
92
93
|
{tag}
|
93
94
|
</a>
|
94
95
|
</span>
|
@@ -3,7 +3,7 @@ $ = require('jquery')
|
|
3
3
|
React = require('react')
|
4
4
|
List = require('./list')
|
5
5
|
Tags = require('./tags')
|
6
|
-
|
6
|
+
Flash = require('./flash')
|
7
7
|
CardCollection = require('../models/cards')
|
8
8
|
CardHistoryCollection = require('../models/card_histories')
|
9
9
|
CardModel = require('../models/card')
|
@@ -38,7 +38,7 @@ module.exports = React.createClass
|
|
38
38
|
cards.query.auto = 'off' if !cards.query.auto
|
39
39
|
cards.query.hide = 'none' if !cards.query.hide
|
40
40
|
document.title = config.title + '、フラッシュ'
|
41
|
-
<
|
41
|
+
<Flash key='flash' router={@props.router} cards={cards} />
|
42
42
|
else
|
43
43
|
document.title = config.title
|
44
44
|
<List key='list' router={@props.router} cards={cards} />
|
@@ -3,6 +3,7 @@ $ = require('jquery')
|
|
3
3
|
React = require('react/addons')
|
4
4
|
Modal = require('react-bootstrap/lib/Modal')
|
5
5
|
Button = require('react-bootstrap/lib/Button')
|
6
|
+
Glyphicon = require('react-bootstrap/lib/Glyphicon')
|
6
7
|
TagsInput = require('react-tagsinput')
|
7
8
|
CardModel = require('../models/card')
|
8
9
|
|
@@ -65,7 +66,7 @@ module.exports = React.createClass
|
|
65
66
|
setTimeout (=> @setState shaking: false), 300
|
66
67
|
|
67
68
|
render: ->
|
68
|
-
<Modal className={"animated infinite shake" if @state.shaking} {...@props} bsStyle='default' title={if @props.card.isNew() then <
|
69
|
+
<Modal className={"animated infinite shake" if @state.shaking} {...@props} bsStyle='default' title={if @props.card.isNew() then <Glyphicon glyph='plus' /> else <Glyphicon glyph='edit' />} animation={false}>
|
69
70
|
<div className='modal-body'>
|
70
71
|
{
|
71
72
|
if @state.errors
|
@@ -80,7 +81,7 @@ module.exports = React.createClass
|
|
80
81
|
</div>
|
81
82
|
else if @state.createSuccess
|
82
83
|
<div className="alert alert-success" role="alert">
|
83
|
-
<
|
84
|
+
<Glyphicon glyph='info-sign' />
|
84
85
|
You created a card successfully. Let's create next one.
|
85
86
|
</div>
|
86
87
|
}
|
@@ -111,7 +112,7 @@ module.exports = React.createClass
|
|
111
112
|
|
112
113
|
{
|
113
114
|
if @state.updating
|
114
|
-
<
|
115
|
+
<Glyphicon glyph='refresh' className='glyphicon-refresh-animate' />
|
115
116
|
}
|
116
117
|
</button>
|
117
118
|
</div>
|
@@ -0,0 +1,13 @@
|
|
1
|
+
# @cjsx React.DOM
|
2
|
+
React = require('react')
|
3
|
+
OverlayMixin = require('react-bootstrap/lib/OverlayMixin')
|
4
|
+
FlashContent = React.createFactory require('./flash_content')
|
5
|
+
|
6
|
+
window.onerror = (error, url, line) -> alert error
|
7
|
+
|
8
|
+
module.exports = React.createClass
|
9
|
+
displayName: 'Flash'
|
10
|
+
mixins: [OverlayMixin]
|
11
|
+
getDefaultProps: -> container: document.body
|
12
|
+
renderOverlay: -> FlashContent(@props)
|
13
|
+
render: -> null
|
@@ -2,7 +2,6 @@
|
|
2
2
|
$ = require('jquery')
|
3
3
|
React = require('react')
|
4
4
|
CardCollection = require('../models/cards')
|
5
|
-
config = require('../config')
|
6
5
|
helpers = require('../helpers')
|
7
6
|
classnames = require('classnames')
|
8
7
|
markdownIt = require('markdown-it')(linkify: true)
|
@@ -13,11 +12,12 @@ Button = require('react-bootstrap').Button
|
|
13
12
|
|
14
13
|
window.onerror = (error, url, line) -> alert error
|
15
14
|
|
16
|
-
|
15
|
+
module.exports = React.createClass
|
16
|
+
displayName: 'FlashContent'
|
17
17
|
scrollEventNames: ['touchstart', 'touchmove', 'touchend', 'gesturestart', 'gesturechange', 'gestureend']
|
18
18
|
|
19
19
|
componentDidMount: ->
|
20
|
-
console.log '[views/
|
20
|
+
console.log '[views/flash_content] componentDidMount', @props
|
21
21
|
$(document).on 'keydown', @onKeyDown
|
22
22
|
for eventName in @scrollEventNames
|
23
23
|
$(document).on eventName, @preventScroll
|
@@ -37,7 +37,7 @@ Flash = React.createClass
|
|
37
37
|
@forceUpdate.bind(@, null)
|
38
38
|
|
39
39
|
componentWillUnmount: ->
|
40
|
-
console.log '[views/
|
40
|
+
console.log '[views/flash_content] FlashMain componentWillUnmount'
|
41
41
|
$(document).off 'keydown', @onKeyDown
|
42
42
|
for eventName in @scrollEventNames
|
43
43
|
$(document).off eventName, @preventScroll
|
@@ -64,23 +64,23 @@ Flash = React.createClass
|
|
64
64
|
|
65
65
|
prevCard: ->
|
66
66
|
_prevCard = @state.currCards.at(@currCardIndex() - 1)
|
67
|
-
console.log '[views/
|
67
|
+
console.log '[views/flash_content] prevCard', _prevCard
|
68
68
|
_prevCard
|
69
69
|
|
70
70
|
nextCard: ->
|
71
71
|
_nextCard = @state.currCards.at(@currCardIndex() + 1)
|
72
|
-
console.log '[views/
|
72
|
+
console.log '[views/flash_content] nextCard', _nextCard
|
73
73
|
_nextCard
|
74
74
|
|
75
75
|
currCardIndex: ->
|
76
76
|
_currCardIndex = @state.currCards.indexOf(@state.currCard)
|
77
|
-
console.log '[views/
|
78
|
-
console.log '[views/
|
77
|
+
console.log '[views/flash_content] currCardIndex, @state.currCard', @state.currCard
|
78
|
+
console.log '[views/flash_content] currCardIndex', _currCardIndex
|
79
79
|
_currCardIndex
|
80
80
|
|
81
81
|
currPage: ->
|
82
82
|
_currPage = @state.currCards.pagination.current_page
|
83
|
-
console.log '[views/
|
83
|
+
console.log '[views/flash_content] currPage', _currPage
|
84
84
|
_currPage
|
85
85
|
|
86
86
|
totalPages: ->
|
@@ -88,16 +88,16 @@ Flash = React.createClass
|
|
88
88
|
|
89
89
|
nextPage: ->
|
90
90
|
_nextPage = if @currPage() < @totalPages() then @currPage() + 1 else 1
|
91
|
-
console.log '[views/
|
91
|
+
console.log '[views/flash_content] nextPage', _nextPage
|
92
92
|
_nextPage
|
93
93
|
|
94
94
|
prevPage: ->
|
95
95
|
_prevPage = if @currPage() > 1 then @currPage() - 1 else @totalPages()
|
96
|
-
console.log '[views/
|
96
|
+
console.log '[views/flash_content] prevPage', _prevPage
|
97
97
|
_prevPage
|
98
98
|
|
99
99
|
loadNextCards: ->
|
100
|
-
console.log '[views/
|
100
|
+
console.log '[views/flash_content] loadNextCards'
|
101
101
|
nextCards = new CardCollection()
|
102
102
|
nextCards.query = $.extend {}, @state.currCards.query, {page: @nextPage()}
|
103
103
|
nextCards.fetching = true
|
@@ -105,7 +105,7 @@ Flash = React.createClass
|
|
105
105
|
@setState nextCards: nextCards
|
106
106
|
|
107
107
|
loadPrevCards: ->
|
108
|
-
console.log '[views/
|
108
|
+
console.log '[views/flash_content] loadPrevCards'
|
109
109
|
prevCards = new CardCollection()
|
110
110
|
prevCards.query = $.extend {}, @state.currCards.query, {page: @prevPage()}
|
111
111
|
prevCards.fetching = true
|
@@ -207,7 +207,7 @@ Flash = React.createClass
|
|
207
207
|
when 'normal' then bpm = 60
|
208
208
|
when 'slow' then bpm = 30
|
209
209
|
@interval = setInterval @onClickNext, 1000 * 60 / bpm
|
210
|
-
<div onTouchStart={@onTouchStart} onTouchMove={@onTouchMove} onTouchEnd={@onTouchEnd}
|
210
|
+
<div onTouchStart={@onTouchStart} onTouchMove={@onTouchMove} onTouchEnd={@onTouchEnd} className="carte-flash">
|
211
211
|
<div onTouchStart={@onTouchStartTools} style={position:'absolute',bottom:0,width:'100%',padding:'47px 0px 0px 0px'} onMouseOver={@onMouseOverTools} onMouseLeave={@onMouseLeaveTools}>
|
212
212
|
<span className={classnames("pull-right":true, 'carte-hidden': !@state.showTools)}>
|
213
213
|
<ButtonGroup>
|
@@ -246,41 +246,10 @@ Flash = React.createClass
|
|
246
246
|
if @props.cards.query.hide == 'content' && @state.hiding == true
|
247
247
|
'???????'
|
248
248
|
else
|
249
|
-
<div dangerouslySetInnerHTML={__html: markdownIt.render @state.currCard.get('content')} />
|
249
|
+
<div dangerouslySetInnerHTML={__html: helpers.parseCardLink markdownIt.render @state.currCard.get('content')} />
|
250
250
|
else
|
251
251
|
<i className="glyphicon glyphicon-refresh glyphicon-refresh-animate" />
|
252
252
|
}
|
253
253
|
</div>
|
254
254
|
</div>
|
255
255
|
</div>
|
256
|
-
|
257
|
-
flash = React.createFactory Flash
|
258
|
-
|
259
|
-
module.exports = React.createClass
|
260
|
-
displayName: 'FlashWrapper'
|
261
|
-
|
262
|
-
componentDidMount: ->
|
263
|
-
console.log '[views/slideshow] componentDidMount'
|
264
|
-
@node = document.createElement('div')
|
265
|
-
@node.className = 'carte-slideshow'
|
266
|
-
document.body.appendChild(@node)
|
267
|
-
@renderSlideshow()
|
268
|
-
|
269
|
-
componentWillReceiveProps: (nextProps)->
|
270
|
-
console.log '[views/slideshow] componentWillReceiveProps', nextProps
|
271
|
-
document.body.removeChild(@node) if @node
|
272
|
-
@node = document.createElement('div')
|
273
|
-
@node.className = 'carte-slideshow'
|
274
|
-
document.body.appendChild(@node)
|
275
|
-
React.render(flash(nextProps), @node)
|
276
|
-
|
277
|
-
componentWillUnmount: ->
|
278
|
-
console.log '[views/slideshow] componentWillUnmount'
|
279
|
-
React.unmountComponentAtNode(@node)
|
280
|
-
document.body.removeChild(@node)
|
281
|
-
|
282
|
-
renderSlideshow: ->
|
283
|
-
React.render(flash(@props), @node)
|
284
|
-
|
285
|
-
render: ->
|
286
|
-
null
|
@@ -2,12 +2,14 @@
|
|
2
2
|
$ = require('jquery')
|
3
3
|
Backbone = require('backbone')
|
4
4
|
React = require('react')
|
5
|
+
classnames = require('classnames')
|
5
6
|
Cards = require('./cards')
|
6
7
|
Card = require('./card')
|
7
8
|
CardCollection = require('../models/cards')
|
8
9
|
Pagination = require('./pagination')
|
9
10
|
helpers = require('../helpers')
|
10
11
|
config = require('../config')
|
12
|
+
Glyphicon = require('react-bootstrap/lib/Glyphicon')
|
11
13
|
|
12
14
|
module.exports = React.createClass
|
13
15
|
displayName: 'List'
|
@@ -50,40 +52,25 @@ module.exports = React.createClass
|
|
50
52
|
when 'atoz'
|
51
53
|
<li key='atoz'>
|
52
54
|
<a onClick={helpers.reload} href={"#/?" + @atozParam()}>
|
53
|
-
{
|
54
|
-
if @props.cards.query.sort == 'title' and @props.cards.query.order != 'random'
|
55
|
-
<strong>A to Z</strong>
|
56
|
-
else
|
57
|
-
<span>A to Z</span>
|
58
|
-
}
|
55
|
+
<span className={classnames('carte-strong': @props.cards.query.sort == 'title' and @props.cards.query.order != 'random')}>A to Z</span>
|
59
56
|
</a>
|
60
57
|
</li>
|
61
58
|
when 'latest'
|
62
59
|
<li key='latest'>
|
63
60
|
<a onClick={helpers.reload} href={"#/?" + @latestParam()}>
|
64
|
-
{
|
65
|
-
if @props.cards.query.sort == 'updated_at' and @props.cards.query.order != 'random'
|
66
|
-
<strong>Latest</strong>
|
67
|
-
else
|
68
|
-
<span>Latest</span>
|
69
|
-
}
|
61
|
+
<span className={classnames('carte-strong': @props.cards.query.sort == 'updated_at' and @props.cards.query.order != 'random')}>Latest</span>
|
70
62
|
</a>
|
71
63
|
</li>
|
72
64
|
when 'random'
|
73
65
|
<li key='random'>
|
74
66
|
<a onClick={helpers.reload} href={"#/?" + @randomParam()}>
|
75
|
-
{
|
76
|
-
if @props.cards.query.order == 'random'
|
77
|
-
<strong>Random</strong>
|
78
|
-
else
|
79
|
-
<span>Random</span>
|
80
|
-
}
|
67
|
+
<span className={classnames('carte-strong': @props.cards.query.order == 'random')}>Random</span>
|
81
68
|
</a>
|
82
69
|
</li>
|
83
70
|
}
|
84
71
|
<li>
|
85
72
|
<a href={"#/tags"}>
|
86
|
-
<
|
73
|
+
<Glyphicon glyph='tag' />
|
87
74
|
</a>
|
88
75
|
</li>
|
89
76
|
<li>
|
@@ -99,20 +86,20 @@ module.exports = React.createClass
|
|
99
86
|
</ul>
|
100
87
|
</div>
|
101
88
|
<div className="col-sm-4">
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
89
|
+
<ul className="nav nav-pills nav-justified">
|
90
|
+
<li>
|
91
|
+
<a href="javascript:void(0)" className="center-block text-center">
|
92
|
+
<span className="badge">
|
93
|
+
{
|
94
|
+
if @props.cards.pagination
|
95
|
+
@props.cards.pagination.total_entries
|
96
|
+
else
|
97
|
+
<Glyphicon glyph='refresh' className='glyphicon-refresh-animate' />
|
98
|
+
}
|
99
|
+
</span>
|
100
|
+
</a>
|
101
|
+
</li>
|
102
|
+
</ul>
|
116
103
|
</div>
|
117
104
|
<div className="col-sm-4">
|
118
105
|
{
|
@@ -122,11 +109,11 @@ module.exports = React.createClass
|
|
122
109
|
{
|
123
110
|
if @props.cards.pagination
|
124
111
|
<a onClick={helpers.reload} href={"#/?" + @randomParam()}>
|
125
|
-
<
|
112
|
+
<Glyphicon glyph='refresh' />
|
126
113
|
</a>
|
127
114
|
else
|
128
115
|
<a href="javascript:void(0)">
|
129
|
-
<
|
116
|
+
<Glyphicon glyph='refresh' className='glyphicon-refresh-animate' />
|
130
117
|
</a>
|
131
118
|
}
|
132
119
|
</li>
|
@@ -146,42 +133,22 @@ module.exports = React.createClass
|
|
146
133
|
<ul className="nav nav-pills">
|
147
134
|
<li>
|
148
135
|
<a href={"#/" + encodeURIComponent(title) + '?context=title'}>
|
149
|
-
{
|
150
|
-
if @props.card && @props.card.query.context == 'title'
|
151
|
-
<strong>A to Z</strong>
|
152
|
-
else
|
153
|
-
<span>A to Z</span>
|
154
|
-
}
|
136
|
+
<span className={classnames('carte-strong': @props.card && @props.card.query.context == 'title')}>A to Z</span>
|
155
137
|
</a>
|
156
138
|
</li>
|
157
139
|
<li>
|
158
140
|
<a href={"#/" + encodeURIComponent(title) + '?context=updated_at'}>
|
159
|
-
{
|
160
|
-
if @props.card && @props.card.query.context == 'updated_at'
|
161
|
-
<strong>Latest</strong>
|
162
|
-
else
|
163
|
-
<span>Latest</span>
|
164
|
-
}
|
141
|
+
<span className={classnames('carte-strong': @props.card && @props.card.query.context == 'updated_at')}>Latest</span>
|
165
142
|
</a>
|
166
143
|
</li>
|
167
144
|
<li>
|
168
145
|
<a href={"#/" + encodeURIComponent(title) + '?context=none'}>
|
169
|
-
{
|
170
|
-
if @props.card && @props.card.query.context == 'none'
|
171
|
-
<strong>Detail</strong>
|
172
|
-
else
|
173
|
-
<span>Detail</span>
|
174
|
-
}
|
146
|
+
<span className={classnames('carte-strong': @props.card && @props.card.query.context == 'none')}>Detail</span>
|
175
147
|
</a>
|
176
148
|
</li>
|
177
149
|
<li>
|
178
150
|
<a href={"#/" + encodeURIComponent(title) + '/history'}>
|
179
|
-
{
|
180
|
-
if @props.cards.collectionName == 'CardHistories'
|
181
|
-
<strong>History</strong>
|
182
|
-
else
|
183
|
-
<span>History</span>
|
184
|
-
}
|
151
|
+
<span className={classnames('carte-strong': @props.cards.collectionName == 'CardHistories')}>History</span>
|
185
152
|
</a>
|
186
153
|
</li>
|
187
154
|
</ul>
|
data/lib/carte/server.rb
CHANGED
@@ -60,7 +60,19 @@ module Carte
|
|
60
60
|
|
61
61
|
def markdown2html(markdown)
|
62
62
|
renderer = Redcarpet::Render::HTML.new(filter_html:true)
|
63
|
-
Redcarpet::Markdown.new(renderer, autolink: true).render(markdown)
|
63
|
+
html = Redcarpet::Markdown.new(renderer, autolink: true).render(markdown)
|
64
|
+
parse_card_link(html)
|
65
|
+
end
|
66
|
+
|
67
|
+
def parse_card_link(html)
|
68
|
+
html.gsub(/\[\[(.+?)\]\]/) do |match|
|
69
|
+
title = $1.dup
|
70
|
+
if title.match(/<("[^"]*"|'[^']*'|[^'">])*>/)
|
71
|
+
match
|
72
|
+
else
|
73
|
+
%Q(<a href="http://#{request.host}/#/#{URI.escape(title)}">#{title}</a>)
|
74
|
+
end
|
75
|
+
end
|
64
76
|
end
|
65
77
|
end
|
66
78
|
|
data/package.json
CHANGED
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.10
|
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-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -80,6 +80,20 @@ dependencies:
|
|
80
80
|
- - '>='
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rack-gzip-file
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - '>='
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - '>='
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
83
97
|
- !ruby/object:Gem::Dependency
|
84
98
|
name: sinatra
|
85
99
|
requirement: !ruby/object:Gem::Requirement
|
@@ -277,12 +291,13 @@ files:
|
|
277
291
|
- lib/carte/client/views/content.cjsx
|
278
292
|
- lib/carte/client/views/edit.cjsx
|
279
293
|
- lib/carte/client/views/edit_tag.cjsx
|
294
|
+
- lib/carte/client/views/flash.cjsx
|
295
|
+
- lib/carte/client/views/flash_content.cjsx
|
280
296
|
- lib/carte/client/views/footer.cjsx
|
281
297
|
- lib/carte/client/views/header.cjsx
|
282
298
|
- lib/carte/client/views/list.cjsx
|
283
299
|
- lib/carte/client/views/message.cjsx
|
284
300
|
- lib/carte/client/views/pagination.cjsx
|
285
|
-
- lib/carte/client/views/slideshow.cjsx
|
286
301
|
- lib/carte/client/views/tags.cjsx
|
287
302
|
- lib/carte/server.rb
|
288
303
|
- lib/carte/server/models.rb
|