lanes 0.6.0 → 0.6.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/client/lanes/components/shared/AssetsListing.cjsx +17 -0
- data/client/lanes/components/shared/FieldSet.cjsx +7 -5
- data/client/lanes/components/shared/ImageAsset.cjsx +6 -9
- data/client/lanes/components/shared/image-asset.scss +15 -0
- data/client/lanes/lib/utilFunctions.coffee +8 -4
- data/client/lanes/models/Asset.coffee +5 -4
- data/client/lanes/models/AssociationMap.coffee +3 -2
- data/client/lanes/models/AssociationProxy.coffee +3 -0
- data/client/lanes/models/PubSub.coffee +1 -2
- data/client/lanes/screens/SystemSettings.cjsx +2 -1
- data/lib/lanes/api/default_routes.rb +10 -9
- data/lib/lanes/api/handlers/asset.rb +9 -1
- data/lib/lanes/api/pub_sub.rb +6 -2
- data/lib/lanes/api/root.rb +1 -1
- data/lib/lanes/api.rb +0 -3
- data/lib/lanes/asset.rb +0 -25
- data/lib/lanes/configuration.rb +1 -1
- data/lib/lanes/job.rb +6 -1
- data/lib/lanes/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 61899d6310319e01eeb5f8d3143de6381d59ef22
|
4
|
+
data.tar.gz: 7684de7e8724e81d9bb3a294dc995d3f74a7a8e5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6037b22dcff009ca206df7145b6058bd8b0e4403e0459f1ce0367afc63a94db7cdd700d225d9cd1c29d86e065392bb087927e71b0f9d039a5c023a14d52b031e
|
7
|
+
data.tar.gz: b227ee2a57df19679fff4767d23734ff4fff44cb92d98494ec1f75c97669793356a6b4610470de0885dba064d91a455ec93e8b0eeac092493ebe50331f67779c
|
@@ -0,0 +1,17 @@
|
|
1
|
+
class Lanes.Components.AssetsListing extends Lanes.React.Component
|
2
|
+
|
3
|
+
propTypes:
|
4
|
+
assets: Lanes.PropTypes.Collection.isRequired
|
5
|
+
size: React.PropTypes.oneOf([
|
6
|
+
'thumb', 'medium', 'original'
|
7
|
+
]).isRequired
|
8
|
+
|
9
|
+
modelBindings:
|
10
|
+
assets: 'props'
|
11
|
+
|
12
|
+
render: ->
|
13
|
+
<div className="assets-listing">
|
14
|
+
{@assets.map (asset) ->
|
15
|
+
<LC.ImageAsset key={asset.cid}
|
16
|
+
asset={asset} size="thumb" />}
|
17
|
+
</div>
|
@@ -1,11 +1,12 @@
|
|
1
1
|
class Lanes.Components.FieldSet extends Lanes.React.Component
|
2
2
|
|
3
|
-
getDefaultProps: ->
|
4
|
-
expanded: true
|
5
|
-
|
6
3
|
propTypes:
|
7
4
|
title: React.PropTypes.string.isRequired
|
8
5
|
expanded: React.PropTypes.bool
|
6
|
+
containerClassName: React.PropTypes.string
|
7
|
+
|
8
|
+
getDefaultProps: ->
|
9
|
+
expanded: true
|
9
10
|
|
10
11
|
getInitialState: ->
|
11
12
|
expanded: @props.expanded
|
@@ -17,7 +18,8 @@ class Lanes.Components.FieldSet extends Lanes.React.Component
|
|
17
18
|
@setState(expanded: not @state.expanded)
|
18
19
|
|
19
20
|
render: ->
|
20
|
-
colProps = _.omit(@props, 'name', 'expanded')
|
21
|
+
colProps = _.omit(@props, 'name', 'expanded', 'bodyClassName')
|
22
|
+
bodyClassName = _.classnames("container", @props.containerClassName)
|
21
23
|
<BS.Col {...colProps}>
|
22
24
|
<fieldset className={
|
23
25
|
_.classnames("collapsible", @props.className, @state.icon
|
@@ -27,7 +29,7 @@ class Lanes.Components.FieldSet extends Lanes.React.Component
|
|
27
29
|
{@props.title}
|
28
30
|
</legend>
|
29
31
|
<BS.Collapse in={@state.expanded}>
|
30
|
-
<div ref="body" className=
|
32
|
+
<div ref="body" className={bodyClassName} >
|
31
33
|
{@props.children}
|
32
34
|
</div>
|
33
35
|
</BS.Collapse>
|
@@ -1,14 +1,13 @@
|
|
1
1
|
class Lanes.Components.ImageAsset extends Lanes.React.Component
|
2
2
|
|
3
3
|
propTypes:
|
4
|
-
|
5
|
-
name: React.PropTypes.string.isRequired
|
4
|
+
asset: Lanes.PropTypes.Model.isRequired
|
6
5
|
size: React.PropTypes.oneOf([
|
7
6
|
'thumb', 'medium', 'original'
|
8
7
|
]).isRequired
|
9
8
|
|
10
9
|
modelBindings:
|
11
|
-
asset:
|
10
|
+
asset: 'props'
|
12
11
|
|
13
12
|
listenNetworkEvents: true
|
14
13
|
|
@@ -30,20 +29,18 @@ class Lanes.Components.ImageAsset extends Lanes.React.Component
|
|
30
29
|
className = _.classnames('image-asset', @props.className, {
|
31
30
|
'with-image': @asset.hasImage
|
32
31
|
})
|
33
|
-
|
34
|
-
|
35
|
-
{...@props}
|
32
|
+
<BS.Col
|
33
|
+
{...Lanes.u.bsSizes(@props)}
|
36
34
|
className={className}
|
37
|
-
displayComponent={Component}
|
38
35
|
>
|
39
36
|
<Component />
|
40
37
|
<form>
|
41
38
|
<label className="selector">
|
42
39
|
<span>
|
43
|
-
{if @asset.
|
40
|
+
{if @asset.isPresent then 'Change' else 'Add'}
|
44
41
|
</span>
|
45
42
|
<input id='file' className="file" type="file"
|
46
43
|
onChange={@handleImageChange} />
|
47
44
|
</label>
|
48
45
|
</form>
|
49
|
-
</
|
46
|
+
</BS.Col>
|
@@ -1,6 +1,7 @@
|
|
1
1
|
@import "../../styles/bootstrap/buttons";
|
2
2
|
|
3
3
|
.image-asset {
|
4
|
+
position: relative;
|
4
5
|
&.field {
|
5
6
|
.value {
|
6
7
|
border-bottom: 0;
|
@@ -36,3 +37,17 @@
|
|
36
37
|
width: 100%;
|
37
38
|
}
|
38
39
|
}
|
40
|
+
|
41
|
+
.assets-listing {
|
42
|
+
|
43
|
+
display: flex;
|
44
|
+
|
45
|
+
.image-asset {
|
46
|
+
max-width: 200px;
|
47
|
+
& + .image-asset {
|
48
|
+
border-left: 1px dotted lightgrey;
|
49
|
+
padding-left: 10px;
|
50
|
+
margin-left: 10px;
|
51
|
+
}
|
52
|
+
}
|
53
|
+
}
|
@@ -16,10 +16,14 @@ distillTypes = (type, ns) ->
|
|
16
16
|
|
17
17
|
Lanes.u = {
|
18
18
|
cleanBsSizes: (props) ->
|
19
|
-
_.omit(props,
|
20
|
-
|
21
|
-
|
22
|
-
)
|
19
|
+
_.omit(props, @getBsSizeProps() )
|
20
|
+
|
21
|
+
bsSizes: (props) ->
|
22
|
+
_.pick(props, @getBsSizeProps())
|
23
|
+
|
24
|
+
getBsSizeProps: ->
|
25
|
+
[ 'xs', 'sm', 'md', 'lg',
|
26
|
+
'xsOffset', 'smOffset', 'mdOffset', 'lgOffset' ]
|
23
27
|
|
24
28
|
makeComparatorUsing: (method) ->
|
25
29
|
(a, b) -> Lanes.u.comparator(a[method], b[method])
|
@@ -31,6 +31,10 @@ class Lanes.Models.Asset extends Lanes.Models.Base
|
|
31
31
|
deps: ['data', 'file_data'], fn: ->
|
32
32
|
if @data then @data else @urlFor('thumbnail')
|
33
33
|
|
34
|
+
isPresent:
|
35
|
+
deps: ['data', 'file_data'], fn: ->
|
36
|
+
@data || !_.isEmpty(@file_data)
|
37
|
+
|
34
38
|
hasImage:
|
35
39
|
deps: ['data', 'file_data'], fn: ->
|
36
40
|
(@data && IS_IMAGE(@metadata.content_type)) ||
|
@@ -55,14 +59,11 @@ class Lanes.Models.Asset extends Lanes.Models.Base
|
|
55
59
|
|
56
60
|
onBlobChange: ->
|
57
61
|
if @blob
|
58
|
-
@metadata = {
|
59
|
-
content_type: @blob.type
|
60
|
-
}
|
62
|
+
@metadata = { content_type: @blob.type }
|
61
63
|
reader = new FileReader()
|
62
64
|
reader.onloadend = (ev) =>
|
63
65
|
@data = reader.result if ev.type is 'loadend'
|
64
66
|
reader.readAsDataURL(@blob)
|
65
|
-
|
66
67
|
else
|
67
68
|
@data = null
|
68
69
|
@mdatadata?.content_type = undefined
|
@@ -80,8 +80,9 @@ class Lanes.Models.AssociationMap
|
|
80
80
|
new target_class(options.models || [], options)
|
81
81
|
else
|
82
82
|
options.model = target_class
|
83
|
-
options.association_name=name
|
84
|
-
|
83
|
+
options.association_name = name
|
84
|
+
klass = options.collectionClass or Lanes.Models.AssociationCollection
|
85
|
+
new klass(options.models || [], options)
|
85
86
|
|
86
87
|
# returns a collection for the given association.
|
87
88
|
collectionFor: (name, model, options = {}) ->
|
@@ -62,12 +62,15 @@ ProxyMethods = {
|
|
62
62
|
|
63
63
|
on: (ev, rest...) ->
|
64
64
|
rememberEvents( @_proxied_events ||= {}, ev, rest )
|
65
|
+
@
|
65
66
|
|
66
67
|
once: (ev, rest...) ->
|
67
68
|
rememberEvents( @_proxied_once_events ||= {}, ev, rest )
|
69
|
+
@
|
68
70
|
|
69
71
|
off: (ev, rest...) ->
|
70
72
|
delete @_proxied_events[ev]
|
73
|
+
@
|
71
74
|
|
72
75
|
}
|
73
76
|
|
@@ -81,9 +81,8 @@ CableChannel = {
|
|
81
81
|
@perform("off", {channel})
|
82
82
|
|
83
83
|
received: (data) ->
|
84
|
-
[channel, model, id] = data.channel.match(/(.*)\/(
|
84
|
+
[channel, model, id] = data.channel.match(/(.*)\/([^\/]+)/)
|
85
85
|
Lanes.log.info "[pubsub] change recvd for: #{channel}"
|
86
|
-
|
87
86
|
Lanes.Models.PubSub.onChange(
|
88
87
|
model, id, _.omit(data, 'channel')
|
89
88
|
)
|
@@ -55,7 +55,8 @@ class Lanes.Screens.SystemSettings extends Lanes.React.Screen
|
|
55
55
|
</BS.NavItem>
|
56
56
|
</BS.Nav>
|
57
57
|
<BS.Row>
|
58
|
-
|
58
|
+
|
59
|
+
<LC.ImageAsset sm=4 asset={@config.logo}
|
59
60
|
label='Logo' size='thumb' />
|
60
61
|
</BS.Row>
|
61
62
|
{for id, Ext of Lanes.Extensions.instances when Ext.getSettingsElement
|
@@ -1,5 +1,15 @@
|
|
1
|
+
require_relative "handlers/asset.rb"
|
2
|
+
|
1
3
|
module Lanes
|
2
4
|
API.routes.draw do
|
5
|
+
# WS endpoint must come first
|
6
|
+
get Lanes.config.api_path + '/ws' do
|
7
|
+
API::Cable.server.call(env)
|
8
|
+
end
|
9
|
+
|
10
|
+
Extensions.each(reversed: true) do | ext |
|
11
|
+
ext.route(self)
|
12
|
+
end
|
3
13
|
|
4
14
|
put Lanes.config.api_path + '/system-settings.json',
|
5
15
|
&SystemSettings.update_handler
|
@@ -10,18 +20,9 @@ module Lanes
|
|
10
20
|
get Lanes.config.api_path + '/asset/*',
|
11
21
|
&API::Handlers::Asset.getter
|
12
22
|
|
13
|
-
get Lanes.config.api_path + '/ws' do
|
14
|
-
API::Cable.server.call(env)
|
15
|
-
end
|
16
|
-
|
17
23
|
post Lanes.config.api_path + '/dev-file-change.json' do
|
18
24
|
API::PubSub.publish("file-change", data)
|
19
25
|
"OK"
|
20
26
|
end
|
21
|
-
|
22
|
-
Extensions.each(reversed: true) do | ext |
|
23
|
-
ext.route(self)
|
24
|
-
end
|
25
|
-
|
26
27
|
end
|
27
28
|
end
|
@@ -4,6 +4,7 @@ module Lanes::API::Handlers
|
|
4
4
|
|
5
5
|
def self.saver
|
6
6
|
lambda do
|
7
|
+
|
7
8
|
path = "#{params['extension_id']}/#{params['owner_type']}"
|
8
9
|
model = path.underscore.camelize.constantize
|
9
10
|
|
@@ -13,7 +14,14 @@ module Lanes::API::Handlers
|
|
13
14
|
asset = if params['id']
|
14
15
|
::Lanes::Asset.find(params['id'])
|
15
16
|
else
|
16
|
-
owner.
|
17
|
+
assoc = owner.class.reflections[
|
18
|
+
params['owner_association']
|
19
|
+
]
|
20
|
+
if assoc.collection?
|
21
|
+
owner.send(params['owner_association']).build
|
22
|
+
else
|
23
|
+
owner.send("build_#{params['owner_association']}")
|
24
|
+
end
|
17
25
|
end
|
18
26
|
|
19
27
|
asset.update(file: params['file'])
|
data/lib/lanes/api/pub_sub.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
require_relative 'cable'
|
2
|
+
|
1
3
|
module Lanes
|
2
4
|
module API
|
3
5
|
|
@@ -16,8 +18,10 @@ module Lanes
|
|
16
18
|
end
|
17
19
|
|
18
20
|
def self.publish(channel, data)
|
19
|
-
ActionCable.server.broadcast
|
20
|
-
|
21
|
+
ActionCable.server.broadcast(
|
22
|
+
PREFIX + channel,
|
23
|
+
data.merge(channel: channel)
|
24
|
+
)
|
21
25
|
end
|
22
26
|
|
23
27
|
end
|
data/lib/lanes/api/root.rb
CHANGED
@@ -33,11 +33,11 @@ module Lanes
|
|
33
33
|
set :show_exceptions, false
|
34
34
|
require_relative 'routing'
|
35
35
|
Extensions.load_controlling_config
|
36
|
-
Cable.configure
|
37
36
|
# late load in case an extension has provided an alternative implementation
|
38
37
|
unless API.const_defined?(:AuthenticationProvider)
|
39
38
|
require "lanes/api/null_authentication_provider"
|
40
39
|
end
|
40
|
+
require_relative './default_routes'
|
41
41
|
Lanes::Configuration.apply
|
42
42
|
end
|
43
43
|
|
data/lib/lanes/api.rb
CHANGED
data/lib/lanes/asset.rb
CHANGED
@@ -8,31 +8,6 @@ module Lanes
|
|
8
8
|
|
9
9
|
validates :owner, set: true
|
10
10
|
|
11
|
-
# after_update :remove_changed_file, if: lambda{ file_changed? }
|
12
|
-
|
13
|
-
# def serializable_hash(options = nil)
|
14
|
-
# values = super
|
15
|
-
# values.delete('file')
|
16
|
-
# values.merge!(file.as_json[:file].stringify_keys)
|
17
|
-
# values['original'] = { 'url' => values.delete('url') }
|
18
|
-
# values
|
19
|
-
# end
|
20
|
-
|
21
|
-
# def store_uploaded_file(f)
|
22
|
-
# ext = File.extname(f[:filename])
|
23
|
-
# if ext.blank?
|
24
|
-
# ext = '.' + FastImage.type(f[:tempfile]).to_s
|
25
|
-
# end
|
26
|
-
# self[:file] = ::Lanes::Strings.random + ext
|
27
|
-
# file.store!(f)
|
28
|
-
# end
|
29
|
-
|
30
|
-
# protected
|
31
|
-
|
32
|
-
# def remove_changed_file
|
33
|
-
# self.file_was.remove!
|
34
|
-
# end
|
35
|
-
|
36
11
|
end
|
37
12
|
|
38
13
|
end
|
data/lib/lanes/configuration.rb
CHANGED
data/lib/lanes/job.rb
CHANGED
@@ -1,4 +1,6 @@
|
|
1
1
|
require 'jobba'
|
2
|
+
require_relative 'api/pub_sub'
|
3
|
+
|
2
4
|
|
3
5
|
module Jobba
|
4
6
|
module RecordStatus
|
@@ -36,7 +38,10 @@ module Lanes
|
|
36
38
|
}
|
37
39
|
|
38
40
|
def deliver_progress_to_clients
|
39
|
-
API::PubSub.publish(
|
41
|
+
::Lanes::API::PubSub.publish(
|
42
|
+
"/lanes/job-statuses/#{job_id}",
|
43
|
+
update: Job.status_for_id(job_id)
|
44
|
+
)
|
40
45
|
end
|
41
46
|
|
42
47
|
def save_progress(output, progress=1.0)
|
data/lib/lanes/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lanes
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nathan Stitt
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-11-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activejob
|
@@ -640,6 +640,7 @@ files:
|
|
640
640
|
- client/lanes/components/select-field/SelectField.cjsx
|
641
641
|
- client/lanes/components/select-field/index.js
|
642
642
|
- client/lanes/components/select-field/styles.scss
|
643
|
+
- client/lanes/components/shared/AssetsListing.cjsx
|
643
644
|
- client/lanes/components/shared/Checkbox.cjsx
|
644
645
|
- client/lanes/components/shared/CountBadge.cjsx
|
645
646
|
- client/lanes/components/shared/DateTime.cjsx
|