weeler 1.5.1 → 1.5.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -95,12 +95,16 @@ module Weeler
95
95
 
96
96
  translations = translations.where(locale: I18n.available_locales)
97
97
 
98
+ translations = translations.where("created_at >= ?", Time.zone.parse(params[:date_from]).beginning_of_day) if params[:date_from].present?
99
+ translations = translations.where("created_at <= ?", Time.zone.parse(params[:date_till]).end_of_day) if params[:date_till].present?
100
+
98
101
  ::Weeler.excluded_i18n_groups.each do |key|
99
102
  translations = translations.except_key(key)
100
103
  end
101
104
 
102
105
  translations = translations.where("key ILIKE ? OR value ILIKE ?", "%#{params[:query]}%", "%#{params[:query]}%") if params[:query]
103
106
  translations = translations.where(locale: params[:filtered_locale]) if params[:filtered_locale].present?
107
+
104
108
  translations = translations.lookup(params[:group]) if params[:group].present?
105
109
  translations
106
110
  end
@@ -1,84 +1,99 @@
1
- .header.container
1
+ .header
2
2
  .row
3
3
  .col-lg-12
4
- .page-header
5
- %h1 Translations
6
- %p.lead.text-muted Static translation data over all your app. You can safely edit translation values. Also you can export excel document, translate in all locales you need and import it back.
7
- %p.lead.text-muted
8
- = "You can switch between showing keys and translations:"
9
- %br/
10
- - if params[:show_translation_keys] == 'true'
11
- = link_to 'Show translations', weeler_translations_path(show_translation_keys: false)
12
- - else
13
- = link_to 'Show translation keys', weeler_translations_path(show_translation_keys: true)
14
- %h1 Stats
15
- %p.lead.text-muted
16
- - if Settings.log_key_usage == 'true'
17
- = 'Translation usage stat gathering is ON'
18
- - else
19
- = 'Translation usage stat gathering is OFF'
20
- %p.lead.text-muted
21
- = link_to 'Go to Stats', {action: :usage_stats}
4
+ %h1{ style: 'margin-top:0px;' } Translations
5
+ %p.lead.text-muted Static translation data over all your app. You can safely edit translation values. Also you can export excel document, translate in all locales you need and import it back.
6
+ %p.lead.text-muted
7
+ = "You can switch between showing keys and translations:"
8
+ %br/
9
+ - if params[:show_translation_keys] == 'true'
10
+ = link_to 'Show translations', weeler_translations_path(show_translation_keys: false)
11
+ - else
12
+ = link_to 'Show translation keys', weeler_translations_path(show_translation_keys: true)
13
+ %h1 Stats
14
+ %p.lead.text-muted
15
+ - if Settings.log_key_usage == 'true'
16
+ = 'Translation usage stat gathering is ON'
17
+ - else
18
+ = 'Translation usage stat gathering is OFF'
19
+ %p.lead.text-muted
20
+ = link_to 'Go to Stats', {action: :usage_stats}
21
+
22
22
  .row
23
- %nav.navbar.navbar-default{role: "navigation"}
24
- / Collect the nav links, forms, and other content for toggling
25
- .collapse.navbar-collapse.navbar-ex1-collapse
26
- / Groups dropdown
27
- %ul.nav.navbar-nav.navbar-left
28
- %li.dropdown
29
- %a.dropdown-toggle{"data-toggle" => "dropdown", href: "#"}
30
- = (params[:group].capitalize if params[:group]) || "All groups"
31
- %b.caret
32
- %ul.dropdown-menu
33
- %li
34
- %a{href: weeler_translations_path(filtered_locale: params[:filtered_locale])} All
35
- - @groups.each do |group|
36
- - if group.present?
37
- %li
38
- %a{href: weeler_translations_path(filtered_locale: params[:filtered_locale], group: group)}= group.capitalize
39
- / Locales dropdown
40
- %ul.nav.navbar-nav
41
- %li.dropdown
42
- %a.dropdown-toggle{"data-toggle" => "dropdown", href: "#"}
43
- = (params[:filtered_locale].capitalize if params[:filtered_locale]) || "All locales"
44
- %b.caret
45
- %ul.dropdown-menu
46
- %li
47
- %a{href: weeler_translations_path(group: params[:group])} All
48
- - I18n.available_locales.each do |locale|
49
- - if locale.present?
50
- %li
51
- %a{href: weeler_translations_path(group: params[:group], filtered_locale: locale)}= locale.capitalize
52
- / Import and export data
53
- = form_tag import_weeler_translations_path, {:multipart => true, class: "navbar-form navbar-left"} do
54
- .form-group
55
- %input.weeler-file-inputs{name: "file", type: "file"}/
56
- .btn-group
57
- %button.btn.btn-default{type: "submit"} Import
58
- %a.btn.btn-default{href: export_weeler_translations_path(filtered_locale: params[:filtered_locale], group: params[:group], query: params[:query], format: :xlsx)} Export
59
- / Search
60
- = form_tag weeler_translations_path, method: 'get', class: "navbar-form navbar-right", role: "search" do
61
- = hidden_field_tag :filtered_locale, params[:filtered_locale] if params[:filtered_locale].present?
62
- = hidden_field_tag :group, params[:group] if params[:group].present?
63
- .form-group
64
- = text_field_tag :query, params[:query], class: "form-control", placeholder: "Search"
65
- %button.btn.btn-default{type: "submit"} Submit
66
- / /.navbar-collapse
67
- .container
68
- .row
69
- .col-lg-12
70
- %table.table.table-hover
71
- %thead
72
- %tr
73
- %th Locale
74
- %th Key
75
- %th.text-center Value
76
- %th.text-center Interpolations
77
- %th.text-center Created
78
- %th
79
- %tbody#translations
80
- - @translations.each do |translation|
81
- = render :partial => "weeler/translations/translation", locals: {translation: translation}
82
- .container
83
- .row
23
+ .col-xs-12
24
+ %nav.navbar.navbar-default{ role: "navigation" }
25
+ .collapse.navbar-collapse.navbar-ex1-collapse
26
+
27
+ /locale dropdown
28
+ %ul.nav.navbar-nav
29
+ %li.dropdown
30
+ %a.dropdown-toggle{ href: "#", data: { toggle: 'dropdown' } }
31
+ = "Locale: "
32
+ = (params[:filtered_locale].capitalize if params[:filtered_locale]) || "All"
33
+ %b.caret
34
+ %ul.dropdown-menu
35
+ %li
36
+ %a{href: weeler_translations_path(group: params[:group])} All
37
+ - I18n.available_locales.each do |locale|
38
+ - if locale.present?
39
+ %li
40
+ %a{href: weeler_translations_path(group: params[:group], filtered_locale: locale)}= locale.capitalize
41
+
42
+
43
+ / key group lookup
44
+ %ul.nav.navbar-nav.navbar-left
45
+ %li.dropdown
46
+ %a.dropdown-toggle{ href: "#", data: { toggle: 'dropdown' } }
47
+ = "Key: "
48
+ = (params[:group].capitalize if params[:group]) || "All"
49
+ %b.caret
50
+ %ul.dropdown-menu
51
+ %li
52
+ %a{href: weeler_translations_path(filtered_locale: params[:filtered_locale])} All
53
+ - @groups.each do |group|
54
+ - if group.present?
55
+ %li
56
+ %a{href: weeler_translations_path(filtered_locale: params[:filtered_locale], group: group)}= group.capitalize
57
+ / Import and export data
58
+ = form_tag import_weeler_translations_path, {:multipart => true, class: "navbar-form navbar-right"} do
59
+ .form-group
60
+ %input.weeler-file-inputs{name: "file", type: "file"}/
61
+ .btn-group
62
+ %button.btn.btn-default{type: "submit"} Import
63
+ %a.btn.btn-default{href: export_weeler_translations_path(filtered_locale: params[:filtered_locale], group: params[:group], query: params[:query], date_from: params[:date_from], date_till: params[:date_till], format: :xlsx)} Export
64
+
65
+ .row
66
+ .col-xs-12
67
+ %nav.navbar.navbar-default{role: "navigation"}
68
+ / Collect the nav links, forms, and other content for toggling
69
+ .collapse.navbar-collapse.navbar-ex1-collapse
70
+ / Groups dropdown
71
+ / Search
72
+ = form_tag weeler_translations_path, method: 'get', class: "navbar-form navbar-right", role: "search" do
73
+ = hidden_field_tag :filtered_locale, params[:filtered_locale] if params[:filtered_locale].present?
74
+ = hidden_field_tag :group, params[:group] if params[:group].present?
75
+ .form-group
76
+ = text_field_tag :date_from, params[:date_from], class: "form-control datepicker", placeholder: "Created from"
77
+ .form-group
78
+ = text_field_tag :date_till, params[:date_till], class: "form-control datepicker", placeholder: "Created till"
79
+ .form-group
80
+ = text_field_tag :query, params[:query], class: "form-control", placeholder: "Search"
81
+ %button.btn.btn-default{type: "submit"} Submit
82
+ / /.navbar-collapse
83
+ .row
84
+ .col-lg-12
85
+ %table.table.table-hover
86
+ %thead
87
+ %tr
88
+ %th Locale
89
+ %th Key
90
+ %th.text-center Value
91
+ %th.text-center Interpolations
92
+ %th.text-center Created
93
+ %th
94
+ %tbody#translations
95
+ - @translations.each do |translation|
96
+ = render :partial => "weeler/translations/translation", locals: {translation: translation}
97
+ .row
98
+ .col-xs-12
84
99
  = paginate @translations, params: {controller: "weeler/translations", action: "index", filtered_locale: params[:filtered_locale], group: params[:group], query: params[:query] }, previous_label: "<<", next_label: ">>", theme: "weeler"
@@ -2,7 +2,7 @@ module Weeler
2
2
  module VERSION
3
3
  MAJOR = 1
4
4
  MINOR = 5
5
- TINY = 1
5
+ TINY = 2
6
6
  PRE = nil
7
7
  STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".")
8
8
  end
@@ -25,7 +25,6 @@ Gem::Specification.new do |spec|
25
25
 
26
26
  spec.add_dependency 'kaminari'
27
27
  spec.add_dependency 'haml'
28
- spec.add_dependency 'sass-twitter-bootstrap-rails'
29
28
  spec.add_dependency 'jquery-turbolinks'
30
29
  spec.add_dependency 'jquery-ui-rails'
31
30
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: weeler
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.1
4
+ version: 1.5.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Artūrs Braučs
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2016-03-31 00:00:00.000000000 Z
12
+ date: 2016-04-05 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -95,20 +95,6 @@ dependencies:
95
95
  - - ">="
96
96
  - !ruby/object:Gem::Version
97
97
  version: '0'
98
- - !ruby/object:Gem::Dependency
99
- name: sass-twitter-bootstrap-rails
100
- requirement: !ruby/object:Gem::Requirement
101
- requirements:
102
- - - ">="
103
- - !ruby/object:Gem::Version
104
- version: '0'
105
- type: :runtime
106
- prerelease: false
107
- version_requirements: !ruby/object:Gem::Requirement
108
- requirements:
109
- - - ">="
110
- - !ruby/object:Gem::Version
111
- version: '0'
112
98
  - !ruby/object:Gem::Dependency
113
99
  name: jquery-turbolinks
114
100
  requirement: !ruby/object:Gem::Requirement
@@ -337,23 +323,31 @@ files:
337
323
  - Rakefile
338
324
  - app/.DS_Store
339
325
  - app/assets/.DS_Store
326
+ - app/assets/fonts/glyphicons-halflings-regular.eot
327
+ - app/assets/fonts/glyphicons-halflings-regular.svg
328
+ - app/assets/fonts/glyphicons-halflings-regular.ttf
329
+ - app/assets/fonts/glyphicons-halflings-regular.woff
330
+ - app/assets/fonts/glyphicons-halflings-regular.woff2
340
331
  - app/assets/javascripts/.DS_Store
341
332
  - app/assets/javascripts/weeler/app/index.js
342
333
  - app/assets/javascripts/weeler/init.js.coffee
343
334
  - app/assets/javascripts/weeler/lib/flash.js
344
335
  - app/assets/javascripts/weeler/lib/sortable.js
336
+ - app/assets/javascripts/weeler/vendor/bootstrap-datetimepicker.min.js
337
+ - app/assets/javascripts/weeler/vendor/bootstrap-switch.js
345
338
  - app/assets/javascripts/weeler/vendor/bootstrap.file-input.js
346
339
  - app/assets/javascripts/weeler/vendor/bootstrap.js
347
340
  - app/assets/javascripts/weeler/vendor/bootstrap.rowlink.js
348
- - app/assets/javascripts/weeler/vendor/bootstrap.switch.js
341
+ - app/assets/javascripts/weeler/vendor/moment.js
349
342
  - app/assets/stylesheets/.DS_Store
350
343
  - app/assets/stylesheets/weeler/app/index.css
351
344
  - app/assets/stylesheets/weeler/init.css.erb
352
345
  - app/assets/stylesheets/weeler/style.css.scss
353
- - app/assets/stylesheets/weeler/vendor/bootstrap.min.css
346
+ - app/assets/stylesheets/weeler/vendor/bootstrap-datetimepicker.css
347
+ - app/assets/stylesheets/weeler/vendor/bootstrap-switch.css
348
+ - app/assets/stylesheets/weeler/vendor/bootstrap.css.scss
354
349
  - app/assets/stylesheets/weeler/vendor/bootstrap.rowlink.css
355
350
  - app/assets/stylesheets/weeler/vendor/bootstrap.spinner.css
356
- - app/assets/stylesheets/weeler/vendor/bootstrap.switch.css
357
351
  - app/controllers/concerns/weeler/section_seo.rb
358
352
  - app/controllers/weeler/administration_controller.rb
359
353
  - app/controllers/weeler/application_controller.rb
@@ -1,382 +0,0 @@
1
- /*! ============================================================
2
- * bootstrapSwitch v1.8 by Larentis Mattia @SpiritualGuru
3
- * http://www.larentis.eu/
4
- *
5
- * Enhanced for radiobuttons by Stein, Peter @BdMdesigN
6
- * http://www.bdmdesign.org/
7
- *
8
- * Project site:
9
- * http://www.larentis.eu/switch/
10
- * ============================================================
11
- * Licensed under the Apache License, Version 2.0
12
- * http://www.apache.org/licenses/LICENSE-2.0
13
- * ============================================================ */
14
-
15
- !function ($) {
16
- "use strict";
17
-
18
- $.fn['bootstrapSwitch'] = function (method) {
19
- var inputSelector = 'input[type!="hidden"]';
20
- var methods = {
21
- init: function () {
22
- return this.each(function () {
23
- var $element = $(this)
24
- , $div
25
- , $switchLeft
26
- , $switchRight
27
- , $label
28
- , $form = $element.closest('form')
29
- , myClasses = ""
30
- , classes = $element.attr('class')
31
- , color
32
- , moving
33
- , onLabel = "ON"
34
- , offLabel = "OFF"
35
- , icon = false
36
- , textLabel = false;
37
-
38
- $.each(['switch-mini', 'switch-small', 'switch-large'], function (i, el) {
39
- if (classes.indexOf(el) >= 0)
40
- myClasses = el;
41
- });
42
-
43
- $element.addClass('has-switch');
44
-
45
- if ($element.data('on') !== undefined)
46
- color = "switch-" + $element.data('on');
47
-
48
- if ($element.data('on-label') !== undefined)
49
- onLabel = $element.data('on-label');
50
-
51
- if ($element.data('off-label') !== undefined)
52
- offLabel = $element.data('off-label');
53
-
54
- if ($element.data('label-icon') !== undefined)
55
- icon = $element.data('label-icon');
56
-
57
- if ($element.data('text-label') !== undefined)
58
- textLabel = $element.data('text-label');
59
-
60
- $switchLeft = $('<span>')
61
- .addClass("switch-left")
62
- .addClass(myClasses)
63
- .addClass(color)
64
- .html(onLabel);
65
-
66
- color = '';
67
- if ($element.data('off') !== undefined)
68
- color = "switch-" + $element.data('off');
69
-
70
- $switchRight = $('<span>')
71
- .addClass("switch-right")
72
- .addClass(myClasses)
73
- .addClass(color)
74
- .html(offLabel);
75
-
76
- $label = $('<label>')
77
- .html("&nbsp;")
78
- .addClass(myClasses)
79
- .attr('for', $element.find(inputSelector).attr('id'));
80
-
81
- if (icon) {
82
- $label.html('<i class="icon ' + icon + '"></i>');
83
- }
84
-
85
- if (textLabel) {
86
- $label.html('' + textLabel + '');
87
- }
88
-
89
- $div = $element.find(inputSelector).wrap($('<div>')).parent().data('animated', false);
90
-
91
- if ($element.data('animated') !== false)
92
- $div.addClass('switch-animate').data('animated', true);
93
-
94
- $div
95
- .append($switchLeft)
96
- .append($label)
97
- .append($switchRight);
98
-
99
- $element.find('>div').addClass(
100
- $element.find(inputSelector).is(':checked') ? 'switch-on' : 'switch-off'
101
- );
102
-
103
- if ($element.find(inputSelector).is(':disabled'))
104
- $(this).addClass('deactivate');
105
-
106
- var changeStatus = function ($this) {
107
- if ($element.parent('label').is('.label-change-switch')) {
108
-
109
- } else {
110
- $this.siblings('label').trigger('mousedown').trigger('mouseup').trigger('click');
111
- }
112
- };
113
-
114
- $element.on('keydown', function (e) {
115
- if (e.keyCode === 32) {
116
- e.stopImmediatePropagation();
117
- e.preventDefault();
118
- changeStatus($(e.target).find('span:first'));
119
- }
120
- });
121
-
122
- $switchLeft.on('click', function (e) {
123
- changeStatus($(this));
124
- });
125
-
126
- $switchRight.on('click', function (e) {
127
- changeStatus($(this));
128
- });
129
-
130
- $element.find(inputSelector).on('change', function (e, skipOnChange) {
131
- var $this = $(this)
132
- , $element = $this.parent()
133
- , thisState = $this.is(':checked')
134
- , state = $element.is('.switch-off');
135
-
136
- e.preventDefault();
137
-
138
- $element.css('left', '');
139
-
140
- if (state === thisState) {
141
-
142
- if (thisState)
143
- $element.removeClass('switch-off').addClass('switch-on');
144
- else $element.removeClass('switch-on').addClass('switch-off');
145
-
146
- if ($element.data('animated') !== false)
147
- $element.addClass("switch-animate");
148
-
149
- if (typeof skipOnChange === 'boolean' && skipOnChange)
150
- return;
151
-
152
- $element.parent().trigger('switch-change', {'el': $this, 'value': thisState})
153
- }
154
- });
155
-
156
- $element.find('label').on('mousedown touchstart', function (e) {
157
- var $this = $(this);
158
- moving = false;
159
-
160
- e.preventDefault();
161
- e.stopImmediatePropagation();
162
-
163
- $this.closest('div').removeClass('switch-animate');
164
-
165
- if ($this.closest('.has-switch').is('.deactivate')) {
166
- $this.unbind('click');
167
- } else if ($this.closest('.switch-on').parent().is('.radio-no-uncheck')) {
168
- $this.unbind('click');
169
- } else {
170
- $this.on('mousemove touchmove', function (e) {
171
- var $element = $(this).closest('.make-switch')
172
- , relativeX = (e.pageX || e.originalEvent.targetTouches[0].pageX) - $element.offset().left
173
- , percent = (relativeX / $element.width()) * 100
174
- , left = 25
175
- , right = 75;
176
-
177
- moving = true;
178
-
179
- if (percent < left)
180
- percent = left;
181
- else if (percent > right)
182
- percent = right;
183
-
184
- $element.find('>div').css('left', (percent - right) + "%")
185
- });
186
-
187
- $this.on('click touchend', function (e) {
188
- var $this = $(this)
189
- , $myInputBox = $this.siblings('input');
190
-
191
- e.stopImmediatePropagation();
192
- e.preventDefault();
193
-
194
- $this.unbind('mouseleave');
195
-
196
- if (moving)
197
- $myInputBox.prop('checked', !(parseInt($this.parent().css('left')) < -25));
198
- else
199
- $myInputBox.prop("checked", !$myInputBox.is(":checked"));
200
-
201
- moving = false;
202
- $myInputBox.trigger('change');
203
- });
204
-
205
- $this.on('mouseleave', function (e) {
206
- var $this = $(this)
207
- , $myInputBox = $this.siblings('input');
208
-
209
- e.preventDefault();
210
- e.stopImmediatePropagation();
211
-
212
- $this.unbind('mouseleave mousemove');
213
- $this.trigger('mouseup');
214
-
215
- $myInputBox.prop('checked', !(parseInt($this.parent().css('left')) < -25)).trigger('change');
216
- });
217
-
218
- $this.on('mouseup', function (e) {
219
- e.stopImmediatePropagation();
220
- e.preventDefault();
221
-
222
- $(this).trigger('mouseleave');
223
- });
224
- }
225
- });
226
-
227
- if ($form.data('bootstrapSwitch') !== 'injected') {
228
- $form.bind('reset', function () {
229
- setTimeout(function () {
230
- $form.find('.make-switch').each(function () {
231
- var $input = $(this).find(inputSelector);
232
-
233
- $input.prop('checked', $input.is(':checked')).trigger('change');
234
- });
235
- }, 1);
236
- });
237
- $form.data('bootstrapSwitch', 'injected');
238
- }
239
- }
240
- );
241
- },
242
- toggleActivation: function () {
243
- var $this = $(this);
244
-
245
- $this.toggleClass('deactivate');
246
- $this.find(inputSelector).prop('disabled', $this.is('.deactivate'));
247
- },
248
- isActive: function () {
249
- return !$(this).hasClass('deactivate');
250
- },
251
- setActive: function (active) {
252
- var $this = $(this);
253
-
254
- if (active) {
255
- $this.removeClass('deactivate');
256
- $this.find(inputSelector).removeAttr('disabled');
257
- }
258
- else {
259
- $this.addClass('deactivate');
260
- $this.find(inputSelector).attr('disabled', 'disabled');
261
- }
262
- },
263
- toggleState: function (skipOnChange) {
264
- var $input = $(this).find(':checkbox');
265
- $input.prop('checked', !$input.is(':checked')).trigger('change', skipOnChange);
266
- },
267
- toggleRadioState: function (skipOnChange) {
268
- var $radioinput = $(this).find(':radio');
269
- $radioinput.not(':checked').prop('checked', !$radioinput.is(':checked')).trigger('change', skipOnChange);
270
- },
271
- toggleRadioStateAllowUncheck: function (uncheck, skipOnChange) {
272
- var $radioinput = $(this).find(':radio');
273
- if (uncheck) {
274
- $radioinput.not(':checked').trigger('change', skipOnChange);
275
- }
276
- else {
277
- $radioinput.not(':checked').prop('checked', !$radioinput.is(':checked')).trigger('change', skipOnChange);
278
- }
279
- },
280
- setState: function (value, skipOnChange) {
281
- $(this).find(inputSelector).prop('checked', value).trigger('change', skipOnChange);
282
- },
283
- setOnLabel: function (value) {
284
- var $switchLeft = $(this).find(".switch-left");
285
- $switchLeft.html(value);
286
- },
287
- setOffLabel: function (value) {
288
- var $switchRight = $(this).find(".switch-right");
289
- $switchRight.html(value);
290
- },
291
- setOnClass: function (value) {
292
- var $switchLeft = $(this).find(".switch-left");
293
- var color = '';
294
- if (value !== undefined) {
295
- if ($(this).attr('data-on') !== undefined) {
296
- color = "switch-" + $(this).attr('data-on')
297
- }
298
- $switchLeft.removeClass(color);
299
- color = "switch-" + value;
300
- $switchLeft.addClass(color);
301
- }
302
- },
303
- setOffClass: function (value) {
304
- var $switchRight = $(this).find(".switch-right");
305
- var color = '';
306
- if (value !== undefined) {
307
- if ($(this).attr('data-off') !== undefined) {
308
- color = "switch-" + $(this).attr('data-off')
309
- }
310
- $switchRight.removeClass(color);
311
- color = "switch-" + value;
312
- $switchRight.addClass(color);
313
- }
314
- },
315
- setAnimated: function (value) {
316
- var $element = $(this).find(inputSelector).parent();
317
- if (value === undefined) value = false;
318
- $element.data('animated', value);
319
- $element.attr('data-animated', value);
320
-
321
- if ($element.data('animated') !== false) {
322
- $element.addClass("switch-animate");
323
- } else {
324
- $element.removeClass("switch-animate");
325
- }
326
- },
327
- setSizeClass: function (value) {
328
- var $element = $(this);
329
- var $switchLeft = $element.find(".switch-left");
330
- var $switchRight = $element.find(".switch-right");
331
- var $label = $element.find("label");
332
- $.each(['switch-mini', 'switch-small', 'switch-large'], function (i, el) {
333
- if (el !== value) {
334
- $switchLeft.removeClass(el);
335
- $switchRight.removeClass(el);
336
- $label.removeClass(el);
337
- } else {
338
- $switchLeft.addClass(el);
339
- $switchRight.addClass(el);
340
- $label.addClass(el);
341
- }
342
- });
343
- },
344
- status: function () {
345
- return $(this).find(inputSelector).is(':checked');
346
- },
347
- destroy: function () {
348
- var $element = $(this)
349
- , $div = $element.find('div')
350
- , $form = $element.closest('form')
351
- , $inputbox;
352
-
353
- $div.find(':not(input)').remove();
354
-
355
- $inputbox = $div.children();
356
- $inputbox.unwrap().unwrap();
357
-
358
- $inputbox.unbind('change');
359
-
360
- if ($form) {
361
- $form.unbind('reset');
362
- $form.removeData('bootstrapSwitch');
363
- }
364
-
365
- return $inputbox;
366
- }
367
- };
368
-
369
- if (methods[method])
370
- return methods[method].apply(this, Array.prototype.slice.call(arguments, 1));
371
- else if (typeof method === 'object' || !method)
372
- return methods.init.apply(this, arguments);
373
- else
374
- $.error('Method ' + method + ' does not exist!');
375
- };
376
- }(jQuery);
377
-
378
- (function ($) {
379
- $(function () {
380
- $('.make-switch')['bootstrapSwitch']();
381
- });
382
- })(jQuery);