carte-server 0.0.13 → 0.0.14

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d197ea3d1133844e5dd56466724f421dad8cf957
4
- data.tar.gz: ef1e33d03996bbcef1eccd41a386e5ec7787b728
3
+ metadata.gz: 94f92bcba2bb68b4e76f4380f0d4bcd508db2470
4
+ data.tar.gz: ce41c8cdd0b3f0221c3e2b3cad4dae76ce5547f6
5
5
  SHA512:
6
- metadata.gz: c28c72d2e4ba717cfe840d3417d10fe3703936defb7185f069800a9b92008031574cce3328eadcb1117572d20b5481157aed8186204153e935a2e473919ba3dc
7
- data.tar.gz: d62efdbf04e13578de0060504acb695b8405c382581f22bf05ff5dad21367409d48c109a6c6f0c129135ad92f1c8c4d9a2f6cad0d1db823fbc2d1dc20421463f
6
+ metadata.gz: 73b8fca305b006462412bc800b10cf00cc65675538cb1fb07681edbdcc72478b51583390e423742cd81c7d23a1a03f5966e6928a30f9e3c3a541b608e6feb572
7
+ data.tar.gz: ba3a2d310e97f4eee0ca9fa2c57d88ff08cf8ef7a09843e6ef58a593d8569d2cdb7a5be504a90991af6187580af08018d3348b5022ff49fa9ed90fc4d902c0c8
data/.gitignore CHANGED
@@ -15,3 +15,4 @@ mkmf.log
15
15
  /node_modules/
16
16
  /public/app.js
17
17
  /lib/carte/shared/custom.json
18
+ .env
data/README.md CHANGED
@@ -21,9 +21,11 @@ Japanese introduction is [here](http://tily.tumblr.com/post/117678137942/carte).
21
21
 
22
22
  ## Components
23
23
 
24
- * [carte-server](https://rubygems.org/gems/carte-server)
25
- * [carte-client](https://www.npmjs.com/package/carte-client)
26
-
24
+ | Package Name | Description |
25
+ |--------------|-------------|
26
+ | [carte-server](https://rubygems.org/gems/carte-server) | provides JSON API (document is [here](https://github.com/tily/carte/wiki/API)) |
27
+ | [carte-client](https://www.npmjs.com/package/carte-client) | builds client side javascript |
28
+
27
29
  ## Deploy
28
30
 
29
31
  [![Deploy](https://www.herokucdn.com/deploy/button.png)](https://heroku.com/deploy?template=https://github.com/tily/carte-sandbox)
@@ -33,4 +33,5 @@ Gem::Specification.new do |spec|
33
33
  spec.add_dependency "haml"
34
34
  spec.add_dependency "mongoid-simple-tags"
35
35
  spec.add_dependency "mongoid-geospatial"
36
+ spec.add_dependency "redcarpet"
36
37
  end
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "title": "Carte Sandbox (custom)",
3
3
  "description": "Sandbox for Carte",
4
+ "icon_link": "http://www.google.com",
4
5
  "public_folder": "public",
5
6
  "script_path": "public/app.js",
6
- "link_color": "yellow",
7
7
  "menu_items": ["latest", "random", "atoz"],
8
8
  "default_query": {"sort": "updated_at", "order": "desc"},
9
9
  "api_path": ""
@@ -8,6 +8,7 @@ Router = require('./client/router')
8
8
  Backbone.$ = $
9
9
  cssify.byUrl('//maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css')
10
10
  cssify.byUrl('//maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css')
11
+ cssify.byUrl('//cdnjs.cloudflare.com/ajax/libs/animate.css/3.2.6/animate.min.css')
11
12
 
12
13
  $(document).ready ()->
13
14
  AppView = React.createFactory(AppViewComponent)
@@ -25,7 +25,7 @@ module.exports = React.createClass
25
25
  when "list"
26
26
  console.log 'list', @props.router.query
27
27
  cards = new CardCollection()
28
- cards.query = $.extend config.default_query, @props.router.query
28
+ cards.query = $.extend {}, config.default_query, @props.router.query
29
29
  cards.fetching = true
30
30
  cards.fetch success: ()-> cards.fetching = false
31
31
  title = []
@@ -16,6 +16,7 @@ module.exports = React.createClass
16
16
  content: @props.card.get('content')
17
17
  tags: @props.card.get('tags') || []
18
18
  errors: false
19
+ shaking: false
19
20
 
20
21
  onChangeTitle: ->
21
22
  @setState title: event.target.value
@@ -41,9 +42,11 @@ module.exports = React.createClass
41
42
  console.log response.responseJSON
42
43
  @setState errors: response.responseJSON.card.errors
43
44
  @setState updating: false
45
+ @setState shaking: true
46
+ setTimeout (=> @setState shaking: false), 300
44
47
 
45
48
  render: ->
46
- <Modal {...@props} bsStyle='default' title={if @props.card.isNew() then <i className="glyphicon glyphicon-plus" /> else <i className="glyphicon glyphicon-edit" />} animation={false}>
49
+ <Modal className={"animated infinite shake" if @state.shaking} {...@props} bsStyle='default' title={if @props.card.isNew() then <i className="glyphicon glyphicon-plus" /> else <i className="glyphicon glyphicon-edit" />} animation={false}>
47
50
  <div className='modal-body'>
48
51
  {
49
52
  if @state.errors
@@ -62,7 +62,7 @@ module.exports = React.createClass
62
62
  <nav className="navbar navbar-default" style={{padding:"0px",backgroundColor:"white",marginBottom:"5px"}}>
63
63
  <div className="container-fluid">
64
64
  <div className="navbar-header">
65
- <a className="navbar-brand" onClick={helpers.reload} href={if config.icon_link then config.icon_link else "#/"} style={{paddingTop:"10px"}}>
65
+ <a className="navbar-brand" onClick={helpers.reload if !config.icon_link} href={if config.icon_link then config.icon_link else "#/"} style={{paddingTop:"10px"}}>
66
66
  <img alt="Brand" src="/images/icon.png" width="30" height="30" />
67
67
  </a>
68
68
  <a className="navbar-brand" onClick={helpers.reload} href="#/">
@@ -31,8 +31,7 @@ module.exports = React.createClass
31
31
  @queryParam {tag: tag}, ['seed']
32
32
 
33
33
  queryParam: (param, deleteKeys)->
34
- query = $.extend {}, @props.cards.query
35
- query = $.extend query, param
34
+ query = $.extend {}, @props.cards.query, param
36
35
  for key in deleteKeys
37
36
  delete query[key]
38
37
  $.param(query)
@@ -5,6 +5,7 @@ require 'mongoid_auto_increment_id'
5
5
  require 'will_paginate_mongoid'
6
6
  require 'mongoid-simple-tags'
7
7
  require 'mongoid/geospatial'
8
+ require 'redcarpet'
8
9
  require 'carte/server/validators'
9
10
  require 'carte/server/models'
10
11
 
@@ -53,6 +54,11 @@ module Carte
53
54
  end
54
55
  cards = cards.paginate(per_page: 9, page: params[:page])
55
56
  end
57
+
58
+ def markdown2html(markdown)
59
+ renderer = Redcarpet::Render::HTML.new(filter_html:true)
60
+ Redcarpet::Markdown.new(renderer, autolink: true).render(markdown)
61
+ end
56
62
  end
57
63
 
58
64
  get '/' do
@@ -20,13 +20,13 @@ module Carte
20
20
  on: :create
21
21
  validates :title,
22
22
  uniqueness: true,
23
- length: {maximum: 70}
23
+ length: {maximum: (ENV['CARTE_TITLE_MAX_LENGTH'] || 70).to_i}
24
24
  validates :content,
25
25
  presence: true,
26
- length: {maximum: 560}
26
+ length: {maximum: (ENV['CARTE_DESCRIPTION_MAX_LENGTH'] || 560).to_i}
27
27
  validates :tags,
28
- length: {maximum: 3, message: 'are too many (maximum is 3 tags)'},
29
- array: {length: {maximum: 10}}
28
+ length: {maximum: (ENV['CARTE_TAGS_MAX_SIZE'] || 3).to_i, message: 'are too many (maximum is 3 tags)'},
29
+ array: {length: {maximum: (ENV['CARTE_TAG_MAX_LENGTH'] || 10).to_i}}
30
30
 
31
31
  has_many :histories
32
32
 
@@ -2,6 +2,6 @@ require 'sinatra/base'
2
2
 
3
3
  module Carte
4
4
  class Server < Sinatra::Base
5
- VERSION = "0.0.13"
5
+ VERSION = "0.0.14"
6
6
  end
7
7
  end
@@ -8,7 +8,7 @@ xml.rss version: "2.0", :"xmlns:atom" => "http://www.w3.org/2005/Atom" do
8
8
  @cards.each do |card|
9
9
  xml.item do
10
10
  xml.title(card.title)
11
- xml.description card.content
11
+ xml.description markdown2html(card.content)
12
12
  xml.link("http://#{request.host}/#/#{URI.escape(card.title)}")
13
13
  xml.pubDate card.updated_at.rfc822
14
14
  xml.guid({isPermaLink: false}, "http://#{request.host}/#/#{URI.escape(card.title)}##{card.updated_at.to_i}")
@@ -23,8 +23,14 @@
23
23
  color: #333333 !important;
24
24
  text-decoration: none !important;
25
25
  }
26
- a, a:hover, a:visited, a:active {
27
- color: #{config['link_color']};
26
+ a {
27
+ color: #{config['link_color']};
28
+ text-decoration: none;
29
+ }
30
+ a:hover,
31
+ a:focus {
32
+ color: #{config['link_active_color']};
33
+ text-decoration: underline;
28
34
  }
29
35
  .glyphicon-refresh-animate {
30
36
  -animation: spin .7s infinite linear;
@@ -3,7 +3,8 @@
3
3
  "description": "Sandbox for Carte",
4
4
  "public_folder": "public",
5
5
  "script_path": "public/app.js",
6
- "link_color": "yellow",
6
+ "link_color": "#337ab7",
7
+ "link_active_color": "#23527c",
7
8
  "api_path": "",
8
9
  "menu_items": ["atoz", "latest", "random"],
9
10
  "default_query": {"sort": "title", "order": "asc"},
@@ -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.13",
4
+ "version": "0.0.14",
5
5
  "main": "lib/carte.coffee",
6
6
  "scripts": {
7
7
  "test": "echo \"Error: no test specified\" && exit 1"
Binary file
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.13
4
+ version: 0.0.14
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-04 00:00:00.000000000 Z
11
+ date: 2015-05-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -206,6 +206,20 @@ dependencies:
206
206
  - - '>='
207
207
  - !ruby/object:Gem::Version
208
208
  version: '0'
209
+ - !ruby/object:Gem::Dependency
210
+ name: redcarpet
211
+ requirement: !ruby/object:Gem::Requirement
212
+ requirements:
213
+ - - '>='
214
+ - !ruby/object:Gem::Version
215
+ version: '0'
216
+ type: :runtime
217
+ prerelease: false
218
+ version_requirements: !ruby/object:Gem::Requirement
219
+ requirements:
220
+ - - '>='
221
+ - !ruby/object:Gem::Version
222
+ version: '0'
209
223
  description: something like dictionary, wiki, or information card
210
224
  email:
211
225
  - tidnlyam@gmail.com