shoes 4.0.0.pre11 → 4.0.0.pre12

Sign up to get free protection for your applications and to get access to all the features.
Files changed (182) hide show
  1. checksums.yaml +4 -4
  2. data/bin/shoes-stub +8 -0
  3. data/lib/shoes/samples.rb +8 -0
  4. data/samples/README +122 -0
  5. data/samples/avatar.png +0 -0
  6. data/samples/blue-box.png +0 -0
  7. data/samples/class-book.yaml +387 -0
  8. data/samples/class_book.rb +46 -0
  9. data/samples/cy.png +0 -0
  10. data/samples/expert_definr.rb +24 -0
  11. data/samples/expert_funnies.rb +60 -0
  12. data/samples/expert_game_of_life.rb +224 -0
  13. data/samples/expert_irb.rb +109 -0
  14. data/samples/expert_minesweeper.rb +272 -0
  15. data/samples/expert_othello.rb +323 -0
  16. data/samples/expert_pong.rb +69 -0
  17. data/samples/expert_snake.rb +88 -0
  18. data/samples/expert_tankspank.rb +425 -0
  19. data/samples/expert_tetris.rb +322 -0
  20. data/samples/good_arc.rb +51 -0
  21. data/samples/good_bounce.rb +34 -0
  22. data/samples/good_clock.rb +55 -0
  23. data/samples/good_displace.rb +99 -0
  24. data/samples/good_follow.rb +27 -0
  25. data/samples/good_image_dl.rb +13 -0
  26. data/samples/good_potato_chopping.rb +23 -0
  27. data/samples/good_psychidelic_circles.rb +73 -0
  28. data/samples/good_reminder.rb +163 -0
  29. data/samples/good_vjot.rb +65 -0
  30. data/samples/lib/require_me.rb +6 -0
  31. data/samples/loogink.png +0 -0
  32. data/samples/menu-corner1.png +0 -0
  33. data/samples/menu-corner2.png +0 -0
  34. data/samples/menu-gray.png +0 -0
  35. data/samples/menu-left.png +0 -0
  36. data/samples/menu-right.png +0 -0
  37. data/samples/menu-top.png +0 -0
  38. data/samples/nks_booklist.rb +25 -0
  39. data/samples/nks_breadsticks.rb +8 -0
  40. data/samples/nks_dancing_circle.rb +14 -0
  41. data/samples/nks_dictionary.rb +24 -0
  42. data/samples/nks_edit_box.rb +5 -0
  43. data/samples/nks_edit_line.rb +7 -0
  44. data/samples/nks_notes.rb +16 -0
  45. data/samples/nks_poem.rb +23 -0
  46. data/samples/nks_self.rb +7 -0
  47. data/samples/nks_text_sizes.rb +11 -0
  48. data/samples/nks_trurl.rb +6 -0
  49. data/samples/potato_chopping/1258_s001.gif +0 -0
  50. data/samples/potato_chopping/1258_s002.gif +0 -0
  51. data/samples/potato_chopping/1258_s003.gif +0 -0
  52. data/samples/potato_chopping/1258_s004.gif +0 -0
  53. data/samples/potato_chopping/1258_s005.gif +0 -0
  54. data/samples/potato_chopping/1258_s006.gif +0 -0
  55. data/samples/potato_chopping/1258_s007.gif +0 -0
  56. data/samples/potato_chopping/1258_s008.gif +0 -0
  57. data/samples/potato_chopping/1258_s009.gif +0 -0
  58. data/samples/potato_chopping/1258_s010.gif +0 -0
  59. data/samples/potato_chopping/1258_s011.gif +0 -0
  60. data/samples/potato_chopping/1258_s012.gif +0 -0
  61. data/samples/potato_chopping/1258_s013.gif +0 -0
  62. data/samples/potato_chopping/1258_s014.gif +0 -0
  63. data/samples/potato_chopping/1258_s015.gif +0 -0
  64. data/samples/potato_chopping/1258_s016.gif +0 -0
  65. data/samples/potato_chopping/1258_s017.gif +0 -0
  66. data/samples/potato_chopping/1258_s018.gif +0 -0
  67. data/samples/potato_chopping/1258_s019.gif +0 -0
  68. data/samples/potato_chopping/1258_s020.gif +0 -0
  69. data/samples/potato_chopping/1258_s021.gif +0 -0
  70. data/samples/potato_chopping/1258_s022.gif +0 -0
  71. data/samples/potato_chopping/1258_s023.gif +0 -0
  72. data/samples/potato_chopping/1258_s024.gif +0 -0
  73. data/samples/potato_chopping/1258_s025.gif +0 -0
  74. data/samples/potato_chopping/1258_s026.gif +0 -0
  75. data/samples/potato_chopping/1258_s027.gif +0 -0
  76. data/samples/potato_chopping/1258_s028.gif +0 -0
  77. data/samples/potato_chopping/1258_s029.gif +0 -0
  78. data/samples/potato_chopping/1258_s030.gif +0 -0
  79. data/samples/potato_chopping/1258_s031.gif +0 -0
  80. data/samples/potato_chopping/1258_s032.gif +0 -0
  81. data/samples/potato_chopping/1258_s033.gif +0 -0
  82. data/samples/potato_chopping/1258_s034.gif +0 -0
  83. data/samples/potato_chopping/1258_s035.gif +0 -0
  84. data/samples/potato_chopping/1258_s036.gif +0 -0
  85. data/samples/potato_chopping/1258_s037.gif +0 -0
  86. data/samples/potato_chopping/1258_s038.gif +0 -0
  87. data/samples/potato_chopping/1258_s039.gif +0 -0
  88. data/samples/potato_chopping/1258_s040.gif +0 -0
  89. data/samples/potato_chopping/1258_s041.gif +0 -0
  90. data/samples/potato_chopping/1258_s042.gif +0 -0
  91. data/samples/potato_chopping/1258_s043.gif +0 -0
  92. data/samples/potato_chopping/1258_s044.gif +0 -0
  93. data/samples/potato_chopping/1258_s045.gif +0 -0
  94. data/samples/potato_chopping/1258_s046.gif +0 -0
  95. data/samples/potato_chopping/1258_s047.gif +0 -0
  96. data/samples/potato_chopping/1258_s048.gif +0 -0
  97. data/samples/potato_chopping/1258_s049.gif +0 -0
  98. data/samples/potato_chopping/1258_s050.gif +0 -0
  99. data/samples/potato_chopping/1258_s051.gif +0 -0
  100. data/samples/potato_chopping/1258_s052.gif +0 -0
  101. data/samples/potato_chopping/1258_s053.gif +0 -0
  102. data/samples/potato_chopping/1258_s054.gif +0 -0
  103. data/samples/potato_chopping/1258_s055.gif +0 -0
  104. data/samples/potato_chopping/1258_s056.gif +0 -0
  105. data/samples/potato_chopping/1258_s057.gif +0 -0
  106. data/samples/potato_chopping/1258_s058.gif +0 -0
  107. data/samples/potato_chopping/1258_s059.gif +0 -0
  108. data/samples/red-box.png +0 -0
  109. data/samples/shape_arc_to.rb +10 -0
  110. data/samples/simple-form.shy +0 -0
  111. data/samples/simple_accordion.rb +98 -0
  112. data/samples/simple_alert.rb +10 -0
  113. data/samples/simple_altered_para.rb +11 -0
  114. data/samples/simple_anim_shapes.rb +18 -0
  115. data/samples/simple_anim_text.rb +14 -0
  116. data/samples/simple_animate.rb +12 -0
  117. data/samples/simple_arc.rb +25 -0
  118. data/samples/simple_attach.rb +26 -0
  119. data/samples/simple_border_image.rb +9 -0
  120. data/samples/simple_borderless.rb +4 -0
  121. data/samples/simple_bounce.rb +27 -0
  122. data/samples/simple_breadsticks.rb +11 -0
  123. data/samples/simple_breadsticks2.rb +11 -0
  124. data/samples/simple_brightness_transitions.rb +16 -0
  125. data/samples/simple_button_animate.rb +17 -0
  126. data/samples/simple_buttons.rb +4 -0
  127. data/samples/simple_calc.rb +67 -0
  128. data/samples/simple_calc_2.rb +49 -0
  129. data/samples/simple_clipboard.rb +17 -0
  130. data/samples/simple_color_selector.rb +11 -0
  131. data/samples/simple_color_transitions.rb +12 -0
  132. data/samples/simple_concentric_circles.rb +9 -0
  133. data/samples/simple_console.rb +12 -0
  134. data/samples/simple_control_sizes.rb +25 -0
  135. data/samples/simple_count_and_draw.rb +19 -0
  136. data/samples/simple_curve.rb +34 -0
  137. data/samples/simple_dialogs.rb +33 -0
  138. data/samples/simple_dialogs_outside.rb +17 -0
  139. data/samples/simple_displace.rb +16 -0
  140. data/samples/simple_downloader.rb +29 -0
  141. data/samples/simple_draw.rb +16 -0
  142. data/samples/simple_editor.rb +30 -0
  143. data/samples/simple_face.rb +15 -0
  144. data/samples/simple_flashing.rb +22 -0
  145. data/samples/simple_flow_wrap.rb +12 -0
  146. data/samples/simple_font.rb +18 -0
  147. data/samples/simple_form.rb +30 -0
  148. data/samples/simple_fullscreen.rb +5 -0
  149. data/samples/simple_gradient_shapes.rb +23 -0
  150. data/samples/simple_guess_game.rb +30 -0
  151. data/samples/simple_image_as_stroke.rb +22 -0
  152. data/samples/simple_image_fill.rb +13 -0
  153. data/samples/simple_image_stroke.rb +13 -0
  154. data/samples/simple_info.rb +10 -0
  155. data/samples/simple_iterated_content.rb +8 -0
  156. data/samples/simple_keypress.rb +15 -0
  157. data/samples/simple_logo_display.rb +15 -0
  158. data/samples/simple_loogink_cy.rb +33 -0
  159. data/samples/simple_lorem_ipsum.rb +19 -0
  160. data/samples/simple_manual.rb +5 -0
  161. data/samples/simple_menu.rb +42 -0
  162. data/samples/simple_mouse_follow.rb +9 -0
  163. data/samples/simple_oval.rb +6 -0
  164. data/samples/simple_polygon_line.rb +19 -0
  165. data/samples/simple_position_as_we_go.rb +10 -0
  166. data/samples/simple_progress_bar.rb +15 -0
  167. data/samples/simple_random_bubbles.rb +15 -0
  168. data/samples/simple_require.rb +9 -0
  169. data/samples/simple_sample_executor.rb +7 -0
  170. data/samples/simple_sample_executor_all.rb +14 -0
  171. data/samples/simple_sesame_street_shoes.rb +6 -0
  172. data/samples/simple_shoes_intro.rb +22 -0
  173. data/samples/simple_slide.rb +57 -0
  174. data/samples/simple_stack_flow_buttons.rb +16 -0
  175. data/samples/simple_stripes.rb +9 -0
  176. data/samples/simple_system_background.rb +5 -0
  177. data/samples/simple_text_movement.rb +8 -0
  178. data/samples/simple_tictactoe.rb +224 -0
  179. data/samples/simple_timer.rb +16 -0
  180. data/samples/simple_translate.rb +10 -0
  181. data/samples/simple_visibility.rb +20 -0
  182. metadata +186 -7
@@ -0,0 +1,99 @@
1
+ # frozen_string_literal: true
2
+ class Layout
3
+ def initialize(app, art, elements)
4
+ @app = app
5
+ @art = art
6
+ @elements = elements
7
+ @position = {}
8
+ @width = 50
9
+ @margin = 10
10
+ @top = 4
11
+ end
12
+
13
+ attr_reader :art, :elements, :width, :margin, :top
14
+
15
+ def oval
16
+ @app.oval(*position(:oval), width)
17
+ end
18
+
19
+ def rect
20
+ @app.rect(*position(:rect), width)
21
+ end
22
+
23
+ def image
24
+ @app.image File.expand_path(File.join(__FILE__, "../avatar.png")), left: left(:image), top: top
25
+ end
26
+
27
+ def edit_box
28
+ @app.edit_box "Edit me", left: left(:edit_box), top: top, width: width
29
+ end
30
+
31
+ def offset(element)
32
+ art.index(element.to_sym) || elements.index(element.to_sym)
33
+ end
34
+
35
+ def left(element)
36
+ (width + margin) * offset(element)
37
+ end
38
+
39
+ def position(element)
40
+ [left(element), top]
41
+ end
42
+
43
+ def remember(name, element)
44
+ @app.info "Remembering #{name} at [#{element.left}, #{element.top}]"
45
+ @position[name] = [element.left, element.top]
46
+ end
47
+
48
+ def recall(name)
49
+ position = @position.fetch(name, "...oops, can't find it...[0, 0]")
50
+ @app.info "Recalling #{name} was at #{position}"
51
+ @position.fetch(name, [0, 0])
52
+ end
53
+ end
54
+
55
+ Shoes.app do
56
+ @art = [:oval, :rect]
57
+ @elements = [:image, :edit_box]
58
+ @objects = {}
59
+ @layout = Layout.new self, @art, @elements
60
+ @create_object = lambda do |name|
61
+ info "#{name} starts at #{@layout.position(name)}"
62
+ @objects[name] = @layout.send(name)
63
+ @layout.remember name, @objects[name]
64
+ end
65
+
66
+ stack do
67
+ title "Art"
68
+ flow height: 100 do
69
+ @art.each(&@create_object)
70
+ end
71
+
72
+ title "Elements"
73
+ flow height: 100 do
74
+ @elements.each(&@create_object)
75
+ end
76
+
77
+ flow do
78
+ x = 400
79
+ colors = [seagreen, salmon, papayawhip, goldenrod]
80
+ @art.concat(@elements).each_with_index do |name, i|
81
+ stack width: 100, margin: 4 do
82
+ background colors[i]
83
+ tagline name.to_s
84
+ button "displace" do
85
+ @layout.remember(name, @objects[name])
86
+ position = [x - @layout.left(name), @layout.top]
87
+ info "#{name} displaces to #{position}"
88
+ @objects[name].displace(*position)
89
+ end
90
+ button "replace" do
91
+ position = @layout.recall(name)
92
+ info "#{name} replaces to #{position}"
93
+ @objects[name].displace(*position)
94
+ end
95
+ end
96
+ end
97
+ end
98
+ end
99
+ end
@@ -0,0 +1,27 @@
1
+ # frozen_string_literal: true
2
+ trails = [[0, 0]] * 60
3
+ Shoes.app width: 200, height: 200, resizable: false do
4
+ nostroke
5
+ fill rgb(0x3, 0x1, 0x3, 0.6)
6
+
7
+ # animation at 100 frames per second
8
+ animate(60) do
9
+ trails.shift
10
+ trails << mouse[1, 2]
11
+
12
+ clear do
13
+ # change the background based on where the pointer is
14
+ background rgb(
15
+ 20 + (70 * (trails.last[0].to_f / width)).to_i,
16
+ 20 + (70 * (trails.last[1].to_f / height)).to_i,
17
+ 51
18
+ )
19
+
20
+ # draw circles progressively bigger
21
+ trails.each_with_index do |(x, y), i|
22
+ i += 1
23
+ oval left: x, top: y, radius: (i * 0.5), center: true
24
+ end
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+ Shoes.app width: 300, height: 200 do
3
+ background lime..blue
4
+
5
+ stack do
6
+ para "Welcome to the world of Shoes!"
7
+ button "Click me" do
8
+ alert "Nice click!"
9
+ end
10
+ image "http://shoesrb.com/img/shoes-icon.png",
11
+ margin_top: 20, margin_left: 10
12
+ end
13
+ end
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+ Shoes.app title: 'potacho', width: 175, height: 160 do
3
+ background tan
4
+
5
+ @imgs = []
6
+ 1.upto 59 do |i|
7
+ @imgs << image(File.expand_path(File.join(__FILE__, "../potato_chopping/1258_s#{format('%03d', i)}.gif"))).hide
8
+ @imgs.last.move(10, 10)
9
+ end
10
+
11
+ @imgs.first.show
12
+
13
+ def potacho
14
+ @imgs[58].hide
15
+ a = animate 12 do |i|
16
+ @imgs[i].show
17
+ @imgs[i - 1].hide if i.positive?
18
+ a.remove if i > 57
19
+ end
20
+ end
21
+
22
+ button(' start ') { potacho }.move 10, 130
23
+ end
@@ -0,0 +1,73 @@
1
+ # frozen_string_literal: true
2
+ degree = 0
3
+ color = 0
4
+ size = 0
5
+
6
+ Shoes.app width: 537, height: 500 do
7
+ background rgb(1.0, 0.5, 1.0, 1.0)
8
+ # Convert degrees to radians
9
+ def to_radians(deg)
10
+ deg * Math::PI / 180
11
+ end
12
+
13
+ red_circles = []
14
+ blue_circles = []
15
+
16
+ mx = (500 / 2).to_i
17
+ my = (537 / 2).to_i
18
+ animate(36) do
19
+ # clear do
20
+ # Manage color
21
+ nostroke
22
+ # Update some variables
23
+ degree += 1
24
+ size += 1
25
+ degree = 0 if degree >= 360
26
+ size = 0 if size >= 100
27
+ color = 0.0 if color >= 1.0
28
+ color += 0.05 if (degree % 10).zero?
29
+
30
+ # Draw inner circle
31
+ fill red(color)
32
+ 10.times do |i|
33
+ current_size = 100 + size
34
+ d = to_radians(i * 60 + degree)
35
+ rx = Math.cos(d) * 100
36
+ ry = Math.sin(d) * 100
37
+ center_x = -current_size / 2 + rx + mx
38
+ center_y = -current_size / 2 + ry + my
39
+ if red_circles.size == 10
40
+ r = red_circles[i]
41
+ r.style fill: red(color)
42
+ r.left = center_x
43
+ r.top = center_y
44
+ r.width = current_size
45
+ r.height = current_size
46
+ else
47
+ red_circles << oval(center_x, center_y, current_size, current_size)
48
+ end
49
+ end
50
+
51
+ # Draw outer circle
52
+ fill blue(color)
53
+ 20.times do |i|
54
+ current_size = 50 + size
55
+ d = to_radians(i * 30 - degree)
56
+ rx = Math.cos(d) * 150
57
+ ry = Math.sin(d) * 150
58
+ center_x = -current_size / 2 + rx + mx
59
+ center_y = -current_size / 2 + ry + my
60
+ if blue_circles.size == 20
61
+ b = blue_circles[i]
62
+ b.style fill: blue(color)
63
+ b.left = center_x
64
+ b.top = center_y
65
+ b.width = current_size
66
+ b.height = current_size
67
+ else
68
+ blue_circles << oval(center_x, center_y, current_size, current_size)
69
+ end
70
+ end
71
+ # end
72
+ end
73
+ end
@@ -0,0 +1,163 @@
1
+ # frozen_string_literal: true
2
+ require 'yaml'
3
+
4
+ Shoes.app title: "A Gentle Reminder",
5
+ width: 370, height: 560, resizable: false do
6
+ background white
7
+ background tan, height: 40
8
+
9
+ caption "A Gentle Reminder", margin: 8, stroke: white
10
+
11
+ stack margin: 10, margin_top: 50 do
12
+ para "You need to", stroke: red, fill: yellow
13
+
14
+ stack margin_left: 5, margin_right: 10, width: 1.0, height: 200, scroll: true do
15
+ background white
16
+ border white, strokewidth: 3
17
+ @gui_todo = para
18
+ end
19
+
20
+ flow margin_top: 10 do
21
+ para "Remember to"
22
+ @add = edit_line(margin_left: 10, width: 180)
23
+ button("Add", margin_left: 5) do
24
+ add_todo(@add.text)
25
+ @add.text = ''
26
+ end
27
+ end
28
+ end
29
+
30
+ stack margin_top: 10 do
31
+ background darkgray
32
+ para strong('Completed'), stroke: white
33
+ end
34
+
35
+ @gui_completed = stack width: 1.0, height: 207, margin_right: 20
36
+
37
+ def data_path
38
+ user_data_directory = if RUBY_PLATFORM =~ /win32/
39
+ if ENV['USERPROFILE']
40
+ if File.join(File.expand_path(ENV['USERPROFILE']), "Application Data")
41
+ File.join File.expand_path(ENV['USERPROFILE']), "Application Data", "GentleReminder"
42
+ else
43
+ File.join File.expand_path(ENV['USERPROFILE']), "GentleReminder"
44
+ end
45
+ else
46
+ File.join File.expand_path(Dir.getwd), "data"
47
+ end
48
+ else
49
+ File.expand_path(File.join("~", ".gentlereminder"))
50
+ end
51
+
52
+ Dir.mkdir(user_data_directory) unless File.exist?(user_data_directory)
53
+
54
+ File.join(user_data_directory, "data.yaml")
55
+ end
56
+
57
+ def refresh_todo
58
+ @gui_todo.replace(
59
+ *@todo.map do |item|
60
+ [item, ' '] + [link('Done') { complete_todo item }] + [' '] +
61
+ [link('Forget it') { forget_todo item }] + ["\n"]
62
+ end.flatten
63
+ )
64
+ end
65
+
66
+ def refresh
67
+ refresh_todo
68
+
69
+ @gui_completed.clear
70
+
71
+ @gui_completed.append do
72
+ background white
73
+
74
+ @completed.keys.sort.reverse_each do |day|
75
+ stack do
76
+ background lightgray
77
+ para strong(day.strftime('%B %d, %Y')), stroke: white
78
+ end
79
+
80
+ stack do
81
+ inscription(
82
+ * @completed[day].map do |item|
83
+ [item] + [' '] + [link('Not Done') { undo_todo day, item }] +
84
+ (@completed[day].index(item) == @completed[day].length - 1 ? [''] : ["\n"])
85
+ end.flatten
86
+ )
87
+ end
88
+ end
89
+ end
90
+ end
91
+
92
+ def complete_todo(item)
93
+ day = Date.today
94
+
95
+ if @completed.keys.include? day
96
+ @completed[day] << item
97
+ else
98
+ @completed[day] = [item]
99
+ end
100
+
101
+ @todo.delete(item)
102
+
103
+ save
104
+
105
+ refresh
106
+ end
107
+
108
+ def undo_todo(day, item)
109
+ @completed[day].delete item
110
+
111
+ @completed.delete(day) if @completed[day].empty?
112
+
113
+ @todo << item unless @todo.include? item
114
+
115
+ save
116
+
117
+ refresh
118
+ end
119
+
120
+ def add_todo(item)
121
+ item = item.strip
122
+
123
+ return if item == ''
124
+
125
+ if @todo.include? item
126
+ alert('You have already added that to the list!')
127
+ return
128
+ end
129
+
130
+ @todo << item
131
+
132
+ save
133
+
134
+ refresh_todo
135
+ end
136
+
137
+ def forget_todo(item)
138
+ @todo.delete item
139
+
140
+ save
141
+
142
+ refresh_todo
143
+ end
144
+
145
+ def load
146
+ if File.exist?(data_path)
147
+ @todo, @completed = YAML.safe_load(File.open(data_path, 'r'), [Date])
148
+ else
149
+ @todo = []
150
+ @completed = {}
151
+ end
152
+
153
+ refresh
154
+ end
155
+
156
+ def save
157
+ File.open(data_path, 'w') do |f|
158
+ f.write [@todo, @completed].to_yaml
159
+ end
160
+ end
161
+
162
+ load
163
+ end
@@ -0,0 +1,65 @@
1
+ # frozen_string_literal: true
2
+ NOTES = [['Welcome to the vJot Clone', <<-'END']].freeze
3
+ This sample app is a notetaker, a clone of PJ Hyett's vjot.com.
4
+
5
+ Creating
6
+ ----------
7
+ Click "Add a New Note" and the jot will be loaded into the editor for reading or editing.
8
+
9
+ Editing
10
+ ---------
11
+ Click a jot's title to load it.
12
+
13
+ Saving
14
+ --------
15
+ There is no save button, the jot is saved as you edit.
16
+
17
+ END
18
+
19
+ Shoes.app title: "vJot", width: 420, height: 560, resizable: false do
20
+ @notes = NOTES.dup
21
+ @note = @notes.first
22
+ background "#C7EAFB"
23
+ stack width: 400, margin: 20 do
24
+ background "#eee", curve: 12
25
+ border "#00D0FF", strokewidth: 3, curve: 12
26
+ stack margin: 20 do
27
+ caption "vJot"
28
+ @title = edit_line @note[0], width: 1.0 do
29
+ @note[0] = @title.text
30
+ load_list
31
+ end
32
+ stack width: 1.0, height: 200, scroll: true do
33
+ @list = para
34
+ end
35
+ @jot = edit_box @note[1], width: 1.0, height: 200, margin_bottom: 20 do
36
+ @note[1] = @jot.text
37
+ end
38
+ end
39
+ end
40
+
41
+ def load_list
42
+ note_list = @notes.map do |note|
43
+ [
44
+ link(note.first) do
45
+ @note = load_note(note)
46
+ load_list
47
+ end,
48
+ "\n"
49
+ ]
50
+ end.flatten + [link("+ Add a new Note") do
51
+ @notes << (@note = load_note)
52
+ load_list
53
+ end]
54
+ @list.replace(*note_list)
55
+ end
56
+
57
+ def load_note(note = ['New Note', ''])
58
+ @note = note
59
+ @title.text = note[0]
60
+ @jot.text = note[1]
61
+ note
62
+ end
63
+
64
+ load_list
65
+ end