Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
ardublockly
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
xpstem
ardublockly
Commits
b2a5be40
Commit
b2a5be40
authored
Jan 22, 2016
by
carlosperate
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update front end desktop environment to use modals instead of window.prompt.
parent
544cdb94
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
41 additions
and
1 deletion
+41
-1
ardublockly/ardublockly.css
ardublockly/ardublockly.css
+4
-1
ardublockly/ardublockly_desktop.js
ardublockly/ardublockly_desktop.js
+25
-0
ardublockly/index.html
ardublockly/index.html
+12
-0
No files found.
ardublockly/ardublockly.css
View file @
b2a5be40
...
...
@@ -513,9 +513,12 @@ ul.side-nav li.side-menu-end {
/* Small modal responsive design */
.modal_small
{
height
:
30%
!important
;
height
:
auto
!important
;
min-height
:
200px
;
}
.modal_small
input
{
width
:
100%
;
}
@media
only
screen
and
(
min-width
:
0
)
{
.modal_small
{
max-width
:
75%
!important
;
...
...
ardublockly/ardublockly_desktop.js
View file @
b2a5be40
...
...
@@ -52,6 +52,27 @@ Ardublockly.hideSideMenuButton = function() {
sideMenuButton
.
style
.
display
=
'
none
'
;
};
/**
* Launches a materialize modal as a text prompt
* @param {string} message Main text message for the window prompt.
* @param {string=} defaultValue Input string to be displayed by default.
* @param {function} callback To process the user input.
*/
Ardublockly
.
htmlPrompt
=
function
(
message
,
defaultValue
,
callback
)
{
$
(
'
#gen_prompt_message
'
).
text
(
''
);
$
(
'
#gen_prompt_message
'
).
append
(
message
);
$
(
'
#gen_prompt_input
'
).
val
(
defaultValue
);
// Bind callback events to buttons
$
(
'
#gen_prompt_ok_link
'
).
bind
(
'
click
'
,
function
()
{
callback
(
$
(
'
#gen_prompt_input
'
).
val
());
});
$
(
'
#gen_prompt_cancel_link
'
).
bind
(
'
click
'
,
function
()
{
callback
(
null
);
});
$
(
'
#gen_prompt
'
).
openModal
();
window
.
location
.
hash
=
''
;
};
/** Initialize Ardublockly code required for Electron on page load. */
window
.
addEventListener
(
'
load
'
,
function
load
(
event
)
{
window
.
removeEventListener
(
'
load
'
,
load
,
false
);
...
...
@@ -63,5 +84,9 @@ window.addEventListener('load', function load(event) {
// Prevent browser zoom changes like pinch-to-zoom
var
webFrame
=
require
(
'
web-frame
'
);
webFrame
.
setZoomLevelLimits
(
1
,
1
);
// Electron does not offer a prompt, so replace Blocks version with modal
// Original signature: function(message, opt_defaultInput, opt_callback)
Blockly
.
prompt
=
Ardublockly
.
htmlPrompt
;
}
});
ardublockly/index.html
View file @
b2a5be40
...
...
@@ -253,6 +253,18 @@
</div>
</div>
<!-- Prompt: Content is loaded using JavaScript to display alerts -->
<div
id=
"gen_prompt"
class=
"modal modal_small modal-fixed-footer"
>
<div
class=
"modal-content"
>
<p><span
id=
"gen_prompt_message"
>
Prompt message
</span></p>
<p><input
id=
"gen_prompt_input"
value=
"test"
/></p>
</div>
<div
class=
"modal-footer"
>
<a
id=
"gen_prompt_ok_link"
href=
"#"
class=
"waves-effect btn-flat modal-close"
>
Okay
</a>
<a
id=
"gen_prompt_cancel_link"
href=
"#"
class=
"waves-effect btn-flat modal-close"
>
Cancel
</a>
</div>
</div>
<!-- Local Server Alert to be shown if Ardublockly Server is not running. -->
<div
id=
"not_running_dialog"
class=
"modal"
>
<div
class=
"modal-content"
>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment