Skip to content

Commit

Permalink
Options to show 5th week and last week in monthly recurring UI.
Browse files Browse the repository at this point in the history
closes #66
  • Loading branch information
naomiaro authored and nathany committed Oct 17, 2014
1 parent 20894a4 commit deaddc9
Show file tree
Hide file tree
Showing 7 changed files with 43 additions and 13 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# 1.2.4 / 2014-10-17

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

# 1.2.3 / 2014-10-01

* Revert fix hidden dialog when called from Bootstrap modal. [#47](https://github.com/GetJobber/recurring_select/pull/47)
Expand Down
16 changes: 13 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ You have to translate JavaScript texts too by including the locale file in your

For other languages include a JavaScript file like this:

```javascript
```coffeescript
$.fn.recurring_select.texts = {
repeat: "Repeat"
frequency: "Frequency"
Expand All @@ -117,8 +117,18 @@ $.fn.recurring_select.texts = {
day_of_week: "Day of week"
cancel: "Cancel"
ok: "OK"
days_first_letter: ["S", "M", "T", "W", "T", "F", "S" ]
order: ["1st", "2nd", "3rd", "4th"]
days_first_letter: ["S", "M", "T", "W", "T", "F", "S"]
order: ["1st", "2nd", "3rd", "4th", "5th", "Last"]
}
```

Javascript options include:

```coffeescript
$.fn.recurring_select.options = {
monthly: {
show_week: [true, true, true, true, false, false] //display week 1, 2 .... Last
}
}
```

Expand Down
9 changes: 8 additions & 1 deletion app/assets/javascripts/recurring_select.js.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,12 @@ $.fn.recurring_select = (method) ->
else
$.error( "Method #{method} does not exist on jQuery.recurring_select" );

$.fn.recurring_select.options = {
monthly: {
show_week: [true, true, true, true, false, false]
}
}

$.fn.recurring_select.texts = {
repeat: "Repeat"
last_day: "Last Day"
Expand All @@ -93,5 +99,6 @@ $.fn.recurring_select.texts = {
summary: "Summary"
first_day_of_week: 0
days_first_letter: ["S", "M", "T", "W", "T", "F", "S" ]
order: ["1st", "2nd", "3rd", "4th"]
order: ["1st", "2nd", "3rd", "4th", "5th", "Last"]
show_week: [true, true, true, true, false, false]
}
3 changes: 2 additions & 1 deletion app/assets/javascripts/recurring_select/fr.js.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,6 @@ $.fn.recurring_select.texts = {
summary: "Résumé"
first_day_of_week: 1
days_first_letter: ["D", "L", "M", "M", "J", "V", "S" ]
order: ["1er", "2ème", "3ème", "4ème"]
order: ["1er", "2ème", "3ème", "4ème", "5ème", "Dernier"]
show_week: [true, true, true, true, false, false]
}
16 changes: 9 additions & 7 deletions app/assets/javascripts/recurring_select_dialog.js.coffee.erb
Original file line number Diff line number Diff line change
Expand Up @@ -193,15 +193,17 @@ window.RecurringSelectDialog =
monthly_calendar = section.find(".rs_calendar_week")
monthly_calendar.html ""
row_labels = $.fn.recurring_select.texts["order"]
show_row = $.fn.recurring_select.options["monthly"]["show_week"]
cell_str = $.fn.recurring_select.texts["days_first_letter"]

for num in [1..4]
monthly_calendar.append "<span>#{row_labels[num - 1]}</span>"
for day_of_week in [0..6]
day_link = $("<a>", {text: cell_str[day_of_week]})
day_link.attr("day", day_of_week)
day_link.attr("instance", num)
monthly_calendar.append day_link
for num, index in [1, 2, 3, 4, 5, -1]
if show_row[index]
monthly_calendar.append "<span>#{row_labels[index]}</span>"
for day_of_week in [0..6]
day_link = $("<a>", {text: cell_str[day_of_week]})
day_link.attr("day", day_of_week)
day_link.attr("instance", num)
monthly_calendar.append day_link
$.each @current_rule.hash.validations.day_of_week, (key, value) ->
$.each value, (index, instance) ->
section.find("a[day='#{key}'][instance='#{instance}']").addClass("selected")
Expand Down
2 changes: 1 addition & 1 deletion lib/recurring_select/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module RecurringSelect
VERSION = "1.2.3"
VERSION = "1.2.4"
end
6 changes: 6 additions & 0 deletions spec/dummy/app/assets/javascripts/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,9 @@
//= require jquery_ujs
//= require recurring_select
//= require_tree .

$.fn.recurring_select.options = {
monthly: {
show_week: [true, true, true, true, true, true]
}
};

0 comments on commit deaddc9

Please sign in to comment.