1. Thririot Christophe
  2. CubeOfCoffee

Commits

Christophe Thiriot  committed 212e4c7

first finish

  • Participants
  • Parent commits 41ab334
  • Branches default

Comments (0)

Files changed (3)

File coffee/app.coffee

View file
 
     model: undefined
 
-    turnlist: ["R2", "U", "R", "U", "R'", "U'", "R'", "U'", "R'", "U", "R'"]
+    turnlist: undefined
 
     constructor:(cubeview) ->
         @view = cubeview
         @model = cubeview.model
 
+        # read the attributes
+        @turnlist = @view.$container.getAttribute('data-move').split(" ")
+
         # add the text movements
         @view.$container.insertAdjacentHTML "beforeend", '<div class="movtext">' + @turnlist.join(' ') + '</div><div class="movbuttons"><a class="first" href="#">|◀</a><a class="previous" href="#">◀|</a><a class="previous-play" href="#">◀</a><a class="stop" href="#">◼</a><a class="next-play" href="#">▶</a><a class="next" href="#">|▶</a><a class="last" href="#">▶|</a></div>'
 

File index.html

View file
 </style>
     </head>
     <body>
-        <div class="container cubeofcoffee">
+        <div class="container cubeofcoffee" data-move="R2 U R U R' U' R' U' R' U R'">
         </div>
     </body>
 </html>

File js/app.js

View file
 
     CubeController.prototype.model = void 0;
 
-    CubeController.prototype.turnlist = ["R2", "U", "R", "U", "R'", "U'", "R'", "U'", "R'", "U", "R'"];
+    CubeController.prototype.turnlist = void 0;
 
     function CubeController(cubeview) {
       this.previous_play = __bind(this.previous_play, this);
       var _this = this;
       this.view = cubeview;
       this.model = cubeview.model;
+      this.turnlist = this.view.$container.getAttribute('data-move').split(" ");
       this.view.$container.insertAdjacentHTML("beforeend", '<div class="movtext">' + this.turnlist.join(' ') + '</div><div class="movbuttons"><a class="first" href="#">|◀</a><a class="previous" href="#">◀|</a><a class="previous-play" href="#">◀</a><a class="stop" href="#">◼</a><a class="next-play" href="#">▶</a><a class="next" href="#">|▶</a><a class="last" href="#">▶|</a></div>');
       this.view.$container.querySelector('.next-play').addEventListener('click', function() {
         return _this.next_play();