template.soy 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225
  1. {namespace planepage}
  2. /**
  3. * This is a Closure Template.
  4. *
  5. * See the README.txt for details.
  6. */
  7. /**
  8. * Translated messages for use in JavaScript.
  9. */
  10. {template .messages}
  11. <div style="display: none">
  12. <span id="Plane_rows">{msg meaning="Plane.rows" desc="page text - Total number of rows of seats on an airplane.\n\nParameters:\n* %1 - number of rows of seats on an airplane. It is always an integer greater than or equal to zero."}Rows: %1{/msg}</span>
  13. <span id="Plane_getRows">{msg meaning="Plane.getRows" desc="block text - The number of rows on the airplane, to be used in a mathematical equation, such as: 'seats = 4 x '''rows (5)''''.\n\nParameters:\n* %1 - number of rows of seats on an airplane. It is always an integer greater than or equal to zero."}rows (%1){/msg}</span>
  14. <span id="Plane_rows1">{msg meaning="Plane.rows1" desc="page text - The number of rows of first-class seats on the airplane. You can see the block at [http://blockly-share.appspot.com/static/apps/plane/plane.html?lang=en&level=3].\n\nParameters:\n* %1 - number of rows of first-class seats on an airplane. It is always an integer greater than or equal to zero."}1st class rows: %1{/msg}</span>
  15. <span id="Plane_getRows1">{msg meaning="Plane.getRows1" desc="block text - The number of rows of first-class seats on the, to be used in a mathematical equation. See [http://blockly-share.appspot.com/static/apps/plane/plane.html?lang=en&level=3].\n\nParameters:\n* %1 - number of rows of first-class seats on an airplane. It is always an integer greater than or equal to zero."}1st class rows (%1){/msg}</span>
  16. <span id="Plane_rows2">{msg meaning="Plane.rows2" desc="page text - The number of rows of second-class seats on the airplane. %1 is an integer greater or equal to zero. See [http://blockly-share.appspot.com/static/apps/plane/plane.html?lang=en&level=3].\n\nParameters:\n* %1 - number of rows of second-class seats on an airplane. It is always an integer greater than or equal to zero."}2nd class rows: %1{/msg}</span>
  17. <span id="Plane_getRows2">{msg meaning="Plane.getRows2" desc="block text - The number of rows of second-class (also called 'economy class') seats on the airplane, to be used in a mathematical expression.\n\nParameters:\n* %1 - number of rows of second-class seats on an airplane. It is always an integer greater than or equal to zero."}2nd class rows (%1){/msg}</span>
  18. <span id="Plane_seats">{msg meaning="Plane.seats" desc="page text - The total number of seats on the airplane.\n\nParameters:\n* %1 - number of seats on an airplane. It is always either the next message or an integer greater than or equal to zero."}Seats: %1{/msg}</span>
  19. <span id="Plane_placeholder">{msg meaning="Plane.placeholder" desc="page text - A word or symbol indicating that this numeric value has not yet been determined."}?{/msg}</span>
  20. <span id="Plane_setSeats">{msg meaning="Plane.setSeats" desc="block text - The first half of a mathematical equation determining the number of seats in an airplane, such as: ''''seats =''' 4 x rows'."}seats ={/msg}</span>
  21. </div>
  22. {/template}
  23. /**
  24. * Web page structure.
  25. */
  26. {template .start}
  27. {call .messages /}
  28. <table width="100%">
  29. <tr>
  30. <td>
  31. <h1><a href="https://developers.google.com/blockly/">Blockly</a>&rlm; &gt;{sp}
  32. <a href="../index.html">Demos</a>&rlm; &gt;{sp}
  33. <span id="title">
  34. {msg meaning="Plane.plane" desc="title - Specifies that this is Blockly's '''Plane''' (airplane) tutorial. The word 'plane' was chosen over 'airplane' in English because it is shorter and less formal."}
  35. Plane Seat Calculator
  36. {/msg}
  37. </span>
  38. {sp}&nbsp;{sp}
  39. {for $i in range(1, $ij.maxLevel + 1)}
  40. {sp}
  41. {if $i == $ij.level}
  42. <span class="tab" id="selected">{$i}</span>
  43. {else}
  44. {if $i < $ij.level}
  45. <a class="tab previous" href="?lang={$ij.lang}&level={$i}">{$i}</a>
  46. {else}
  47. <a class="tab" href="?lang={$ij.lang}&level={$i}">{$i}</a>
  48. {/if}
  49. {/if}
  50. {/for}
  51. </h1>
  52. </td>
  53. <td class="farSide">
  54. <span {if $ij.lang == 'en'}id="languageBorder"{/if} style="padding: 10px">
  55. <select id="languageMenu"></select>
  56. </span>
  57. </td>
  58. </tr>
  59. </table>
  60. <script src="slider.js"></script>
  61. <svg
  62. id="plane"
  63. xmlns="http://www.w3.org/2000/svg"
  64. xmlns:svg="http://www.w3.org/2000/svg"
  65. xmlns:xlink="http://www.w3.org/1999/xlink"
  66. version="1.1"
  67. width="600"
  68. height="320"
  69. viewBox="0 110 600 320">
  70. <defs>
  71. <g id="row1st">
  72. <rect
  73. class="seat1st"
  74. width="10" height="10"
  75. x="75" y="243" />
  76. <rect
  77. class="seat1st"
  78. width="10" height="10"
  79. x="75" y="254" />
  80. <rect
  81. class="seat1st"
  82. width="10" height="10"
  83. x="75" y="272" />
  84. <rect
  85. class="seat1st"
  86. width="10" height="10"
  87. x="75" y="283" />
  88. </g>
  89. <g id="row2nd">
  90. <rect
  91. class="seat2nd"
  92. width="10" height="8"
  93. x="75" y="243" />
  94. <rect
  95. class="seat2nd"
  96. width="10" height="8"
  97. x="75" y="251" />
  98. <rect
  99. class="seat2nd"
  100. width="10" height="8"
  101. x="75" y="269" />
  102. <rect
  103. class="seat2nd"
  104. width="10" height="8"
  105. x="75" y="277" />
  106. <rect
  107. class="seat2nd"
  108. width="10" height="8"
  109. x="75" y="285" />
  110. </g>
  111. <linearGradient id="grad1" x1="0%" y1="100%" x2="0%" y2="0%">
  112. <stop offset="0%" style="stop-color:#fff;stop-opacity:0" />
  113. <stop offset="100%" style="stop-color:#fff;stop-opacity:1" />
  114. </linearGradient>
  115. <linearGradient id="grad2" x1="0%" y1="0%" x2="0%" y2="100%">
  116. <stop offset="0%" style="stop-color:#fff;stop-opacity:0" />
  117. <stop offset="100%" style="stop-color:#fff;stop-opacity:1" />
  118. </linearGradient>
  119. </defs>
  120. <path
  121. d="m 214,270 l 159,-254 31,-16 -74,189 0,162 74,189 -31,16 z"
  122. id="wing" />
  123. <path
  124. d="m 577,270 22,-93 -27,6 -44,88 44,88 27,6 z"
  125. id="tail" />
  126. <path
  127. d="m 577,270 l -94,24 h -407 c -38,0 -75,-13 -75,-26 c 0,-13 38,-26 75,-26 h 407 z"
  128. id="fuselage" />
  129. <rect
  130. width="610"
  131. height="100"
  132. x="-5"
  133. y="110"
  134. fill="url(#grad1)" />
  135. <rect
  136. width="610"
  137. height="100"
  138. x="-5"
  139. y="330"
  140. fill="url(#grad2)" />
  141. <text id="row1stText" x="55" y="380"></text>
  142. <text id="row2ndText" x="55" y="420"></text>
  143. <text x="55" y="210">
  144. <tspan id="seatText"></tspan>
  145. <tspan id="seatYes" style="fill: #0c0;" dy="10">&#x2713;</tspan>
  146. <tspan id="seatNo" style="fill: #f00;" dy="10">&#x2717;</tspan>
  147. </text>
  148. {if $ij.level > 1}
  149. <rect
  150. id="crew_right" class="crew"
  151. width="10" height="10"
  152. x="35" y="254" />
  153. <rect
  154. id="crew_left" class="crew"
  155. width="10" height="10"
  156. x="35" y="272" />
  157. {/if}
  158. </svg>
  159. <p>
  160. {switch $ij.level}
  161. {case 1}
  162. {msg meaning="Plane.description1" desc="instructions - Note that in [http://blockly-share.appspot.com/static/apps/plane/plane.html?lang=en&level=1 this level], there is only one type of seat on the plane."}An airplane has a number of rows of passenger seats. Each row contains four seats.{/msg}
  163. {case 2}
  164. {msg meaning="Plane.description2" desc="instructions - Note that in [http://blockly-share.appspot.com/static/apps/plane/plane.html?lang=en&level=2 this level], there are two types of seats on this plane."}An airplane has two seats in the flight deck (for the pilot and co-pilot), and a number of rows of passenger seats. Each row contains four seats.{/msg}
  165. {case 3}
  166. {msg meaning="Plane.description3" desc="instructions - Note that in [http://blockly-share.appspot.com/static/apps/plane/plane.html?lang=en&level=3 this level], there are three types of seats on this plane. Be sure to use the same terms for '1st class' and '2nd class' as you did for the earlier messages."}An airplane has two seats in the flight deck (for the pilot and co-pilot), and a number of rows of 1st class and 2nd class passenger seats. Each 1st class row contains four seats. Each 2nd class row contains five seats.{/msg}
  167. {/switch}
  168. </p>
  169. <p>
  170. {msg meaning="Plane.instructions" desc="page text - This text appears below the airplane graphic and above the space for the user to create the formula. The number of rows an the graphic may be changed by the user with a slider. See [http://blockly-share.appspot.com/static/apps/plane/plane.html?lang=en&level=1] for a picture."}Build a formula (below) that calculates the total number of seats on the airplane as the rows are changed (above).{/msg}
  171. </p>
  172. <script src="../../blockly_compressed.js"></script>
  173. <script src="../../blocks_compressed.js"></script>
  174. <script src="../../javascript_compressed.js"></script>
  175. <script src="../../msg/js/{$ij.lang}.js"></script>
  176. <script src="blocks.js"></script>
  177. {call .toolbox /}
  178. <div id="blockly"></div>
  179. {/template}
  180. /**
  181. * Toolboxes for each level.
  182. */
  183. {template .toolbox}
  184. <xml id="toolbox" style="display: none">
  185. <block type="math_number"></block>
  186. <block type="math_arithmetic">
  187. <value name="A">
  188. <shadow type="math_number">
  189. <field name="NUM">1</field>
  190. </shadow>
  191. </value>
  192. <value name="B">
  193. <shadow type="math_number">
  194. <field name="NUM">1</field>
  195. </shadow>
  196. </value>
  197. </block>
  198. <block type="math_arithmetic">
  199. <field name="OP">MULTIPLY</field>
  200. <value name="A">
  201. <shadow type="math_number">
  202. <field name="NUM">1</field>
  203. </shadow>
  204. </value>
  205. <value name="B">
  206. <shadow type="math_number">
  207. <field name="NUM">1</field>
  208. </shadow>
  209. </value>
  210. </block>
  211. {if $ij.level <= 2}
  212. <block type="plane_get_rows"></block>
  213. {else}
  214. <block type="plane_get_rows1st"></block>
  215. <block type="plane_get_rows2nd"></block>
  216. {/if}
  217. </xml>
  218. {/template}