sortablelabel-js 0.8 → 0.9

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: 2cfe5fd7777bb9bfdc7b102445eb9286b1f3e7b3
4
- data.tar.gz: ba6bfb11bccc583cfd89c0a1f7cd92eb7337e33a
3
+ metadata.gz: 9092cbe06787f0323d0037755638116c84745808
4
+ data.tar.gz: b0965d4ddc4bca909fe5e49b41fea7b2b1f7bf79
5
5
  SHA512:
6
- metadata.gz: 6bc193fb82ff8c8f48b62a9feed721e417295bf32ce57ca5ad2db439f469c55861600bdb55262477a28ad235ccab235682bcc0fb363072db676537f7bcb488ee
7
- data.tar.gz: 66def897877720149551efc2fcccd8762891310ee77c0309a4537783dc4fceba8103d39aac86eb4d7e13afeb177c13778259b5d9c4fa00e4d26b26b2fb058e43
6
+ metadata.gz: f563c296378c8b29a637071467675f4ec5357424bebeddc1757afdca2b24b098109621a27679bde1867db192c8b805f5cdee348c12691dd89daf4d596f4d7fb9
7
+ data.tar.gz: fe882a24c6b6c5dd54fa008e3adb7d5c95365eaa9ab014c621cc3046896ea9e7db622882d47803d062398b271d60766785aaee36737e0ee59bcc0270a3779379
@@ -1,5 +1,5 @@
1
1
  module Sortablelabel
2
2
  module Js
3
- VERSION = "0.8"
3
+ VERSION = "0.9"
4
4
  end
5
5
  end
@@ -61,23 +61,24 @@ class @SortableLabel
61
61
  $(@target).each(->
62
62
  stepCount = 1
63
63
  $(this).find(target).each( ->
64
- if _this.options['minimun'] >= stepCount
65
- $(this).closest('.fields').find('.remove_nested_fields').hide();
66
- else
67
- $(this).closest('.fields').find('.remove_nested_fields').show();
68
- $(this).closest('.fields').find(_this.options['positionTarget']).val(stepCount)
69
- if typeof(_this.options['label']) == 'string'
70
- if _this.options['label'].trim() == 'Day'
71
- $(this).closest('.fields').find(_this.options['labelTarget']).html(_this.dayOfWeek(stepCount - 1))
64
+ if($(this).closest('.fields').siblings().find('.remove_nested_fields').data('association') == _this.options['fieldName'])
65
+ if _this.options['minimun'] >= stepCount
66
+ $(this).closest('.fields').find('.remove_nested_fields').hide();
72
67
  else
73
- if _this.options['fieldName']
74
- if $(this).parent().find('.remove_nested_fields').data('association') == _this.options['fieldName']
75
- $(this).closest('.fields').find(_this.options['labelTarget']).html(_this.options['label'] + stepCount)
68
+ $(this).closest('.fields').find('.remove_nested_fields').show();
69
+ $(this).closest('.fields').find(_this.options['positionTarget']).val(stepCount)
70
+ if typeof(_this.options['label']) == 'string'
71
+ if _this.options['label'].trim() == 'Day'
72
+ $(this).closest('.fields').find(_this.options['labelTarget']).html(_this.dayOfWeek(stepCount - 1))
76
73
  else
77
- alert("Field name can't be empty!")
78
- else if typeof(_this.options['label']) == 'function'
79
- $(this).closest('.fields').find(_this.options['labelTarget']).html(_this.options['label'].call($(this).closest('.fields').find(_this.options['labelTarget']), stepCount))
80
- stepCount += 1
74
+ if _this.options['fieldName']
75
+ if $(this).parent().find('.remove_nested_fields').data('association') == _this.options['fieldName']
76
+ $(this).closest('.fields').find(_this.options['labelTarget']).html(_this.options['label'] + stepCount)
77
+ else
78
+ alert("Field name can't be empty!")
79
+ else if typeof(_this.options['label']) == 'function'
80
+ $(this).closest('.fields').find(_this.options['labelTarget']).html(_this.options['label'].call($(this).closest('.fields').find(_this.options['labelTarget']), stepCount))
81
+ stepCount += 1
81
82
  )
82
83
  )
83
84
 
@@ -86,27 +87,30 @@ class @SortableLabel
86
87
  week_group_label_list = []
87
88
  $(@target).each(->
88
89
  $(this).find(target).each(->
89
- tempLabel = $(this).text()
90
- _index = _this.isIncludeWeekGroup(tempLabel, week_group_label_list)
91
- if _index is -1
92
- week_group_label_list.push(
93
- name: tempLabel,
94
- count: 1
95
- )
96
- if typeof _this.options['subPositionTarget'] == 'string'
97
- $(this).closest('.fields').find(_this.options['subPositionTarget']).val(1)
98
- if typeof _this.options['groupLabel'] == 'string'
99
- $(this).html("<i class='fa fa-trophy fa-fw small-opacity-30'></i>" + tempLabel + " " + _this.options['groupLabel'] + " 1")
100
- else
101
- $(this).html("<i class='fa fa-trophy fa-fw small-opacity-30'></i>" + tempLabel)
102
- else if _index > -1
103
- week_group_label_list[_index].count += 1
104
- if typeof _this.options['subPositionTarget'] == 'string'
105
- $(this).closest('.fields').find(_this.options['subPositionTarget']).val(week_group_label_list[_index].count)
106
- if typeof _this.options['groupLabel'] == 'string'
107
- $(this).html("<i class='fa fa-trophy fa-fw small-opacity-30'></i>" + tempLabel + " " + _this.options['groupLabel'] + " " + week_group_label_list[_index].count)
108
- else
109
- $(this).html("<i class='fa fa-trophy fa-fw small-opacity-30'></i>" + tempLabel)
90
+ tempLabel = $(this).closest('.fields').find('.workout_workout_weeks_workout_week_group_id select').find(":selected").text()
91
+ if $(this).closest('.fields').find('.workout_workout_weeks_workout_week_group_id select').find(":selected").val() != ""
92
+ _index = _this.isIncludeWeekGroup(tempLabel, week_group_label_list)
93
+ if _index is -1
94
+ week_group_label_list.push(
95
+ name: tempLabel,
96
+ count: 1
97
+ )
98
+ if typeof _this.options['subPositionTarget'] == 'string'
99
+ $(this).closest('.fields').find(_this.options['subPositionTarget']).val(1)
100
+ if typeof _this.options['groupLabel'] == 'string'
101
+ $(this).html("<i class='fa fa-trophy fa-fw small-opacity-30'></i>" + tempLabel + " " + _this.options['groupLabel'] + " 1")
102
+ else
103
+ $(this).html("<i class='fa fa-trophy fa-fw small-opacity-30'></i>" + tempLabel)
104
+ else if _index > -1
105
+ week_group_label_list[_index].count += 1
106
+ if typeof _this.options['subPositionTarget'] == 'string'
107
+ $(this).closest('.fields').find(_this.options['subPositionTarget']).val(week_group_label_list[_index].count)
108
+ if typeof _this.options['groupLabel'] == 'string'
109
+ $(this).html("<i class='fa fa-trophy fa-fw small-opacity-30'></i>" + tempLabel + " " + _this.options['groupLabel'] + " " + week_group_label_list[_index].count)
110
+ else
111
+ $(this).html("<i class='fa fa-trophy fa-fw small-opacity-30'></i>" + tempLabel)
112
+ else
113
+ $(this).html("<i class='fa fa-trophy fa-fw small-opacity-30'></i>")
110
114
  )
111
115
  )
112
116
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sortablelabel-js
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.8'
4
+ version: '0.9'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joe
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-08-25 00:00:00.000000000 Z
11
+ date: 2017-08-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler