Commits

Konstantine Rybnikov  committed ba7929a

ok, I'm done with ajax. That's just a shit

  • Participants
  • Parent commits c64d6ca

Comments (0)

Files changed (4)

File fat/fat_po_editor/static/css/main.css

 
 #repositories-list .repo-name {
   width: 500px; }
+#repositories-list .repository-list {
+  list-style: none; }
+  #repositories-list .repository-list li.repo {
+    cursor: pointer;
+    font-weight: bold;
+    text-decoration: underline; }

File fat/fat_po_editor/static/css/main.scss

     .repo-name {
         width: 500px;
     }
+    .repository-list {
+        list-style: none;
+        li.repo {
+            cursor: pointer;
+            font-weight: bold;
+            text-decoration: underline;
+        }
+    }
 }

File fat/fat_po_editor/static/js/repositories_list.js

     var onclick = (function(repoList) {
         return function() {
             var path = $add_path_input.val();
-
+            
             var callback = (function(repoList) {
                 return function(response) {
                     if (response.status == 'success') {
                         AjaxUtil.info(
                             response.data.message);
-                        repoList.updateList(response.data.repositories);
+                        repoList.drawElemAdded(path);
                     } else if (response.status == 'fail') {
                         AjaxUtil.error(
                             response.data.message);
         .autocomplete({source: autocomplete_url});
 };
 
-RepositoriesList.prototype.updateList = function(repositories) {
-    console.log('finally here!');
-    console.log(repositories);
-    // 1. get list
-    // 2. update list
+RepositoriesList.prototype.drawElemAdded = function(path) {
+    this.$list.find('ul.repository-list').append($('<li></li>').attr("class", "repo").html(path));
 };

File fat/fat_po_editor/templates/fat_po_editor/repositories_list.html

         {% if repositories %}
         <ul class="repository-list">
             {% for repository in repositories %}
-            <li>{{ repository.path }}</li>
+            <li class="repo">{{ repository.path }}</li>
             {% endfor %}
         </ul>
         {% else %}