Switch to foundation modals
authorCharles Connell <charles@connells.org>
Sat, 29 Mar 2014 21:16:35 +0000 (17:16 -0400)
committerCharles Connell <charles@connells.org>
Sat, 29 Mar 2014 21:16:35 +0000 (17:16 -0400)
karmaworld/assets/css/global.css
karmaworld/assets/css/note_course_pages.css
karmaworld/assets/js/add-course.js
karmaworld/assets/js/course-detail.js
karmaworld/assets/js/note-detail.js
karmaworld/assets/js/utils.js [deleted file]
karmaworld/templates/base.html
karmaworld/templates/courses/course_detail.html
karmaworld/templates/courses/course_list.html
karmaworld/templates/notes/note_detail.html
karmaworld/templates/partial/add_course.html

index 6515429888282f6164934a0462badd7d63684df7..c3521f0aadb1766658d50e726aa41f02cf0be303 100644 (file)
@@ -171,3 +171,8 @@ table.dataTable tr.even {
   border-top: 2px solid #f0f0f0;
   border-bottom: 2px solid #f0f0f0;
 }
+
+ul.ui-autocomplete {
+  z-index: 1000;
+}
+
index ec86d7651c254566d4e6e5be1664280532438079..0efa0dad3a09572b941cd0433d972f37bf862c35 100644 (file)
@@ -1,5 +1,5 @@
 
-span.course-header-school
+#course-header-school
 {
   font-weight: bold;
 }
index 8a438f08e057ba0f157670e3f0f4b6a0ffef18ae..3b7be385c692819dc53301f4bf7f2cfb321c6e90 100644 (file)
@@ -20,8 +20,6 @@ $(function() {
   };
 
   addCourse = function() {
-    // Show the add a course form
-    $('#add-course-form').dialog("open");
     // Put focus in first input field
     $('#str_school').focus();
   };
@@ -30,15 +28,8 @@ $(function() {
   // of page
   $('#add-course-btn').click(addCourse);
 
-  $('#add-course-form').dialog({
-    autoOpen: false,
-    modal: true,
-    show: { effect: 'fade', duration: 500 },
-    width: dialogWidth()
-  });
-
   if (jump_to_form) {
-    $("#add-course-form").dialog("open");
+    $("#add-course-form").foundation('reveal', 'open');
   }
 
   $("#str_school").autocomplete({
index b3f99410239ff7123d48ac7fca9db48238e7d214..1e9d5e7a64fb84594bee4789b1c8480d004dcf2e 100644 (file)
@@ -20,17 +20,6 @@ $(function() {
     }
   });
 
-  $('#edit-course-form').dialog({
-    autoOpen: false,
-    modal: true,
-    show: { effect: 'fade', duration: 500 },
-    width: dialogWidth()
-  });
-
-  $('#edit-button').click(function(event) {
-    $('#edit-course-form').dialog("open");
-  });
-
   $('#edit-save-btn').click(function(event) {
     $.ajax({
       url: course_edit_url,
@@ -46,8 +35,8 @@ $(function() {
         // on both the client and server side
         $('.validation_error').remove()
         $('#course_form_errors').empty();
-        $('#course_name').text(data.fields.name);
-        $('#course_instructor_name').text(data.fields.instructor_name);
+        $('#course-header-name').text(data.fields.name);
+        $('#course-header-instructor').text(data.fields.instructor_name);
 
         var $externalLinkSquare = $('<i>', {'class': 'fa fa-external-link-square'});
         $('#course_url').text(data.fields.url.slice(0, 50) + ' ');
@@ -58,6 +47,8 @@ $(function() {
         } else {
           $('#course_link').parent().show();
         }
+
+        $('#edit-course-form').foundation('reveal', 'close');
       },
       error: function(resp) {
         var json;
index df60c5382068596ff03c451d2742be4aac4a2cb6..67da5344c28bbd99c906e6887e37aa2f7eefb22e 100644 (file)
@@ -117,18 +117,6 @@ $(function() {
     }
   });
 
-  $('#note-tag-dialog').dialog({
-    title: "Edit note tags",
-    autoOpen: false,
-    modal: true,
-    show: { effect: 'fade', duration: 500 },
-    width: dialogWidth()
-  });
-
-  $('#edit-note-tags').click(function(event) {
-    $('#note-tag-dialog').dialog("open");
-  });
-
   $('#save_note_tags').click(function(event) {
     $.ajax({
       url: edit_note_tags_url,
@@ -141,7 +129,7 @@ $(function() {
         $.each(data.fields.tags, function(index, tag) {
           $('.tags').append($('<span>', { class: 'tag-span', text: tag }));
         });
-        $('#note-tag-dialog').dialog("close");
+        $('#note-tag-dialog').foundation('reveal', 'close');
       }
     });
   });
diff --git a/karmaworld/assets/js/utils.js b/karmaworld/assets/js/utils.js
deleted file mode 100644 (file)
index d621c2a..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-
-function dialogWidth() {
-  var bodyWidth = $('body').width();
-  if (bodyWidth < 700) {
-    return bodyWidth;
-  } else {
-    return 700;
-  }
-}
index c0f5d1b79786151cc9bd7f248c39fd6286fd1eea..b2df969bba7cd6a59354967f2c3c3efc88fea999 100644 (file)
@@ -56,7 +56,6 @@
     {% block bodyscripts %}
     {% endblock %}
     <!-- end block bodyscripts -->
-    <script src="{{ STATIC_URL }}js/utils.js"></script>
     <script src="{{ STATIC_URL }}js/opentip-jquery-excanvas.min.js"></script>
     <script src="{{ STATIC_URL }}js/foundation.min.js"></script>
     <script src="{{ STATIC_URL }}js/foundation.offcanvas.js"></script>
index ea074d5415a4e62e7583dc4004bb58f23285d2dc..32a71eda941436942eec66a0cf7647f81360a94b 100644 (file)
@@ -36,9 +36,9 @@
     <div id="course-header">
       <div class="row header-byline">
         <div class="small-12 columns">
-          <span class="course-header-school">{{ course.school.name }}</span>&nbsp;&nbsp;&bull;&nbsp;&nbsp;
+          <span id="course-header-school">{{ course.school.name }}</span>&nbsp;&nbsp;&bull;&nbsp;&nbsp;
           {% if course.department %}<span class="course-header-department">{{ course.department.name }}</span>&nbsp;&nbsp;&bull;&nbsp;&nbsp;{% endif %}
-          <span class="course-header-instructor">{{ course.instructor_name }}</span>
+          <span id="course-header-instructor">{{ course.instructor_name }}</span>
         </div>
       </div>
 
@@ -53,7 +53,7 @@
             <span class="show-for-large-up">
               {% if user.is_authenticated %}
                 {% if user.get_profile.can_edit_items %}
-                  <button id="edit-button" class="modify-button"> <i class="fa fa-edit"></i> Edit this course</button>&nbsp;&nbsp;
+                  <button id="edit-button" data-reveal-id="edit-course-form" class="modify-button"> <i class="fa fa-edit"></i> Edit this course</button>&nbsp;&nbsp;
                 {% endif %}
 
                 {% if already_flagged %}
@@ -88,7 +88,8 @@
     </div><!-- /course_header -->
 
     {% if user.get_profile.can_edit_items %}
-      <section id="edit-course-form" class="hide">
+      <section id="edit-course-form" class="reveal-modal" data-reveal>
+        <a class="close-reveal-modal">&#215;</a>
         <form>
           {% csrf_token %}
 
         {{ file_upload_form.fp_file }}
       </div>
       <div class="small-12 large-6 columns">
-        <form class="search-notes" action="{% url 'note_search' %}" method="GET">
+        <form style="display: inline" class="search-notes" action="{% url 'note_search' %}" method="GET">
+          <span>
+          <input style="display: inline;" type="hidden" name="course_id" value="{{ course.id }}" />
           <input name="query" class="search-notes" type="text" placeholder="Search Notes" />
-          <input type="hidden" name="course_id" value="{{ course.id }}" />
-          <button type="submit" class="inline-button"><i class="fa fa-search"></i></button>
+          </span>
         </form>
       </div>
       <div class="large-4 columns show-for-large-up">
index c2cdd87ae3af468a7aaa895e30897f2a6942576c..515c8deab98eb3690e32556274a540398567a7ed 100644 (file)
@@ -55,7 +55,7 @@
   <div id="course-search-bar">
     <div class="row">
       <div class="large-2 columns show-for-large-up">
-        <button id="add-course-btn" class="inline-button important">Add a Course</button>
+        <button id="add-course-btn" class="inline-button important" data-reveal-id="add-course-form">Add a Course</button>
       </div>
       <div class="small-12 large-6 columns">
         <input class="search-courses" type="text" placeholder="Search Courses" />
index 8408475c11d4d79e2162c98734a27806ac907e68..c47f50d15a069480f97eb35a82fb3084bdd4d3c2 100644 (file)
               {% endif %}
 
               {% if user.get_profile.can_edit_items %}
-                <button id="edit-note-tags" class="modify-button">
+                <button id="edit-note-tags" class="modify-button" data-reveal-id="note-tag-dialog">
                   <i class="fa fa-pencil-square-o"></i> Edit Tags
                 </button>
               {% endif %}
         </div><!-- /note_tags -->
       </div>
 
-      <div id="note-tag-dialog" class="row">
-        <div class="small-12 columns">
-          <input id="note_tags_input" type="text" value="{% for tag in note.tags.all %}{{ tag.name }}{% if not forloop.last %}, {% endif %}{% endfor %}">
-          <button id="save_note_tags" type=button><i class="fa fa-save"></i> Save</button>
+      <div id="note-tag-dialog" class="reveal-modal" data-reveal>
+        <a class="close-reveal-modal">&#215;</a>
+        <div class="row">
+          <div class="small-12 columns">
+            <p>Edit this note's tags:
+            <input id="note_tags_input" type="text" value="{% for tag in note.tags.all %}{{ tag.name }}{% if not forloop.last %}, {% endif %}{% endfor %}"></p>
+            <button id="save_note_tags" type=button><i class="fa fa-save"></i> Save</button>
+          </div>
         </div>
       </div>
 
index ed560e0b5e598628631a03d26ae4cecd31d72539..70298ffb93986404b968dd4277a951a292e96282 100644 (file)
@@ -1,6 +1,7 @@
 {% load url from future %}
 
-<section id="add-course-form" class="hide">
+<section id="add-course-form" class="reveal-modal" data-reveal>
+  <a class="close-reveal-modal">&#215;</a>
   <form method="POST" action="{% url 'home' %}">
   {% csrf_token %}