RubyApp 0.5.30 → 0.5.31
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Gemfile.lock +1 -1
- data/lib/ruby_app/element.rb +10 -5
- data/lib/ruby_app/elements/mobile/calendars/month.css.haml +26 -0
- data/lib/ruby_app/elements/mobile/calendars/month.html.haml +34 -0
- data/lib/ruby_app/elements/mobile/calendars/month.js.haml +9 -0
- data/lib/ruby_app/elements/mobile/calendars/month.rb +89 -0
- data/lib/ruby_app/elements/mobile/default/features/calendars/default_page.css.haml +4 -0
- data/lib/ruby_app/elements/mobile/default/features/calendars/default_page.html.haml +11 -0
- data/lib/ruby_app/elements/mobile/default/features/calendars/default_page.js.haml +4 -0
- data/lib/ruby_app/elements/mobile/default/features/calendars/default_page.rb +44 -0
- data/lib/ruby_app/elements/mobile/default/features/calendars/month_page.css.haml +4 -0
- data/lib/ruby_app/elements/mobile/default/features/calendars/month_page.html.haml +9 -0
- data/lib/ruby_app/elements/mobile/default/features/calendars/month_page.js.haml +4 -0
- data/lib/ruby_app/elements/mobile/default/features/calendars/month_page.rb +46 -0
- data/lib/ruby_app/elements/mobile/default/features/default_page.css.haml +1 -0
- data/lib/ruby_app/elements/mobile/default/features/default_page.html.haml +2 -0
- data/lib/ruby_app/elements/mobile/default/features/default_page.js.haml +1 -0
- data/lib/ruby_app/elements/mobile/default/features/default_page.rb +4 -0
- data/lib/ruby_app/elements/mobile/default/features/dialogs_page.css.haml +1 -0
- data/lib/ruby_app/elements/mobile/default/features/dialogs_page.html.haml +2 -0
- data/lib/ruby_app/elements/mobile/default/features/dialogs_page.js.haml +1 -0
- data/lib/ruby_app/elements/mobile/default/features/dialogs_page.rb +8 -0
- data/lib/ruby_app/elements/mobile/dialog.html.haml +1 -1
- data/lib/ruby_app/elements/mobile/dialogs/acknowledgement_dialog.css.haml +2 -0
- data/lib/ruby_app/elements/mobile/dialogs/acknowledgement_dialog.js.haml +2 -0
- data/lib/ruby_app/elements/mobile/dialogs/calendars/month_dialog.css.haml +14 -0
- data/lib/ruby_app/elements/mobile/dialogs/calendars/month_dialog.html.haml +18 -0
- data/lib/ruby_app/elements/mobile/dialogs/calendars/month_dialog.js.haml +4 -0
- data/lib/ruby_app/elements/mobile/dialogs/calendars/month_dialog.rb +69 -0
- data/lib/ruby_app/elements/mobile/dialogs/confirmation_dialog.css.haml +2 -0
- data/lib/ruby_app/elements/mobile/dialogs/confirmation_dialog.js.haml +2 -0
- data/lib/ruby_app/elements/mobile/dialogs/exception_dialog.css.haml +2 -0
- data/lib/ruby_app/elements/mobile/dialogs/exception_dialog.js.haml +2 -0
- data/lib/ruby_app/elements/mobile/document.html.haml +1 -1
- data/lib/ruby_app/elements/mobile/document.rb +1 -1
- data/lib/ruby_app/elements/mobile/documents/mail_document.html.haml +1 -1
- data/lib/ruby_app/elements/mobile/documents/quit_document.html.haml +1 -1
- data/lib/ruby_app/elements/mobile/input.html.haml +1 -1
- data/lib/ruby_app/elements/mobile/inputs/multiline_input.html.haml +1 -1
- data/lib/ruby_app/elements/mobile/inputs/toggle_input.html.haml +1 -1
- data/lib/ruby_app/elements/mobile/link.html.haml +1 -1
- data/lib/ruby_app/elements/mobile/list.html.haml +1 -1
- data/lib/ruby_app/elements/mobile/list_divider.html.haml +1 -1
- data/lib/ruby_app/elements/mobile/list_item.html.haml +1 -1
- data/lib/ruby_app/elements/mobile/list_split_item.html.haml +1 -1
- data/lib/ruby_app/elements/mobile/page.html.haml +1 -1
- data/lib/ruby_app/elements/mobile/page.rb +16 -0
- data/lib/ruby_app/scripts/all_once.rb +1 -0
- data/lib/ruby_app/scripts/elements/calendars/month.rb +39 -0
- data/lib/ruby_app/scripts/elements/dialogs.rb +67 -75
- data/lib/ruby_app/translations/en.yml +4 -0
- data/lib/ruby_app/version.rb +1 -1
- metadata +27 -4
data/Gemfile.lock
CHANGED
data/lib/ruby_app/element.rb
CHANGED
@@ -91,19 +91,23 @@ module RubyApp
|
|
91
91
|
end
|
92
92
|
|
93
93
|
def add_class(selector, _class)
|
94
|
-
|
94
|
+
_selector = ".ui-page-active #{selector}"
|
95
|
+
self.execute("RubyApp.addClass(#{_selector.to_json}, #{_class.to_json});")
|
95
96
|
end
|
96
97
|
|
97
98
|
def remove_class(selector, _class)
|
98
|
-
|
99
|
+
_selector = ".ui-page-active #{selector}"
|
100
|
+
self.execute("RubyApp.removeClass(#{_selector.to_json}, #{_class.to_json});")
|
99
101
|
end
|
100
102
|
|
101
103
|
def update_text(selector, value)
|
102
|
-
|
104
|
+
_selector = ".ui-page-active #{selector}"
|
105
|
+
self.execute("RubyApp.updateText(#{_selector.to_json}, #{value.to_json});")
|
103
106
|
end
|
104
107
|
|
105
108
|
def update_value(selector, value)
|
106
|
-
|
109
|
+
_selector = ".ui-page-active #{selector}"
|
110
|
+
self.execute("RubyApp.updateValue(#{_selector.to_json}, #{value.to_json});")
|
107
111
|
end
|
108
112
|
|
109
113
|
def update_input(text, value)
|
@@ -111,7 +115,8 @@ module RubyApp
|
|
111
115
|
end
|
112
116
|
|
113
117
|
def update_value_for(selector, value)
|
114
|
-
|
118
|
+
_selector = ".ui-page-active #{selector}"
|
119
|
+
self.execute("RubyApp.updateValueFor(#{_selector.to_json}, #{value.to_json});")
|
115
120
|
end
|
116
121
|
|
117
122
|
def set_cookie(name, value, expires = Time.now + 365*24*60*60)
|
@@ -0,0 +1,26 @@
|
|
1
|
+
:sass
|
2
|
+
/* #{__FILE__}
|
3
|
+
div.month
|
4
|
+
table
|
5
|
+
width: 100%
|
6
|
+
thead
|
7
|
+
td
|
8
|
+
font-weight: bold
|
9
|
+
padding-bottom: 10px
|
10
|
+
padding-left: 0px
|
11
|
+
padding-right: 0px
|
12
|
+
padding-top: 10px
|
13
|
+
text-align: center
|
14
|
+
width: 14%
|
15
|
+
tbody
|
16
|
+
td
|
17
|
+
a.date, span.date, span.value
|
18
|
+
margin-bottom: 2px
|
19
|
+
margin-left: 2px
|
20
|
+
margin-right: 2px
|
21
|
+
margin-top: 2px
|
22
|
+
padding-bottom: 5px
|
23
|
+
padding-left: 0px
|
24
|
+
padding-right: 0px
|
25
|
+
padding-top: 6px
|
26
|
+
= yield
|
@@ -0,0 +1,34 @@
|
|
1
|
+
/
|
2
|
+
#{__FILE__}
|
3
|
+
%div.month{self.attributes}
|
4
|
+
%table{:cellpadding => 0,
|
5
|
+
:cellspacing => 0}
|
6
|
+
%thead
|
7
|
+
- sunday = self.first_date
|
8
|
+
%tr
|
9
|
+
- (0..6).each do |weekday|
|
10
|
+
- day = sunday + weekday
|
11
|
+
%td
|
12
|
+
= RubyApp::Language.locale.strftime(day, '%a')
|
13
|
+
%tbody
|
14
|
+
- first_date = self.first_date
|
15
|
+
- last_date = self.last_date
|
16
|
+
- date = first_date
|
17
|
+
- (0..6).each do |week|
|
18
|
+
- if date <= last_date
|
19
|
+
%tr
|
20
|
+
- (0..6).each do |weekday|
|
21
|
+
%td
|
22
|
+
- if date.month == @display.month
|
23
|
+
- unless date == @value
|
24
|
+
%a.date.ui-btn.ui-shadow.ui-btn-corner-all{:class => "ui-btn-#{date == @today ? 'down' : 'up'}-#{self.attributes['data-date-theme'] || 'c'}",
|
25
|
+
'href' => '#',
|
26
|
+
'data-value' => date}
|
27
|
+
= date.day
|
28
|
+
- else
|
29
|
+
%span.value.ui-btn.ui-shadow.ui-btn-corner-all.ui-btn-active
|
30
|
+
= date.day
|
31
|
+
- else
|
32
|
+
%span.date.ui-btn.ui-shadow.ui-btn-corner-all.ui-disabled{:class => "ui-btn-down-#{self.attributes['data-date-theme'] || 'c'}"}
|
33
|
+
= date.day
|
34
|
+
- date += 1
|
@@ -0,0 +1,9 @@
|
|
1
|
+
:plain
|
2
|
+
// #{__FILE__}
|
3
|
+
$(document).ready( function() {
|
4
|
+
$(document).on('tap', 'div.month a.date', function(event) {
|
5
|
+
event.preventDefault();
|
6
|
+
RubyApp.queueEvent({_class:'RubyApp::Elements::Mobile::Calendars::Month::ChangedEvent', source:$(this).parents('div.month').attr('id'), value:$(this).attr('data-value')});
|
7
|
+
});
|
8
|
+
});
|
9
|
+
= yield
|
@@ -0,0 +1,89 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'bundler/setup'
|
3
|
+
|
4
|
+
require 'ruby-event'
|
5
|
+
|
6
|
+
module RubyApp
|
7
|
+
|
8
|
+
module Elements
|
9
|
+
|
10
|
+
module Mobile
|
11
|
+
|
12
|
+
module Calendars
|
13
|
+
require 'ruby_app/element'
|
14
|
+
|
15
|
+
class Month < RubyApp::Element
|
16
|
+
|
17
|
+
class ChangedEvent < RubyApp::Element::Event
|
18
|
+
|
19
|
+
attr_reader :value
|
20
|
+
|
21
|
+
def initialize(data)
|
22
|
+
super(data)
|
23
|
+
@value = data['value'].strip
|
24
|
+
@value = @value.empty? ? nil : Date.parse(@value)
|
25
|
+
end
|
26
|
+
|
27
|
+
def to_hash
|
28
|
+
super.merge(:value => @value)
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
32
|
+
|
33
|
+
template_path(:all, File.dirname(__FILE__))
|
34
|
+
|
35
|
+
attr_accessor :value
|
36
|
+
attr_accessor :display
|
37
|
+
|
38
|
+
event :changed
|
39
|
+
|
40
|
+
def initialize(today = Date.today)
|
41
|
+
super()
|
42
|
+
@today = today
|
43
|
+
@value = @today
|
44
|
+
@display = @value
|
45
|
+
end
|
46
|
+
|
47
|
+
def move_previous(event)
|
48
|
+
@display = @display << 1
|
49
|
+
event.update_element(self)
|
50
|
+
end
|
51
|
+
|
52
|
+
def move_next(event)
|
53
|
+
@display = @display >> 1
|
54
|
+
event.update_element(self)
|
55
|
+
end
|
56
|
+
|
57
|
+
protected
|
58
|
+
|
59
|
+
def first_date
|
60
|
+
first_of_month = @display - (@display.day - 1)
|
61
|
+
return first_of_month - first_of_month.wday
|
62
|
+
end
|
63
|
+
|
64
|
+
def last_date
|
65
|
+
next_month = @display >> 1
|
66
|
+
last_of_month = next_month - next_month.day
|
67
|
+
return last_of_month + (6 - last_of_month.wday)
|
68
|
+
end
|
69
|
+
|
70
|
+
def on_event(event)
|
71
|
+
on_changed(event) if event.is_a?(RubyApp::Elements::Mobile::Calendars::Month::ChangedEvent)
|
72
|
+
super(event)
|
73
|
+
end
|
74
|
+
|
75
|
+
def on_changed(event)
|
76
|
+
@value = event.value
|
77
|
+
event.update_element(self)
|
78
|
+
changed(event)
|
79
|
+
end
|
80
|
+
|
81
|
+
end
|
82
|
+
|
83
|
+
end
|
84
|
+
|
85
|
+
end
|
86
|
+
|
87
|
+
end
|
88
|
+
|
89
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
- self.content_for(:html, :page) do
|
2
|
+
/
|
3
|
+
#{__FILE__}
|
4
|
+
%div{'data-role' => 'header'}
|
5
|
+
= @back_button.render(:html)
|
6
|
+
%h1
|
7
|
+
Calendars
|
8
|
+
%div{'data-role' => 'content'}
|
9
|
+
%div{'data-role' => 'controlgroup'}
|
10
|
+
= @month_link.render(:html) do |element|
|
11
|
+
- element.content_for(:html, :link, 'Month')
|
@@ -0,0 +1,44 @@
|
|
1
|
+
module RubyApp
|
2
|
+
|
3
|
+
module Elements
|
4
|
+
|
5
|
+
module Mobile
|
6
|
+
|
7
|
+
module Default
|
8
|
+
|
9
|
+
module Features
|
10
|
+
|
11
|
+
module Calendars
|
12
|
+
require 'ruby_app'
|
13
|
+
require 'ruby_app/elements/mobile/default/features/calendars/month_page'
|
14
|
+
require 'ruby_app/elements/mobile/navigation/back_button'
|
15
|
+
require 'ruby_app/elements/mobile/navigation/page_button'
|
16
|
+
require 'ruby_app/elements/mobile/page'
|
17
|
+
|
18
|
+
class DefaultPage < RubyApp::Elements::Mobile::Page
|
19
|
+
|
20
|
+
template_path(:all, File.dirname(__FILE__))
|
21
|
+
|
22
|
+
def initialize
|
23
|
+
super
|
24
|
+
|
25
|
+
@back_button = RubyApp::Elements::Mobile::Navigation::BackButton.new
|
26
|
+
|
27
|
+
@month_link = RubyApp::Elements::Mobile::Navigation::PageButton.new
|
28
|
+
@month_link.page = RubyApp::Elements::Mobile::Default::Features::Calendars::MonthPage
|
29
|
+
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
37
|
+
|
38
|
+
end
|
39
|
+
|
40
|
+
end
|
41
|
+
|
42
|
+
end
|
43
|
+
|
44
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
module RubyApp
|
2
|
+
|
3
|
+
module Elements
|
4
|
+
|
5
|
+
module Mobile
|
6
|
+
|
7
|
+
module Default
|
8
|
+
|
9
|
+
module Features
|
10
|
+
|
11
|
+
module Calendars
|
12
|
+
require 'ruby_app'
|
13
|
+
require 'ruby_app/elements/mobile/calendars/month'
|
14
|
+
require 'ruby_app/elements/mobile/dialogs/acknowledgement_dialog'
|
15
|
+
require 'ruby_app/elements/mobile/navigation/back_button'
|
16
|
+
require 'ruby_app/elements/mobile/page'
|
17
|
+
|
18
|
+
class MonthPage < RubyApp::Elements::Mobile::Page
|
19
|
+
|
20
|
+
template_path(:all, File.dirname(__FILE__))
|
21
|
+
|
22
|
+
def initialize
|
23
|
+
super
|
24
|
+
|
25
|
+
@back_button = RubyApp::Elements::Mobile::Navigation::BackButton.new
|
26
|
+
|
27
|
+
@month = RubyApp::Elements::Mobile::Calendars::Month.new
|
28
|
+
@month.changed do |element, event|
|
29
|
+
RubyApp::Elements::Mobile::Dialog.show(event, RubyApp::Elements::Mobile::Dialogs::AcknowledgementDialog.new('Month', "You selected day #{@month.value.day}."), :transition => 'pop')
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
37
|
+
|
38
|
+
end
|
39
|
+
|
40
|
+
end
|
41
|
+
|
42
|
+
end
|
43
|
+
|
44
|
+
end
|
45
|
+
|
46
|
+
end
|
@@ -1,5 +1,6 @@
|
|
1
1
|
= RubyApp::Elements::Mobile::Default::Features::Authentications::DefaultPage.render(:css)
|
2
2
|
= RubyApp::Elements::Mobile::Default::Features::ButtonsPage.render(:css)
|
3
|
+
= RubyApp::Elements::Mobile::Default::Features::Calendars::MonthPage.render(:css)
|
3
4
|
= RubyApp::Elements::Mobile::Default::Features::DialogsPage.render(:css)
|
4
5
|
= RubyApp::Elements::Mobile::Default::Features::InputsPage.render(:css)
|
5
6
|
= RubyApp::Elements::Mobile::Default::Features::SwipePage.render(:css)
|
@@ -11,6 +11,8 @@
|
|
11
11
|
- element.content_for(:html, :link, 'Authentications')
|
12
12
|
= @buttons_link.render(:html) do |element|
|
13
13
|
- element.content_for(:html, :link, 'Buttons')
|
14
|
+
= @calendars_link.render(:html) do |element|
|
15
|
+
- element.content_for(:html, :link, 'Calendars')
|
14
16
|
= @dialogs_link.render(:html) do |element|
|
15
17
|
- element.content_for(:html, :link, 'Dialogs')
|
16
18
|
= @inputs_link.render(:html) do |element|
|
@@ -1,5 +1,6 @@
|
|
1
1
|
= RubyApp::Elements::Mobile::Default::Features::Authentications::DefaultPage.render(:js)
|
2
2
|
= RubyApp::Elements::Mobile::Default::Features::ButtonsPage.render(:js)
|
3
|
+
= RubyApp::Elements::Mobile::Default::Features::Calendars::MonthPage.render(:js)
|
3
4
|
= RubyApp::Elements::Mobile::Default::Features::DialogsPage.render(:js)
|
4
5
|
= RubyApp::Elements::Mobile::Default::Features::InputsPage.render(:js)
|
5
6
|
= RubyApp::Elements::Mobile::Default::Features::SwipePage.render(:js)
|
@@ -9,6 +9,7 @@ module RubyApp
|
|
9
9
|
module Features
|
10
10
|
require 'ruby_app/elements/mobile/default/features/authentications/default_page'
|
11
11
|
require 'ruby_app/elements/mobile/default/features/buttons_page'
|
12
|
+
require 'ruby_app/elements/mobile/default/features/calendars/default_page'
|
12
13
|
require 'ruby_app/elements/mobile/default/features/dialogs_page'
|
13
14
|
require 'ruby_app/elements/mobile/default/features/inputs_page'
|
14
15
|
require 'ruby_app/elements/mobile/default/features/swipe_page'
|
@@ -33,6 +34,9 @@ module RubyApp
|
|
33
34
|
@buttons_link = RubyApp::Elements::Mobile::Navigation::PageButton.new
|
34
35
|
@buttons_link.page = RubyApp::Elements::Mobile::Default::Features::ButtonsPage
|
35
36
|
|
37
|
+
@calendars_link = RubyApp::Elements::Mobile::Navigation::PageButton.new
|
38
|
+
@calendars_link.page = RubyApp::Elements::Mobile::Default::Features::Calendars::DefaultPage
|
39
|
+
|
36
40
|
@dialogs_link = RubyApp::Elements::Mobile::Navigation::PageButton.new
|
37
41
|
@dialogs_link.page = RubyApp::Elements::Mobile::Default::Features::DialogsPage
|
38
42
|
|
@@ -1,5 +1,6 @@
|
|
1
1
|
= RubyApp::Elements::Mobile::Button.render(:css)
|
2
2
|
= RubyApp::Elements::Mobile::Dialogs::AcknowledgementDialog.render(:css)
|
3
|
+
= RubyApp::Elements::Mobile::Dialogs::Calendars::MonthDialog.render(:css)
|
3
4
|
= RubyApp::Elements::Mobile::Dialogs::ConfirmationDialog.render(:css)
|
4
5
|
= RubyApp::Elements::Mobile::Dialogs::ExceptionDialog.render(:css)
|
5
6
|
= RubyApp::Elements::Mobile::Navigation::BackButton.render(:css)
|
@@ -1,5 +1,6 @@
|
|
1
1
|
= RubyApp::Elements::Mobile::Button.render(:js)
|
2
2
|
= RubyApp::Elements::Mobile::Dialogs::AcknowledgementDialog.render(:js)
|
3
|
+
= RubyApp::Elements::Mobile::Dialogs::Calendars::MonthDialog.render(:js)
|
3
4
|
= RubyApp::Elements::Mobile::Dialogs::ConfirmationDialog.render(:js)
|
4
5
|
= RubyApp::Elements::Mobile::Dialogs::ExceptionDialog.render(:js)
|
5
6
|
= RubyApp::Elements::Mobile::Navigation::BackButton.render(:js)
|
@@ -10,6 +10,7 @@ module RubyApp
|
|
10
10
|
require 'ruby_app/elements/mobile/button'
|
11
11
|
require 'ruby_app/elements/mobile/dialog'
|
12
12
|
require 'ruby_app/elements/mobile/dialogs/acknowledgement_dialog'
|
13
|
+
require 'ruby_app/elements/mobile/dialogs/calendars/month_dialog'
|
13
14
|
require 'ruby_app/elements/mobile/dialogs/confirmation_dialog'
|
14
15
|
require 'ruby_app/elements/mobile/dialogs/exception_dialog'
|
15
16
|
require 'ruby_app/elements/mobile/navigation/back_button'
|
@@ -44,6 +45,13 @@ module RubyApp
|
|
44
45
|
end
|
45
46
|
end
|
46
47
|
|
48
|
+
@month_link = RubyApp::Elements::Mobile::Button.new
|
49
|
+
@month_link.clicked do |element, event|
|
50
|
+
RubyApp::Elements::Mobile::Dialog.show(event, RubyApp::Elements::Mobile::Dialogs::Calendars::MonthDialog.new(event.today), :transition => 'pop') do |_event, response|
|
51
|
+
RubyApp::Elements::Mobile::Dialog.show(_event, RubyApp::Elements::Mobile::Dialogs::AcknowledgementDialog.new('Acknowledgement', "You responded day #{response.day}."), :transition => 'pop')
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
47
55
|
end
|
48
56
|
|
49
57
|
end
|
@@ -1,2 +1,2 @@
|
|
1
|
-
%div{attributes}
|
1
|
+
%div{self.attributes}
|
2
2
|
= yield :dialog
|
@@ -0,0 +1,14 @@
|
|
1
|
+
:sass
|
2
|
+
/* #{__FILE__}
|
3
|
+
div.buttons
|
4
|
+
padding-bottom: 5px
|
5
|
+
div.ui-block-a
|
6
|
+
text-align: left
|
7
|
+
div.ui-block-b
|
8
|
+
text-align: center
|
9
|
+
div.ui-block-c
|
10
|
+
text-align: right
|
11
|
+
= RubyApp::Elements::Mobile::Button.render(:css)
|
12
|
+
= RubyApp::Elements::Mobile::Calendars::Month.render(:css)
|
13
|
+
= RubyApp::Elements::Mobile::Dialogs::ResponseDialog::CloseLink.render(:css)
|
14
|
+
= yield
|
@@ -0,0 +1,18 @@
|
|
1
|
+
- self.content_for(:html, :dialog) do
|
2
|
+
/
|
3
|
+
#{__FILE__}
|
4
|
+
%div{'data-role' => 'header'}
|
5
|
+
%h1
|
6
|
+
= RubyApp::Language.locale.strftime(@month.display, '%b %Y')
|
7
|
+
%div{'data-role' => 'content'}
|
8
|
+
= @month.render(:html)
|
9
|
+
%div.buttons.ui-grid-b
|
10
|
+
%div.ui-block-a
|
11
|
+
= @previous_link.render(:html) do |element|
|
12
|
+
- element.content_for(:html, :link, RubyApp::Language.locale.strftime(@month.display << 1, '%b'))
|
13
|
+
%div.ui-block-b
|
14
|
+
= @today_link.render(:html) do |element|
|
15
|
+
- element.content_for(:html, :link, RubyApp::Elements::Mobile::Dialogs::Calendars::MonthDialog.translate.today)
|
16
|
+
%div.ui-block-c
|
17
|
+
= @next_link.render(:html) do |element|
|
18
|
+
- element.content_for(:html, :link, RubyApp::Language.locale.strftime(@month.display >> 1, '%b'))
|
@@ -0,0 +1,69 @@
|
|
1
|
+
module RubyApp
|
2
|
+
|
3
|
+
module Elements
|
4
|
+
|
5
|
+
module Mobile
|
6
|
+
|
7
|
+
module Dialogs
|
8
|
+
|
9
|
+
module Calendars
|
10
|
+
require 'ruby_app/elements/mobile/button'
|
11
|
+
require 'ruby_app/elements/mobile/calendars/month'
|
12
|
+
require 'ruby_app/elements/mobile/dialogs/response_dialog'
|
13
|
+
|
14
|
+
class MonthDialog < RubyApp::Elements::Mobile::Dialogs::ResponseDialog
|
15
|
+
|
16
|
+
template_path(:all, File.dirname(__FILE__))
|
17
|
+
|
18
|
+
attr_accessor :value
|
19
|
+
|
20
|
+
def initialize(today = Date.today)
|
21
|
+
super()
|
22
|
+
|
23
|
+
@month = RubyApp::Elements::Mobile::Calendars::Month.new(today)
|
24
|
+
@month.changed do |element, event|
|
25
|
+
@response = @month.value
|
26
|
+
self.hide(event, @today_link.options)
|
27
|
+
end
|
28
|
+
|
29
|
+
@previous_link = RubyApp::Elements::Mobile::Button.new
|
30
|
+
@previous_link.attributes.merge!('data-icon' => 'arrow-l',
|
31
|
+
'data-iconpos' => 'left',
|
32
|
+
'data-inline' => true)
|
33
|
+
@previous_link.clicked do |element, event|
|
34
|
+
@month.move_previous(event)
|
35
|
+
event.update_text('div[data-role="header"] h1', RubyApp::Language.locale.strftime(@month.display, '%b %Y'))
|
36
|
+
event.update_text("##{@previous_link.element_id} span.ui-btn-text", RubyApp::Language.locale.strftime(@month.display << 1, '%b'))
|
37
|
+
event.update_text("##{@next_link.element_id} span.ui-btn-text", RubyApp::Language.locale.strftime(@month.display >> 1, '%b'))
|
38
|
+
end
|
39
|
+
|
40
|
+
@today_link = RubyApp::Elements::Mobile::Dialogs::ResponseDialog::CloseLink.new
|
41
|
+
@today_link.clicked do |element, event|
|
42
|
+
@response = today
|
43
|
+
self.hide(event, element.options)
|
44
|
+
end
|
45
|
+
|
46
|
+
@next_link = RubyApp::Elements::Mobile::Button.new
|
47
|
+
@next_link.attributes.merge!('data-icon' => 'arrow-r',
|
48
|
+
'data-iconpos' => 'right',
|
49
|
+
'data-inline' => true)
|
50
|
+
@next_link.clicked do |element, event|
|
51
|
+
@month.move_next(event)
|
52
|
+
event.update_text('div[data-role="header"] h1', RubyApp::Language.locale.strftime(@month.display, '%b %Y'))
|
53
|
+
event.update_text("##{@previous_link.element_id} span.ui-btn-text", RubyApp::Language.locale.strftime(@month.display << 1, '%b'))
|
54
|
+
event.update_text("##{@next_link.element_id} span.ui-btn-text", RubyApp::Language.locale.strftime(@month.display >> 1, '%b'))
|
55
|
+
end
|
56
|
+
|
57
|
+
end
|
58
|
+
|
59
|
+
end
|
60
|
+
|
61
|
+
end
|
62
|
+
|
63
|
+
end
|
64
|
+
|
65
|
+
end
|
66
|
+
|
67
|
+
end
|
68
|
+
|
69
|
+
end
|
@@ -43,7 +43,7 @@ module RubyApp
|
|
43
43
|
|
44
44
|
@metadata.merge!('viewport' => 'width=device-width, initial-scale=1')
|
45
45
|
|
46
|
-
@stylesheets.push('http://code.jquery.com/mobile/1.1.0-rc.1/jquery.mobile-1.1.0-rc.1.
|
46
|
+
@stylesheets.push('http://code.jquery.com/mobile/1.1.0-rc.1/jquery.mobile-1.1.0-rc.1.css')
|
47
47
|
@stylesheets.push("/#{RubyApp::Language.locale.code}/document.css")
|
48
48
|
|
49
49
|
@scripts.push('http://code.jquery.com/jquery-1.7.1.js')
|
@@ -1,2 +1,2 @@
|
|
1
|
-
%div{attributes}
|
1
|
+
%div{self.attributes}
|
2
2
|
= yield :page
|
@@ -58,6 +58,14 @@ module RubyApp
|
|
58
58
|
super(data)
|
59
59
|
end
|
60
60
|
|
61
|
+
def left?
|
62
|
+
return true
|
63
|
+
end
|
64
|
+
|
65
|
+
def right?
|
66
|
+
return false
|
67
|
+
end
|
68
|
+
|
61
69
|
end
|
62
70
|
|
63
71
|
class SwipedRightEvent < RubyApp::Elements::Mobile::Page::SwipedEvent
|
@@ -66,6 +74,14 @@ module RubyApp
|
|
66
74
|
super(data)
|
67
75
|
end
|
68
76
|
|
77
|
+
def left?
|
78
|
+
return false
|
79
|
+
end
|
80
|
+
|
81
|
+
def right?
|
82
|
+
return true
|
83
|
+
end
|
84
|
+
|
69
85
|
end
|
70
86
|
|
71
87
|
template_path(:all, File.dirname(__FILE__))
|
@@ -0,0 +1,39 @@
|
|
1
|
+
load_script! 'common/features'
|
2
|
+
|
3
|
+
add_step! RubyApp::Elements::Mobile::Page::ShownEvent do |event|
|
4
|
+
event.assert_exists_link('Calendars')
|
5
|
+
event.tap_link('Calendars')
|
6
|
+
end
|
7
|
+
|
8
|
+
add_step! RubyApp::Elements::Mobile::Page::ShownEvent do |event|
|
9
|
+
event.assert_exists_link('Month')
|
10
|
+
event.tap_link('Month')
|
11
|
+
end
|
12
|
+
|
13
|
+
add_step! RubyApp::Elements::Mobile::Page::ShownEvent do |event|
|
14
|
+
event.assert_exists_link(Date.today.day == 15 ? 14 : 15)
|
15
|
+
event.tap_link(Date.today.day == 15 ? 14 : 15)
|
16
|
+
end
|
17
|
+
|
18
|
+
add_step! RubyApp::Elements::Mobile::Page::ShownEvent do |event|
|
19
|
+
event.assert_exists_text("You selected day #{Date.today.day == 15 ? 14 : 15}.")
|
20
|
+
event.assert_exists_link('OK')
|
21
|
+
event.tap_link('OK')
|
22
|
+
end
|
23
|
+
|
24
|
+
add_step! RubyApp::Elements::Mobile::Page::ShownEvent do |event|
|
25
|
+
event.assert_exists_text(Date.today.day == 15 ? 14 : 15)
|
26
|
+
event.tap_link('Back')
|
27
|
+
end
|
28
|
+
|
29
|
+
add_step! RubyApp::Elements::Mobile::Page::ShownEvent do |event|
|
30
|
+
event.tap_link('Back')
|
31
|
+
end
|
32
|
+
|
33
|
+
add_step! RubyApp::Elements::Mobile::Page::ShownEvent do |event|
|
34
|
+
event.tap_link('Back')
|
35
|
+
end
|
36
|
+
|
37
|
+
add_step! RubyApp::Elements::Mobile::Page::ShownEvent do |event|
|
38
|
+
event.refresh_browser
|
39
|
+
end
|
@@ -1,77 +1,69 @@
|
|
1
1
|
load_script! 'common/features'
|
2
2
|
|
3
|
-
add_step! RubyApp::Elements::Mobile::Page::ShownEvent
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
add_step! RubyApp::Elements::Mobile::Page::ShownEvent
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
add_step! RubyApp::
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
add_step! RubyApp::Elements::Mobile::Page::ShownEvent
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
add_step! RubyApp::
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
add_step! RubyApp::
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
add_step! RubyApp::Elements::Mobile::Page::ShownEvent
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
add_step! RubyApp::Elements::Mobile::Page::ShownEvent
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
add_step! RubyApp::Elements::Mobile::Page::ShownEvent do |event|
|
72
|
-
event.tap_link('Back')
|
73
|
-
end
|
74
|
-
|
75
|
-
add_step! RubyApp::Elements::Mobile::Page::ShownEvent do |event|
|
76
|
-
event.refresh_browser
|
77
|
-
end
|
3
|
+
add_step! (RubyApp::Elements::Mobile::Page::ShownEvent) { |event| event.assert_exists_link('Dialogs') }
|
4
|
+
add_step! (RubyApp::Element::AssertedEvent) { |event| event.tap_link('Dialogs') }
|
5
|
+
|
6
|
+
add_step! (RubyApp::Elements::Mobile::Page::ShownEvent) { |event| event.assert_exists_link('Acknowledgement') }
|
7
|
+
add_step! (RubyApp::Element::AssertedEvent) { |event| event.tap_link('Acknowledgement') }
|
8
|
+
|
9
|
+
add_step! (RubyApp::Elements::Mobile::Page::ShownEvent) { |event| event.assert_exists_text('Acknowledge this.') }
|
10
|
+
add_step! (RubyApp::Element::AssertedEvent) { |event| event.assert_exists_link('OK') }
|
11
|
+
add_step! (RubyApp::Element::AssertedEvent) { |event| event.tap_link('OK') }
|
12
|
+
|
13
|
+
add_step! (RubyApp::Elements::Mobile::Page::ShownEvent) { |event| event.assert_exists_link('Acknowledgement') }
|
14
|
+
add_step! (RubyApp::Element::AssertedEvent) { |event| event.assert_exists_link('Confirmation') }
|
15
|
+
add_step! (RubyApp::Element::AssertedEvent) { |event| event.tap_link('Confirmation') }
|
16
|
+
|
17
|
+
add_step! (RubyApp::Elements::Mobile::Page::ShownEvent) { |event| event.assert_exists_text('Do you confirm this?') }
|
18
|
+
add_step! (RubyApp::Element::AssertedEvent) { |event| event.assert_exists_link('Yes') }
|
19
|
+
add_step! (RubyApp::Element::AssertedEvent) { |event| event.assert_exists_link('No') }
|
20
|
+
add_step! (RubyApp::Element::AssertedEvent) { |event| event.tap_link('Yes') }
|
21
|
+
|
22
|
+
add_step! (RubyApp::Elements::Mobile::Page::ShownEvent) { |event| event.assert_exists_text('You responded true.') }
|
23
|
+
add_step! (RubyApp::Element::AssertedEvent) { |event| event.assert_exists_link('OK') }
|
24
|
+
add_step! (RubyApp::Element::AssertedEvent) { |event| event.tap_link('OK') }
|
25
|
+
|
26
|
+
add_step! (RubyApp::Elements::Mobile::Page::ShownEvent) { |event| event.assert_exists_link('Confirmation') }
|
27
|
+
add_step! (RubyApp::Element::AssertedEvent) { |event| event.tap_link('Confirmation') }
|
28
|
+
|
29
|
+
add_step! (RubyApp::Elements::Mobile::Page::ShownEvent) { |event| event.assert_exists_text('Do you confirm this?') }
|
30
|
+
add_step! (RubyApp::Element::AssertedEvent) { |event| event.tap_link('No') }
|
31
|
+
|
32
|
+
add_step! (RubyApp::Elements::Mobile::Page::ShownEvent) { |event| event.assert_exists_text('You responded false.') }
|
33
|
+
add_step! (RubyApp::Element::AssertedEvent) { |event| event.assert_exists_link('OK') }
|
34
|
+
add_step! (RubyApp::Element::AssertedEvent) { |event| event.tap_link('OK') }
|
35
|
+
|
36
|
+
add_step! (RubyApp::Elements::Mobile::Page::ShownEvent) { |event| event.assert_exists_link('Confirmation') }
|
37
|
+
add_step! (RubyApp::Element::AssertedEvent) { |event| event.assert_exists_link('Exception') }
|
38
|
+
add_step! (RubyApp::Element::AssertedEvent) { |event| event.tap_link('Exception') }
|
39
|
+
|
40
|
+
add_step! (RubyApp::Elements::Mobile::Page::ShownEvent) { |event| event.assert_exists_text('This is an exception.') }
|
41
|
+
add_step! (RubyApp::Element::AssertedEvent) { |event| event.assert_exists_link('Close') }
|
42
|
+
add_step! (RubyApp::Element::AssertedEvent) { |event| event.tap_link('Close') }
|
43
|
+
|
44
|
+
add_step! (RubyApp::Elements::Mobile::Page::ShownEvent) { |event| event.assert_exists_link('Month') }
|
45
|
+
add_step! (RubyApp::Element::AssertedEvent) { |event| event.tap_link('Month') }
|
46
|
+
|
47
|
+
add_step! (RubyApp::Elements::Mobile::Page::ShownEvent) { |event| event.assert_exists_link(Date.today.day == 15 ? 14 : 15) }
|
48
|
+
add_step! (RubyApp::Element::AssertedEvent) { |event| event.tap_link(Date.today.day == 15 ? 14 : 15) }
|
49
|
+
|
50
|
+
add_step! (RubyApp::Elements::Mobile::Page::ShownEvent) { |event| event.assert_exists_text("You responded day #{Date.today.day == 15 ? 14 : 15}.") }
|
51
|
+
add_step! (RubyApp::Element::AssertedEvent) { |event| event.assert_exists_link('OK') }
|
52
|
+
add_step! (RubyApp::Element::AssertedEvent) { |event| event.tap_link('OK') }
|
53
|
+
|
54
|
+
add_step! (RubyApp::Elements::Mobile::Page::ShownEvent) { |event| event.assert_exists_link('Month') }
|
55
|
+
add_step! (RubyApp::Element::AssertedEvent) { |event| event.tap_link('Month') }
|
56
|
+
|
57
|
+
add_step! (RubyApp::Elements::Mobile::Page::ShownEvent) { |event| event.assert_exists_link('Today') }
|
58
|
+
add_step! (RubyApp::Element::AssertedEvent) { |event| event.tap_link('Today') }
|
59
|
+
|
60
|
+
add_step! (RubyApp::Elements::Mobile::Page::ShownEvent) { |event| event.assert_exists_text("You responded day #{Date.today.day}.") }
|
61
|
+
add_step! (RubyApp::Element::AssertedEvent) { |event| event.assert_exists_link('OK') }
|
62
|
+
add_step! (RubyApp::Element::AssertedEvent) { |event| event.tap_link('OK') }
|
63
|
+
|
64
|
+
add_step! (RubyApp::Elements::Mobile::Page::ShownEvent) { |event| event.assert_exists_link('Month') }
|
65
|
+
add_step! (RubyApp::Element::AssertedEvent) { |event| event.tap_link('Back') }
|
66
|
+
|
67
|
+
add_step! (RubyApp::Elements::Mobile::Page::ShownEvent) { |event| event.tap_link('Back') }
|
68
|
+
|
69
|
+
add_step! (RubyApp::Elements::Mobile::Page::ShownEvent) { |event| event.refresh_browser }
|
data/lib/ruby_app/version.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: RubyApp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 53
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 5
|
9
|
-
-
|
10
|
-
version: 0.5.
|
9
|
+
- 31
|
10
|
+
version: 0.5.31
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Frank G. Ficnar
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2012-04-
|
18
|
+
date: 2012-04-24 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
version_requirements: &id001 !ruby/object:Gem::Requirement
|
@@ -281,6 +281,10 @@ files:
|
|
281
281
|
- lib/ruby_app/element.rb
|
282
282
|
- lib/ruby_app/elements.rb
|
283
283
|
- lib/ruby_app/elements/mobile/button.rb
|
284
|
+
- lib/ruby_app/elements/mobile/calendars/month.css.haml
|
285
|
+
- lib/ruby_app/elements/mobile/calendars/month.html.haml
|
286
|
+
- lib/ruby_app/elements/mobile/calendars/month.js.haml
|
287
|
+
- lib/ruby_app/elements/mobile/calendars/month.rb
|
284
288
|
- lib/ruby_app/elements/mobile/click.js.haml
|
285
289
|
- lib/ruby_app/elements/mobile/click.rb
|
286
290
|
- lib/ruby_app/elements/mobile/default/default_document.css.haml
|
@@ -298,6 +302,14 @@ files:
|
|
298
302
|
- lib/ruby_app/elements/mobile/default/features/buttons_page.html.haml
|
299
303
|
- lib/ruby_app/elements/mobile/default/features/buttons_page.js.haml
|
300
304
|
- lib/ruby_app/elements/mobile/default/features/buttons_page.rb
|
305
|
+
- lib/ruby_app/elements/mobile/default/features/calendars/default_page.css.haml
|
306
|
+
- lib/ruby_app/elements/mobile/default/features/calendars/default_page.html.haml
|
307
|
+
- lib/ruby_app/elements/mobile/default/features/calendars/default_page.js.haml
|
308
|
+
- lib/ruby_app/elements/mobile/default/features/calendars/default_page.rb
|
309
|
+
- lib/ruby_app/elements/mobile/default/features/calendars/month_page.css.haml
|
310
|
+
- lib/ruby_app/elements/mobile/default/features/calendars/month_page.html.haml
|
311
|
+
- lib/ruby_app/elements/mobile/default/features/calendars/month_page.js.haml
|
312
|
+
- lib/ruby_app/elements/mobile/default/features/calendars/month_page.rb
|
301
313
|
- lib/ruby_app/elements/mobile/default/features/default_page.css.haml
|
302
314
|
- lib/ruby_app/elements/mobile/default/features/default_page.html.haml
|
303
315
|
- lib/ruby_app/elements/mobile/default/features/default_page.js.haml
|
@@ -330,11 +342,21 @@ files:
|
|
330
342
|
- lib/ruby_app/elements/mobile/dialog.html.haml
|
331
343
|
- lib/ruby_app/elements/mobile/dialog.js.haml
|
332
344
|
- lib/ruby_app/elements/mobile/dialog.rb
|
345
|
+
- lib/ruby_app/elements/mobile/dialogs/acknowledgement_dialog.css.haml
|
333
346
|
- lib/ruby_app/elements/mobile/dialogs/acknowledgement_dialog.html.haml
|
347
|
+
- lib/ruby_app/elements/mobile/dialogs/acknowledgement_dialog.js.haml
|
334
348
|
- lib/ruby_app/elements/mobile/dialogs/acknowledgement_dialog.rb
|
349
|
+
- lib/ruby_app/elements/mobile/dialogs/calendars/month_dialog.css.haml
|
350
|
+
- lib/ruby_app/elements/mobile/dialogs/calendars/month_dialog.html.haml
|
351
|
+
- lib/ruby_app/elements/mobile/dialogs/calendars/month_dialog.js.haml
|
352
|
+
- lib/ruby_app/elements/mobile/dialogs/calendars/month_dialog.rb
|
353
|
+
- lib/ruby_app/elements/mobile/dialogs/confirmation_dialog.css.haml
|
335
354
|
- lib/ruby_app/elements/mobile/dialogs/confirmation_dialog.html.haml
|
355
|
+
- lib/ruby_app/elements/mobile/dialogs/confirmation_dialog.js.haml
|
336
356
|
- lib/ruby_app/elements/mobile/dialogs/confirmation_dialog.rb
|
357
|
+
- lib/ruby_app/elements/mobile/dialogs/exception_dialog.css.haml
|
337
358
|
- lib/ruby_app/elements/mobile/dialogs/exception_dialog.html.haml
|
359
|
+
- lib/ruby_app/elements/mobile/dialogs/exception_dialog.js.haml
|
338
360
|
- lib/ruby_app/elements/mobile/dialogs/exception_dialog.rb
|
339
361
|
- lib/ruby_app/elements/mobile/dialogs/response_dialog.css.haml
|
340
362
|
- lib/ruby_app/elements/mobile/dialogs/response_dialog.rb
|
@@ -469,6 +491,7 @@ files:
|
|
469
491
|
- lib/ruby_app/scripts/common/reset.rb
|
470
492
|
- lib/ruby_app/scripts/default.rb
|
471
493
|
- lib/ruby_app/scripts/elements/buttons.rb
|
494
|
+
- lib/ruby_app/scripts/elements/calendars/month.rb
|
472
495
|
- lib/ruby_app/scripts/elements/dialogs.rb
|
473
496
|
- lib/ruby_app/scripts/elements/inputs.rb
|
474
497
|
- lib/ruby_app/scripts/elements/lists.rb
|