@@ -43,7 +43,6 @@ window.RecurringSelectDialog =
43
43
@inner_holder.css new_style_hash
44
44
@inner_holder.trigger "recurring_select:dialog_positioned"
45
45
else
46
- @content.css {"width": @content.width()+"px"}
47
46
@inner_holder.addClass "animated"
48
47
@inner_holder.animate new_style_hash, 200, =>
49
48
@inner_holder.removeClass "animated"
@@ -103,10 +102,15 @@ window.RecurringSelectDialog =
103
102
interval_input.val(@current_rule.hash.interval)
104
103
interval_input.on "change keyup", @intervalChanged
105
104
105
+ # clear selected days
106
+ section.find(".day_holder a").each (index, element) ->
107
+ $(element).removeClass("selected")
108
+
106
109
# connect the day fields
107
110
if @current_rule.hash.validations? && @current_rule.hash.validations.day?
108
111
$(@current_rule.hash.validations.day).each (index, val) ->
109
112
section.find(".day_holder a[data-value='"+val+"']").addClass("selected")
113
+
110
114
section.off('click', '.day_holder a').on "click", ".day_holder a", @daysChanged
111
115
112
116
section.show()
@@ -161,9 +165,9 @@ window.RecurringSelectDialog =
161
165
162
166
summaryFetch: ->
163
167
return if !(@current_rule.hash? && (rule_type = @current_rule.hash.rule_type)?)
164
- @content.css {"width": @content.width()+"px"}
168
+ @current_rule.hash['week_start'] = $.fn.recurring_select.texts["first_day_of_week"]
165
169
$.ajax
166
- url: "/recurring_select/translate",
170
+ url: "<%= Rails . application . config . action_controller . relative_url_root %> /recurring_select/translate/#{$.fn.recurring_select.texts["locale_iso_code"]} ",
167
171
type: "POST",
168
172
data: @current_rule.hash
169
173
success: @summaryFetchSuccess
@@ -198,12 +202,14 @@ window.RecurringSelectDialog =
198
202
199
203
for num, index in [1, 2, 3, 4, 5, -1]
200
204
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]})
205
+ monthly_calendar.append "< span > #{row_labels[num - 1]}</ span > "
206
+ for day_of_week in [$.fn.recurring_select.texts["first_day_of_week"]...(7 + $.fn.recurring_select.texts["first_day_of_week"])]
207
+ day_of_week = day_of_week % 7
208
+ day_link = $("< a > ", {text: cell_str[day_of_week] })
204
209
day_link.attr("day", day_of_week)
205
210
day_link.attr("instance", num)
206
211
monthly_calendar.append day_link
212
+
207
213
$.each @current_rule.hash.validations.day_of_week, (key, value) ->
208
214
$.each value, (index, instance) ->
209
215
section.find("a[day='#{key}'][instance='#{instance}']").addClass("selected")
@@ -252,7 +258,6 @@ window.RecurringSelectDialog =
252
258
@current_rule.hash.interval = parseInt($(event.currentTarget).val())
253
259
if @current_rule.hash.interval < 1 || isNaN(@current_rule.hash.interval)
254
260
@current_rule.hash.interval = 1
255
- # $(event.currentTarget).val(@current_rule.hash.interval)
256
261
@summaryUpdate()
257
262
258
263
daysChanged: (event) =>
@@ -301,9 +306,9 @@ window.RecurringSelectDialog =
301
306
< div class ='rs_dialog '>
302
307
< div class ='rs_dialog_content '>
303
308
< h1 > #{$.fn.recurring_select.texts["repeat"]} < a href ='# ' title ='#{$.fn.recurring_select.texts["cancel"]} ' Alt ='#{$.fn.recurring_select.texts["cancel"]} '> </ a > </ h1 >
304
- < p >
309
+ < p class =' frequency-select-wrapper ' >
305
310
< label for ='rs_frequency '> #{$.fn.recurring_select.texts["frequency"]}:</ label >
306
- < select id ='rs_frequency ' class ='rs_frequency ' name ='rs_frequency '>
311
+ < select data-wrapper-class =' ui-recurring-select ' id ='rs_frequency ' class ='rs_frequency ' name ='rs_frequency '>
307
312
< option value ='Daily '> #{$.fn.recurring_select.texts["daily"]}</ option >
308
313
< option value ='Weekly '> #{$.fn.recurring_select.texts["weekly"]}</ option >
309
314
< option value ='Monthly '> #{$.fn.recurring_select.texts["monthly"]}</ option >
@@ -314,14 +319,14 @@ window.RecurringSelectDialog =
314
319
< div class ='daily_options freq_option_section '>
315
320
< p >
316
321
#{$.fn.recurring_select.texts["every"]}
317
- < input type ='text ' name ='rs_daily_interval ' class ='rs_daily_interval rs_interval ' value ='1 ' size ='2 ' />
322
+ < input type ='text ' data-wrapper-class =' ui-recurring-select ' name ='rs_daily_interval ' class ='rs_daily_interval rs_interval ' value ='1 ' size ='2 ' />
318
323
#{$.fn.recurring_select.texts["days"]}
319
324
</ p >
320
325
</ div >
321
326
< div class ='weekly_options freq_option_section '>
322
327
< p >
323
328
#{$.fn.recurring_select.texts["every"]}
324
- < input type ='text ' name ='rs_weekly_interval ' class ='rs_weekly_interval rs_interval ' value ='1 ' size ='2 ' />
329
+ < input type ='text ' data-wrapper-class =' ui-recurring-select ' name ='rs_weekly_interval ' class ='rs_weekly_interval rs_interval ' value ='1 ' size ='2 ' />
325
330
#{$.fn.recurring_select.texts["weeks_on"]}:
326
331
</ p >
327
332
< div class ='day_holder '>
@@ -337,29 +342,29 @@ window.RecurringSelectDialog =
337
342
< div class ='monthly_options freq_option_section '>
338
343
< p >
339
344
#{$.fn.recurring_select.texts["every"]}
340
- < input type ='text ' name ='rs_monthly_interval ' class ='rs_monthly_interval rs_interval ' value ='1 ' size ='2 ' />
345
+ < input type ='text ' data-wrapper-class =' ui-recurring-select ' name ='rs_monthly_interval ' class ='rs_monthly_interval rs_interval ' value ='1 ' size ='2 ' />
341
346
#{$.fn.recurring_select.texts["months"]}:
342
347
</ p >
343
348
< p class ='monthly_rule_type '>
344
- < span > #{$.fn.recurring_select.texts["day_of_month"]} < input type ='radio ' class ='monthly_rule_type_day ' name ='monthly_rule_type ' value ='true ' /> </ span >
345
- < span > #{$.fn.recurring_select.texts["day_of_week"]} < input type ='radio ' class ='monthly_rule_type_week ' name ='monthly_rule_type ' value ='true ' /> </ span >
349
+ < span > < label for =' monthly_rule_type_day ' > #{$.fn.recurring_select.texts["day_of_month"]}</ label > < input type ='radio ' class ='monthly_rule_type_day ' name ='monthly_rule_type ' id =' monthly_rule_type_day ' value ='true ' /> </ span >
350
+ < span > < label for =' monthly_rule_type_week ' > #{$.fn.recurring_select.texts["day_of_week"]}</ label > < input type ='radio ' class ='monthly_rule_type_week ' name ='monthly_rule_type ' id =' monthly_rule_type_week ' value ='true ' /> </ span >
346
351
</ p >
347
352
< p class ='rs_calendar_day '> </ p >
348
353
< p class ='rs_calendar_week '> </ p >
349
354
</ div >
350
355
< div class ='yearly_options freq_option_section '>
351
356
< p >
352
357
#{$.fn.recurring_select.texts["every"]}
353
- < input type ='text ' name ='rs_yearly_interval ' class ='rs_yearly_interval rs_interval ' value ='1 ' size ='2 ' />
358
+ < input type ='text ' data-wrapper-class =' ui-recurring-select ' name ='rs_yearly_interval ' class ='rs_yearly_interval rs_interval ' value ='1 ' size ='2 ' />
354
359
#{$.fn.recurring_select.texts["years"]}
355
360
</ p >
356
361
</ div >
357
362
< p class ='rs_summary '>
358
363
< span > </ span >
359
364
</ p >
360
365
< div class ='controls '>
361
- < input type ='button ' class ='rs_save ' value ='#{$.fn.recurring_select.texts["ok"]} ' />
362
- < input type ='button ' class ='rs_cancel ' value ='#{$.fn.recurring_select.texts["cancel"]} ' />
366
+ < input type ='button ' data-wrapper-class =' ui-recurring-select ' class ='rs_save ' value ='#{$.fn.recurring_select.texts["ok"]} ' />
367
+ < input type ='button ' data-wrapper-class =' ui-recurring-select ' class ='rs_cancel ' value ='#{$.fn.recurring_select.texts["cancel"]} ' />
363
368
</ div >
364
369
</ div >
365
370
</ div >
0 commit comments