diff --git a/common/lib/xmodule/xmodule/course_module.py b/common/lib/xmodule/xmodule/course_module.py index 884dc40df2e54b9f2e1ba6536f47e913b78dcac8..e00e62a7c03e52aff48b40c78c7b584c40968799 100644 --- a/common/lib/xmodule/xmodule/course_module.py +++ b/common/lib/xmodule/xmodule/course_module.py @@ -29,7 +29,7 @@ class CourseDescriptor(SequenceDescriptor): def has_started(self): return time.gmtime() > self.start - + @classmethod def id_to_location(cls, course_id): org, course, name = course_id.split('/') @@ -39,6 +39,10 @@ class CourseDescriptor(SequenceDescriptor): def id(self): return "/".join([self.location.org, self.location.course, self.location.name]) + @property + def start_date_text(self): + return time.strftime("%m/%d/%y", self.start) + @property def title(self): return self.metadata['display_name'] @@ -86,8 +90,8 @@ class CourseDescriptor(SequenceDescriptor): with self.system.resources_fs.open(path("about") / section_key + ".html") as htmlFile: return htmlFile.read().decode('utf-8') except ResourceNotFoundError: - log.exception("Missing about section {key} in course {url}".format(key=section_key, url=self.location.url())) - return "! About section missing !" + log.warning("Missing about section {key} in course {url}".format(key=section_key, url=self.location.url())) + return None elif section_key == "title": return self.metadata.get('display_name', self.name) elif section_key == "university": diff --git a/lms/static/js/toggle_login_modal.js b/lms/static/js/toggle_login_modal.js index 59d83a0dad85eb6de06b3d27a2e5be5323911184..a92c61624506a2d6fd7422962022f49922d30b4e 100644 --- a/lms/static/js/toggle_login_modal.js +++ b/lms/static/js/toggle_login_modal.js @@ -48,6 +48,11 @@ }) $(modal_id).fadeTo(200,1); + $(modal_id).find(".notice").hide().html(""); + var notice = $(this).data('notice') + if(notice !== undefined) { + $(modal_id).find(".notice").show().html(notice); + } e.preventDefault(); }); diff --git a/lms/static/sass/shared/_modal.scss b/lms/static/sass/shared/_modal.scss index 4113eb7f41198fb669179ceb1e2cdcc62bc385c0..1ac3bbcbb274bf0c3fa67f888536d8aaaa5d9fc4 100644 --- a/lms/static/sass/shared/_modal.scss +++ b/lms/static/sass/shared/_modal.scss @@ -115,7 +115,16 @@ padding: 12px; } - .activation-message, .message { + .activation-message, .message, .notice { + background: $yellow; + border: 1px solid darken($yellow, 60%); + color: darken($yellow, 60%); + display: none; + margin-bottom: 20px; + padding: 12px; + } + + .activation-message { padding: 0 40px 10px; p { diff --git a/lms/templates/course.html b/lms/templates/course.html index 37a25c75266b0c887db0b303ffa2c1b19f4a9b08..c22ff349eafdce7831764bfacebe5d8bd817db07 100644 --- a/lms/templates/course.html +++ b/lms/templates/course.html @@ -23,7 +23,7 @@ </div> <div class="bottom"> <a href="#" class="university">${course.get_about_section('university')}</a> - <span class="start-date">7/23/12</span> + <span class="start-date">${course.start_date_text}</span> </div> </section> </div> diff --git a/lms/templates/portal/course_about.html b/lms/templates/portal/course_about.html index 112333694fc0bc31300c5c64fee1f573148fe6d2..51e769a3a44a1303ae266a3c0e11a274d227c652 100644 --- a/lms/templates/portal/course_about.html +++ b/lms/templates/portal/course_about.html @@ -15,16 +15,22 @@ </hgroup> <div class="main-cta"> - <a href="${reverse('enroll', args=[course.id])}" class="register">Register</a> + %if user.is_authenticated(): + <a href="${reverse('enroll', args=[course.id])}" class="register">Register</a> + %else: + <a href="#signup-modal" class="register" rel="leanModal" data-notice="You must register in order to enroll">Register</a> + %endif </div> </section> + % if course.get_about_section("video"): <a href="#video-modal" class="media" rel="leanModal"> <div class="hero"> <img src="${static.url('images/courses/circuits.jpeg')}" /> <div class="play-intro"></div> </div> </a> + % endif </div> </header> @@ -62,7 +68,7 @@ </header> <ol class="important-dates"> - <li><div class="icon start-icon"></div><p>Classes Start</p><span class="start-date">7/12/12</span></li> + <li><div class="icon start-icon"></div><p>Classes Start</p><span class="start-date">${course.start_date_text}</span></li> ##<li><div class="icon final-icon"></div><p>Final Exam</p><span class="final-date">12/09/12</span></li> ##<li><div class="icon length-icon"></div><p>Course Length</p><span class="course-length">15 weeks</span></li> <li><div class="icon number-icon"></div><p>Course Number</p><span class="course-number">${course.number}</span></li> diff --git a/lms/templates/signup_modal.html b/lms/templates/signup_modal.html index 3ab940c58e9bafef4a0ad941e74580c80a963cf1..d22dc8e9a063a7a856332c61ad0ea84164092dfd 100644 --- a/lms/templates/signup_modal.html +++ b/lms/templates/signup_modal.html @@ -10,7 +10,9 @@ </header> <form id="enroll_form" method="post" data-remote="true" action="/create_account"> + <div class="notice"></div> <div id="enroll_error" class="modal-form-error" name="enroll_error"></div> + <div id="enroll_error" name="enroll_error"></div> <label>E-mail</label> <input name="email" type="email" placeholder="E-mail"> <label>Password</label>