recurring_select 1.2.1 → 1.2.2

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
- ---
2
- SHA1:
3
- metadata.gz: d147dfd3d4246febebf68ddb7cc94a99655cf460
4
- data.tar.gz: 1994c19574f24dc7f6b0657239942b68af6b43e6
5
- SHA512:
6
- metadata.gz: 9645aa0e8ec4d39d5c8907cf0f864e16973bbafc9ebb8f91bf446554bc7346b5202520a38470494836a751f2619d01b953f150fb308554ce3b9e1c8a7a1a188f
7
- data.tar.gz: 2f2f226f16b1d5e0764e8582ec479b63af9760b3f6018839f6e24dfe18808b9f30b002bdb8452d23756a954c89ac44bcc0e484772e34bbaf21bad5f286edbd40
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 7c6d7d4aa1daf583df9f4d817d72a524e99958eb
4
+ data.tar.gz: 99cf5f696743e108e73c4ef18625e87211ee0b6d
5
+ SHA512:
6
+ metadata.gz: 428846f435d5e4f24d3ddaed9c02dfbe8e651d151acf604fcf6d8fe56027f0e6e7dd52ccf0ffb347d2b612bd4d96a197736c924a0a5203d55d979eea6f7c1e53
7
+ data.tar.gz: 53c1ae690fdfc4417b7a99e97f952ce76c9d5d1bc43e18ae7ef75ffa6c082fb21c98e2d837ac1ba2023f50895ec547c954db188e4a39613b768936a5d501b655
data/README.md CHANGED
@@ -1,80 +1,85 @@
1
- RecurringSelect
2
- =============
1
+ # Recurring Select
3
2
 
4
3
  [![Build Status](https://travis-ci.org/GetJobber/recurring_select.png?branch=master)](https://travis-ci.org/GetJobber/recurring_select) [![Code Climate](https://codeclimate.com/github/GetJobber/recurring_select.png)](https://codeclimate.com/github/GetJobber/recurring_select)
5
4
 
6
- This is a gem to add a number of selectors and helpers for working with recurring schedules in a rails app.
7
- It uses the [IceCube](https://github.com/seejohnrun/ice_cube) recurring scheduling gem.
5
+ This gem adds selectors and helpers for working with recurring schedules in a Rails app. It uses [ice_cube](https://github.com/seejohnrun/ice_cube) recurring scheduling gem.
8
6
 
9
7
  Created by the [Jobber](http://getjobber.com) team for Jobber, the leading business management tool for field service companies.
10
8
 
11
- Check out the [live demo](http://recurring-select-demo.herokuapp.com/) (code in [spec\dummy](https://github.com/GetJobber/recurring_select/tree/master/spec/dummy) folder)
9
+ Check out the [live demo](http://recurring-select-demo.herokuapp.com/) (code in [spec/dummy](https://github.com/GetJobber/recurring_select/tree/master/spec/dummy) folder)
12
10
 
13
11
 
14
- Usage
15
- -----
12
+ ## Usage
16
13
 
17
14
  Basic selector:
18
15
 
19
- Load the gem:
20
- `gem 'recurring_select'`
16
+ Add the gem to your Gemfile:
21
17
 
22
- Require assets
23
- Desktop view
24
- application.js
25
- `//= require recurring_select`
26
- application.css
27
- `//= require recurring_select`
18
+ ```ruby
19
+ gem 'recurring_select'
20
+ ```
28
21
 
29
- or jQueryMobile interface
30
- application.js
31
- `//= require jquery-mobile-rs`
32
- application.css
33
- `//= require jquery-mobile-rs`
22
+ ### Require Assets
34
23
 
24
+ #### Desktop Interface:
25
+ - application.js: `//= require recurring_select`
26
+ - application.css: `//= require recurring_select`
35
27
 
36
- In the form view call the helper:
37
- `<%= f.select_recurring :recurring_rule_column %>`
28
+ #### jQuery Mobile Interface:
29
+ - application.js: `//= require jquery-mobile-rs`
30
+ - application.css: `//= require jquery-mobile-rs`
31
+
32
+ ### Form Helper
38
33
 
39
- Options
40
- -------
34
+ In the form view call the helper:
41
35
 
42
- Defaults Values
36
+ ```erb
37
+ <%= f.select_recurring :recurring_rule_column %>
43
38
  ```
39
+
40
+ #### Options
41
+
42
+ ```ruby
44
43
  f.select_recurring :current_existing_rule, [
45
44
  IceCube::Rule.weekly.day(:monday, :wednesday, :friday),
46
45
  IceCube::Rule.monthly.day_of_month(-1)
47
46
  ]
48
47
  ```
49
48
 
50
- :allow_blank let's you pick if there is a "not recurring" value
51
- ```
52
- f.select_recurring :current_existing_rule, :allow_blank => true
49
+ Use :allow_blank for a "not recurring" option:
50
+
51
+ ```ruby
52
+ f.select_recurring :current_existing_rule, nil, :allow_blank => true
53
53
  ```
54
54
 
55
55
 
56
- Additional Helpers
57
- ------------------
56
+ ### Additional Helpers
58
57
 
59
- RecurringSelect also comes with several helpers for parsing up the
58
+ Recurring Select also comes with helpers for parsing the
60
59
  parameters when they hit your application.
61
60
 
62
61
  You can send the column into the `is_valid_rule?` method to check the
63
62
  validity of the input.
64
- `RecurringSelect.is_valid_rule?(possible_rule)`
63
+
64
+ ```ruby
65
+ RecurringSelect.is_valid_rule?(possible_rule)
66
+ ```
65
67
 
66
68
  There is also a `dirty_hash_to_rule` method for sanitizing the inputs
67
- for IceCube. This is sometimes needed based on if you're receiving strings, fixed
69
+ for IceCube. This is sometimes needed if you're receiving strings, fixed
68
70
  numbers, strings vs symbols, etc.
69
- `RecurringSelect.dirty_hash_to_rule(params)`
70
71
 
71
- I18n
72
- ----
73
- Recurrent select is I18n aware
72
+ ```ruby
73
+ RecurringSelect.dirty_hash_to_rule(params)
74
+ ```
75
+
76
+ ### I18n
77
+
78
+ Recurring Select is I18n aware
74
79
 
75
80
  You can create a locale file like this:
76
81
 
77
- ```
82
+ ```yaml
78
83
  en:
79
84
  recurring_select:
80
85
  not_recurring: "- not recurring -"
@@ -85,16 +90,16 @@ en:
85
90
  or: or
86
91
  ```
87
92
 
88
- You have to translate javascript texts too by including the locale file in your assets manifest. Only french and english are supported for the moment
93
+ You have to translate JavaScript texts too by including the locale file in your assets manifest. Only French and English are supported for the moment.
89
94
 
90
95
  ```
91
96
  //= require recurring_select/en
92
97
  //= require recurring_select/fr
93
98
  ```
94
99
 
95
- For other languages include a file like this:
100
+ For other languages include a JavaScript file like this:
96
101
 
97
- ```
102
+ ```javascript
98
103
  $.fn.recurring_select.texts = {
99
104
  repeat: "Repeat"
100
105
  frequency: "Frequency"
@@ -117,25 +122,33 @@ $.fn.recurring_select.texts = {
117
122
  }
118
123
  ```
119
124
 
120
- Testing and development
121
- ----------------------
125
+ ## Testing and Development
126
+
127
+ The dummy app uses a [Postgres](http://postgresapp.com/) database `recurring_select_development`. To get setup:
128
+
129
+ ```console
130
+ bundle
131
+ rake db:create
132
+ ```
122
133
 
123
134
  Start the dummy server for clicking around the interface:
124
- `rails s`
135
+
136
+ ```console
137
+ rails s
138
+ ```
125
139
 
126
140
  Use [Guard](https://github.com/guard/guard) and RSpec for all tests. I'd
127
- love to get jasmine running also, but haven't had time yet.
141
+ love to get Jasmine running also, but haven't had time yet.
128
142
 
129
143
  Tests can be ran against different versions of Rails like so:
130
144
 
131
145
  ```
132
146
  BUNDLE_GEMFILE=spec/gemfiles/Gemfile.rails-3.2.x bundle install
133
- BUNDLE_GEMFILE=spec/gemfiles/Gemfile.rails-3.2.x bundle exec rake spec
147
+ BUNDLE_GEMFILE=spec/gemfiles/Gemfile.rails-3.2.x bundle exec rspec spec
134
148
  ```
135
149
 
136
150
  Feel free to open issues or send pull requests.
137
151
 
138
- Licensing
139
- ---------
140
- This project rocks and uses MIT-LICENSE.
152
+ ## Licensing
141
153
 
154
+ This project rocks and uses MIT-LICENSE.
@@ -13,6 +13,7 @@ window.RecurringSelectDialog =
13
13
 
14
14
  open_in = $("body")
15
15
  open_in = $(".ui-page-active") if $(".ui-page-active").length
16
+ open_in = $(".modal") if $(".modal:visible").length
16
17
  open_in.append @template()
17
18
  @outer_holder = $(".rs_dialog_holder")
18
19
  @inner_holder = @outer_holder.find ".rs_dialog"
@@ -107,7 +108,7 @@ window.RecurringSelectDialog =
107
108
  if @current_rule.hash.validations? && @current_rule.hash.validations.day?
108
109
  $(@current_rule.hash.validations.day).each (index, val) ->
109
110
  section.find(".day_holder a[data-value='"+val+"']").addClass("selected")
110
- section.on "click", ".day_holder a", @daysChanged
111
+ section.off('click', '.day_holder a').on "click", ".day_holder a", @daysChanged
111
112
 
112
113
  section.show()
113
114
 
@@ -326,7 +327,6 @@ window.RecurringSelectDialog =
326
327
  "
327
328
  for day_of_week in [$.fn.recurring_select.texts["first_day_of_week"]...(7 + $.fn.recurring_select.texts["first_day_of_week"])]
328
329
  day_of_week = day_of_week % 7
329
- console.log day_of_week
330
330
  str += "<a href='#' data-value='#{day_of_week}'>#{$.fn.recurring_select.texts["days_first_letter"][day_of_week]}</a>"
331
331
 
332
332
  str += "
@@ -36,13 +36,15 @@ select {
36
36
  a {float:right; display:inline-block; height:16px; width:16px; background-image:url(<%=asset_path "recurring_select/cancel.png"%>); background-position:center; background-repeat:no-repeat;}
37
37
  }
38
38
 
39
- p { padding:5px 0; margin:0;
39
+ p { padding:5px 0; margin:0; line-height: 14px;
40
40
  label {margin-right:10px;}
41
41
  }
42
42
 
43
+ a { -moz-box-sizing: content-box; -webkit-box-sizing: content-box; box-sizing: content-box; }
44
+
43
45
  .freq_option_section { display:none;
44
46
  label { font-weight: bold; }
45
- .rs_interval {width:30px; text-align:center;}
47
+ .rs_interval {width:30px; text-align:center; display: inline-block;}
46
48
 
47
49
  .day_holder { border-left:1px solid #ccc; position:relative; margin-top:5px; height:26px;
48
50
  a {display:block; padding:5px 7px; font-size:14px; border-style:solid; border-color:#ccc; border-width:1px 1px 1px 0px; float:left; text-decoration:none; font-weight:bold; @include inset_shadows(0px, 1px, 2px, rgba(0,0,0,0.1)); background-color:#fff;;
@@ -33,10 +33,10 @@ module RecurringSelectHelper
33
33
 
34
34
  if default_schedules.blank?
35
35
  if currently_selected_rule.present?
36
- options_array << blank_option if options[:allow_blank]
37
36
  options_array << ice_cube_rule_to_option(currently_selected_rule)
38
37
  options_array << separator
39
38
  options_array << [I18n.t("recurring_select.change_schedule"), "custom"]
39
+ options_array << blank_option if options[:allow_blank]
40
40
  else
41
41
  options_array << blank_option
42
42
  options_array << [I18n.t("recurring_select.set_schedule"), "custom"]
@@ -1,3 +1,3 @@
1
1
  module RecurringSelect
2
- VERSION = "1.2.1"
2
+ VERSION = "1.2.2"
3
3
  end
metadata CHANGED
@@ -1,116 +1,151 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: recurring_select
3
- version: !ruby/object:Gem::Version
4
- version: 1.2.1
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.2.2
5
5
  platform: ruby
6
- authors:
6
+ authors:
7
7
  - Jobber
8
8
  - Forrest Zeisler
9
9
  - Nathan Youngman
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
-
14
- date: 2014-02-12 00:00:00 Z
15
- dependencies:
16
- - !ruby/object:Gem::Dependency
13
+ date: 2014-09-30 00:00:00.000000000 Z
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
17
16
  name: rails
18
- prerelease: false
19
- requirement: &id001 !ruby/object:Gem::Requirement
20
- requirements:
17
+ requirement: !ruby/object:Gem::Requirement
18
+ requirements:
21
19
  - - ">="
22
- - !ruby/object:Gem::Version
23
- version: "3.2"
20
+ - !ruby/object:Gem::Version
21
+ version: '3.2'
24
22
  type: :runtime
25
- version_requirements: *id001
26
- - !ruby/object:Gem::Dependency
27
- name: jquery-rails
28
23
  prerelease: false
29
- requirement: &id002 !ruby/object:Gem::Requirement
30
- requirements:
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ requirements:
26
+ - - ">="
27
+ - !ruby/object:Gem::Version
28
+ version: '3.2'
29
+ - !ruby/object:Gem::Dependency
30
+ name: jquery-rails
31
+ requirement: !ruby/object:Gem::Requirement
32
+ requirements:
31
33
  - - ">="
32
- - !ruby/object:Gem::Version
33
- version: "3.0"
34
+ - !ruby/object:Gem::Version
35
+ version: '3.0'
34
36
  type: :runtime
35
- version_requirements: *id002
36
- - !ruby/object:Gem::Dependency
37
- name: ice_cube
38
37
  prerelease: false
39
- requirement: &id003 !ruby/object:Gem::Requirement
40
- requirements:
38
+ version_requirements: !ruby/object:Gem::Requirement
39
+ requirements:
40
+ - - ">="
41
+ - !ruby/object:Gem::Version
42
+ version: '3.0'
43
+ - !ruby/object:Gem::Dependency
44
+ name: ice_cube
45
+ requirement: !ruby/object:Gem::Requirement
46
+ requirements:
41
47
  - - ">="
42
- - !ruby/object:Gem::Version
43
- version: "0.11"
48
+ - !ruby/object:Gem::Version
49
+ version: '0.11'
44
50
  type: :runtime
45
- version_requirements: *id003
46
- - !ruby/object:Gem::Dependency
47
- name: sass-rails
48
51
  prerelease: false
49
- requirement: &id004 !ruby/object:Gem::Requirement
50
- requirements:
52
+ version_requirements: !ruby/object:Gem::Requirement
53
+ requirements:
51
54
  - - ">="
52
- - &id005 !ruby/object:Gem::Version
53
- version: "3.1"
55
+ - !ruby/object:Gem::Version
56
+ version: '0.11'
57
+ - !ruby/object:Gem::Dependency
58
+ name: sass-rails
59
+ requirement: !ruby/object:Gem::Requirement
60
+ requirements:
61
+ - - ">="
62
+ - !ruby/object:Gem::Version
63
+ version: '3.1'
54
64
  type: :runtime
55
- version_requirements: *id004
56
- - !ruby/object:Gem::Dependency
57
- name: coffee-rails
58
65
  prerelease: false
59
- requirement: &id006 !ruby/object:Gem::Requirement
60
- requirements:
66
+ version_requirements: !ruby/object:Gem::Requirement
67
+ requirements:
61
68
  - - ">="
62
- - *id005
69
+ - !ruby/object:Gem::Version
70
+ version: '3.1'
71
+ - !ruby/object:Gem::Dependency
72
+ name: coffee-rails
73
+ requirement: !ruby/object:Gem::Requirement
74
+ requirements:
75
+ - - ">="
76
+ - !ruby/object:Gem::Version
77
+ version: '3.1'
63
78
  type: :runtime
64
- version_requirements: *id006
65
- - !ruby/object:Gem::Dependency
66
- name: bundler
67
79
  prerelease: false
68
- requirement: &id007 !ruby/object:Gem::Requirement
69
- requirements:
80
+ version_requirements: !ruby/object:Gem::Requirement
81
+ requirements:
70
82
  - - ">="
71
- - !ruby/object:Gem::Version
83
+ - !ruby/object:Gem::Version
84
+ version: '3.1'
85
+ - !ruby/object:Gem::Dependency
86
+ name: bundler
87
+ requirement: !ruby/object:Gem::Requirement
88
+ requirements:
89
+ - - ">="
90
+ - !ruby/object:Gem::Version
72
91
  version: 1.3.5
73
92
  type: :development
74
- version_requirements: *id007
75
- - !ruby/object:Gem::Dependency
76
- name: rspec-rails
77
93
  prerelease: false
78
- requirement: &id008 !ruby/object:Gem::Requirement
79
- requirements:
94
+ version_requirements: !ruby/object:Gem::Requirement
95
+ requirements:
80
96
  - - ">="
81
- - &id009 !ruby/object:Gem::Version
82
- version: "2.14"
97
+ - !ruby/object:Gem::Version
98
+ version: 1.3.5
99
+ - !ruby/object:Gem::Dependency
100
+ name: rspec-rails
101
+ requirement: !ruby/object:Gem::Requirement
102
+ requirements:
103
+ - - ">="
104
+ - !ruby/object:Gem::Version
105
+ version: '2.14'
83
106
  type: :development
84
- version_requirements: *id008
85
- - !ruby/object:Gem::Dependency
86
- name: rspec
87
107
  prerelease: false
88
- requirement: &id010 !ruby/object:Gem::Requirement
89
- requirements:
108
+ version_requirements: !ruby/object:Gem::Requirement
109
+ requirements:
110
+ - - ">="
111
+ - !ruby/object:Gem::Version
112
+ version: '2.14'
113
+ - !ruby/object:Gem::Dependency
114
+ name: rspec
115
+ requirement: !ruby/object:Gem::Requirement
116
+ requirements:
90
117
  - - ">="
91
- - *id009
118
+ - !ruby/object:Gem::Version
119
+ version: '2.14'
92
120
  type: :development
93
- version_requirements: *id010
94
- - !ruby/object:Gem::Dependency
95
- name: rake
96
121
  prerelease: false
97
- requirement: &id011 !ruby/object:Gem::Requirement
98
- requirements:
122
+ version_requirements: !ruby/object:Gem::Requirement
123
+ requirements:
124
+ - - ">="
125
+ - !ruby/object:Gem::Version
126
+ version: '2.14'
127
+ - !ruby/object:Gem::Dependency
128
+ name: rake
129
+ requirement: !ruby/object:Gem::Requirement
130
+ requirements:
99
131
  - - ">="
100
- - !ruby/object:Gem::Version
132
+ - !ruby/object:Gem::Version
101
133
  version: 0.9.6
102
134
  type: :development
103
- version_requirements: *id011
104
- description: This gem provides a useful interface for creating recurring rules for the ice_cube gem.
105
- email:
135
+ prerelease: false
136
+ version_requirements: !ruby/object:Gem::Requirement
137
+ requirements:
138
+ - - ">="
139
+ - !ruby/object:Gem::Version
140
+ version: 0.9.6
141
+ description: This gem provides a useful interface for creating recurring rules for
142
+ the ice_cube gem.
143
+ email:
106
144
  - forrest@getjobber.com
107
145
  executables: []
108
-
109
146
  extensions: []
110
-
111
147
  extra_rdoc_files: []
112
-
113
- files:
148
+ files:
114
149
  - MIT-LICENSE
115
150
  - README.md
116
151
  - Rakefile
@@ -132,30 +167,27 @@ files:
132
167
  - lib/recurring_select/engine.rb
133
168
  - lib/recurring_select/version.rb
134
169
  homepage: http://github.com/getjobber/recurring_select
135
- licenses:
170
+ licenses:
136
171
  - MIT
137
172
  metadata: {}
138
-
139
173
  post_install_message:
140
174
  rdoc_options: []
141
-
142
- require_paths:
175
+ require_paths:
143
176
  - lib
144
- required_ruby_version: !ruby/object:Gem::Requirement
145
- requirements:
146
- - &id012
147
- - ">="
148
- - !ruby/object:Gem::Version
149
- version: "0"
150
- required_rubygems_version: !ruby/object:Gem::Requirement
151
- requirements:
152
- - *id012
177
+ required_ruby_version: !ruby/object:Gem::Requirement
178
+ requirements:
179
+ - - ">="
180
+ - !ruby/object:Gem::Version
181
+ version: '0'
182
+ required_rubygems_version: !ruby/object:Gem::Requirement
183
+ requirements:
184
+ - - ">="
185
+ - !ruby/object:Gem::Version
186
+ version: '0'
153
187
  requirements: []
154
-
155
188
  rubyforge_project:
156
- rubygems_version: 2.2.1
189
+ rubygems_version: 2.2.2
157
190
  signing_key:
158
191
  specification_version: 4
159
192
  summary: A select helper which gives you magical powers to generate ice_cube rules.
160
193
  test_files: []
161
-