bookingsync_portal 3.0.0
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 +7 -0
- data/MIT-LICENSE +20 -0
- data/README.md +174 -0
- data/Rakefile +28 -0
- data/app/assets/config/manifest.js +3 -0
- data/app/assets/images/bookingsync_portal/bookingsync.png +0 -0
- data/app/assets/images/bookingsync_portal/help/connect.gif +0 -0
- data/app/assets/javascripts/bookingsync_portal/admin/application.js.coffee +83 -0
- data/app/assets/javascripts/bookingsync_portal/admin/connections.js.coffee +3 -0
- data/app/assets/javascripts/bookingsync_portal/admin/handle_remote_errors.js.coffee +3 -0
- data/app/assets/javascripts/bookingsync_portal/admin/lib/list-filter.js.coffee +28 -0
- data/app/assets/javascripts/bookingsync_portal/admin/live_updates.js.coffee +7 -0
- data/app/assets/javascripts/bookingsync_portal/admin/rentals.js.coffee +12 -0
- data/app/assets/javascripts/bookingsync_portal/admin/templates/filter_input.hbs +6 -0
- data/app/assets/javascripts/bookingsync_portal/admin/vendor/css-contains.js +29 -0
- data/app/assets/stylesheets/bookingsync_portal/admin/application.scss +241 -0
- data/app/controllers/bookingsync_portal/admin/base_controller.rb +25 -0
- data/app/controllers/bookingsync_portal/admin/connections_controller.rb +48 -0
- data/app/controllers/bookingsync_portal/admin/help_controller.rb +7 -0
- data/app/controllers/bookingsync_portal/admin/remote_accounts_controller.rb +27 -0
- data/app/controllers/bookingsync_portal/admin/rentals_controller.rb +36 -0
- data/app/controllers/bookingsync_portal/application_controller.rb +4 -0
- data/app/helpers/bookingsync_portal/admin/application_helper.rb +34 -0
- data/app/models/bookingsync_portal/account.rb +15 -0
- data/app/models/bookingsync_portal/connection.rb +29 -0
- data/app/models/bookingsync_portal/photo.rb +8 -0
- data/app/models/bookingsync_portal/rate.rb +6 -0
- data/app/models/bookingsync_portal/remote_account.rb +9 -0
- data/app/models/bookingsync_portal/remote_rental.rb +31 -0
- data/app/models/bookingsync_portal/rental.rb +26 -0
- data/app/synchronizers/bookingsync_portal/write/ensure_source_exists.rb +22 -0
- data/app/synchronizers/bookingsync_portal/write/source.rb +30 -0
- data/app/views/bookingsync_portal/admin/connections/create.js.coffee +6 -0
- data/app/views/bookingsync_portal/admin/connections/destroy.js.coffee +7 -0
- data/app/views/bookingsync_portal/admin/help/_help.html.erb +5 -0
- data/app/views/bookingsync_portal/admin/help/index.html.erb +7 -0
- data/app/views/bookingsync_portal/admin/remote_accounts/_form.html.erb +11 -0
- data/app/views/bookingsync_portal/admin/remote_accounts/_how_to_connect.html.erb +1 -0
- data/app/views/bookingsync_portal/admin/remote_accounts/new.html.erb +5 -0
- data/app/views/bookingsync_portal/admin/rentals/_connected_rental.html.erb +30 -0
- data/app/views/bookingsync_portal/admin/rentals/_new_remote_account.html.erb +3 -0
- data/app/views/bookingsync_portal/admin/rentals/_new_remote_rental.html.erb +6 -0
- data/app/views/bookingsync_portal/admin/rentals/_remote_rental.html.erb +11 -0
- data/app/views/bookingsync_portal/admin/rentals/_rental.html.erb +14 -0
- data/app/views/bookingsync_portal/admin/rentals/_rentals.html.erb +14 -0
- data/app/views/bookingsync_portal/admin/rentals/index.html.erb +56 -0
- data/app/views/bookingsync_portal/admin/rentals/show.js.erb +7 -0
- data/app/views/layouts/bookingsync_portal/_flash.html.erb +8 -0
- data/app/views/layouts/bookingsync_portal/_menu.html.erb +30 -0
- data/app/views/layouts/bookingsync_portal/admin.html.erb +21 -0
- data/app/views/layouts/bookingsync_portal/fullscreen/application.html.erb +19 -0
- data/config/locales/en.yml +85 -0
- data/config/routes.rb +9 -0
- data/db/migrate/20150222172825_create_accounts.rb +17 -0
- data/db/migrate/20150222173413_create_rentals.rb +14 -0
- data/db/migrate/20150222173711_create_remote_accounts.rb +10 -0
- data/db/migrate/20150222174023_create_remote_rentals.rb +12 -0
- data/db/migrate/20150222174234_create_connections.rb +10 -0
- data/db/migrate/20150520134912_create_photos.rb +13 -0
- data/db/migrate/20150521091056_create_rates.rb +12 -0
- data/db/migrate/20151210164752_add_synced_source_id_to_account.rb +5 -0
- data/db/migrate/20160301141356_create_bookings.rb +9 -0
- data/lib/bookingsync_portal.rb +77 -0
- data/lib/bookingsync_portal/booking_map.rb +109 -0
- data/lib/bookingsync_portal/engine.rb +18 -0
- data/lib/bookingsync_portal/mash_serializer.rb +9 -0
- data/lib/bookingsync_portal/version.rb +3 -0
- data/lib/generators/bookingsync_portal/install_generator.rb +22 -0
- data/lib/generators/templates/initializers/bookingsync_portal.rb +48 -0
- data/lib/generators/templates/models/account.rb +14 -0
- data/lib/generators/templates/models/connection.rb +2 -0
- data/lib/generators/templates/models/photo.rb +4 -0
- data/lib/generators/templates/models/rate.rb +3 -0
- data/lib/generators/templates/models/remote_account.rb +6 -0
- data/lib/generators/templates/models/remote_rental.rb +6 -0
- data/lib/generators/templates/models/rental.rb +11 -0
- data/lib/tasks/bookingsync_portal_tasks.rake +4 -0
- metadata +521 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 6d421d75ad1576b846c1193f95a99cbdccfc69c3a2e425ce277f9b0f1ee5da96
|
|
4
|
+
data.tar.gz: ca119adacdf8c98acb2e307ecb220b74741a3a066ba46531f764b686976f9ae8
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: e943963710bb782ba8bf3f970115a07298de7cd98c5b1bdbd3d59705dc829070ad00f2499584fb33a8b2a1a423a36e554799d6072727d4a6b68671e2901a676a
|
|
7
|
+
data.tar.gz: ab637cea334141163a8672ccf1c4d7c6936f8e402babedf5ca52ce5675d7c400e2fab9273662e5726a8fabc502aec963e520412bb58b07e1417fd81953fea539
|
data/MIT-LICENSE
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
Copyright 2015 Piotr Marciniak
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
4
|
+
a copy of this software and associated documentation files (the
|
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
|
9
|
+
the following conditions:
|
|
10
|
+
|
|
11
|
+
The above copyright notice and this permission notice shall be
|
|
12
|
+
included in all copies or substantial portions of the Software.
|
|
13
|
+
|
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
[](https://codeclimate.com/github/BookingSync/bookingsync_portal)
|
|
2
|
+
[](https://travis-ci.org/BookingSync/bookingsync_portal)
|
|
3
|
+
|
|
4
|
+
# BookingsyncPortal
|
|
5
|
+
|
|
6
|
+
A Rails engine to simplify building BookingSync Portal Applications.
|
|
7
|
+
|
|
8
|
+
## Requirements
|
|
9
|
+
|
|
10
|
+
This engine requires Rails `>= 5.2.0` and Ruby `>= 2.5.0`.
|
|
11
|
+
|
|
12
|
+
## Documentation
|
|
13
|
+
|
|
14
|
+
[API documentation is available at rdoc.info](http://rdoc.info/github/BookingSync/bookingsync_portal/master/frames).
|
|
15
|
+
|
|
16
|
+
## Installation
|
|
17
|
+
|
|
18
|
+
BookingSync Portal works with Rails 5.2 onwards and Ruby 2.5 onwards. To get started, add it to your Gemfile with:
|
|
19
|
+
|
|
20
|
+
```ruby
|
|
21
|
+
gem 'bookingsync_portal'
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Then bundle install:
|
|
25
|
+
|
|
26
|
+
```ruby
|
|
27
|
+
bundle install
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
### Add routes
|
|
31
|
+
|
|
32
|
+
BookingSync Authorization routes need to be mounted inside you apps `routes.rb`:
|
|
33
|
+
|
|
34
|
+
```ruby
|
|
35
|
+
mount BookingSync::Engine => '/'
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
This will add the following routes:
|
|
39
|
+
|
|
40
|
+
* `/auth/bookingsync/callback`
|
|
41
|
+
* `/auth/failure`
|
|
42
|
+
* `/signout`
|
|
43
|
+
|
|
44
|
+
as well as BookingSync Portal controllers routes:
|
|
45
|
+
|
|
46
|
+
```ruby
|
|
47
|
+
mount BookingsyncPortal::Engine => '/'
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
### Migrations
|
|
51
|
+
|
|
52
|
+
BookingSync Portal provide migrations for the most common models:
|
|
53
|
+
* `Account`: BookingSync accounts,
|
|
54
|
+
* `Connection`: connection between `rentals` and `remote_rentals`,
|
|
55
|
+
* `Photo`: BookingSync rentals' photos,
|
|
56
|
+
* `Rate`: BookingSync rentals' rates,
|
|
57
|
+
* `RemoteAccount`: Portal accounts,
|
|
58
|
+
* `RemoteRental`: Portal rentals,
|
|
59
|
+
* `Rental`: BookingSync rentals,
|
|
60
|
+
|
|
61
|
+
You can copy the migrations file to your application by running:
|
|
62
|
+
|
|
63
|
+
```console
|
|
64
|
+
rake bookingsync_portal:install:migrations
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
then run the migration:
|
|
68
|
+
|
|
69
|
+
```console
|
|
70
|
+
rake db:migrate
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
### Add initializer and default models
|
|
74
|
+
|
|
75
|
+
This will install a configuration file in `config/initializers/bookingsync_portal.rb` as well as creating default models:
|
|
76
|
+
|
|
77
|
+
```console
|
|
78
|
+
rails g bookingsync_portal:install
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
### Assets
|
|
83
|
+
|
|
84
|
+
You will need to install the assets for each namespace:
|
|
85
|
+
|
|
86
|
+
in `/app/assets/javascripts/admin/application.js`:
|
|
87
|
+
|
|
88
|
+
```javascript
|
|
89
|
+
// This is a manifest file that'll be compiled into application.js, which will include all the files
|
|
90
|
+
// listed below.
|
|
91
|
+
//
|
|
92
|
+
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
|
|
93
|
+
// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
|
|
94
|
+
//
|
|
95
|
+
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
|
|
96
|
+
// compiled file.
|
|
97
|
+
//
|
|
98
|
+
// Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details
|
|
99
|
+
// about supported directives.
|
|
100
|
+
//
|
|
101
|
+
//= require bookingsync_portal/admin/application
|
|
102
|
+
//= require_tree .
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
in `/app/assets/javascripts/admin/application.css.scss`:
|
|
106
|
+
|
|
107
|
+
```scss
|
|
108
|
+
/*
|
|
109
|
+
* This is a manifest file that'll be compiled into application.css, which will include all the files
|
|
110
|
+
* listed below.
|
|
111
|
+
*
|
|
112
|
+
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
|
|
113
|
+
* or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
|
|
114
|
+
*
|
|
115
|
+
* You're free to add application-wide styles to this file and they'll appear at the bottom of the
|
|
116
|
+
* compiled file so the styles you add here take precedence over styles defined in any styles
|
|
117
|
+
* defined in the other CSS/SCSS files in this directory. It is generally better to create a new
|
|
118
|
+
* file per style scope.
|
|
119
|
+
*
|
|
120
|
+
*= require bookingsync_portal/admin/application
|
|
121
|
+
*= require_self
|
|
122
|
+
*/
|
|
123
|
+
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
_Note: When saving new token, this gem uses a separate thread with new db connection to ensure token save (in case of a rollback in the main transaction). To make room for the new connections, it is recommended to increase db `pool` size by 2-3._
|
|
128
|
+
|
|
129
|
+
## Configuration
|
|
130
|
+
|
|
131
|
+
The engine is configured by the following ENV variables:
|
|
132
|
+
|
|
133
|
+
* `BOOKINGSYNC_URL` - the url of the website, should be `https://www.bookingsync.com`
|
|
134
|
+
* `BOOKINGSYNC_APP_ID` - BookingSync Application's Client ID
|
|
135
|
+
* `BOOKINGSYNC_APP_SECRET` - BookingSync Application's Client Secret
|
|
136
|
+
* `BOOKINGSYNC_VERIFY_SSL` - Verify SSL (available only in development or test). Default to false
|
|
137
|
+
* `BOOKINGSYNC_SCOPE` - Space separated list of required scopes. Defaults to nil, which means the public scope.
|
|
138
|
+
|
|
139
|
+
You might want to use [dotenv-rails](https://github.com/bkeepers/dotenv)
|
|
140
|
+
to make ENV variables management easy.
|
|
141
|
+
|
|
142
|
+
Rack::Lock is not recommended with message_bus gem, causing deadlock problems. You might want to add this line to your app `development.rb` file:
|
|
143
|
+
|
|
144
|
+
```ruby
|
|
145
|
+
config.middleware.delete Rack::Lock
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
## Testing
|
|
149
|
+
|
|
150
|
+
### RSpec
|
|
151
|
+
|
|
152
|
+
We do provide some helper for RSpec users, you can include them in your `spec/rails_helper.rb` (before `spec/support` inclusion):
|
|
153
|
+
```
|
|
154
|
+
require 'bookingsync_application/spec_helper'
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
### VCR
|
|
158
|
+
|
|
159
|
+
We recommend a VCR setup inspired from the following configuration. It will mask authorization tokens from your fixtures:
|
|
160
|
+
|
|
161
|
+
```ruby
|
|
162
|
+
require 'vcr'
|
|
163
|
+
|
|
164
|
+
VCR.configure do |config|
|
|
165
|
+
config.cassette_library_dir = 'spec/fixtures/cassettes'
|
|
166
|
+
config.hook_into :webmock
|
|
167
|
+
config.configure_rspec_metadata!
|
|
168
|
+
config.filter_sensitive_data('BOOKINGSYNC_OAUTH_ACCESS_TOKEN') do
|
|
169
|
+
ENV['BOOKINGSYNC_OAUTH_ACCESS_TOKEN']
|
|
170
|
+
end
|
|
171
|
+
# Uncomment if using codeclimate
|
|
172
|
+
# config.ignore_hosts 'codeclimate.com'
|
|
173
|
+
end
|
|
174
|
+
```
|
data/Rakefile
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
begin
|
|
2
|
+
require 'bundler/setup'
|
|
3
|
+
rescue LoadError
|
|
4
|
+
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
|
5
|
+
end
|
|
6
|
+
|
|
7
|
+
require 'rdoc/task'
|
|
8
|
+
|
|
9
|
+
RDoc::Task.new(:rdoc) do |rdoc|
|
|
10
|
+
rdoc.rdoc_dir = 'rdoc'
|
|
11
|
+
rdoc.title = 'BookingsyncPortal'
|
|
12
|
+
rdoc.options << '--line-numbers'
|
|
13
|
+
rdoc.rdoc_files.include('README.rdoc')
|
|
14
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
APP_RAKEFILE = File.expand_path('../spec/dummy/Rakefile', __FILE__)
|
|
18
|
+
load 'rails/tasks/engine.rake'
|
|
19
|
+
|
|
20
|
+
Bundler::GemHelper.install_tasks
|
|
21
|
+
|
|
22
|
+
require 'rspec/core'
|
|
23
|
+
require 'rspec/core/rake_task'
|
|
24
|
+
|
|
25
|
+
desc 'Run all specs in spec directory (excluding plugin specs)'
|
|
26
|
+
RSpec::Core::RakeTask.new(spec: 'app:db:test:prepare')
|
|
27
|
+
|
|
28
|
+
task default: :spec
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
# This is a manifest file that'll be compiled into application.js, which will include all the files
|
|
2
|
+
# listed below.
|
|
3
|
+
#
|
|
4
|
+
# Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
|
|
5
|
+
# or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
|
|
6
|
+
#
|
|
7
|
+
# It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
|
|
8
|
+
# compiled file.
|
|
9
|
+
#
|
|
10
|
+
# Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details
|
|
11
|
+
# about supported directives.
|
|
12
|
+
#
|
|
13
|
+
#= require jquery
|
|
14
|
+
#= require jquery_ujs
|
|
15
|
+
#= require jquery-ui/widgets/draggable
|
|
16
|
+
#= require jquery-ui/widgets/droppable
|
|
17
|
+
#= require handlebars.runtime
|
|
18
|
+
#= require message-bus
|
|
19
|
+
#= require bootstrap/alert
|
|
20
|
+
#= require bootstrap/collapse
|
|
21
|
+
#= require bookingsync/form
|
|
22
|
+
#= require ./vendor/css-contains
|
|
23
|
+
#= require ./lib/list-filter
|
|
24
|
+
#= require_tree ./templates
|
|
25
|
+
#= require_tree .
|
|
26
|
+
|
|
27
|
+
window.extractIdFromDomId = (attribute) ->
|
|
28
|
+
if attribute
|
|
29
|
+
attribute.split("_").pop()
|
|
30
|
+
$.fn.extend
|
|
31
|
+
draggableRental: ->
|
|
32
|
+
settings =
|
|
33
|
+
revert: "invalid"
|
|
34
|
+
zIndex: 50
|
|
35
|
+
revertDuration: 100
|
|
36
|
+
cursor: "move"
|
|
37
|
+
containment: '.rentals-container'
|
|
38
|
+
appendTo: '.rentals-container'
|
|
39
|
+
helper: "clone"
|
|
40
|
+
scroll: false
|
|
41
|
+
|
|
42
|
+
start: (e, ui) ->
|
|
43
|
+
$(ui.helper).addClass "ui-draggable-helper"
|
|
44
|
+
|
|
45
|
+
@each () ->
|
|
46
|
+
$(this).draggable(settings)
|
|
47
|
+
|
|
48
|
+
droppableRemoteRental: ->
|
|
49
|
+
settings =
|
|
50
|
+
accept: ".bookingsync-rental"
|
|
51
|
+
activeClass: "dropzone-active"
|
|
52
|
+
hoverClass: "dropzone-hover"
|
|
53
|
+
greedy: true
|
|
54
|
+
tolerance: "pointer"
|
|
55
|
+
drop: (event, ui) ->
|
|
56
|
+
remoteRentalDropZone = $(@)
|
|
57
|
+
|
|
58
|
+
rentalId = extractIdFromDomId($(ui.draggable).attr("id"))
|
|
59
|
+
remoteRentalId = extractIdFromDomId(remoteRentalDropZone.attr("id"))
|
|
60
|
+
remoteAccountId = remoteRentalDropZone.data("remote-account-id")
|
|
61
|
+
|
|
62
|
+
if remoteRentalId
|
|
63
|
+
postData = { "rental_id": rentalId, "remote_rental_id": remoteRentalId }
|
|
64
|
+
else
|
|
65
|
+
postData = { "rental_id": rentalId, "remote_account_id": remoteAccountId }
|
|
66
|
+
# clone new remote rental drop zone and append to the end
|
|
67
|
+
remoteRentalDropZone.clone().insertBefore(remoteRentalDropZone).addClass('new_rental_placeholder');
|
|
68
|
+
|
|
69
|
+
$(ui.draggable).remove()
|
|
70
|
+
|
|
71
|
+
connect_url = $('.remote-rentals-list.rentals-list').data('connect-url')
|
|
72
|
+
|
|
73
|
+
$.ajax
|
|
74
|
+
url: connect_url
|
|
75
|
+
type: "POST"
|
|
76
|
+
data: postData
|
|
77
|
+
dataType: 'script'
|
|
78
|
+
beforeSend: ->
|
|
79
|
+
$(@).addClass('loading')
|
|
80
|
+
success: ->
|
|
81
|
+
$(@).removeClass('loading')
|
|
82
|
+
@each () ->
|
|
83
|
+
$(this).droppable(settings)
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
class @ListFilter
|
|
2
|
+
constructor: (header, list, @listElement, @listFilterable, @inputId, formTemplate) ->
|
|
3
|
+
@header = $(header)
|
|
4
|
+
@list = $(list)
|
|
5
|
+
@form = $(formTemplate)
|
|
6
|
+
|
|
7
|
+
@insertForm()
|
|
8
|
+
@observeInputChanges()
|
|
9
|
+
|
|
10
|
+
insertForm: ->
|
|
11
|
+
@form.appendTo(@header)
|
|
12
|
+
@input = $("#" + @inputId)
|
|
13
|
+
|
|
14
|
+
observeInputChanges: ->
|
|
15
|
+
@input.change( =>
|
|
16
|
+
filter = $(event.target).val()
|
|
17
|
+
@hideElements @listFilterable + ":not(:Contains(" + filter + "))"
|
|
18
|
+
@showElements @listFilterable + ":Contains(" + filter + ")"
|
|
19
|
+
false
|
|
20
|
+
).keyup =>
|
|
21
|
+
# fire the above change event after every letter
|
|
22
|
+
@input.change()
|
|
23
|
+
|
|
24
|
+
showElements: (elements) ->
|
|
25
|
+
@list.find(elements).parents(@listElement).show()
|
|
26
|
+
|
|
27
|
+
hideElements: (elements) ->
|
|
28
|
+
@list.find(elements).parents(@listElement).hide()
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
$ ->
|
|
2
|
+
for rentalsList, index in $(".rentals-list")
|
|
3
|
+
inputId = "rentals-list-filter-#{index}"
|
|
4
|
+
new ListFilter(
|
|
5
|
+
$(rentalsList).children(".rentals-list-header"),
|
|
6
|
+
$(rentalsList).children(".rentals-list-scroll"),
|
|
7
|
+
".panel",
|
|
8
|
+
".panel h4",
|
|
9
|
+
inputId,
|
|
10
|
+
HandlebarsTemplates["filter_input"]
|
|
11
|
+
inputId: inputId
|
|
12
|
+
)
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
// Copyright (c) 2010 Kilian Valkhof
|
|
2
|
+
|
|
3
|
+
// Permission is hereby granted, free of charge, to any person
|
|
4
|
+
// obtaining a copy of this software and associated documentation
|
|
5
|
+
// files (the "Software"), to deal in the Software without
|
|
6
|
+
// restriction, including without limitation the rights to use,
|
|
7
|
+
// copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
8
|
+
// copies of the Software, and to permit persons to whom the
|
|
9
|
+
// Software is furnished to do so, subject to the following
|
|
10
|
+
// conditions:
|
|
11
|
+
|
|
12
|
+
// The above copyright notice and this permission notice shall be
|
|
13
|
+
// included in all copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
16
|
+
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
|
17
|
+
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
18
|
+
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
|
19
|
+
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
20
|
+
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
21
|
+
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
|
22
|
+
// OTHER DEALINGS IN THE SOFTWARE.
|
|
23
|
+
|
|
24
|
+
!function ($) {
|
|
25
|
+
// custom css expression for a case-insensitive contains()
|
|
26
|
+
jQuery.expr[':'].Contains = function(a, i, m) {
|
|
27
|
+
return (a.textContent || a.innerText || "").toUpperCase().indexOf(m[3].toUpperCase()) >= 0;
|
|
28
|
+
}
|
|
29
|
+
}(jQuery);
|
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
@import "font-awesome-sprockets";
|
|
2
|
+
@import "font-awesome";
|
|
3
|
+
@import "bootstrap-bookingsync-sprockets";
|
|
4
|
+
@import "bootstrap-bookingsync";
|
|
5
|
+
|
|
6
|
+
html, body {
|
|
7
|
+
height: 100%;
|
|
8
|
+
height: 100vh;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
body.fullscreen {
|
|
12
|
+
background-color: #fff;
|
|
13
|
+
padding: 1em;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
body > .footer {
|
|
17
|
+
clear: both;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.container-fullscreen {
|
|
21
|
+
height: 100%;
|
|
22
|
+
width: 100%;
|
|
23
|
+
|
|
24
|
+
> #flash > .alert {
|
|
25
|
+
border-top: 0;
|
|
26
|
+
border-left: 0;
|
|
27
|
+
border-right: 0;
|
|
28
|
+
border-radius: 0;
|
|
29
|
+
margin: 0 (-1 * ceil($grid-gutter-width / 2));
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.rentals-container {
|
|
34
|
+
height: 100%;
|
|
35
|
+
padding: ceil($grid-gutter-width / 2) 0;
|
|
36
|
+
margin: 0 (-1 * ceil($grid-gutter-width / 2));
|
|
37
|
+
|
|
38
|
+
& > div {
|
|
39
|
+
height: 100%;
|
|
40
|
+
min-width: 300px;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.rentals-list {
|
|
45
|
+
height: 100%;
|
|
46
|
+
display: flex;
|
|
47
|
+
flex-direction: column;
|
|
48
|
+
overflow: auto;
|
|
49
|
+
padding: ceil($grid-gutter-width / 2);
|
|
50
|
+
border-radius: 4px;
|
|
51
|
+
border: 1px solid $gray-lighter;
|
|
52
|
+
|
|
53
|
+
legend {
|
|
54
|
+
border: 0;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
h3 {
|
|
58
|
+
border-top: 1px solid $gray-lighter;
|
|
59
|
+
font-size: 14px;
|
|
60
|
+
padding: 10px 10px;
|
|
61
|
+
margin: 0;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.filterform {
|
|
66
|
+
margin-bottom: 10px;
|
|
67
|
+
width: 90%;
|
|
68
|
+
margin-left: 5%;
|
|
69
|
+
font-size: small;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.rentals-list-header, .rentals-list-footer {
|
|
73
|
+
flex: 0 0 auto;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.rentals-list-header {
|
|
77
|
+
img {
|
|
78
|
+
height: 29px;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.rentals-list-footer {
|
|
83
|
+
border-top: 1px solid $gray-lighter;
|
|
84
|
+
margin-left: (-1 * ceil($grid-gutter-width / 2));
|
|
85
|
+
margin-right: (-1 * ceil($grid-gutter-width / 2));
|
|
86
|
+
padding-top: 8px;
|
|
87
|
+
margin-bottom: (-1 * ceil($grid-gutter-width / 2)) + 8px;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
.rentals-list-scroll {
|
|
91
|
+
flex: 1 1 auto;
|
|
92
|
+
overflow-y: auto;
|
|
93
|
+
margin-left: (-1 * ceil($grid-gutter-width / 2));
|
|
94
|
+
margin-right: (-1 * ceil($grid-gutter-width / 2));
|
|
95
|
+
|
|
96
|
+
.well {
|
|
97
|
+
border-left: 0;
|
|
98
|
+
border-right: 0;
|
|
99
|
+
border-radius: 0;
|
|
100
|
+
box-shadow: none;
|
|
101
|
+
background-color: $body-bg;
|
|
102
|
+
|
|
103
|
+
i {
|
|
104
|
+
color: $gray-light;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
.remote-rentals-list {
|
|
110
|
+
background-color: #fff;
|
|
111
|
+
|
|
112
|
+
.dropzone-active {
|
|
113
|
+
border: 1px dashed $btn-success-border;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
.dropzone-hover {
|
|
117
|
+
border: 1px solid $btn-success-border;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
.rentals-container .panel-bookingsync.ui-draggable-dragging {
|
|
122
|
+
box-shadow: 0 0 10px $gray-light;
|
|
123
|
+
background-color: #fff;
|
|
124
|
+
height: auto;
|
|
125
|
+
border: 1px solid $gray-lighter;
|
|
126
|
+
width: 31%;
|
|
127
|
+
transform: scale(1.1);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
.panel {
|
|
131
|
+
padding: 10px;
|
|
132
|
+
border-radius: 0;
|
|
133
|
+
margin-bottom: 0;
|
|
134
|
+
border-top: 1px solid $gray-lighter;
|
|
135
|
+
border-bottom: 1px solid $gray-lighter;
|
|
136
|
+
position: relative;
|
|
137
|
+
|
|
138
|
+
& + .panel,
|
|
139
|
+
& + h3 {
|
|
140
|
+
border-top: 0;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
.alert {
|
|
144
|
+
margin: 10px -12px;
|
|
145
|
+
border-radius: 0;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
.alert-bottom:last-of-type {
|
|
149
|
+
margin-bottom: -10px;
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
.panel-body-grid {
|
|
154
|
+
display: flex;
|
|
155
|
+
overflow: hidden;
|
|
156
|
+
position: relative;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
.panel-body-grid-photo {
|
|
160
|
+
min-width: 96px;
|
|
161
|
+
height: 64px;
|
|
162
|
+
flex-grow: 0;
|
|
163
|
+
background-color: rgba(255, 255, 255, 0.8);
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
.panel-body-grid-text {
|
|
167
|
+
padding: 0 $padding-base-horizontal;
|
|
168
|
+
flex-grow: 1;
|
|
169
|
+
overflow: hidden;
|
|
170
|
+
|
|
171
|
+
h4 {
|
|
172
|
+
margin: 0 0 10px 0;
|
|
173
|
+
line-height: 1.4;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
p {
|
|
177
|
+
margin: 0;
|
|
178
|
+
font-size: 12px;
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
.panel-bookingsync {
|
|
183
|
+
background-color: $body-bg;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
.panel-connected {
|
|
187
|
+
.panel-heading {
|
|
188
|
+
position: relative;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
h4 small {
|
|
192
|
+
color: $gray-lighter;
|
|
193
|
+
display: block;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
.status {
|
|
197
|
+
position: absolute;
|
|
198
|
+
right: 3px;
|
|
199
|
+
top: 8px;
|
|
200
|
+
|
|
201
|
+
.btn-xs {
|
|
202
|
+
border-radius: 11px;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
.remove-connection {
|
|
206
|
+
.hover_show {
|
|
207
|
+
display: none;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
.fa-check {
|
|
211
|
+
border-radius: 11px;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
&:hover {
|
|
215
|
+
background-color: $brand-danger;
|
|
216
|
+
border-color: $brand-danger;
|
|
217
|
+
border-radius: $border-radius-small;
|
|
218
|
+
|
|
219
|
+
.hover_hide {
|
|
220
|
+
display: none;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
.hover_show {
|
|
224
|
+
display: block;
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
.panel-remote {
|
|
232
|
+
background-color: $body-bg;
|
|
233
|
+
opacity: 0.5;
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
.panel.ui-draggable {
|
|
237
|
+
&:hover {
|
|
238
|
+
cursor: move;
|
|
239
|
+
background-color: #fff;
|
|
240
|
+
}
|
|
241
|
+
}
|