Skip to content

Commit 0bbd84e

Browse files
committed
Merge remote-tracking branch 'origin/master' into sass_helpers
2 parents 59454b8 + 055c09d commit 0bbd84e

File tree

7 files changed

+50
-18
lines changed

7 files changed

+50
-18
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ For other languages include a JavaScript file like this:
101101

102102
```coffeescript
103103
$.fn.recurring_select.texts = {
104+
locale_iso_code: "fr"
104105
repeat: "Repeat"
105106
frequency: "Frequency"
106107
daily: "Daily"

app/assets/javascripts/recurring_select.js.coffee

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ $.fn.recurring_select.options = {
8080
}
8181

8282
$.fn.recurring_select.texts = {
83+
locale_iso_code: "en"
8384
repeat: "Repeat"
8485
last_day: "Last Day"
8586
frequency: "Frequency"

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
$.fn.recurring_select.texts = {
2+
locale_iso_code: "fr"
23
repeat: "Récurrence"
34
last_day: "Dernier jour"
45
frequency: "Fréquence"

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

Lines changed: 22 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ window.RecurringSelectDialog =
4343
@inner_holder.css new_style_hash
4444
@inner_holder.trigger "recurring_select:dialog_positioned"
4545
else
46-
@content.css {"width": @content.width()+"px"}
4746
@inner_holder.addClass "animated"
4847
@inner_holder.animate new_style_hash, 200, =>
4948
@inner_holder.removeClass "animated"
@@ -103,10 +102,15 @@ window.RecurringSelectDialog =
103102
interval_input.val(@current_rule.hash.interval)
104103
interval_input.on "change keyup", @intervalChanged
105104

105+
# clear selected days
106+
section.find(".day_holder a").each (index, element) ->
107+
$(element).removeClass("selected")
108+
106109
# connect the day fields
107110
if @current_rule.hash.validations? && @current_rule.hash.validations.day?
108111
$(@current_rule.hash.validations.day).each (index, val) ->
109112
section.find(".day_holder a[data-value='"+val+"']").addClass("selected")
113+
110114
section.off('click', '.day_holder a').on "click", ".day_holder a", @daysChanged
111115

112116
section.show()
@@ -161,9 +165,9 @@ window.RecurringSelectDialog =
161165

162166
summaryFetch: ->
163167
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"]
165169
$.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"]}",
167171
type: "POST",
168172
data: @current_rule.hash
169173
success: @summaryFetchSuccess
@@ -198,12 +202,14 @@ window.RecurringSelectDialog =
198202

199203
for num, index in [1, 2, 3, 4, 5, -1]
200204
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] })
204209
day_link.attr("day", day_of_week)
205210
day_link.attr("instance", num)
206211
monthly_calendar.append day_link
212+
207213
$.each @current_rule.hash.validations.day_of_week, (key, value) ->
208214
$.each value, (index, instance) ->
209215
section.find("a[day='#{key}'][instance='#{instance}']").addClass("selected")
@@ -252,7 +258,6 @@ window.RecurringSelectDialog =
252258
@current_rule.hash.interval = parseInt($(event.currentTarget).val())
253259
if @current_rule.hash.interval < 1 || isNaN(@current_rule.hash.interval)
254260
@current_rule.hash.interval = 1
255-
# $(event.currentTarget).val(@current_rule.hash.interval)
256261
@summaryUpdate()
257262

258263
daysChanged: (event) =>
@@ -301,9 +306,9 @@ window.RecurringSelectDialog =
301306
<div class='rs_dialog'>
302307
<div class='rs_dialog_content'>
303308
<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'>
305310
<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'>
307312
<option value='Daily'>#{$.fn.recurring_select.texts["daily"]}</option>
308313
<option value='Weekly'>#{$.fn.recurring_select.texts["weekly"]}</option>
309314
<option value='Monthly'>#{$.fn.recurring_select.texts["monthly"]}</option>
@@ -314,14 +319,14 @@ window.RecurringSelectDialog =
314319
<div class='daily_options freq_option_section'>
315320
<p>
316321
#{$.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' />
318323
#{$.fn.recurring_select.texts["days"]}
319324
</p>
320325
</div>
321326
<div class='weekly_options freq_option_section'>
322327
<p>
323328
#{$.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' />
325330
#{$.fn.recurring_select.texts["weeks_on"]}:
326331
</p>
327332
<div class='day_holder'>
@@ -337,29 +342,29 @@ window.RecurringSelectDialog =
337342
<div class='monthly_options freq_option_section'>
338343
<p>
339344
#{$.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' />
341346
#{$.fn.recurring_select.texts["months"]}:
342347
</p>
343348
<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>
346351
</p>
347352
<p class='rs_calendar_day'></p>
348353
<p class='rs_calendar_week'></p>
349354
</div>
350355
<div class='yearly_options freq_option_section'>
351356
<p>
352357
#{$.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' />
354359
#{$.fn.recurring_select.texts["years"]}
355360
</p>
356361
</div>
357362
<p class='rs_summary'>
358363
<span></span>
359364
</p>
360365
<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"]}' />
363368
</div>
364369
</div>
365370
</div>

app/assets/stylesheets/jquery-mobile-rs.css.scss

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,20 @@
33
*= require_self
44
*/
55

6+
/* Make the jQuery mobile wrapped input elements inline */
7+
div.ui-recurring-select {
8+
display:inline-block;
9+
}
10+
11+
.frequency-select-wrapper label{
12+
display:inline;
13+
}
14+
15+
/* Make the jQuery mobile wrapped labels and radios remain inline elements inline */
16+
p.monthly_rule_type label {
17+
display:inline;
18+
}
19+
620
.rs_dialog_holder {padding-left:0px; background-color:#333; background-color:rgba(30,30,30,0.3); font-size:1em; position:absolute;
721
.rs_dialog { position:absolute; left:10px; right:10px; margin:0px; display:block; z-index:51;
822

app/middleware/recurring_select_middleware.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@ def initialize(app)
77
end
88

99
def call(env)
10-
if env["PATH_INFO"] =~ /^\/recurring_select\/translate/
10+
regexp = /^\/recurring_select\/translate\/(.*)/
11+
if env["PATH_INFO"] =~ regexp
12+
I18n.locale = env["PATH_INFO"].scan(regexp).first.first
1113
request = Rack::Request.new(env)
1214
params = request.params
1315
params.symbolize_keys!

config/locales/nl.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
nl:
2+
recurring_select:
3+
not_recurring: "- niet herhalen -"
4+
change_schedule: "Rooster aanpassen..."
5+
set_schedule: "Rooster instellen..."
6+
new_custom_schedule: "Nieuw aangepast rooster..."
7+
custom_schedule: "Aangepast rooster..."
8+
or: of

0 commit comments

Comments
 (0)