Skip to content

Commit 0c7b2cd

Browse files
committed
Rename everything and require sprockets engine to support rails 7
1 parent e9cded9 commit 0c7b2cd

35 files changed

+646
-607
lines changed

CHANGELOG.md

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,28 @@
1+
# 3.0.1 / 2022-05-30
2+
3+
* Change the name to not clash with existing repository.
4+
* Add sprockets engine to support rails 7
5+
16
# 2.0.0 / 2015-09-24
27

38
* [BREAKING-CHANGE] Dropping support for rails 3.X - Upgrade to sass-rails 4
4-
* [FIX] Rename all css.scss to .scss [#86](https://github.com/GetJobber/recurring_select/pull/86)
9+
* [FIX] Rename all css.scss to .scss [#86](https://github.com/GetJobber/ice_cube_select/pull/86)
510

611
# 1.2.4 / 2014-10-17
712

8-
* Options to show 5th week and last week in monthly recurring UI. [#66](https://github.com/GetJobber/recurring_select/pull/66) (thanks @naomiaro)
13+
* Options to show 5th week and last week in monthly recurring UI. [#66](https://github.com/GetJobber/ice_cube_select/pull/66) (thanks @naomiaro)
914

1015
# 1.2.3 / 2014-10-01
1116

12-
* Revert fix hidden dialog when called from Bootstrap modal. [#47](https://github.com/GetJobber/recurring_select/pull/47)
17+
* Revert fix hidden dialog when called from Bootstrap modal. [#47](https://github.com/GetJobber/ice_cube_select/pull/47)
1318

1419
# 1.2.2 / 2014-09-29
1520

16-
* Show currently selected rule first when selected [#65](https://github.com/GetJobber/recurring_select/pull/65) (thanks @ericmwalsh)
17-
* [FIX] Add some explicit CSS rules to fix issues with Zurb Foundation. [#50](https://github.com/GetJobber/recurring_select/pull/50) (thanks @ndbroadbent)
18-
* [FIX] Fix hidden dialog when called from Bootstrap modal. [#47](https://github.com/GetJobber/recurring_select/pull/47) (thanks @rgrwatson85)
19-
* [FIX] Fix dialog in IE. [#46](https://github.com/GetJobber/recurring_select/pull/46) (thanks @ttp)
20-
* [FIX] Fix rebinding for day of the week selection [#60](https://github.com/GetJobber/recurring_select/pull/60) (thanks @joshjordan)
21+
* Show currently selected rule first when selected [#65](https://github.com/GetJobber/ice_cube_select/pull/65) (thanks @ericmwalsh)
22+
* [FIX] Add some explicit CSS rules to fix issues with Zurb Foundation. [#50](https://github.com/GetJobber/ice_cube_select/pull/50) (thanks @ndbroadbent)
23+
* [FIX] Fix hidden dialog when called from Bootstrap modal. [#47](https://github.com/GetJobber/ice_cube_select/pull/47) (thanks @rgrwatson85)
24+
* [FIX] Fix dialog in IE. [#46](https://github.com/GetJobber/ice_cube_select/pull/46) (thanks @ttp)
25+
* [FIX] Fix rebinding for day of the week selection [#60](https://github.com/GetJobber/ice_cube_select/pull/60) (thanks @joshjordan)
2126
* Travis CI: Testing against latest point releases of Rails.
2227

2328
# 1.2.1 / 2014-02-12
@@ -33,8 +38,8 @@ constant (thanks @fourseven)
3338
# 1.2.1.rc2 / 2013-10-30
3439

3540
* [FIX] Recurring select input displays inconsistently in development
36-
* [FIX] dirty_hash_to_rule was modifying its argument [#35](https://github.com/GetJobber/recurring_select/pull/35) (thanks @asgeo1)
37-
* [FIX] Handle empty hashes [#36](https://github.com/GetJobber/recurring_select/pull/36) (thanks @asgeo1)
41+
* [FIX] dirty_hash_to_rule was modifying its argument [#35](https://github.com/GetJobber/ice_cube_select/pull/35) (thanks @asgeo1)
42+
* [FIX] Handle empty hashes [#36](https://github.com/GetJobber/ice_cube_select/pull/36) (thanks @asgeo1)
3843

3944
# 1.2.1.rc1 / 2013-08-07
4045

@@ -43,8 +48,8 @@ constant (thanks @fourseven)
4348

4449
# 1.2.0 / 2013-07-03
4550

46-
* [ENHANCEMENT] I18n aware [#19](https://github.com/GetJobber/recurring_select/pull/19) (thanks @vddgil)
47-
* remove IceCube::ValidatedRule#to_s monkey patch [#21](https://github.com/GetJobber/recurring_select/pull/21) (thanks @ajsharp)
51+
* [ENHANCEMENT] I18n aware [#19](https://github.com/GetJobber/ice_cube_select/pull/19) (thanks @vddgil)
52+
* remove IceCube::ValidatedRule#to_s monkey patch [#21](https://github.com/GetJobber/ice_cube_select/pull/21) (thanks @ajsharp)
4853

4954
# 1.1.0 / 2013-06-27
5055

@@ -57,7 +62,7 @@ constant (thanks @fourseven)
5762
# 1.0.1 / 2013-04-25
5863

5964
* [FIX] convert week_start value to integer (thanks @rubenrails) #2
60-
* [FIX] recurring_select should be able to handle a string as the input #1
65+
* [FIX] ice_cube_select should be able to handle a string as the input #1
6166

6267
# 1.0.0 / 2013-04-16
6368

README.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
# Recurring Select
22

3-
[![Build Status](https://travis-ci.org/GetJobber/recurring_select.svg?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)
3+
[![Build Status](https://travis-ci.org/GetJobber/ice_cube_select.svg?branch=master)](https://travis-ci.org/GetJobber/ice_cube_select) [![Code Climate](https://codeclimate.com/github/GetJobber/ice_cube_select.png)](https://codeclimate.com/github/GetJobber/ice_cube_select)
44

55
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.
66

77
Created by the [Jobber](http://getjobber.com) team for Jobber, the leading business management tool for field service companies.
88

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)
9+
Check out the [live demo](http://recurring-select-demo.herokuapp.com/) (code in [spec/dummy](https://github.com/GetJobber/ice_cube_select/tree/master/spec/dummy) folder)
1010

1111

1212
## Usage
@@ -16,14 +16,14 @@ Basic selector:
1616
Add the gem to your Gemfile:
1717

1818
```ruby
19-
gem 'recurring_select'
19+
gem 'ice_cube_select'
2020
```
2121

2222
### Require Assets
2323

2424
#### Desktop Interface:
25-
- application.js: `//= require recurring_select`
26-
- application.css: `//= require recurring_select`
25+
- application.js: `//= require ice_cube_select`
26+
- application.css: `//= require ice_cube_select`
2727

2828
#### jQuery Mobile Interface:
2929
- application.js: `//= require jquery-mobile-rs`
@@ -62,15 +62,15 @@ You can send the column into the `is_valid_rule?` method to check the
6262
validity of the input.
6363

6464
```ruby
65-
RecurringSelect.is_valid_rule?(possible_rule)
65+
IceCubeSelect.is_valid_rule?(possible_rule)
6666
```
6767

6868
There is also a `dirty_hash_to_rule` method for sanitizing the inputs
6969
for IceCube. This is sometimes needed if you're receiving strings, fixed
7070
numbers, strings vs symbols, etc.
7171

7272
```ruby
73-
RecurringSelect.dirty_hash_to_rule(params)
73+
IceCubeSelect.dirty_hash_to_rule(params)
7474
```
7575

7676
### I18n
@@ -81,7 +81,7 @@ You can create a locale file like this:
8181

8282
```yaml
8383
en:
84-
recurring_select:
84+
ice_cube_select:
8585
not_recurring: "- not recurring -"
8686
change_schedule: "Change schedule..."
8787
set_schedule: "Set schedule..."
@@ -93,14 +93,14 @@ en:
9393
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.
9494
9595
```
96-
//= require recurring_select/en
97-
//= require recurring_select/fr
96+
//= require ice_cube_select/en
97+
//= require ice_cube_select/fr
9898
```
9999

100100
For other languages include a JavaScript file like this:
101101

102102
```coffeescript
103-
$.fn.recurring_select.texts = {
103+
$.fn.ice_cube_select.texts = {
104104
locale_iso_code: "fr"
105105
repeat: "Repeat"
106106
frequency: "Frequency"
@@ -126,7 +126,7 @@ $.fn.recurring_select.texts = {
126126
Options include:
127127

128128
```coffeescript
129-
$.fn.recurring_select.options = {
129+
$.fn.ice_cube_select.options = {
130130
monthly: {
131131
show_week: [true, true, true, true, false, false] //display week 1, 2 .... Last
132132
}
@@ -135,7 +135,7 @@ $.fn.recurring_select.options = {
135135

136136
## Testing and Development
137137

138-
The dummy app uses a [Postgres](http://postgresapp.com/) database `recurring_select_development`. To get setup:
138+
The dummy app uses a [Postgres](http://postgresapp.com/) database `ice_cube_select_development`. To get setup:
139139

140140
```console
141141
bundle

Rakefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Bundler::GemHelper.install_tasks
1212
require 'rdoc/task'
1313
RDoc::Task.new(:rdoc) do |rdoc|
1414
rdoc.rdoc_dir = 'rdoc'
15-
rdoc.title = 'RecurringSelect'
15+
rdoc.title = 'IceCubeSelect'
1616
rdoc.options << '--line-numbers'
1717
rdoc.rdoc_files.include('README.rdoc')
1818
rdoc.rdoc_files.include('lib/**/*.rb')
File renamed without changes.
File renamed without changes.
File renamed without changes.
Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
(function() {
2+
var $, methods;
3+
4+
$ = jQuery;
5+
6+
$(function() {
7+
$(document).on("focus", ".ice_cube_select", function() {
8+
return $(this).ice_cube_select('set_initial_values');
9+
});
10+
return $(document).on("change", ".ice_cube_select", function() {
11+
return $(this).ice_cube_select('changed');
12+
});
13+
});
14+
15+
methods = {
16+
set_initial_values: function() {
17+
this.data('initial-value-hash', this.val());
18+
return this.data('initial-value-str', $(this.find("option").get()[this.prop("selectedIndex")]).text());
19+
},
20+
changed: function() {
21+
if (this.val() === "custom") {
22+
return methods.open_custom.apply(this);
23+
} else {
24+
return methods.set_initial_values.apply(this);
25+
}
26+
},
27+
open_custom: function() {
28+
this.data("recurring-select-active", true);
29+
new IceCubeSelectDialog(this);
30+
return this.blur();
31+
},
32+
save: function(new_rule) {
33+
var new_json_val;
34+
this.find("option[data-custom]").remove();
35+
new_json_val = JSON.stringify(new_rule.hash);
36+
if ($.inArray(new_json_val, this.find("option").map(function() {
37+
return $(this).val();
38+
})) === -1) {
39+
methods.insert_option.apply(this, [new_rule.str, new_json_val]);
40+
}
41+
this.val(new_json_val);
42+
methods.set_initial_values.apply(this);
43+
return this.trigger("ice_cube_select:save");
44+
},
45+
current_rule: function() {
46+
return {
47+
str: this.data("initial-value-str"),
48+
hash: $.parseJSON(this.data("initial-value-hash"))
49+
};
50+
},
51+
cancel: function() {
52+
this.val(this.data("initial-value-hash"));
53+
this.data("recurring-select-active", false);
54+
return this.trigger("ice_cube_select:cancel");
55+
},
56+
insert_option: function(new_rule_str, new_rule_json) {
57+
var new_option, separator;
58+
separator = this.find("option:disabled");
59+
if (separator.length === 0) {
60+
separator = this.find("option");
61+
}
62+
separator = separator.last();
63+
new_option = $(document.createElement("option"));
64+
new_option.attr("data-custom", true);
65+
if (new_rule_str.substr(new_rule_str.length - 1) !== "*") {
66+
new_rule_str += "*";
67+
}
68+
new_option.text(new_rule_str);
69+
new_option.val(new_rule_json);
70+
return new_option.insertBefore(separator);
71+
},
72+
methods: function() {
73+
return methods;
74+
}
75+
};
76+
77+
$.fn.ice_cube_select = function(method) {
78+
if (method in methods) {
79+
return methods[method].apply(this, Array.prototype.slice.call(arguments, 1));
80+
} else {
81+
return $.error("Method " + method + " does not exist on jQuery.ice_cube_select");
82+
}
83+
};
84+
85+
$.fn.ice_cube_select.options = {
86+
monthly: {
87+
show_week: [true, true, true, true, false, false]
88+
}
89+
};
90+
91+
$.fn.ice_cube_select.texts = {
92+
locale_iso_code: "en",
93+
repeat: "Repeat",
94+
last_day: "Last Day",
95+
frequency: "Frequency",
96+
daily: "Daily",
97+
weekly: "Weekly",
98+
monthly: "Monthly",
99+
yearly: "Yearly",
100+
every: "Every",
101+
days: "day(s)",
102+
weeks_on: "week(s) on",
103+
months: "month(s)",
104+
years: "year(s)",
105+
day_of_month: "Day of month",
106+
day_of_week: "Day of week",
107+
cancel: "Cancel",
108+
ok: "OK",
109+
summary: "Summary",
110+
first_day_of_week: 0,
111+
days_first_letter: ["S", "M", "T", "W", "T", "F", "S"],
112+
order: ["1st", "2nd", "3rd", "4th", "5th", "Last"],
113+
show_week: [true, true, true, true, false, false]
114+
};
115+
116+
}).call(this);

app/assets/javascripts/recurring_select/fr.js.coffee renamed to app/assets/javascripts/ice_cube_select/fr.js.coffee

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
$.fn.recurring_select.texts = {
1+
$.fn.ice_cube_select.texts = {
22
locale_iso_code: "fr"
33
repeat: "Récurrence"
44
last_day: "Dernier jour"
@@ -21,4 +21,4 @@ $.fn.recurring_select.texts = {
2121
days_first_letter: ["D", "L", "M", "M", "J", "V", "S" ]
2222
order: ["1er", "2ème", "3ème", "4ème", "5ème", "Dernier"]
2323
show_week: [true, true, true, true, false, false]
24-
}
24+
}

0 commit comments

Comments
 (0)