bookingsync_portal 0.6.0 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (25) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/bookingsync_portal/admin/application.js.coffee +4 -0
  3. data/app/assets/javascripts/bookingsync_portal/admin/connections.js.coffee +48 -0
  4. data/app/assets/javascripts/bookingsync_portal/admin/rentals.js.coffee +0 -79
  5. data/app/assets/stylesheets/bookingsync_portal/admin/application.css.scss +19 -39
  6. data/app/controllers/bookingsync_portal/admin/base_controller.rb +1 -0
  7. data/app/controllers/bookingsync_portal/admin/connections_controller.rb +45 -0
  8. data/app/controllers/bookingsync_portal/admin/rentals_controller.rb +0 -25
  9. data/app/helpers/bookingsync_portal/admin/{rentals_helper.rb → application_helper.rb} +1 -1
  10. data/app/models/bookingsync_portal/connection.rb +9 -0
  11. data/app/models/bookingsync_portal/remote_rental.rb +4 -0
  12. data/app/views/bookingsync_portal/admin/connections/create.js.erb +5 -0
  13. data/app/views/bookingsync_portal/admin/rentals/_connected_rental.html.erb +26 -28
  14. data/app/views/bookingsync_portal/admin/rentals/_new_remote_rental.html.erb +6 -0
  15. data/app/views/bookingsync_portal/admin/rentals/_remote_rental.html.erb +2 -2
  16. data/app/views/bookingsync_portal/admin/rentals/_rental.html.erb +1 -2
  17. data/app/views/bookingsync_portal/admin/rentals/index.html.erb +7 -3
  18. data/app/views/bookingsync_portal/admin/rentals/show.js.erb +3 -2
  19. data/config/locales/en.yml +3 -1
  20. data/config/routes.rb +2 -4
  21. data/lib/bookingsync_portal.rb +7 -11
  22. data/lib/bookingsync_portal/version.rb +1 -1
  23. data/lib/generators/templates/initializers/bookingsync_portal.rb +19 -7
  24. metadata +7 -4
  25. data/app/assets/javascripts/bookingsync_portal/admin/templates/rentals/connected_rental.hbs +0 -8
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 883ef9dd634929c8ad2e22a7ca7a0c1a8870c486
4
- data.tar.gz: b463a96bfd2ca504685f5cd5fc5de68b7820adca
3
+ metadata.gz: c409dc3f373173cf63975b3e7deea34767d19a3d
4
+ data.tar.gz: bea7083a6fb9bde9eeeb60da4101db6b1d501206
5
5
  SHA512:
6
- metadata.gz: 030b887351b316322b4a958e1a4ca4b7097f52e7c46898012d82de9d8a473be5b1ed90845aebb399be694eb2887a6ee811820debf9bb152a3e5c5e8ae98e8fec
7
- data.tar.gz: 647c7f128b8d5b9dd0adbffa65dfde59e9fa5291d207952d24ccc6a98580906ab6a0e137b4fe9d76a334801db51f17d539fdf76b04b7f88c08136ef71c5c3742
6
+ metadata.gz: b86598c7bca993d3105cbb5518f22cbce58c90355dc2f09c16b4ac65168423e389f4b60f07897b7ec6921f48fdc5f315f6f9efc58934c1c0a1af54bbd4195da4
7
+ data.tar.gz: 30dbf6577ba6ddfcaf4206c0e96c2f7bddcc264fe2ae4b0a99a96c0e93dd35fa2095b82a6c4af1b1a715de5e8096cb64a46c0fd78774ba5c574799595481113c
@@ -23,3 +23,7 @@
23
23
  #= require ./lib/list-filter
24
24
  #= require_tree ./templates
25
25
  #= require_tree .
26
+
27
+ window.extractIdFromDomId = (attribute) ->
28
+ if attribute
29
+ attribute.split("_").pop()
@@ -0,0 +1,48 @@
1
+ $ ->
2
+ $(".bookingsync-rental").draggable
3
+ revert: "invalid"
4
+ zIndex: 50
5
+ revertDuration: 100
6
+ cursor: "move"
7
+ containment: '.rentals-container'
8
+ appendTo: '.rentals-container'
9
+ helper: "clone"
10
+ scroll: false
11
+
12
+ start: (e, ui) ->
13
+ $(ui.helper).addClass "ui-draggable-helper"
14
+
15
+ $(".panel.panel-remote").droppable
16
+ accept: ".bookingsync-rental"
17
+ activeClass: "dropzone-active"
18
+ hoverClass: "dropzone-hover"
19
+ greedy: true
20
+ tolerance: "pointer"
21
+ drop: (event, ui) ->
22
+ remoteRentalDropZone = $(@)
23
+
24
+ rentalId = extractIdFromDomId($(ui.draggable).attr("id"))
25
+ remoteRentalId = extractIdFromDomId(remoteRentalDropZone.attr("id"))
26
+ remoteAccountId = remoteRentalDropZone.data("remote-account-id")
27
+ remoteRentalUid = remoteRentalDropZone.data("uid")
28
+
29
+ if remoteRentalId
30
+ postData = { "rental_id": rentalId, "remote_rental_id": remoteRentalId }
31
+ else
32
+ postData = { "rental_id": rentalId, "remote_account_id": remoteAccountId }
33
+ # clone new remote rental drop zone and append to the end
34
+ remoteRentalDropZone.clone().insertBefore(remoteRentalDropZone).addClass('new_rental_placeholder');
35
+
36
+ $(ui.draggable).remove()
37
+
38
+ connect_url = $('.remote-rentals-list.rentals-list').data('connect-url')
39
+
40
+ $.ajax
41
+ url: connect_url
42
+ type: "POST"
43
+ data: postData
44
+ dataType: 'script'
45
+ beforeSend: ->
46
+ $(@).addClass('loading')
47
+ success: ->
48
+ $(@).removeClass('loading')
@@ -1,83 +1,4 @@
1
1
  $ ->
2
- $(".bookingsync-rental").draggable
3
- revert: "invalid"
4
- zIndex: 50
5
- revertDuration: 100
6
- cursor: "move"
7
- containment: '.rentals-container'
8
- appendTo: '.rentals-container'
9
- helper: "clone"
10
- scroll: false
11
-
12
- start: (e, ui) ->
13
- $(ui.helper).addClass "ui-draggable-helper"
14
-
15
- $(".not-connected-remote-rental").droppable
16
- accept: ".bookingsync-rental"
17
- activeClass: "dropzone-active"
18
- hoverClass: "dropzone-hover"
19
- greedy: true
20
- tolerance: "pointer"
21
- drop: (event, ui) ->
22
- remoteRental = $(@)
23
-
24
- rentalId = parseInt($(ui.draggable).attr("id").split("_").pop())
25
- remoteRentalId = parseInt(remoteRental.attr("id").split("_").pop())
26
- remoteRentalUid = parseInt(remoteRental.data("uid"))
27
-
28
- remoteRental.replaceWith HandlebarsTemplates["rentals/connected_rental"]
29
- rentalName: $(ui.draggable).children('.panel-heading').text()
30
- rentalDescription: $(ui.draggable).children('.panel-body').html()
31
- rentalId: rentalId
32
- listingId: "Listing #" + remoteRentalUid
33
- $(ui.draggable).remove()
34
-
35
- connect_url = "/en/admin/rentals/" + rentalId + "/connect" +
36
- "?remote_rental_id=" + remoteRentalId
37
-
38
- $.ajax
39
- url: connect_url
40
- type: "PUT"
41
- dataType: 'json'
42
- beforeSend: ->
43
- $(@).addClass('loading')
44
- success: ->
45
- $(@).removeClass('loading')
46
-
47
- $(".remote-new-rental").droppable
48
- accept: ".bookingsync-rental"
49
- activeClass: "dropzone-active"
50
- hoverClass: "dropzone-hover"
51
- greedy: true
52
- tolerance: "pointer"
53
- drop: (event, ui) ->
54
- rentalId = parseInt($(ui.draggable).attr("id").split("_")[1])
55
- remoteAccountId = parseInt($(@).data("remote-account-id"))
56
-
57
- newRental = HandlebarsTemplates["rentals/connected_rental"]
58
- rentalName: $(ui.draggable).children('.panel-heading').text()
59
- rentalDescription: $(ui.draggable).children('.panel-body').html()
60
- rentalId: rentalId
61
-
62
- rentalsScrollingList = $(@).closest(".rentals-list").find(".rentals-list-scroll")
63
- $(newRental).appendTo(rentalsScrollingList).addClass('pending')
64
- rentalsScrollingList.animate
65
- scrollTop: rentalsScrollingList.prop("scrollHeight")
66
-
67
- $(ui.draggable).remove()
68
-
69
- new_connect_url = "/en/admin/rentals/" + rentalId + "/connect_to_new" +
70
- "?remote_account_id=" + remoteAccountId
71
-
72
- $.ajax
73
- url: new_connect_url
74
- type: "PUT"
75
- dataType: 'json'
76
- beforeSend: ->
77
- $(@).addClass('loading')
78
- success: ->
79
- $(@).removeClass('loading')
80
-
81
2
  for rentalsList, index in $(".rentals-list")
82
3
  inputId = "rentals-list-filter-#{index}"
83
4
  new ListFilter(
@@ -1,5 +1,3 @@
1
- $dropzone-active-bg: #fbf9ee;
2
-
3
1
  @import "font-awesome-sprockets";
4
2
  @import "font-awesome";
5
3
  @import "bootstrap-bookingsync-sprockets";
@@ -112,20 +110,6 @@ body > .footer {
112
110
  .remote-rentals-list {
113
111
  background-color: #fff;
114
112
 
115
- &.dropzone-active {
116
- border: 1px dashed darken($dropzone-active-bg, 7%);
117
- background-color: lighten($dropzone-active-bg, 2%);
118
- }
119
-
120
- &.dropzone-hover {
121
- border: 1px solid darken($dropzone-active-bg, 7%);
122
- background-color: $dropzone-active-bg;
123
-
124
- .remote-new-rental {
125
- border: 1px solid $btn-success-border;
126
- }
127
- }
128
-
129
113
  .dropzone-active {
130
114
  border: 1px dashed $btn-success-border;
131
115
  }
@@ -201,40 +185,36 @@ body > .footer {
201
185
  }
202
186
 
203
187
  .panel-connected {
204
- &.pending {
205
- border-color: darken($dropzone-active-bg, 7%);
206
-
207
- .panel-heading {
208
- background-color: $dropzone-active-bg;
209
- color: darken($dropzone-active-bg, 50%);
210
- }
211
- }
212
-
213
188
  .panel-heading {
214
189
  position: relative;
215
190
  }
216
191
 
217
- .remove-connection {
192
+ .status {
218
193
  position: absolute;
219
194
  right: 3px;
220
195
  top: 8px;
221
- border-radius: 11px;
222
-
223
- span {
224
- display: none;
225
- }
226
-
227
- &:hover {
228
- background-color: $brand-danger;
229
- border-color: $brand-danger;
230
- border-radius: $border-radius-small;
231
196
 
232
- i {
197
+ .remove-connection {
198
+ .hover_show {
233
199
  display: none;
234
200
  }
235
201
 
236
- span {
237
- display: block;
202
+ .fa-check {
203
+ border-radius: 11px;
204
+ }
205
+
206
+ &:hover {
207
+ background-color: $brand-danger;
208
+ border-color: $brand-danger;
209
+ border-radius: $border-radius-small;
210
+
211
+ .hover_hide {
212
+ display: none;
213
+ }
214
+
215
+ .hover_show {
216
+ display: block;
217
+ }
238
218
  }
239
219
  }
240
220
  }
@@ -3,6 +3,7 @@ require 'bookingsync_application/admin/common_base_controller'
3
3
  module BookingsyncPortal
4
4
  module Admin
5
5
  class BaseController < ApplicationController
6
+ helper BookingsyncPortal::Admin::ApplicationHelper
6
7
  layout 'bookingsync_portal/admin'
7
8
  respond_to :html
8
9
  include BookingsyncApplication::Admin::CommonBaseController
@@ -0,0 +1,45 @@
1
+ module BookingsyncPortal
2
+ module Admin
3
+ class ConnectionsController < Admin::BaseController
4
+ def create
5
+ if remote_account? && BookingsyncPortal.create_remote_rental
6
+ new_remote_rental = BookingsyncPortal.remote_rental_model.constantize.new(remote_account: remote_account)
7
+ @connection = rental.create_connection(remote_rental: new_remote_rental)
8
+ else
9
+ @connection = rental.create_connection(remote_rental: remote_rental)
10
+ end
11
+
12
+ respond_to do |wants|
13
+ wants.html { redirect_to admin_rentals_path }
14
+ wants.js
15
+ end
16
+ end
17
+
18
+ def destroy
19
+ connection = current_account.connections.find(params[:id]).destroy
20
+
21
+ respond_to do |wants|
22
+ wants.html { redirect_to admin_rentals_path }
23
+ end
24
+ end
25
+
26
+ private
27
+
28
+ def rental
29
+ @rental ||= current_account.rentals.not_connected.visible.find(params[:rental_id])
30
+ end
31
+
32
+ def remote_rental
33
+ @remote_rental ||= current_account.remote_rentals.not_connected.find(params[:remote_rental_id])
34
+ end
35
+
36
+ def remote_account
37
+ @remote_account ||= current_account.remote_accounts.find(params[:remote_account_id])
38
+ end
39
+
40
+ def remote_account?
41
+ params[:remote_account_id].present? && remote_account
42
+ end
43
+ end
44
+ end
45
+ end
@@ -16,24 +16,6 @@ module BookingsyncPortal
16
16
  rental
17
17
  end
18
18
 
19
- def connect
20
- remote_rental = current_account.remote_rentals.find(params[:remote_rental_id])
21
- connection = rental.build_connection(remote_rental: remote_rental)
22
- connection.save
23
-
24
- BookingsyncPortal.connection_created(connection)
25
- redirect_or_js_response
26
- end
27
-
28
- def disconnect
29
- connection = rental.connection
30
- rental.remote_rental.update_attribute(:synchronized_at, nil)
31
- connection.destroy
32
-
33
- BookingsyncPortal.connection_destroyed(connection)
34
- redirect_or_js_response
35
- end
36
-
37
19
  private
38
20
 
39
21
  def synchronize_rentals
@@ -49,13 +31,6 @@ module BookingsyncPortal
49
31
  def rental
50
32
  @rental ||= current_account.rentals.visible.find(params[:id])
51
33
  end
52
-
53
- def redirect_or_js_response
54
- respond_to do |wants|
55
- wants.html { redirect_to admin_rentals_path }
56
- wants.json { head :ok }
57
- end
58
- end
59
34
  end
60
35
  end
61
36
  end
@@ -1,6 +1,6 @@
1
1
  module BookingsyncPortal
2
2
  module Admin
3
- module RentalsHelper
3
+ module ApplicationHelper
4
4
  def rental_details(rental)
5
5
  scope = 'bookingsync_portal.admin.rentals.rental'
6
6
 
@@ -9,6 +9,15 @@ class BookingsyncPortal::Connection < ActiveRecord::Base
9
9
 
10
10
  validate :matching_accounts, if: -> { rental && remote_rental }
11
11
 
12
+ after_save :notify_via_message_bus
13
+ after_destroy :notify_via_message_bus
14
+
15
+ def notify_via_message_bus
16
+ MessageBus.publish "/account-#{rental.account_id}", { refresh_from:
17
+ BookingsyncPortal::Engine.routes.url_helpers.admin_rental_path(rental, format: :js)
18
+ }
19
+ end
20
+
12
21
  private
13
22
 
14
23
  def matching_accounts?
@@ -17,6 +17,10 @@ class BookingsyncPortal::RemoteRental < ActiveRecord::Base
17
17
  scope :connected, -> { joins(:rental) }
18
18
  scope :not_connected, -> { includes(:rental).where(rentals: { id: nil }) }
19
19
 
20
+ def display_name
21
+ uid
22
+ end
23
+
20
24
  def connected?
21
25
  rental.present?
22
26
  end
@@ -0,0 +1,5 @@
1
+ <%- if @connection.persisted? %>
2
+ $("#<%= dom_id @connection.remote_rental %>, .new_rental_placeholder").replaceWith(
3
+ "<%=j render 'bookingsync_portal/admin/rentals/connected_rental', rental: @connection.rental, remote_rental: @connection.remote_rental,
4
+ disconnect_url: bookingsync_portal.admin_connection_url(@connection) %>");
5
+ <%- end %>
@@ -1,31 +1,29 @@
1
- <%-
2
- disconnect_label = content_tag(:i, "", { class: 'fa fa-check' }) + h(" ") +
3
- content_tag(:span, t('.disconnect_rental'))
4
- -%>
5
- <div
6
- class="panel panel-connected <%= "pending" unless remote_rental.synchronized? %>"
7
- id="<%= dom_id rental %>">
8
- <% if rental.remote_rental.synchronized? %>
9
- <div class="panel-body-grid">
10
- <div class="panel-body-grid-photo">
11
- <%- if rental.ordered_photos.first -%>
12
- <%= image_tag rental.ordered_photos.first.thumb_url, class: "img-responsive" %>
13
- <%- end -%>
14
- </div>
15
- <div class="panel-body-grid-text">
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>
20
- <%= link_to disconnect_label,
21
- bookingsync_portal.disconnect_admin_rental_path(rental),
22
- class: "btn btn-default btn-xs btn-success remove-connection",
23
- data: { disable_with: t('.disconnecting_rental') },
24
- method: :put %>
25
- <p class="text-overflow"><%= rental_details(rental) %></p>
1
+ <div id="<%= dom_id rental %>"
2
+ class="panel panel-connected <%= "pending" unless rental.remote_rental.synchronized? %>">
3
+
4
+ <div class="panel-body-grid">
5
+ <div class="panel-body-grid-photo">
6
+ <%- if rental.ordered_photos.first -%>
7
+ <%= image_tag rental.ordered_photos.first.thumb_url, class: "img-responsive" %>
8
+ <%- end -%>
9
+ </div>
10
+ <div class="panel-body-grid-text">
11
+ <h4 title="<%= RemoteRental.human_attribute_name(:uid) %>: <%= remote_rental.uid %>">
12
+ <%= remote_rental.display_name %> / <%= rental.name %>
13
+ </h4>
14
+ <div class="status">
15
+ <%= link_to bookingsync_portal.admin_connection_path(rental.connection),
16
+ class: ["btn", "btn-xs", "remove-connection", rental.remote_rental.synchronized? ? "btn-success" : "btn-warning"],
17
+ data: { disable_with: t('.disconnecting_rental') }, method: :delete do %>
18
+ <% unless rental.remote_rental.synchronized? %>
19
+ <span class="hover_hide"><%= icon('spinner') %></span>
20
+ <% else %>
21
+ <span class="hover_hide"><%= icon('check') %></span>
22
+ <% end %>
23
+ <span class="hover_show"><%= t('.disconnect_rental') %></span>
24
+ <% end %>
26
25
  </div>
26
+ <p class="text-overflow"><%= rental_details(rental) %></p>
27
27
  </div>
28
- <% else %>
29
- <div class="panel-body"><%= icon('spinner fa-spin', t('.synchronizing')) %></div>
30
- <% end %>
28
+ </div>
31
29
  </div>
@@ -0,0 +1,6 @@
1
+ <div class="panel panel-remote"
2
+ data-remote-account-id="<%= remote_account.id %>">
3
+ <div class="panel-body-grid text-center">
4
+ <%=t ".drop_here", portal_name: BookingsyncPortal.portal_name %>
5
+ </div>
6
+ </div>
@@ -1,11 +1,11 @@
1
- <div class="panel panel-remote not-connected-remote-rental" id="<%= dom_id remote_rental %>"
1
+ <div class="panel panel-remote" id="<%= dom_id remote_rental %>"
2
2
  data-uid="<%= remote_rental.uid %>">
3
3
  <div class="panel-body-grid">
4
4
  <div class="panel-body-grid-photo">
5
5
  </div>
6
6
  <div class="panel-body-grid-text">
7
7
  <h4 title="<%= RemoteRental.human_attribute_name(:uid) %>
8
- <%= remote_rental.uid %>"><%= remote_rental.name %></h4>
8
+ <%= remote_rental.uid %>"><%= remote_rental.display_name %></h4>
9
9
  <p class="text-overflow"></p>
10
10
  </div>
11
11
  </div>
@@ -1,6 +1,5 @@
1
1
  <div class="panel panel-bookingsync bookingsync-rental"
2
- id="<%= dom_id rental %>"
3
- data-connect-url="<%= connect_admin_rental_url(rental) %>">
2
+ id="<%= dom_id rental %>">
4
3
  <div class="panel-body-grid">
5
4
  <div class="panel-body-grid-photo">
6
5
  <%- if rental.ordered_photos.first -%>
@@ -28,7 +28,8 @@
28
28
  </div>
29
29
  </div>
30
30
  <div class="col-xs-6">
31
- <div class="remote-rentals-list rentals-list">
31
+ <div class="remote-rentals-list rentals-list"
32
+ data-connect-url="<%= bookingsync_portal.admin_connections_url %>">
32
33
  <div class="rentals-list-header">
33
34
  <legend class="text-center">
34
35
  <%= image_tag("#{BookingsyncPortal.portal_name.parameterize}.png",
@@ -48,12 +49,15 @@
48
49
  <%= render "remote_rental", remote_rental: remote_rental %>
49
50
  <% end %>
50
51
  <% end %>
51
- <%- else -%>
52
+ <%- elsif !BookingsyncPortal.create_remote_rental -%>
52
53
  <div class="lead text-center well">
53
54
  <p class=""><%= icon 'info fa-lg' %></p>
54
- <p><%=t '.create_listings_first' %></p>
55
+ <p><%=t '.create_listings_first', portal_name: BookingsyncPortal.portal_name %></p>
55
56
  </div>
56
57
  <%- end -%>
58
+ <%- if BookingsyncPortal.create_remote_rental -%>
59
+ <%= render "new_remote_rental", remote_account: remote_account %>
60
+ <%- end -%>
57
61
  <% end %>
58
62
  </div>
59
63
  <div class="rentals-list-footer text-center">
@@ -1,6 +1,7 @@
1
1
  $("#<%= dom_id @rental %>").replaceWith(
2
2
  <%- if @rental.connected? %>
3
- "<%=j render 'connected_rental', rental: @rental, remote_rental: @rental.remote_rental %>");
3
+ "<%=j render 'connected_rental', rental: @rental, remote_rental: @rental.remote_rental,
4
+ disconnect_url: bookingsync_portal.admin_connection_url(@rental.connection) %>");
4
5
  <%- else %>
5
- "<%=j render 'rental', rental: @rental %>");
6
+ "<%=j render 'rental', rental: @rental %>");
6
7
  <%- end %>
@@ -41,12 +41,14 @@ en:
41
41
  rentals:
42
42
  new_remote_account:
43
43
  connect_accounts: Connect additional accounts
44
+ new_remote_rental:
45
+ drop_here: "Drop here to create a new rental on %{portal_name}"
44
46
  index:
45
47
  connect: Connect
46
48
  bookingsync_header: "BookingSync: %{account_name}"
47
49
  all_synchronized: Perfect! All your rentals are synchronized.
48
50
  no_published_rentals_html: 'No published rentals present, please make sure to <a href="https://www.bookingsync.com/en/admin/v2/%{id}/rentals" target="_blank">fill all your rentals details</a>.'
49
- create_listings_first: You must create your rentals on Remote Account before you can synchronize them automatically.
51
+ create_listings_first: "You must create your rentals on %{portal_name} before you can synchronize them automatically."
50
52
  connect_accounts: Add External Portal Account
51
53
  remote_header: "%{portal_name}: %{account_name}"
52
54
  help: Help
@@ -1,9 +1,7 @@
1
1
  BookingsyncPortal::Engine.routes.draw do
2
2
  namespace :admin do
3
- resources :rentals, only: [:index, :show] do
4
- put :disconnect, on: :member
5
- put :connect, on: :member
6
- end
3
+ resources :rentals, only: [:index, :show]
4
+ resources :connections, only: [:create, :destroy]
7
5
  resources :remote_accounts, only: [:new, :create]
8
6
  get 'help', to: 'help#index'
9
7
  root to: 'rentals#index'
@@ -21,6 +21,13 @@ module BookingsyncPortal
21
21
  mattr_accessor :portal_name
22
22
  @@portal_name = 'Portal'
23
23
 
24
+ # source name for use in bookings
25
+ mattr_accessor :source_name
26
+
27
+ # Allow to create a remote rental from this app.
28
+ mattr_accessor :create_remote_rental
29
+ @@create_remote_rental = false
30
+
24
31
  # account model class
25
32
  mattr_accessor :account_model
26
33
  @@account_model = 'BookingsyncPortal::Account'
@@ -49,20 +56,9 @@ module BookingsyncPortal
49
56
  mattr_accessor :rate_model
50
57
  @@rate_model = 'BookingsyncPortal::Rate'
51
58
 
52
- # source name for use in bookings
53
- mattr_accessor :source_name
54
-
55
59
  # message bus channel scope
56
60
  mattr_accessor :message_bus_channel_scope
57
61
 
58
- # handle synchronization of rentals after connection is made
59
- def self.connection_created(connection)
60
- end
61
-
62
- # handle synchronization of rentals after connection is destroyed
63
- def self.connection_destroyed(connection)
64
- end
65
-
66
62
  # fetch remote rentals
67
63
  def self.fetch_remote_rentals(account)
68
64
  # return false if remote account is not present or not valid
@@ -1,3 +1,3 @@
1
1
  module BookingsyncPortal
2
- VERSION = '0.6.0'
2
+ VERSION = '0.7.0'
3
3
  end
@@ -1,5 +1,17 @@
1
1
  # Use this to customize the behaviour of BookingsyncPortal engine and hook up custom synchronization
2
2
  BookingsyncPortal.setup do |config|
3
+ # customize the portal name
4
+ config.portal_name = "Replace with portal app name"
5
+
6
+ # customize the source name
7
+ config.source_name = "Replace with portal name"
8
+
9
+ # specify message_bus_channel_scope to allow shared redis setup
10
+ config.message_bus_channel_scope = 'portal_app_name'
11
+
12
+ # Allow to create a remote rental directly from this app.
13
+ config.create_remote_rental = false
14
+
3
15
  # customize account model class, can extend BookingsyncPortal::Account
4
16
  config.account_model = '::Account'
5
17
 
@@ -22,15 +34,15 @@ BookingsyncPortal.setup do |config|
22
34
  config.rate_model = '::Rate'
23
35
 
24
36
  # handle synchronization of rentals after connection is made
25
- def config.connection_created(connection)
26
- end
37
+ # def config.connection_created(connection)
38
+ # end
27
39
 
28
40
  # handle synchronization of rentals after connection is destroyed
29
- def config.connection_destroyed(connection)
30
- end
41
+ # def config.connection_destroyed(connection)
42
+ # end
31
43
 
32
44
  # fetch remote rentals
33
- def config.fetch_remote_rentals(account)
34
- # return false if remote account is not present or not valid
35
- end
45
+ # def config.fetch_remote_rentals(account)
46
+ # return false if remote account is not present or not valid
47
+ # end
36
48
  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.6.0
4
+ version: 0.7.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-02-09 00:00:00.000000000 Z
13
+ date: 2016-02-18 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rails
@@ -335,20 +335,21 @@ files:
335
335
  - app/assets/images/bookingsync_portal/bookingsync.png
336
336
  - app/assets/images/bookingsync_portal/help/connect.gif
337
337
  - app/assets/javascripts/bookingsync_portal/admin/application.js.coffee
338
+ - app/assets/javascripts/bookingsync_portal/admin/connections.js.coffee
338
339
  - app/assets/javascripts/bookingsync_portal/admin/handle_remote_errors.js.coffee
339
340
  - app/assets/javascripts/bookingsync_portal/admin/lib/list-filter.js.coffee
340
341
  - app/assets/javascripts/bookingsync_portal/admin/live_updates.js.coffee
341
342
  - app/assets/javascripts/bookingsync_portal/admin/rentals.js.coffee
342
343
  - app/assets/javascripts/bookingsync_portal/admin/templates/filter_input.hbs
343
- - app/assets/javascripts/bookingsync_portal/admin/templates/rentals/connected_rental.hbs
344
344
  - app/assets/javascripts/bookingsync_portal/admin/vendor/css-contains.js
345
345
  - app/assets/stylesheets/bookingsync_portal/admin/application.css.scss
346
346
  - app/controllers/bookingsync_portal/admin/base_controller.rb
347
+ - app/controllers/bookingsync_portal/admin/connections_controller.rb
347
348
  - app/controllers/bookingsync_portal/admin/help_controller.rb
348
349
  - app/controllers/bookingsync_portal/admin/remote_accounts_controller.rb
349
350
  - app/controllers/bookingsync_portal/admin/rentals_controller.rb
350
351
  - app/controllers/bookingsync_portal/application_controller.rb
351
- - app/helpers/bookingsync_portal/admin/rentals_helper.rb
352
+ - app/helpers/bookingsync_portal/admin/application_helper.rb
352
353
  - app/models/bookingsync_portal/account.rb
353
354
  - app/models/bookingsync_portal/connection.rb
354
355
  - app/models/bookingsync_portal/photo.rb
@@ -358,6 +359,7 @@ files:
358
359
  - app/models/bookingsync_portal/rental.rb
359
360
  - app/synchronizers/bookingsync_portal/write/ensure_source_exists.rb
360
361
  - app/synchronizers/bookingsync_portal/write/source.rb
362
+ - app/views/bookingsync_portal/admin/connections/create.js.erb
361
363
  - app/views/bookingsync_portal/admin/help/_help.html.erb
362
364
  - app/views/bookingsync_portal/admin/help/index.html.erb
363
365
  - app/views/bookingsync_portal/admin/remote_accounts/_form.html.erb
@@ -365,6 +367,7 @@ files:
365
367
  - app/views/bookingsync_portal/admin/remote_accounts/new.html.erb
366
368
  - app/views/bookingsync_portal/admin/rentals/_connected_rental.html.erb
367
369
  - app/views/bookingsync_portal/admin/rentals/_new_remote_account.html.erb
370
+ - app/views/bookingsync_portal/admin/rentals/_new_remote_rental.html.erb
368
371
  - app/views/bookingsync_portal/admin/rentals/_remote_rental.html.erb
369
372
  - app/views/bookingsync_portal/admin/rentals/_rental.html.erb
370
373
  - app/views/bookingsync_portal/admin/rentals/index.html.erb
@@ -1,8 +0,0 @@
1
- <div class="panel panel-connected" id="rental_{{rentalId}}"}}>
2
- <div class="panel-heading" title="{{listingId}}">{{rentalName}}
3
- <a href="/en/admin/rentals/{{rentalId}}/disconnect"
4
- class="btn btn-default btn-xs remove-connection"
5
- data-method="put">Remove Connection</a>
6
- </div>
7
- <div class="panel-body"><i class="fa fa-spinner fa-spin"></i> Synchronizing...</div>
8
- </div>