combo_auto_box 0.0.51 → 0.0.52

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 50b086b14581ee4c93d851bdbdf89e40c85d9c1a
4
- data.tar.gz: ca36601bbb3fd52bddb73fc0dd3a94cbf09b4439
3
+ metadata.gz: 3f1b5d274153aca3f2a723013e0d08757ea7ff73
4
+ data.tar.gz: bdc956ddd91fb7b0d16304c3a29b38a95ac08d43
5
5
  SHA512:
6
- metadata.gz: 51ceec1b461fad898b25405823d54cf9124e1bf05cd809e8a8e7905d80f91941b49a63e880b47c339d07ce70a37cc8198279104e0839ffd4dc9312e68114560b
7
- data.tar.gz: ea89c157c85f09f0b29c48e48853367db8d6d1914374692e52d4f332fbfde2e27b92e07b85edd24f821f86a731ccd3ad330b2dd0ddfb6ddea2b3de59b365b7a9
6
+ metadata.gz: d11e8f2362087f91aca34aa24412e936cb034ec21153d83492abe05f8b4d7aa9c6d052c54917fb49b6539855a2d4b6e31500ce5193f93e5b014611a633be2fa5
7
+ data.tar.gz: 8c2935d7ccb44b04a2f5bdbdfc93cacf6413c198b8b80983b3a41d70bb2e7fbf390521f59976e26d5544795e653cfba9356bddc987621df523bffc90c41525a7
@@ -1,3 +1,3 @@
1
1
  module ComboAutoBox
2
- VERSION = '0.0.51'
2
+ VERSION = '0.0.52'
3
3
  end
@@ -794,9 +794,29 @@ var ComboAutoBox = {
794
794
  unselectData(value, label);
795
795
  }
796
796
  };
797
+
798
+ var fixItemSize = function (id) {
799
+ text = $('div#' + id + " i").text();
800
+
801
+ while($('div#' + id + " i").width() > ($('div#' + id).parent().width() - 50)) {
802
+ text = text.substring(0, text.length - 5) + '...';
803
+ $('div#' + id + " i").text(htmlSafe(text));
804
+ }
805
+ }
806
+
807
+ var fixItemSizeOnResize = function () {
808
+ try {
809
+ $('#searchable-clients > div.searchable > div.item').each(function(index) {
810
+ fixItemSize($(this).attr('id'));
811
+ });
812
+ } catch (error) {
813
+
814
+ }
815
+ }
797
816
 
798
817
  // add searchable item for ransack
799
818
  var addSearchableItemForRansack = function (inputId, selectedId, selectedData) {
819
+ var auxText = '';
800
820
  if (selectedData != '') {
801
821
  var ransackId = generateShortId('r');
802
822
  predicate = getSearchablePredicate(selectedId);
@@ -807,7 +827,9 @@ var ComboAutoBox = {
807
827
  fieldCondition = '<input type="hidden" name="q[g]['+ predicate['attribute'] +'][c]['+ ransackId +'][p]" value="'+ predicate['condition'] +'">';
808
828
  fieldValue = '<input type="hidden" name="q[g]['+ predicate['attribute'] +'][c]['+ ransackId +'][v][0][value]" value="'+ htmlSafe(getSearchableValue(selectedData)) +'">';
809
829
  var id = generateAnId('item');
810
- $('#' + inputId).before('<div class="item" id="' + id + '">'+ htmlSafe(selectedData) +'<span class="remove_item" title="Remove Item">x</span>'+ fieldAttribute + fieldCondition + fieldValue +'</div>');
830
+ $('#' + inputId).before('<div class="item" id="' + id + '"><i>'+ htmlSafe(selectedData) +'</i><span class="remove_item" title="Remove Item">x</span>'+ fieldAttribute + fieldCondition + fieldValue +'</div>');
831
+
832
+ fixItemSize(id);
811
833
 
812
834
  $('#' + id + ' > span').click(function() {
813
835
  $(this).parent().remove();
@@ -1080,6 +1102,11 @@ var ComboAutoBox = {
1080
1102
  normalizeStyles(textField.attr('id'));
1081
1103
  handleSearchbleInitials();
1082
1104
  }
1105
+
1106
+ $( window ).resize(function() {
1107
+ fixItemSizeOnResize();
1108
+ });
1109
+
1083
1110
 
1084
1111
  }
1085
1112
  }
@@ -16,11 +16,11 @@ div.multiple div.item span:hover { color:#6D6D6D; cursor:pointer; }
16
16
  div.multiple input { border: 0px; float:left; min-height:22px; font-size:13px; margin-top:5px; margin-left:11px; }
17
17
  div.multiple input:focus { outline:none; }
18
18
 
19
- div.searchable { border: 1px solid #CDCDCD; display:table; width:100%; padding: 2px 6px; }
19
+ div.searchable { border: 1px solid #CDCDCD; display:flex; flex-wrap: wrap; width:100%; padding: 2px 6px; }
20
20
  div.searchable:hover {cursor:text}
21
- div.searchable input { border: 0px; float:left; min-height:22px; font-size:15px; margin-top:2px; }
21
+ div.searchable input { border: 0px; float:left; min-height:22px; font-size:15px; margin-top:2px; max-width: 100%; display:inline; }
22
22
  div.searchable input:focus { outline:none; }
23
- div.searchable div.item { font-family: inherit; float:left; font-size: 15px; color:#FFFFFF; background-color:#008000; margin: 2px 8px 3px 4px; padding:2px 10px 2px 10px; border-radius: .25em; vertical-align: baseline; display:inline; white-space: nowrap; font-weight:bold; }
23
+ div.searchable div.item { font-family: inherit; float:left; font-size: 15px; color:#FFFFFF; background-color:#008000; margin: 2px 8px 3px 4px; padding:2px 10px 2px 10px; border-radius: .25em; vertical-align: baseline; display:inline; white-space: nowrap; font-weight:bold; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
24
24
  div.searchable div.item:hover { cursor:default; }
25
25
  div.searchable div.item span { margin-left:10px; color:#CCCCCC; }
26
26
  div.searchable div.item span.remove_item { font-weight:none; color:#AAAAAA;}
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: combo_auto_box
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.51
4
+ version: 0.0.52
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adilson Chacon
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-05-05 00:00:00.000000000 Z
11
+ date: 2018-06-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec