mumuki-gobstones-runner 2.5.0 → 2.6.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cac300fd1a47b04646788843ddfecc79ff2884ded1f0fe5c487aa6be7a956847
4
- data.tar.gz: '0483fa63493e187c1d7c11cc78f19d58a524bb11aa60180c6650e1c3b8848cf8'
3
+ metadata.gz: b446a18e6b30e8cf36967b04bb4acb42ece4e58f6d408c6c46d4c0169916e1bd
4
+ data.tar.gz: f3da67c858453ebe4cd67b296411ad8c2c8464e7555f4aa77dfc2e6fc89ef791
5
5
  SHA512:
6
- metadata.gz: 4f504c3eac9f541416c2357ed1cd8da5adceb3ae4f24381cd3ecd473eae613d9742f8c5044c7e26c21230af9eab9b9a1ca46db761f91423d673142f62be604bd
7
- data.tar.gz: ea1bd21dc36faedcfe18c49ec6d90e5953654b55d1c2433c4de8a55076660a1db33b0107701db85ef13ba6768c29ac7cd35f2f3fd9218b2bf50bae32cdbf9465
6
+ metadata.gz: 7ea507680416d06c0f23b3223ce8c32f331bb55a46492ed14f5dad0e69f610743d257df6363ea0a68767bf0cc12f78f33970ee70a0fe84214f6697a321d66984
7
+ data.tar.gz: 8fcf765ac567ac38e0edcce528de4fdecbcc47b471297b8b59d5ef316ee1a27707370091494c531a8ea459b5922886be863f5f53e68ace1951a4b28bb464e11e
@@ -13,6 +13,10 @@ class Mumukit::Server::App < Sinatra::Base
13
13
  get_asset route, Gobstones::CodeRunner.assets_path_for(path), type
14
14
  end
15
15
 
16
+ def self.get_local_svg(name, asset_type)
17
+ get_local_asset "#{asset_type}/#{name}.svg", "lib/public/#{name}.svg", 'image/svg+xml'
18
+ end
19
+
16
20
  ['polymer', 'polymer-mini', 'polymer-micro'].each { |name|
17
21
  get_board_asset "#{name}.html", "htmls/vendor/#{name}.html", 'text/html'
18
22
  }
@@ -28,7 +32,12 @@ class Mumukit::Server::App < Sinatra::Base
28
32
  get_local_asset 'editor/editor.html', 'lib/render/editor/editor.html', 'text/html'
29
33
  get_local_asset 'editor/hammer.min.js', 'lib/render/editor/hammer.min.js', 'application/javascript'
30
34
  get_local_asset 'boom.png', 'lib/public/boom.png', 'image/png'
31
- ['red', 'blue', 'green', 'black', 'attires_enabled', 'attires_disabled'].each { |name|
32
- get_local_asset "editor/#{name}.svg", "lib/public/#{name}.svg", 'image/svg+xml'
33
- }
35
+
36
+ ['red', 'blue', 'green', 'black'].each do |name|
37
+ get_local_svg(name, 'editor')
38
+ end
39
+
40
+ ['attires_enabled', 'attires_disabled'].each do |name|
41
+ get_local_svg(name, 'layout')
42
+ end
34
43
  end
@@ -48,6 +48,7 @@
48
48
  </div>
49
49
  <% end %>
50
50
 
51
+ <gs-attire-toggle-button></gs-attire-toggle-button>
51
52
  </div>
52
53
 
53
54
  <% if @result[:reason] %>
@@ -1066,81 +1066,3 @@
1066
1066
  </script>
1067
1067
  </dom-module>
1068
1068
 
1069
- <dom-module id="gs-attire-toggle-button">
1070
- <style>
1071
- .button {
1072
- position: absolute;
1073
- cursor: pointer;
1074
- top: -2px;
1075
- right: 0;
1076
- -ms-transform-origin: right center;
1077
- -webkit-transform-origin: right center;
1078
- transform-origin: right center;
1079
- }
1080
- </style>
1081
-
1082
- <template>
1083
- <template is="dom-if" if="{{shouldDisplay}}">
1084
- <div class="button" on-click="_onButtonClick">
1085
- <template is="dom-if" if="{{isEnabled}}">
1086
- <img src="./attires_enabled.svg">
1087
- </template>
1088
- <template is="dom-if" if="{{!isEnabled}}">
1089
- <img src="./attires_disabled.svg">
1090
- </template>
1091
- </div>
1092
- </template>
1093
- </template>
1094
-
1095
- <script>
1096
- Polymer({
1097
- is: 'gs-attire-toggle-button',
1098
- properties: {
1099
- isEnabled: {
1100
- type: Boolean,
1101
- value: true
1102
- }
1103
- },
1104
-
1105
- ready: function () {
1106
- document.addEventListener('board-attire-changed', this._updateVisibility.bind(this));
1107
- this._relocateButton();
1108
- },
1109
-
1110
- _updateVisibility: function () {
1111
- this.boards = $(".mu-kids-states").find("gs-board");
1112
- this.shouldDisplay = this.boards.toArray().some(board => board.attire);
1113
- },
1114
-
1115
- _onButtonClick: function () {
1116
- this.isEnabled = !this.isEnabled;
1117
-
1118
- this.boards.each((__, board) => {
1119
- if (board.attire) board.set("attire.enabled", this.isEnabled);
1120
- gbsBoardRemoveBorder(board);
1121
- });
1122
- },
1123
-
1124
- _getEditor: function () {
1125
- return $("mu-gobstones-custom-editor")[0];
1126
- },
1127
-
1128
- _relocateButton: function () {
1129
- const $container = $('.mu-kids-gbs-board-initial');
1130
- if(!$container.length || this._getEditor().interactiveMode) return;
1131
- const $header = $('.mu-initial-state-header');
1132
- const headerWidth = $header.width() || $container.width();
1133
- const $attireToggle = $container.find('.button.gs-attire-toggle-button');
1134
- if(!$attireToggle.length) return setTimeout(() => this._relocateButton());
1135
- const margin = 4; // Leave a margin between text and image
1136
- const maxSize = 65.75; // Original width
1137
- mumuki.resize(() => {
1138
- $attireToggle.css('transform', 'scale(1)');
1139
- let buttonSize = (($container.width() - headerWidth) / 2) - margin;
1140
- let scaleX = Math.min(buttonSize, maxSize) / $attireToggle.width();
1141
- $attireToggle.css('transform', `scale(${scaleX})`);
1142
- });
1143
- },
1144
- });
1145
- </script>
1146
- </dom-module>
@@ -22,4 +22,88 @@
22
22
  </script>
23
23
  </dom-module>
24
24
 
25
+ <dom-module id="gs-attire-toggle-button">
26
+ <style>
27
+ :host-context(.mu-kids-states) .button {
28
+ position: absolute;
29
+ cursor: pointer;
30
+ top: -2px;
31
+ right: 0;
32
+ -ms-transform-origin: right center;
33
+ -webkit-transform-origin: right center;
34
+ transform-origin: right center;
35
+ }
36
+
37
+ :host-context(.boards-container) .button {
38
+ cursor: pointer;
39
+ margin-top: -8px;
40
+ }
41
+ </style>
42
+
43
+ <template>
44
+ <template is="dom-if" if="{{shouldDisplay}}">
45
+ <div class="button" on-click="_onButtonClick">
46
+ <template is="dom-if" if="{{isEnabled}}">
47
+ <img src="./attires_enabled.svg">
48
+ </template>
49
+ <template is="dom-if" if="{{!isEnabled}}">
50
+ <img src="./attires_disabled.svg">
51
+ </template>
52
+ </div>
53
+ </template>
54
+ </template>
55
+
56
+ <script>
57
+ Polymer({
58
+ is: 'gs-attire-toggle-button',
59
+ properties: {
60
+ isEnabled: {
61
+ type: Boolean,
62
+ value: true
63
+ }
64
+ },
65
+
66
+ ready: function () {
67
+ this._updateVisibility();
68
+ document.addEventListener('board-attire-changed', this._updateVisibility.bind(this));
69
+ this._relocateButton();
70
+ },
71
+
72
+ _updateVisibility: function () {
73
+ this.boards = $(this).parents(".mu-kids-states, .boards-container").find("gs-board");
74
+ this.shouldDisplay = this.boards.toArray().some(board => board.attire);
75
+ },
76
+
77
+ _onButtonClick: function () {
78
+ this.isEnabled = !this.isEnabled;
79
+
80
+ this.boards.each((__, board) => {
81
+ if (board.attire) board.set("attire.enabled", this.isEnabled);
82
+ board.updateStyles();
83
+ });
84
+ },
85
+
86
+ _getEditor: function () {
87
+ return $("mu-gobstones-custom-editor")[0];
88
+ },
89
+
90
+ _relocateButton: function () {
91
+ const $container = $('.mu-kids-gbs-board-initial');
92
+ if(!$container.length || this._getEditor().interactiveMode) return;
93
+ const $header = $('.mu-initial-state-header');
94
+ const headerWidth = $header.width() || $container.width();
95
+ const $attireToggle = $container.find('.button.gs-attire-toggle-button');
96
+ if(!$attireToggle.length) return setTimeout(() => this._relocateButton());
97
+ const margin = 4; // Leave a margin between text and image
98
+ const maxSize = 65.75; // Original width
99
+ mumuki.resize(() => {
100
+ $attireToggle.css('transform', 'scale(1)');
101
+ let buttonSize = (($container.width() - headerWidth) / 2) - margin;
102
+ let scaleX = Math.min(buttonSize, maxSize) / $attireToggle.width();
103
+ $attireToggle.css('transform', `scale(${scaleX})`);
104
+ });
105
+ },
106
+ });
107
+ </script>
108
+ </dom-module>
25
109
 
@@ -1,3 +1,3 @@
1
1
  module GobstonesVersionHook
2
- VERSION = '2.5.0'
2
+ VERSION = '2.6.0'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mumuki-gobstones-runner
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.5.0
4
+ version: 2.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rodrigo Alfonso
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-11-04 00:00:00.000000000 Z
11
+ date: 2019-11-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mumukit
@@ -44,14 +44,14 @@ dependencies:
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '1.18'
47
+ version: '1.19'
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: '1.18'
54
+ version: '1.19'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: gobstones-blockly
57
57
  requirement: !ruby/object:Gem::Requirement