carte-server 0.0.26 → 0.0.27
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +0 -7
- data/carte.gemspec +1 -2
- data/gulpfile.coffee +2 -2
- data/lib/carte.coffee +9 -78
- data/lib/carte/client.css +102 -4
- data/lib/carte/client/tasks.coffee +78 -0
- data/lib/carte/client/views/app.cjsx +1 -3
- data/lib/carte/client/views/card.cjsx +18 -8
- data/lib/carte/client/views/content.cjsx +51 -37
- data/lib/carte/client/views/edit.cjsx +9 -9
- data/lib/carte/client/views/footer.cjsx +1 -2
- data/lib/carte/client/views/header.cjsx +2 -2
- data/lib/carte/client/views/list.cjsx +60 -23
- data/lib/carte/client/views/message.cjsx +3 -3
- data/lib/carte/client/views/pagination.cjsx +8 -8
- data/package.json +2 -1
- metadata +17 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d5d689a6bbbfaebcc4b2317306ece56bc01860d9
|
4
|
+
data.tar.gz: 62c6865bd68b8fba5ab18230aed5a11f917b5cb5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4822231b9c7e7bd40fe3a55278bec3c6ff5df2d0600315ecffb799979db1b078625585cdf55ea7113ce57cef67113ba1b0aafc2857f56af2f89e0857dc24eb1d
|
7
|
+
data.tar.gz: ad53d1b291851888f3f41951f18575c2d83cb473b048a45ed1a45c5d8f0618185eac927584ea591d362917c4610d0af94e66be46dd9617e12aa0565d8f8cce3e
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -33,13 +33,6 @@ Japanese introduction is [here](http://tily.tumblr.com/post/117678137942/carte).
|
|
33
33
|
|
34
34
|
[![Deploy](https://www.herokucdn.com/deploy/button.png)](https://heroku.com/deploy?template=https://github.com/tily/carte-sandbox)
|
35
35
|
|
36
|
-
```
|
37
|
-
## change title and description
|
38
|
-
$ vi config.json
|
39
|
-
## replace brand icon
|
40
|
-
$ cp ~/Desktop/icon.png public/images/icon.png
|
41
|
-
```
|
42
|
-
|
43
36
|
**Docker**
|
44
37
|
|
45
38
|
```bash
|
data/carte.gemspec
CHANGED
@@ -21,7 +21,7 @@ Gem::Specification.new do |spec|
|
|
21
21
|
spec.add_development_dependency "bundler", "~> 1.7"
|
22
22
|
spec.add_development_dependency "rake", "~> 10.0"
|
23
23
|
spec.add_development_dependency "shotgun"
|
24
|
-
|
24
|
+
spec.add_development_dependency "rspec"
|
25
25
|
spec.add_development_dependency "httparty"
|
26
26
|
|
27
27
|
spec.add_dependency "sinatra"
|
@@ -35,5 +35,4 @@ Gem::Specification.new do |spec|
|
|
35
35
|
spec.add_dependency "mongoid-geospatial"
|
36
36
|
spec.add_dependency "redcarpet"
|
37
37
|
spec.add_dependency "pry"
|
38
|
-
spec.add_dependency "rspec"
|
39
38
|
end
|
data/gulpfile.coffee
CHANGED
@@ -1,3 +1,3 @@
|
|
1
1
|
gulp = require 'gulp'
|
2
|
-
|
3
|
-
new
|
2
|
+
Tasks = require('./lib/carte').Tasks
|
3
|
+
(new Tasks).install(gulp, __dirname + '/config.json')
|
data/lib/carte.coffee
CHANGED
@@ -1,78 +1,9 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
streamify = require 'gulp-streamify'
|
11
|
-
coffeeReactify = require 'coffee-reactify'
|
12
|
-
browserifyCss = require 'browserify-css'
|
13
|
-
_ = require 'lodash'
|
14
|
-
jade = require 'gulp-jade'
|
15
|
-
rename = require 'gulp-rename'
|
16
|
-
|
17
|
-
module.exports = class Carte
|
18
|
-
watching: false
|
19
|
-
|
20
|
-
install: (gulp, config)->
|
21
|
-
custom = require(config)
|
22
|
-
fs.writeFileSync(__dirname + '/carte/shared/custom.json', JSON.stringify(custom))
|
23
|
-
|
24
|
-
gulp.task 'watching', => @watching = true
|
25
|
-
gulp.task 'build', ['build:html', 'build:script']
|
26
|
-
gulp.task 'watch', ['watching', 'build:html', 'build:script']
|
27
|
-
|
28
|
-
gulp.task 'build:html', =>
|
29
|
-
_config = require('./carte/client/config')
|
30
|
-
gulp.src(__dirname + '/carte/client.jade')
|
31
|
-
.pipe jade(locals: {config: _config}, pretty: true)
|
32
|
-
.pipe rename(_config.html_path)
|
33
|
-
.pipe gulp.dest(_config.root_dir)
|
34
|
-
|
35
|
-
gulp.task 'build:script', =>
|
36
|
-
@buildScript config: config
|
37
|
-
|
38
|
-
buildScript: (options)->
|
39
|
-
config = require(options.config)
|
40
|
-
fs.writeFileSync(__dirname + '/carte/shared/custom.json', JSON.stringify(config))
|
41
|
-
dir = config.root_dir
|
42
|
-
file = path.basename config.script_path
|
43
|
-
browserify = browserify
|
44
|
-
cache: {}
|
45
|
-
packageCache: {}
|
46
|
-
fullPaths: true
|
47
|
-
entries: [__dirname + '/carte/client.coffee']
|
48
|
-
extensions: ['.coffee', '.js', '.cjsx', '.css']
|
49
|
-
browserify
|
50
|
-
.transform coffeeReactify
|
51
|
-
.transform browserifyCss,
|
52
|
-
rootDir: 'public'
|
53
|
-
processRelativeUrl: (relativeUrl)->
|
54
|
-
stripQueryStringAndHashFromPath = (url)-> url.split('?')[0].split('#')[0]
|
55
|
-
rootDir = path.resolve(process.cwd(), 'public')
|
56
|
-
relativePath = stripQueryStringAndHashFromPath(relativeUrl)
|
57
|
-
queryStringAndHash = relativeUrl.substring(relativePath.length)
|
58
|
-
prefix = '../node_modules/'
|
59
|
-
if (_.startsWith(relativePath, prefix))
|
60
|
-
vendorPath = 'vendor/' + relativePath.substring(prefix.length)
|
61
|
-
source = path.join(rootDir, relativePath)
|
62
|
-
target = path.join(rootDir, vendorPath)
|
63
|
-
gulpUtil.log('Copying file from ' + JSON.stringify(source) + ' to ' + JSON.stringify(target))
|
64
|
-
fs.copySync(source, target)
|
65
|
-
return vendorPath + queryStringAndHash
|
66
|
-
relativeUrl
|
67
|
-
if @watching
|
68
|
-
watchified = watchify(browserify)
|
69
|
-
watchified.on 'update', ()=> @bundle(browserify, dir, file)
|
70
|
-
watchified.on 'log', gulpUtil.log
|
71
|
-
@bundle(browserify, dir, file)
|
72
|
-
|
73
|
-
bundle: (browserify, dir, file)->
|
74
|
-
browserify
|
75
|
-
.bundle()
|
76
|
-
.pipe sourceStream file
|
77
|
-
.pipe gulpIf(!@watching, streamify(uglify(compress: {drop_console: !@watching})))
|
78
|
-
.pipe gulp.dest dir
|
1
|
+
Tasks = require './carte/client/tasks'
|
2
|
+
Card = require './carte/client/models/card'
|
3
|
+
Cards = require './carte/client/models/cards'
|
4
|
+
|
5
|
+
module.exports =
|
6
|
+
Tasks: Tasks
|
7
|
+
Models:
|
8
|
+
Card: Card
|
9
|
+
Cards: Cards
|
data/lib/carte/client.css
CHANGED
@@ -15,22 +15,120 @@
|
|
15
15
|
.tools a:visited,
|
16
16
|
.tools a:active
|
17
17
|
{
|
18
|
-
color: #
|
18
|
+
color: #333 !important;
|
19
19
|
text-decoration: none !important;
|
20
20
|
}
|
21
21
|
|
22
|
+
ul.nav-pills li a {
|
23
|
+
padding: 6px 12px;
|
24
|
+
}
|
25
|
+
|
22
26
|
.card ul,ol {
|
23
27
|
padding-left: 20px;
|
24
28
|
}
|
25
29
|
|
30
|
+
.col-sm-4 {
|
31
|
+
padding: 0px;
|
32
|
+
}
|
33
|
+
|
34
|
+
.col-sm-12 {
|
35
|
+
padding: 0px;
|
36
|
+
}
|
37
|
+
|
38
|
+
.alert {
|
39
|
+
padding: 5px;
|
40
|
+
}
|
41
|
+
|
42
|
+
.alert ul {
|
43
|
+
padding-left: 20px;
|
44
|
+
}
|
45
|
+
|
46
|
+
.list-group {
|
47
|
+
margin: 0px;
|
48
|
+
padding: 5px;
|
49
|
+
}
|
50
|
+
|
51
|
+
.list-group-item {
|
52
|
+
height: 200px;
|
53
|
+
}
|
54
|
+
|
55
|
+
.navbar {
|
56
|
+
padding: 0px;
|
57
|
+
background-color: white;
|
58
|
+
margin-bottom: 5px;
|
59
|
+
}
|
60
|
+
|
61
|
+
.badge {
|
62
|
+
color: #333;
|
63
|
+
background-color: #eee;
|
64
|
+
}
|
65
|
+
|
66
|
+
.modal-body .form-group:last-child {
|
67
|
+
padding-bottom: 17px;
|
68
|
+
}
|
69
|
+
|
70
|
+
.navbar-brand:first-child {
|
71
|
+
padding-top: 10px;
|
72
|
+
}
|
73
|
+
|
74
|
+
/* carte original definitions */
|
75
|
+
.carte-content {
|
76
|
+
padding: 0px 20px;
|
77
|
+
}
|
78
|
+
|
79
|
+
.carte-hidden {
|
80
|
+
visibility: hidden;
|
81
|
+
}
|
82
|
+
|
83
|
+
.carte-card-header {
|
84
|
+
margin-bottom: 10px;
|
85
|
+
}
|
86
|
+
|
87
|
+
.carte-card-header .glyphicon-star {
|
88
|
+
margin-right: 5px;
|
89
|
+
}
|
90
|
+
|
91
|
+
.carte-card-content {
|
92
|
+
overflow: hidden;
|
93
|
+
width: 100%;
|
94
|
+
height: 73%;
|
95
|
+
word-wrap: break-word;
|
96
|
+
}
|
97
|
+
|
98
|
+
.carte-pagination .carte-pagination-curr {
|
99
|
+
width: 7.5em;
|
100
|
+
text-align: center;
|
101
|
+
}
|
102
|
+
|
103
|
+
.carte-list {
|
104
|
+
padding-left: 5px;
|
105
|
+
padding-right: 5px;
|
106
|
+
}
|
107
|
+
|
108
|
+
.carte-slideshow {
|
109
|
+
height: 100%;
|
110
|
+
width: 100%;
|
111
|
+
background-color: white;
|
112
|
+
position : absolute;
|
113
|
+
}
|
114
|
+
|
115
|
+
/* http://stackoverflow.com/questions/24511887/css-animation-works-in-chrome-but-not-in-firefox-resolved */
|
26
116
|
.glyphicon-refresh-animate {
|
27
|
-
-animation: spin .7s infinite linear;
|
28
|
-
-webkit-animation:
|
117
|
+
-moz-animation: spin-moz .7s infinite linear;
|
118
|
+
-webkit-animation: spin-webkit .7s infinite linear;
|
119
|
+
animation: spin .7s infinite linear;
|
120
|
+
}
|
121
|
+
|
122
|
+
@-moz-keyframes spin-moz {
|
123
|
+
from { -moz-transform: rotate(0deg);}
|
124
|
+
to { -moz-transform: rotate(360deg);}
|
29
125
|
}
|
30
|
-
|
126
|
+
|
127
|
+
@-webkit-keyframes spin-webkit {
|
31
128
|
from { -webkit-transform: rotate(0deg);}
|
32
129
|
to { -webkit-transform: rotate(360deg);}
|
33
130
|
}
|
131
|
+
|
34
132
|
@keyframes spin {
|
35
133
|
from { transform: scale(1) rotate(0deg);}
|
36
134
|
to { transform: scale(1) rotate(360deg);}
|
@@ -0,0 +1,78 @@
|
|
1
|
+
fs = require 'fs-extra'
|
2
|
+
path = require 'path'
|
3
|
+
gulp = require 'gulp'
|
4
|
+
gulpUtil = require 'gulp-util'
|
5
|
+
gulpIf = require 'gulp-if'
|
6
|
+
sourceStream = require 'vinyl-source-stream'
|
7
|
+
browserify = require 'browserify'
|
8
|
+
watchify = require 'watchify'
|
9
|
+
uglify = require 'gulp-uglify'
|
10
|
+
streamify = require 'gulp-streamify'
|
11
|
+
coffeeReactify = require 'coffee-reactify'
|
12
|
+
browserifyCss = require 'browserify-css'
|
13
|
+
_ = require 'lodash'
|
14
|
+
jade = require 'gulp-jade'
|
15
|
+
rename = require 'gulp-rename'
|
16
|
+
|
17
|
+
module.exports = class Carte
|
18
|
+
watching: false
|
19
|
+
|
20
|
+
install: (gulp, config)->
|
21
|
+
custom = require(config)
|
22
|
+
fs.writeFileSync(__dirname + '/../shared/custom.json', JSON.stringify(custom))
|
23
|
+
|
24
|
+
gulp.task 'watching', => @watching = true
|
25
|
+
gulp.task 'build', ['build:html', 'build:script']
|
26
|
+
gulp.task 'watch', ['watching', 'build:html', 'build:script']
|
27
|
+
|
28
|
+
gulp.task 'build:html', =>
|
29
|
+
_config = require('./config')
|
30
|
+
gulp.src(__dirname + '/../client.jade')
|
31
|
+
.pipe jade(locals: {config: _config}, pretty: true)
|
32
|
+
.pipe rename(_config.html_path)
|
33
|
+
.pipe gulp.dest(_config.root_dir)
|
34
|
+
|
35
|
+
gulp.task 'build:script', =>
|
36
|
+
@buildScript config: config
|
37
|
+
|
38
|
+
buildScript: (options)->
|
39
|
+
config = require(options.config)
|
40
|
+
fs.writeFileSync(__dirname + '/../shared/custom.json', JSON.stringify(config))
|
41
|
+
dir = config.root_dir
|
42
|
+
file = path.basename config.script_path
|
43
|
+
browserify = browserify
|
44
|
+
cache: {}
|
45
|
+
packageCache: {}
|
46
|
+
fullPaths: true
|
47
|
+
entries: [__dirname + '/../client.coffee']
|
48
|
+
extensions: ['.coffee', '.js', '.cjsx', '.css']
|
49
|
+
browserify
|
50
|
+
.transform coffeeReactify
|
51
|
+
.transform browserifyCss,
|
52
|
+
rootDir: 'public'
|
53
|
+
processRelativeUrl: (relativeUrl)->
|
54
|
+
stripQueryStringAndHashFromPath = (url)-> url.split('?')[0].split('#')[0]
|
55
|
+
rootDir = path.resolve(process.cwd(), 'public')
|
56
|
+
relativePath = stripQueryStringAndHashFromPath(relativeUrl)
|
57
|
+
queryStringAndHash = relativeUrl.substring(relativePath.length)
|
58
|
+
prefix = '../node_modules/'
|
59
|
+
if (_.startsWith(relativePath, prefix))
|
60
|
+
vendorPath = 'vendor/' + relativePath.substring(prefix.length)
|
61
|
+
source = path.join(rootDir, relativePath)
|
62
|
+
target = path.join(rootDir, vendorPath)
|
63
|
+
gulpUtil.log('Copying file from ' + JSON.stringify(source) + ' to ' + JSON.stringify(target))
|
64
|
+
fs.copySync(source, target)
|
65
|
+
return vendorPath + queryStringAndHash
|
66
|
+
relativeUrl
|
67
|
+
if @watching
|
68
|
+
watchified = watchify(browserify)
|
69
|
+
watchified.on 'update', ()=> @bundle(browserify, dir, file)
|
70
|
+
watchified.on 'log', gulpUtil.log
|
71
|
+
@bundle(browserify, dir, file)
|
72
|
+
|
73
|
+
bundle: (browserify, dir, file)->
|
74
|
+
browserify
|
75
|
+
.bundle()
|
76
|
+
.pipe sourceStream file
|
77
|
+
.pipe gulpIf(!@watching, streamify(uglify(compress: {drop_console: !@watching})))
|
78
|
+
.pipe gulp.dest dir
|
@@ -15,8 +15,6 @@ module.exports = React.createClass
|
|
15
15
|
Button = require('react-bootstrap/lib/Button')
|
16
16
|
<div>
|
17
17
|
<Header key='header' router={@props.router} />
|
18
|
-
<
|
19
|
-
<Content key='content' router={@props.router} />
|
20
|
-
</div>
|
18
|
+
<Content key='content' router={@props.router} />
|
21
19
|
</div>
|
22
20
|
|
@@ -4,6 +4,7 @@ Edit = require('./edit')
|
|
4
4
|
ModalTrigger = require('react-bootstrap/lib/ModalTrigger')
|
5
5
|
markdownIt = require('markdown-it')(linkify: true)
|
6
6
|
helpers = require('../helpers')
|
7
|
+
classnames = require('classnames')
|
7
8
|
|
8
9
|
module.exports = React.createClass
|
9
10
|
displayName: 'Card'
|
@@ -24,18 +25,21 @@ module.exports = React.createClass
|
|
24
25
|
onMouseLeave: ()->
|
25
26
|
@setState showTools: false
|
26
27
|
|
28
|
+
showTools: ()->
|
29
|
+
helpers.isMobile() || @state.showTools
|
30
|
+
|
27
31
|
render: ->
|
28
|
-
<div className='col-sm-4 col-xs-12 list-group'
|
29
|
-
<div className='list-group-item'
|
30
|
-
<div
|
32
|
+
<div className='col-sm-4 col-xs-12 list-group' onMouseOver={@onMouseOver} onMouseLeave={@onMouseLeave}>
|
33
|
+
<div className='list-group-item'>
|
34
|
+
<div className="carte-card-header">
|
31
35
|
{
|
32
36
|
if @props.card.get('focused')
|
33
|
-
<i className='glyphicon glyphicon-star'
|
37
|
+
<i className='glyphicon glyphicon-star' />
|
34
38
|
}
|
35
39
|
<strong>
|
36
40
|
{@props.card.get('title')}
|
37
41
|
</strong>
|
38
|
-
<span className='pull-right
|
42
|
+
<span className={classnames('pull-right': true, 'tools': true, 'carte-hidden': !@showTools())}>
|
39
43
|
<ModalTrigger modal={<Edit card={@props.card} />}>
|
40
44
|
<a href="javascript:void(0)">
|
41
45
|
<i className='glyphicon glyphicon-edit' />
|
@@ -48,14 +52,20 @@ module.exports = React.createClass
|
|
48
52
|
</a>
|
49
53
|
</span>
|
50
54
|
</div>
|
51
|
-
<div className="card"
|
55
|
+
<div className="carte-card-content">
|
52
56
|
<div dangerouslySetInnerHTML={__html: markdownIt.render @props.card.get('content')} />
|
53
57
|
</div>
|
54
|
-
<div
|
58
|
+
<div className={classnames('carte-hidden': !@showTools())}>
|
55
59
|
{
|
56
60
|
if @props.card.get("tags")
|
57
61
|
@props.card.get("tags").map (tag)->
|
58
|
-
<span className="pull-right tools"
|
62
|
+
<span className="pull-right tools">
|
63
|
+
|
64
|
+
<a href={"#/?tags=" + tag}>
|
65
|
+
<i className="glyphicon glyphicon-tag" />
|
66
|
+
{tag}
|
67
|
+
</a>
|
68
|
+
</span>
|
59
69
|
}
|
60
70
|
</div>
|
61
71
|
</div>
|
@@ -20,40 +20,54 @@ module.exports = React.createClass
|
|
20
20
|
@props.router.off "route", @callback
|
21
21
|
|
22
22
|
render: ->
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
23
|
+
<div className="carte-content">
|
24
|
+
{
|
25
|
+
switch @props.router.current
|
26
|
+
when "list"
|
27
|
+
cards = new CardCollection()
|
28
|
+
cards.query = $.extend {}, config.default_query, @props.router.query
|
29
|
+
cards.fetching = true
|
30
|
+
cards.fetch success: ()-> cards.fetching = false
|
31
|
+
#title = []
|
32
|
+
#for k, v of cards.query
|
33
|
+
# title.push(String(k).capitalize() + ': ' + v)
|
34
|
+
#title = title.join(', ')
|
35
|
+
#title = config.title + ' (' + title + ')'
|
36
|
+
#document.title = title
|
37
|
+
document.title = config.title
|
38
|
+
<List key='list' router={@props.router} cards={cards} />
|
39
|
+
when "show"
|
40
|
+
cards = new CardCollection()
|
41
|
+
cards.fetching = true
|
42
|
+
card = new CardModel(title: @props.router.title)
|
43
|
+
card.fetch
|
44
|
+
success: (card)->
|
45
|
+
for left in card.get("lefts")
|
46
|
+
cardModel = new CardModel(left)
|
47
|
+
cardModel.set 'focused', false
|
48
|
+
cards.add cardModel
|
49
|
+
card.set 'focused', true
|
50
|
+
cards.add card
|
51
|
+
for right in card.get("rights")
|
52
|
+
cardModel = new CardModel(right)
|
53
|
+
cardModel.set 'focused', false
|
54
|
+
cards.add cardModel
|
55
|
+
cards.fetching = false
|
56
|
+
error: (card, response)=>
|
57
|
+
cards.fetching = false
|
58
|
+
document.title = config.title + '、' + card.get('title')
|
59
|
+
<List key='show' cards={cards} card={card} />
|
60
|
+
when "slideshow"
|
61
|
+
console.log 'slideshow', @props.router.query
|
62
|
+
cards = new CardCollection()
|
63
|
+
cards.query = $.extend {}, config.default_query, @props.router.query
|
64
|
+
cards.fetching = true
|
65
|
+
cards.fetch success: ()-> cards.fetching = false
|
66
|
+
document.title = config.title + '、スライドショー'
|
67
|
+
e = React.createElement(Slideshow, cards: cards)
|
68
|
+
React.render(e, document.body)
|
69
|
+
#<Slideshow key='slideshow' router={@props.router} cards={cards} />
|
70
|
+
else
|
71
|
+
<div>Loading ...</div>
|
72
|
+
}
|
73
|
+
</div>
|
@@ -64,17 +64,17 @@ module.exports = React.createClass
|
|
64
64
|
<div className='modal-body'>
|
65
65
|
{
|
66
66
|
if @state.errors
|
67
|
-
<div className="alert alert-danger" role="alert"
|
68
|
-
<ul
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
67
|
+
<div className="alert alert-danger" role="alert">
|
68
|
+
<ul>
|
69
|
+
{
|
70
|
+
for key, errors of @state.errors
|
71
|
+
for error in errors
|
72
|
+
<li>{key + ' ' + error}</li>
|
73
|
+
}
|
74
74
|
</ul>
|
75
75
|
</div>
|
76
76
|
else if @state.createSuccess
|
77
|
-
<div className="alert alert-success" role="alert"
|
77
|
+
<div className="alert alert-success" role="alert">
|
78
78
|
<i className="glyphicon glyphicon-info-sign" />
|
79
79
|
You created a card successfully. Let's create next one.
|
80
80
|
</div>
|
@@ -99,7 +99,7 @@ module.exports = React.createClass
|
|
99
99
|
</label>
|
100
100
|
</div>
|
101
101
|
}
|
102
|
-
<div className="form-group"
|
102
|
+
<div className="form-group">
|
103
103
|
<button className="btn btn-default pull-right" onClick={@onClickOk} disabled={@state.updating}>
|
104
104
|
|
105
105
|
OK
|
@@ -70,10 +70,10 @@ module.exports = React.createClass
|
|
70
70
|
location.hash = '/?' + $.param(query)
|
71
71
|
|
72
72
|
render: ->
|
73
|
-
<nav className="navbar navbar-default"
|
73
|
+
<nav className="navbar navbar-default">
|
74
74
|
<div className="container-fluid">
|
75
75
|
<div className="navbar-header">
|
76
|
-
<a className="navbar-brand" onClick={helpers.reload if !config.icon_link} href={if config.icon_link then config.icon_link else "#/"}
|
76
|
+
<a className="navbar-brand" onClick={helpers.reload if !config.icon_link} href={if config.icon_link then config.icon_link else "#/"}>
|
77
77
|
<img alt="Brand" src={config.root_path + config.icon_path} width="30" height="30" />
|
78
78
|
</a>
|
79
79
|
<a className="navbar-brand" onClick={helpers.reload} href="#/">
|
@@ -38,48 +38,79 @@ module.exports = React.createClass
|
|
38
38
|
$.param(query)
|
39
39
|
|
40
40
|
render: ->
|
41
|
-
<div className="container
|
41
|
+
<div className="container carte-list">
|
42
42
|
{if !@props.card
|
43
43
|
<div className="row">
|
44
|
-
<div className="col-sm-4"
|
44
|
+
<div className="col-sm-4">
|
45
45
|
<ul className="nav nav-pills">
|
46
46
|
{
|
47
47
|
for menuItem in config.menu_items
|
48
48
|
switch menuItem
|
49
49
|
when 'atoz'
|
50
|
-
<li
|
50
|
+
<li key='atoz'>
|
51
|
+
<a onClick={helpers.reload} href={"#/?" + @atozParam()}>
|
52
|
+
{
|
53
|
+
if @props.cards.query.sort == 'title' and @props.cards.query.order != 'random'
|
54
|
+
<strong>A to Z</strong>
|
55
|
+
else
|
56
|
+
<span>A to Z</span>
|
57
|
+
}
|
58
|
+
</a>
|
59
|
+
</li>
|
51
60
|
when 'latest'
|
52
|
-
<li
|
61
|
+
<li key='latest'>
|
62
|
+
<a onClick={helpers.reload} href={"#/?" + @latestParam()}>
|
63
|
+
{
|
64
|
+
if @props.cards.query.sort == 'updated_at' and @props.cards.query.order != 'random'
|
65
|
+
<strong>Latest</strong>
|
66
|
+
else
|
67
|
+
<span>Latest</span>
|
68
|
+
}
|
69
|
+
</a>
|
70
|
+
</li>
|
53
71
|
when 'random'
|
54
|
-
<li
|
72
|
+
<li key='random'>
|
73
|
+
<a onClick={helpers.reload} href={"#/?" + @randomParam()}>
|
74
|
+
{
|
75
|
+
if @props.cards.query.order == 'random'
|
76
|
+
<strong>Random</strong>
|
77
|
+
else
|
78
|
+
<span>Random</span>
|
79
|
+
}
|
80
|
+
</a>
|
81
|
+
</li>
|
55
82
|
}
|
56
|
-
<li
|
83
|
+
<li>
|
84
|
+
<a href={config.root_path + config.api_path + "/cards.xml?" + @queryParam({}, [])}>
|
85
|
+
<i className="fa fa-rss" />
|
86
|
+
</a>
|
87
|
+
</li>
|
57
88
|
</ul>
|
58
89
|
</div>
|
59
|
-
<div className="col-sm-4"
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
90
|
+
<div className="col-sm-4">
|
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
|
+
<i className="glyphicon glyphicon-refresh glyphicon-refresh-animate" />
|
98
|
+
}
|
99
|
+
</span>
|
100
|
+
</a>
|
70
101
|
</div>
|
71
|
-
<div className="col-sm-4"
|
102
|
+
<div className="col-sm-4">
|
72
103
|
{
|
73
104
|
if @props.cards.query.order == 'random'
|
74
105
|
<ul className="nav nav-pills pull-right">
|
75
106
|
<li>
|
76
107
|
{
|
77
108
|
if @props.cards.pagination
|
78
|
-
<a onClick={helpers.reload} href={"#/?" + @randomParam()}
|
109
|
+
<a onClick={helpers.reload} href={"#/?" + @randomParam()}>
|
79
110
|
<i className="glyphicon glyphicon-refresh" />
|
80
111
|
</a>
|
81
112
|
else
|
82
|
-
<a href="javascript:void(0)"
|
113
|
+
<a href="javascript:void(0)">
|
83
114
|
<i className="glyphicon glyphicon-refresh glyphicon-refresh-animate" />
|
84
115
|
</a>
|
85
116
|
}
|
@@ -92,9 +123,15 @@ module.exports = React.createClass
|
|
92
123
|
</div>
|
93
124
|
else
|
94
125
|
<div className="row">
|
95
|
-
<div className="col-sm-12"
|
126
|
+
<div className="col-sm-12">
|
96
127
|
<ul className="nav nav-pills">
|
97
|
-
<li
|
128
|
+
<li>
|
129
|
+
<a href={"#/" + @props.card.get('title')}>
|
130
|
+
<strong>
|
131
|
+
{@props.card.get('title')}
|
132
|
+
</strong>
|
133
|
+
</a>
|
134
|
+
</li>
|
98
135
|
</ul>
|
99
136
|
</div>
|
100
137
|
</div>
|
@@ -103,7 +140,7 @@ module.exports = React.createClass
|
|
103
140
|
{
|
104
141
|
if !@props.card && helpers.isMobile()
|
105
142
|
<div className="row">
|
106
|
-
<div className="col-sm-12"
|
143
|
+
<div className="col-sm-12">
|
107
144
|
<Pagination cards={@props.cards} />
|
108
145
|
</div>
|
109
146
|
</div>
|
@@ -9,9 +9,9 @@ module.exports = React.createClass
|
|
9
9
|
<div className='row'>
|
10
10
|
{
|
11
11
|
for i in [1..9]
|
12
|
-
<div className='col-sm-4'
|
13
|
-
<div className='list-group'
|
14
|
-
<div className='list-group-item'
|
12
|
+
<div key={i} className='col-sm-4'>
|
13
|
+
<div className='list-group'>
|
14
|
+
<div className='list-group-item'>
|
15
15
|
{@props.children}
|
16
16
|
</div>
|
17
17
|
</div>
|
@@ -13,8 +13,8 @@ module.exports = React.createClass
|
|
13
13
|
$.param(query)
|
14
14
|
|
15
15
|
render: ->
|
16
|
-
<ul className="nav nav-pills pull-right">
|
17
|
-
<li>
|
16
|
+
<ul className="nav nav-pills pull-right carte-pagination">
|
17
|
+
<li className="carte-pagination-prev">
|
18
18
|
{
|
19
19
|
if @props.cards.pagination
|
20
20
|
if @props.cards.pagination.current_page > 1
|
@@ -23,24 +23,24 @@ module.exports = React.createClass
|
|
23
23
|
href = "#/?" + @pageParam(@props.cards.pagination.total_pages)
|
24
24
|
else
|
25
25
|
href = "javascript:void(0)"
|
26
|
-
<a href={href} aria-label="Previous"
|
26
|
+
<a href={href} aria-label="Previous">
|
27
27
|
<span aria-hidden="true">«</span>
|
28
28
|
</a>
|
29
29
|
}
|
30
30
|
</li>
|
31
|
-
<li
|
31
|
+
<li className="carte-pagination-curr">
|
32
32
|
{
|
33
33
|
if @props.cards.pagination
|
34
|
-
<a href={"#/?" + @pageParam(@props.cards.pagination.current_page)} onClick={helpers.reload}
|
34
|
+
<a href={"#/?" + @pageParam(@props.cards.pagination.current_page)} onClick={helpers.reload}>
|
35
35
|
{@props.cards.pagination.current_page} / {@props.cards.pagination.total_pages}
|
36
36
|
</a>
|
37
37
|
else
|
38
|
-
<a href="javascript:void(0)"
|
38
|
+
<a href="javascript:void(0)">
|
39
39
|
<i className="glyphicon glyphicon-refresh glyphicon-refresh-animate" />
|
40
40
|
</a>
|
41
41
|
}
|
42
42
|
</li>
|
43
|
-
<li>
|
43
|
+
<li className="carte-pagination-next">
|
44
44
|
{
|
45
45
|
if @props.cards.pagination
|
46
46
|
if @props.cards.pagination.current_page < @props.cards.pagination.total_pages
|
@@ -49,7 +49,7 @@ module.exports = React.createClass
|
|
49
49
|
href = "#/?" + @pageParam(1)
|
50
50
|
else
|
51
51
|
href = "javascript:void(0)"
|
52
|
-
<a href={href} aria-label="Next"
|
52
|
+
<a href={href} aria-label="Next">
|
53
53
|
<span aria-hidden="true">»</span>
|
54
54
|
</a>
|
55
55
|
}
|
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": "0.0.
|
4
|
+
"version": "0.0.27",
|
5
5
|
"main": "lib/carte.coffee",
|
6
6
|
"scripts": {
|
7
7
|
"test": "echo \"Error: no test specified\" && exit 1"
|
@@ -22,6 +22,7 @@
|
|
22
22
|
"bootstrap": "^3.3.4",
|
23
23
|
"browserify": "^9.0.8",
|
24
24
|
"browserify-css": "^0.6.1",
|
25
|
+
"classnames": "^2.1.1",
|
25
26
|
"coffee-reactify": "^3.0.0",
|
26
27
|
"coffee-script": "^1.9.2",
|
27
28
|
"coffeeify": "^1.0.0",
|
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: 0.0.
|
4
|
+
version: 0.0.27
|
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-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -52,6 +52,20 @@ dependencies:
|
|
52
52
|
- - '>='
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rspec
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - '>='
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
55
69
|
- !ruby/object:Gem::Dependency
|
56
70
|
name: httparty
|
57
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -220,20 +234,6 @@ dependencies:
|
|
220
234
|
- - '>='
|
221
235
|
- !ruby/object:Gem::Version
|
222
236
|
version: '0'
|
223
|
-
- !ruby/object:Gem::Dependency
|
224
|
-
name: rspec
|
225
|
-
requirement: !ruby/object:Gem::Requirement
|
226
|
-
requirements:
|
227
|
-
- - '>='
|
228
|
-
- !ruby/object:Gem::Version
|
229
|
-
version: '0'
|
230
|
-
type: :runtime
|
231
|
-
prerelease: false
|
232
|
-
version_requirements: !ruby/object:Gem::Requirement
|
233
|
-
requirements:
|
234
|
-
- - '>='
|
235
|
-
- !ruby/object:Gem::Version
|
236
|
-
version: '0'
|
237
237
|
description: something like dictionary, wiki, or information card
|
238
238
|
email:
|
239
239
|
- tidnlyam@gmail.com
|
@@ -266,6 +266,7 @@ files:
|
|
266
266
|
- lib/carte/client/models/card.coffee
|
267
267
|
- lib/carte/client/models/cards.coffee
|
268
268
|
- lib/carte/client/router.coffee
|
269
|
+
- lib/carte/client/tasks.coffee
|
269
270
|
- lib/carte/client/views/app.cjsx
|
270
271
|
- lib/carte/client/views/card.cjsx
|
271
272
|
- lib/carte/client/views/cards.cjsx
|