carte-server 0.0.4 → 0.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 40e29e4e73482abcd5e6155e32ea8a5765f38247
4
- data.tar.gz: a4495c673b963ba553581bf4d9c47c0accb88e30
3
+ metadata.gz: e0bfef4c6ba86e6cce646264ebf2e52818ec097f
4
+ data.tar.gz: 693f0efaf70c3ec9b5e35e5b5c20838f1a51cdb3
5
5
  SHA512:
6
- metadata.gz: b77a2714e6a6188549a7c9ea9b6a4da6df1684c54c71a76e9322a2a751a1fc4eecd58593e2108eefbf51c1e7482487a300794e347bc1e4561bad8d7b34412731
7
- data.tar.gz: e241efb22b9a7db1f53832c63e6900e47252556ef73aadbebe91c9ecaf48439692f3b39d904dc796e5a787bc597254bc27203e3b74e64e7e043b98546e6ccaf5
6
+ metadata.gz: d679b7217daad508664271b41e9238433cc56d49ee1f335113489c2f8b6afcaffd98be5e38f11fd2c854b066939a847e61880876a201b4d2a9f2f2d27205601f
7
+ data.tar.gz: b3c674856434d6a70e069a23c419b4c0a26977647325ca81503e5cd08f2c659ad5babed67de1c89883088a87535b85e5cb8a1a11dcbeb04f4545f12be052307e
data/config.json CHANGED
@@ -1,6 +1,7 @@
1
1
  {
2
2
  "title": "carte sandbox",
3
- "description": "something like dictionary, wiki, or information card",
3
+ "description": "sandbox for carte",
4
4
  "public_folder": "public",
5
- "script_path": "public/app.js"
5
+ "script_path": "public/app.js",
6
+ "link_color": "#2C21A6"
6
7
  }
data/config.ru CHANGED
@@ -5,9 +5,7 @@ class Carte::Server
5
5
  configure do
6
6
  Mongoid.load! './mongoid.yml'
7
7
  config = JSON.parse File.read('config.json')
8
- config.each do |k, v|
9
- set k.to_sym, v
10
- end
8
+ set :carte, config
11
9
  end
12
10
  end
13
11
 
@@ -6,6 +6,7 @@ markdownIt = require('markdown-it')(linkify: true)
6
6
 
7
7
  module.exports = React.createClass
8
8
  displayName: 'Card'
9
+ isSafariOrUiWebView: /(iPhone|iPod|iPad).*AppleWebKit/i.test(navigator.userAgent)
9
10
 
10
11
  componentDidMount: ->
11
12
  @props.card.on 'change', @forceUpdate.bind(@, null)
@@ -27,13 +28,8 @@ module.exports = React.createClass
27
28
 
28
29
  render: ->
29
30
  console.log 'Card: render'
30
- style = {height:'220px'}
31
- if @props.card.get('focused')
32
- #style.color = 'red'
33
- style.borderColor = '#ccc'
34
- <div className='col-sm-4' style={padding:'5px'} onMouseOver={@onMouseOver} onMouseLeave={@onMouseLeave}>
35
- <div className='list-group' style={margin:'0px',padding:'0px'}>
36
- <div className='list-group-item' style={style}>
31
+ <div className='col-sm-4 col-xs-12 list-group' style={marginBottom:'0px',padding:"5px"} onMouseOver={@onMouseOver} onMouseLeave={@onMouseLeave}>
32
+ <div className='list-group-item' style={height:'220px'}>
37
33
  <div>
38
34
  {
39
35
  if @props.card.get('focused')
@@ -42,7 +38,7 @@ module.exports = React.createClass
42
38
  <strong>
43
39
  {@props.card.get('title')}
44
40
  </strong>
45
- <span className='pull-right' style={{visibility: if @state.showTools then 'visible' else 'hidden'}}>
41
+ <span className='pull-right tools' style={{visibility: if @isSafariOrUiWebView || @state.showTools then 'visible' else 'hidden'}}>
46
42
  <ModalTrigger modal={<Edit card={@props.card} />}>
47
43
  <a href="javascript:void(0)">
48
44
  <i className='glyphicon glyphicon-edit' />
@@ -55,11 +51,8 @@ module.exports = React.createClass
55
51
  </a>
56
52
  </span>
57
53
  </div>
58
- <div style={overflow:'scroll',width:'100%',height:'80%',wordWrap:'break-word'}>
59
- <p>
60
- <div dangerouslySetInnerHTML={__html: markdownIt.render @props.card.get('content')} />
61
- </p>
54
+ <div style={overflow:'hidden',width:'100%',height:'80%',wordWrap:'break-word'}>
55
+ <p dangerouslySetInnerHTML={__html: markdownIt.render @props.card.get('content')} />
62
56
  </div>
63
- </div>
64
57
  </div>
65
58
  </div>
@@ -61,7 +61,7 @@ module.exports = React.createClass
61
61
  error: (card, response)=>
62
62
  console.log response
63
63
  document.title = card.get('title') + ' - ' + config.title
64
- <List key='show' cards={cards} showNav=false />
64
+ <List key='show' cards={cards} card={card} />
65
65
  else
66
66
  console.log 'else'
67
67
  <div>Loading ...</div>
@@ -1,4 +1,5 @@
1
1
  # @cjsx React.DOM
2
+ $ = require('jquery')
2
3
  React = require('react')
3
4
  Edit = require('./edit')
4
5
  CardModel = require('../models/card')
@@ -8,6 +9,9 @@ config = require('../../shared/config.json')
8
9
  module.exports = React.createClass
9
10
  displayName: 'Header'
10
11
 
12
+ getInitialState: ()->
13
+ searchText: ''
14
+
11
15
  componentWillMount: ()->
12
16
  console.log 'header mounted'
13
17
  @card = new CardModel()
@@ -18,8 +22,18 @@ module.exports = React.createClass
18
22
  @card._isNew = true
19
23
  @forceUpdate()
20
24
 
25
+ onChangeSearchText: ()->
26
+ @setState searchText: event.target.value
27
+
28
+ onKeyPressSearchText: ()->
29
+ if event.keyCode == 13 # ENTER
30
+ console.log '13 enter'
31
+ event.preventDefault()
32
+ query = {title: @state.searchText}
33
+ location.hash = '/?' + $.param(query)
34
+
21
35
  render: ->
22
- <nav className="navbar navbar-default" style={{padding:"0px",backgroundColor:"white"}}>
36
+ <nav className="navbar navbar-default" style={{padding:"0px",backgroundColor:"white",marginBottom:"5px"}}>
23
37
  <div className="container-fluid">
24
38
  <div className="navbar-header">
25
39
  <a className="navbar-brand" href="#/" style={{paddingTop:"10px"}}>
@@ -29,7 +43,12 @@ module.exports = React.createClass
29
43
  {config.title}
30
44
  </a>
31
45
  </div>
32
- <div className="collapse navbar-collapse">
46
+ <div>
47
+ <form className="navbar-form navbar-left" role="search">
48
+ <div className="form-group">
49
+ <input type="text" className="form-control" value={@state.searchText} onChange={@onChangeSearchText} onKeyPress={@onKeyPressSearchText} placeholder='Search ...' style={width:"344px"} />
50
+ </div>
51
+ </form>
33
52
  <ul className="nav navbar-nav navbar-right">
34
53
  <li>
35
54
  <ModalTrigger modal={<Edit card={@card} />}>
@@ -14,20 +14,6 @@ module.exports = React.createClass
14
14
  console.log 'List: component will receive props'
15
15
  nextProps.cards.on 'sync', @forceUpdate.bind(@, null)
16
16
 
17
- getInitialState: ()->
18
- searchText: ''
19
-
20
- onChangeSearchText: ()->
21
- @setState searchText: event.target.value
22
-
23
- onKeyPressSearchText: ()->
24
- if event.keyCode == 13 # ENTER
25
- console.log '13 enter', @props.cards.query
26
- event.preventDefault()
27
- query = $.extend {}, @props.cards.query
28
- query = $.extend query, {title: @state.searchText}
29
- location.hash = '/?' + $.param(query)
30
-
31
17
  atozParam: ()->
32
18
  query = $.extend {}, @props.cards.query
33
19
  query = $.extend query, {sort: 'title', order: 'asc', page: 1}
@@ -54,16 +40,9 @@ module.exports = React.createClass
54
40
 
55
41
  render: ->
56
42
  console.log 'render', @props.cards.query
57
- <div className="container" style={{paddingLeft:"5px",paddingRight:"5px",paddingBottom:"20px"}}>
58
- {if @props.showNav
43
+ <div className="container" style={{paddingLeft:"5px",paddingRight:"5px"}}>
44
+ {if !@props.card
59
45
  <div className="row">
60
- <div className="col-sm-12" style={{padding:"5px"}}>
61
- <form>
62
- <div className="form-group">
63
- <input type="text" className="form-control" value={@state.searchText} onChange={@onChangeSearchText} onKeyPress={@onKeyPressSearchText} placeholder='Type search text and press enter ...' />
64
- </div>
65
- </form>
66
- </div>
67
46
  <div className="col-sm-6" style={{padding:"0px"}}>
68
47
  <ul className="nav nav-pills">
69
48
  <li><a 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>
@@ -134,6 +113,14 @@ module.exports = React.createClass
134
113
  }
135
114
  </div>
136
115
  </div>
116
+ else
117
+ <div className="row">
118
+ <div className="col-sm-12" style={{padding:"0px"}}>
119
+ <ul className="nav nav-pills">
120
+ <li><a href={"/#/" + @props.card.get('title')} style={fontWeight:'bold'}>{@props.card.get('title')}</a></li>
121
+ </ul>
122
+ </div>
123
+ </div>
137
124
  }
138
125
  <Cards cards={@props.cards} />
139
126
  </div>
data/lib/carte/server.rb CHANGED
@@ -45,7 +45,7 @@ module Carte
45
45
  end
46
46
 
47
47
  get '/app.js' do
48
- send_file settings.script_path
48
+ send_file settings.carte['script_path']
49
49
  end
50
50
 
51
51
  namespace '/api' do
@@ -2,6 +2,6 @@ require 'sinatra/base'
2
2
 
3
3
  module Carte
4
4
  class Server < Sinatra::Base
5
- VERSION = "0.0.4"
5
+ VERSION = "0.0.5"
6
6
  end
7
7
  end
@@ -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 "carte"
6
- xml.description "something like dictionary, wiki, or information card"
5
+ xml.title settings.carte['title']
6
+ xml.description settings.carte['description']
7
7
  xml.link "http://#{request.host}/"
8
8
  @cards.each do |card|
9
9
  xml.item do
@@ -2,15 +2,30 @@
2
2
  %html
3
3
  %head
4
4
  %meta{charset:"utf-8"}
5
- %title= settings.title
5
+ %title= settings.carte['title']
6
6
  %meta{name:"viewport",content:"width=device-width,initial-scale=1.0"}
7
- %meta{name:"description",content:settings.description}
7
+ %meta{name:"description",content:settings.carte['description']}
8
8
  %script{type:"text/javascript",src:"/app.js"}
9
9
  :css
10
- a, a:hover, a:visited, a:active {
10
+ .navbar-default a,
11
+ .navbar-default a:hover,
12
+ .navbar-default a:visited,
13
+ .navbar-default a:active,
14
+ .nav-pills a,
15
+ .nav-pills a:hover,
16
+ .nav-pills a:visited,
17
+ .nav-pills a:active,
18
+ .tools a,
19
+ .tools a:hover,
20
+ .tools a:visited,
21
+ .tools a:active
22
+ {
11
23
  color: #333333 !important;
12
24
  text-decoration: none !important;
13
25
  }
26
+ a, a:hover, a:visited, a:active {
27
+ color: #{settings.carte['link_color']};
28
+ }
14
29
  .glyphicon-refresh-animate {
15
30
  -animation: spin .7s infinite linear;
16
31
  -webkit-animation: spin2 .7s infinite linear;
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",
4
+ "version": "0.0.5",
5
5
  "main": "lib/carte.coffee",
6
6
  "scripts": {
7
7
  "test": "echo \"Error: no test specified\" && exit 1"
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
4
+ version: 0.0.5
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-01 00:00:00.000000000 Z
11
+ date: 2015-05-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler