10 Commits 14b9a2d3a0 ... 4f6a4f79d8

Author SHA1 Message Date
  Jeremy Kaplan 4f6a4f79d8 Fix syntax error 6 years ago
  jdkaplan 5eb99e5d22 Merge branch 'swal' of adqm/catsoop-queue into master 6 years ago
  jdkaplan 6ce987d88e Merge branch 'css' of adqm/catsoop-queue into master 6 years ago
  adam j hartz a7313c83bb swal-related changes for queue proper 6 years ago
  adam j hartz 3f228085ed change to make the queue work with updated sweetalert2 6 years ago
  adam j hartz ed0bc43b9f only affect the queue with css 6 years ago
  jdkaplan 7dd888f709 Merge branch 'catsoop_updates' of adqm/catsoop-queue into master 6 years ago
  adam j hartz 26eec28bf1 style queue buttons added by plugin to match catsoop buttons 6 years ago
  adam j hartz 7f5419826e update checkoffs for new catsoop 6 years ago
  adam j hartz 6d420f8b37 update template footer to match updated catsoop 6 years ago

+ 3 - 2
catsoop/plugin-template/__MEDIA__/templates/queue.template

@@ -83,9 +83,10 @@
     </div>
     <div id="footer">
       {cs_footer}
-      Powered by <a href='https://cat-soop.org'>CAT-SOOP</a> v{cs_version}<br/>
-      (<a href="BASE/cs_util/license" target="_blank">View License</a>, <a href="BASE/cs_util/source.zip{cs_source_qstring}" download>Download Source Code</a>)
       <pre class="catsooplogo" style="font-size:50%;">{cs_base_logo_text}</pre>
+      Powered by <a target='_blank' href='https://catsoop.mit.edu'>CAT-SOOP</a> {cs_version}.<br/>
+      CAT-SOOP is <a href="http://www.fsf.org/about/what-is-free-software" target="_blank">free/libre software</a>, available under the terms<br/>of the <a href="BASE/cs_util/license" target="_blank">GNU Affero General Public License, version 3</a>.<br/>
+      (<a href="BASE/cs_util/source.zip{cs_source_qstring}" download>Download Source Code</a>)
     </div>
   </body>
 </html>

+ 15 - 9
catsoop/plugin-template/post_handle.py

@@ -25,18 +25,22 @@ swal({{
     showCancelButton: true,
     inputPlaceholder: "Table number (e.g., 6A)",
     preConfirm: function(text){{
-        return new Promise(function(resolve, reject) {{
-        if (text === false) reject('no');
-        else if (text === "") {{
-            reject("You need to write something!");
-        }}else{{
+        return new Promise(function(resolve) {{
+            if (text === false){{
+                swal.showValidationError('no.');
+            }}
+            else if (text === "") {{
+                swal.showValidationError('You need to write something!');
+            }}
             resolve();
-        }}}});
+        }});
     }}
     }}).then(function(text) {{
-        queue.set('location', text);
-        ''' + addtoqueue + '''
-        queue.set('_visible', true);
+        if(typeof text.value !== 'undefined'){{
+            queue.set('location', text.value);
+            ''' + addtoqueue + '''
+            queue.set('_visible', true);
+        }}
     }}) : (''' + addtoqueue + ''', queue.set('_visible', true))'''
 
 def queue_buttons(qtype, context):
@@ -45,6 +49,7 @@ def queue_buttons(qtype, context):
     buttons['id'] = '{}_queue_buttons'.format(context['csq_name'])
 
     button = soup.new_tag('button')
+    button['class'] = ['btn', 'btn-catsoop']
     button.string = 'Ask for Help'
     button['onclick'] = tablenumber_modal.format(
         type = 'help',
@@ -55,6 +60,7 @@ def queue_buttons(qtype, context):
 
     if qtype['qtype'] == 'checkoff':
         button = soup.new_tag('button')
+        button['class'] = ['btn', 'btn-catsoop']
         button.string = 'Ask for Checkoff'
         button['onclick'] = tablenumber_modal.format(
             type = 'checkoff',

+ 2 - 2
server/entry_types.js

@@ -184,7 +184,7 @@ class CheckoffEntry extends Entry {
             .submit(this.data.assignment.page, {
                 names: JSON.stringify([this.data.assignment.name]),
                 as: this.username,
-                data: JSON.stringify({[this.data.assignment.name]: user.username}),
+                data: JSON.stringify({[this.data.assignment.name]: params.CATSOOP.TOKEN+','+user.username}),
             })
             .then(() => db
                 .table('queue')
@@ -206,7 +206,7 @@ class CheckoffEntry extends Entry {
                     .submit(this.data.assignment.page, {
                         names: JSON.stringify([this.data.assignment.name]),
                         as: member,
-                        data: JSON.stringify({[this.data.assignment.name]: user.username}),
+                        data: JSON.stringify({[this.data.assignment.name]: params.CATSOOP.TOKEN+','+user.username}),
                     });
             }));
         }).then(() => db

+ 8 - 4
www/js/view.js

@@ -212,8 +212,10 @@ module.exports = function(SweetAlert, client, options={}) {
                 confirmButtonText: 'Clear the queue',
                 confirmButtonColor: '#d33',
             })
-                .then(() => {
-                    client.clear();
+                .then((res) => {
+                    if(res.value){
+                        client.clear();
+                    }
                 });
         },
 
@@ -226,8 +228,10 @@ module.exports = function(SweetAlert, client, options={}) {
                 confirmButtonText: 'Lock the queue',
                 confirmButtonColor: '#d33',
             })
-                .then(() => {
-                    client.lock();
+                .then((res) => {
+                    if(res.value){
+                        client.lock();
+                    }
                 });
         },
 

+ 1 - 1
www/scss/queue.scss

@@ -11,7 +11,7 @@
 }
 
 /* Keep the table buttons from taking up tons of space by making them as small as possible. */
-table tr td:last-child {
+.queue-row td:last-child {
     white-space: nowrap;
     width: 0;
 }