Renamed survey-take-090627.js to survey-take-090705.js.
authorLennard de Rijk <ljvderijk@gmail.com>
Sun, 05 Jul 2009 23:45:57 +0200
changeset 2551 087684992ab0
parent 2550 85ee43d4a6f5
child 2552 747e058900d5
Renamed survey-take-090627.js to survey-take-090705.js.
app/soc/content/js/survey-take-090627.js
app/soc/content/js/survey-take-090705.js
app/soc/templates/soc/survey/public.html
app/soc/templates/soc/survey/take.html
--- a/app/soc/content/js/survey-take-090627.js	Sun Jul 05 23:43:57 2009 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,165 +0,0 @@
-/* Copyright 2009 the Melange authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/*
-*
-* @author <a href="mailto:ajaksu@gmail.com">Daniel Diniz</a>
-* @author <a href="mailto:jamesalexanderlevy@gmail.com">James Levy</a>
-*/
-
-(function ($) { 
-  $(function () {
-  
-    /*
-    * == Setup Survey on Page Load ==
-    *
-    */
-
-    var widget = $('div#survey_widget');
-    widget.parents('td.formfieldvalue:first').css({
-      'float': 'left',
-      'width': 200
-    });
-
-    // TODO(ajaksu) survey below is unused, remove if no known use is predicted
-    var survey = widget.find('tbody:first');
-
-    if (widget.hasClass('create')) {
-
-      /*
-      * == Set Custom Field Rules ==
-      *
-      */
-      widget.find('input').each(
-        function () {
-          $(this).preserveDefaultText($(this).val());
-        }
-      );
-
-      widget.find('textarea').each(
-        function () {
-          $(this).preserveDefaultText($(this).val()).attr('overflow', 'auto')
-          .growfield();
-        }
-      );
-    }
-
-    else { // survey has saved results
-      widget.find('textarea').each(
-        function () {
-          $(this).attr('overflow', 'auto').growfield();
-        }
-      ).end()
-      .find('.pick_multi').each(
-        function () {
-          $(this).find('input').each(
-            function () {
-              // if $(this).attr('checked', 'true');});
-            }
-          );
-        }
-      );
-    }
-
-    /*
-    * == Configure Project ==
-    *
-    */
-
-    // remember if form has been touched
-    $('input,textarea,select').change(
-      function () {
-        if ($(this).attr('id') === 'id_project') {
-          return;
-        }
-        $('form:first').data('touched', true);
-      }
-    );
-
-  // remember initially chosen project choice
-    $('select#id_project').blur(
-      function () {
-        $(this).data('selected', $(this).find('option:first'));
-      }
-    ).change(
-      function () {
-        if ($('form:first').data('touched') === true) {
-          // if form has been touched, send confirmation dialog
-          var save_check = confirm(["Switching projects will lose unsaved ",
-                                    "edits made to this survey."].join(""));
-          if (!save_check) {
-            $(this).data('selected').attr('selected', 'selected');
-            return false;
-          }
-        }
-
-        if ($(this).val() !== 'None') {
-          // redirect with new project GET param
-          window.location = [window.location.href.split('?')[0],  "?project=",
-                             $(this).val()].join("");
-        }
-      }
-    );
-
-    // insert project link after project select field
-    $('div#project_link').insertAfter($('select#id_project')).show();
-
-    /*
-    * == Survey Submission Handler ==
-    *
-    */
-
-    // validate form
-    $('input[type=submit]').bind(
-      'click',
-      function (e) {
-        e.preventDefault();
-
-        // validate project and grade choice fields
-        if ($('select#id_project') &&
-        $('select#id_project').val() === 'None') {
-          return alert('Please Choose a Project');
-        }
-
-        if ($('select#id_grade') && $('select#id_grade').val() === 'None') {
-          return alert('Please Choose a Grade');
-        }
-        $('form').trigger('submit');
-
-      }
-    );
-
-    $('form').bind('submit',
-      function () {
-        $('input#id_s_html').val(
-          widget.find('div#survey_options').remove().end().html()
-        );
-      }
-    );
-  
-   /*
-   * == Customize Comment Appearance ==
-   */
-   
-   var comments = widget.find('td > .comment');
-   comments.each(function(){
-     $(this).parents('tr:first')
-           .css({'margin-top': '-10px', 'margin-bottom': '30px'})
-           .prev().css({'margin-top': '-10px'})
-           .find('label').css({'font-size': '11px'});
-   });
-    
-  });
-}(jQuery));
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/app/soc/content/js/survey-take-090705.js	Sun Jul 05 23:45:57 2009 +0200
@@ -0,0 +1,165 @@
+/* Copyright 2009 the Melange authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+*
+* @author <a href="mailto:ajaksu@gmail.com">Daniel Diniz</a>
+* @author <a href="mailto:jamesalexanderlevy@gmail.com">James Levy</a>
+*/
+
+(function ($) { 
+  $(function () {
+  
+    /*
+    * == Setup Survey on Page Load ==
+    *
+    */
+
+    var widget = $('div#survey_widget');
+    widget.parents('td.formfieldvalue:first').css({
+      'float': 'left',
+      'width': 200
+    });
+
+    // TODO(ajaksu) survey below is unused, remove if no known use is predicted
+    var survey = widget.find('tbody:first');
+
+    if (widget.hasClass('create')) {
+
+      /*
+      * == Set Custom Field Rules ==
+      *
+      */
+      widget.find('input').each(
+        function () {
+          $(this).preserveDefaultText($(this).val());
+        }
+      );
+
+      widget.find('textarea').each(
+        function () {
+          $(this).preserveDefaultText($(this).val()).attr('overflow', 'auto')
+          .growfield();
+        }
+      );
+    }
+
+    else { // survey has saved results
+      widget.find('textarea').each(
+        function () {
+          $(this).attr('overflow', 'auto').growfield();
+        }
+      ).end()
+      .find('.pick_multi').each(
+        function () {
+          $(this).find('input').each(
+            function () {
+              // if $(this).attr('checked', 'true');});
+            }
+          );
+        }
+      );
+    }
+
+    /*
+    * == Configure Project ==
+    *
+    */
+
+    // remember if form has been touched
+    $('input,textarea,select').change(
+      function () {
+        if ($(this).attr('id') === 'id_project') {
+          return;
+        }
+        $('form:first').data('touched', true);
+      }
+    );
+
+  // remember initially chosen project choice
+    $('select#id_project').blur(
+      function () {
+        $(this).data('selected', $(this).find('option:first'));
+      }
+    ).change(
+      function () {
+        if ($('form:first').data('touched') === true) {
+          // if form has been touched, send confirmation dialog
+          var save_check = confirm(["Switching projects will lose unsaved ",
+                                    "edits made to this survey."].join(""));
+          if (!save_check) {
+            $(this).data('selected').attr('selected', 'selected');
+            return false;
+          }
+        }
+
+        if ($(this).val() !== 'None') {
+          // redirect with new project GET param
+          window.location = [window.location.href.split('?')[0],  "?project=",
+                             $(this).val()].join("");
+        }
+      }
+    );
+
+    // insert project link after project select field
+    $('div#project_link').insertAfter($('select#id_project')).show();
+
+    /*
+    * == Survey Submission Handler ==
+    *
+    */
+
+    // validate form
+    $('input[type=submit]').bind(
+      'click',
+      function (e) {
+        e.preventDefault();
+
+        // validate project and grade choice fields
+        if ($('select#id_project') &&
+        $('select#id_project').val() === 'None') {
+          return alert('Please Choose a Project');
+        }
+
+        if ($('select#id_grade') && $('select#id_grade').val() === 'None') {
+          return alert('Please Choose a Grade');
+        }
+        $('form').trigger('submit');
+
+      }
+    );
+
+    $('form').bind('submit',
+      function () {
+        $('input#id_s_html').val(
+          widget.find('div#survey_options').remove().end().html()
+        );
+      }
+    );
+  
+   /*
+   * == Customize Comment Appearance ==
+   */
+   
+   var comments = widget.find('td > .comment');
+   comments.each(function(){
+     $(this).parents('tr:first')
+           .css({'margin-top': '-10px', 'margin-bottom': '30px'})
+           .prev().css({'margin-top': '-10px'})
+           .find('label').css({'font-size': '11px'});
+   });
+    
+  });
+}(jQuery));
--- a/app/soc/templates/soc/survey/public.html	Sun Jul 05 23:43:57 2009 +0200
+++ b/app/soc/templates/soc/survey/public.html	Sun Jul 05 23:45:57 2009 +0200
@@ -16,7 +16,7 @@
 {% block scripts %}
 {{ block.super }}
 <script type="text/javascript" src="/soc/content/js/survey-default-text-090627.js"></script>
-<script type="text/javascript" src="/soc/content/survey-take-090627.js"></script>
+<script type="text/javascript" src="/soc/content/survey-take-090705.js"></script>
 <script type="text/javascript" src="/jquery/jquery-growfield.js"></script>
 {% endblock %}
 
--- a/app/soc/templates/soc/survey/take.html	Sun Jul 05 23:43:57 2009 +0200
+++ b/app/soc/templates/soc/survey/take.html	Sun Jul 05 23:45:57 2009 +0200
@@ -16,7 +16,7 @@
 {% block scripts %}
 {{ block.super }}
 <script type="text/javascript" src="/soc/content/js/survey-default-text-090627.js"></script>
-<script type="text/javascript" src="/soc/content/js/survey-take-090627.js"></script>
+<script type="text/javascript" src="/soc/content/js/survey-take-090705.js"></script>
 <script type="text/javascript" src="/jquery/jquery-growfield.js"></script>
 {% endblock %}