bookingsync_portal 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ab83431a462646ae92b55367aa850ea6fe361cc2
4
- data.tar.gz: b104c6d7b237f1a56878a9df5cea6c86b891d32d
3
+ metadata.gz: 9a480ce2459ec1089601197319ee60201436263d
4
+ data.tar.gz: e282f8169d93c61ae942716c5fb2bb31a9790bc7
5
5
  SHA512:
6
- metadata.gz: a2f667d2324d7f67c8228cc1413692d73acda17e20640c71edd652b8517e8d4f395ef9be3d79aea2c5b488d2a857835af4e0d5b3f1d9c3962119e6a278cabc38
7
- data.tar.gz: e3441d437d0ae5f9c1a7a1c43e7b6a91ca8a695e19909e4b2a963fc965312766e4a6c63913b2487e1362ad3742448e311ef20fb2e1f3b75322cd88e17c2ba076
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
- label = $("<label>Filter by name:</label>"),
39
- input = $("<input>").attr({"class":"filterinput","type":"text"});
40
- $(form).append(label).append(input).appendTo(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);
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"), $(".bookingsync-rentals-list .rentals-list-scroll"));
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));
@@ -1,8 +1,8 @@
1
- legend {
2
- form {
3
- font-size: small;
4
- label {
5
- margin-right: 10px;
6
- }
1
+ .filterform {
2
+ margin-bottom: 5px;
3
+ font-size: small;
4
+
5
+ label {
6
+ margin-right: 10px;
7
7
  }
8
8
  }
@@ -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
- @rentals = current_account.rentals.ordered
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, presence: true, uniqueness: true
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 @rentals.count == 0 -%>
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>
@@ -1,3 +1,3 @@
1
1
  module BookingsyncPortal
2
- VERSION = '0.1.1'
2
+ VERSION = '0.1.2'
3
3
  end
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.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-25 00:00:00.000000000 Z
11
+ date: 2015-05-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails