Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
afd82771
Commit
afd82771
authored
Apr 16, 2014
by
Adam
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3101 from edx/talbs/ui-disabled
UI: Disabled Utility Classes
parents
ce330374
7636ad32
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
106 additions
and
7 deletions
+106
-7
cms/static/sass/_base.scss
+9
-1
cms/static/sass/elements/_controls.scss
+15
-0
cms/static/sass/views/_unit.scss
+10
-1
common/static/js/spec/CSS3_workarounds_spec.js
+40
-0
common/static/js/src/CSS3_workarounds.js
+17
-0
common/static/sass/_mixins.scss
+1
-0
lms/static/sass/base/_base.scss
+13
-5
lms/static/sass/base/_mixins.scss
+1
-0
No files found.
cms/static/sass/_base.scss
View file @
afd82771
...
...
@@ -782,12 +782,20 @@ hr.divide {
// ====================
// basic utility
// UI - semantically hide text
.sr
{
@extend
%cont-text-sr
;
}
// UI - faking a link's behavior
.fake-link
{
cursor
:
pointer
;
@extend
%ui-fake-link
;
}
// UI - disabled
.is-disabled
{
@extend
%ui-disabled
;
}
.non-list
{
...
...
cms/static/sass/elements/_controls.scss
View file @
afd82771
// studio - elements - UI controls
// ====================
// ====================
// general actions
%action
{
@extend
%ui-fake-link
;
&
.is-disabled
{
@extend
%ui-disabled
;
-webkit-filter
:
grayscale
(
65%
);
opacity
:
0
.65
;
}
}
// ====================
// gray primary button
%btn-primary-gray
{
@extend
%ui-btn-primary
;
...
...
cms/static/sass/views/_unit.scss
View file @
afd82771
...
...
@@ -1038,6 +1038,7 @@ body.unit {
padding
:
$baseline
/
2
$baseline
;
}
.unit-actions
{
border-bottom
:
none
;
padding-bottom
:
0
;
...
...
@@ -1055,8 +1056,16 @@ body.unit {
div
{
margin-top
:
15px
;
}
}
// actions - publish/edit
.publish-draft
{
@extend
%action
;
}
.create-draft
{
@extend
%action
;
}
}
input
[
type
=
"radio"
]
{
...
...
common/static/js/spec/CSS3_workarounds_spec.js
0 → 100644
View file @
afd82771
describe
(
"CSS3 workarounds"
,
function
()
{
describe
(
"pointer-events"
,
function
()
{
beforeEach
(
function
()
{
var
html
=
"<a href='#' class='ui-disabled'>What wondrous life in this I lead</a>"
;
setFixtures
(
html
);
});
it
(
"should not prevent default when pointerEvents is supported"
,
function
()
{
// In case this test suite is being run in a browser where
// 'pointerEvents' is not supported, mock out document.body.style
// so that it includes 'pointerEvents'
var
mockBodyStyle
=
document
.
body
.
style
;
if
(
!
(
"pointerEvents"
in
mockBodyStyle
))
{
mockBodyStyle
[
"pointerEvents"
]
=
""
;
};
pointerEventsNone
(
".ui-disabled"
,
mockBodyStyle
);
spyOnEvent
(
".ui-disabled"
,
"click"
);
$
(
".ui-disabled"
).
click
();
expect
(
"click"
).
not
.
toHaveBeenPreventedOn
(
".ui-disabled"
);
});
it
(
"should prevent default when pointerEvents is not Supported"
,
function
()
{
// mock document.body.style so it does not include 'pointerEvents'
var
mockBodyStyle
=
{},
bodyStyleKeys
=
Object
.
keys
(
document
.
body
.
style
);
for
(
var
index
=
0
;
index
<
bodyStyleKeys
.
length
;
index
++
)
{
var
key
=
bodyStyleKeys
[
index
];
if
(
key
!==
"pointerEvents"
)
{
mockBodyStyle
[
key
]
=
document
.
body
.
style
[
key
];
};
};
pointerEventsNone
(
".ui-disabled"
,
mockBodyStyle
);
spyOnEvent
(
".ui-disabled"
,
"click"
);
$
(
".ui-disabled"
).
click
();
expect
(
"click"
).
toHaveBeenPreventedOn
(
".ui-disabled"
);
});
});
});
common/static/js/src/CSS3_workarounds.js
0 → 100644
View file @
afd82771
// A file for JS workarounds for CSS3 features that are not
// supported in older browsers
var
pointerEventsNone
=
function
(
selector
,
supportedStyles
)
{
// Check to see if the brower supports 'pointer-events' css rule.
// If it doesn't, use javascript to stop the link from working
// when clicked.
$
(
selector
).
click
(
function
(
event
)
{
if
(
!
(
'pointerEvents'
in
supportedStyles
))
{
event
.
preventDefault
();
};
});
};
$
(
function
()
{
pointerEventsNone
(
'.ui-disabled'
,
document
.
body
.
styles
);
});
common/static/sass/_mixins.scss
View file @
afd82771
...
...
@@ -106,6 +106,7 @@
%ui-disabled
{
pointer-events
:
none
;
outline
:
none
;
cursor
:
default
;
}
// extends - UI - depth levels
...
...
lms/static/sass/base/_base.scss
View file @
afd82771
...
...
@@ -222,10 +222,6 @@ mark {
}
}
.sr
{
@extend
%text-sr
;
}
.help-tab
{
@include
transform
(
rotate
(
-90deg
));
@include
transform-origin
(
0
0
);
...
...
@@ -286,7 +282,19 @@ mark {
height
:
150px
;
}
// ui - skipnav
// ====================
// UI - disabled state
.is-disabled
{
@extend
%ui-disabled
;
}
// UI - semantically hide text
.sr
{
@extend
%text-sr
;
}
// UI - skipnav
.nav-skip
{
display
:
block
;
position
:
absolute
;
...
...
lms/static/sass/base/_mixins.scss
View file @
afd82771
...
...
@@ -87,6 +87,7 @@
%ui-disabled
{
pointer-events
:
none
;
outline
:
none
;
cursor
:
default
;
}
// extends - UI - depth levels
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment