bookingsync_portal 0.2.0 → 0.3.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.
Files changed (25) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +6 -0
  3. data/app/assets/images/bookingsync_portal/bookingsync.png +0 -0
  4. data/app/assets/javascripts/bookingsync_portal/admin/application.js.coffee +23 -0
  5. data/app/assets/javascripts/bookingsync_portal/admin/lib/list-filter.js.coffee +28 -0
  6. data/app/assets/javascripts/bookingsync_portal/admin/rentals.js.coffee +18 -4
  7. data/app/assets/javascripts/bookingsync_portal/admin/templates/filter_input.hbs +6 -0
  8. data/app/assets/javascripts/bookingsync_portal/admin/vendor/css-contains.js +29 -0
  9. data/app/assets/stylesheets/bookingsync_portal/admin/application.css.scss +121 -14
  10. data/app/views/bookingsync_portal/admin/remote_accounts/_form.html.erb +5 -5
  11. data/app/views/bookingsync_portal/admin/remote_accounts/new.html.erb +1 -1
  12. data/app/views/bookingsync_portal/admin/rentals/_connected_rental.html.erb +12 -10
  13. data/app/views/bookingsync_portal/admin/rentals/_new_remote_account.html.erb +3 -5
  14. data/app/views/bookingsync_portal/admin/rentals/_remote_rental.html.erb +8 -6
  15. data/app/views/bookingsync_portal/admin/rentals/_rental.html.erb +2 -4
  16. data/app/views/bookingsync_portal/admin/rentals/index.html.erb +46 -38
  17. data/app/views/layouts/bookingsync_portal/_menu.html.erb +11 -0
  18. data/app/views/layouts/bookingsync_portal/admin.html.erb +8 -5
  19. data/config/locales/en.yml +5 -3
  20. data/lib/bookingsync_portal.rb +3 -0
  21. data/lib/bookingsync_portal/version.rb +1 -1
  22. metadata +10 -7
  23. data/app/assets/javascripts/bookingsync_portal/admin/application.js +0 -20
  24. data/app/assets/javascripts/bookingsync_portal/admin/list_filters.js +0 -67
  25. data/app/assets/stylesheets/bookingsync_portal/admin/_list_filters.scss +0 -8
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7bce44a09e365af14bee6025bdbaf505b5cbaa3e
4
- data.tar.gz: 672dc73f92f93d0d3e0d9aa18199b73b201d7ded
3
+ metadata.gz: 29ab3ee00bd840c8750a4e73b1cb838d6b40e081
4
+ data.tar.gz: c150bf73675d7ac922fb898ab33d1d7b8cc64760
5
5
  SHA512:
6
- metadata.gz: cb08b602aef04800fd3608c2db757bb2b8d5b8aa0ae62611d4bfe66c4926638511476a4401ebe22684ed15b5c0b434ccab5d8f45f94990038b4d0acfbf44b749
7
- data.tar.gz: d0026be5f43c6fe11bd6b240f36f719ef0eecc243468a116433e3b23e179dbe16401dc70cb33d61edb3678913b3bb957be8b1c0049f3b73767d847fccb8d54b9
6
+ metadata.gz: 50afcce183c586ea3409abd2595b7bbc4f1ffd4c13a8a94b02b94f6fb2a7d857da6f09617f4d6549ec1ab5ea92fea48fe145bc60b5b291b3b51a826c66543dfd
7
+ data.tar.gz: 4c71e8270a265cc20093062bde77b39c548497dc3757c256654495318632893be76802a624a7d8cc6f74d2842f24c34b34461371b1cef2939989801317228055
data/README.md CHANGED
@@ -139,6 +139,12 @@ The engine is configured by the following ENV variables:
139
139
  You might want to use [dotenv-rails](https://github.com/bkeepers/dotenv)
140
140
  to make ENV variables management easy.
141
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
+
142
148
  ## Testing
143
149
 
144
150
  ### RSpec
@@ -0,0 +1,23 @@
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/draggable
16
+ #= require jquery-ui/droppable
17
+ #= require handlebars.runtime
18
+ #= require message-bus
19
+ #= require bookingsync/form
20
+ #= require ./vendor/css-contains
21
+ #= require ./lib/list-filter
22
+ #= require_tree ./templates
23
+ #= require_tree .
@@ -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
+ @showElements @listFilterable + ":not(:Contains(" + filter + "))"
18
+ @hideElements @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).slideUp()
26
+
27
+ hideElements: (elements) ->
28
+ @list.find(elements).parents(@listElement).slideDown()
@@ -19,11 +19,13 @@ $ ->
19
19
  greedy: true
20
20
  tolerance: "pointer"
21
21
  drop: (event, ui) ->
22
- rentalId = parseInt($(ui.draggable).attr("id").split("_")[1])
23
- remoteRentalId = parseInt($(@).attr("id").split("_")[2])
24
- remoteRentalUid = parseInt($(@).data("uid"))
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"))
25
27
 
26
- $(@).replaceWith HandlebarsTemplates["rentals/connected_rental"]
28
+ remoteRental.replaceWith HandlebarsTemplates["rentals/connected_rental"]
27
29
  rentalName: $(ui.draggable).children('.panel-heading').text()
28
30
  rentalDescription: $(ui.draggable).children('.panel-body').html()
29
31
  rentalId: rentalId
@@ -75,3 +77,15 @@ $ ->
75
77
  $(@).addClass('loading')
76
78
  success: ->
77
79
  $(@).removeClass('loading')
80
+
81
+ for rentalsList, index in $(".rentals-list")
82
+ inputId = "rentals-list-filter-#{index}"
83
+ new ListFilter(
84
+ $(rentalsList).children(".rentals-list-header"),
85
+ $(rentalsList).children(".rentals-list-scroll"),
86
+ ".panel",
87
+ ".panel h4",
88
+ inputId,
89
+ HandlebarsTemplates["filter_input"]
90
+ inputId: inputId
91
+ )
@@ -0,0 +1,6 @@
1
+ <form class="filterform" action="#">
2
+ <div class="form-group">
3
+ <label class="control-label" for="{{inputId}}">Search in listings</label>
4
+ <input class="filterinput form-control" type="text" id="{{inputId}}">
5
+ </div>
6
+ </form>
@@ -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);
@@ -2,9 +2,8 @@ $dropzone-active-bg: #fbf9ee;
2
2
 
3
3
  @import "font-awesome-sprockets";
4
4
  @import "font-awesome";
5
- @import "bootstrap-sprockets";
6
- @import "bootstrap";
7
- @import 'list_filters';
5
+ @import "bootstrap-bookingsync-sprockets";
6
+ @import "bootstrap-bookingsync";
8
7
 
9
8
  html, body {
10
9
  height: 100%;
@@ -16,12 +15,20 @@ body > .footer {
16
15
  clear: both;
17
16
  }
18
17
 
19
- #remote_account_uid {
20
- text-align: center;
18
+ .container-fullscreen {
19
+ height: 100%;
20
+ width: 100%;
21
21
  }
22
22
 
23
23
  .rentals-container {
24
24
  height: 100%;
25
+ padding: ceil($grid-gutter-width / 2) 0;
26
+ margin: 0 (-1 * ceil($grid-gutter-width / 2));
27
+
28
+ & > div {
29
+ height: 100%;
30
+ min-width: 300px;
31
+ }
25
32
  }
26
33
 
27
34
  .rentals-list {
@@ -29,19 +36,68 @@ body > .footer {
29
36
  display: flex;
30
37
  flex-direction: column;
31
38
  overflow: auto;
39
+ padding: ceil($grid-gutter-width / 2);
40
+ border-radius: 4px;
41
+ border: 1px solid $gray-lighter;
42
+
43
+ legend {
44
+ border: 0;
45
+ }
46
+
47
+ h3 {
48
+ border-top: 1px solid $gray-lighter;
49
+ font-size: 14px;
50
+ padding: 10px 10px;
51
+ margin: 0;
52
+ }
53
+ }
54
+
55
+ .filterform {
56
+ margin-bottom: 10px;
57
+ width: 90%;
58
+ margin-left: 5%;
59
+ font-size: small;
32
60
  }
33
61
 
34
62
  .rentals-list-header, .rentals-list-footer {
35
63
  flex: 0 0 auto;
36
64
  }
37
65
 
66
+ .rentals-list-header {
67
+ img {
68
+ height: 29px;
69
+ }
70
+ }
71
+
72
+ .rentals-list-footer {
73
+ border-top: 1px solid $gray-lighter;
74
+ margin-left: (-1 * ceil($grid-gutter-width / 2));
75
+ margin-right: (-1 * ceil($grid-gutter-width / 2));
76
+ padding-top: 8px;
77
+ margin-bottom: (-1 * ceil($grid-gutter-width / 2)) + 8px;
78
+ }
79
+
38
80
  .rentals-list-scroll {
39
- flex: 0 0 auto;
81
+ flex: 1 1 auto;
40
82
  overflow-y: auto;
83
+ margin-left: (-1 * ceil($grid-gutter-width / 2));
84
+ margin-right: (-1 * ceil($grid-gutter-width / 2));
85
+
86
+ .well {
87
+ border-left: 0;
88
+ border-right: 0;
89
+ border-radius: 0;
90
+ box-shadow: none;
91
+ background-color: $body-bg;
92
+
93
+ i {
94
+ color: $gray-light;
95
+ }
96
+ }
41
97
  }
42
98
 
43
99
  .remote-rentals-list {
44
- border: 1px solid transparent;
100
+ background-color: #fff;
45
101
 
46
102
  &.dropzone-active {
47
103
  border: 1px dashed darken($dropzone-active-bg, 7%);
@@ -66,31 +122,61 @@ body > .footer {
66
122
  }
67
123
  }
68
124
 
69
- .ui-draggable-helper {
70
- opacity: 0.6;
125
+ .rentals-container .panel-bookingsync.ui-draggable-dragging {
126
+ box-shadow: 0 0 10px $gray-light;
127
+ background-color: #fff;
128
+ height: auto;
129
+ border: 1px solid $gray-lighter;
130
+ width: 31%;
131
+ transform: scale(1.1);
132
+ }
133
+
134
+ .panel {
135
+ padding: 10px;
136
+ border-radius: 0;
137
+ margin-bottom: 0;
138
+ border-top: 1px solid $gray-lighter;
139
+ border-bottom: 1px solid $gray-lighter;
140
+ position: relative;
141
+
142
+ & + .panel,
143
+ & + h3 {
144
+ border-top: 0;
145
+ }
71
146
  }
72
147
 
73
148
  .panel-body-grid {
74
149
  display: flex;
150
+ overflow: hidden;
75
151
  }
76
152
 
77
153
  .panel-body-grid-photo {
78
154
  min-width: 96px;
155
+ height: 64px;
79
156
  flex-grow: 0;
157
+ background-color: rgba(255, 255, 255, 0.8);
80
158
  }
81
159
 
82
160
  .panel-body-grid-text {
83
- padding: $padding-base-vertical $padding-base-horizontal;
161
+ padding: 0 $padding-base-horizontal;
84
162
  flex-grow: 1;
163
+ overflow: hidden;
164
+
165
+ h4 {
166
+ margin: 0 0 10px 0;
167
+ }
168
+
169
+ p {
170
+ margin: 0;
171
+ font-size: 12px;
172
+ }
85
173
  }
86
174
 
87
175
  .panel-bookingsync {
88
- @extend .panel-info;
176
+ background-color: $body-bg;
89
177
  }
90
178
 
91
179
  .panel-connected {
92
- @extend .panel-success;
93
-
94
180
  &.pending {
95
181
  border-color: darken($dropzone-active-bg, 7%);
96
182
 
@@ -108,15 +194,36 @@ body > .footer {
108
194
  position: absolute;
109
195
  right: 3px;
110
196
  top: 8px;
197
+ border-radius: 11px;
198
+
199
+ span {
200
+ display: none;
201
+ }
202
+
203
+ &:hover {
204
+ background-color: $brand-danger;
205
+ border-color: $brand-danger;
206
+ border-radius: $border-radius-small;
207
+
208
+ i {
209
+ display: none;
210
+ }
211
+
212
+ span {
213
+ display: block;
214
+ }
215
+ }
111
216
  }
112
217
  }
113
218
 
114
219
  .panel-remote {
115
- @extend .panel-default;
220
+ background-color: $body-bg;
221
+ opacity: 0.5;
116
222
  }
117
223
 
118
224
  .panel.ui-draggable {
119
225
  &:hover {
120
226
  cursor: move;
227
+ background-color: #fff;
121
228
  }
122
229
  }
@@ -1,11 +1,11 @@
1
- <div class="col-sm-offset-4 col-sm-4 form-group">
1
+ <div class="col-sm-offset-4 col-sm-4">
2
2
  <%= simple_form_for [:admin, remote_account] do |f| -%>
3
- <div class="form-group">
4
- <%= f.input :uid, input_html: { class: 'input-lg form-control' } -%>
5
- </div>
3
+ <%= f.input :uid, wrapper_html: { class: 'form-group' },
4
+ label_html: { class: 'label-lg' }, input_html: { class: 'input-lg form-control' } -%>
6
5
 
7
6
  <div class="form-group">
8
- <%= f.submit t('.submit_new'), class: "btn btn-primary btn-lg btn-block" %>
7
+ <%= f.submit t('.submit_new', portal_name: BookingsyncPortal.portal_name),
8
+ class: "btn btn-primary btn-lg btn-block" %>
9
9
  </div>
10
10
  <%- end -%>
11
11
  </div>
@@ -1,5 +1,5 @@
1
1
  <div class="text-center">
2
- <h1><%=t '.title' %></h1>
2
+ <h1><%=t '.title', portal_name: BookingsyncPortal.portal_name %></h1>
3
3
  <%= render 'how_to_connect' %>
4
4
  <%= render 'form', remote_account: @remote_account %>
5
5
  </div>
@@ -1,15 +1,10 @@
1
+ <%-
2
+ disconnect_label = content_tag(:i, "", { class: 'fa fa-check' }) + h(" ") +
3
+ content_tag(:span, t('.disconnect_rental'))
4
+ -%>
1
5
  <div
2
6
  class="panel panel-connected <%= "pending" unless remote_rental.synchronized? %>"
3
7
  id="<%= dom_id rental %>">
4
- <div class="panel-heading" title="<%= RemoteRental.human_attribute_name(:uid) %>
5
- <%= remote_rental.uid %>">
6
- <%= rental.name %>
7
- <%= link_to t('.disconnect_rental'),
8
- bookingsync_portal.disconnect_admin_rental_path(rental),
9
- class: "btn btn-default btn-xs remove-connection",
10
- data: {disable_with: t('.disconnecting_rental')},
11
- method: :put %>
12
- </div>
13
8
  <% if rental.remote_rental.synchronized? %>
14
9
  <div class="panel-body-grid">
15
10
  <div class="panel-body-grid-photo">
@@ -18,7 +13,14 @@
18
13
  <%- end -%>
19
14
  </div>
20
15
  <div class="panel-body-grid-text">
21
- <%= rental_details(rental) %>
16
+ <h4 title="<%= RemoteRental.human_attribute_name(:uid) %>
17
+ <%= remote_rental.uid %>"><%= remote_rental.name %></h4>
18
+ <%= link_to disconnect_label,
19
+ bookingsync_portal.disconnect_admin_rental_path(rental),
20
+ class: "btn btn-default btn-xs btn-success remove-connection",
21
+ data: { disable_with: t('.disconnecting_rental') },
22
+ method: :put %>
23
+ <p class="text-overflow"><%= rental_details(rental) %></p>
22
24
  </div>
23
25
  </div>
24
26
  <% else %>
@@ -1,5 +1,3 @@
1
- <div>
2
- <%= link_to new_admin_remote_account_path, class: "btn btn-primary btn-lg btn-block" do %>
3
- <%= icon "plus-circle" %> <%= t '.connect_accounts' %>
4
- <% end %>
5
- </div>
1
+ <%= link_to new_admin_remote_account_path, class: "btn btn-default" do %>
2
+ <%= icon :plus %> <%= t '.connect_accounts' %>
3
+ <% end %>
@@ -1,10 +1,12 @@
1
1
  <div class="panel panel-remote not-connected-remote-rental" id="<%= dom_id remote_rental %>"
2
2
  data-uid="<%= remote_rental.uid %>">
3
- <div class="panel-heading" title="<%= RemoteRental.human_attribute_name(:uid) %>
4
- <%= remote_rental.uid %>">
5
- <%= remote_rental.remote_account.uid %>:
6
- <%= remote_rental.name %>
7
- </div>
8
- <div class="panel-body">
3
+ <div class="panel-body-grid">
4
+ <div class="panel-body-grid-photo">
5
+ </div>
6
+ <div class="panel-body-grid-text">
7
+ <h4 title="<%= RemoteRental.human_attribute_name(:uid) %>
8
+ <%= remote_rental.uid %>"><%= remote_rental.name %></h4>
9
+ <p class="text-overflow"></p>
10
+ </div>
9
11
  </div>
10
12
  </div>
@@ -1,9 +1,6 @@
1
1
  <div class="panel panel-bookingsync bookingsync-rental"
2
2
  id="<%= dom_id rental %>"
3
3
  data-connect-url="<%= connect_admin_rental_url(rental) %>">
4
- <div class="panel-heading">
5
- <%= rental.name.presence || t('.no_name') %>
6
- </div>
7
4
  <div class="panel-body-grid">
8
5
  <div class="panel-body-grid-photo">
9
6
  <%- if rental.ordered_photos.first -%>
@@ -11,7 +8,8 @@
11
8
  <%- end -%>
12
9
  </div>
13
10
  <div class="panel-body-grid-text">
14
- <%= rental_details rental %>
11
+ <h4><%= rental.name.presence || t('.no_name') %></h4>
12
+ <p class="text-overflow"><%= rental_details rental %></p>
15
13
  </div>
16
14
  </div>
17
15
  </div>
@@ -1,50 +1,58 @@
1
- <div class="rentals-container row-fluid">
2
- <div class="bookingsync-rentals-list rentals-list col-xs-4">
3
- <div class="rentals-list-header">
4
- <legend><%=t '.bookingsync_header', account_name: current_account.name %></legend>
5
- </div>
6
- <div class="rentals-list-scroll">
7
- <%- if @visible_rentals_count == 0 -%>
8
- <div class="lead text-center well">
9
- <p><%= t('.no_published_rentals_html', id: current_account.synced_id) %></p>
10
- </div>
11
- <%- elsif @not_connected_rentals.count > 0 -%>
12
- <% @not_connected_rentals.each do |rental| %>
13
- <%= render rental %>
14
- <% end %>
15
- <%- else -%>
16
- <div class="lead text-center well">
17
- <p class=""><%= icon 'thumbs-up fa-lg' %></p>
18
- <p><%=t '.all_synchronized' %></p>
19
- </div>
20
- <%- end -%>
21
- </div>
22
- </div>
23
-
24
- <div class="remote-rentals-list rentals-list col-xs-4">
25
- <% @remote_accounts.each do |remote_account| %>
1
+ <div class="rentals-container row">
2
+ <div class="col-xs-4">
3
+ <div class="bookingsync-rentals-list rentals-list">
26
4
  <div class="rentals-list-header">
27
- <legend><%=t '.remote_header', account_name: remote_account.name %></legend>
5
+ <legend class="text-center"><%= image_tag('bookingsync_portal/bookingsync.png', alt: 'BookingSync') %></legend>
28
6
  </div>
29
-
30
7
  <div class="rentals-list-scroll">
31
- <%- if Array(@remote_rentals_by_account[remote_account]).length > 0 -%>
32
- <% Array(@remote_rentals_by_account[remote_account]).each do |remote_rental| %>
33
- <% if remote_rental.connected? %>
34
- <%= render "connected_rental", remote_rental: remote_rental, rental: remote_rental.rental %>
35
- <% else %>
36
- <%= render "remote_rental", remote_rental: remote_rental %>
37
- <% end %>
8
+ <%- if @visible_rentals_count == 0 -%>
9
+ <div class="lead text-center well">
10
+ <p><%= t('.no_published_rentals_html', id: current_account.synced_id) %></p>
11
+ </div>
12
+ <%- elsif @not_connected_rentals.count > 0 -%>
13
+ <% @not_connected_rentals.each do |rental| %>
14
+ <%= render rental %>
38
15
  <% end %>
39
16
  <%- else -%>
40
17
  <div class="lead text-center well">
41
- <p class=""><%= icon 'info fa-lg' %></p>
42
- <p><%=t '.create_listings_first' %></p>
18
+ <p class=""><%= icon 'thumbs-up fa-lg' %></p>
19
+ <p><%=t '.all_synchronized' %></p>
43
20
  </div>
44
21
  <%- end -%>
45
22
  </div>
46
- <% end %>
47
- <%= render partial: 'new_remote_account' %>
23
+ </div>
24
+ </div>
25
+ <div class="col-xs-4">
26
+ <div class="remote-rentals-list rentals-list">
27
+ <div class="rentals-list-header">
28
+ <legend class="text-center"><%= image_tag("#{BookingsyncPortal.portal_name.parameterize}.png",
29
+ alt: BookingsyncPortal.portal_name) %></legend>
30
+ </div>
31
+
32
+ <div class="rentals-list-scroll">
33
+ <% @remote_accounts.each do |remote_account| %>
34
+ <h3><%=t '.remote_header', portal_name: BookingsyncPortal.portal_name,
35
+ account_name: remote_account.name %></h3>
36
+ <%- if Array(@remote_rentals_by_account[remote_account]).length > 0 -%>
37
+ <% Array(@remote_rentals_by_account[remote_account]).each do |remote_rental| %>
38
+ <% if remote_rental.connected? %>
39
+ <%= render "connected_rental", remote_rental: remote_rental, rental: remote_rental.rental %>
40
+ <% else %>
41
+ <%= render "remote_rental", remote_rental: remote_rental %>
42
+ <% end %>
43
+ <% end %>
44
+ <%- else -%>
45
+ <div class="lead text-center well">
46
+ <p class=""><%= icon 'info fa-lg' %></p>
47
+ <p><%=t '.create_listings_first' %></p>
48
+ </div>
49
+ <%- end -%>
50
+ <% end %>
51
+ </div>
52
+ <div class="rentals-list-footer text-center">
53
+ <%= render partial: 'new_remote_account' %>
54
+ </div>
55
+ </div>
48
56
  </div>
49
57
  <%= render partial: 'how_to' %>
50
58
  </div>
@@ -0,0 +1,11 @@
1
+ <nav class="navbar navbar-default navbar-fixed-top" role="navigation">
2
+ <div class="container container-fullscreen">
3
+ <div class="navbar-header">
4
+ <div>
5
+ <a class="navbar-brand h1" href="#" data-toggle="dropdown">
6
+ <i class="fa fa-globe"></i> <%= BookingsyncPortal.portal_name %>
7
+ </a>
8
+ </div>
9
+ </div>
10
+ </div>
11
+ </nav>
@@ -1,13 +1,16 @@
1
1
  <!DOCTYPE html>
2
2
  <html>
3
3
  <head>
4
- <title>BookingSync - HolidayLettings integration</title>
5
- <%= stylesheet_link_tag 'admin/application', media: 'all', 'data-turbolinks-track' => true %>
4
+ <title><%=t 'bookingsync_portal.admin.layout.title', portal_name: BookingsyncPortal.portal_name %></title>
5
+ <%= stylesheet_link_tag 'admin/application', media: 'all' %>
6
6
  <%= csrf_meta_tags %>
7
7
  </head>
8
8
  <body data-messagebus-channel="<%= messagebus_channel %>">
9
- <%= yield %>
10
- <%= javascript_include_tag 'admin/application', 'data-turbolinks-track' => true %>
11
- <div class="footer"></div>
9
+ <%= render partial: '/layouts/bookingsync_portal/menu' %>
10
+ <div class="container container-fullscreen">
11
+ <%= yield %>
12
+ </div>
13
+ <%= javascript_include_tag 'admin/application' %>
14
+ <div class="footer"></div>
12
15
  </body>
13
16
  </html>
@@ -9,11 +9,13 @@ en:
9
9
 
10
10
  bookingsync_portal:
11
11
  admin:
12
+ layout:
13
+ title: Connect BookingSync with %{portal_name}
12
14
  remote_accounts:
13
15
  new:
14
- title: Connect A New Remote Account
16
+ title: Connect with %{portal_name}
15
17
  form:
16
- submit_new: Connect This Remote Account
18
+ submit_new: Connect with %{portal_name}
17
19
 
18
20
  remote_rentals:
19
21
  show:
@@ -29,7 +31,7 @@ en:
29
31
  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>.'
30
32
  create_listings_first: You must create your rentals on Remote Account before you can synchronize them automatically.
31
33
  connect_accounts: Add External Portal Account
32
- remote_header: "Remote Account: %{account_name}"
34
+ remote_header: "%{portal_name}: %{account_name}"
33
35
  rental:
34
36
  bedrooms_html:
35
37
  one: '<strong>1</strong> Bedroom'
@@ -17,6 +17,9 @@ require 'turbolinks'
17
17
  require 'responders'
18
18
 
19
19
  module BookingsyncPortal
20
+ # portal name
21
+ mattr_accessor :portal_name
22
+ @@portal_name = 'Portal'
20
23
 
21
24
  # account model class
22
25
  mattr_accessor :account_model
@@ -1,3 +1,3 @@
1
1
  module BookingsyncPortal
2
- VERSION = '0.2.0'
2
+ VERSION = '0.3.0'
3
3
  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.2.0
4
+ version: 0.3.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: 2015-07-31 00:00:00.000000000 Z
13
+ date: 2015-12-19 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rails
@@ -83,7 +83,7 @@ dependencies:
83
83
  - !ruby/object:Gem::Version
84
84
  version: '0'
85
85
  - !ruby/object:Gem::Dependency
86
- name: bootstrap-sass
86
+ name: bootstrap-bookingsync-sass
87
87
  requirement: !ruby/object:Gem::Requirement
88
88
  requirements:
89
89
  - - ">="
@@ -318,13 +318,15 @@ files:
318
318
  - MIT-LICENSE
319
319
  - README.md
320
320
  - Rakefile
321
- - app/assets/javascripts/bookingsync_portal/admin/application.js
321
+ - app/assets/images/bookingsync_portal/bookingsync.png
322
+ - app/assets/javascripts/bookingsync_portal/admin/application.js.coffee
322
323
  - app/assets/javascripts/bookingsync_portal/admin/handle_remote_errors.js.coffee
323
- - app/assets/javascripts/bookingsync_portal/admin/list_filters.js
324
+ - app/assets/javascripts/bookingsync_portal/admin/lib/list-filter.js.coffee
324
325
  - app/assets/javascripts/bookingsync_portal/admin/live_updates.js.coffee
325
326
  - app/assets/javascripts/bookingsync_portal/admin/rentals.js.coffee
327
+ - app/assets/javascripts/bookingsync_portal/admin/templates/filter_input.hbs
326
328
  - app/assets/javascripts/bookingsync_portal/admin/templates/rentals/connected_rental.hbs
327
- - app/assets/stylesheets/bookingsync_portal/admin/_list_filters.scss
329
+ - app/assets/javascripts/bookingsync_portal/admin/vendor/css-contains.js
328
330
  - app/assets/stylesheets/bookingsync_portal/admin/application.css.scss
329
331
  - app/controllers/bookingsync_portal/admin/base_controller.rb
330
332
  - app/controllers/bookingsync_portal/admin/remote_accounts_controller.rb
@@ -356,6 +358,7 @@ files:
356
358
  - app/views/bookingsync_portal/admin/rentals/_rental.html.erb
357
359
  - app/views/bookingsync_portal/admin/rentals/index.html.erb
358
360
  - app/views/bookingsync_portal/admin/rentals/show.js.erb
361
+ - app/views/layouts/bookingsync_portal/_menu.html.erb
359
362
  - app/views/layouts/bookingsync_portal/admin.html.erb
360
363
  - config/locales/en.yml
361
364
  - config/routes.rb
@@ -400,7 +403,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
400
403
  version: '0'
401
404
  requirements: []
402
405
  rubyforge_project:
403
- rubygems_version: 2.4.8
406
+ rubygems_version: 2.4.5
404
407
  signing_key:
405
408
  specification_version: 4
406
409
  summary: A common base for creating BookingSync portal applications.
@@ -1,20 +0,0 @@
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/draggable
16
- //= require jquery-ui/droppable
17
- //= require handlebars.runtime
18
- //= require message-bus
19
- //= require_tree ./templates
20
- //= require_tree .
@@ -1,67 +0,0 @@
1
-
2
-
3
- // Copyright (c) 2010 Kilian Valkhof
4
-
5
- // Permission is hereby granted, free of charge, to any person
6
- // obtaining a copy of this software and associated documentation
7
- // files (the "Software"), to deal in the Software without
8
- // restriction, including without limitation the rights to use,
9
- // copy, modify, merge, publish, distribute, sublicense, and/or sell
10
- // copies of the Software, and to permit persons to whom the
11
- // Software is furnished to do so, subject to the following
12
- // conditions:
13
-
14
- // The above copyright notice and this permission notice shall be
15
- // included in all copies or substantial portions of the Software.
16
-
17
- // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
18
- // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
19
- // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
20
- // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
21
- // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
22
- // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
23
- // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
24
- // OTHER DEALINGS IN THE SOFTWARE.
25
-
26
-
27
-
28
- (function ($) {
29
- // custom css expression for a case-insensitive contains()
30
- jQuery.expr[':'].Contains = function(a,i,m){
31
- return (a.textContent || a.innerText || "").toUpperCase().indexOf(m[3].toUpperCase())>=0;
32
- };
33
-
34
-
35
- function listFilter(header, list, input_id) { // header is any element, list is an unordered list
36
- // create and add the filter form to the header
37
- var form = $("<form>").attr({"class":"filterform form-inline","action":"#"}),
38
- form_group = $("<div>").attr({"class":"form-group form-group-sm"}),
39
- label = $("<label>Filter by name:</label>").attr({"class":"control-label","for":input_id}),
40
- input = $("<input>").attr({"class":"filterinput form-control","type":"text","id":input_id});
41
- $(form).append(form_group.append(label).append(input)).appendTo(header);
42
-
43
- $(input)
44
- .change( function () {
45
- var filter = $(this).val();
46
- // this finds all links in a list that contain the input,
47
- // and hide the ones not containing the input while showing the ones that do
48
- $(list).find("> div .panel-heading:not(:Contains(" + filter + "))").parent().slideUp();
49
- $(list).find("> div .panel-heading:Contains(" + filter + ")").parent().slideDown();
50
- return false;
51
- })
52
- .keyup( function () {
53
- // fire the above change event after every letter
54
- $(this).change();
55
- });
56
- }
57
-
58
-
59
- //ondomready
60
- $(function () {
61
- listFilter($(".bookingsync-rentals-list .rentals-list-header legend"),
62
- $(".bookingsync-rentals-list .rentals-list-scroll"), "bookingsync_filter");
63
- $(".remote-rentals-list .rentals-list-header").each(function(index, element) {
64
- listFilter($(element).find("legend"), $(element).next(), "remote_filter_" + index);
65
- });
66
- });
67
- }(jQuery));
@@ -1,8 +0,0 @@
1
- .filterform {
2
- margin-bottom: 5px;
3
- font-size: small;
4
-
5
- label {
6
- margin-right: 10px;
7
- }
8
- }