Skip to content

Commit a199471

Browse files
committed
feat: [FC-0070] add message events and styles to the library content page
1 parent 971afe6 commit a199471

File tree

4 files changed

+108
-24
lines changed

4 files changed

+108
-24
lines changed

cms/static/js/views/pages/container.js

+21-4
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ function($, _, Backbone, gettext, BasePage,
3939
'click .manage-tags-button': 'openManageTags',
4040
'change .header-library-checkbox': 'toggleLibraryComponent',
4141
'click .collapse-button': 'collapseXBlock',
42+
'click .xblock-view-action-button': 'viewXBlockContent',
4243
},
4344

4445
options: {
@@ -717,10 +718,6 @@ function($, _, Backbone, gettext, BasePage,
717718
this.deleteComponent(this.findXBlockElement(event.target));
718719
},
719720

720-
createPlaceholderElement: function() {
721-
return $('<div/>', {class: 'studio-xblock-wrapper'});
722-
},
723-
724721
createComponent: function(template, target) {
725722
// A placeholder element is created in the correct location for the new xblock
726723
// and then onNewXBlock will replace it with a rendering of the xblock. Note that
@@ -814,6 +811,26 @@ function($, _, Backbone, gettext, BasePage,
814811
}
815812
},
816813

814+
viewXBlockContent: function(event) {
815+
try {
816+
if (this.options.isIframeEmbed) {
817+
event.preventDefault();
818+
var usageId = event.currentTarget.href.split('/').pop() || '';
819+
window.parent.postMessage(
820+
{
821+
type: 'handleViewXBlockContent',
822+
payload: {
823+
usageId: usageId,
824+
},
825+
}, document.referrer
826+
);
827+
return true;
828+
}
829+
} catch (e) {
830+
console.error(e);
831+
}
832+
},
833+
817834
toggleSaveButton: function() {
818835
var $saveButton = $('.nav-actions .save-button');
819836
if (JSON.stringify(this.selectedLibraryComponents.sort()) === JSON.stringify(this.storedSelectedLibraryComponents.sort())) {

cms/static/sass/course-unit-mfe-iframe-bundle.scss

+81-19
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,22 @@
11
@import 'cms/theme/variables-v1';
22
@import 'elements/course-unit-mfe-iframe';
33

4+
body {
5+
min-width: 800px;
6+
}
7+
48
.wrapper {
9+
.inner-wrapper {
10+
max-width: 100%;
11+
}
12+
513
.wrapper-xblock {
614
background-color: $transparent;
715
border-radius: 6px;
816
border: none;
917

1018
&:hover {
11-
border-color: none;
19+
border-color: transparent;
1220
}
1321

1422
.xblock-header-primary {
@@ -23,6 +31,54 @@
2331
}
2432
}
2533

34+
.xblock-header-secondary {
35+
border-radius: 0 0 4px 4px;
36+
37+
.actions-list .action-item .action-button {
38+
border-radius: 4px;
39+
40+
&:hover {
41+
background-color: $primary;
42+
color: $white;
43+
}
44+
}
45+
}
46+
47+
&.level-page .xblock-message {
48+
padding: ($baseline * .75) ($baseline * 1.2);
49+
border-radius: 0 0 4px 4px;
50+
51+
&.information {
52+
color: $text-color;
53+
background-color: $xblock-message-info-bg;
54+
border-color: $xblock-message-info-border-color;
55+
}
56+
57+
&.validation.has-warnings {
58+
color: $black;
59+
background-color: $xblock-message-warning-bg;
60+
border-color: $xblock-message-warning-border-color;
61+
border-top-width: 1px;
62+
63+
.icon {
64+
color: $xblock-message-warning-border-color;
65+
}
66+
}
67+
68+
a {
69+
color: $primary;
70+
}
71+
}
72+
73+
.xblock-author_view-library_content > .wrapper-xblock-message .xblock-message {
74+
font-size: 16px;
75+
line-height: 22px;
76+
border-radius: 4px;
77+
padding: ($baseline * 1.2);
78+
box-shadow: 0 1px 2px rgba(0, 0, 0, .15), 0 1px 4px rgba(0, 0, 0, .15);
79+
margin-bottom: ($baseline * 1.4);
80+
}
81+
2682
&.level-element {
2783
box-shadow: 0 2px 4px rgba(0, 0, 0, .15), 0 2px 8px rgba(0, 0, 0, .15);
2884
margin: 0 0 ($baseline * 1.4) 0;
@@ -40,27 +96,33 @@
4096
border-bottom-right-radius: 6px;
4197
}
4298

43-
.wrapper-xblock .header-actions .actions-list .action-item .action-button {
44-
@extend %button-styles;
45-
46-
color: $primary;
47-
48-
.fa-ellipsis-v {
49-
font-size: $base-font-size;
99+
.wrapper-xblock .header-actions .actions-list {
100+
.action-actions-menu:last-of-type .nav-sub {
101+
right: 120px;
50102
}
51103

52-
&:hover {
53-
background-color: $primary;
54-
color: $white;
55-
border-color: $transparent;
56-
}
104+
.action-item .action-button {
105+
@extend %button-styles;
57106

58-
&:focus {
59-
outline: 2px $transparent;
60-
background-color: $transparent;
61-
box-shadow: inset 0 0 0 2px $primary;
62107
color: $primary;
63-
border-color: $transparent;
108+
109+
.fa-ellipsis-v {
110+
font-size: $base-font-size;
111+
}
112+
113+
&:hover {
114+
background-color: $primary;
115+
color: $white;
116+
border-color: $transparent;
117+
}
118+
119+
&:focus {
120+
outline: 2px $transparent;
121+
background-color: $transparent;
122+
box-shadow: inset 0 0 0 2px $primary;
123+
color: $primary;
124+
border-color: $transparent;
125+
}
64126
}
65127
}
66128

@@ -629,7 +691,7 @@ select {
629691
}
630692
}
631693

632-
.xblock-header-primary {
694+
.xblock-header:not(.xblock-header-library_content, .xblock-header-split_test) .xblock-header-primary {
633695
position: relative;
634696

635697
&::before {

cms/static/sass/partials/cms/theme/_variables-v1.scss

+5
Original file line numberDiff line numberDiff line change
@@ -313,3 +313,8 @@ $light-background-color: #e1dddb !default;
313313
$border-color: #707070 !default;
314314
$base-font-size: 18px !default;
315315
$dark: #212529;
316+
317+
$xblock-message-info-bg: #eff8fa;
318+
$xblock-message-info-border-color: #9cd2e6;
319+
$xblock-message-warning-bg: #fffdf0;
320+
$xblock-message-warning-border-color: #fff6bf;

cms/templates/studio_xblock_wrapper.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@
229229
<div class="meta-info">${_('This block contains multiple components.')}</div>
230230
<ul class="actions-list">
231231
<li class="action-item action-view">
232-
<a href="${xblock_url}" class="action-button">
232+
<a href="${xblock_url}" class="action-button xblock-view-action-button">
233233
## Translators: this is a verb describing the action of viewing more details
234234
<span class="action-button-text">${('View')}</span>
235235
<span class="icon fa fa-arrow-right" aria-hidden="true"></span>

0 commit comments

Comments
 (0)