simple_form_extension 1.1.4 → 1.1.5

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: 40b76905f993c1d85fe6d87f2e13c042f985891b
4
- data.tar.gz: edc4518dda7d58a0e2d8a3d6c3117f183a3f4b7a
3
+ metadata.gz: 6bd9f5143cb4292539dbe72ea07c9e8b34dc3baf
4
+ data.tar.gz: 9723e55b3a8233285cf23da9d90a997a22a03801
5
5
  SHA512:
6
- metadata.gz: daa96cc685910fe4514132b286881ddcd02992f0303c94f1cdcaf7d2d1aaa8f1dd11fc95a52bb3c6143879a382a16fc502498923b211927f97917be07d94f0a2
7
- data.tar.gz: 01cbf739c86556795d51eb057d163b95347528192c8037b12f95fae7cd3706db1d9d1f036e487bccf6bad375ef1018046d2a529c43275e97f58f639a8b4757dc
6
+ metadata.gz: fe14c41ed1884c7304268812adcf424b934fa81237a680693dd0d39e5dc7cd42102d7e38ea26ae6174577e7e4474acd4797cc07aa4059a7d0ffe0074e2399f11
7
+ data.tar.gz: 0df975c6859ae09ad103ed819af12aaf9fdf3d0d8e4e4d6601a46704e7249705d59ad07d9cd32dc7e79fccb8deadac8b4a7026cb979a400700d2f3db15ea8d04
@@ -1,3 +1,3 @@
1
1
  module SimpleFormExtension
2
- VERSION = "1.1.4"
2
+ VERSION = "1.1.5"
3
3
  end
@@ -0,0 +1,198 @@
1
+ /* ===========================================================
2
+ * Bootstrap: fileinput.js v3.1.3
3
+ * http://jasny.github.com/bootstrap/javascript/#fileinput
4
+ * ===========================================================
5
+ * Copyright 2012-2014 Arnold Daniels
6
+ *
7
+ * Licensed under the Apache License, Version 2.0 (the "License")
8
+ * you may not use this file except in compliance with the License.
9
+ * You may obtain a copy of the License at
10
+ *
11
+ * http://www.apache.org/licenses/LICENSE-2.0
12
+ *
13
+ * Unless required by applicable law or agreed to in writing, software
14
+ * distributed under the License is distributed on an "AS IS" BASIS,
15
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ * See the License for the specific language governing permissions and
17
+ * limitations under the License.
18
+ * ========================================================== */
19
+
20
+ +function ($) { "use strict";
21
+
22
+ var isIE = window.navigator.appName == 'Microsoft Internet Explorer'
23
+
24
+ // FILEUPLOAD PUBLIC CLASS DEFINITION
25
+ // =================================
26
+
27
+ var Fileinput = function (element, options) {
28
+ this.$element = $(element)
29
+
30
+ this.$input = this.$element.find(':file')
31
+ if (this.$input.length === 0) return
32
+
33
+ this.name = this.$input.attr('name') || options.name
34
+
35
+ this.$hidden = this.$element.find('input[type=hidden][name="' + this.name + '"]')
36
+ if (this.$hidden.length === 0) {
37
+ this.$hidden = $('<input type="hidden">').insertBefore(this.$input)
38
+ }
39
+
40
+ this.$preview = this.$element.find('.fileinput-preview')
41
+ var height = this.$preview.css('height')
42
+ if (this.$preview.css('display') !== 'inline' && height !== '0px' && height !== 'none') {
43
+ this.$preview.css('line-height', height)
44
+ }
45
+
46
+ this.original = {
47
+ exists: this.$element.hasClass('fileinput-exists'),
48
+ preview: this.$preview.html(),
49
+ hiddenVal: this.$hidden.val()
50
+ }
51
+
52
+ this.listen()
53
+ }
54
+
55
+ Fileinput.prototype.listen = function() {
56
+ this.$input.on('change.bs.fileinput', $.proxy(this.change, this))
57
+ $(this.$input[0].form).on('reset.bs.fileinput', $.proxy(this.reset, this))
58
+
59
+ this.$element.find('[data-trigger="fileinput"]').on('click.bs.fileinput', $.proxy(this.trigger, this))
60
+ this.$element.find('[data-dismiss="fileinput"]').on('click.bs.fileinput', $.proxy(this.clear, this))
61
+ },
62
+
63
+ Fileinput.prototype.change = function(e) {
64
+ var files = e.target.files === undefined ? (e.target && e.target.value ? [{ name: e.target.value.replace(/^.+\\/, '')}] : []) : e.target.files
65
+
66
+ e.stopPropagation()
67
+
68
+ if (files.length === 0) {
69
+ this.clear()
70
+ return
71
+ }
72
+
73
+ this.$hidden.val('')
74
+ this.$hidden.attr('name', '')
75
+ this.$input.attr('name', this.name)
76
+
77
+ var file = files[0]
78
+
79
+ if (this.$preview.length > 0 && (typeof file.type !== "undefined" ? file.type.match(/^image\/(gif|png|jpeg)$/) : file.name.match(/\.(gif|png|jpe?g)$/i)) && typeof FileReader !== "undefined") {
80
+ var reader = new FileReader()
81
+ var preview = this.$preview
82
+ var element = this.$element
83
+
84
+ reader.onload = function(re) {
85
+ var $img = $('<img>')
86
+ $img[0].src = re.target.result
87
+ files[0].result = re.target.result
88
+
89
+ element.find('.fileinput-filename').text(file.name)
90
+
91
+ // if parent has max-height, using `(max-)height: 100%` on child doesn't take padding and border into account
92
+ if (preview.css('max-height') != 'none') $img.css('max-height', parseInt(preview.css('max-height'), 10) - parseInt(preview.css('padding-top'), 10) - parseInt(preview.css('padding-bottom'), 10) - parseInt(preview.css('border-top'), 10) - parseInt(preview.css('border-bottom'), 10))
93
+
94
+ preview.html($img)
95
+ element.addClass('fileinput-exists').removeClass('fileinput-new')
96
+
97
+ element.trigger('change.bs.fileinput', files)
98
+ }
99
+
100
+ reader.readAsDataURL(file)
101
+ } else {
102
+ this.$element.find('.fileinput-filename').text(file.name)
103
+ this.$preview.text(file.name)
104
+
105
+ this.$element.addClass('fileinput-exists').removeClass('fileinput-new')
106
+
107
+ this.$element.trigger('change.bs.fileinput')
108
+ }
109
+ },
110
+
111
+ Fileinput.prototype.clear = function(e) {
112
+ if (e) e.preventDefault()
113
+
114
+ this.$hidden.val('')
115
+ this.$hidden.attr('name', this.name)
116
+ this.$input.attr('name', '')
117
+
118
+ //ie8+ doesn't support changing the value of input with type=file so clone instead
119
+ if (isIE) {
120
+ var inputClone = this.$input.clone(true);
121
+ this.$input.after(inputClone);
122
+ this.$input.remove();
123
+ this.$input = inputClone;
124
+ } else {
125
+ this.$input.val('')
126
+ }
127
+
128
+ this.$preview.html('')
129
+ this.$element.find('.fileinput-filename').text('')
130
+ this.$element.addClass('fileinput-new').removeClass('fileinput-exists')
131
+
132
+ if (e !== undefined) {
133
+ this.$input.trigger('change')
134
+ this.$element.trigger('clear.bs.fileinput')
135
+ }
136
+ },
137
+
138
+ Fileinput.prototype.reset = function() {
139
+ this.clear()
140
+
141
+ this.$hidden.val(this.original.hiddenVal)
142
+ this.$preview.html(this.original.preview)
143
+ this.$element.find('.fileinput-filename').text('')
144
+
145
+ if (this.original.exists) this.$element.addClass('fileinput-exists').removeClass('fileinput-new')
146
+ else this.$element.addClass('fileinput-new').removeClass('fileinput-exists')
147
+
148
+ this.$element.trigger('reset.bs.fileinput')
149
+ },
150
+
151
+ Fileinput.prototype.trigger = function(e) {
152
+ this.$input.trigger('click')
153
+ e.preventDefault()
154
+ }
155
+
156
+
157
+ // FILEUPLOAD PLUGIN DEFINITION
158
+ // ===========================
159
+
160
+ var old = $.fn.fileinput
161
+
162
+ $.fn.fileinput = function (options) {
163
+ return this.each(function () {
164
+ var $this = $(this),
165
+ data = $this.data('bs.fileinput')
166
+ if (!data) $this.data('bs.fileinput', (data = new Fileinput(this, options)))
167
+ if (typeof options == 'string') data[options]()
168
+ })
169
+ }
170
+
171
+ $.fn.fileinput.Constructor = Fileinput
172
+
173
+
174
+ // FILEINPUT NO CONFLICT
175
+ // ====================
176
+
177
+ $.fn.fileinput.noConflict = function () {
178
+ $.fn.fileinput = old
179
+ return this
180
+ }
181
+
182
+
183
+ // FILEUPLOAD DATA-API
184
+ // ==================
185
+
186
+ $(document).on('click.fileinput.data-api', '[data-provides="fileinput"]', function (e) {
187
+ var $this = $(this)
188
+ if ($this.data('bs.fileinput')) return
189
+ $this.fileinput($this.data())
190
+
191
+ var $target = $(e.target).closest('[data-dismiss="fileinput"],[data-trigger="fileinput"]');
192
+ if ($target.length > 0) {
193
+ e.preventDefault()
194
+ $target.trigger('click.bs.fileinput')
195
+ }
196
+ })
197
+
198
+ }(window.jQuery);
@@ -3,6 +3,7 @@
3
3
  #= require redactor-rails/plugins
4
4
  #= require selectize
5
5
  #= require spinbox
6
+ #= require jasny-bootstrap
6
7
  #= require jquery.datetimepicker
7
8
  #= require_self
8
9
  #= require_tree ./simple_form_extension
@@ -0,0 +1,109 @@
1
+ /*!
2
+ * Jasny Bootstrap v3.1.0 (http://jasny.github.com/bootstrap)
3
+ * Copyright 2011-2014 Arnold Daniels.
4
+ * Licensed under Apache-2.0 (https://github.com/jasny/bootstrap/blob/master/LICENSE)
5
+ */
6
+
7
+ .btn-file {
8
+ overflow: hidden;
9
+ position: relative;
10
+ vertical-align: middle;
11
+ }
12
+ .btn-file > input {
13
+ position: absolute;
14
+ top: 0;
15
+ right: 0;
16
+ margin: 0;
17
+ opacity: 0;
18
+ filter: alpha(opacity=0);
19
+ font-size: 23px;
20
+ height: 100%;
21
+ width: 100%;
22
+ direction: ltr;
23
+ cursor: pointer;
24
+ }
25
+ .fileinput {
26
+ margin-bottom: 9px;
27
+ display: inline-block;
28
+ }
29
+ .fileinput .form-control {
30
+ padding-top: 7px;
31
+ padding-bottom: 5px;
32
+ display: inline-block;
33
+ margin-bottom: 0px;
34
+ vertical-align: middle;
35
+ cursor: text;
36
+ }
37
+ .fileinput .thumbnail {
38
+ overflow: hidden;
39
+ display: inline-block;
40
+ margin-bottom: 5px;
41
+ vertical-align: middle;
42
+ text-align: center;
43
+ }
44
+ .fileinput .thumbnail > img {
45
+ max-height: 100%;
46
+ }
47
+ .fileinput .btn {
48
+ vertical-align: middle;
49
+ }
50
+ .fileinput-exists .fileinput-new,
51
+ .fileinput-new .fileinput-exists {
52
+ display: none;
53
+ }
54
+ .fileinput-inline .fileinput-controls {
55
+ display: inline;
56
+ }
57
+ .fileinput-filename {
58
+ vertical-align: middle;
59
+ display: inline-block;
60
+ overflow: hidden;
61
+ }
62
+ .form-control .fileinput-filename {
63
+ vertical-align: bottom;
64
+ }
65
+ .fileinput.input-group {
66
+ display: table;
67
+ }
68
+ .fileinput.input-group > * {
69
+ position: relative;
70
+ z-index: 2;
71
+ }
72
+ .fileinput.input-group > .btn-file {
73
+ z-index: 1;
74
+ }
75
+ .fileinput-new.input-group .btn-file,
76
+ .fileinput-new .input-group .btn-file {
77
+ border-radius: 0 4px 4px 0;
78
+ }
79
+ .fileinput-new.input-group .btn-file.btn-xs,
80
+ .fileinput-new .input-group .btn-file.btn-xs,
81
+ .fileinput-new.input-group .btn-file.btn-sm,
82
+ .fileinput-new .input-group .btn-file.btn-sm {
83
+ border-radius: 0 3px 3px 0;
84
+ }
85
+ .fileinput-new.input-group .btn-file.btn-lg,
86
+ .fileinput-new .input-group .btn-file.btn-lg {
87
+ border-radius: 0 6px 6px 0;
88
+ }
89
+ .form-group.has-warning .fileinput .fileinput-preview {
90
+ color: #8a6d3b;
91
+ }
92
+ .form-group.has-warning .fileinput .thumbnail {
93
+ border-color: #faebcc;
94
+ }
95
+ .form-group.has-error .fileinput .fileinput-preview {
96
+ color: #a94442;
97
+ }
98
+ .form-group.has-error .fileinput .thumbnail {
99
+ border-color: #ebccd1;
100
+ }
101
+ .form-group.has-success .fileinput .fileinput-preview {
102
+ color: #3c763d;
103
+ }
104
+ .form-group.has-success .fileinput .thumbnail {
105
+ border-color: #d6e9c6;
106
+ }
107
+ .input-group-addon:not(:first-child) {
108
+ border-left: 0;
109
+ }
@@ -2,3 +2,4 @@
2
2
  //= require selectize
3
3
  //= require selectize.bootstrap3
4
4
  //= require jquery.datetimepicker
5
+ //= require jasny-bootstrap
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simple_form_extension
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.4
4
+ version: 1.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexandre Vasseur
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-01-10 00:00:00.000000000 Z
11
+ date: 2015-01-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -134,6 +134,7 @@ files:
134
134
  - lib/simple_form_extension/version.rb
135
135
  - simple_form_extension.gemspec
136
136
  - vendor/assets/javascripts/.DS_Store
137
+ - vendor/assets/javascripts/jasny-bootstrap.js
137
138
  - vendor/assets/javascripts/jquery.datetimepicker.js
138
139
  - vendor/assets/javascripts/simple_form_extension.coffee
139
140
  - vendor/assets/javascripts/simple_form_extension/.DS_Store
@@ -143,6 +144,7 @@ files:
143
144
  - vendor/assets/javascripts/simple_form_extension/selectize.coffee
144
145
  - vendor/assets/javascripts/simple_form_extension/spinbox.coffee
145
146
  - vendor/assets/javascripts/spinbox.js
147
+ - vendor/assets/stylesheets/jasny-bootstrap.css
146
148
  - vendor/assets/stylesheets/jquery.datetimepicker.css
147
149
  - vendor/assets/stylesheets/simple_form_extension.sass
148
150
  homepage: http://www.glyph.fr