bookingsync_portal 0.1.1 → 0.1.2
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 +4 -4
- data/app/assets/javascripts/bookingsync_portal/admin/list_filters.js +9 -7
- data/app/assets/stylesheets/bookingsync_portal/admin/_list_filters.scss +6 -6
- data/app/controllers/bookingsync_portal/admin/rentals_controller.rb +3 -3
- data/app/models/bookingsync_portal/remote_rental.rb +1 -1
- data/app/models/bookingsync_portal/rental.rb +3 -0
- data/app/views/bookingsync_portal/admin/rentals/index.html.erb +1 -1
- data/lib/bookingsync_portal/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9a480ce2459ec1089601197319ee60201436263d
|
4
|
+
data.tar.gz: e282f8169d93c61ae942716c5fb2bb31a9790bc7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 695f61dd565e424616ba9f16792146fea0212de4185b512f9916a52a6c0bc7afd8b3bb16834b2d2efcfd0de81d19d0ab5e8fefe09beb367b63d3953be5dfe1a9
|
7
|
+
data.tar.gz: 529f1ee3232b275d0585bab5ed511a1d26093d358f43fa22ef7bcd4e7e6fe785c5946cb0fbea2435b266ddeb7e32f1b4361e38390f12b990415d4acc63610f04
|
@@ -32,12 +32,13 @@
|
|
32
32
|
};
|
33
33
|
|
34
34
|
|
35
|
-
function listFilter(header, list) { // header is any element, list is an unordered list
|
35
|
+
function listFilter(header, list, input_id) { // header is any element, list is an unordered list
|
36
36
|
// create and add the filter form to the header
|
37
|
-
var form = $("<form>").attr({"class":"filterform","action":"#"}),
|
38
|
-
|
39
|
-
|
40
|
-
|
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);
|
41
42
|
|
42
43
|
$(input)
|
43
44
|
.change( function () {
|
@@ -57,9 +58,10 @@
|
|
57
58
|
|
58
59
|
//ondomready
|
59
60
|
$(function () {
|
60
|
-
listFilter($(".bookingsync-rentals-list .rentals-list-header legend"),
|
61
|
+
listFilter($(".bookingsync-rentals-list .rentals-list-header legend"),
|
62
|
+
$(".bookingsync-rentals-list .rentals-list-scroll"), "bookingsync_filter");
|
61
63
|
$(".remote-rentals-list .rentals-list-header").each(function(index, element) {
|
62
|
-
listFilter($(element).find("legend"), $(element).next());
|
64
|
+
listFilter($(element).find("legend"), $(element).next(), "remote_filter_" + index);
|
63
65
|
});
|
64
66
|
});
|
65
67
|
}(jQuery));
|
@@ -5,8 +5,8 @@ module BookingsyncPortal
|
|
5
5
|
before_action :fetch_remote_rentals, only: :index
|
6
6
|
|
7
7
|
def index
|
8
|
-
@not_connected_rentals = current_account.rentals.ordered.not_connected
|
9
|
-
@
|
8
|
+
@not_connected_rentals = current_account.rentals.visible.ordered.not_connected
|
9
|
+
@visible_rentals_count = current_account.rentals.visible.count
|
10
10
|
@remote_accounts = current_account.remote_accounts
|
11
11
|
@remote_rentals_by_account = current_account.remote_rentals.ordered
|
12
12
|
.includes(:remote_account).group_by(&:remote_account)
|
@@ -47,7 +47,7 @@ module BookingsyncPortal
|
|
47
47
|
end
|
48
48
|
|
49
49
|
def rental
|
50
|
-
@rental ||= current_account.rentals.find(params[:id])
|
50
|
+
@rental ||= current_account.rentals.visible.find(params[:id])
|
51
51
|
end
|
52
52
|
|
53
53
|
def redirect_or_js_response
|
@@ -10,7 +10,7 @@ class BookingsyncPortal::RemoteRental < ActiveRecord::Base
|
|
10
10
|
|
11
11
|
serialize :remote_data, BookingsyncPortal::MashSerializer
|
12
12
|
|
13
|
-
validates :uid,
|
13
|
+
validates :uid, uniqueness: { allow_nil: true }
|
14
14
|
validates :remote_account, presence: true
|
15
15
|
|
16
16
|
scope :ordered, -> { order(created_at: :desc) }
|
@@ -5,9 +5,12 @@ class BookingsyncPortal::Rental < ActiveRecord::Base
|
|
5
5
|
has_one :connection, class_name: BookingsyncPortal.connection_model, dependent: :destroy
|
6
6
|
has_one :remote_rental, class_name: BookingsyncPortal.remote_rental_model, through: :connection
|
7
7
|
|
8
|
+
validates :synced_id, uniqueness: true, presence: true
|
9
|
+
|
8
10
|
scope :ordered, -> { order(position: :asc) }
|
9
11
|
scope :connected, -> { joins(:remote_rental) }
|
10
12
|
scope :not_connected, -> { includes(:connection).where(connections: { remote_rental_id: nil }) }
|
13
|
+
scope :visible, -> { all }
|
11
14
|
|
12
15
|
def connected?
|
13
16
|
remote_rental.present?
|
@@ -4,7 +4,7 @@
|
|
4
4
|
<legend><%=t '.bookingsync_header', account_name: current_account.name %></legend>
|
5
5
|
</div>
|
6
6
|
<div class="rentals-list-scroll">
|
7
|
-
<%- if @
|
7
|
+
<%- if @visible_rentals_count == 0 -%>
|
8
8
|
<div class="lead text-center well">
|
9
9
|
<p><%= t('.no_published_rentals_html', id: current_account.uid) %></p>
|
10
10
|
</div>
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bookingsync_portal
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Piotr Marciniak
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-05-
|
11
|
+
date: 2015-05-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|