git.fiddlerwoaroof.com
Browse code

View tweaks

- hide in-progress box better
- show moderated links to non-logged-in users

fiddlerwoaroof authored on 23/01/2016 14:31:40
Showing 3 changed files
... ...
@@ -96,8 +96,10 @@
96 96
                 (render-mustache #p"static/index.mustache.html"
97 97
                                  `((:links . ,(mapcar #'submission-alist *submissions*))
98 98
                                    (:user . ,(user-alist (gethash :app-user session)))))))
99
-            (cl-oid-connect.utils:user-not-logged-in (c) (render-mustache #p"static/index.mustache.html"
100
-                                                                          nil))))))
99
+            (cl-oid-connect.utils:user-not-logged-in
100
+              (c)
101
+              (render-mustache #p"static/index.mustache.html"
102
+                               `((:links . ,(mapcar #'submission-alist (get-moderated *submissions*))))))))))
101 103
 
102 104
 (defun submit (params)
103 105
   (awhen (alist-submission params :nil-if-exists t)
... ...
@@ -166,6 +166,7 @@ ul#submissions li {
166 166
 }
167 167
 
168 168
 ul#submissions li.in-progress {
169
+  visibility: hidden;
169 170
   position: relative;
170 171
   margin-top: 1.5em;
171 172
   font-size: 1.1em;
... ...
@@ -175,6 +176,10 @@ ul#submissions li.in-progress {
175 176
   letter-spacing: 1px;
176 177
 }
177 178
 
179
+ul#submissions li.in-progress.ready {
180
+  visibility: visible;
181
+}
182
+
178 183
 ul#submissions li.submission:first-child {
179 184
   margin-top: 3.33em;
180 185
 }
... ...
@@ -26,14 +26,14 @@
26 26
     </form>
27 27
 
28 28
     <ul id="submissions">
29
-      <li class="in-progress hidden" v-if="newLink.headline || newLink.url">
30
-        <a href="#">
31 29
           {{=<% %>=}}
30
+      <li class="in-progress {{ ready }}" v-if="newLink.headline || newLink.url">
31
+        <a href="#">
32 32
           <h2>{{ newLink.headline }}</h2>
33 33
           <p>{{ newLink.url }}</p>
34
-          <%={{ }}=%>
35 34
         </a>
36 35
       </li>
36
+          <%={{ }}=%>
37 37
 
38 38
       {{#links}}
39 39
       <li class="submission">
... ...
@@ -49,7 +49,7 @@
49 49
         </div>
50 50
         {{/moderator}}
51 51
         {{/user}}
52
-        <a href="{{ url }}" class="{{ approved }}">
52
+        <a href="{{ url }}" class="{{#user}}{{#moderator}}{{ approved }}{{/moderator}}{{/user}}">
53 53
           <h2>{{ headline }}</h2>
54 54
           <p>{{ url }}</p>
55 55
         </a>
... ...
@@ -62,24 +62,24 @@
62 62
     <script src="/static/js/jquery.formalize.js"></script>
63 63
     <script src="/static/js/vue.js"></script>
64 64
     <script type="text/javascript">
65
-      new Vue({
66
-        el: '#app',
65
+new Vue({
66
+  el: '#app',
67 67
 
68
-         methods: {
69
-             submit: function(e) {
70
-                 e.preventDefault();
71
-                 this.links.unshift(0,Object.create(this.newLink));
72
-                 this.newLink = {};
73
-                 return false;
74
-               }
75
-           },
68
+  methods: {
69
+    submit: function(e) {
70
+      e.preventDefault();
71
+      this.links.unshift(0,Object.create(this.newLink));
72
+      this.newLink = {};
73
+      return false;
74
+    }
75
+  },
76 76
 
77
-         data: {
78
-             newLink: {
79
-               },
80
-           }
81
-      });
82
-      jQuery('.hidden.in-progress').removeClass('hidden');
77
+  data: {
78
+    ready: 'ready',
79
+    newLink: {
80
+    },
81
+  }
82
+});
83 83
     </script>
84 84
   </body>
85 85
 </html>