jquery-ioslist-rails 0.1.0 → 0.2.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: dede604a4833b7f04e5eeb6d44850327cad90da7
4
- data.tar.gz: 503e47149328d71ae45ebe50211231cfe3d160b7
3
+ metadata.gz: ad820eefba11ed3ff06ef5c95789fd3b05f2d722
4
+ data.tar.gz: ee71eed803665cc1fd2f3b6b85b81f5ab5cc98cc
5
5
  SHA512:
6
- metadata.gz: 35f62b1d31ecedd4a7cdddb0ebb5a40602fff92b7588b48e069d2ec0888cba67322e31d514098da143e640e560dd77d0d2fd160cfa71a9486f7a4f1925ba4e11
7
- data.tar.gz: 7b2f24b3e888b3707960497fbf5a5be02227968f67f12adf1b3a6a6ad43bbd0ce0b10849478845f7c778e59ebf5378c25c07986560e691e2f6902208728886d7
6
+ metadata.gz: cb95a1b5858bd8167f72d90bffa19ccedf3f406e779f4008c9645c3d5f29f65a9118fcdb352d1f7b0261dd2681366721cf7e953ee02f154ff112487832fe1e00
7
+ data.tar.gz: ed14197b310df3880832975d42fa4b66938dc644e98c07d277613cae03cd70c920357a6ffbd7c129657e914032dc61b6fa565e68c7a1dabfa6a2afb5ee81623d
data/README.md CHANGED
@@ -22,20 +22,7 @@ Or install it yourself as:
22
22
 
23
23
  ## Usage
24
24
 
25
- TODO: Write usage instructions here
26
-
27
- ## Development
28
-
29
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
30
-
31
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
32
-
33
- ## Contributing
34
-
35
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/jquery-ioslist-rails. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
36
-
37
-
38
- ## License
39
-
40
- The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
41
-
25
+ Add to your application.js
26
+ ```
27
+ //= require jquery.ioslist
28
+ ```
@@ -1,14 +1,8 @@
1
- require "jquery/ioslist/rails/version"
2
-
3
1
  module Jquery
4
2
  module Ioslist
5
3
  module Rails
6
- class Engine < ::Rails::Engine
7
- initializer 'Precompile hook', :group => :all do |app|
8
- app.config.assets.precompile += ['jquery.isolist.js']
9
- app.config.assets.precompile += ['jquery.isolist.css']
10
- end
11
- end
4
+ require 'jquery/ioslist/rails/engine'
5
+ require 'jquery/ioslist/rails/version'
12
6
  end
13
7
  end
14
8
  end
@@ -1,7 +1,7 @@
1
1
  module Jquery
2
2
  module Ioslist
3
3
  module Rails
4
- VERSION = "0.1.0"
4
+ VERSION = "0.2.0"
5
5
  end
6
6
  end
7
7
  end
@@ -0,0 +1,108 @@
1
+ /*! iOSList - v2.0.0 - * https://brianhadaway.github.io/iOSList
2
+ * Copyright (c) 2014 Brian Hadaway; Licensed MIT */(function($, window, document, undefined) {
3
+ var IosList = function(elem, options) {
4
+ this.$elem = $(elem);
5
+ this.$elem.data('instance', this);
6
+ this.init(options);
7
+ };
8
+
9
+ IosList.prototype = {
10
+ defaults: {
11
+ classes: {
12
+ animated: 'ioslist-animated',
13
+ container: 'ioslist-wrapper',
14
+ hidden: 'ioslist-hidden',
15
+ stationaryHeader: 'ioslist-fake-header'
16
+ },
17
+ selectors: {
18
+ groupContainer: '.ioslist-group-container',
19
+ groupHeader: '.ioslist-group-header',
20
+ stationaryHeader: 'h2'
21
+ }
22
+ },
23
+
24
+ init: function(options) {
25
+ var scope = this,
26
+ isIOS = navigator.userAgent.match(/ipad|iphone|ipod/gi) ? true : false;
27
+
28
+ //set defaults
29
+ this.options = $.extend(true, {}, this.defaults, (options || {}));
30
+ this.elems = [];
31
+ //indicate that this is an ioslist
32
+ this.$elem.addClass('ioslist');
33
+ //wrap all the children
34
+ this.$elem.children().wrapAll(["<div class='", this.options.classes.container, "' data-ios='", isIOS, "'></div>"].join(''));
35
+ this.$elem.prepend(['<', this.options.selectors.stationaryHeader, '/>'].join(''));
36
+ this.$listWrapper = this.$elem.find('.' + this.options.classes.container);
37
+ this.$fakeHeader = this.$elem.find(this.options.selectors.stationaryHeader).eq(0);
38
+ this.$fakeHeader.addClass(this.options.classes.stationaryHeader);
39
+
40
+ this.$elem.find(this.options.selectors.groupContainer).each(function(index, elem) {
41
+ var $tmp_list = scope.$elem.find(scope.options.selectors.groupContainer).eq(index),
42
+ $tmp_header = $tmp_list.find(scope.options.selectors.groupHeader).eq(0),
43
+ $tmp_listHeight = $tmp_list.height(),
44
+ $tmp_listOffset = $tmp_list.position().top;
45
+ scope.elems.push({
46
+ 'list': $tmp_list,
47
+ 'header': $tmp_header,
48
+ 'listHeight': $tmp_listHeight,
49
+ 'headerText': $tmp_header.text(),
50
+ 'headerHeight': $tmp_header.outerHeight(),
51
+ 'listOffset': $tmp_listOffset,
52
+ 'listBottom': $tmp_listHeight + $tmp_listOffset
53
+ });
54
+ });
55
+
56
+ this.$fakeHeader.text(this.elems[0].headerText);
57
+
58
+ this.$listWrapper.scroll(function() {
59
+ scope.testPosition();
60
+ });
61
+
62
+ },
63
+
64
+ testPosition: function() {
65
+ var currentTop = this.$listWrapper.scrollTop(),
66
+ topElement, offscreenElement, topElementBottom, i = 0;
67
+
68
+ while ((this.elems[i].listOffset - currentTop) <= 0) {
69
+ topElement = this.elems[i];
70
+ topElementBottom = topElement.listBottom - currentTop;
71
+ if (topElementBottom < -topElement.headerHeight) {
72
+ offscreenElement = topElement;
73
+ }
74
+ i++;
75
+ if (i >= this.elems.length) {
76
+ break;
77
+ }
78
+ }
79
+
80
+ if (topElementBottom < 0 && topElementBottom > -topElement.headerHeight) {
81
+ this.$fakeHeader.addClass(this.options.classes.hidden);
82
+ $(topElement.list).addClass(this.options.classes.animated);
83
+ } else {
84
+ this.$fakeHeader.removeClass(this.options.classes.hidden);
85
+ if (topElement) {
86
+ $(topElement.list).removeClass(this.options.classes.animated);
87
+ }
88
+ }
89
+
90
+ if (topElement) {
91
+ this.$fakeHeader.text(topElement.headerText);
92
+ }
93
+ }
94
+ };
95
+
96
+ $.fn.ioslist = function(options, args) {
97
+ if (typeof options === 'string') {
98
+ return this.each(function() {
99
+ $(this).data('instance')[options](args);
100
+ });
101
+ } else {
102
+ return this.each(function() {
103
+ new IosList(this, options);
104
+ });
105
+ }
106
+ };
107
+
108
+ })(jQuery, window, document);
@@ -0,0 +1,88 @@
1
+ .ioslist-wrapper{
2
+ height: 100%;
3
+ overflow-x: hidden;
4
+ overflow-y: auto;
5
+ position: absolute;
6
+ width: 100%;
7
+ }
8
+
9
+
10
+ .ioslist-group-container {
11
+ margin: 0;
12
+ min-height: 1px;
13
+ overflow: hidden;
14
+ padding: 24px 0 0 0;
15
+ position: relative;
16
+ }
17
+ .ioslist-group-header, .ioslist-fake-header {
18
+ background: #B8C1C8;
19
+ border-bottom: 1px solid #989EA4;
20
+ border-top: 1px solid #717D85;
21
+ color: #FFF;
22
+ font: normal 18px/21px Helvetica, Arial, sans-serif;
23
+ margin: 0;
24
+ padding: 2px 0 0 12px;
25
+ position: absolute;
26
+ text-shadow: 0 1px #646A6E;
27
+ -moz-text-shadow: 0 1px #646A6E;
28
+ -webkit-text-shadow: 0 1px #646A6E;
29
+ }
30
+ .ioslist-group-header {
31
+ bottom: auto;
32
+ min-height: 1px;
33
+ top: 0;
34
+ width: 273px;
35
+ }
36
+ .ioslist-fake-header {
37
+ width: 273px;
38
+ z-index: 1000;
39
+ }
40
+
41
+ .ioslist-fake-header.ioslist-hidden {
42
+ visibility: hidden;
43
+ }
44
+ .ioslist-group-container.ioslist-animated .ioslist-group-header {
45
+ bottom: 0;
46
+ top: auto;
47
+ }
48
+
49
+ /* Demo Styling */
50
+ body {
51
+ font: normal 20px Helvetica, Arial, sans-serif;
52
+ margin: 0;
53
+ }
54
+
55
+ #list1 {
56
+ height: 300px;
57
+ margin: 100px;
58
+ overflow: visible;
59
+ position: relative;
60
+ width: 300px;
61
+ zoom: 1;
62
+ }
63
+
64
+ .ioslist ul, .ioslist dl {
65
+ list-style: none;
66
+ margin: 0;
67
+ padding: 0;
68
+ }
69
+
70
+ .ioslist li, .ioslist dt {
71
+ font: normal 20px/45px Helvetica, Arial, sans-serif;
72
+ margin: 0;
73
+ padding: 0 0 0 12px;
74
+ white-space: nowrap;
75
+ }
76
+
77
+ .ioslist li + li, .ioslist dd + dt {
78
+ border-top: 1px solid #CCC;
79
+ }
80
+
81
+ .ioslist dd {
82
+ padding: 0 12px;
83
+ }
84
+
85
+ [data-ios="true"] .ioslist-group-header,
86
+ [data-ios="true"] .ioslist-fake-header {
87
+ width: 288px; /*scrollbars aren't visible in iOS devices, so make the headers wider */
88
+ }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jquery-ioslist-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kirill
@@ -69,9 +69,12 @@ files:
69
69
  - Rakefile
70
70
  - bin/console
71
71
  - bin/setup
72
+ - jquery-ioslist-rails-0.1.0.gem
72
73
  - jquery-ioslist-rails.gemspec
73
74
  - lib/jquery/ioslist/rails.rb
74
75
  - lib/jquery/ioslist/rails/version.rb
76
+ - vendor/assets/javascripts/jquery.ioslist.js
77
+ - vendor/assets/stylesheets/jquery.isolist.css
75
78
  homepage: https://github.com/cderche/jquery-ioslist-rails
76
79
  licenses:
77
80
  - MIT