carte-server 0.0.12 → 0.0.13
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -1
- data/config.json +3 -1
- data/lib/carte.coffee +1 -1
- data/lib/carte/client/config.coffee +4 -0
- data/lib/carte/client/models/card.coffee +1 -1
- data/lib/carte/client/models/cards.coffee +1 -1
- data/lib/carte/client/views/card.cjsx +1 -1
- data/lib/carte/client/views/cards.cjsx +4 -4
- data/lib/carte/client/views/content.cjsx +3 -4
- data/lib/carte/client/views/header.cjsx +1 -1
- data/lib/carte/client/views/list.cjsx +12 -5
- data/lib/carte/server.rb +6 -0
- data/lib/carte/server/version.rb +1 -1
- data/lib/carte/server/views/cards.builder +2 -2
- data/lib/carte/server/views/index.haml +3 -3
- data/lib/carte/shared/default.json +10 -28
- data/package.json +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d197ea3d1133844e5dd56466724f421dad8cf957
|
4
|
+
data.tar.gz: ef1e33d03996bbcef1eccd41a386e5ec7787b728
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c28c72d2e4ba717cfe840d3417d10fe3703936defb7185f069800a9b92008031574cce3328eadcb1117572d20b5481157aed8186204153e935a2e473919ba3dc
|
7
|
+
data.tar.gz: d62efdbf04e13578de0060504acb695b8405c382581f22bf05ff5dad21367409d48c109a6c6f0c129135ad92f1c8c4d9a2f6cad0d1db823fbc2d1dc20421463f
|
data/.gitignore
CHANGED
data/config.json
CHANGED
@@ -1,8 +1,10 @@
|
|
1
1
|
{
|
2
|
-
"title": "Carte Sandbox",
|
2
|
+
"title": "Carte Sandbox (custom)",
|
3
3
|
"description": "Sandbox for Carte",
|
4
4
|
"public_folder": "public",
|
5
5
|
"script_path": "public/app.js",
|
6
6
|
"link_color": "yellow",
|
7
|
+
"menu_items": ["latest", "random", "atoz"],
|
8
|
+
"default_query": {"sort": "updated_at", "order": "desc"},
|
7
9
|
"api_path": ""
|
8
10
|
}
|
data/lib/carte.coffee
CHANGED
@@ -24,7 +24,7 @@ module.exports = class Carte
|
|
24
24
|
|
25
25
|
build: (options)->
|
26
26
|
config = require(options.config)
|
27
|
-
fs.writeFileSync(__dirname + '/carte/shared/
|
27
|
+
fs.writeFileSync(__dirname + '/carte/shared/custom.json', JSON.stringify(config))
|
28
28
|
dir = path.dirname config.script_path
|
29
29
|
file = path.basename config.script_path
|
30
30
|
minify = options.minify
|
@@ -11,10 +11,10 @@ module.exports = React.createClass
|
|
11
11
|
componentDidMount: ()->
|
12
12
|
console.log 'component did mount'
|
13
13
|
@props.cards.on 'sync', @forceUpdate.bind(@, null)
|
14
|
-
@props.card
|
15
|
-
|
16
|
-
|
17
|
-
|
14
|
+
if @props.card
|
15
|
+
@props.card.on 'error', (model, response)=>
|
16
|
+
@setState error: response
|
17
|
+
@forceUpdate.bind(@, null)
|
18
18
|
|
19
19
|
render: ->
|
20
20
|
console.log 'render cards', @props.cards, @state
|
@@ -1,10 +1,11 @@
|
|
1
1
|
# @cjsx React.DOM
|
2
|
+
$ = require('jquery')
|
2
3
|
React = require('react')
|
3
4
|
List = require('./list')
|
4
5
|
CardCollection = require('../models/cards')
|
5
6
|
CardModel = require('../models/card')
|
6
7
|
String = require('string')
|
7
|
-
config = require('
|
8
|
+
config = require('../config')
|
8
9
|
|
9
10
|
module.exports = React.createClass
|
10
11
|
displayName: 'Content'
|
@@ -24,9 +25,7 @@ module.exports = React.createClass
|
|
24
25
|
when "list"
|
25
26
|
console.log 'list', @props.router.query
|
26
27
|
cards = new CardCollection()
|
27
|
-
cards.query = @props.router.query
|
28
|
-
cards.query.sort = 'title' if !cards.query.sort
|
29
|
-
cards.query.order = 'asc' if !cards.query.order
|
28
|
+
cards.query = $.extend config.default_query, @props.router.query
|
30
29
|
cards.fetching = true
|
31
30
|
cards.fetch success: ()-> cards.fetching = false
|
32
31
|
title = []
|
@@ -5,7 +5,7 @@ Edit = require('./edit')
|
|
5
5
|
CardModel = require('../models/card')
|
6
6
|
ModalTrigger = require('react-bootstrap/lib/ModalTrigger')
|
7
7
|
helpers = require('../helpers')
|
8
|
-
config = require('
|
8
|
+
config = require('../config')
|
9
9
|
|
10
10
|
module.exports = React.createClass
|
11
11
|
displayName: 'Header'
|
@@ -6,7 +6,7 @@ Cards = require('./cards')
|
|
6
6
|
CardCollection = require('../models/cards')
|
7
7
|
Pagination = require('./pagination')
|
8
8
|
helpers = require('../helpers')
|
9
|
-
config = require('
|
9
|
+
config = require('../config')
|
10
10
|
|
11
11
|
module.exports = React.createClass
|
12
12
|
displayName: 'List'
|
@@ -44,9 +44,16 @@ module.exports = React.createClass
|
|
44
44
|
<div className="row">
|
45
45
|
<div className="col-sm-6" style={{padding:"0px"}}>
|
46
46
|
<ul className="nav nav-pills">
|
47
|
-
|
48
|
-
|
49
|
-
|
47
|
+
{
|
48
|
+
for menuItem in config.menu_items
|
49
|
+
switch menuItem
|
50
|
+
when 'atoz'
|
51
|
+
<li><a onClick={helpers.reload} href={"#/?" + @atozParam()} style={{padding:'6px 12px',fontWeight: if @props.cards.query.sort == 'title' and @props.cards.query.order != 'random' then 'bold' else 'normal'}}>A to Z</a></li>
|
52
|
+
when 'latest'
|
53
|
+
<li><a onClick={helpers.reload} href={"#/?" + @latestParam()} style={{padding:'6px 12px',fontWeight: if @props.cards.query.sort == 'updated_at' and @props.cards.query.order != 'random' then 'bold' else 'normal'}}>Latest</a></li>
|
54
|
+
when 'random'
|
55
|
+
<li><a onClick={helpers.reload} href={"#/?" + @randomParam()} style={{padding:'6px 12px',fontWeight: if @props.cards.query.order == 'random' then 'bold' else 'normal'}}>Random</a></li>
|
56
|
+
}
|
50
57
|
<li><a href={config.api_path + "/api/cards.xml?" + @queryParam({}, [])} style={{padding:'6px 12px'}}><i className="fa fa-rss" /></a></li>
|
51
58
|
</ul>
|
52
59
|
</div>
|
@@ -76,7 +83,7 @@ module.exports = React.createClass
|
|
76
83
|
<div className="row">
|
77
84
|
<div className="col-sm-12" style={{padding:"0px"}}>
|
78
85
|
<ul className="nav nav-pills">
|
79
|
-
<li><a href={"#/" + @props.card.get('title')} style={fontWeight:'bold'}>{@props.card.get('title')}</a></li>
|
86
|
+
<li><a href={"#/" + @props.card.get('title')} style={padding:'6px 12px',fontWeight:'bold'}>{@props.card.get('title')}</a></li>
|
80
87
|
</ul>
|
81
88
|
</div>
|
82
89
|
</div>
|
data/lib/carte/server.rb
CHANGED
@@ -18,10 +18,16 @@ module Carte
|
|
18
18
|
set :protection, :except => :path_traversal
|
19
19
|
set :views, File.join(File.dirname(__FILE__), 'server/views')
|
20
20
|
set :public_folder, 'public'
|
21
|
+
set :default, JSON.parse(File.read(File.join(File.dirname(__FILE__), 'shared/default.json')))
|
22
|
+
set :carte, {}
|
21
23
|
set :script_path, '/app.js'
|
22
24
|
end
|
23
25
|
|
24
26
|
helpers do
|
27
|
+
def config
|
28
|
+
@config ||= settings.default.update(settings.carte)
|
29
|
+
end
|
30
|
+
|
25
31
|
def json_data
|
26
32
|
request.body.rewind
|
27
33
|
JSON.parse(request.body.read)
|
data/lib/carte/server/version.rb
CHANGED
@@ -2,8 +2,8 @@ xml.instruct! :xml, version: '1.0'
|
|
2
2
|
xml.rss version: "2.0", :"xmlns:atom" => "http://www.w3.org/2005/Atom" do
|
3
3
|
xml.channel do
|
4
4
|
xml.tag! "atom:link", href: "http://#{request.host}/api/cards.xml?#{request.env['QUERY_STRING']}", rel: "self", type: "application/rss+xml"
|
5
|
-
xml.title
|
6
|
-
xml.description
|
5
|
+
xml.title config['title']
|
6
|
+
xml.description config['description']
|
7
7
|
xml.link "http://#{request.host}/"
|
8
8
|
@cards.each do |card|
|
9
9
|
xml.item do
|
@@ -2,9 +2,9 @@
|
|
2
2
|
%html
|
3
3
|
%head
|
4
4
|
%meta{charset:"utf-8"}
|
5
|
-
%title=
|
5
|
+
%title= config['title']
|
6
6
|
%meta{name:"viewport",content:"width=device-width,initial-scale=1.0"}
|
7
|
-
%meta{name:"description",content:
|
7
|
+
%meta{name:"description",content:config['description']}
|
8
8
|
%script{type:"text/javascript",src:"/app.js"}
|
9
9
|
:css
|
10
10
|
.navbar-default a,
|
@@ -24,7 +24,7 @@
|
|
24
24
|
text-decoration: none !important;
|
25
25
|
}
|
26
26
|
a, a:hover, a:visited, a:active {
|
27
|
-
color: #{
|
27
|
+
color: #{config['link_color']};
|
28
28
|
}
|
29
29
|
.glyphicon-refresh-animate {
|
30
30
|
-animation: spin .7s infinite linear;
|
@@ -1,32 +1,14 @@
|
|
1
1
|
{
|
2
2
|
"title": "Carte Sandbox",
|
3
3
|
"description": "Sandbox for Carte",
|
4
|
-
"
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
"
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
},
|
15
|
-
"description": {
|
16
|
-
"presence": true,
|
17
|
-
"length": {
|
18
|
-
"maximum": 70
|
19
|
-
}
|
20
|
-
},
|
21
|
-
"tags": {
|
22
|
-
"length": 3,
|
23
|
-
"array": {
|
24
|
-
"length": {
|
25
|
-
"maximum": 10
|
26
|
-
}
|
27
|
-
}
|
28
|
-
}
|
29
|
-
}
|
30
|
-
}
|
31
|
-
}
|
4
|
+
"public_folder": "public",
|
5
|
+
"script_path": "public/app.js",
|
6
|
+
"link_color": "yellow",
|
7
|
+
"api_path": "",
|
8
|
+
"menu_items": ["atoz", "latest", "random"],
|
9
|
+
"default_query": {"sort": "title", "order": "asc"},
|
10
|
+
"title_max_length": 70,
|
11
|
+
"description_max_length": 560,
|
12
|
+
"tags_max_size": 3,
|
13
|
+
"tag_max_length": 10
|
32
14
|
}
|
data/package.json
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
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.13
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- tily
|
@@ -226,6 +226,7 @@ files:
|
|
226
226
|
- lib/carte.coffee
|
227
227
|
- lib/carte.rb
|
228
228
|
- lib/carte/client.coffee
|
229
|
+
- lib/carte/client/config.coffee
|
229
230
|
- lib/carte/client/helpers.coffee
|
230
231
|
- lib/carte/client/models/card.coffee
|
231
232
|
- lib/carte/client/models/cards.coffee
|