lanes 0.5.6 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +6 -2
- data/client/lanes/Config.coffee +6 -5
- data/client/lanes/access/LoginDialog.cjsx +4 -2
- data/client/lanes/access/Roles.coffee +3 -0
- data/client/lanes/access/screens/user-management/Editor.cjsx +1 -1
- data/client/lanes/components/grid/Body.cjsx +4 -3
- data/client/lanes/components/grid/Grid.cjsx +4 -3
- data/client/lanes/components/grid/Header.cjsx +1 -1
- data/client/lanes/components/grid/PopOverMixin.cjsx +6 -6
- data/client/lanes/components/grid/Selections.cjsx +16 -6
- data/client/lanes/components/grid/Toolbar.cjsx +1 -1
- data/client/lanes/components/grid/styles.scss +21 -5
- data/client/lanes/components/modal/Modal.cjsx +18 -9
- data/client/lanes/components/record-finder/Clause.cjsx +1 -2
- data/client/lanes/components/record-finder/Dialog.cjsx +11 -3
- data/client/lanes/components/record-finder/RecordFinder.cjsx +14 -7
- data/client/lanes/components/record-finder/styles.scss +1 -0
- data/client/lanes/components/select-field/SelectField.cjsx +36 -10
- data/client/lanes/components/select-field/styles.scss +7 -0
- data/client/lanes/components/shared/Checkbox.cjsx +34 -0
- data/client/lanes/components/shared/DateTime.cjsx +3 -2
- data/client/lanes/components/shared/ErrorDisplay.cjsx +1 -1
- data/client/lanes/components/shared/FieldMixin.cjsx +26 -15
- data/client/lanes/components/shared/FieldSet.cjsx +1 -1
- data/client/lanes/components/shared/FieldWrapper.cjsx +2 -2
- data/client/lanes/components/shared/FormGroup.cjsx +2 -2
- data/client/lanes/components/shared/Icon.cjsx +31 -4
- data/client/lanes/components/shared/IconButton.cjsx +8 -0
- data/client/lanes/components/shared/ImageAsset.cjsx +8 -5
- data/client/lanes/components/shared/IndeterminateCheckbox.cjsx +19 -0
- data/client/lanes/components/shared/InputFieldMixin.cjsx +6 -0
- data/client/lanes/components/shared/JobProgress.cjsx +4 -3
- data/client/lanes/components/shared/NetworkActivityOverlay.cjsx +1 -1
- data/client/lanes/components/shared/ScreenWrapper.cjsx +1 -1
- data/client/lanes/components/shared/ToggleField.cjsx +2 -1
- data/client/lanes/components/shared/Tooltip.cjsx +10 -2
- data/client/lanes/components/shared/fields.scss +7 -2
- data/client/lanes/components/toolbar/RemoteChangeSets.cjsx +10 -7
- data/client/lanes/components/toolbar/SaveButton.cjsx +5 -4
- data/client/lanes/components/toolbar/Toolbar.cjsx +18 -19
- data/client/lanes/components/toolbar/changes-notification.scss +3 -1
- data/client/lanes/components/toolbar/styles.scss +6 -3
- data/client/lanes/lib/HotReload.coffee +1 -1
- data/client/lanes/lib/all.js +1 -1
- data/client/lanes/lib/dom.coffee +14 -1
- data/client/lanes/lib/format.coffee +3 -0
- data/client/lanes/lib/loader.coffee +0 -2
- data/client/lanes/lib/{dom-polyfills.coffee → polyfills.coffee} +3 -0
- data/client/lanes/lib/utilFunctions.coffee +5 -7
- data/client/lanes/models/Asset.coffee +33 -20
- data/client/lanes/models/AssociationMap.coffee +5 -6
- data/client/lanes/models/Base.coffee +5 -2
- data/client/lanes/models/Collection.coffee +23 -2
- data/client/lanes/models/PubSub.coffee +51 -13
- data/client/lanes/models/Query.coffee +53 -42
- data/client/lanes/models/State.coffee +5 -4
- data/client/lanes/models/Sync.coffee +5 -3
- data/client/lanes/models/index.js +1 -1
- data/client/lanes/models/mixins/TrackCollectionRemovals.coffee +17 -0
- data/client/lanes/models/query/ArrayResult.coffee +16 -17
- data/client/lanes/models/query/CollectionResult.coffee +4 -4
- data/client/lanes/react/Component.coffee +14 -13
- data/client/lanes/react/Root.cjsx +1 -1
- data/client/lanes/react/Screen.coffee +1 -0
- data/client/lanes/react/Viewport.coffee +52 -16
- data/client/lanes/react/mixins/Access.coffee +5 -0
- data/client/lanes/react/mixins/Data.coffee +52 -144
- data/client/lanes/react/mixins/MonitorSize.coffee +1 -1
- data/client/lanes/react/mixins/ReadEditingState.coffee +3 -0
- data/client/lanes/screens/Commands.coffee +1 -1
- data/client/lanes/screens/CommonComponents.cjsx +2 -2
- data/client/lanes/screens/Definitions.coffee +3 -1
- data/client/lanes/screens/SystemSettings.cjsx +13 -18
- data/client/lanes/screens/UserPreferences.cjsx +1 -1
- data/client/lanes/styles/fonts.scss +2 -3
- data/client/lanes/styles/global/styles.scss +2 -1
- data/client/lanes/testing/TestObjects.coffee +6 -2
- data/client/lanes/vendor/action_cable.js +590 -0
- data/client/lanes/vendor/development/calendar.js +56 -56
- data/client/lanes/vendor/development/commons.js +7819 -6690
- data/client/lanes/vendor/development/data.js +1877 -1455
- data/client/lanes/vendor/development/helpers.js +39 -82
- data/client/lanes/vendor/development/toggle.js +20 -20
- data/client/lanes/vendor/development/ui.js +14629 -14261
- data/client/lanes/vendor/development/widgets.js +3146 -2173
- data/client/lanes/vendor/index.js +1 -2
- data/client/lanes/vendor/production/calendar.js +56 -56
- data/client/lanes/vendor/production/commons.js +6352 -6185
- data/client/lanes/vendor/production/data.js +1871 -1456
- data/client/lanes/vendor/production/toggle.js +20 -20
- data/client/lanes/vendor/production/ui.js +14694 -14286
- data/client/lanes/vendor/production/widgets.js +3139 -2166
- data/client/lanes/vendor/standalone/index.js +5666 -4586
- data/client/lanes/vendor/styles/widgets.scss +5 -5
- data/client/lanes/workspace/Layout.cjsx +1 -10
- data/client/lanes/workspace/Navbar.cjsx +8 -13
- data/client/lanes/workspace/ScreenView.cjsx +3 -4
- data/client/lanes/workspace/ScreensMenu.cjsx +8 -19
- data/client/lanes/workspace/Tabs.cjsx +6 -14
- data/db/migrate/02_create_assets.rb +1 -3
- data/lanes.gemspec +16 -11
- data/lib/lanes/access/test_fixture_extensions.rb +6 -10
- data/lib/lanes/access/track_modifications.rb +24 -0
- data/lib/lanes/api/cable.rb +49 -0
- data/lib/lanes/api/controller_base.rb +52 -9
- data/lib/lanes/api/default_routes.rb +9 -0
- data/lib/lanes/api/generic_controller.rb +2 -9
- data/lib/lanes/api/handlers/asset.rb +5 -6
- data/lib/lanes/api/helper_methods.rb +3 -2
- data/lib/lanes/api/javascript_processor.rb +6 -5
- data/lib/lanes/api/pub_sub.rb +14 -32
- data/lib/lanes/api/request_wrapper.rb +1 -1
- data/lib/lanes/api/root.rb +4 -7
- data/lib/lanes/api/routing.rb +3 -3
- data/lib/lanes/api/sprockets_extension.rb +1 -1
- data/lib/lanes/api.rb +4 -0
- data/lib/lanes/asset.rb +25 -25
- data/lib/lanes/concerns/asset_uploader.rb +25 -47
- data/lib/lanes/concerns/export_scope.rb +5 -7
- data/lib/lanes/concerns/queries.rb +7 -3
- data/lib/lanes/concerns/set_attribute_data.rb +12 -6
- data/lib/lanes/configuration.rb +4 -7
- data/lib/lanes/db.rb +3 -1
- data/lib/lanes/guard_tasks.rb +2 -1
- data/lib/lanes/hot_reload_plugin.rb +2 -1
- data/lib/lanes/job.rb +0 -1
- data/lib/lanes/logger.rb +3 -3
- data/lib/lanes/model.rb +0 -3
- data/lib/lanes/spec_helper.rb +1 -1
- data/lib/lanes/system_settings.rb +8 -14
- data/lib/lanes/version.rb +1 -1
- data/npm-build/data.js +1 -0
- data/npm-build/package.json +21 -19
- data/npm-build/ui.js +3 -0
- data/npm-build/update-dayz +2 -2
- data/npm-build/update-model-bindings.js +5 -0
- data/spec/command-reference-files/initial/Gemfile +1 -1
- data/spec/command-reference-files/initial/config/database.yml +1 -0
- data/spec/command-reference-files/initial/config/lanes.rb +3 -3
- data/spec/command-reference-files/screen/spec/appy-app/screens/ready-set-go/ReadySetGoSpec.coffee +1 -1
- data/spec/lanes/components/grid/GridSpec.coffee +2 -2
- data/spec/lanes/components/grid/PopoverEditorSpec.coffee +11 -12
- data/spec/lanes/components/select-field/SelectFieldSpec.coffee +6 -4
- data/spec/lanes/components/shared/NetworkActivityOverlaySpec.coffee +1 -1
- data/spec/lanes/models/PubSubSpec.coffee +6 -8
- data/spec/lanes/models/QuerySpec.coffee +19 -0
- data/spec/lanes/react/mixins/DataSpec.coffee +18 -16
- data/spec/server/api/coffeescript_processor_spec.rb +1 -1
- data/spec/server/api/controller_base_spec.rb +77 -0
- data/spec/server/api/pub_sub_spec.rb +9 -0
- data/spec/server/asset_spec.rb +23 -18
- data/spec/server/concerns/export_scope_spec.rb +2 -1
- data/spec/server/concerns/exported_limits_spec.rb +14 -9
- data/spec/server/concerns/set_attribute_data_spec.rb +17 -0
- data/spec/server/spec_helper.rb +29 -11
- data/templates/config/database.yml +1 -0
- data/templates/spec/client/Screen.coffee +1 -1
- data/views/specs.erb +4 -1
- metadata +138 -89
- data/client/lanes/vendor/message-bus-ajax.js +0 -44
- data/client/lanes/vendor/message-bus.js +0 -414
data/lib/lanes/api/pub_sub.rb
CHANGED
@@ -1,41 +1,23 @@
|
|
1
|
-
require 'message_bus'
|
2
|
-
|
3
1
|
module Lanes
|
4
2
|
module API
|
5
3
|
|
6
|
-
class PubSub
|
7
|
-
|
8
|
-
def
|
9
|
-
|
10
|
-
|
4
|
+
class PubSub < Cable::Channel
|
5
|
+
PREFIX = 'ps:'
|
6
|
+
def on(data)
|
7
|
+
channel = PREFIX + data['channel']
|
8
|
+
stream_from channel
|
11
9
|
end
|
12
10
|
|
13
|
-
def
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
require "oj"
|
20
|
-
require_relative "updates"
|
21
|
-
require 'message_bus'
|
22
|
-
api.use MessageBus::Rack::Middleware if api
|
23
|
-
|
24
|
-
if defined?(::PhusionPassenger)
|
25
|
-
PhusionPassenger.on_event(:starting_worker_process) do |forked|
|
26
|
-
MessageBus.after_fork if forked
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
Updates.relay!
|
31
|
-
|
32
|
-
::Lanes::API.routes.draw do
|
33
|
-
post '/file-change.json' do
|
34
|
-
::Lanes::API::PubSub.publish("/file-change", data)
|
35
|
-
"OK"
|
36
|
-
end
|
37
|
-
end
|
11
|
+
def off(data)
|
12
|
+
channel = PREFIX + data['channel']
|
13
|
+
cb = pubsub.instance_variable_get('@listener')
|
14
|
+
.instance_variable_get('@subscribers')[channel].first
|
15
|
+
pubsub.unsubscribe(channel, cb)
|
16
|
+
end
|
38
17
|
|
18
|
+
def self.publish(channel, data)
|
19
|
+
ActionCable.server.broadcast PREFIX + channel,
|
20
|
+
data.merge(channel: channel)
|
39
21
|
end
|
40
22
|
|
41
23
|
end
|
@@ -77,7 +77,7 @@ module Lanes
|
|
77
77
|
log_request
|
78
78
|
if options[:with_transaction]
|
79
79
|
Lanes::Model.transaction do
|
80
|
-
response = yield
|
80
|
+
response = yield || {success: false}
|
81
81
|
# This is quite possibly a horrible idea.
|
82
82
|
# It enables test specs to reset the db state after a request
|
83
83
|
if !Lanes.env.production? && request.env['HTTP_X_ROLLBACK_AFTER_REQUEST']
|
data/lib/lanes/api/root.rb
CHANGED
@@ -2,9 +2,6 @@ require 'sinatra'
|
|
2
2
|
require 'oj'
|
3
3
|
require 'rack/protection'
|
4
4
|
require 'rack/cors'
|
5
|
-
require_relative 'sprockets_extension'
|
6
|
-
require_relative 'helper_methods'
|
7
|
-
require_relative 'pub_sub'
|
8
5
|
|
9
6
|
module Lanes
|
10
7
|
module API
|
@@ -18,8 +15,9 @@ module Lanes
|
|
18
15
|
helpers RequestWrapper
|
19
16
|
helpers HelperMethods
|
20
17
|
helpers FormattedReply
|
21
|
-
use Rack::Session::Cookie,
|
22
|
-
|
18
|
+
use Rack::Session::Cookie,
|
19
|
+
:key => 'lanes.session',
|
20
|
+
:secret => Lanes.config.session_secret_key_base
|
23
21
|
not_found do
|
24
22
|
Oj.dump({ message: "endpoint not found", success: false })
|
25
23
|
end
|
@@ -34,9 +32,8 @@ module Lanes
|
|
34
32
|
set :views, Pathname.new(__FILE__).dirname.join("../../../views")
|
35
33
|
set :show_exceptions, false
|
36
34
|
require_relative 'routing'
|
37
|
-
|
38
|
-
PubSub.initialize(self)
|
39
35
|
Extensions.load_controlling_config
|
36
|
+
Cable.configure
|
40
37
|
# late load in case an extension has provided an alternative implementation
|
41
38
|
unless API.const_defined?(:AuthenticationProvider)
|
42
39
|
require "lanes/api/null_authentication_provider"
|
data/lib/lanes/api/routing.rb
CHANGED
@@ -22,8 +22,6 @@ module Lanes
|
|
22
22
|
end
|
23
23
|
|
24
24
|
def enable_cors(path_suffix, options = {origins: '*', methods: [:get]})
|
25
|
-
puts path_suffix
|
26
|
-
puts options
|
27
25
|
API::Root::CORS_PATHS[make_path(path_suffix)] = options
|
28
26
|
end
|
29
27
|
|
@@ -85,7 +83,9 @@ module Lanes
|
|
85
83
|
private
|
86
84
|
|
87
85
|
def make_path(path)
|
88
|
-
Lanes.config.api_path + '/' + @ext_id + '/' + path
|
86
|
+
path = Lanes.config.api_path + '/' + @ext_id + '/' + path
|
87
|
+
Lanes.logger.debug("[route]: #{path}")
|
88
|
+
path
|
89
89
|
end
|
90
90
|
end
|
91
91
|
|
@@ -85,7 +85,7 @@ module Lanes
|
|
85
85
|
app.configure :test, :development do
|
86
86
|
app.get "#{Lanes.config.assets_path_prefix}/*" do |path|
|
87
87
|
env_sprockets = request.env.dup
|
88
|
-
env_sprockets['PATH_INFO'] = path
|
88
|
+
env_sprockets['PATH_INFO'] = path.gsub(/\?\d+$/, '')
|
89
89
|
settings.sprockets.call env_sprockets
|
90
90
|
end
|
91
91
|
end
|
data/lib/lanes/api.rb
CHANGED
@@ -4,6 +4,10 @@ require_relative 'api/error_formatter'
|
|
4
4
|
require_relative 'api/formatted_reply'
|
5
5
|
require_relative 'api/controller_base'
|
6
6
|
require_relative 'api/generic_controller'
|
7
|
+
require_relative 'api/cable'
|
8
|
+
require_relative 'api/sprockets_extension'
|
9
|
+
require_relative 'api/helper_methods'
|
10
|
+
require_relative 'api/pub_sub'
|
7
11
|
require_relative 'api/root'
|
8
12
|
|
9
13
|
Lanes.config.get(:environment) do
|
data/lib/lanes/asset.rb
CHANGED
@@ -2,36 +2,36 @@ module Lanes
|
|
2
2
|
|
3
3
|
class Asset < Lanes::Model
|
4
4
|
|
5
|
-
|
5
|
+
include Lanes::Concerns::AssetUploader[:file]
|
6
6
|
|
7
7
|
belongs_to :owner, polymorphic: true
|
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
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
end
|
20
|
-
|
21
|
-
def store_uploaded_file(f)
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
end
|
29
|
-
|
30
|
-
protected
|
31
|
-
|
32
|
-
def remove_changed_file
|
33
|
-
|
34
|
-
end
|
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
35
|
|
36
36
|
end
|
37
37
|
|
@@ -1,58 +1,36 @@
|
|
1
|
-
require '
|
2
|
-
require '
|
3
|
-
require 'fastimage'
|
1
|
+
require 'shrine'
|
2
|
+
require 'image_processing/mini_magick'
|
4
3
|
|
5
4
|
module Lanes::Concerns
|
6
5
|
|
7
|
-
class AssetUploader <
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
end
|
16
|
-
|
17
|
-
version :thumbnail, :if => :image? do
|
18
|
-
process :resize_to_fit => [200,200]
|
19
|
-
end
|
20
|
-
|
21
|
-
def cache_dir
|
22
|
-
'/tmp'
|
23
|
-
end
|
24
|
-
|
25
|
-
def filename
|
26
|
-
if original_filename && model && model.read_attribute(mounted_as).present?
|
27
|
-
model.read_attribute(mounted_as)
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
def store_dir
|
32
|
-
token = secure_token
|
33
|
-
"#{token[0, 2]}/#{token[2, 2]}"
|
34
|
-
end
|
35
|
-
|
36
|
-
protected
|
37
|
-
|
38
|
-
def store_attributes
|
39
|
-
if file && model
|
40
|
-
model.metadata['size'] = file.size
|
41
|
-
model.metadata['content_type'] = file.content_type
|
42
|
-
if image?(file)
|
43
|
-
img = ::MiniMagick::Image.open(file.file)
|
44
|
-
model.metadata['width'] = img.width
|
45
|
-
model.metadata['height'] = img.height
|
6
|
+
class AssetUploader < Shrine
|
7
|
+
module LocationHash
|
8
|
+
module InstanceMethods
|
9
|
+
CHAR_CHOICES = [*('a'..'z'),*('0'..'9')]
|
10
|
+
def generate_location(io, context)
|
11
|
+
basename, _ = super.split("/")
|
12
|
+
path = Array.new(3){ CHAR_CHOICES.shuffle[0,4].join }
|
13
|
+
path.push(basename).join('/')
|
46
14
|
end
|
47
15
|
end
|
48
16
|
end
|
17
|
+
::Shrine::Plugins.register_plugin(:location_hash, LocationHash)
|
49
18
|
|
50
|
-
|
51
|
-
|
52
|
-
|
19
|
+
include ImageProcessing::MiniMagick
|
20
|
+
|
21
|
+
plugin :activerecord
|
22
|
+
plugin :rack_file
|
23
|
+
plugin :processing
|
24
|
+
plugin :store_dimensions
|
25
|
+
plugin :determine_mime_type
|
26
|
+
plugin :versions
|
27
|
+
plugin :location_hash
|
53
28
|
|
54
|
-
|
55
|
-
|
29
|
+
process(:store) do |io, context|
|
30
|
+
size_800 = resize_to_limit(io.download, 800, 800)
|
31
|
+
size_500 = resize_to_limit(size_800, 500, 500)
|
32
|
+
size_300 = resize_to_limit(size_500, 300, 300)
|
33
|
+
{original: size_800, medium: size_500, thumbnail: size_300}
|
56
34
|
end
|
57
35
|
|
58
36
|
end
|
@@ -20,12 +20,12 @@ module Lanes::Concerns
|
|
20
20
|
#
|
21
21
|
# * Safely escape data *(should __ALWAYS__ do this anyway, but it bears mentioning again)*
|
22
22
|
# * Be relatively simple and complete quickly.
|
23
|
-
# * Provide value to the client that it cannot obtain by using normal query
|
24
|
-
|
23
|
+
# * Provide value to the client that it cannot obtain by using normal query method
|
24
|
+
class_methods do
|
25
25
|
def scope(name, body, options = {}, &block)
|
26
26
|
super(name, body, &block)
|
27
27
|
if (export = options[:export])
|
28
|
-
export_scope(name,
|
28
|
+
export_scope(name, limit: (export == true ? nil : export[:limit]))
|
29
29
|
end
|
30
30
|
end
|
31
31
|
|
@@ -35,14 +35,12 @@ module Lanes::Concerns
|
|
35
35
|
# @param limit [Symbol referring to a Class method name, lambda]
|
36
36
|
# If given, this will be queried by the API to determining if a given user may call the scope
|
37
37
|
# @return nil
|
38
|
-
def export_scope(name,
|
38
|
+
def export_scope(name, limit: nil)
|
39
39
|
include ExportedLimitEvaluator
|
40
40
|
|
41
41
|
self.exported_scopes ||= Hash.new
|
42
42
|
self.exported_scopes[name.to_sym] = {
|
43
|
-
|
44
|
-
name: name,
|
45
|
-
limit: limit
|
43
|
+
name: name, limit: limit
|
46
44
|
}
|
47
45
|
nil
|
48
46
|
end
|
@@ -9,9 +9,13 @@ module Lanes
|
|
9
9
|
module ClassMethods
|
10
10
|
|
11
11
|
def compose_query_using_detail_view( view: nil, join_to: nil )
|
12
|
-
join_to
|
13
|
-
joins("join #{view} as details on details.#{join_to} = #{table_name}.#{primary_key}")
|
14
|
-
|
12
|
+
join_to ||= self.name.demodulize.tableize.singularize + '_' + primary_key
|
13
|
+
q = joins("join #{view} as details on details.#{join_to} = #{table_name}.#{primary_key}")
|
14
|
+
.select("details.*")
|
15
|
+
if current_scope.nil? || current_scope.select_values.exclude?("#{table_name}.*")
|
16
|
+
q = q.select("#{table_name}.*")
|
17
|
+
end
|
18
|
+
q
|
15
19
|
end
|
16
20
|
|
17
21
|
end
|
@@ -76,11 +76,10 @@ module Lanes::Concerns
|
|
76
76
|
# @param user [User] who is performing request
|
77
77
|
# @returns
|
78
78
|
def set_attribute_data(data, user)
|
79
|
-
|
80
79
|
return {} unless self.can_write_attributes?(data, user)
|
81
|
-
|
82
80
|
data.each_with_object(Hash.new) do | (key, value), result |
|
83
81
|
# First we set all the attributes that are allowed
|
82
|
+
|
84
83
|
if self.setting_attribute_is_allowed?(key.to_sym, user)
|
85
84
|
result[key] = value
|
86
85
|
public_send("#{key}=", value)
|
@@ -101,15 +100,22 @@ module Lanes::Concerns
|
|
101
100
|
end
|
102
101
|
end
|
103
102
|
|
104
|
-
def _set_attribute_data_from_collection(association, name,
|
105
|
-
records = public_send(name
|
106
|
-
|
103
|
+
def _set_attribute_data_from_collection(association, name, record_data, user)
|
104
|
+
records = public_send(name)
|
105
|
+
record_data.map do | association_data |
|
106
|
+
|
107
107
|
record = if association_data['id'].blank?
|
108
108
|
association.build
|
109
109
|
else
|
110
110
|
records.detect{ |r| r.id.to_s == association_data['id'].to_s }
|
111
111
|
end
|
112
|
-
|
112
|
+
next unless record
|
113
|
+
|
114
|
+
if association_data['_delete'] == true
|
115
|
+
record.mark_for_destruction
|
116
|
+
else
|
117
|
+
record.set_attribute_data(association_data, user)
|
118
|
+
end
|
113
119
|
end
|
114
120
|
end
|
115
121
|
|
data/lib/lanes/configuration.rb
CHANGED
@@ -1,10 +1,9 @@
|
|
1
1
|
require_relative "concerns/attr_accessor_with_default"
|
2
2
|
require 'securerandom'
|
3
3
|
require 'pathname'
|
4
|
-
require '
|
4
|
+
require 'shrine'
|
5
5
|
require 'active_job'
|
6
6
|
require 'jobba'
|
7
|
-
require 'message_bus'
|
8
7
|
|
9
8
|
module Lanes
|
10
9
|
|
@@ -59,8 +58,7 @@ module Lanes
|
|
59
58
|
|
60
59
|
Resque.redis.namespace = "#{identifier}::resque"
|
61
60
|
Resque.redis = Lanes.config.redis
|
62
|
-
|
63
|
-
MessageBus.logger = Lanes.logger
|
61
|
+
|
64
62
|
Lanes::SystemSettings.for_ext('lanes').apply!
|
65
63
|
Extensions.each{|ext| ext.apply_configuration }
|
66
64
|
end
|
@@ -102,9 +100,8 @@ module Lanes
|
|
102
100
|
# For testing or other uses it can be changed here
|
103
101
|
config_option :configuration_id, (ENV['LANES_CONFIG_ID'] || 1)
|
104
102
|
|
105
|
-
#
|
106
|
-
|
107
|
-
config_option :storage_type, :file
|
103
|
+
# Configuration for action cable
|
104
|
+
config_option :cable, { 'adapter' => 'redis' }
|
108
105
|
|
109
106
|
def api_path
|
110
107
|
mounted_at + 'api'
|
data/lib/lanes/db.rb
CHANGED
@@ -14,7 +14,6 @@ module Lanes
|
|
14
14
|
::ActiveRecord::Base.configurations = config
|
15
15
|
::ActiveRecord::Base.establish_connection(::ActiveRecord::Base.configurations[env.to_s])
|
16
16
|
end
|
17
|
-
ActiveRecord::Base.logger = Lanes.logger
|
18
17
|
end
|
19
18
|
|
20
19
|
def load_seed
|
@@ -52,4 +51,7 @@ module Lanes
|
|
52
51
|
::ActiveRecord::Base.logger = old_logger
|
53
52
|
end
|
54
53
|
end
|
54
|
+
|
55
|
+
ActiveRecord::Base.logger = Lanes.logger
|
56
|
+
|
55
57
|
end
|
data/lib/lanes/guard_tasks.rb
CHANGED
@@ -29,6 +29,7 @@ module Lanes
|
|
29
29
|
yield matchers
|
30
30
|
|
31
31
|
jasmine_options = options.merge({
|
32
|
+
keep_failed: false,
|
32
33
|
port: 8888, server_mount: '/spec',
|
33
34
|
server_env: 'development',
|
34
35
|
server: :puma, spec_dir: "spec/#{app_name}",
|
@@ -49,7 +50,7 @@ module Lanes
|
|
49
50
|
|
50
51
|
dsl.guard :jasmine, jasmine_options do
|
51
52
|
dsl.watch(coffee_files){ |m| "spec/#{m[0]}Spec.#{m[2]}" }
|
52
|
-
dsl.watch(%r{^spec/.*(?:_s|S)pec\.(?:js|coffee|cjsx)$}){|m| p m; m}
|
53
|
+
dsl.watch(%r{^spec/.*(?:_s|S)pec\.(?:js|coffee|cjsx)$}){|m| p m[0]; m[0]}
|
53
54
|
matchers.client_matches.call if matchers.client_matches
|
54
55
|
end
|
55
56
|
|
data/lib/lanes/job.rb
CHANGED
data/lib/lanes/logger.rb
CHANGED
@@ -5,10 +5,10 @@ module Lanes
|
|
5
5
|
|
6
6
|
class MultiDestinationLogger
|
7
7
|
def initialize
|
8
|
-
@targets = [
|
9
|
-
|
8
|
+
@targets = [STDOUT]
|
9
|
+
@targets.push(
|
10
10
|
File.open("log/#{Lanes.config.environment}.log", "a")
|
11
|
-
|
11
|
+
) if File.writable?("log")
|
12
12
|
Lanes.config.get(:environment) do
|
13
13
|
@targets.each{|t| t.sync = ! Lanes.env.production? }
|
14
14
|
end
|
data/lib/lanes/model.rb
CHANGED
data/lib/lanes/spec_helper.rb
CHANGED
@@ -13,20 +13,14 @@ module Lanes
|
|
13
13
|
SystemSettings.persist!(@extension_id, self.to_h)
|
14
14
|
end
|
15
15
|
def apply!
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
config.fog_credentials = self.fog_credentials
|
25
|
-
end
|
26
|
-
config.ignore_integrity_errors = false
|
27
|
-
config.ignore_processing_errors = false
|
28
|
-
config.ignore_download_errors = false
|
29
|
-
end
|
16
|
+
require 'shrine/storage/file_system'
|
17
|
+
ext = Extensions.controlling
|
18
|
+
Lanes::Concerns::AssetUploader.storages = {
|
19
|
+
cache: Shrine::Storage::FileSystem.new(ext.root_path,
|
20
|
+
prefix: "tmp/cache"),
|
21
|
+
store: Shrine::Storage::FileSystem.new(ext.root_path,
|
22
|
+
prefix: "public/files")
|
23
|
+
}
|
30
24
|
end
|
31
25
|
end
|
32
26
|
|
data/lib/lanes/version.rb
CHANGED
data/npm-build/data.js
CHANGED
@@ -19,6 +19,7 @@ Lanes.Vendor.Ampersand.RestCollection = require("ampersand-rest-collection");
|
|
19
19
|
Lanes.Vendor.Ampersand.LDCollection = require('ampersand-collection-lodash-mixin');
|
20
20
|
Lanes.Vendor.Ampersand.Collection = require("ampersand-collection");
|
21
21
|
Lanes.Vendor.Events = require('ampersand-events');
|
22
|
+
Lanes.Vendor.ReactModelMixin = require("react-model-binding");
|
22
23
|
|
23
24
|
Lanes.log = require('loglevel');
|
24
25
|
Lanes.Vendor.dom = require('ampersand-dom');
|
data/npm-build/package.json
CHANGED
@@ -10,36 +10,38 @@
|
|
10
10
|
"ampersand-collection": "~2.0",
|
11
11
|
"ampersand-collection-lodash-mixin": "~4.0",
|
12
12
|
"ampersand-dom": "~1.5",
|
13
|
-
"ampersand-rest-collection": "~6.0",
|
14
|
-
"ampersand-state": "~5.0",
|
15
13
|
"ampersand-events": "~2.0",
|
16
14
|
"ampersand-filtered-subcollection": "~3.0",
|
15
|
+
"ampersand-rest-collection": "~6.0",
|
16
|
+
"ampersand-state": "~5.0",
|
17
17
|
"big.js": "~3.1",
|
18
18
|
"classnames": "~2.2",
|
19
19
|
"dayz": "0.6.5",
|
20
20
|
"get-object-path": "~0.0.3",
|
21
|
-
"history": "^
|
21
|
+
"history": "^3.0.0",
|
22
22
|
"lodash": "*",
|
23
|
-
"lodash-inflection": "^1.
|
24
|
-
"loglevel": "1.4.
|
25
|
-
"moment": "^2.
|
23
|
+
"lodash-inflection": "^1.4",
|
24
|
+
"loglevel": "1.4.1",
|
25
|
+
"moment": "^2.14.1",
|
26
26
|
"moment-range": "^2.2.0",
|
27
|
-
"object-assign": "^4.0
|
27
|
+
"object-assign": "^4.1.0",
|
28
28
|
"react": "*",
|
29
|
-
"react-
|
30
|
-
"react-
|
31
|
-
"react-
|
32
|
-
"react-component-resizable": "git://github.com/justinanastos/react-component-resizable#8c995a6a624fee7f9651e18c6177f79d41244898",
|
29
|
+
"react-addons-test-utils": "^15.2",
|
30
|
+
"react-bootstrap": "^0.30.2",
|
31
|
+
"react-component-resizable": "git://github.com/arcanis/react-component-resizable#patch-1",
|
33
32
|
"react-deep-force-update": "^2.0.1",
|
34
|
-
"react-dom": "^15.
|
35
|
-
"react-list": "^0.7.
|
36
|
-
"react-
|
37
|
-
"react-
|
33
|
+
"react-dom": "^15.2",
|
34
|
+
"react-list": "^0.7.20",
|
35
|
+
"react-lite": "0.15.14",
|
36
|
+
"react-model-binding": "0.4.0",
|
37
|
+
"react-proxy": "^2.0.8",
|
38
|
+
"react-toggle": "^2.1.1",
|
39
|
+
"react-widgets": "^3.4.3",
|
38
40
|
"rsvp": "~3.2",
|
39
41
|
"sorty": "^1.2.2",
|
40
42
|
"sprintf-js": "^1.0.3",
|
41
43
|
"underscore.string": "^3.3.4",
|
42
|
-
"xhr": "^2.2.
|
44
|
+
"xhr": "^2.2.2"
|
43
45
|
},
|
44
46
|
"peerDependencies": {
|
45
47
|
"react-overlays": "*"
|
@@ -49,11 +51,11 @@
|
|
49
51
|
"raw-loader": "^0.5.1",
|
50
52
|
"css-loader": "^0.23.1",
|
51
53
|
"extract-text-webpack-plugin": "^1.0.1",
|
52
|
-
"file-loader": "^0.
|
53
|
-
"less": "^2.
|
54
|
+
"file-loader": "^0.9.0",
|
55
|
+
"less": "^2.7.1",
|
54
56
|
"less-loader": "^2.2.3",
|
55
57
|
"url-loader": "^0.5.7",
|
56
|
-
"webpack": "^1.13.
|
58
|
+
"webpack": "^1.13.1"
|
57
59
|
},
|
58
60
|
"jshintConfig": {
|
59
61
|
"asi": false,
|
data/npm-build/ui.js
CHANGED
@@ -6,3 +6,6 @@ Lanes.Vendor.BrowserHistory = require("history");
|
|
6
6
|
Lanes.Vendor.ComponentResize = require('react-component-resizable');
|
7
7
|
Lanes.Vendor.List = require('react-list')
|
8
8
|
Lanes.Vendor.Overlay = require('react-overlays');
|
9
|
+
|
10
|
+
Lanes.Vendor.ReactProxy = require('react-proxy')['default'];
|
11
|
+
Lanes.Vendor.deepForceUpdate = require('react-deep-force-update')['default'];
|
data/npm-build/update-dayz
CHANGED