Skip to content

Commit 9de5eae

Browse files
naomiaronathany
authored andcommitted
Options to show 5th week and last week in monthly recurring UI.
closes gregschmit#66
1 parent 20894a4 commit 9de5eae

File tree

7 files changed

+43
-13
lines changed

7 files changed

+43
-13
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# 1.2.4 / 2014-10-17
2+
3+
* Options to show 5th week and last week in monthly recurring UI. [#66](https://github.com/GetJobber/recurring_select/pull/66) (thanks @naomiaro)
4+
15
# 1.2.3 / 2014-10-01
26

37
* Revert fix hidden dialog when called from Bootstrap modal. [#47](https://github.com/GetJobber/recurring_select/pull/47)

README.md

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ You have to translate JavaScript texts too by including the locale file in your
9999

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

102-
```javascript
102+
```coffeescript
103103
$.fn.recurring_select.texts = {
104104
repeat: "Repeat"
105105
frequency: "Frequency"
@@ -117,8 +117,18 @@ $.fn.recurring_select.texts = {
117117
day_of_week: "Day of week"
118118
cancel: "Cancel"
119119
ok: "OK"
120-
days_first_letter: ["S", "M", "T", "W", "T", "F", "S" ]
121-
order: ["1st", "2nd", "3rd", "4th"]
120+
days_first_letter: ["S", "M", "T", "W", "T", "F", "S"]
121+
order: ["1st", "2nd", "3rd", "4th", "5th", "Last"]
122+
}
123+
```
124+
125+
Options include:
126+
127+
```coffeescript
128+
$.fn.recurring_select.options = {
129+
monthly: {
130+
show_week: [true, true, true, true, false, false] //display week 1, 2 .... Last
131+
}
122132
}
123133
```
124134

app/assets/javascripts/recurring_select.js.coffee

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,12 @@ $.fn.recurring_select = (method) ->
7373
else
7474
$.error( "Method #{method} does not exist on jQuery.recurring_select" );
7575

76+
$.fn.recurring_select.options = {
77+
monthly: {
78+
show_week: [true, true, true, true, false, false]
79+
}
80+
}
81+
7682
$.fn.recurring_select.texts = {
7783
repeat: "Repeat"
7884
last_day: "Last Day"
@@ -93,5 +99,6 @@ $.fn.recurring_select.texts = {
9399
summary: "Summary"
94100
first_day_of_week: 0
95101
days_first_letter: ["S", "M", "T", "W", "T", "F", "S" ]
96-
order: ["1st", "2nd", "3rd", "4th"]
102+
order: ["1st", "2nd", "3rd", "4th", "5th", "Last"]
103+
show_week: [true, true, true, true, false, false]
97104
}

app/assets/javascripts/recurring_select/fr.js.coffee

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,6 @@ $.fn.recurring_select.texts = {
1919
summary: "Résumé"
2020
first_day_of_week: 1
2121
days_first_letter: ["D", "L", "M", "M", "J", "V", "S" ]
22-
order: ["1er", "2ème", "3ème", "4ème"]
22+
order: ["1er", "2ème", "3ème", "4ème", "5ème", "Dernier"]
23+
show_week: [true, true, true, true, false, false]
2324
}

app/assets/javascripts/recurring_select_dialog.js.coffee.erb

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -193,15 +193,17 @@ window.RecurringSelectDialog =
193193
monthly_calendar = section.find(".rs_calendar_week")
194194
monthly_calendar.html ""
195195
row_labels = $.fn.recurring_select.texts["order"]
196+
show_row = $.fn.recurring_select.options["monthly"]["show_week"]
196197
cell_str = $.fn.recurring_select.texts["days_first_letter"]
197198

198-
for num in [1..4]
199-
monthly_calendar.append "<span>#{row_labels[num - 1]}</span>"
200-
for day_of_week in [0..6]
201-
day_link = $("<a>", {text: cell_str[day_of_week]})
202-
day_link.attr("day", day_of_week)
203-
day_link.attr("instance", num)
204-
monthly_calendar.append day_link
199+
for num, index in [1, 2, 3, 4, 5, -1]
200+
if show_row[index]
201+
monthly_calendar.append "<span>#{row_labels[index]}</span>"
202+
for day_of_week in [0..6]
203+
day_link = $("<a>", {text: cell_str[day_of_week]})
204+
day_link.attr("day", day_of_week)
205+
day_link.attr("instance", num)
206+
monthly_calendar.append day_link
205207
$.each @current_rule.hash.validations.day_of_week, (key, value) ->
206208
$.each value, (index, instance) ->
207209
section.find("a[day='#{key}'][instance='#{instance}']").addClass("selected")

lib/recurring_select/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
module RecurringSelect
2-
VERSION = "1.2.3"
2+
VERSION = "1.2.4"
33
end

spec/dummy/app/assets/javascripts/application.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,9 @@
88
//= require jquery_ujs
99
//= require recurring_select
1010
//= require_tree .
11+
12+
$.fn.recurring_select.options = {
13+
monthly: {
14+
show_week: [true, true, true, true, true, true]
15+
}
16+
};

0 commit comments

Comments
 (0)