tomify 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/javascripts/tomify/dynamic/react/components/index.coffee +11 -3
- data/app/assets/javascripts/tomify/dynamic/react/components/pagination.coffee +10 -10
- data/app/assets/javascripts/tomify/dynamic/react/components/public/subscription.coffee +1 -1
- data/app/assets/javascripts/tomify/dynamic/react/mixins/follow.coffee +1 -1
- data/app/assets/stylesheets/tomify/_pagination.scss +1 -1
- data/lib/tomify/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d85803b12226321bb76440fc8efae058be5d9772
|
4
|
+
data.tar.gz: 3ce0217e98efeced7e3f22ff3abb980f308bfe67
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3d9363a21eefec8e5262e5361de0eb8f55fd9f53cb3648c7e1d100d7e10a0a5b08bbe525ad0ec5e59ee8a5ab5cf94878c7b4a66b20fc9495278a2c4946d5a3d9
|
7
|
+
data.tar.gz: 5d0bafb20a6461996c1f05fdd989c8e3e1f0d57192bc75439b1d488f9dfea2e6402e136415e178779d7b31b20a4902fd10b649199a18acd0568fc86f03b45b20
|
@@ -1,4 +1,6 @@
|
|
1
1
|
Component.create "Index.Container",
|
2
|
+
getDefaultProps: -> { length: 5 }
|
3
|
+
getInitialState: -> { page: 1, currentRecords: [] }
|
2
4
|
componentWillInitialize: ->
|
3
5
|
@model = Model.findOrCreate @props.name
|
4
6
|
@store = Store.findOrCreate "#{@props.name}.Index"
|
@@ -20,7 +22,9 @@ Component.create "Index.Container",
|
|
20
22
|
modelDestroy: (response) ->
|
21
23
|
@model.all() if response.type == "danger"
|
22
24
|
setPage: (page) ->
|
23
|
-
|
25
|
+
finish = page * @props.length
|
26
|
+
start = finish - @props.length
|
27
|
+
@setState(page: page, currentRecords: @state.records[start...finish])
|
24
28
|
actions: (record) ->
|
25
29
|
actions = []
|
26
30
|
|
@@ -63,7 +67,7 @@ Component.create "Index.Container",
|
|
63
67
|
<a className="btn btn-primary btn-xs" href="#" onClick={click}>New</a>
|
64
68
|
}
|
65
69
|
</h4>
|
66
|
-
<Pagination page=
|
70
|
+
<Pagination page={@state.page} total={@state.records.length} setPage={@setPage} length={@props.length} />
|
67
71
|
</div>
|
68
72
|
<div className="table-responsive">
|
69
73
|
<table className="table table-bordered table-hover">
|
@@ -76,7 +80,7 @@ Component.create "Index.Container",
|
|
76
80
|
</tr>
|
77
81
|
</thead>
|
78
82
|
<tbody>
|
79
|
-
{for record, i in @state.
|
83
|
+
{for record, i in @state.currentRecords
|
80
84
|
<tr key={i}>
|
81
85
|
{for field, j in @model.columns
|
82
86
|
<td key={j}>{field.value?(record) ? record[field.name]}</td>
|
@@ -87,6 +91,10 @@ Component.create "Index.Container",
|
|
87
91
|
</tbody>
|
88
92
|
</table>
|
89
93
|
</div>
|
94
|
+
<div className="panel-footer">
|
95
|
+
<Pagination page={@state.page} total={@state.records.length} setPage={@setPage} length={@props.length} />
|
96
|
+
<div className="clearfix" />
|
97
|
+
</div>
|
90
98
|
</div>
|
91
99
|
</div>
|
92
100
|
</div>
|
@@ -1,29 +1,29 @@
|
|
1
1
|
Component.create "Pagination",
|
2
2
|
setPage: (page, e) ->
|
3
3
|
e.preventDefault()
|
4
|
-
@props.setPage(page)
|
4
|
+
@props.setPage(page) if page
|
5
5
|
false
|
6
6
|
render: ->
|
7
7
|
first = 1
|
8
8
|
prev = @props.page - 1
|
9
9
|
next = @props.page + 1
|
10
|
-
last = Math.ceil(@props.total /
|
10
|
+
last = Math.ceil(@props.total / @props.length)
|
11
11
|
prevDisabled = first > prev
|
12
12
|
nextDisabled = next > last
|
13
13
|
<ul className="pagination">
|
14
|
-
<li className="pagination-first#{' disabled'
|
15
|
-
<a href="#" onClick={@setPage.bind(null, first)} className="fa fa-angle-double-left" />
|
14
|
+
<li className="pagination-first#{prevDisabled && ' disabled'}">
|
15
|
+
<a href="#" onClick={@setPage.bind(null, !prevDisabled && first)} className="fa fa-angle-double-left" />
|
16
16
|
</li>
|
17
|
-
<li className="pagination-prev#{' disabled'
|
18
|
-
<a href="#" onClick={@setPage.bind(null, prev)} className="fa fa-angle-left" />
|
17
|
+
<li className="pagination-prev#{prevDisabled && ' disabled'}">
|
18
|
+
<a href="#" onClick={@setPage.bind(null, !prevDisabled && prev)} className="fa fa-angle-left" />
|
19
19
|
</li>
|
20
20
|
<li className="pagination-link active">
|
21
21
|
<a href="#" onClick={@setPage.bind(null, @props.page)}>{@props.page}</a>
|
22
22
|
</li>
|
23
|
-
<li className="pagination-next#{' disabled'
|
24
|
-
<a href="#" onClick={@setPage.bind(null, next)} className="fa fa-angle-right" />
|
23
|
+
<li className="pagination-next#{nextDisabled && ' disabled'}">
|
24
|
+
<a href="#" onClick={@setPage.bind(null, !nextDisabled && next)} className="fa fa-angle-right" />
|
25
25
|
</li>
|
26
|
-
<li className="pagination-last#{' disabled'
|
27
|
-
<a href="#" onClick={@setPage.bind(null,
|
26
|
+
<li className="pagination-last#{nextDisabled && ' disabled'}">
|
27
|
+
<a href="#" onClick={@setPage.bind(null, !nextDisabled && last)} className="fa fa-angle-double-right" />
|
28
28
|
</li>
|
29
29
|
</ul>
|
@@ -23,7 +23,7 @@ Component.create "Public.Subscription",
|
|
23
23
|
{if @state.subscription.active
|
24
24
|
<div>
|
25
25
|
<p>
|
26
|
-
<strong>{@state.subscription.email}</strong> will
|
26
|
+
<strong>{@state.subscription.email}</strong> will no longer recieve the majority of emails from {setting "name"}.
|
27
27
|
</p>
|
28
28
|
<a href="#" onClick={@destroy} className="btn btn-danger" data-confirm="Are you sure?">Unsubscribe</a>
|
29
29
|
</div>
|
@@ -32,7 +32,7 @@
|
|
32
32
|
throw "Component: Invalid Store (#{value})" unless store?
|
33
33
|
setupModels: ->
|
34
34
|
@models = @convertToHash(@followModels?() || @followModels || [])
|
35
|
-
for key, value of @models when not (value instanceof
|
35
|
+
for key, value of @models when not (value instanceof Model)
|
36
36
|
delete @models[key]
|
37
37
|
store = @stores[key.camelize] = @store.findOrCreate value, []
|
38
38
|
model = @models[key.camelize] = Model.findOrCreate(value)
|
data/lib/tomify/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tomify
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tom Prats
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-08-
|
11
|
+
date: 2017-08-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|