smalruby-editor 0.2.1 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of smalruby-editor might be problematic. Click here for more details.

Files changed (75) hide show
  1. checksums.yaml +4 -4
  2. data/LEGAL +4 -3
  3. data/app/assets/javascripts/blocks/character.js.coffee.erb +7 -3
  4. data/app/assets/javascripts/blocks/events.js.coffee.erb +7 -10
  5. data/app/assets/javascripts/blocks/hardware.js.coffee.erb +119 -31
  6. data/app/assets/javascripts/blocks/motion.js.coffee.erb +16 -20
  7. data/app/assets/javascripts/blocks/operators.js.coffee.erb +1 -1
  8. data/app/assets/javascripts/blocks/pen.js.coffee.erb +2 -1
  9. data/app/assets/javascripts/blocks/ruby.js.coffee.erb +3 -3
  10. data/app/assets/javascripts/blocks/sensing.js.coffee.erb +8 -8
  11. data/app/assets/javascripts/blocks/sound.js.coffee.erb +3 -1
  12. data/app/assets/javascripts/fix_blockly.js.erb +105 -0
  13. data/app/assets/javascripts/generators/ruby.js.coffee.erb +3 -0
  14. data/app/assets/javascripts/msg/en_us.js +67 -17
  15. data/app/assets/javascripts/msg/ja.js +151 -95
  16. data/app/assets/javascripts/{smalruby.js.coffee → smalruby.js.coffee.erb} +35 -16
  17. data/app/assets/javascripts/views/character_selector_view.js.coffee +2 -2
  18. data/app/assets/javascripts/views/{load_modal_view.js.coffee → load_modal_view.js.coffee.erb} +8 -2
  19. data/app/assets/javascripts/views/main_menu_view.js.coffee.erb +33 -48
  20. data/app/assets/javascripts/views/signin_modal_view.js.coffee.erb +43 -0
  21. data/app/assets/stylesheets/application.css +3 -1
  22. data/app/assets/stylesheets/toolbox.css.scss.erb +2 -56
  23. data/app/assets/stylesheets/toolbox_default.css.scss.erb +34 -0
  24. data/app/assets/stylesheets/toolbox_smalrubot_s1.css.scss.erb +31 -0
  25. data/app/assets/stylesheets/toolbox_smalrubot_v3.css.scss.erb +32 -0
  26. data/app/controllers/application_controller.rb +5 -0
  27. data/app/controllers/source_codes_controller.rb +6 -3
  28. data/app/helpers/application_helper.rb +12 -0
  29. data/app/helpers/editor_helper.rb +25 -0
  30. data/app/models/concerns/ruby_to_block/block/hardware_smalrubot_s1_action.rb +13 -0
  31. data/app/models/concerns/ruby_to_block/block/hardware_smalrubot_s1_action_with_sec.rb +14 -0
  32. data/app/models/concerns/ruby_to_block/block/hardware_smalrubot_s1_ir_photoreflector_value.rb +29 -0
  33. data/app/models/concerns/ruby_to_block/block/hardware_smalrubot_s1_led_turn_on_or_off.rb +22 -0
  34. data/app/views/editor/_block_tab.html.haml +7 -6
  35. data/app/views/editor/_reset_modal.html.haml +4 -4
  36. data/app/views/editor/_signin_modal.html.haml +8 -9
  37. data/app/views/editor/_toolbox_default.html.haml +504 -0
  38. data/app/views/editor/_toolbox_smalrubot_s1.html.haml +171 -0
  39. data/app/views/editor/_toolbox_smalrubot_v3.html.haml +177 -0
  40. data/app/views/editor/index.html.haml +12 -2
  41. data/app/views/layouts/application.html.erb +1 -0
  42. data/config/environments/production.rb +1 -0
  43. data/config/locales/en.yml +19 -16
  44. data/config/locales/ja.yml +28 -25
  45. data/demos/hardware_led.rb.xml +79 -79
  46. data/lib/smalruby_editor.rb +58 -0
  47. data/lib/smalruby_editor/config.rb +22 -0
  48. data/lib/smalruby_editor/version.rb +1 -1
  49. data/public/blockly/media/anon.jpeg +0 -0
  50. data/public/blockly/media/handclosed.cur +0 -0
  51. data/public/blockly/media/handdelete.cur +0 -0
  52. data/public/blockly/media/progress.gif +0 -0
  53. data/public/blockly/media/sprites.png +0 -0
  54. data/smalruby-editor.gemspec +2 -1
  55. data/spec/acceptance/base.feature +3 -3
  56. data/spec/acceptance/block_mode/blocks/hardware/smalrubot_s1_action.feature +107 -0
  57. data/spec/acceptance/block_mode/blocks/hardware/smalrubot_s1_action_with_sec.feature +151 -0
  58. data/spec/acceptance/block_mode/blocks/hardware/smalrubot_s1_ir_photoreflector_value.feature +100 -0
  59. data/spec/acceptance/block_mode/blocks/hardware/smalrubot_s1_led_turn_on_or_off.feature +73 -0
  60. data/spec/acceptance/ruby_mode/translate.feature +6 -6
  61. data/spec/acceptance/standalone/save.feature +3 -3
  62. data/spec/acceptance/standalone/signin.feature +1 -2
  63. data/spec/lib/smalruby_editor_spec.rb +21 -11
  64. data/spec/models/concerns/ruby_to_block/block/hardware__smalrubot_s1_spec.rb +279 -0
  65. data/vendor/assets/javascripts/blockly/blockly_compressed.js +995 -668
  66. data/vendor/assets/javascripts/blockly/blocks_compressed.js +138 -114
  67. data/vendor/assets/javascripts/blockly/msg/js/en_us.js +6 -6
  68. data/vendor/assets/javascripts/blockly/msg/js/ja.js +42 -28
  69. metadata +66 -25
  70. data/app/assets/javascripts/fix_blockly.js +0 -128
  71. data/app/assets/javascripts/views/signin_modal_view.js.coffee +0 -33
  72. data/app/views/editor/_toolbox.html.haml +0 -496
  73. data/public/blockly/media/trashbody.png +0 -0
  74. data/public/blockly/media/trashlid.png +0 -0
  75. data/public/blockly/media/tree.png +0 -0
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: smalruby-editor
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kouji Takao
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-01-27 00:00:00.000000000 Z
11
+ date: 2015-02-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -178,20 +178,34 @@ dependencies:
178
178
  - - ">="
179
179
  - !ruby/object:Gem::Version
180
180
  version: '0'
181
+ - !ruby/object:Gem::Dependency
182
+ name: settingslogic
183
+ requirement: !ruby/object:Gem::Requirement
184
+ requirements:
185
+ - - ">="
186
+ - !ruby/object:Gem::Version
187
+ version: '0'
188
+ type: :runtime
189
+ prerelease: false
190
+ version_requirements: !ruby/object:Gem::Requirement
191
+ requirements:
192
+ - - ">="
193
+ - !ruby/object:Gem::Version
194
+ version: '0'
181
195
  - !ruby/object:Gem::Dependency
182
196
  name: smalruby
183
197
  requirement: !ruby/object:Gem::Requirement
184
198
  requirements:
185
199
  - - "~>"
186
200
  - !ruby/object:Gem::Version
187
- version: 0.1.2
201
+ version: 0.1.3
188
202
  type: :runtime
189
203
  prerelease: false
190
204
  version_requirements: !ruby/object:Gem::Requirement
191
205
  requirements:
192
206
  - - "~>"
193
207
  - !ruby/object:Gem::Version
194
- version: 0.1.2
208
+ version: 0.1.3
195
209
  - !ruby/object:Gem::Dependency
196
210
  name: therubyracer
197
211
  requirement: !ruby/object:Gem::Requirement
@@ -278,7 +292,7 @@ files:
278
292
  - app/assets/javascripts/blocks/sound.js.coffee.erb
279
293
  - app/assets/javascripts/collections/.keep
280
294
  - app/assets/javascripts/collections/character_set.js.coffee
281
- - app/assets/javascripts/fix_blockly.js
295
+ - app/assets/javascripts/fix_blockly.js.erb
282
296
  - app/assets/javascripts/generators/ruby.js.coffee.erb
283
297
  - app/assets/javascripts/models/.keep
284
298
  - app/assets/javascripts/models/character.js.coffee
@@ -287,19 +301,22 @@ files:
287
301
  - app/assets/javascripts/msg/en_us.js
288
302
  - app/assets/javascripts/msg/ja.js
289
303
  - app/assets/javascripts/routers/.keep
290
- - app/assets/javascripts/smalruby.js.coffee
304
+ - app/assets/javascripts/smalruby.js.coffee.erb
291
305
  - app/assets/javascripts/views/.keep
292
306
  - app/assets/javascripts/views/character_modal_view.js.coffee
293
307
  - app/assets/javascripts/views/character_selector_view.js.coffee
294
- - app/assets/javascripts/views/load_modal_view.js.coffee
308
+ - app/assets/javascripts/views/load_modal_view.js.coffee.erb
295
309
  - app/assets/javascripts/views/main_menu_view.js.coffee.erb
296
310
  - app/assets/javascripts/views/reset_modal_view.js.coffee
297
- - app/assets/javascripts/views/signin_modal_view.js.coffee
311
+ - app/assets/javascripts/views/signin_modal_view.js.coffee.erb
298
312
  - app/assets/stylesheets/application.css
299
313
  - app/assets/stylesheets/editor.css.scss
300
314
  - app/assets/stylesheets/flatstrap-custom.css.scss
301
315
  - app/assets/stylesheets/load-modal.css.scss
302
316
  - app/assets/stylesheets/toolbox.css.scss.erb
317
+ - app/assets/stylesheets/toolbox_default.css.scss.erb
318
+ - app/assets/stylesheets/toolbox_smalrubot_s1.css.scss.erb
319
+ - app/assets/stylesheets/toolbox_smalrubot_v3.css.scss.erb
303
320
  - app/assets/templates/.keep
304
321
  - app/controllers/application_controller.rb
305
322
  - app/controllers/concerns/.keep
@@ -341,6 +358,10 @@ files:
341
358
  - app/models/concerns/ruby_to_block/block/hardware_rgb_led_set_color.rb
342
359
  - app/models/concerns/ruby_to_block/block/hardware_rgb_led_turn_off.rb
343
360
  - app/models/concerns/ruby_to_block/block/hardware_sensor_value.rb
361
+ - app/models/concerns/ruby_to_block/block/hardware_smalrubot_s1_action.rb
362
+ - app/models/concerns/ruby_to_block/block/hardware_smalrubot_s1_action_with_sec.rb
363
+ - app/models/concerns/ruby_to_block/block/hardware_smalrubot_s1_ir_photoreflector_value.rb
364
+ - app/models/concerns/ruby_to_block/block/hardware_smalrubot_s1_led_turn_on_or_off.rb
344
365
  - app/models/concerns/ruby_to_block/block/hardware_smalrubot_v3_action.rb
345
366
  - app/models/concerns/ruby_to_block/block/hardware_smalrubot_v3_action_with_sec.rb
346
367
  - app/models/concerns/ruby_to_block/block/hardware_smalrubot_v3_led_turn_on_or_off.rb
@@ -399,7 +420,9 @@ files:
399
420
  - app/views/editor/_load_modal.html.haml
400
421
  - app/views/editor/_reset_modal.html.haml
401
422
  - app/views/editor/_signin_modal.html.haml
402
- - app/views/editor/_toolbox.html.haml
423
+ - app/views/editor/_toolbox_default.html.haml
424
+ - app/views/editor/_toolbox_smalrubot_s1.html.haml
425
+ - app/views/editor/_toolbox_smalrubot_v3.html.haml
403
426
  - app/views/editor/demo.html.erb
404
427
  - app/views/editor/index.html.haml
405
428
  - app/views/layouts/application.html.erb
@@ -445,6 +468,7 @@ files:
445
468
  - lib/assets/.keep
446
469
  - lib/smalruby_editor.rb
447
470
  - lib/smalruby_editor/blockly_message_helper.rb
471
+ - lib/smalruby_editor/config.rb
448
472
  - lib/smalruby_editor/version.rb
449
473
  - lib/tasks/.keep
450
474
  - lib/tasks/gem.rake
@@ -456,14 +480,14 @@ files:
456
480
  - public/422.html
457
481
  - public/500.html
458
482
  - public/apple-touch-icon.png
459
- - public/assets/application-b305a6ea9e7c045a8e170bbf6fb09dd1.js
460
- - public/assets/application-b305a6ea9e7c045a8e170bbf6fb09dd1.js.gz
461
- - public/assets/application-d5358d75a2c4e570c749b333c59b55ab.css
462
- - public/assets/application-d5358d75a2c4e570c749b333c59b55ab.css.gz
463
- - public/assets/blockly/msg/js/en_us-6f7333af29688596ef863fa36a22cb41.js
464
- - public/assets/blockly/msg/js/en_us-6f7333af29688596ef863fa36a22cb41.js.gz
465
- - public/assets/blockly/msg/js/ja-d2cbf808bda8180571bc5f39141a98fe.js
466
- - public/assets/blockly/msg/js/ja-d2cbf808bda8180571bc5f39141a98fe.js.gz
483
+ - public/assets/application-71c4890fe0ea2e896fc0acff41cdb0ad.js
484
+ - public/assets/application-71c4890fe0ea2e896fc0acff41cdb0ad.js.gz
485
+ - public/assets/application-c196e243630d74071981a16041bf391d.css
486
+ - public/assets/application-c196e243630d74071981a16041bf391d.css.gz
487
+ - public/assets/blockly/msg/js/en_us-d5e1938b2d57c1df954f4411b9165d10.js
488
+ - public/assets/blockly/msg/js/en_us-d5e1938b2d57c1df954f4411b9165d10.js.gz
489
+ - public/assets/blockly/msg/js/ja-9f676d46458a2802b8f5a797c90ae8a4.js
490
+ - public/assets/blockly/msg/js/ja-9f676d46458a2802b8f5a797c90ae8a4.js.gz
467
491
  - public/assets/favicon-d958ba1d3efbea2e9a10fda1b5970b6c.ico
468
492
  - public/assets/jquery-ui/animated-overlay-9b629ab5247187e831ea51106acdf03a.gif
469
493
  - public/assets/jquery-ui/ui-bg_flat_0_aaaaaa_40x100-e055bc219bd3aed111713c2ef884d6f4.png
@@ -480,13 +504,20 @@ files:
480
504
  - public/assets/jquery-ui/ui-icons_888888_256x240-ce584ffa171c3ea9a018cf0d7bec65c8.png
481
505
  - public/assets/jquery-ui/ui-icons_cd0a0a_256x240-747e96029e8dedcabc224e5f7d1f2ede.png
482
506
  - public/assets/loading-e77296be32d066d3e29d3bf9803fa417.gif
483
- - public/assets/manifest-b1b843b1334b3b973824ab66b1f7a077.json
484
- - public/assets/msg/en_us-c6f8f0084f38560bf933b742ede64a52.js
485
- - public/assets/msg/en_us-c6f8f0084f38560bf933b742ede64a52.js.gz
486
- - public/assets/msg/ja-3703e6ceebd04ae1f08b0e871800539d.js
487
- - public/assets/msg/ja-3703e6ceebd04ae1f08b0e871800539d.js.gz
507
+ - public/assets/manifest-f3d29c6d66b959abe4294a899733e4f0.json
508
+ - public/assets/msg/en_us-213fb4a57884078038725a2991776f47.js
509
+ - public/assets/msg/en_us-213fb4a57884078038725a2991776f47.js.gz
510
+ - public/assets/msg/ja-aeface7456b479021e977a0387204036.js
511
+ - public/assets/msg/ja-aeface7456b479021e977a0387204036.js.gz
488
512
  - public/assets/progressbar-ee8fb1222f286f625bbf7332844a6a0c.gif
513
+ - public/assets/toolbox_default-e023d3f7a2cc7cc1f54a1224577b3c26.css
514
+ - public/assets/toolbox_default-e023d3f7a2cc7cc1f54a1224577b3c26.css.gz
515
+ - public/assets/toolbox_smalrubot_s1-18d28dc4b99723b60a3f538b742027df.css
516
+ - public/assets/toolbox_smalrubot_s1-18d28dc4b99723b60a3f538b742027df.css.gz
517
+ - public/assets/toolbox_smalrubot_v3-9af26ff13d4496890c4a391f65f95bcd.css
518
+ - public/assets/toolbox_smalrubot_v3-9af26ff13d4496890c4a391f65f95bcd.css.gz
489
519
  - public/blockly/media/1x1.gif
520
+ - public/blockly/media/anon.jpeg
490
521
  - public/blockly/media/click.mp3
491
522
  - public/blockly/media/click.ogg
492
523
  - public/blockly/media/click.wav
@@ -494,12 +525,12 @@ files:
494
525
  - public/blockly/media/delete.ogg
495
526
  - public/blockly/media/delete.wav
496
527
  - public/blockly/media/handclosed.cur
528
+ - public/blockly/media/handdelete.cur
497
529
  - public/blockly/media/handopen.cur
530
+ - public/blockly/media/progress.gif
498
531
  - public/blockly/media/quote0.png
499
532
  - public/blockly/media/quote1.png
500
- - public/blockly/media/trashbody.png
501
- - public/blockly/media/trashlid.png
502
- - public/blockly/media/tree.png
533
+ - public/blockly/media/sprites.png
503
534
  - public/browserconfig.xml
504
535
  - public/fonts/FontAwesome.otf
505
536
  - public/fonts/fontawesome-webfont.eot
@@ -564,6 +595,10 @@ files:
564
595
  - spec/acceptance/block_mode/blocks/hardware/rgb_led_turn_off.feature
565
596
  - spec/acceptance/block_mode/blocks/hardware/sensor_value.feature
566
597
  - spec/acceptance/block_mode/blocks/hardware/servo_set_position.feature
598
+ - spec/acceptance/block_mode/blocks/hardware/smalrubot_s1_action.feature
599
+ - spec/acceptance/block_mode/blocks/hardware/smalrubot_s1_action_with_sec.feature
600
+ - spec/acceptance/block_mode/blocks/hardware/smalrubot_s1_ir_photoreflector_value.feature
601
+ - spec/acceptance/block_mode/blocks/hardware/smalrubot_s1_led_turn_on_or_off.feature
567
602
  - spec/acceptance/block_mode/blocks/hardware/smalrubot_v3_action.feature
568
603
  - spec/acceptance/block_mode/blocks/hardware/smalrubot_v3_action_with_sec.feature
569
604
  - spec/acceptance/block_mode/blocks/hardware/smalrubot_v3_led_turn_on_or_off.feature
@@ -644,6 +679,7 @@ files:
644
679
  - spec/models/concerns/ruby_to_block/block/control_if_spec.rb
645
680
  - spec/models/concerns/ruby_to_block/block/control_loop_spec.rb
646
681
  - spec/models/concerns/ruby_to_block/block/events_on_start_spec.rb
682
+ - spec/models/concerns/ruby_to_block/block/hardware__smalrubot_s1_spec.rb
647
683
  - spec/models/concerns/ruby_to_block/block/hardware_spec.rb
648
684
  - spec/models/concerns/ruby_to_block/block/looks_say_spec.rb
649
685
  - spec/models/concerns/ruby_to_block/block/looks_spec.rb
@@ -736,6 +772,10 @@ test_files:
736
772
  - spec/acceptance/block_mode/blocks/hardware/rgb_led_turn_off.feature
737
773
  - spec/acceptance/block_mode/blocks/hardware/sensor_value.feature
738
774
  - spec/acceptance/block_mode/blocks/hardware/servo_set_position.feature
775
+ - spec/acceptance/block_mode/blocks/hardware/smalrubot_s1_action.feature
776
+ - spec/acceptance/block_mode/blocks/hardware/smalrubot_s1_action_with_sec.feature
777
+ - spec/acceptance/block_mode/blocks/hardware/smalrubot_s1_ir_photoreflector_value.feature
778
+ - spec/acceptance/block_mode/blocks/hardware/smalrubot_s1_led_turn_on_or_off.feature
739
779
  - spec/acceptance/block_mode/blocks/hardware/smalrubot_v3_action.feature
740
780
  - spec/acceptance/block_mode/blocks/hardware/smalrubot_v3_action_with_sec.feature
741
781
  - spec/acceptance/block_mode/blocks/hardware/smalrubot_v3_led_turn_on_or_off.feature
@@ -816,6 +856,7 @@ test_files:
816
856
  - spec/models/concerns/ruby_to_block/block/control_if_spec.rb
817
857
  - spec/models/concerns/ruby_to_block/block/control_loop_spec.rb
818
858
  - spec/models/concerns/ruby_to_block/block/events_on_start_spec.rb
859
+ - spec/models/concerns/ruby_to_block/block/hardware__smalrubot_s1_spec.rb
819
860
  - spec/models/concerns/ruby_to_block/block/hardware_spec.rb
820
861
  - spec/models/concerns/ruby_to_block/block/looks_say_spec.rb
821
862
  - spec/models/concerns/ruby_to_block/block/looks_spec.rb
@@ -1,128 +0,0 @@
1
- /**
2
- * this program copied from Blockly and modified
3
- *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
15
- */
16
-
17
- Blockly.Names.prototype.safeName_ = function(name) {
18
- if (!name) {
19
- name = 'unnamed';
20
- } else {
21
- // Unfortunately names in non-latin characters will look like
22
- // _E9_9F_B3_E4_B9_90 which is pretty meaningless.
23
- // HACK: Rubyでは日本語の変数名を許可しているためencodeURIを行わない。
24
- // また、使えない記号を置換する。
25
- name = name.replace(/[ !"#$%&'()=\-~^\\|`@{\[+;*:}\]<>,.?\/]/g, '_')
26
- // Most languages don't allow names with leading numbers.
27
- if ('0123456789'.indexOf(name[0]) != -1) {
28
- name = '_' + name;
29
- }
30
- }
31
- return name;
32
- };
33
-
34
- var originalBlocksMathNumberInit = Blockly.Blocks['math_number'].init;
35
- Blockly.Blocks['math_number'].init = function() {
36
- originalBlocksMathNumberInit.call(this);
37
- this.setColour(100);
38
- };
39
-
40
- var originalBlocksTextInit = Blockly.Blocks['text'].init;
41
- Blockly.Blocks['text'].init = function() {
42
- originalBlocksTextInit.call(this);
43
- this.setColour(100);
44
- };
45
-
46
- // HACK: fix could not play sound on IE11
47
- Blockly.loadAudio_ = function(filenames, name) {
48
- if (!window['Audio'] || !filenames.length) {
49
- // No browser support for Audio.
50
- return;
51
- }
52
- var sound;
53
- var audioTest = new window['Audio']();
54
- for (var i = 0; i < filenames.length; i++) {
55
- var filename = filenames[i];
56
- var ext = filename.match(/\.(\w+)$/);
57
- if (ext && audioTest.canPlayType('audio/' + ext[1])) {
58
- // Found an audio format we can play.
59
- sound = new window['Audio'](Blockly.pathToBlockly + filename);
60
- break;
61
- }
62
- }
63
- // To force the browser to load the sound, play it, but at nearly zero volume.
64
- if (sound && sound.play) {
65
- sound.volume = 0.01;
66
- sound.play();
67
- sound.pause(); // added
68
- Blockly.SOUNDS_[name] = sound;
69
- }
70
- };
71
-
72
- // blockly/core/block.js
73
- Blockly.Block.prototype.interpolateMsg = function(msg, var_args) {
74
- // Validate the msg at the start and the dummy alignment at the end,
75
- // and remove the latter.
76
- goog.asserts.assertString(msg);
77
- var dummyAlign = arguments[arguments.length - 1];
78
- goog.asserts.assert(
79
- dummyAlign === Blockly.ALIGN_LEFT ||
80
- dummyAlign === Blockly.ALIGN_CENTRE ||
81
- dummyAlign === Blockly.ALIGN_RIGHT,
82
- 'Illegal final argument "%d" is not an alignment.', dummyAlign);
83
- arguments.length = arguments.length - 1;
84
-
85
- var tokens = msg.split(/(%\d)/);
86
- for (var i = 0; i < tokens.length; i += 2) {
87
- var text = goog.string.trim(tokens[i]);
88
- var symbol = tokens[i + 1];
89
- if (symbol) {
90
- // Value input.
91
- var digit = parseInt(symbol.charAt(1), 10);
92
- var tuple = arguments[digit];
93
- goog.asserts.assertArray(tuple,
94
- 'Message symbol "%s" is out of range.', symbol);
95
- if (goog.typeOf(tuple[1]) == 'array' && tuple[1][0] == 'Dropdown') {
96
- this.appendDummyInput()
97
- .appendField(text)
98
- .setAlign(tuple[2])
99
- .appendField(new Blockly.FieldDropdown(tuple[1][1]), tuple[0]);
100
- }
101
- else if (goog.typeOf(tuple[1]) == 'array' && tuple[1][0] == 'Colour') {
102
- this.appendDummyInput()
103
- .appendField(text)
104
- .setAlign(tuple[2])
105
- .appendField(new Blockly.FieldColour(tuple[1][1]), tuple[0]);
106
- }
107
- else {
108
- this.appendValueInput(tuple[0])
109
- .setCheck(tuple[1])
110
- .setAlign(tuple[2])
111
- .appendField(text);
112
- }
113
- arguments[digit] = null; // Inputs may not be reused.
114
- } else if (text) {
115
- this.appendDummyInput()
116
- .setAlign(dummyAlign)
117
- .appendField(text);
118
- }
119
- }
120
- // Verify that all inputs were used.
121
- for (var i = 1; i < arguments.length - 1; i++) {
122
- goog.asserts.assert(arguments[i] === null,
123
- 'Input "%%s" not used in message: "%s"', i, msg);
124
- }
125
- // Make the inputs inline unless there is only one input and
126
- // no text follows it.
127
- this.setInputsInline(!msg.match(/%1\s*$/))
128
- };
@@ -1,33 +0,0 @@
1
- # ログインダイアログを表現するビュー
2
- Smalruby.SigninModalView = Backbone.View.extend
3
- events:
4
- 'click #signin-modal-ok-button': 'onOk' # FIXME: 本当は#signin-modal .ok-buttonを指定したいができなかった
5
-
6
- initialize: ->
7
- Smalruby.ignoreEnterKey(@$el)
8
- @$el.on 'shown', =>
9
- @$el.find('#signin-modal-username')
10
- .focus()
11
-
12
- render: ->
13
- @$el.find('#signin-modal-username')
14
- .val($('#username-label').text())
15
- @$el.modal('show')
16
-
17
- onOk: (e) ->
18
- username = @$el.find('input[name=username]').val()
19
- $.post('/sessions/', { username: username })
20
- .then(
21
- (data) ->
22
- $('#signin-button').hide()
23
- $('#signout-button').show()
24
- $('#username-label').text(data)
25
- $('#username-button').show()
26
- successMessage('ログインしました')
27
- new $.Deferred().resolve().promise()
28
- ->
29
- errorMessage('ログインに失敗しました')
30
- new $.Deferred().resolve().promise()
31
- )
32
- .done =>
33
- @$el.modal('hide')
@@ -1,496 +0,0 @@
1
- %xml{:id => 'toolbox', :style => 'display: none'}
2
- - category = 'motion'
3
- %category{:name => t('.motion')}
4
- %category{:name => t('.motion_move')}
5
- -# ( )歩動かす
6
- %block{:type => "#{category}_move"}
7
- = toolbox_number_value('STEP', 10)
8
-
9
- -# x座標を( )、y座標を( )にする
10
- %block{:type => "#{category}_set_x_y"}
11
- = toolbox_number_value('X')
12
- = toolbox_number_value('Y')
13
-
14
- -# マウスポインターへ行く
15
- %block{:type => "#{category}_go_to_mouse"}
16
-
17
- -# [▼]へ行く
18
- %block{:type => "#{category}_go_to_character"}
19
-
20
- -# ( )秒でx座標を( )、y座標を( )に変える
21
- -#%block{:type => "#{category}_glide_to_x_y"}
22
- -# = toolbox_number_value('SEC', 1)
23
- -# = toolbox_number_value('X')
24
- -# = toolbox_number_value('Y')
25
-
26
- -# x座標を( )ずつ変える
27
- %block{:type => "#{category}_change_x_by"}
28
- = toolbox_number_value('X', 10)
29
-
30
- -# x座標を( )にする
31
- %block{:type => "#{category}_set_x"}
32
- = toolbox_number_value('X', 0)
33
-
34
- -# y座標を( )ずつ変える
35
- %block{:type => "#{category}_change_y_by"}
36
- = toolbox_number_value('Y', 10)
37
-
38
- -# y座標を( )にする
39
- %block{:type => "#{category}_set_y"}
40
- = toolbox_number_value('Y', 0)
41
-
42
- -# 変数:x座標
43
- - if !raspberrypi?
44
- %block{:type => "#{category}_self_x"}
45
-
46
- -# 変数:y座標
47
- - if !raspberrypi?
48
- %block{:type => "#{category}_self_y"}
49
-
50
- %category{:name => t('.motion_rotate')}
51
- -# もし端に着いたら、跳ね返る
52
- %block{:type => "#{category}_turn_if_reach_wall"}
53
-
54
- -# 跳ね返る
55
- %block{:type => "#{category}_turn"}
56
-
57
- -# [▼水平(X)]方向に跳ね返る
58
- %block{:type => "#{category}_turn_xy"}
59
-
60
- -# 時計回りに( )度回す
61
- %block{:type => "#{category}_rotate_right"}
62
- = toolbox_number_value('ANGLE', 15)
63
-
64
- -# 反時計回りに( )度回す
65
- %block{:type => "#{category}_rotate_left"}
66
- = toolbox_number_value('ANGLE', 15)
67
-
68
- -# ( )度に向ける
69
- %block{:type => "#{category}_set_angle"}
70
- = toolbox_number_value('ANGLE', 90)
71
-
72
- -# マウスポインターへ向ける
73
- %block{:type => "#{category}_point_towards_mouse"}
74
-
75
- -# [▼]へ向ける
76
- %block{:type => "#{category}_point_towards_character"}
77
-
78
- -# 回転方法を[▼]にする
79
- %block{:type => "#{category}_set_rotation_style"}
80
-
81
- -# 変数:向き
82
- - if !raspberrypi?
83
- %block{:type => "#{category}_self_angle"}
84
-
85
- - if !raspberrypi?
86
- - category = 'hardware'
87
- %category{:name => t('.motion_actuator')}
88
- - subcategory = 'servo'
89
- -# サーボ[▼PIN]を( )度(5~180)にする
90
- %block{:type => "#{category}_#{subcategory}_set_position"}
91
- = toolbox_number_value('POS', 90)
92
-
93
- - subcategory = 'two_wheel_drive_car'
94
- -# 2WD車[▼PIN]を( )秒[▼コマンド]
95
- %block{:type => "#{category}_#{subcategory}_run"}
96
- = toolbox_pin_field('D5')
97
- = toolbox_number_value('SEC', 1)
98
- %value{:name => 'COMMAND'}
99
- %block{:type => "#{category}_#{subcategory}_commands"}
100
-
101
- -# [▼コマンド]
102
- %block{:type => "#{category}_#{subcategory}_commands"}
103
- %field{:name => 'COMMAND'}<
104
- forward
105
-
106
- -# 2WD車[▼PIN]を進める
107
- %block{:type => "#{category}_#{subcategory}_forward"}
108
- = toolbox_pin_field('D5')
109
-
110
- -# 2WD車[▼PIN]をバックさせる
111
- %block{:type => "#{category}_#{subcategory}_backward"}
112
- = toolbox_pin_field('D5')
113
-
114
- -# 2WD車[▼PIN]を左に曲げる
115
- %block{:type => "#{category}_#{subcategory}_turn_left"}
116
- = toolbox_pin_field('D5')
117
-
118
- -# 2WD車[▼PIN]を右に曲げる
119
- %block{:type => "#{category}_#{subcategory}_turn_right"}
120
- = toolbox_pin_field('D5')
121
-
122
- -# 2WD車[▼PIN]を止める
123
- %block{:type => "#{category}_#{subcategory}_stop"}
124
- = toolbox_pin_field('D5')
125
-
126
- -# 2WD車[▼PIN]の[▼LOR]の速度を<SPEED>%にする
127
- %block{:type => "#{category}_#{subcategory}_set_speed"}
128
- = toolbox_pin_field('D5')
129
- = toolbox_number_value('SPEED', 100)
130
-
131
- - subcategory = 'motor_driver'
132
- -# (モータードライバ[▼PIN]で)モーターを[▼正転させる]
133
- %block{:type => "#{category}_#{subcategory}"}
134
- = toolbox_pin_field('D6')
135
- %field{:name => 'METHOD'}<
136
- forward
137
-
138
- -# (モータードライバ[▼PIN]の)モーターの速度を<SPEED>%にする
139
- %block{:type => "#{category}_#{subcategory}_set_speed"}
140
- = toolbox_pin_field('D6')
141
- = toolbox_number_value('SPEED', 100)
142
-
143
- - subcategory = 'smalrubot_v3'
144
- %block{type: "#{category}_#{subcategory}_action"}
145
- %field{name: 'ACTION'}<
146
- forward
147
-
148
- %block{type: "#{category}_#{subcategory}_action_with_sec"}
149
- %field{name: 'ACTION'}<
150
- forward
151
- = toolbox_number_value('SEC', 0.5)
152
-
153
- %block{type: "#{category}_#{subcategory}_motor_set_speed"}
154
- = toolbox_number_value('SPEED', 100)
155
-
156
- - category = 'looks'
157
- %category{:name => t('.looks')}
158
- -# [ ]と( )秒言う
159
- -#%block{:type => "#{category}_say_second"}
160
- -# = toolbox_text_value('TEXT', 'こんにちは!')
161
- -# = toolbox_number_value('SEC', 2)
162
-
163
- -# [ ]と言う
164
- %block{:type => "#{category}_say"}
165
- = toolbox_text_value('TEXT', t('.hello'))
166
-
167
- -# [ ]と( )秒考える
168
- -#%block{:type => "#{category}_think_second"}
169
- -# = toolbox_text_value('TEXT', 'ふーん')
170
- -# = toolbox_number_value('SEC', 2)
171
-
172
- -# [ ]と考える
173
- -#%block{:type => "#{category}_think"}
174
- -# = toolbox_text_value('TEXT', 'ふーん')
175
-
176
- -# 表示する
177
- %block{:type => "#{category}_show"}
178
-
179
- -# 隠す
180
- %block{:type => "#{category}_hide"}
181
-
182
- -# 消滅する
183
- %block{:type => "#{category}_vanish"}
184
-
185
- -# 大きさを( )%ずつ変える
186
- -#%block{:type => "#{category}_change_scale_by"}
187
- -# = toolbox_number_value('SCALE', 10)
188
-
189
- -# 大きさを( )%にする
190
- -#%block{:type => "#{category}_set_scale"}
191
- -# = toolbox_number_value('SCALE', 100)
192
-
193
- -# 変数:大きさ
194
- -#%block{:type => "#{category}_self_scale"}
195
-
196
- -# [▼プリセット画像]
197
- -#%block{:type => "#{category}_preset_images"}
198
-
199
- - if !raspberrypi?
200
- - category = 'hardware'
201
- - subcategory = 'led'
202
- -# LED[▼PIN]をオンにする
203
- %block{:type => "#{category}_#{subcategory}_turn_on"}
204
-
205
- -# LED[▼PIN]をオフにする
206
- %block{:type => "#{category}_#{subcategory}_turn_off"}
207
-
208
- - subcategory = 'rgb_led'
209
- -# RGB LED[▼アノード]コモン[▼PIN]を[カラー]にする
210
- %block{:type => "#{category}_#{subcategory}_set_color"}
211
-
212
- -# RGB LED[▼アノード]コモン[▼PIN]をオフにする
213
- %block{:type => "#{category}_#{subcategory}_turn_off"}
214
-
215
- - subcategory = 'seven_segment_display'
216
- -# 7セグディスプレイに[▼0-9]を表示する
217
- %block{:type => "#{category}_#{subcategory}_show"}
218
-
219
- -# 7セグディスプレイをオフにする
220
- %block{:type => "#{category}_#{subcategory}_off"}
221
-
222
- - subcategory = 'lcd'
223
- -# LCDに( )を表示する
224
- %block{:type => "#{category}_#{subcategory}_puts"}
225
- = toolbox_text_value('TEXT', 'Hello')
226
-
227
- -# LCDをクリアする
228
- %block{:type => "#{category}_#{subcategory}_clear"}
229
-
230
- - subcategory = 'smalrubot_v3'
231
- %block{type: "#{category}_#{subcategory}_led_turn_on_or_off"}
232
- %field{name: 'COLOUR'}<
233
- red
234
- %field{name: 'OOO'}<
235
- turn_on
236
-
237
- - category = 'sound'
238
- %category{:name => t('.sound')}
239
- -# [▼プリセット音声]の音を鳴らす
240
- %block{:type => "#{category}_play"}
241
- %value{:name => 'NAME'}
242
- %block{:type => "#{category}_preset_sounds"}
243
-
244
- -# すべての音を止める
245
- -#%block{:type => "#{category}_stop"}
246
-
247
- -# 変数:ボリューム
248
- -#%block{:type => "#{category}_volume"}
249
-
250
- - category = 'pen'
251
- %category{:name => t('.pen')}
252
- - if !raspberrypi?
253
- -# ペンを下ろす
254
- %block{:type => "#{category}_down_pen"}
255
-
256
- -# ペンを上げる
257
- %block{:type => "#{category}_up_pen"}
258
-
259
- -# ペンの色を[カラー]にする
260
- %block{:type => "#{category}_set_pen_color"}
261
-
262
- %category{:name => t('.data')}
263
- %category{:name => t('.data_variables'), :custom => 'VARIABLE'}
264
-
265
- - category = 'events'
266
- %category{:name => t('.events')}
267
- -# まずは
268
- %block{:type => "#{category}_on_start"}
269
-
270
- -# キーボードの[▼キー]が[▼押された/押され続けている]とき
271
- %block{:type => "#{category}_on_key_push_or_down"}
272
- = toolbox_key_field
273
-
274
- -# キャラクターがクリックされたとき
275
- %block{:type => "#{category}_on_click"}
276
-
277
- -# [▼キャラクター]にぶつかったとき
278
- %block{:type => "#{category}_on_hit"}
279
-
280
- - category = 'control'
281
- %category{:name => t('.control')}
282
- %category{:name => t('.control_loop')}
283
- -# ずっと
284
- %block{:type => "#{category}_loop"}
285
-
286
- -# ( )回繰り返す
287
- %block{:type => "#{category}_times"}
288
- = toolbox_number_value('COUNT', 10)
289
-
290
- -# < >まで繰り返す
291
- %block{:type => "#{category}_until"}
292
-
293
- -# 繰り返しから脱出する
294
- %block{:type => "#{category}_break"}
295
-
296
- - if !raspberrypi?
297
- -# 次の繰り返しにジャンプする
298
- %block{:type => "#{category}_next"}
299
-
300
- -# 現在の繰り返しをやり直す
301
- %block{:type => "#{category}_redo"}
302
-
303
- %category{:name => t('.control_wait')}
304
- -# ( )秒待つ
305
- %block{:type => "#{category}_sleep"}
306
- = toolbox_number_value('SEC', 1)
307
-
308
- -# < >まで待つ
309
- %block{:type => "#{category}_await_until"}
310
-
311
- -# ほんの少し待つ
312
- %block{:type => "#{category}_await"}
313
-
314
- %category{:name => t('.control_if')}
315
- -# もし< >なら
316
- %block{:type => "#{category}_if"}
317
-
318
- -# もし< >なら~でなければ
319
- %block{:type => "#{category}_if_else"}
320
-
321
- - category = 'sensing'
322
- %category{:name => t('.sensing')}
323
- %category{:name => t('.sensing_general')}
324
- -# 条件:端に触れた
325
- %block{:type => "#{category}_reach_wall"}
326
-
327
- -# 条件:キーボードの[▼キー]が[▼押された]
328
- %block{:type => "#{category}_input_key_push_or_down"}
329
- = toolbox_key_field
330
-
331
- -# 条件:マウスの[▼左ボタン]が[▼押された]
332
- %block{:type => "#{category}_input_mouse_push_or_down"}
333
-
334
- -# 変数:マウスのx座標
335
- %block{:type => "#{category}_input_mouse_pos_x"}
336
-
337
- -# 変数:マウスのy座標
338
- %block{:type => "#{category}_input_mouse_pos_y"}
339
-
340
- -# 条件:[▼キャラクター]に触れた
341
- %block{:type => "#{category}_hit"}
342
-
343
- -# [ ]と聞いて待つ
344
- -#%block{:type => "#{category}_ask"}
345
- -# = toolbox_text_value('TEXT', 'あなたのお名前は?')
346
-
347
- -# 変数:答え
348
- -#%block{:type => "#{category}_answer"}
349
-
350
- -# 変数:タイマー
351
- -#%block{:type => "#{category}_timer_count"}
352
-
353
- -# タイマーをリセット
354
- -#%block{:type => "#{category}_timer_reset"}
355
-
356
- -# 変数:[▼キャラクター]の[▼プロパティ]
357
- %block{:type => "#{category}_character_property"}
358
-
359
- - if !raspberrypi?
360
- -# 変数:現在の[▼時]
361
- %block{:type => "#{category}_time_now"}
362
-
363
- -# 変数:2000年からの日数
364
- %block{:type => "#{category}_days_since_2000"}
365
-
366
- - if !raspberrypi?
367
- - category = 'hardware'
368
- %category{:name => t('.sensing_hardware')}
369
- -# センサー[▼PIN]
370
- %block{:type => "#{category}_sensor_value"}
371
- = toolbox_pin_field('A0')
372
-
373
- -# 条件:ボタン[▼PIN]が[▼押された]
374
- %block{:type => "#{category}_button_pressed_or_released"}
375
- = toolbox_pin_field('D3')
376
-
377
- -# 2WD車[▼PIN]の[▼LOR]の速度%
378
- %block{:type => "#{category}_two_wheel_drive_car_speed"}
379
- = toolbox_pin_field('D5')
380
-
381
- -# (モータードライバ[▼PIN]の)モーターの速度(%)
382
- %block{:type => "#{category}_motor_driver_speed"}
383
- = toolbox_pin_field('D6')
384
-
385
- - subcategory = 'smalrubot_v3'
386
- %block{type: "#{category}_#{subcategory}_touch_sensor_pressed_or_released"}
387
- %block{type: "#{category}_#{subcategory}_light_sensor_value"}
388
- %block{type: "#{category}_#{subcategory}_motor_speed"}
389
-
390
- - category = 'operators'
391
- %category{:name => t('.operators')}
392
- %category{:name => t('.operators_calculate')}
393
- -# 変数:( ) + ( )
394
- %block{:type => "#{category}_add"}
395
-
396
- -# 変数:( ) - ( )
397
- %block{:type => "#{category}_minus"}
398
-
399
- -# 変数:( ) * ( )
400
- %block{:type => "#{category}_multiply"}
401
-
402
- -# 変数:( ) / ( )
403
- %block{:type => "#{category}_divide"}
404
-
405
- -# 変数:( )から( )までの乱数
406
- %block{:type => "#{category}_rand"}
407
- = toolbox_number_value('A', 1)
408
- = toolbox_number_value('B', 10)
409
-
410
- -# 変数:( )を( )で割った余り
411
- - if !raspberrypi?
412
- %block{:type => "#{category}_modulo"}
413
- = toolbox_number_value('A', 5)
414
- = toolbox_number_value('B', 2)
415
-
416
- -# 変数:( )を丸める
417
- %block{:type => "#{category}_round"}
418
- = toolbox_number_value('A', 0.5)
419
-
420
- -# 変数:( )の[▼数学関数]
421
- %block{:type => "#{category}_math_method"}
422
- = toolbox_number_value('NUM', 9)
423
- %field{:name => 'METHOD'}<
424
- Math.sqrt(%num%)
425
-
426
- -# 数値
427
- %block{:type => 'math_number'}
428
- %field{:name => 'NUM'}<
429
- 0
430
-
431
- %category{:name => t('.operators_string')}
432
- -# 変数:( )の( )番目
433
- %block{:type => "#{category}_index_of"}
434
- = toolbox_text_value('A', t('.world'))
435
- = toolbox_number_value('INDEX', 1)
436
-
437
- -# 変数:( )の長さ
438
- %block{:type => "#{category}_length"}
439
- = toolbox_text_value('A', t('.world'))
440
-
441
- -# テキスト
442
- %block{:type => 'text'}
443
- %field{:name => 'TEXT'}<
444
- = t('.text')
445
-
446
- %category{:name => t('.operators_condition')}
447
- -# 条件:( ) < ( )
448
- %block{:type => "#{category}_compare_gt"}
449
-
450
- -# 条件:( ) <= ( )
451
- %block{:type => "#{category}_compare_gte"}
452
-
453
- -# 条件:( ) = ( )
454
- %block{:type => "#{category}_compare_eq"}
455
-
456
- -# 条件:( ) >= ( )
457
- %block{:type => "#{category}_compare_lte"}
458
-
459
- -# 条件:( ) > ( )
460
- %block{:type => "#{category}_compare_lt"}
461
-
462
- -# 条件:< > かつ < >
463
- %block{:type => "#{category}_and"}
464
-
465
- -# 条件:< > または < >
466
- %block{:type => "#{category}_or"}
467
-
468
- -# 条件:< > ではない
469
- %block{:type => "#{category}_negate"}
470
-
471
- -# 条件:真
472
- %block{:type => "#{category}_true"}
473
-
474
- -# 条件:偽
475
- %block{:type => "#{category}_false"}
476
-
477
- %category{:name => t('.etc')}
478
- - if !raspberrypi?
479
- - category = 'ruby'
480
- %category{:name => t('.etc_ruby')}
481
- -# 文
482
- %block{:type => "#{category}_statement"}
483
-
484
- -# 式
485
- %block{:type => "#{category}_expression"}
486
-
487
- -# コメント
488
- %block{:type => "#{category}_comment"}
489
-
490
- -# p
491
- %block{:type => "#{category}_p"}
492
-
493
- - category = 'hardware'
494
- %category{:name => t('.etc_hardware')}
495
- -# ハードウェアを準備する
496
- %block{:type => "#{category}_init_hardware"}