smalruby-editor 0.1.10-x86-mingw32 → 0.1.11-x86-mingw32
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.
- checksums.yaml +4 -4
- data/app/assets/javascripts/blocks/motion.js.coffee.erb +1 -1
- data/app/assets/javascripts/smalruby.js.coffee +18 -0
- data/app/assets/javascripts/views/main_menu_view.js.coffee +38 -1
- data/app/assets/javascripts/views/signin_modal_view.js.coffee +33 -0
- data/app/controllers/application_controller.rb +6 -0
- data/app/controllers/sessions_controller.rb +19 -0
- data/app/controllers/source_codes_controller.rb +20 -9
- data/app/helpers/sessions_helper.rb +2 -0
- data/app/views/editor/_signin_modal.html.haml +22 -0
- data/app/views/editor/_toolbox.html.haml +1 -1
- data/app/views/editor/index.html.haml +31 -1
- data/config/routes.rb +3 -0
- data/lib/smalruby_editor/version.rb +1 -1
- data/public/assets/application-53d651da3309caa498cc0ca6616dbead.css.gz +0 -0
- data/public/assets/{application-0b3c70107ad81ea9fcda6d7d921bd8cf.js → application-669cbc2df60729c4b12d739af7595cc6.js} +98 -4
- data/public/assets/{application-0b3c70107ad81ea9fcda6d7d921bd8cf.js.gz → application-669cbc2df60729c4b12d739af7595cc6.js.gz} +0 -0
- data/public/assets/manifest-332a5a1668194028b55103e0ea45c054.json +1 -1
- data/smalruby-editor.gemspec +1 -1
- data/spec/acceptance/base.feature +1 -0
- data/spec/acceptance/standalone/signin.feature +95 -0
- data/spec/controllers/sessions_controller_spec.rb +74 -0
- data/spec/helpers/sessions_helper_spec.rb +15 -0
- data/spec/steps/base_steps.rb +33 -2
- data/spec/steps/global_variable.rb +38 -11
- metadata +16 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a94273db1c791f6e7ae5c93360482e9ab8fa5076
|
4
|
+
data.tar.gz: fc488f3cb404b1fe0194070df2f1dfadf0b9bedd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 86caaa9bf6cfe611bfed8e65a648dabf4d49c9e8428067916c394fdbe8d700ed7b01fc799e7a0a34883eb8e8123a692127e4e6a6ce98b0a357b6d6eb9e6391b8
|
7
|
+
data.tar.gz: a7c3221eeac8e97d17827fe1014f37d028fece17b479439fbcef9aac3a944357bb2fa63685b05f1f185e0eb44a5515ea425e692f5226e60be6ad0035f535a2ed
|
@@ -270,7 +270,7 @@ Blockly.Blocks['<%= n %>'] =
|
|
270
270
|
|
271
271
|
Blockly.Ruby['<%= n %>'] = (block) ->
|
272
272
|
style = @getFieldValue('STYLE')
|
273
|
-
|
273
|
+
Blockly.Ruby.characterSetVariable_('rotation_style', ":#{style}")
|
274
274
|
|
275
275
|
# 変数:x座標
|
276
276
|
# 変数:y座標
|
@@ -22,12 +22,19 @@ window.errorMessage = (msg, selector = '#messages') ->
|
|
22
22
|
html.fadeIn('slow')
|
23
23
|
return
|
24
24
|
|
25
|
+
window.clearMessages = (selector = '#messages') ->
|
26
|
+
$(selector).empty()
|
27
|
+
|
25
28
|
window.Smalruby =
|
26
29
|
Models: {}
|
27
30
|
Collections: {}
|
28
31
|
Views: {}
|
29
32
|
Routers: {}
|
30
33
|
initialize: ->
|
34
|
+
$.ajaxSetup
|
35
|
+
headers:
|
36
|
+
'X-CSRF-Token': $('meta[name="csrf-token"]').attr('content')
|
37
|
+
|
31
38
|
# HACK: Underscoreのテンプレートの<%, %>はHamlと組み合わせたときに
|
32
39
|
# HTML要素の属性がHamlによってエスケープされてしまうため使いにく
|
33
40
|
# い。そこで、それぞれ{{, }}に変更する。
|
@@ -40,6 +47,8 @@ window.Smalruby =
|
|
40
47
|
@Collections.CharacterSet = new Smalruby.CharacterSet()
|
41
48
|
|
42
49
|
@Views.MainMenuView = new Smalruby.MainMenuView()
|
50
|
+
@Views.SigninModalView = new Smalruby.SigninModalView
|
51
|
+
el: $('#signin-modal')
|
43
52
|
@Views.CharacterSelectorView = new Smalruby.CharacterSelectorView
|
44
53
|
model: @Collections.CharacterSet
|
45
54
|
@Views.CharacterModalView = new Smalruby.CharacterModalView
|
@@ -129,5 +138,14 @@ window.Smalruby =
|
|
129
138
|
xmlDom.insertBefore(e, blocklyDom)
|
130
139
|
Blockly.Xml.domToPrettyText(xmlDom)
|
131
140
|
|
141
|
+
# テキスト入力欄のEnter(Return)キーを無視する
|
142
|
+
ignoreEnterKey: (el) ->
|
143
|
+
el.find('input[type=text]').keypress (e) ->
|
144
|
+
e = window.event if !e
|
145
|
+
if e.keyCode == 13
|
146
|
+
false
|
147
|
+
else
|
148
|
+
true
|
149
|
+
|
132
150
|
$(document).ready ->
|
133
151
|
Smalruby.initialize()
|
@@ -12,6 +12,9 @@ Smalruby.MainMenuView = Backbone.View.extend
|
|
12
12
|
'click #save-button': 'onSave'
|
13
13
|
'click #check-button': 'onCheck'
|
14
14
|
'click #reset-button': 'onReset'
|
15
|
+
'click #signin-button': 'onSignin'
|
16
|
+
'click #signout-button': 'onSignout'
|
17
|
+
'click #username-button': 'onUsername'
|
15
18
|
|
16
19
|
initialize: ->
|
17
20
|
$('#filename').keypress (e) ->
|
@@ -87,6 +90,8 @@ Smalruby.MainMenuView = Backbone.View.extend
|
|
87
90
|
filename += '.xml' unless filename.match(/\.xml$/)
|
88
91
|
xmlSourceCode = new Smalruby.SourceCode({ filename: filename })
|
89
92
|
|
93
|
+
clearMessages()
|
94
|
+
|
90
95
|
@blockUI
|
91
96
|
title:
|
92
97
|
"""
|
@@ -144,6 +149,8 @@ Smalruby.MainMenuView = Backbone.View.extend
|
|
144
149
|
|
145
150
|
sourceCode = @getSourceCode()
|
146
151
|
|
152
|
+
clearMessages()
|
153
|
+
|
147
154
|
@blockUI
|
148
155
|
title:
|
149
156
|
"""
|
@@ -199,6 +206,8 @@ Smalruby.MainMenuView = Backbone.View.extend
|
|
199
206
|
else
|
200
207
|
sourceCode = @getSourceCode()
|
201
208
|
|
209
|
+
clearMessages()
|
210
|
+
|
202
211
|
@blockUI
|
203
212
|
title:
|
204
213
|
"""
|
@@ -229,7 +238,7 @@ Smalruby.MainMenuView = Backbone.View.extend
|
|
229
238
|
onCheck: (e) ->
|
230
239
|
e.preventDefault()
|
231
240
|
|
232
|
-
|
241
|
+
clearMessages()
|
233
242
|
|
234
243
|
sourceCode = @getSourceCode()
|
235
244
|
|
@@ -265,6 +274,32 @@ Smalruby.MainMenuView = Backbone.View.extend
|
|
265
274
|
|
266
275
|
location.reload()
|
267
276
|
|
277
|
+
onSignin: (e) ->
|
278
|
+
e.preventDefault()
|
279
|
+
|
280
|
+
Smalruby.Views.SigninModalView.render()
|
281
|
+
|
282
|
+
onSignout: (e) ->
|
283
|
+
e.preventDefault()
|
284
|
+
|
285
|
+
$.ajax({
|
286
|
+
url: '/signout'
|
287
|
+
type: 'DELETE'
|
288
|
+
})
|
289
|
+
.then(
|
290
|
+
(data) ->
|
291
|
+
$('#signin-button').show()
|
292
|
+
$('#signout-button').hide()
|
293
|
+
$('#username-label').text('')
|
294
|
+
$('#username-button').hide()
|
295
|
+
successMessage('ログアウトしました')
|
296
|
+
->
|
297
|
+
errorMessage('ログアウトに失敗しました')
|
298
|
+
)
|
299
|
+
|
300
|
+
onUsername: (e) ->
|
301
|
+
e.preventDefault()
|
302
|
+
|
268
303
|
getFilename: ->
|
269
304
|
$.trim($('#filename').val())
|
270
305
|
|
@@ -330,6 +365,8 @@ Smalruby.MainMenuView = Backbone.View.extend
|
|
330
365
|
if info.error
|
331
366
|
window.errorMessage(info.filename + 'は' + info.error)
|
332
367
|
else
|
368
|
+
clearMessages()
|
369
|
+
|
333
370
|
filename = info.filename
|
334
371
|
if filename.match(/\.xml$/)
|
335
372
|
unless window.blockMode
|
@@ -0,0 +1,33 @@
|
|
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')
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
# セッションを扱うコントローラ
|
3
|
+
class SessionsController < ApplicationController
|
4
|
+
before_filter :check_whether_standalone
|
5
|
+
|
6
|
+
def create
|
7
|
+
return head :bad_request if params[:username].blank?
|
8
|
+
|
9
|
+
session[:username] = params[:username].to_s
|
10
|
+
|
11
|
+
render text: session[:username]
|
12
|
+
end
|
13
|
+
|
14
|
+
def destroy
|
15
|
+
session[:username] = nil
|
16
|
+
|
17
|
+
render nothing: true
|
18
|
+
end
|
19
|
+
end
|
@@ -101,7 +101,12 @@ class SourceCodesController < ApplicationController
|
|
101
101
|
|
102
102
|
def run
|
103
103
|
source_code = SourceCode.new(source_code_params)
|
104
|
-
|
104
|
+
if session[:username]
|
105
|
+
s = "~/#{session[:username]}/#{source_code.filename}"
|
106
|
+
else
|
107
|
+
s = "~/#{source_code.filename}"
|
108
|
+
end
|
109
|
+
path = Pathname(s).expand_path
|
105
110
|
render json: source_code.run(path)
|
106
111
|
end
|
107
112
|
|
@@ -118,12 +123,6 @@ class SourceCodesController < ApplicationController
|
|
118
123
|
|
119
124
|
private
|
120
125
|
|
121
|
-
def check_whether_standalone
|
122
|
-
unless standalone?
|
123
|
-
fail "#{self.class.name}##{action_name}はstandaloneモードのみの機能です"
|
124
|
-
end
|
125
|
-
end
|
126
|
-
|
127
126
|
def source_code_params
|
128
127
|
params.require(:source_code).permit(:data, :filename)
|
129
128
|
end
|
@@ -154,10 +153,16 @@ class SourceCodesController < ApplicationController
|
|
154
153
|
end
|
155
154
|
|
156
155
|
def write_source_code(source_code)
|
157
|
-
|
156
|
+
if session[:username]
|
157
|
+
s = "~/#{session[:username]}/#{source_code.filename}"
|
158
|
+
else
|
159
|
+
s = "~/#{source_code.filename}"
|
160
|
+
end
|
161
|
+
path = Pathname(s).expand_path.to_s
|
158
162
|
|
159
163
|
fail 'すでに同じ名前のプログラムがあります' if File.exist?(path) && params[:force].blank?
|
160
164
|
|
165
|
+
FileUtils.mkdir_p(File.dirname(path))
|
161
166
|
File.open(path, 'w') do |f|
|
162
167
|
f.write(source_code.data)
|
163
168
|
end
|
@@ -170,7 +175,13 @@ class SourceCodesController < ApplicationController
|
|
170
175
|
end
|
171
176
|
|
172
177
|
def local_program_paths
|
173
|
-
|
178
|
+
if session[:username]
|
179
|
+
# TODO: session[:username]の/や\をエスケープする
|
180
|
+
s = "~/#{session[:username]}/*.rb.xml"
|
181
|
+
else
|
182
|
+
s = '~/*.rb.xml'
|
183
|
+
end
|
184
|
+
Pathname.glob(Pathname(s).expand_path)
|
174
185
|
end
|
175
186
|
|
176
187
|
def demo_program_paths
|
@@ -0,0 +1,22 @@
|
|
1
|
+
#signin-modal{class: "modal hide fade", tabindex: "-1",
|
2
|
+
role: "dialog", :"aria-hidden" => "true"}
|
3
|
+
.modal-body
|
4
|
+
%h4
|
5
|
+
%i.icon-info-sign
|
6
|
+
あなたの名前をいれて、
|
7
|
+
%br
|
8
|
+
ほかの人のプログラムとまざらないようにしよう♪
|
9
|
+
%form#signin-modal-form.form-horizontal
|
10
|
+
.control-group{for: "username"}
|
11
|
+
%label.control-label{for: "signin-modal-username"}<
|
12
|
+
名前
|
13
|
+
.controls
|
14
|
+
%input#signin-modal-username.input-large{name: "username", type: "text", placeholder: "名前、生徒番号、ニックネームなど"}
|
15
|
+
|
16
|
+
.modal-footer
|
17
|
+
%button#signin-modal-cancel-button.cancel-button{class: "btn", :"data-dismiss" => "modal", :"aria-hidden" => "true"}<
|
18
|
+
%i.icon-remove
|
19
|
+
やめる
|
20
|
+
%button#signin-modal-ok-button.ok-button{class: "btn btn-primary"}<
|
21
|
+
%i.icon-circle-blank
|
22
|
+
ログイン
|
@@ -27,7 +27,7 @@
|
|
27
27
|
.btn-group
|
28
28
|
%a#submenu-button{:class => "dropdown-toggle btn btn-primary", :"data-toggle" => "dropdown", :href => "#"}
|
29
29
|
%i.icon-reorder
|
30
|
-
%ul.dropdown-menu{:class => "pull-right"}
|
30
|
+
%ul#submenu.dropdown-menu{:class => "pull-right"}
|
31
31
|
%li
|
32
32
|
- if standalone?
|
33
33
|
- load_id = 'load-local-button'
|
@@ -53,6 +53,34 @@
|
|
53
53
|
%h4
|
54
54
|
%i.icon-off
|
55
55
|
リセット
|
56
|
+
- if standalone?
|
57
|
+
%li
|
58
|
+
- if session[:username]
|
59
|
+
%a#signout-button
|
60
|
+
%h4
|
61
|
+
%i.icon-eject
|
62
|
+
ログアウト
|
63
|
+
- else
|
64
|
+
%a#signout-button{style: "display: none"}
|
65
|
+
%h4
|
66
|
+
%i.icon-eject
|
67
|
+
ログアウト
|
68
|
+
- if standalone?
|
69
|
+
- if session[:username]
|
70
|
+
%button#signin-button{class: "btn btn-danger", style: "display: none"}<
|
71
|
+
%i.icon-user
|
72
|
+
ログイン
|
73
|
+
%button#username-button{class: "btn btn-success"}<
|
74
|
+
%i.icon-user
|
75
|
+
%span#username-label<
|
76
|
+
= session[:username]
|
77
|
+
- else
|
78
|
+
%button#signin-button{class: "btn btn-danger"}<
|
79
|
+
%i.icon-user
|
80
|
+
ログイン
|
81
|
+
%button#username-button{class: "btn btn-success", style: "display: none"}<
|
82
|
+
%i.icon-user
|
83
|
+
%span#username-label
|
56
84
|
|
57
85
|
#messages
|
58
86
|
|
@@ -62,3 +90,5 @@
|
|
62
90
|
|
63
91
|
#ruby-tab{:class => 'tab-pane modes-tab-pane'}
|
64
92
|
#text-editor
|
93
|
+
|
94
|
+
= render 'signin_modal'
|
data/config/routes.rb
CHANGED
@@ -5,6 +5,9 @@ SmalrubyEditor::Application.routes.draw do
|
|
5
5
|
match '/demo(/:filename)' => 'editor#demo',
|
6
6
|
defaults: { filename: 'car_chase' }, via: :get
|
7
7
|
|
8
|
+
resources :sessions, only: [:create, :destroy]
|
9
|
+
match '/signout', to: 'sessions#destroy', via: 'delete'
|
10
|
+
|
8
11
|
resources :source_codes, only: [:create, :index]
|
9
12
|
post 'source_codes/check'
|
10
13
|
delete 'source_codes/download'
|
Binary file
|
@@ -12526,6 +12526,13 @@ Blockly.Msg.CONTROLS_IF_ELSE_TITLE_ELSE = Blockly.Msg.CONTROLS_IF_MSG_ELSE;
|
|
12526
12526
|
html.fadeIn('slow');
|
12527
12527
|
};
|
12528
12528
|
|
12529
|
+
window.clearMessages = function(selector) {
|
12530
|
+
if (selector == null) {
|
12531
|
+
selector = '#messages';
|
12532
|
+
}
|
12533
|
+
return $(selector).empty();
|
12534
|
+
};
|
12535
|
+
|
12529
12536
|
window.Smalruby = {
|
12530
12537
|
Models: {},
|
12531
12538
|
Collections: {},
|
@@ -12534,6 +12541,11 @@ Blockly.Msg.CONTROLS_IF_ELSE_TITLE_ELSE = Blockly.Msg.CONTROLS_IF_MSG_ELSE;
|
|
12534
12541
|
initialize: function() {
|
12535
12542
|
var session, textEditor,
|
12536
12543
|
_this = this;
|
12544
|
+
$.ajaxSetup({
|
12545
|
+
headers: {
|
12546
|
+
'X-CSRF-Token': $('meta[name="csrf-token"]').attr('content')
|
12547
|
+
}
|
12548
|
+
});
|
12537
12549
|
_.extend(_.templateSettings, {
|
12538
12550
|
escape: /{{-([\s\S]+?)}}/,
|
12539
12551
|
evaluate: /{{([\s\S]+?)}}/,
|
@@ -12541,6 +12553,9 @@ Blockly.Msg.CONTROLS_IF_ELSE_TITLE_ELSE = Blockly.Msg.CONTROLS_IF_MSG_ELSE;
|
|
12541
12553
|
});
|
12542
12554
|
this.Collections.CharacterSet = new Smalruby.CharacterSet();
|
12543
12555
|
this.Views.MainMenuView = new Smalruby.MainMenuView();
|
12556
|
+
this.Views.SigninModalView = new Smalruby.SigninModalView({
|
12557
|
+
el: $('#signin-modal')
|
12558
|
+
});
|
12544
12559
|
this.Views.CharacterSelectorView = new Smalruby.CharacterSelectorView({
|
12545
12560
|
model: this.Collections.CharacterSet
|
12546
12561
|
});
|
@@ -12641,6 +12656,18 @@ Blockly.Msg.CONTROLS_IF_ELSE_TITLE_ELSE = Blockly.Msg.CONTROLS_IF_MSG_ELSE;
|
|
12641
12656
|
return xmlDom.insertBefore(e, blocklyDom);
|
12642
12657
|
});
|
12643
12658
|
return Blockly.Xml.domToPrettyText(xmlDom);
|
12659
|
+
},
|
12660
|
+
ignoreEnterKey: function(el) {
|
12661
|
+
return el.find('input[type=text]').keypress(function(e) {
|
12662
|
+
if (!e) {
|
12663
|
+
e = window.event;
|
12664
|
+
}
|
12665
|
+
if (e.keyCode === 13) {
|
12666
|
+
return false;
|
12667
|
+
} else {
|
12668
|
+
return true;
|
12669
|
+
}
|
12670
|
+
});
|
12644
12671
|
}
|
12645
12672
|
};
|
12646
12673
|
|
@@ -13347,7 +13374,10 @@ Blockly.Msg.CONTROLS_IF_ELSE_TITLE_ELSE = Blockly.Msg.CONTROLS_IF_MSG_ELSE;
|
|
13347
13374
|
'click #load-button': 'onLoad',
|
13348
13375
|
'click #save-button': 'onSave',
|
13349
13376
|
'click #check-button': 'onCheck',
|
13350
|
-
'click #reset-button': 'onReset'
|
13377
|
+
'click #reset-button': 'onReset',
|
13378
|
+
'click #signin-button': 'onSignin',
|
13379
|
+
'click #signout-button': 'onSignout',
|
13380
|
+
'click #username-button': 'onUsername'
|
13351
13381
|
},
|
13352
13382
|
initialize: function() {
|
13353
13383
|
var _this = this;
|
@@ -13430,6 +13460,7 @@ Blockly.Msg.CONTROLS_IF_ELSE_TITLE_ELSE = Blockly.Msg.CONTROLS_IF_MSG_ELSE;
|
|
13430
13460
|
xmlSourceCode = new Smalruby.SourceCode({
|
13431
13461
|
filename: filename
|
13432
13462
|
});
|
13463
|
+
clearMessages();
|
13433
13464
|
this.blockUI({
|
13434
13465
|
title: "<i class=\"icon-play\"></i>\nプログラムの実行中",
|
13435
13466
|
message: 'プログラムの画面に切り替えてください。',
|
@@ -13494,6 +13525,7 @@ Blockly.Msg.CONTROLS_IF_ELSE_TITLE_ELSE = Blockly.Msg.CONTROLS_IF_MSG_ELSE;
|
|
13494
13525
|
var sourceCode;
|
13495
13526
|
e.preventDefault();
|
13496
13527
|
sourceCode = this.getSourceCode();
|
13528
|
+
clearMessages();
|
13497
13529
|
this.blockUI({
|
13498
13530
|
title: "プログラムのダウンロード中",
|
13499
13531
|
message: 'プログラムをダウンロードしています。',
|
@@ -13546,6 +13578,7 @@ Blockly.Msg.CONTROLS_IF_ELSE_TITLE_ELSE = Blockly.Msg.CONTROLS_IF_MSG_ELSE;
|
|
13546
13578
|
} else {
|
13547
13579
|
sourceCode = this.getSourceCode();
|
13548
13580
|
}
|
13581
|
+
clearMessages();
|
13549
13582
|
this.blockUI({
|
13550
13583
|
title: "プログラムのセーブ中",
|
13551
13584
|
message: 'プログラムをセーブしています。',
|
@@ -13569,6 +13602,7 @@ Blockly.Msg.CONTROLS_IF_ELSE_TITLE_ELSE = Blockly.Msg.CONTROLS_IF_MSG_ELSE;
|
|
13569
13602
|
onCheck: function(e) {
|
13570
13603
|
var sourceCode;
|
13571
13604
|
e.preventDefault();
|
13605
|
+
clearMessages();
|
13572
13606
|
sourceCode = this.getSourceCode();
|
13573
13607
|
this.blockUI({
|
13574
13608
|
title: "プログラムのチェック中",
|
@@ -13602,6 +13636,28 @@ Blockly.Msg.CONTROLS_IF_ELSE_TITLE_ELSE = Blockly.Msg.CONTROLS_IF_MSG_ELSE;
|
|
13602
13636
|
e.preventDefault();
|
13603
13637
|
return location.reload();
|
13604
13638
|
},
|
13639
|
+
onSignin: function(e) {
|
13640
|
+
e.preventDefault();
|
13641
|
+
return Smalruby.Views.SigninModalView.render();
|
13642
|
+
},
|
13643
|
+
onSignout: function(e) {
|
13644
|
+
e.preventDefault();
|
13645
|
+
return $.ajax({
|
13646
|
+
url: '/signout',
|
13647
|
+
type: 'DELETE'
|
13648
|
+
}).then(function(data) {
|
13649
|
+
$('#signin-button').show();
|
13650
|
+
$('#signout-button').hide();
|
13651
|
+
$('#username-label').text('');
|
13652
|
+
$('#username-button').hide();
|
13653
|
+
return successMessage('ログアウトしました');
|
13654
|
+
}, function() {
|
13655
|
+
return errorMessage('ログアウトに失敗しました');
|
13656
|
+
});
|
13657
|
+
},
|
13658
|
+
onUsername: function(e) {
|
13659
|
+
return e.preventDefault();
|
13660
|
+
},
|
13605
13661
|
getFilename: function() {
|
13606
13662
|
return $.trim($('#filename').val());
|
13607
13663
|
},
|
@@ -13657,6 +13713,7 @@ Blockly.Msg.CONTROLS_IF_ELSE_TITLE_ELSE = Blockly.Msg.CONTROLS_IF_MSG_ELSE;
|
|
13657
13713
|
if (info.error) {
|
13658
13714
|
return window.errorMessage(info.filename + 'は' + info.error);
|
13659
13715
|
} else {
|
13716
|
+
clearMessages();
|
13660
13717
|
filename = info.filename;
|
13661
13718
|
if (filename.match(/\.xml$/)) {
|
13662
13719
|
if (!window.blockMode) {
|
@@ -13686,6 +13743,45 @@ Blockly.Msg.CONTROLS_IF_ELSE_TITLE_ELSE = Blockly.Msg.CONTROLS_IF_MSG_ELSE;
|
|
13686
13743
|
}
|
13687
13744
|
});
|
13688
13745
|
|
13746
|
+
}).call(this);
|
13747
|
+
(function() {
|
13748
|
+
Smalruby.SigninModalView = Backbone.View.extend({
|
13749
|
+
events: {
|
13750
|
+
'click #signin-modal-ok-button': 'onOk'
|
13751
|
+
},
|
13752
|
+
initialize: function() {
|
13753
|
+
var _this = this;
|
13754
|
+
Smalruby.ignoreEnterKey(this.$el);
|
13755
|
+
return this.$el.on('shown', function() {
|
13756
|
+
return _this.$el.find('#signin-modal-username').focus();
|
13757
|
+
});
|
13758
|
+
},
|
13759
|
+
render: function() {
|
13760
|
+
this.$el.find('#signin-modal-username').val($('#username-label').text());
|
13761
|
+
return this.$el.modal('show');
|
13762
|
+
},
|
13763
|
+
onOk: function(e) {
|
13764
|
+
var username,
|
13765
|
+
_this = this;
|
13766
|
+
username = this.$el.find('input[name=username]').val();
|
13767
|
+
return $.post('/sessions/', {
|
13768
|
+
username: username
|
13769
|
+
}).then(function(data) {
|
13770
|
+
$('#signin-button').hide();
|
13771
|
+
$('#signout-button').show();
|
13772
|
+
$('#username-label').text(data);
|
13773
|
+
$('#username-button').show();
|
13774
|
+
successMessage('ログインしました');
|
13775
|
+
return new $.Deferred().resolve().promise();
|
13776
|
+
}, function() {
|
13777
|
+
errorMessage('ログインに失敗しました');
|
13778
|
+
return new $.Deferred().resolve().promise();
|
13779
|
+
}).done(function() {
|
13780
|
+
return _this.$el.modal('hide');
|
13781
|
+
});
|
13782
|
+
}
|
13783
|
+
});
|
13784
|
+
|
13689
13785
|
}).call(this);
|
13690
13786
|
(function() {
|
13691
13787
|
Blockly.Ruby = new Blockly.Generator('Ruby');
|
@@ -15501,9 +15597,7 @@ case end next return until\
|
|
15501
15597
|
Blockly.Ruby['motion_set_rotation_style'] = function(block) {
|
15502
15598
|
var style;
|
15503
15599
|
style = this.getFieldValue('STYLE');
|
15504
|
-
return "" +
|
15505
|
-
dropSelf: false
|
15506
|
-
})) + "rotation_style = :" + style + "\n";
|
15600
|
+
return Blockly.Ruby.characterSetVariable_('rotation_style', ":" + style);
|
15507
15601
|
};
|
15508
15602
|
|
15509
15603
|
Blockly.Blocks['motion_self_x'] = {
|
Binary file
|
@@ -1 +1 @@
|
|
1
|
-
{"files":{"default-5d1886100d7c8961e9962bbc4bb0c714.xml":{"logical_path":"default.xml","mtime":"2014-02-14T01:28:48+09:00","size":5017,"digest":"5d1886100d7c8961e9962bbc4bb0c714"},"rgb_led_anode-91225bef2a8b97f1cefee862a0619b91.xml":{"logical_path":"rgb_led_anode.xml","mtime":"2014-02-11T14:17:03+09:00","size":3805,"digest":"91225bef2a8b97f1cefee862a0619b91"},"favicon-a37c90b368fd8ed436cb8f9e9396465c.ico":{"logical_path":"favicon.ico","mtime":"2014-01-21T03:18:02+09:00","size":5430,"digest":"a37c90b368fd8ed436cb8f9e9396465c"},"application-735e172a0df828da16d22f5d3c26671f.js":{"logical_path":"application.js","mtime":"2014-02-19T18:22:09+09:00","size":1440213,"digest":"735e172a0df828da16d22f5d3c26671f"},"application-64a390efe879c386a5950515064f062d.css":{"logical_path":"application.css","mtime":"2014-02-19T14:32:55+09:00","size":119186,"digest":"64a390efe879c386a5950515064f062d"},"jquery-ui/animated-overlay-c48c87b7a95316f4698484e3b85ee4aa.gif":{"logical_path":"jquery-ui/animated-overlay.gif","mtime":"2014-02-04T09:35:48+09:00","size":1738,"digest":"c48c87b7a95316f4698484e3b85ee4aa"},"jquery-ui/ui-bg_flat_0_aaaaaa_40x100-58b63faadd031ca3db096dfdffd90224.png":{"logical_path":"jquery-ui/ui-bg_flat_0_aaaaaa_40x100.png","mtime":"2014-02-04T09:35:48+09:00","size":180,"digest":"58b63faadd031ca3db096dfdffd90224"},"jquery-ui/ui-bg_flat_75_ffffff_40x100-937399e8b369d64aa075d13a82c00112.png":{"logical_path":"jquery-ui/ui-bg_flat_75_ffffff_40x100.png","mtime":"2014-02-04T09:35:48+09:00","size":178,"digest":"937399e8b369d64aa075d13a82c00112"},"jquery-ui/ui-bg_glass_55_fbf9ee_1x400-a8c503e0f42a081a92a473b0d30ac6cf.png":{"logical_path":"jquery-ui/ui-bg_glass_55_fbf9ee_1x400.png","mtime":"2014-02-04T09:35:48+09:00","size":120,"digest":"a8c503e0f42a081a92a473b0d30ac6cf"},"jquery-ui/ui-bg_glass_65_ffffff_1x400-ddcbfe385abc3947937caa0b44e2f5d2.png":{"logical_path":"jquery-ui/ui-bg_glass_65_ffffff_1x400.png","mtime":"2014-02-04T09:35:48+09:00","size":105,"digest":"ddcbfe385abc3947937caa0b44e2f5d2"},"jquery-ui/ui-bg_glass_75_dadada_1x400-14dd4a9ad1f21d8c4c7e673ddfb0806f.png":{"logical_path":"jquery-ui/ui-bg_glass_75_dadada_1x400.png","mtime":"2014-02-04T09:35:48+09:00","size":111,"digest":"14dd4a9ad1f21d8c4c7e673ddfb0806f"},"jquery-ui/ui-bg_glass_75_e6e6e6_1x400-a43dfabb23b0a987b567b282bad68346.png":{"logical_path":"jquery-ui/ui-bg_glass_75_e6e6e6_1x400.png","mtime":"2014-02-04T09:35:48+09:00","size":110,"digest":"a43dfabb23b0a987b567b282bad68346"},"jquery-ui/ui-bg_glass_95_fef1ec_1x400-31c0c791a756266043ee8ea61dacb36a.png":{"logical_path":"jquery-ui/ui-bg_glass_95_fef1ec_1x400.png","mtime":"2014-02-04T09:35:48+09:00","size":119,"digest":"31c0c791a756266043ee8ea61dacb36a"},"jquery-ui/ui-bg_highlight-soft_75_cccccc_1x100-33edbdb0d2fcebd2a65c2041a28533da.png":{"logical_path":"jquery-ui/ui-bg_highlight-soft_75_cccccc_1x100.png","mtime":"2014-02-04T09:35:48+09:00","size":101,"digest":"33edbdb0d2fcebd2a65c2041a28533da"},"jquery-ui/ui-icons_222222_256x240-890385424135de1513f00cbecfb7f990.png":{"logical_path":"jquery-ui/ui-icons_222222_256x240.png","mtime":"2014-02-04T09:35:48+09:00","size":4369,"digest":"890385424135de1513f00cbecfb7f990"},"jquery-ui/ui-icons_2e83ff_256x240-824705ca4aa2610434a358fe4018c9c6.png":{"logical_path":"jquery-ui/ui-icons_2e83ff_256x240.png","mtime":"2014-02-04T09:35:48+09:00","size":4369,"digest":"824705ca4aa2610434a358fe4018c9c6"},"jquery-ui/ui-icons_454545_256x240-254e054f6df453dfac49efbc8b78f79d.png":{"logical_path":"jquery-ui/ui-icons_454545_256x240.png","mtime":"2014-02-04T09:35:48+09:00","size":4369,"digest":"254e054f6df453dfac49efbc8b78f79d"},"jquery-ui/ui-icons_888888_256x240-57c441f87c4289a5372823f506c1182d.png":{"logical_path":"jquery-ui/ui-icons_888888_256x240.png","mtime":"2014-02-04T09:35:48+09:00","size":4369,"digest":"57c441f87c4289a5372823f506c1182d"},"jquery-ui/ui-icons_cd0a0a_256x240-261647ac915575f3981ded254ae8d43e.png":{"logical_path":"jquery-ui/ui-icons_cd0a0a_256x240.png","mtime":"2014-02-04T09:35:48+09:00","size":4369,"digest":"261647ac915575f3981ded254ae8d43e"},"loading-e8e6dd7833131c92a6c3b9c8ccc6a6ac.gif":{"logical_path":"loading.gif","mtime":"2014-01-03T14:44:55+09:00","size":3897,"digest":"e8e6dd7833131c92a6c3b9c8ccc6a6ac"},"progressbar-82023a146fba2a0f6d925629ed2b09c5.gif":{"logical_path":"progressbar.gif","mtime":"2014-01-03T14:44:55+09:00","size":3323,"digest":"82023a146fba2a0f6d925629ed2b09c5"},"application-0047adbc0fb7a529ef7a41b5e0e7d097.js":{"logical_path":"application.js","mtime":"2014-02-20T03:12:12+09:00","size":1441568,"digest":"0047adbc0fb7a529ef7a41b5e0e7d097"},"application-42aa660a3233c7738b7578d30ba040b3.js":{"logical_path":"application.js","mtime":"2014-02-22T15:25:11+09:00","size":1441708,"digest":"42aa660a3233c7738b7578d30ba040b3"},"application-66b65154e7b5dcfe67fa164db6fc5f51.js":{"logical_path":"application.js","mtime":"2014-02-23T21:53:43+09:00","size":1441898,"digest":"66b65154e7b5dcfe67fa164db6fc5f51"},"application-8bfffad1222d4e198f3c7ccc1cbd774f.js":{"logical_path":"application.js","mtime":"2014-02-27T01:28:32+09:00","size":1442504,"digest":"8bfffad1222d4e198f3c7ccc1cbd774f"},"application-4f747690ebc8ec4815ae36021fdb2c44.js":{"logical_path":"application.js","mtime":"2014-03-07T12:36:30+09:00","size":1447094,"digest":"4f747690ebc8ec4815ae36021fdb2c44"},"application-28b7bed56c5389dfa372e972c75b6676.css":{"logical_path":"application.css","mtime":"2014-03-07T10:27:39+09:00","size":119378,"digest":"28b7bed56c5389dfa372e972c75b6676"},"application-3ee566927dc437f1406e5e903da1baf5.js":{"logical_path":"application.js","mtime":"2014-04-30T00:15:32+09:00","size":1452218,"digest":"3ee566927dc437f1406e5e903da1baf5"},"application-5f1777e683ca5d3cf4e0f0374eab6fac.css":{"logical_path":"application.css","mtime":"2014-03-29T10:25:16+09:00","size":120345,"digest":"5f1777e683ca5d3cf4e0f0374eab6fac"},"application-53d651da3309caa498cc0ca6616dbead.css":{"logical_path":"application.css","mtime":"2014-
|
1
|
+
{"files":{"default-5d1886100d7c8961e9962bbc4bb0c714.xml":{"logical_path":"default.xml","mtime":"2014-02-14T01:28:48+09:00","size":5017,"digest":"5d1886100d7c8961e9962bbc4bb0c714"},"rgb_led_anode-91225bef2a8b97f1cefee862a0619b91.xml":{"logical_path":"rgb_led_anode.xml","mtime":"2014-02-11T14:17:03+09:00","size":3805,"digest":"91225bef2a8b97f1cefee862a0619b91"},"favicon-a37c90b368fd8ed436cb8f9e9396465c.ico":{"logical_path":"favicon.ico","mtime":"2014-01-21T03:18:02+09:00","size":5430,"digest":"a37c90b368fd8ed436cb8f9e9396465c"},"application-735e172a0df828da16d22f5d3c26671f.js":{"logical_path":"application.js","mtime":"2014-02-19T18:22:09+09:00","size":1440213,"digest":"735e172a0df828da16d22f5d3c26671f"},"application-64a390efe879c386a5950515064f062d.css":{"logical_path":"application.css","mtime":"2014-02-19T14:32:55+09:00","size":119186,"digest":"64a390efe879c386a5950515064f062d"},"jquery-ui/animated-overlay-c48c87b7a95316f4698484e3b85ee4aa.gif":{"logical_path":"jquery-ui/animated-overlay.gif","mtime":"2014-02-04T09:35:48+09:00","size":1738,"digest":"c48c87b7a95316f4698484e3b85ee4aa"},"jquery-ui/ui-bg_flat_0_aaaaaa_40x100-58b63faadd031ca3db096dfdffd90224.png":{"logical_path":"jquery-ui/ui-bg_flat_0_aaaaaa_40x100.png","mtime":"2014-02-04T09:35:48+09:00","size":180,"digest":"58b63faadd031ca3db096dfdffd90224"},"jquery-ui/ui-bg_flat_75_ffffff_40x100-937399e8b369d64aa075d13a82c00112.png":{"logical_path":"jquery-ui/ui-bg_flat_75_ffffff_40x100.png","mtime":"2014-02-04T09:35:48+09:00","size":178,"digest":"937399e8b369d64aa075d13a82c00112"},"jquery-ui/ui-bg_glass_55_fbf9ee_1x400-a8c503e0f42a081a92a473b0d30ac6cf.png":{"logical_path":"jquery-ui/ui-bg_glass_55_fbf9ee_1x400.png","mtime":"2014-02-04T09:35:48+09:00","size":120,"digest":"a8c503e0f42a081a92a473b0d30ac6cf"},"jquery-ui/ui-bg_glass_65_ffffff_1x400-ddcbfe385abc3947937caa0b44e2f5d2.png":{"logical_path":"jquery-ui/ui-bg_glass_65_ffffff_1x400.png","mtime":"2014-02-04T09:35:48+09:00","size":105,"digest":"ddcbfe385abc3947937caa0b44e2f5d2"},"jquery-ui/ui-bg_glass_75_dadada_1x400-14dd4a9ad1f21d8c4c7e673ddfb0806f.png":{"logical_path":"jquery-ui/ui-bg_glass_75_dadada_1x400.png","mtime":"2014-02-04T09:35:48+09:00","size":111,"digest":"14dd4a9ad1f21d8c4c7e673ddfb0806f"},"jquery-ui/ui-bg_glass_75_e6e6e6_1x400-a43dfabb23b0a987b567b282bad68346.png":{"logical_path":"jquery-ui/ui-bg_glass_75_e6e6e6_1x400.png","mtime":"2014-02-04T09:35:48+09:00","size":110,"digest":"a43dfabb23b0a987b567b282bad68346"},"jquery-ui/ui-bg_glass_95_fef1ec_1x400-31c0c791a756266043ee8ea61dacb36a.png":{"logical_path":"jquery-ui/ui-bg_glass_95_fef1ec_1x400.png","mtime":"2014-02-04T09:35:48+09:00","size":119,"digest":"31c0c791a756266043ee8ea61dacb36a"},"jquery-ui/ui-bg_highlight-soft_75_cccccc_1x100-33edbdb0d2fcebd2a65c2041a28533da.png":{"logical_path":"jquery-ui/ui-bg_highlight-soft_75_cccccc_1x100.png","mtime":"2014-02-04T09:35:48+09:00","size":101,"digest":"33edbdb0d2fcebd2a65c2041a28533da"},"jquery-ui/ui-icons_222222_256x240-890385424135de1513f00cbecfb7f990.png":{"logical_path":"jquery-ui/ui-icons_222222_256x240.png","mtime":"2014-02-04T09:35:48+09:00","size":4369,"digest":"890385424135de1513f00cbecfb7f990"},"jquery-ui/ui-icons_2e83ff_256x240-824705ca4aa2610434a358fe4018c9c6.png":{"logical_path":"jquery-ui/ui-icons_2e83ff_256x240.png","mtime":"2014-02-04T09:35:48+09:00","size":4369,"digest":"824705ca4aa2610434a358fe4018c9c6"},"jquery-ui/ui-icons_454545_256x240-254e054f6df453dfac49efbc8b78f79d.png":{"logical_path":"jquery-ui/ui-icons_454545_256x240.png","mtime":"2014-02-04T09:35:48+09:00","size":4369,"digest":"254e054f6df453dfac49efbc8b78f79d"},"jquery-ui/ui-icons_888888_256x240-57c441f87c4289a5372823f506c1182d.png":{"logical_path":"jquery-ui/ui-icons_888888_256x240.png","mtime":"2014-02-04T09:35:48+09:00","size":4369,"digest":"57c441f87c4289a5372823f506c1182d"},"jquery-ui/ui-icons_cd0a0a_256x240-261647ac915575f3981ded254ae8d43e.png":{"logical_path":"jquery-ui/ui-icons_cd0a0a_256x240.png","mtime":"2014-02-04T09:35:48+09:00","size":4369,"digest":"261647ac915575f3981ded254ae8d43e"},"loading-e8e6dd7833131c92a6c3b9c8ccc6a6ac.gif":{"logical_path":"loading.gif","mtime":"2014-01-03T14:44:55+09:00","size":3897,"digest":"e8e6dd7833131c92a6c3b9c8ccc6a6ac"},"progressbar-82023a146fba2a0f6d925629ed2b09c5.gif":{"logical_path":"progressbar.gif","mtime":"2014-01-03T14:44:55+09:00","size":3323,"digest":"82023a146fba2a0f6d925629ed2b09c5"},"application-0047adbc0fb7a529ef7a41b5e0e7d097.js":{"logical_path":"application.js","mtime":"2014-02-20T03:12:12+09:00","size":1441568,"digest":"0047adbc0fb7a529ef7a41b5e0e7d097"},"application-42aa660a3233c7738b7578d30ba040b3.js":{"logical_path":"application.js","mtime":"2014-02-22T15:25:11+09:00","size":1441708,"digest":"42aa660a3233c7738b7578d30ba040b3"},"application-66b65154e7b5dcfe67fa164db6fc5f51.js":{"logical_path":"application.js","mtime":"2014-02-23T21:53:43+09:00","size":1441898,"digest":"66b65154e7b5dcfe67fa164db6fc5f51"},"application-8bfffad1222d4e198f3c7ccc1cbd774f.js":{"logical_path":"application.js","mtime":"2014-02-27T01:28:32+09:00","size":1442504,"digest":"8bfffad1222d4e198f3c7ccc1cbd774f"},"application-4f747690ebc8ec4815ae36021fdb2c44.js":{"logical_path":"application.js","mtime":"2014-03-07T12:36:30+09:00","size":1447094,"digest":"4f747690ebc8ec4815ae36021fdb2c44"},"application-28b7bed56c5389dfa372e972c75b6676.css":{"logical_path":"application.css","mtime":"2014-03-07T10:27:39+09:00","size":119378,"digest":"28b7bed56c5389dfa372e972c75b6676"},"application-3ee566927dc437f1406e5e903da1baf5.js":{"logical_path":"application.js","mtime":"2014-04-30T00:15:32+09:00","size":1452218,"digest":"3ee566927dc437f1406e5e903da1baf5"},"application-5f1777e683ca5d3cf4e0f0374eab6fac.css":{"logical_path":"application.css","mtime":"2014-03-29T10:25:16+09:00","size":120345,"digest":"5f1777e683ca5d3cf4e0f0374eab6fac"},"application-53d651da3309caa498cc0ca6616dbead.css":{"logical_path":"application.css","mtime":"2014-05-06T14:59:20+09:00","size":118430,"digest":"53d651da3309caa498cc0ca6616dbead"},"application-0b3c70107ad81ea9fcda6d7d921bd8cf.js":{"logical_path":"application.js","mtime":"2014-04-30T02:04:36+09:00","size":1452582,"digest":"0b3c70107ad81ea9fcda6d7d921bd8cf"},"application-c2d6a82134037eb9a7f6c7d13d2657db.js":{"logical_path":"application.js","mtime":"2014-05-06T21:22:51+09:00","size":1455113,"digest":"c2d6a82134037eb9a7f6c7d13d2657db"},"application-669cbc2df60729c4b12d739af7595cc6.js":{"logical_path":"application.js","mtime":"2014-05-08T04:10:12+09:00","size":1455352,"digest":"669cbc2df60729c4b12d739af7595cc6"}},"assets":{"default.xml":"default-5d1886100d7c8961e9962bbc4bb0c714.xml","rgb_led_anode.xml":"rgb_led_anode-91225bef2a8b97f1cefee862a0619b91.xml","favicon.ico":"favicon-a37c90b368fd8ed436cb8f9e9396465c.ico","application.js":"application-669cbc2df60729c4b12d739af7595cc6.js","application.css":"application-53d651da3309caa498cc0ca6616dbead.css","jquery-ui/animated-overlay.gif":"jquery-ui/animated-overlay-c48c87b7a95316f4698484e3b85ee4aa.gif","jquery-ui/ui-bg_flat_0_aaaaaa_40x100.png":"jquery-ui/ui-bg_flat_0_aaaaaa_40x100-58b63faadd031ca3db096dfdffd90224.png","jquery-ui/ui-bg_flat_75_ffffff_40x100.png":"jquery-ui/ui-bg_flat_75_ffffff_40x100-937399e8b369d64aa075d13a82c00112.png","jquery-ui/ui-bg_glass_55_fbf9ee_1x400.png":"jquery-ui/ui-bg_glass_55_fbf9ee_1x400-a8c503e0f42a081a92a473b0d30ac6cf.png","jquery-ui/ui-bg_glass_65_ffffff_1x400.png":"jquery-ui/ui-bg_glass_65_ffffff_1x400-ddcbfe385abc3947937caa0b44e2f5d2.png","jquery-ui/ui-bg_glass_75_dadada_1x400.png":"jquery-ui/ui-bg_glass_75_dadada_1x400-14dd4a9ad1f21d8c4c7e673ddfb0806f.png","jquery-ui/ui-bg_glass_75_e6e6e6_1x400.png":"jquery-ui/ui-bg_glass_75_e6e6e6_1x400-a43dfabb23b0a987b567b282bad68346.png","jquery-ui/ui-bg_glass_95_fef1ec_1x400.png":"jquery-ui/ui-bg_glass_95_fef1ec_1x400-31c0c791a756266043ee8ea61dacb36a.png","jquery-ui/ui-bg_highlight-soft_75_cccccc_1x100.png":"jquery-ui/ui-bg_highlight-soft_75_cccccc_1x100-33edbdb0d2fcebd2a65c2041a28533da.png","jquery-ui/ui-icons_222222_256x240.png":"jquery-ui/ui-icons_222222_256x240-890385424135de1513f00cbecfb7f990.png","jquery-ui/ui-icons_2e83ff_256x240.png":"jquery-ui/ui-icons_2e83ff_256x240-824705ca4aa2610434a358fe4018c9c6.png","jquery-ui/ui-icons_454545_256x240.png":"jquery-ui/ui-icons_454545_256x240-254e054f6df453dfac49efbc8b78f79d.png","jquery-ui/ui-icons_888888_256x240.png":"jquery-ui/ui-icons_888888_256x240-57c441f87c4289a5372823f506c1182d.png","jquery-ui/ui-icons_cd0a0a_256x240.png":"jquery-ui/ui-icons_cd0a0a_256x240-261647ac915575f3981ded254ae8d43e.png","loading.gif":"loading-e8e6dd7833131c92a6c3b9c8ccc6a6ac.gif","progressbar.gif":"progressbar-82023a146fba2a0f6d925629ed2b09c5.gif"}}
|
data/smalruby-editor.gemspec
CHANGED
@@ -68,7 +68,7 @@ Gem::Specification.new do |spec|
|
|
68
68
|
['launchy'],
|
69
69
|
['mime-types', '~> 1.16'],
|
70
70
|
['haml-rails'],
|
71
|
-
['smalruby', '~> 0.0.
|
71
|
+
['smalruby', '~> 0.0.19'],
|
72
72
|
]
|
73
73
|
runtime_dependencies << ['therubyracer'] unless is_windows
|
74
74
|
runtime_dependencies.each do |args|
|
@@ -0,0 +1,95 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
# language: ja
|
3
|
+
@javascript
|
4
|
+
@standalone
|
5
|
+
機能: SignIn - ログイン(standaloneモード)
|
6
|
+
背景:
|
7
|
+
前提 セッションをクリアする
|
8
|
+
|
9
|
+
シナリオ: ログイン後、ログアウトする
|
10
|
+
もし "トップページ" にアクセスする
|
11
|
+
|
12
|
+
ならば "メニュー" に "ログイン" を含むこと
|
13
|
+
|
14
|
+
もし "サブメニューボタン" をクリックする
|
15
|
+
|
16
|
+
ならば "サブメニュー" に "ログアウト" を含まないこと
|
17
|
+
|
18
|
+
もし "ログインボタン" をクリックする
|
19
|
+
|
20
|
+
ならば "ログインダイアログ" が表示されていること
|
21
|
+
|
22
|
+
もし "ログインダイアログの名前" に "1102" を指定する
|
23
|
+
かつ "ログインダイアログのログインボタン" をクリックする
|
24
|
+
かつ JavaScriptによるリクエストが終わるまで待つ
|
25
|
+
|
26
|
+
ならば "メッセージ" に "ログインしました" を含むこと
|
27
|
+
かつ "メニュー" に "1102" を含むこと
|
28
|
+
|
29
|
+
もし "サブメニューボタン" をクリックする
|
30
|
+
|
31
|
+
ならば "サブメニュー" に "ログアウト" を含むこと
|
32
|
+
|
33
|
+
もし サブメニューの "ログアウトボタン" をクリックする
|
34
|
+
かつ JavaScriptによるリクエストが終わるまで待つ
|
35
|
+
|
36
|
+
ならば "メッセージ" に "ログアウトしました" を含むこと
|
37
|
+
かつ "メニュー" に "ログイン" を含むこと
|
38
|
+
かつ "メニュー" に "1102" を含まないこと
|
39
|
+
|
40
|
+
もし "サブメニューボタン" をクリックする
|
41
|
+
|
42
|
+
ならば "サブメニュー" に "ログアウト" を含まないこと
|
43
|
+
|
44
|
+
シナリオ: 名前を指定せずにログインボタンを押す
|
45
|
+
前提 "トップページ" にアクセスする
|
46
|
+
かつ "ログインボタン" をクリックする
|
47
|
+
|
48
|
+
もし "ログインダイアログの名前" に "" を指定する
|
49
|
+
かつ "ログインダイアログのログインボタン" をクリックする
|
50
|
+
かつ JavaScriptによるリクエストが終わるまで待つ
|
51
|
+
|
52
|
+
ならば "メッセージ" に "ログインに失敗しました" を含むこと
|
53
|
+
かつ "メニュー" に "ログイン" を含むこと
|
54
|
+
|
55
|
+
シナリオ: ログインをやめる
|
56
|
+
前提 "トップページ" にアクセスする
|
57
|
+
かつ "ログインボタン" をクリックする
|
58
|
+
かつ "ログインダイアログの名前" に "1102" を指定する
|
59
|
+
|
60
|
+
もし "ログインダイアログのやめるボタン" をクリックする
|
61
|
+
|
62
|
+
ならば "メッセージ" に "ログインしました" を含まないこと
|
63
|
+
かつ "メニュー" に "ログイン" を含むこと
|
64
|
+
|
65
|
+
シナリオ: ログイン後にプログラムを実行する
|
66
|
+
前提 "トップページ" にアクセスする
|
67
|
+
かつ "ログインボタン" をクリックする
|
68
|
+
かつ "ログインダイアログの名前" に "1102" を指定する
|
69
|
+
かつ "ログインダイアログのログインボタン" をクリックする
|
70
|
+
かつ JavaScriptによるリクエストが終わるまで待つ
|
71
|
+
かつ "Ruby" タブを表示する
|
72
|
+
かつ プログラムの名前に "01.rb" を指定する
|
73
|
+
かつ テキストエディタに "puts 'Hello, World!'" を入力済みである
|
74
|
+
|
75
|
+
もし "実行ボタン" をクリックする
|
76
|
+
かつ JavaScriptによるリクエストが終わるまで待つ
|
77
|
+
|
78
|
+
ならば "~/1102" ディレクトリに "01.rb" が存在すること
|
79
|
+
かつ "~/1102" ディレクトリの "01.rb" の内容が "puts 'Hello, World!'" であること
|
80
|
+
|
81
|
+
シナリオ: ログイン後、リセットする
|
82
|
+
前提 "トップページ" にアクセスする
|
83
|
+
かつ "ログインボタン" をクリックする
|
84
|
+
かつ "ログインダイアログの名前" に "1102" を指定する
|
85
|
+
かつ "ログインダイアログのログインボタン" をクリックする
|
86
|
+
かつ JavaScriptによるリクエストが終わるまで待つ
|
87
|
+
|
88
|
+
もし サブメニューの "リセットボタン" をクリックする
|
89
|
+
|
90
|
+
ならば "メニュー" に "ログイン" を含まないこと
|
91
|
+
かつ "メニュー" に "1102" を含むこと
|
92
|
+
|
93
|
+
もし "サブメニューボタン" をクリックする
|
94
|
+
|
95
|
+
ならば "サブメニュー" に "ログアウト" を含むこと
|
@@ -0,0 +1,74 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
require 'spec_helper'
|
3
|
+
|
4
|
+
describe SessionsController do
|
5
|
+
describe 'ログインする (XHR POST create)' do
|
6
|
+
let(:params) {
|
7
|
+
{
|
8
|
+
username: '1102',
|
9
|
+
}
|
10
|
+
}
|
11
|
+
|
12
|
+
context 'RAILS_ENVがstandaloneの場合', set_standalone_rails_env: true do
|
13
|
+
before do
|
14
|
+
xhr :post, :create, params, {}
|
15
|
+
end
|
16
|
+
|
17
|
+
describe 'レスポンスボディ' do
|
18
|
+
subject { response.body }
|
19
|
+
|
20
|
+
it { should eq('1102') }
|
21
|
+
end
|
22
|
+
|
23
|
+
describe 'session' do
|
24
|
+
subject { session }
|
25
|
+
|
26
|
+
describe '[:username]' do
|
27
|
+
subject { super()[:username] }
|
28
|
+
|
29
|
+
it { should eq(params[:username]) }
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
context 'RAILS_ENVがstandaloneではない場合' do
|
35
|
+
it do
|
36
|
+
expect {
|
37
|
+
xhr :post, :create, params, {}
|
38
|
+
}.to raise_exception
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
describe 'ログアウトする (DELETE destroy)' do
|
44
|
+
let(:_session) {
|
45
|
+
{
|
46
|
+
username: '1102',
|
47
|
+
}
|
48
|
+
}
|
49
|
+
|
50
|
+
context 'RAILS_ENVがstandaloneの場合', set_standalone_rails_env: true do
|
51
|
+
before do
|
52
|
+
xhr :delete, :destroy, {}, _session
|
53
|
+
end
|
54
|
+
|
55
|
+
describe 'session' do
|
56
|
+
subject { session }
|
57
|
+
|
58
|
+
describe '[:username]' do
|
59
|
+
subject { super()[:username] }
|
60
|
+
|
61
|
+
it { should be_nil }
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
context 'RAILS_ENVがstandaloneではない場合' do
|
67
|
+
it do
|
68
|
+
expect {
|
69
|
+
xhr :post, :create, params, {}
|
70
|
+
}.to raise_exception
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
# Specs in this file have access to a helper object that includes
|
4
|
+
# the SessionsHelper. For example:
|
5
|
+
#
|
6
|
+
# describe SessionsHelper do
|
7
|
+
# describe "string concat" do
|
8
|
+
# it "concats two strings with spaces" do
|
9
|
+
# expect(helper.concat_strings("this","that")).to eq("this that")
|
10
|
+
# end
|
11
|
+
# end
|
12
|
+
# end
|
13
|
+
describe SessionsHelper do
|
14
|
+
pending "add some examples to (or delete) #{__FILE__}"
|
15
|
+
end
|
data/spec/steps/base_steps.rb
CHANGED
@@ -1,5 +1,9 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
|
+
step 'セッションをクリアする' do
|
4
|
+
Capybara.reset_sessions!
|
5
|
+
end
|
6
|
+
|
3
7
|
step ':name にアクセスする' do |name|
|
4
8
|
visit NAME_INFO[name][:path]
|
5
9
|
|
@@ -25,6 +29,10 @@ step ':name が表示されていること' do |name|
|
|
25
29
|
expect(page).to have_selector(NAME_INFO[name][:selector])
|
26
30
|
end
|
27
31
|
|
32
|
+
step ':name が表示されていないこと' do |name|
|
33
|
+
expect(page).not_to have_selector(NAME_INFO[name][:selector])
|
34
|
+
end
|
35
|
+
|
28
36
|
step ':name にタブを切り替える' do |name|
|
29
37
|
page.execute_script(<<-JS)
|
30
38
|
$('#tabs a[href=\"#{NAME_INFO[name][:selector]}\"]').click()
|
@@ -36,8 +44,12 @@ step ':name タブを表示する' do |name|
|
|
36
44
|
step %("#{name}タブ" にタブを切り替える)
|
37
45
|
end
|
38
46
|
|
47
|
+
step ':name に :value を指定する' do |name, value|
|
48
|
+
fill_in(NAME_INFO.key?(name) ? NAME_INFO[name][:id] : name, with: value)
|
49
|
+
end
|
50
|
+
|
39
51
|
step 'プログラムの名前に :filename を指定する' do |filename|
|
40
|
-
|
52
|
+
step %("プログラム名の入力欄" に "#{filename}" を指定する)
|
41
53
|
end
|
42
54
|
|
43
55
|
step 'サブメニューの :name をクリックする' do |name|
|
@@ -128,7 +140,7 @@ step ':name に :message を含むこと' do |name, message|
|
|
128
140
|
end
|
129
141
|
|
130
142
|
step ':name に :message を含まないこと' do |name, message|
|
131
|
-
expect(page.find(NAME_INFO[name][:selector])).
|
143
|
+
expect(page.find(NAME_INFO[name][:selector])).not_to have_content(message)
|
132
144
|
end
|
133
145
|
|
134
146
|
step 'ページをリロードする' do
|
@@ -228,3 +240,22 @@ step 'ホームディレクトリの :filename の内容が :program である
|
|
228
240
|
path = Pathname("~/#{filename}").expand_path
|
229
241
|
expect(path.read).to eq(program)
|
230
242
|
end
|
243
|
+
|
244
|
+
step ':directory ディレクトリに :program という内容の :filename が存在する' do
|
245
|
+
|directory, program, filename|
|
246
|
+
File.open(Pathname("#{directory}/#{filename}").expand_path, 'w') do |f|
|
247
|
+
f.write(program)
|
248
|
+
end
|
249
|
+
end
|
250
|
+
|
251
|
+
step ':directory ディレクトリに :filename が存在すること' do
|
252
|
+
|directory, filename|
|
253
|
+
path = Pathname("#{directory}/#{filename}").expand_path
|
254
|
+
expect(path).to be_exist
|
255
|
+
end
|
256
|
+
|
257
|
+
step ':directory ディレクトリの :filename の内容が :program であること' do
|
258
|
+
|directory, filename, program|
|
259
|
+
path = Pathname("#{directory}/#{filename}").expand_path
|
260
|
+
expect(path.read).to eq(program)
|
261
|
+
end
|
@@ -16,48 +16,75 @@
|
|
16
16
|
|
17
17
|
'ブロックタブ' => {
|
18
18
|
id: 'block-tab',
|
19
|
-
selector: '#block-tab',
|
20
19
|
},
|
21
20
|
'Rubyタブ' => {
|
22
21
|
id: 'ruby-tab',
|
23
|
-
selector: '#ruby-tab',
|
24
22
|
},
|
25
23
|
'テキストエディタ' => {
|
26
24
|
id: 'text-editor',
|
27
|
-
selector: '#text-editor',
|
28
25
|
},
|
29
26
|
'プログラム名の入力欄' => {
|
30
27
|
id: 'filename',
|
31
|
-
selector: '#filename',
|
32
28
|
},
|
33
29
|
|
30
|
+
# メニュー/サブメニューのボタン
|
31
|
+
'メニュー' => {
|
32
|
+
selector: '#main-menu',
|
33
|
+
},
|
34
|
+
'サブメニュー' => {
|
35
|
+
selector: '#submenu',
|
36
|
+
},
|
37
|
+
'ログインボタン' => {
|
38
|
+
id: 'signin-button',
|
39
|
+
},
|
34
40
|
'ダウンロードボタン' => {
|
35
41
|
id: 'download-button',
|
36
|
-
selector: '#download-button',
|
37
42
|
},
|
38
43
|
'実行ボタン' => {
|
39
44
|
id: 'run-button',
|
40
|
-
|
45
|
+
},
|
46
|
+
'サブメニューボタン' => {
|
47
|
+
id: 'submenu-button',
|
41
48
|
},
|
42
49
|
'ロードボタン' => {
|
43
50
|
id: 'load-button',
|
44
|
-
selector: '#load-button',
|
45
51
|
},
|
46
52
|
'セーブボタン' => {
|
47
53
|
id: 'save-button',
|
48
|
-
selector: '#save-button',
|
49
54
|
},
|
50
55
|
'チェックボタン' => {
|
51
56
|
id: 'check-button',
|
52
|
-
selector: '#check-button',
|
53
57
|
},
|
54
58
|
'リセットボタン' => {
|
55
59
|
id: 'reset-button',
|
56
|
-
|
60
|
+
},
|
61
|
+
'ログアウトボタン' => {
|
62
|
+
id: 'signout-button',
|
57
63
|
},
|
58
64
|
|
59
65
|
'メッセージ' => {
|
60
66
|
id: 'messages',
|
61
|
-
|
67
|
+
},
|
68
|
+
|
69
|
+
# ダイアログ
|
70
|
+
'ログインダイアログ' => {
|
71
|
+
selector: '#signin-modal',
|
72
|
+
},
|
73
|
+
|
74
|
+
# ログインダイアログ
|
75
|
+
'ログインダイアログの名前' => {
|
76
|
+
id: 'signin-modal-username',
|
77
|
+
},
|
78
|
+
'ログインダイアログのログインボタン' => {
|
79
|
+
id: 'signin-modal-ok-button',
|
80
|
+
},
|
81
|
+
'ログインダイアログのやめるボタン' => {
|
82
|
+
id: 'signin-modal-cancel-button',
|
62
83
|
},
|
63
84
|
}
|
85
|
+
|
86
|
+
::NAME_INFO.values.each do |value|
|
87
|
+
if value.key?(:id) && !value.key?(:selector)
|
88
|
+
value[:selector] = "##{value[:id]}"
|
89
|
+
end
|
90
|
+
end
|
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.1.
|
4
|
+
version: 0.1.11
|
5
5
|
platform: x86-mingw32
|
6
6
|
authors:
|
7
7
|
- Kouji Takao
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-05-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -184,14 +184,14 @@ dependencies:
|
|
184
184
|
requirements:
|
185
185
|
- - ~>
|
186
186
|
- !ruby/object:Gem::Version
|
187
|
-
version: 0.0.
|
187
|
+
version: 0.0.19
|
188
188
|
type: :runtime
|
189
189
|
prerelease: false
|
190
190
|
version_requirements: !ruby/object:Gem::Requirement
|
191
191
|
requirements:
|
192
192
|
- - ~>
|
193
193
|
- !ruby/object:Gem::Version
|
194
|
-
version: 0.0.
|
194
|
+
version: 0.0.19
|
195
195
|
- !ruby/object:Gem::Dependency
|
196
196
|
name: bundler
|
197
197
|
requirement: !ruby/object:Gem::Requirement
|
@@ -275,6 +275,7 @@ files:
|
|
275
275
|
- app/assets/javascripts/views/character_selector_view.js.coffee
|
276
276
|
- app/assets/javascripts/views/load_modal_view.js.coffee
|
277
277
|
- app/assets/javascripts/views/main_menu_view.js.coffee
|
278
|
+
- app/assets/javascripts/views/signin_modal_view.js.coffee
|
278
279
|
- app/assets/stylesheets/application.css
|
279
280
|
- app/assets/stylesheets/editor.css.scss
|
280
281
|
- app/assets/stylesheets/flatstrap-custom.css.scss
|
@@ -284,9 +285,11 @@ files:
|
|
284
285
|
- app/controllers/application_controller.rb
|
285
286
|
- app/controllers/concerns/.keep
|
286
287
|
- app/controllers/editor_controller.rb
|
288
|
+
- app/controllers/sessions_controller.rb
|
287
289
|
- app/controllers/source_codes_controller.rb
|
288
290
|
- app/helpers/application_helper.rb
|
289
291
|
- app/helpers/editor_helper.rb
|
292
|
+
- app/helpers/sessions_helper.rb
|
290
293
|
- app/mailers/.keep
|
291
294
|
- app/models/.keep
|
292
295
|
- app/models/concerns/.keep
|
@@ -355,6 +358,7 @@ files:
|
|
355
358
|
- app/views/editor/_block_tab.html.haml
|
356
359
|
- app/views/editor/_character_modal.html.haml
|
357
360
|
- app/views/editor/_load_modal.html.haml
|
361
|
+
- app/views/editor/_signin_modal.html.haml
|
358
362
|
- app/views/editor/_toolbox.html.haml
|
359
363
|
- app/views/editor/demo.html.erb
|
360
364
|
- app/views/editor/index.html.haml
|
@@ -526,12 +530,15 @@ files:
|
|
526
530
|
- spec/acceptance/ruby_mode/translate.feature
|
527
531
|
- spec/acceptance/standalone/run.feature
|
528
532
|
- spec/acceptance/standalone/save.feature
|
533
|
+
- spec/acceptance/standalone/signin.feature
|
529
534
|
- spec/controllers/editor_controller_spec.rb
|
535
|
+
- spec/controllers/sessions_controller_spec.rb
|
530
536
|
- spec/controllers/source_codes_controller_spec.rb
|
531
537
|
- spec/fixtures/files/01.rb
|
532
538
|
- spec/fixtures/files/01.rb.xml
|
533
539
|
- spec/fixtures/files/favicon.ico
|
534
540
|
- spec/helpers/editor_helper_spec.rb
|
541
|
+
- spec/helpers/sessions_helper_spec.rb
|
535
542
|
- spec/javascripts/collections/character_set_spec.coffee
|
536
543
|
- spec/javascripts/models/character_spec.coffee
|
537
544
|
- spec/javascripts/models/scene_spec.coffee
|
@@ -573,10 +580,10 @@ files:
|
|
573
580
|
- vendor/assets/javascripts/blockly/msg/js/ja.js
|
574
581
|
- vendor/assets/javascripts/jquery.blockUI.js
|
575
582
|
- vendor/assets/stylesheets/.keep
|
576
|
-
- public/assets/application-0b3c70107ad81ea9fcda6d7d921bd8cf.js
|
577
|
-
- public/assets/application-0b3c70107ad81ea9fcda6d7d921bd8cf.js.gz
|
578
583
|
- public/assets/application-53d651da3309caa498cc0ca6616dbead.css
|
579
584
|
- public/assets/application-53d651da3309caa498cc0ca6616dbead.css.gz
|
585
|
+
- public/assets/application-669cbc2df60729c4b12d739af7595cc6.js
|
586
|
+
- public/assets/application-669cbc2df60729c4b12d739af7595cc6.js.gz
|
580
587
|
- public/assets/favicon-a37c90b368fd8ed436cb8f9e9396465c.ico
|
581
588
|
- public/assets/jquery-ui/animated-overlay-c48c87b7a95316f4698484e3b85ee4aa.gif
|
582
589
|
- public/assets/jquery-ui/ui-bg_flat_0_aaaaaa_40x100-58b63faadd031ca3db096dfdffd90224.png
|
@@ -699,12 +706,15 @@ test_files:
|
|
699
706
|
- spec/acceptance/ruby_mode/translate.feature
|
700
707
|
- spec/acceptance/standalone/run.feature
|
701
708
|
- spec/acceptance/standalone/save.feature
|
709
|
+
- spec/acceptance/standalone/signin.feature
|
702
710
|
- spec/controllers/editor_controller_spec.rb
|
711
|
+
- spec/controllers/sessions_controller_spec.rb
|
703
712
|
- spec/controllers/source_codes_controller_spec.rb
|
704
713
|
- spec/fixtures/files/01.rb
|
705
714
|
- spec/fixtures/files/01.rb.xml
|
706
715
|
- spec/fixtures/files/favicon.ico
|
707
716
|
- spec/helpers/editor_helper_spec.rb
|
717
|
+
- spec/helpers/sessions_helper_spec.rb
|
708
718
|
- spec/javascripts/collections/character_set_spec.coffee
|
709
719
|
- spec/javascripts/models/character_spec.coffee
|
710
720
|
- spec/javascripts/models/scene_spec.coffee
|