Commit 89a6a0f2 authored by carlosperate's avatar carlosperate

Updated code app to use same style and msgs as demos version (no more soy templates).

Restored demo code to original version.
parent 6c3573f9
This diff is collapsed.
// Copyright 2009 Google Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
Contents:
+ SoyToJsSrcCompiler.jar
Executable jar that compiles template files into JavaScript files.
+ SoyMsgExtractor.jar
Executable jar that extracts messages from template files into XLF files.
+ soyutils.js
Helper utilities required by all JavaScript code that SoyToJsSrcCompiler
generates. Equivalent functionality to soyutils_usegoog.js, but this
version does not need Closure Library.
Instructions:
+ A simple Hello World for JavaScript:
http://code.google.com/closure/templates/docs/helloworld_js.html
+ Complete documentation:
http://code.google.com/closure/templates/
+ Closure Templates project on Google Code:
http://code.google.com/p/closure-templates/
Notes:
+ Closure Templates requires Java 6 or higher:
http://www.java.com/
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
html, body {
height: 100%;
}
body {
background-color: #fff;
font-family: sans-serif;
margin: 0;
overflow: hidden;
}
.farSide {
text-align: right;
}
html[dir="RTL"] .farSide {
text-align: left;
}
/* Buttons */
button {
margin: 5px;
padding: 10px;
border-radius: 4px;
border: 1px solid #ddd;
font-size: large;
background-color: #eee;
color: #000;
}
button.primary {
border: 1px solid #dd4b39;
background-color: #dd4b39;
color: #fff;
}
button.primary>img {
opacity: 1;
}
button>img {
opacity: 0.6;
vertical-align: text-bottom;
}
button:hover>img {
opacity: 1;
}
button:active {
border: 1px solid #888 !important;
}
button:hover {
box-shadow: 2px 2px 5px #888;
}
button.disabled:hover>img {
opacity: 0.6;
}
button.disabled {
display: none;
}
button.notext {
font-size: 10%;
}
h1 {
font-weight: normal;
font-size: 140%;
margin-left: 5px;
margin-right: 5px;
}
......
This diff is collapsed.
body {
background-color: #fff;
font-family: sans-serif;
margin-top: 0;
}
h1 {
font-weight: normal;
font-size: 140%;
}
a:hover {
color: #f00;
}
.farSide {
text-align: right;
}
html[dir="RTL"] .farSide {
text-align: left;
}
/* Buttons */
button {
margin: 5px;
padding: 10px;
border-radius: 4px;
border: 1px solid #ddd;
font-size: large;
background-color: #eee;
color: #000;
}
button.primary {
border: 1px solid #dd4b39;
background-color: #dd4b39;
color: #fff;
}
button.secondary {
border: 1px solid #4d90fe;
background-color: #4d90fe;
color: #fff;
}
button.primary>img,
button.secondary>img {
opacity: 1;
}
button>img {
opacity: 0.6;
vertical-align: text-bottom;
}
button:hover>img {
opacity: 1;
}
button:active {
border: 1px solid #888 !important;
}
button:hover {
box-shadow: 2px 2px 5px #888;
}
button.disabled:hover>img {
opacity: 0.6;
}
button.disabled {
display: none;
}
button.notext {
font-size: 10%;
}
/* Dialogs */
#dialog {
visibility: hidden;
background-color: #fff;
color: #000;
border: 1px solid #ccc;
position: absolute;
border-radius: 8px;
box-shadow: 5px 5px 5px #888;
padding: 10px;
}
#dialogBorder {
visibility: hidden;
position: absolute;
background-color: #fff;
color: #000;
border: 1px solid #000;
border-radius: 6px;
box-shadow: 5px 5px 5px #888;
}
#dialogShadow {
visibility: hidden;
position: fixed;
top: 0;
left: 0;
height: 100%;
width: 100%;
background-color: #000;
opacity: 0.3
}
.dialogAnimate {
transition-property: width height left top opacity;
transition-duration: 0.2s;
transition-timing-function: linear;
}
.dialogHiddenContent {
visibility: hidden;
position: absolute;
top: 0;
left: 0;
z-index: -1;
}
#dialogHeader {
height: 25px;
margin: -10px -10px 15px;
border-top-left-radius: 8px;
border-top-right-radius: 8px;
background-color: #ddd;
cursor: move;
}
#dialog button {
min-width: 4em;
}
This diff is collapsed.
{namespace apps}
/**
* This is a Closure Template.
*
* Run the following command after changing the messages in any of the
* included apps subdirectories. If building on Windows, you may need to
* substitute '\' for '/'.
*
* java -jar _soy/SoyMsgExtractor.jar --outputFile extracted_msgs.xlf --srcs common.soy,code/template.soy,graph/template.soy,maze/template.soy,plane/template.soy,turtle/template.soy,index/template.soy
*
* Create en.json, keys.json, and qqq.json.
* ../i18n/xliff_to_json.py --xlf extracted_msgs.xlf --templates common.soy {code,graph,index,maze,plane,turtle}/template.soy
* or in Windows:
* python ..\i18n\xliff_to_json.py --xlf extracted_msgs.xlf --templates common.soy code\template.soy graph\template.soy index\template.soy maze\template.soy plane\template.soy turtle\template.soy
*
* Generate .js files for each project and the index:
* for i in code graph index maze plane turtle; do ../i18n/json_to_js.py --output_dir=$i/generated --template common.soy,$i/template.soy json/*.json; done
* or in Windows:
* FOR %i IN (code graph index maze plane turtle) DO python ..\i18n\json_to_js.py --output_dir=%i\generated --template common.soy,%i\template.soy json\*.json
*/
/**
* All messages to be translated.
*/
{template .messages}
<div style="display: none">
// Only used externally.
<span id="subtitle">{msg meaning="Apps.subtitle" desc="A short description of Blockly."}a visual programming environment{/msg}</span>
// Common messages used in multiple applications are defined here.
// The applications' template.soy file may also contain msg statements
// with the same "meaning" value. The "desc" value must be set to "IBID"
// (case-insensitive) or identical to the one in this file (not
// recommended), or an error will be raised during generation of qqq.json.
// The source-language text in the applications' definitions is ignored.
<span id="blocklyMessage">{msg meaning="Apps.blocklyMessage" desc="The project name. If readers of your language would know approximately how to pronounce 'Blockly', leave unchanged. Otherwise, include a transliteration in parentheses, such as the Russian: 'Blockly (Блoкли)'."}Blockly{/msg}</span>
// Buttons and tooltips.
<span id="codeTooltip">{msg meaning="Apps.codeTooltip" desc="tooltip - Pressing the button causes a program in the JavaScript computer language to be displayed, based on the program created by the user."}See generated JavaScript code.{/msg}</span>
<span id="linkTooltip">{msg meaning="Apps.linkTooltip" desc="tooltip - Clicking on this button will cause the current program to be saved and for a URL to be shown to later retrieve it."}Save and link to blocks.{/msg}</span>
<span id="runTooltip">{msg meaning="Apps.runTooltip" desc="tooltip - Pressing this button runs the computer program the user has written."}Run the program defined by the blocks in the workspace.{/msg}</span>
<span id="runProgram">{msg meaning="Apps.runProgram" desc="button label - Pressing the button runs the computer program the user has written."}Run Program{/msg}</span>
<span id="resetProgram">{msg meaning="Apps.resetProgram" desc="button label - Pressing the button causes the output of the program to be erased but does not delete the user's program)."}Reset{/msg}</span>
<span id="dialogOk">{{msg meaning="Apps.dialogOk" desc="Label on button for user to press when done reading help information.\n{lb}{lb}Identical|OK{rb}{rb}"}}OK{{/msg}}</span>
<span id="dialogCancel">{{msg meaning="Apps.dialogCancel" desc="Label on button for user to press when not wanting to proceed.\n{lb}{lb}Identical|Cancel{rb}{rb}"}}Cancel{{/msg}}</span>
// Categories. Apps can use these names or their own.
<span id="catLogic">{msg meaning="Apps.catLogic" desc="category - Blocks related to [https://github.com/google/blockly/wiki/Logic logic]."}Logic{/msg}</span>
<span id="catLoops">{msg meaning="Apps.catLoops" desc="category - Blocks related to [https://en.wikipedia.org/wiki/Control_flow#Loops loops]."}Loops{/msg}</span>
<span id="catMath">{msg meaning="Apps.catMath" desc="category - Blocks related to mathematics."}Math{/msg}</span>
<span id="catText">{{msg meaning="Apps.catText" desc="category - Blocks related to [https://github.com/google/blockly/wiki/Text text processing].\n{lb}{lb}Identical|Text{rb}{rb}"}}Text{{/msg}}</span>
<span id="catLists">{{msg meaning="Apps.catLists" desc="category - Blocks related to [https://github.com/google/blockly/wiki/Lists lists].\n{lb}{lb}Identical|Lists{rb}{rb}"}}Lists{{/msg}}</span>
<span id="catColour">{{msg meaning="Apps.catColour" desc="category - Blocks related to [https://github.com/google/blockly/wiki/Colour colour].\n{lb}{lb}Identical|Colour{rb}{rb}"}}Colour{{/msg}}</span>
<span id="catVariables">{msg meaning="Apps.catVariables" desc="category - Blocks related to [https://github.com/google/blockly/wiki/Variables variables]."}Variables{/msg}</span>
<span id="catProcedures">{msg meaning="Apps.catProcedures" desc="category - Blocks related to [https://en.wikipedia.org/wiki/Subroutine defining or using procedures/functions]."}Functions{/msg}</span>
// Error messages related to loading/storing user programs.
<span id="httpRequestError">{msg meaning="Apps.httpRequestError" desc="alert - The URL is invalid or a server error occurred. This message will be followed by technical information useful to engineers trying to understand the problem."}There was a problem with the request.{/msg}</span>
<span id="linkAlert">{msg meaning="Apps.linkAlert" desc="alert - After the user has pressed a button to save his/her program, this provides the URL (%1) to retrieve the program. The characters '\n\n' indicate that a blank line will be displayed before the URL (in English). Leave those in unless you move %1 to the beginning or middle of the text, in which case you should use your judgment about where blank lines would be most useful.\n\nParameters:\n* %1 - URL of saved program."}Share your blocks with this link:\n\n%1{/msg}</span>
<span id="hashError">{{msg meaning="Apps.hashError" desc="alert - A request to retrieve a stored program does not have a valid URL. %1 is the invalid portion of the URL."}}Sorry, '%1' doesn't correspond with any saved program.{{/msg}}</span>
<span id="xmlError">{msg meaning="Apps.xmlError" desc="alert - There was a problem loading a file previously saved by the user. The most likely reason for the problem is that it was created with an earlier, incompatible version of Blockly. This message will be followed by technical information useful to engineers trying to understand the problem."}Could not load your saved file. Perhaps it was created with a different version of Blockly?{/msg}</span>
// Default variable names.
<span id="listVariable">{msg meaning="Apps.listVariable" desc="variable name - Default [https://github.com/google/blockly/wiki/Variables variable] representing a [https://github.com/google/blockly/wiki/Lists list]. This should be a single word, preferably short."}list{/msg}</span>
<span id="textVariable">{{msg meaning="Apps.textVariable" desc="variable name - Default [https://github.com/google/blockly/wiki/Variables variable] representing a [https://github.com/google/blockly/wiki/Text piece of text]. This should be a single word, preferably short.\n{lb}{lb}Identical|Text{rb}{rb}"}}text{{/msg}}</span>
</div>
{/template}
/**
* Dialogs.
*/
{template .dialog private="true"}
<div id="dialogShadow" class="dialogAnimate"></div>
<div id="dialogBorder"></div>
<div id="dialog"></div>
{/template}
/**
* Code dialog.
*/
{template .codeDialog private="true"}
<div id="dialogCode" class="dialogHiddenContent">
<pre id="containerCode"></pre>
{call apps.ok /}
</div>
{/template}
/**
* Storage dialog.
*/
{template .storageDialog private="true"}
<div id="dialogStorage" class="dialogHiddenContent">
<div id="containerStorage"></div>
{call apps.ok /}
</div>
{/template}
/**
* OK button for dialogs.
*/
{template .ok private="true"}
<div class="farSide" style="padding: 1ex 3ex 0">
<button class="secondary" onclick="BlocklyApps.hideDialog(true)">
{{msg meaning="Apps.dialogOk" desc="IBID"}}OK{{/msg}}
</button>
</div>
{/template}
......@@ -237,7 +237,7 @@ Code.LANG = Code.getLang();
* List of tab names.
* @private
*/
Code.TABS_ = ['blocks', 'arduino', 'javascript', 'python', 'dart', 'xml'];
Code.TABS_ = ['blocks', 'javascript', 'python', 'dart', 'xml'];
Code.selected = 'blocks';
......@@ -296,14 +296,6 @@ Code.renderContent = function() {
var xmlText = Blockly.Xml.domToPrettyText(xmlDom);
xmlTextarea.value = xmlText;
xmlTextarea.focus();
} else if (content.id == 'content_arduino') {
var code = Blockly.Arduino.workspaceToCode();
content.textContent = code;
if (typeof prettyPrintOne == 'function') {
code = content.innerHTML;
code = prettyPrintOne(code, 'cpp');
content.innerHTML = code;
}
} else if (content.id == 'content_javascript') {
var code = Blockly.JavaScript.workspaceToCode();
content.textContent = code;
......
......@@ -8,15 +8,6 @@
<script src="/storage.js"></script>
<script src="../../blockly_compressed.js"></script>
<script src="../../blocks_compressed.js"></script>
<script src="../../generators/arduino.js"></script>
<script src="../../generators/arduino/colour.js"></script>
<script src="../../generators/arduino/lists.js"></script>
<script src="../../generators/arduino/logic.js"></script>
<script src="../../generators/arduino/loops.js"></script>
<script src="../../generators/arduino/math.js"></script>
<script src="../../generators/arduino/procedures.js"></script>
<script src="../../generators/arduino/text.js"></script>
<script src="../../generators/arduino/variables.js"></script>
<script src="../../javascript_compressed.js"></script>
<script src="../../python_compressed.js"></script>
<script src="../../dart_compressed.js"></script>
......@@ -41,8 +32,6 @@
<tr id="tabRow" height="1em">
<td id="tab_blocks" class="tabon">...</td>
<td class="tabmin">&nbsp;</td>
<td id="tab_arduino" class="taboff">Arduino</td>
<td class="tabmin">&nbsp;</td>
<td id="tab_javascript" class="taboff">JavaScript</td>
<td class="tabmin">&nbsp;</td>
<td id="tab_python" class="taboff">Python</td>
......@@ -71,7 +60,6 @@
</tr>
</table>
<div id="content_blocks" class="content"></div>
<pre id="content_arduino" class="content"></pre>
<pre id="content_javascript" class="content"></pre>
<pre id="content_python" class="content"></pre>
<pre id="content_dart" class="content"></pre>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment