From f7de4b44c56d14d2711b31c926e5019be58d093f Mon Sep 17 00:00:00 2001 From: Charles Connell Date: Sat, 29 Mar 2014 17:16:35 -0400 Subject: [PATCH] Switch to foundation modals --- karmaworld/assets/css/global.css | 5 +++++ karmaworld/assets/css/note_course_pages.css | 2 +- karmaworld/assets/js/add-course.js | 11 +---------- karmaworld/assets/js/course-detail.js | 17 ++++------------- karmaworld/assets/js/note-detail.js | 14 +------------- karmaworld/assets/js/utils.js | 9 --------- karmaworld/templates/base.html | 1 - karmaworld/templates/courses/course_detail.html | 16 +++++++++------- karmaworld/templates/courses/course_list.html | 2 +- karmaworld/templates/notes/note_detail.html | 14 +++++++++----- karmaworld/templates/partial/add_course.html | 3 ++- 11 files changed, 33 insertions(+), 61 deletions(-) delete mode 100644 karmaworld/assets/js/utils.js diff --git a/karmaworld/assets/css/global.css b/karmaworld/assets/css/global.css index 6515429..c3521f0 100644 --- a/karmaworld/assets/css/global.css +++ b/karmaworld/assets/css/global.css @@ -171,3 +171,8 @@ table.dataTable tr.even { border-top: 2px solid #f0f0f0; border-bottom: 2px solid #f0f0f0; } + +ul.ui-autocomplete { + z-index: 1000; +} + diff --git a/karmaworld/assets/css/note_course_pages.css b/karmaworld/assets/css/note_course_pages.css index ec86d76..0efa0da 100644 --- a/karmaworld/assets/css/note_course_pages.css +++ b/karmaworld/assets/css/note_course_pages.css @@ -1,5 +1,5 @@ -span.course-header-school +#course-header-school { font-weight: bold; } diff --git a/karmaworld/assets/js/add-course.js b/karmaworld/assets/js/add-course.js index 8a438f0..3b7be38 100644 --- a/karmaworld/assets/js/add-course.js +++ b/karmaworld/assets/js/add-course.js @@ -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({ diff --git a/karmaworld/assets/js/course-detail.js b/karmaworld/assets/js/course-detail.js index b3f9941..1e9d5e7 100644 --- a/karmaworld/assets/js/course-detail.js +++ b/karmaworld/assets/js/course-detail.js @@ -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 = $('', {'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; diff --git a/karmaworld/assets/js/note-detail.js b/karmaworld/assets/js/note-detail.js index df60c53..67da534 100644 --- a/karmaworld/assets/js/note-detail.js +++ b/karmaworld/assets/js/note-detail.js @@ -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($('', { 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 index d621c2a..0000000 --- a/karmaworld/assets/js/utils.js +++ /dev/null @@ -1,9 +0,0 @@ - -function dialogWidth() { - var bodyWidth = $('body').width(); - if (bodyWidth < 700) { - return bodyWidth; - } else { - return 700; - } -} diff --git a/karmaworld/templates/base.html b/karmaworld/templates/base.html index c0f5d1b..b2df969 100644 --- a/karmaworld/templates/base.html +++ b/karmaworld/templates/base.html @@ -56,7 +56,6 @@ {% block bodyscripts %} {% endblock %} - diff --git a/karmaworld/templates/courses/course_detail.html b/karmaworld/templates/courses/course_detail.html index ea074d5..32a71ed 100644 --- a/karmaworld/templates/courses/course_detail.html +++ b/karmaworld/templates/courses/course_detail.html @@ -36,9 +36,9 @@
@@ -53,7 +53,7 @@ {% if user.is_authenticated %} {% if user.get_profile.can_edit_items %} -    +    {% endif %} {% if already_flagged %} @@ -88,7 +88,8 @@
{% if user.get_profile.can_edit_items %} -
+
+ ×
{% csrf_token %} @@ -147,10 +148,11 @@ {{ file_upload_form.fp_file }}
- + + + - - +
diff --git a/karmaworld/templates/courses/course_list.html b/karmaworld/templates/courses/course_list.html index c2cdd87..515c8de 100644 --- a/karmaworld/templates/courses/course_list.html +++ b/karmaworld/templates/courses/course_list.html @@ -55,7 +55,7 @@