Commit a0a46c46 by alisan617

add new unit page title TNL-5623

new bookmark button placement and look TNL-5625
parent 2b80c619
...@@ -65,6 +65,7 @@ class VerticalBlock(SequenceFields, XModuleFields, StudioEditableBlock, XmlParse ...@@ -65,6 +65,7 @@ class VerticalBlock(SequenceFields, XModuleFields, StudioEditableBlock, XmlParse
fragment.add_content(self.system.render_template('vert_module.html', { fragment.add_content(self.system.render_template('vert_module.html', {
'items': contents, 'items': contents,
'xblock_context': context, 'xblock_context': context,
'unit_title': self.display_name_with_default,
'show_bookmark_button': True, 'show_bookmark_button': True,
'bookmarked': child_context['bookmarked'], 'bookmarked': child_context['bookmarked'],
'bookmark_id': "{},{}".format(child_context['username'], unicode(self.location)) 'bookmark_id': "{},{}".format(child_context['username'], unicode(self.location))
......
...@@ -267,6 +267,10 @@ class CoursewarePage(CoursePage): ...@@ -267,6 +267,10 @@ class CoursewarePage(CoursePage):
""" Return the course tree breadcrumb shown above the sequential bar """ """ Return the course tree breadcrumb shown above the sequential bar """
return [part.strip() for part in self.q(css='.path').text[0].split('>')] return [part.strip() for part in self.q(css='.path').text[0].split('>')]
def unit_title_visible(self):
""" Check if unit title is visible """
return self.q(css='.unit-title').visible
def bookmark_button_visible(self): def bookmark_button_visible(self):
""" Check if bookmark button is visible """ """ Check if bookmark button is visible """
EmptyPromise(lambda: self.q(css='.bookmark-button').visible, "Bookmark button visible").fulfill() EmptyPromise(lambda: self.q(css='.bookmark-button').visible, "Bookmark button visible").fulfill()
......
...@@ -6,7 +6,9 @@ ...@@ -6,7 +6,9 @@
errorMessage: gettext('An error has occurred. Please try again.'), errorMessage: gettext('An error has occurred. Please try again.'),
srAddBookmarkText: gettext('Click to add'), srAddBookmarkText: gettext('Click to add'),
bookmarkText: gettext('Bookmark this page'),
srRemoveBookmarkText: gettext('Click to remove'), srRemoveBookmarkText: gettext('Click to remove'),
bookmarkedText: gettext('Bookmarked'),
events: { events: {
'click': 'toggleBookmark' 'click': 'toggleBookmark'
...@@ -85,10 +87,12 @@ ...@@ -85,10 +87,12 @@
if (bookmarked) { if (bookmarked) {
this.$el.addClass('bookmarked'); this.$el.addClass('bookmarked');
this.$el.attr('aria-pressed', 'true'); this.$el.attr('aria-pressed', 'true');
this.$el.find('.bookmark-text').text(this.bookmarkedText);
this.$el.find('.bookmark-sr').text(this.srRemoveBookmarkText); this.$el.find('.bookmark-sr').text(this.srRemoveBookmarkText);
} else { } else {
this.$el.removeClass('bookmarked'); this.$el.removeClass('bookmarked');
this.$el.attr('aria-pressed', 'false'); this.$el.attr('aria-pressed', 'false');
this.$el.find('.bookmark-text').text(this.bookmarkText);
this.$el.find('.bookmark-sr').text(this.srAddBookmarkText); this.$el.find('.bookmark-sr').text(this.srAddBookmarkText);
} }
}, },
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
aria-pressed="false" aria-pressed="false"
data-bookmark-id="bilbo,usage_1"> data-bookmark-id="bilbo,usage_1">
<span class="sr bookmark-sr"></span>&nbsp; <span class="sr bookmark-sr"></span>&nbsp;
Bookmark <span class="bookmark-text">Bookmark this page</span>
</button> </button>
</div> </div>
</div> </div>
...@@ -121,5 +121,12 @@ $headings-base-color: $gray-d2; ...@@ -121,5 +121,12 @@ $headings-base-color: $gray-d2;
font-weight: $headings-font-weight-normal; font-weight: $headings-font-weight-normal;
// override external modules and xblocks that use inline CSS // override external modules and xblocks that use inline CSS
text-transform: initial; text-transform: initial;
&.unit-title {
margin-bottom: 0;
font-size: 1.5em;
}
} }
} }
...@@ -22,9 +22,8 @@ html.video-fullscreen { ...@@ -22,9 +22,8 @@ html.video-fullscreen {
overflow: hidden; overflow: hidden;
&.studio-view { &.studio-view {
position: relative;
top: -($baseline/2);
margin: 0; margin: 0;
display: inline;
} }
.instructor-info-action { .instructor-info-action {
......
$bookmark-icon: "\f097"; // .fa-bookmark-o
$bookmarked-icon: "\f02e"; // .fa-bookmark
// Rules for placing bookmarks and search button side by side // Rules for placing bookmarks and search button side by side
.wrapper-course-modes { .wrapper-course-modes {
border-bottom: 1px solid $gray-l3; border-bottom: 1px solid $gray-l3;
...@@ -25,7 +28,7 @@ ...@@ -25,7 +28,7 @@
padding: ($baseline/4) ($baseline/2); padding: ($baseline/4) ($baseline/2);
&:before { &:before {
content: "\f02e"; content: $bookmarked-icon;
font-family: FontAwesome; font-family: FontAwesome;
} }
...@@ -80,7 +83,7 @@ ...@@ -80,7 +83,7 @@
} }
.bookmarks-results-list-item:before { .bookmarks-results-list-item:before {
content: "\f02e"; content: $bookmarked-icon;
position: relative; position: relative;
top: -7px; top: -7px;
font-family: FontAwesome; font-family: FontAwesome;
...@@ -133,42 +136,34 @@ ...@@ -133,42 +136,34 @@
.course-content { .course-content {
.bookmark-icon.bookmarked { .bookmark-icon.bookmarked {
@include left($baseline / 4);
top: -3px; top: -3px;
position: absolute; position: absolute;
left: ($baseline/4);
} }
// Rules for bookmark button's different styles // Rules for bookmark button's different styles
.bookmark-button-wrapper { .bookmark-button-wrapper {
text-align: right; margin-bottom: ($baseline * 1.5);
margin-bottom: 10px;
} }
.bookmark-button { .bookmark-button {
@extend %ui-clear-button;
@extend %btn-pl-default-base;
@include font-size(13);
padding: ($baseline/4) ($baseline/2);
&:before { &:before {
content: "\f02e"; content: $bookmark-icon;
font-family: FontAwesome; font-family: FontAwesome;
} }
&.is-active {
background-color: lighten($action-primary-bg,10%);
color: $white;
}
&.bookmarked { &.bookmarked {
background-color: lighten($action-primary-bg,10%);
color: $white;
&:before { &:before {
content: "\f097"; content: $bookmarked-icon;
font-family: FontAwesome;
} }
} }
}
.bookmark-sr {
@include margin-right($baseline / 4);
} }
} }
<%page expression_filter="h" args="bookmark_id, is_bookmarked" />
<%! from django.utils.translation import ugettext as _ %> <%! from django.utils.translation import ugettext as _ %>
<%page args="bookmark_id, is_bookmarked" />
<div class="bookmark-button-wrapper"> <div class="bookmark-button-wrapper">
<button class="btn bookmark-button ${"bookmarked" if is_bookmarked else ""}" <button class="btn btn-link bookmark-button ${"bookmarked" if is_bookmarked else ""}"
aria-pressed="${"true" if is_bookmarked else "false"}" aria-pressed="${"true" if is_bookmarked else "false"}"
data-bookmark-id="${bookmark_id}"> data-bookmark-id="${bookmark_id}">
<span class="sr bookmark-sr">${_("Click to remove") if is_bookmarked else _("Click to add")}</span>&nbsp; <span class="sr bookmark-sr">${_("Click to remove") if is_bookmarked else _("Click to add")}</span>
${_("Bookmark")} <span class="bookmark-text">${_("Bookmarked") if is_bookmarked else _("Bookmark this page")}</span>
</button> </button>
</div> </div>
<%page expression_filter="h"/> <%page expression_filter="h"/>
<%! from openedx.core.djangolib.markup import HTML %>
%if unit_title:
<h3 class="unit-title">${unit_title}</h3>
% endif
% if show_bookmark_button: % if show_bookmark_button:
<%include file='bookmark_button.html' args="bookmark_id=bookmark_id, is_bookmarked=bookmarked"/> <%include file='bookmark_button.html' args="bookmark_id=bookmark_id, is_bookmarked=bookmarked"/>
...@@ -7,7 +11,7 @@ ...@@ -7,7 +11,7 @@
<div class="vert-mod"> <div class="vert-mod">
% for idx, item in enumerate(items): % for idx, item in enumerate(items):
<div class="vert vert-${idx}" data-id="${item['id']}"> <div class="vert vert-${idx}" data-id="${item['id']}">
${item['content'] | n, unicode} ${HTML(item['content'])}
</div> </div>
% endfor % endfor
</div> </div>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment