Browse Source

Sort content based on type

Carlos Hernandez 3 years ago
parent
commit
c7f755c93a
2 changed files with 79 additions and 120 deletions
  1. 54
    120
      app_template/www/home.html
  2. 25
    0
      app_template/www/sortposts.js

+ 54
- 120
app_template/www/home.html
File diff suppressed because it is too large
View File


+ 25
- 0
app_template/www/sortposts.js View File

@@ -0,0 +1,25 @@
1
+function sort_posts(id) {
2
+    console.log("Executing function.");
3
+    var value = document.getElementById("my-selection").value;
4
+    console.log(value);
5
+
6
+    var parentNode = document.getElementById("rows-parent");
7
+    var instagramRow = document.getElementById("instagram-row");
8
+    var podcastsRow = document.getElementById("podcasts-row");
9
+    var articlesRow = document.getElementById("articles-row");
10
+    if (value == 1) {
11
+        parentNode.appendChild(podcastsRow);
12
+        parentNode.appendChild(instagramRow);
13
+        parentNode.appendChild(articlesRow);
14
+    }
15
+    else if (value == 2) {
16
+        parentNode.appendChild(instagramRow);
17
+        parentNode.append(articlesRow);
18
+        parentNode.appendChild(podcastsRow);
19
+    }
20
+    else if (value == 3) {
21
+        parentNode.append(articlesRow);
22
+        parentNode.appendChild(podcastsRow);
23
+        parentNode.appendChild(instagramRow);
24
+    }
25
+}