bookingsync_portal 0.3.3 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/images/bookingsync_portal/help/connect.gif +0 -0
- data/app/assets/javascripts/bookingsync_portal/admin/application.js.coffee +2 -0
- data/app/assets/stylesheets/bookingsync_portal/admin/application.css.scss +13 -0
- data/app/controllers/bookingsync_portal/admin/help_controller.rb +7 -0
- data/app/controllers/bookingsync_portal/admin/remote_accounts_controller.rb +1 -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/help/_help.html.erb +5 -0
- data/app/views/bookingsync_portal/admin/help/index.html.erb +7 -0
- data/app/views/bookingsync_portal/admin/rentals/_connected_rental.html.erb +4 -2
- data/app/views/bookingsync_portal/admin/rentals/index.html.erb +11 -4
- data/app/views/layouts/bookingsync_portal/_flash.html.erb +8 -0
- data/app/views/layouts/bookingsync_portal/_menu.html.erb +21 -2
- data/app/views/layouts/bookingsync_portal/admin.html.erb +6 -1
- data/app/views/layouts/bookingsync_portal/fullscreen/application.html.erb +19 -0
- data/config/locales/en.yml +18 -0
- data/config/routes.rb +1 -0
- data/db/migrate/20151210164752_add_synced_source_id_to_account.rb +5 -0
- data/lib/bookingsync_portal.rb +3 -0
- data/lib/bookingsync_portal/version.rb +1 -1
- metadata +11 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1319288ef7564085052b114efe5080edcef79586
|
4
|
+
data.tar.gz: 27a32ae0a5b4b801f1c48b8132928ce81dfda36a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 927ac83466cdf90ba8e6d7d4aeab3242867e2c97f9d7cff2e295c5de58f7d44fb0af34276ac52a2473b1d6668282cdd327fdcf05ed96ba3c11bd96aa8e7a3951
|
7
|
+
data.tar.gz: 76bab06506eb2fdda286b7616a80691529f1fddf629530500e78503367560d69b1682e33f88d6994a68060fdb26496437a415f3d40e12a47d197b40fb2f86a73
|
Binary file
|
@@ -10,6 +10,11 @@ html, body {
|
|
10
10
|
height: 100vh;
|
11
11
|
}
|
12
12
|
|
13
|
+
body.fullscreen {
|
14
|
+
background-color: #fff;
|
15
|
+
padding: 1em;
|
16
|
+
}
|
17
|
+
|
13
18
|
body > .footer {
|
14
19
|
padding-bottom: 20px;
|
15
20
|
clear: both;
|
@@ -18,6 +23,14 @@ body > .footer {
|
|
18
23
|
.container-fullscreen {
|
19
24
|
height: 100%;
|
20
25
|
width: 100%;
|
26
|
+
|
27
|
+
> #flash > .alert {
|
28
|
+
border-top: 0;
|
29
|
+
border-left: 0;
|
30
|
+
border-right: 0;
|
31
|
+
border-radius: 0;
|
32
|
+
margin: 0 (-1 * ceil($grid-gutter-width / 2));
|
33
|
+
}
|
21
34
|
}
|
22
35
|
|
23
36
|
.rentals-container {
|
@@ -0,0 +1,22 @@
|
|
1
|
+
class BookingsyncPortal::Write::EnsureSourceExists
|
2
|
+
attr_reader :account
|
3
|
+
|
4
|
+
def initialize(account)
|
5
|
+
@account = account
|
6
|
+
end
|
7
|
+
|
8
|
+
def call
|
9
|
+
blank_source? ? update_source : true
|
10
|
+
end
|
11
|
+
|
12
|
+
private
|
13
|
+
|
14
|
+
def blank_source?
|
15
|
+
account.synced_source_id.blank?
|
16
|
+
end
|
17
|
+
|
18
|
+
def update_source
|
19
|
+
source = BookingsyncPortal::Write::Source.new(account).synchronize
|
20
|
+
account.update!(synced_source_id: source.id)
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
class BookingsyncPortal::Write::Source
|
2
|
+
attr_reader :account
|
3
|
+
private :account
|
4
|
+
|
5
|
+
def initialize(account)
|
6
|
+
@account = account
|
7
|
+
end
|
8
|
+
|
9
|
+
def synchronize
|
10
|
+
find_or_create
|
11
|
+
end
|
12
|
+
|
13
|
+
private
|
14
|
+
|
15
|
+
def find_or_create
|
16
|
+
find_source || create_source
|
17
|
+
end
|
18
|
+
|
19
|
+
def api
|
20
|
+
account.api
|
21
|
+
end
|
22
|
+
|
23
|
+
def find_source
|
24
|
+
api.sources.find { |s| s.name == BookingsyncPortal.source_name }
|
25
|
+
end
|
26
|
+
|
27
|
+
def create_source
|
28
|
+
api.create_source(name: BookingsyncPortal.source_name)
|
29
|
+
end
|
30
|
+
end
|
@@ -13,8 +13,10 @@ disconnect_label = content_tag(:i, "", { class: 'fa fa-check' }) + h(" ") +
|
|
13
13
|
<%- end -%>
|
14
14
|
</div>
|
15
15
|
<div class="panel-body-grid-text">
|
16
|
-
<h4 title="<%= RemoteRental.human_attribute_name(:
|
17
|
-
<%=
|
16
|
+
<h4 title="<%= RemoteRental.human_attribute_name(:name) %>: <%= remote_rental.name %>
|
17
|
+
<%= RemoteRental.human_attribute_name(:uid) %>: <%= remote_rental.uid %>">
|
18
|
+
<%= remote_rental.rental.name %>
|
19
|
+
</h4>
|
18
20
|
<%= link_to disconnect_label,
|
19
21
|
bookingsync_portal.disconnect_admin_rental_path(rental),
|
20
22
|
class: "btn btn-default btn-xs btn-success remove-connection",
|
@@ -1,5 +1,10 @@
|
|
1
|
+
<%- content_for :navbar_right do -%>
|
2
|
+
<ul class="nav navbar-nav">
|
3
|
+
<li><%= link_to icon("life-ring", t('.help')), admin_help_url %></li>
|
4
|
+
</ul>
|
5
|
+
<%- end -%>
|
1
6
|
<div class="rentals-container row">
|
2
|
-
<div class="col-xs-
|
7
|
+
<div class="col-xs-6">
|
3
8
|
<div class="bookingsync-rentals-list rentals-list">
|
4
9
|
<div class="rentals-list-header">
|
5
10
|
<legend class="text-center"><%= image_tag('bookingsync_portal/bookingsync.png', alt: 'BookingSync') %></legend>
|
@@ -22,11 +27,13 @@
|
|
22
27
|
</div>
|
23
28
|
</div>
|
24
29
|
</div>
|
25
|
-
<div class="col-xs-
|
30
|
+
<div class="col-xs-6">
|
26
31
|
<div class="remote-rentals-list rentals-list">
|
27
32
|
<div class="rentals-list-header">
|
28
|
-
<legend class="text-center"
|
29
|
-
|
33
|
+
<legend class="text-center">
|
34
|
+
<%= image_tag("#{BookingsyncPortal.portal_name.parameterize}.png",
|
35
|
+
alt: BookingsyncPortal.portal_name) %>
|
36
|
+
</legend>
|
30
37
|
</div>
|
31
38
|
|
32
39
|
<div class="rentals-list-scroll">
|
@@ -0,0 +1,8 @@
|
|
1
|
+
<%- if flash[:error] -%>
|
2
|
+
<div id="flash">
|
3
|
+
<div class="alert alert-danger">
|
4
|
+
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
|
5
|
+
<strong><%=t 'bookingsync_portal.admin.layout.flash.error.legend' %></strong> <%= flash[:error] %>
|
6
|
+
</div>
|
7
|
+
</div>
|
8
|
+
<%- end -%>
|
@@ -1,11 +1,30 @@
|
|
1
1
|
<nav class="navbar navbar-default navbar-fixed-top" role="navigation">
|
2
2
|
<div class="container container-fullscreen">
|
3
3
|
<div class="navbar-header">
|
4
|
+
<%- if yield(:navbar_right).present? -%>
|
5
|
+
<button type="button" class="navbar-toggle navbar-toggle-context" data-toggle="collapse"
|
6
|
+
data-target=".navbar-context1-collapse">
|
7
|
+
<span class="sr-only">
|
8
|
+
<%=t 'bookingsync_portal.admin.layout.menu.toggle_navigation' %>
|
9
|
+
</span>
|
10
|
+
<span class="icon-bar"></span>
|
11
|
+
<span class="icon-bar"></span>
|
12
|
+
<span class="icon-bar"></span>
|
13
|
+
</button>
|
14
|
+
<%- end -%>
|
4
15
|
<div>
|
5
|
-
|
6
|
-
|
16
|
+
<%= link_to icon("globe", BookingsyncPortal.portal_name), admin_root_url,
|
17
|
+
class: "navbar-brand h1",
|
18
|
+
data: { toggle: "dropdown" } %>
|
7
19
|
</a>
|
8
20
|
</div>
|
9
21
|
</div>
|
22
|
+
<%- if yield(:navbar_right).present? -%>
|
23
|
+
<div class="collapse navbar-collapse navbar-context1-collapse">
|
24
|
+
<div class="navbar-right">
|
25
|
+
<%= yield(:navbar_right) %>
|
26
|
+
</div>
|
27
|
+
</div>
|
28
|
+
<%- end -%>
|
10
29
|
</div>
|
11
30
|
</nav>
|
@@ -1,13 +1,18 @@
|
|
1
1
|
<!DOCTYPE html>
|
2
2
|
<html>
|
3
3
|
<head>
|
4
|
-
<
|
4
|
+
<meta charset="utf-8">
|
5
|
+
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
6
|
+
<title><%=t 'bookingsync_portal.admin.layout.title',
|
7
|
+
portal_name: BookingsyncPortal.portal_name %></title>
|
8
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
|
5
9
|
<%= stylesheet_link_tag 'admin/application', media: 'all' %>
|
6
10
|
<%= csrf_meta_tags %>
|
7
11
|
</head>
|
8
12
|
<body data-messagebus-channel="<%= messagebus_channel %>">
|
9
13
|
<%= render partial: '/layouts/bookingsync_portal/menu' %>
|
10
14
|
<div class="container container-fullscreen">
|
15
|
+
<%= render '/layouts/bookingsync_portal/flash' %>
|
11
16
|
<%= yield %>
|
12
17
|
</div>
|
13
18
|
<%= javascript_include_tag 'admin/application' %>
|
@@ -0,0 +1,19 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<meta charset="utf-8">
|
5
|
+
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
6
|
+
<title><%=t 'bookingsync_portal.admin.layout.title',
|
7
|
+
portal_name: BookingsyncPortal.portal_name %></title>
|
8
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
|
9
|
+
<%= stylesheet_link_tag 'admin/application', media: 'all' %>
|
10
|
+
<%= csrf_meta_tags %>
|
11
|
+
</head>
|
12
|
+
<body class="fullscreen">
|
13
|
+
<div class="container">
|
14
|
+
<%= render '/layouts/bookingsync_portal/flash' %>
|
15
|
+
<%= yield %>
|
16
|
+
</div>
|
17
|
+
<%= javascript_include_tag 'admin/application' %>
|
18
|
+
</body>
|
19
|
+
</html>
|
data/config/locales/en.yml
CHANGED
@@ -9,8 +9,25 @@ en:
|
|
9
9
|
|
10
10
|
bookingsync_portal:
|
11
11
|
admin:
|
12
|
+
help:
|
13
|
+
index:
|
14
|
+
title: What to do?
|
15
|
+
close: Close
|
16
|
+
help:
|
17
|
+
publish_rentals:
|
18
|
+
title: Publish rentals
|
19
|
+
description_html: 'Only rentals that are in the "Published" status can be connected to the portal. If you see the message "No published rentals present, please make sure to fill all your rentals details" on the left column, go back to the Rentals section to publish the ones you want to connect.'
|
20
|
+
connect:
|
21
|
+
title: Connect rentals
|
22
|
+
description_html: 'Drag the rentals from the left column and drop it to the corresponding listing on the right one.<br>You can filter the lists with the listings names.'
|
12
23
|
layout:
|
13
24
|
title: Connect BookingSync with %{portal_name}
|
25
|
+
flash:
|
26
|
+
error:
|
27
|
+
legend: Error
|
28
|
+
menu:
|
29
|
+
toggle_navigation: Toggle Navigation
|
30
|
+
|
14
31
|
remote_accounts:
|
15
32
|
new:
|
16
33
|
title: Connect with %{portal_name}
|
@@ -32,6 +49,7 @@ en:
|
|
32
49
|
create_listings_first: You must create your rentals on Remote Account before you can synchronize them automatically.
|
33
50
|
connect_accounts: Add External Portal Account
|
34
51
|
remote_header: "%{portal_name}: %{account_name}"
|
52
|
+
help: Help
|
35
53
|
rental:
|
36
54
|
bedrooms_html:
|
37
55
|
one: '<strong>1</strong> Bedroom'
|
data/config/routes.rb
CHANGED
data/lib/bookingsync_portal.rb
CHANGED
@@ -69,6 +69,9 @@ module BookingsyncPortal
|
|
69
69
|
mattr_accessor :connection_resource
|
70
70
|
@@connection_resource = 'BookingsyncPortal::AdminApi::ConnectionResource'
|
71
71
|
|
72
|
+
# source name for use in bookings
|
73
|
+
mattr_accessor :source_name
|
74
|
+
|
72
75
|
# handle synchronization of rentals after connection is made
|
73
76
|
def self.connection_created(connection)
|
74
77
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bookingsync_portal
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Piotr Marciniak
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2016-01-
|
13
|
+
date: 2016-01-19 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rails
|
@@ -333,6 +333,7 @@ files:
|
|
333
333
|
- README.md
|
334
334
|
- Rakefile
|
335
335
|
- app/assets/images/bookingsync_portal/bookingsync.png
|
336
|
+
- app/assets/images/bookingsync_portal/help/connect.gif
|
336
337
|
- app/assets/javascripts/bookingsync_portal/admin/application.js.coffee
|
337
338
|
- app/assets/javascripts/bookingsync_portal/admin/handle_remote_errors.js.coffee
|
338
339
|
- app/assets/javascripts/bookingsync_portal/admin/lib/list-filter.js.coffee
|
@@ -343,6 +344,7 @@ files:
|
|
343
344
|
- app/assets/javascripts/bookingsync_portal/admin/vendor/css-contains.js
|
344
345
|
- app/assets/stylesheets/bookingsync_portal/admin/application.css.scss
|
345
346
|
- app/controllers/bookingsync_portal/admin/base_controller.rb
|
347
|
+
- app/controllers/bookingsync_portal/admin/help_controller.rb
|
346
348
|
- app/controllers/bookingsync_portal/admin/remote_accounts_controller.rb
|
347
349
|
- app/controllers/bookingsync_portal/admin/rentals_controller.rb
|
348
350
|
- app/controllers/bookingsync_portal/admin_api/base_controller.rb
|
@@ -362,6 +364,10 @@ files:
|
|
362
364
|
- app/resources/bookingsync_portal/admin_api/remote_account_resource.rb
|
363
365
|
- app/resources/bookingsync_portal/admin_api/remote_rental_resource.rb
|
364
366
|
- app/resources/bookingsync_portal/admin_api/rental_resource.rb
|
367
|
+
- app/synchronizers/bookingsync_portal/write/ensure_source_exists.rb
|
368
|
+
- app/synchronizers/bookingsync_portal/write/source.rb
|
369
|
+
- app/views/bookingsync_portal/admin/help/_help.html.erb
|
370
|
+
- app/views/bookingsync_portal/admin/help/index.html.erb
|
365
371
|
- app/views/bookingsync_portal/admin/remote_accounts/_form.html.erb
|
366
372
|
- app/views/bookingsync_portal/admin/remote_accounts/_how_to_connect.html.erb
|
367
373
|
- app/views/bookingsync_portal/admin/remote_accounts/new.html.erb
|
@@ -372,8 +378,10 @@ files:
|
|
372
378
|
- app/views/bookingsync_portal/admin/rentals/_rental.html.erb
|
373
379
|
- app/views/bookingsync_portal/admin/rentals/index.html.erb
|
374
380
|
- app/views/bookingsync_portal/admin/rentals/show.js.erb
|
381
|
+
- app/views/layouts/bookingsync_portal/_flash.html.erb
|
375
382
|
- app/views/layouts/bookingsync_portal/_menu.html.erb
|
376
383
|
- app/views/layouts/bookingsync_portal/admin.html.erb
|
384
|
+
- app/views/layouts/bookingsync_portal/fullscreen/application.html.erb
|
377
385
|
- config/locales/en.yml
|
378
386
|
- config/routes.rb
|
379
387
|
- db/migrate/20150222172825_create_accounts.rb
|
@@ -383,6 +391,7 @@ files:
|
|
383
391
|
- db/migrate/20150222174234_create_connections.rb
|
384
392
|
- db/migrate/20150520134912_create_photos.rb
|
385
393
|
- db/migrate/20150521091056_create_rates.rb
|
394
|
+
- db/migrate/20151210164752_add_synced_source_id_to_account.rb
|
386
395
|
- lib/bookingsync_portal.rb
|
387
396
|
- lib/bookingsync_portal/engine.rb
|
388
397
|
- lib/bookingsync_portal/mash_serializer.rb
|