@@ -2,22 +2,36 @@ window.RecurringSelectDialog =
2
2
class RecurringSelectDialog
3
3
constructor: (@recurring_selector) ->
4
4
@current_rule = @recurring_selector.recurring_select('current_rule')
5
+ @position = @recurring_selector.data('recurring-select-position') ? 'fixed'
6
+
5
7
@initDialogBox()
6
8
if not @current_rule.hash? or not @current_rule.hash.rule_type?
7
9
@freqChanged()
8
- else
10
+ else if @position != 'inline'
9
11
setTimeout @positionDialogVert, 10 # allow initial render
10
12
13
+ if @position != 'fixed'
14
+ $('body').on 'click.recurring_select_cancel', (e) =>
15
+ unless $(e.target).closest('.rs_dialog_content').length
16
+ @cancel(e)
17
+ $('body').off('click.recurring_select_cancel')
18
+
19
+
11
20
initDialogBox: ->
12
21
$(".rs_dialog_holder").remove()
13
22
14
- open_in = $("body")
23
+ open_in = if @position == 'inline'
24
+ @recurring_selector.parent()
25
+ else
26
+ $("body")
27
+
15
28
open_in = $(".ui-page-active") if $(".ui-page-active").length
16
29
open_in.append @template()
17
30
@outer_holder = $(".rs_dialog_holder")
31
+ @outer_holder.addClass @position
18
32
@inner_holder = @outer_holder.find ".rs_dialog"
19
33
@content = @outer_holder.find ".rs_dialog_content"
20
- @positionDialogVert(true)
34
+ @positionDialogVert(true) unless @position == 'inline'
21
35
@mainEventInit()
22
36
@freqInit()
23
37
@summaryInit()
@@ -49,7 +63,8 @@ window.RecurringSelectDialog =
49
63
@content.css {"width": "auto"}
50
64
@inner_holder.trigger "recurring_select:dialog_positioned"
51
65
52
- cancel: =>
66
+ cancel: (e) =>
67
+ e.preventDefault() if e
53
68
@outer_holder.remove()
54
69
@recurring_selector.recurring_select('cancel')
55
70
@@ -250,7 +265,7 @@ window.RecurringSelectDialog =
250
265
@current_rule.str = $.fn.recurring_select.texts["daily"]
251
266
@initDailyOptions()
252
267
@summaryUpdate()
253
- @positionDialogVert()
268
+ @positionDialogVert() unless @position == 'inline'
254
269
255
270
intervalChanged: (event) =>
256
271
@current_rule.str = null
0 commit comments