Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Image Modal CMS HTML Block subtype #2362

Merged
merged 1 commit into from
Feb 7, 2014
Merged

Conversation

caesar2164
Copy link
Contributor

  • Added YAML file for the HTML template code for the modal to work
  • Added CSS and JS code for modal to look and function properly
  • Updated code to take comments into account.
  • Simplified HTML template and expanded JS to set up image modal on load.
  • Added preliminary drag script.
  • Converted jQuery UI draggable to Draggabilly

@frrrances - here's the image modal branch! with Draggabilly and everything!

Here are some screenshots of how imageModal works. (This is using the Stanford theme, but would work equally well with the default courseware theme.)

When you first load an image modal it presents like this:
screen shot 2014-01-30 at 9 43 56 am

When you click on the image, it goes into the modal interface (starting in "fit to screen"):
screen shot 2014-01-30 at 9 44 17 am

Clicking the + magnifying glass makes the image full size and draggable (via draggabilly):
screen shot 2014-01-30 at 9 44 28 am
screen shot 2014-01-30 at 9 44 43 am

You can click the - magnifying glass to go back to the "fit to screen", or click the X to exit the modal.

@ghost ghost assigned adampalay Jan 29, 2014
@cahrens
Copy link

cahrens commented Jan 30, 2014

Studio team has a story for reviewing this PR (STUD-1256). I recommended to Giulio that he start writing a Jasmine test for imageModal.js. Giulio will also provide documentation on how the feature should work.

@mhoeber Adding you so you are aware of this PR.

@cahrens
Copy link

cahrens commented Jan 31, 2014

At today's planning, Studio thought it made more sense for LMS to review this PR (so @singingwolfboy will not be reviewing). I have moved the Issue, and it is now LMS-2146.

@frrrances
Copy link
Contributor

@caesar2164 I haven't had a chance to check out the new draggabilly version yet, but I wanted to check with you about the other image zoom that was merged to master: will that cover this use case as well? It seems like having two image zoom components might be confusing for course authors. If the other one won't serve, can you outline the reasons why it won't work for your use cases? (I'll be out for a few days next week, but will review this as soon as I'm back.)

@caesar2164
Copy link
Contributor Author

@frrrances - unfortunately, the zooming image won't work for our use case. Also, I think mine is a better starting point for a general "breakout" system to allow users to use their full browser window area, while the zooming image has very limited uses.

Here's a quote from @gbruhns (Stanford courseops) explaining why we need image modal, and can't use "zooming image":

I have a test course with the VPUE Adventures in Writing course content to show why the new "zooming image" HTML component won't work for their course and why it would be good to have Giulio's image modal option. Just to refresh everyone on the VPUE course, they have created animated story boards to present their content. These are large files that get text heavy and shrinking the image down to fit in the courseware pane makes the text hard to read on certain images.

The zooming image component gives the user a magnifying glass and you move your cursor over the image to see that part of the image magnified. I have included a screenshot below. I can see how this would work for certain images, but in the case of a story board where the entire image tells the story, what you really want (and what the VPUE asked for and what Giulio provided) was a way for the image to fill the entire screen and not be bound to the small courseware pane.

Greg

zoomingimage

var currentDraggie = $(this).siblings('.imageModal-imgWrapper').children('img').removeClass('zoomed').attr('id').split('-');
draggie[currentDraggie[1]].disable();
$('html').css({overflow: 'auto'});
});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure how I feel about some of this duplication. Is there any way to split out this logic to a common function where we just pass in a single jQuery object (this or this.closest('.imageModal'), presumably) and do all of the operations on that object?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

@dianakhuang
Copy link
Contributor

@frrrances is out, so @talbs volunteered to help step in and take a look.

// if contents of zoomable link is image and large image link exists: setup modal
if (smallImageObject.is('img') && largeImageSRC) {
var smallImageHTML = $(this).html();
var largeImageHTML = '<img alt="" src="' + largeImageSRC + '" />';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is the alt being deliberately left blank here? Why doesn't use the same alt-text as the small image?

@talbs
Copy link
Contributor

talbs commented Feb 6, 2014

@caesar2164, I noticed you've made some significant changes based on feedback. Thanks for making that effort! Let me know when you're ready for another look through (and it looks like you have some tests failing currently).

@caesar2164
Copy link
Contributor Author

@talbs - Phew, it's not my branch that failed, it;s testing that failed in this case. I'll force Jenkins to try again.

Also, yes please give it another look, I think I've addressed everything.

@@ -235,6 +235,10 @@
<script id="system-feedback-tpl" type="text/template">
<%static:include path="js/system-feedback.underscore" />
</script>

<script type="text/template" id="image-modal-tpl">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be loaded into every Studio page or just the unit editing page where it is needed to reproduce the interaction/UI of the feature when placed in LMS context? @singingwolfboy, not sure if you have a preference on this as well.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The template needs to be present on every page where it might be used, but I don't think that this template can ever be used on any page on Studio except for the unit editing page. Maybe move it to cms/templates/unit.html?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can try unit.html, although I'll have to add the "header_extras" block

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is now done.

@talbs
Copy link
Contributor

talbs commented Feb 6, 2014

@caesar2164, thanks for the ping via HipChat to review the changes you made.

I'm having a very hard time following:

  1. what changes/recommendations/questions you've addressed from my initial review
  2. what resolution (agree, disagree, etc.) you decided to choose for each item addressed
  3. what specific implementation change you made in the cases where you did revise something

Can you please provide comments to my original feedback that supply that info noted above? Once I have that context, I'll be better able to re-review and help support this work.

Thanks!

if (smallImageObject.is('img') && largeImageSRC) {
var smallImageHTML = $(this).html();
var largeImageALT = smallImageObject.attr('alt');
var largeImageHTML = '<img alt="' + largeImageALT + ', ' + gettext("Large") + '" src="' + largeImageSRC + '" />';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you move this HTML into the template, as well? And ideally, the smallImageHTML as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How would I move the smallerImageHTML into the template? I'm currently using the the HTML straight from the Studio input field.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As I explained, I use the HTML from Studio for the small image.

@caesar2164
Copy link
Contributor Author

@singingwolfboy & @talbs - code all updated, running tests and comments all addressed with replies.

Could you guys give it another look?

<%namespace name="units" file="widgets/units.html" />
<%block name="title">${_("Individual Unit")}</%block>
<%block name="bodyclass">is-signedin course unit view-unit</%block>

<%block name="header_extras">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doing this will load the script into the head of the HTML structure, correct? For optimization's sake, should this be called right before the </body> to help with page loading and asset gathering?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The template will load wherever the <%block name="header_extras"> is located in <head>...

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. My original concern stands - if this script is not necessary to support the page loading, it should be placed before the close of the body element (which will allow it to not be a dependency that will slow down the loading of the DOM and basic page functions).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This script IS necessary for page load IF there is an image-modal in the unit that is being loaded.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Allow me to clarify further, is this script necessary for the base state (layout, content, etc.) of the page to load?

If not, then I would call it from later in the DOM (i.e. right before the body element closes). See http://www.feedthebot.com/pagespeed/prioritize-visible-content.html for a simple explanation of what JavaScript calls do within the head to loading the basic HTML of the page requested.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done, moved script to <js_extra>

@singingwolfboy
Copy link
Contributor

Looks good to me! 👍

@talbs
Copy link
Contributor

talbs commented Feb 6, 2014

@caesar2164 did you see my comment above about explaining your revisions with respect to my feedback (which GH squashed to outdated diffs)? I'll review once more when I can follow your decisions.

@caesar2164
Copy link
Contributor Author

@talbs I commented on each of your previous comments

@dianakhuang
Copy link
Contributor

👍

@caesar2164
Copy link
Contributor Author

Thanks @dianakhuang!

@dianakhuang
Copy link
Contributor

I definitely want @talbs to sign off before merge, though.

@caesar2164
Copy link
Contributor Author

@dianakhuang, of course! 😄

width: 95%;
margin: auto;
overflow: hidden;
top: 2.5%;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The ordering here is still incorrect - please place any top, left, bottom, right rules next to the position rule for easier comprehension

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

@caesar2164
Copy link
Contributor Author

@talbs, that should be all your comments addressed now. Let me know.

@talbs
Copy link
Contributor

talbs commented Feb 7, 2014

Thanks for addressing all of my concerns, @caesar2164. The extra effort is much appreciated.

👍

- Added YAML file for the HTML template code for the modal to work
- Added CSS and JS code for modal to look and function properly
- Updated code to take comments into account.
- Simplified HTML template and expanded JS to set up image modal on load.
- Added preliminary drag script.
- Converted jQuery UI draggable to Draggabilly
caesar2164 added a commit that referenced this pull request Feb 7, 2014
@caesar2164 caesar2164 merged commit 7320513 into master Feb 7, 2014
@caesar2164 caesar2164 deleted the giulio/image-modal-squash branch February 7, 2014 17:41
jenkins-ks pushed a commit to nttks/edx-platform that referenced this pull request Dec 22, 2017
* Correctly format date block dates.

(cherry picked from commit 22cb307)

* ECOM-3673 Update the course end date description text to remove the reference to certificate when course enrollment is in audit mode

(cherry picked from commit 649e8b1)

* Fixes for courseware date formatting/translation.

(cherry picked from commit 80bfa36)

 Conflicts:
	lms/djangoapps/courseware/date_summary.py

* Fix date summaries with Unicode format issues.

This issue would show up when date formatting strings are translated
with Unicode characters (like when testing with fake Esperanto
translations).

(cherry picked from commit c1a59cc)

* Converts the dates on the dashboard, sidebar navigation, and important course dates to user specified time zone.

(cherry picked from commit 0bf8fc4)

 Conflicts:
	common/djangoapps/util/date_utils.py
	common/lib/xmodule/xmodule/course_module.py
	common/lib/xmodule/xmodule/tests/test_course_metadata_utils.py
	lms/djangoapps/ccx/tests/test_models.py
	lms/djangoapps/courseware/views/index.py
	lms/djangoapps/student_account/views.py
	lms/templates/dashboard/_dashboard_course_listing.html
	openedx/core/djangoapps/content/course_overviews/models.py
	openedx/core/djangoapps/user_api/preferences/api.py
	openedx/core/djangoapps/user_api/preferences/tests/test_views.py

* Display JST for survey's answer datetime. openedx#2146

* Display JST for section's deadline and course start/end datetime. openedx#2146

* Display JST for face-to-face start/end datetime on Django Admin. openedx#2146

* Display JST for ORA2 settings. openedx#2146

* Add the validation of the schedule dates before 1900 openedx#2284 (openedx#2298)

* Implements command count_initial_registration_course openedx#2221 (openedx#2296)

* Add GaCourseEditorRole and GaLmsCourseStaffRole openedx#2150 (openedx#2306)

* Add GaCourseEditorRole and GaLmsCourseStaffRole openedx#2150

* Add UT for studio openedx#2150

* Fix GaCourseEditor has access to after the course closed openedx#2150

* GaLmsCourseStaff can use the same function as the course staff at the staff debug info openedx#2150

* Fix UT and Bok choy openedx#2150

* Remove extra line feed openedx#2150

* Fix comment openedx#2150

* Mod conditions openedx#2150

* Move judgment conditions to template openedx#2150

* Fix comment openedx#2150

* Remove unused code openedx#2150

* Mod conditions for GaCourseEditor but a global staff openedx#2150

* Revert parameter CourseDetails.update_from_json openedx#2150

* Mod check for staff acccess at LMS for GaCourseEditor openedx#2150

* Rename GaCourseEditorRole -> GaGlobalCourseCreatorRole openedx#2150

* Rename GA_COURSE_EDITOR_USER_INFO -> GA_GLOBAL_COURSE_CREATOR_USER_INFO openedx#2150

* Rename GA_ACCESS_CHECK_TYPE_COURSE_EDITOR -> GA_ACCESS_CHECK_TYPE_GLOBAL_COURSE_CREATOR openedx#2150

* Rename Ga_Course_Editor -> Ga_Global_Course_Creator openedx#2150

* Rename gacourseeditor -> gaglobalcoursecreator openedx#2150

* Rename GaCourseEditor -> GaGlobalCourseCreator openedx#2150

* Rename course_editor -> global_course_creator openedx#2150

* Mod hide staff debug info for GaGlobalCourseCreatorRole openedx#2150

* Fix UT for GaGlobalCourseCreator openedx#2150

* Rename UT openedx#2150

* Fix skipped UT openedx#2150

* Remove unused code openedx#2150

* Fix argument openedx#2150

* Remove unused code openedx#2150

* Fix ambiguous conditions openedx#2150

* Rename GaLmsCourseStaffRole -> GaCourseScorerRole openedx#2150

* Rename GA_LMS_COURSE_STAFF_USER_INFO -> GA_COURSE_SCORER_USER_INFO openedx#2150

* Ga_Lms_Course_Staff -> Ga_Course_Scorer openedx#2150

* Rename galmscoursestaff -> gacoursescorer openedx#2150

* Rename GaLmsCourseStaff -> GaCourseScorer openedx#2150

* Rename lms_course_staff -> course_scorer openedx#2150

* Fix translation openedx#2150

* Fix comment openedx#2150

*  Add personal info mask at resign openedx#2148 (openedx#2316)

* Add personal info mask at unenroll openedx#2148

* Fix Review.

* Add Unit Test.

* Add JST date fields near UTC date fields. openedx#2230 (openedx#2307)

* Add JST date fields near UTC date fields. openedx#2230

* Fix Review

* Fix Review 2.

* Add yml Files

* Add option of progress restriction that makes users need to pass prob… (openedx#2305)

* Add option of progress restriction that makes users need to pass problems. openedx#2147

* Skip Bok-Choy CoursewareProgressRestrictionTest temporarily
because this may cause an error of other test

* Fix review 1 openedx#2147

* Fix review 2 openedx#2147

* Fix to use different username and email from test_ga_register.py
so that no error occurs on test_register_and_activate. openedx#2147

* Fix review 3 openedx#2147

* Fix review 4 openedx#2147

* Fix review 5-1

* Fix review 5-2

* Fix review 5-3

* Fix review 5-4

* Fix review 5-5

* Fix review 5-6

* Fix review 5-7

* Fix review 5-8

* Fix review 5-9

* Fix review 5-10

* Fix review 5-12

* Fix review 5-14
revert 5-13

* Fix review 5-15

* Fix review 5-16

* Fix review 6-1 openedx#2147

* Fix review 6-2 openedx#2147

* Fix review 6-3 openedx#2147

* Fix UTC message in survey page. openedx#2340 (openedx#2345)

* Fix bug for manage_user_standing page. openedx#2347 (openedx#2348)

* Fix bug and add failed testcase for mask_resigned_user command. openedx#2362 (openedx#2365)

* Add confirm for account_disabled of manage_user_standing openedx#2366 (openedx#2367)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
open-source-contribution PR author is not from Axim or 2U
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants