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
a3459eae
Commit
a3459eae
authored
Oct 24, 2016
by
Albert St. Aubin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Updated learner profile to only use the tab panel view when there is accomplishments.
TNL-5283
parent
eb6bb036
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
48 additions
and
44 deletions
+48
-44
lms/static/js/spec/student_profile/helpers.js
+14
-7
lms/static/js/spec/student_profile/learner_profile_factory_spec.js
+2
-2
lms/static/js/student_profile/views/learner_profile_view.js
+32
-35
No files found.
lms/static/js/spec/student_profile/helpers.js
View file @
a3459eae
...
...
@@ -100,10 +100,10 @@ define(['underscore', 'URI', 'edx-ui-toolkit/js/utils/spec-helpers/ajax-helpers'
expect
(
learnerProfileView
.
$
(
'.wrapper-profile-section-two'
).
length
).
toBe
(
0
);
};
var
expectTabbedViewToBe
Hidden
=
function
(
requests
,
tabbedViewView
)
{
var
expectTabbedViewToBe
Undefined
=
function
(
requests
,
tabbedViewView
)
{
// Unrelated initial request, no badge request
expect
(
requests
.
length
).
toBe
(
1
);
expect
(
tabbedViewView
.
$el
.
find
(
'.page-content-nav'
).
is
(
':visible'
)).
toBe
(
false
);
expect
(
tabbedViewView
).
toBe
(
undefined
);
};
var
expectTabbedViewToBeShown
=
function
(
tabbedViewView
)
{
...
...
@@ -228,10 +228,17 @@ define(['underscore', 'URI', 'edx-ui-toolkit/js/utils/spec-helpers/ajax-helpers'
expectLimitedProfileSectionsAndFieldsToBeRendered
:
expectLimitedProfileSectionsAndFieldsToBeRendered
,
expectProfileSectionsAndFieldsToBeRendered
:
expectProfileSectionsAndFieldsToBeRendered
,
expectProfileSectionsNotToBeRendered
:
expectProfileSectionsNotToBeRendered
,
expectTabbedViewToBeHidden
:
expectTabbedViewToBeHidden
,
expectTabbedViewToBeShown
:
expectTabbedViewToBeShown
,
expectBadgesDisplayed
:
expectBadgesDisplayed
,
expectBadgesHidden
:
expectBadgesHidden
,
expectBadgeLoadingErrorIsRendered
:
expectBadgeLoadingErrorIsRendered
,
breakBadgeLoading
:
breakBadgeLoading
,
firstPageBadges
:
firstPageBadges
,
secondPageBadges
:
secondPageBadges
,
thirdPageBadges
:
thirdPageBadges
,
emptyBadges
:
emptyBadges
,
expectPage
:
expectPage
,
makeBadge
:
makeBadge
expectTabbedViewToBeUndefined
:
expectTabbedViewToBeUndefined
,
expectTabbedViewToBeShown
:
expectTabbedViewToBeShown
,
expectBadgesDisplayed
:
expectBadgesDisplayed
,
expectBadgesHidden
:
expectBadgesHidden
,
expectBadgeLoadingErrorIsRendered
:
expectBadgeLoadingErrorIsRendered
,
breakBadgeLoading
:
breakBadgeLoading
,
firstPageBadges
:
firstPageBadges
,
secondPageBadges
:
secondPageBadges
,
thirdPageBadges
:
thirdPageBadges
,
emptyBadges
:
emptyBadges
,
expectPage
:
expectPage
,
makeBadge
:
makeBadge
};
});
lms/static/js/spec/student_profile/learner_profile_factory_spec.js
View file @
a3459eae
...
...
@@ -72,7 +72,7 @@ define(['backbone', 'jquery', 'underscore', 'edx-ui-toolkit/js/utils/spec-helper
tabbedView
=
context
.
learnerProfileView
.
tabbedView
,
learnerProfileView
=
context
.
learnerProfileView
;
LearnerProfileHelpers
.
expectTabbedViewToBe
Hidden
(
requests
,
tabbedView
);
LearnerProfileHelpers
.
expectTabbedViewToBe
Undefined
(
requests
,
tabbedView
);
LearnerProfileHelpers
.
expectBadgesHidden
(
learnerProfileView
);
});
...
...
@@ -83,7 +83,7 @@ define(['backbone', 'jquery', 'underscore', 'edx-ui-toolkit/js/utils/spec-helper
tabbedView
=
context
.
learnerProfileView
.
tabbedView
,
learnerProfileView
=
context
.
learnerProfileView
;
LearnerProfileHelpers
.
expectTabbedViewToBe
Hidden
(
requests
,
tabbedView
);
LearnerProfileHelpers
.
expectTabbedViewToBe
Undefined
(
requests
,
tabbedView
);
LearnerProfileHelpers
.
expectBadgesHidden
(
learnerProfileView
);
});
...
...
lms/static/js/student_profile/views/learner_profile_view.js
View file @
a3459eae
...
...
@@ -39,7 +39,8 @@
},
render
:
function
()
{
var
self
=
this
;
var
tabs
,
self
=
this
;
this
.
sectionTwoView
=
new
SectionTwoTab
({
viewList
:
this
.
options
.
sectionTwoFieldViews
,
...
...
@@ -47,10 +48,6 @@
ownProfile
:
this
.
options
.
ownProfile
});
var
tabs
=
[
{
view
:
this
.
sectionTwoView
,
title
:
gettext
(
'About Me'
),
url
:
'about_me'
}
];
HtmlUtils
.
setHtml
(
this
.
$el
,
HtmlUtils
.
template
(
learnerProfileTemplate
)({
username
:
self
.
options
.
accountSettingsModel
.
get
(
'username'
),
ownProfile
:
self
.
options
.
ownProfile
,
...
...
@@ -59,45 +56,45 @@
this
.
renderFields
();
if
(
this
.
showFullProfile
()
&&
(
this
.
options
.
accountSettingsModel
.
get
(
'accomplishments_shared'
)))
{
tabs
.
push
({
view
:
this
.
options
.
badgeListContainer
,
title
:
gettext
(
'Accomplishments'
),
url
:
'accomplishments'
});
tabs
=
[
{
view
:
this
.
sectionTwoView
,
title
:
gettext
(
'About Me'
),
url
:
'about_me'
},
{
view
:
this
.
options
.
badgeListContainer
,
title
:
gettext
(
'Accomplishments'
),
url
:
'accomplishments'
}
];
// Build the accomplishments Tab and fill with data
this
.
options
.
badgeListContainer
.
collection
.
fetch
().
done
(
function
()
{
self
.
options
.
badgeListContainer
.
render
();
}).
error
(
function
()
{
self
.
options
.
badgeListContainer
.
renderError
();
});
}
this
.
tabbedView
=
new
TabbedView
({
tabs
:
tabs
,
router
:
this
.
router
,
viewLabel
:
gettext
(
'Profile'
)
});
this
.
tabbedView
.
render
();
if
(
tabs
.
length
===
1
)
{
// If the tab is unambiguous, don't display the tab interface.
this
.
tabbedView
.
$el
.
find
(
'.page-content-nav'
).
hide
();
}
this
.
$el
.
find
(
'.account-settings-container'
).
append
(
this
.
tabbedView
.
el
);
this
.
tabbedView
=
new
TabbedView
({
tabs
:
tabs
,
router
:
this
.
router
,
viewLabel
:
gettext
(
'Profile'
)
});
if
(
this
.
firstRender
)
{
this
.
router
.
on
(
'route:loadTab'
,
_
.
bind
(
this
.
setActiveTab
,
this
));
Backbone
.
history
.
start
();
this
.
firstRender
=
false
;
// Load from history.
this
.
router
.
navigate
((
Backbone
.
history
.
getFragment
()
||
'about_me'
),
{
trigger
:
true
});
this
.
tabbedView
.
render
();
this
.
$el
.
find
(
'.account-settings-container'
).
append
(
this
.
tabbedView
.
el
);
if
(
this
.
firstRender
)
{
this
.
router
.
on
(
'route:loadTab'
,
_
.
bind
(
this
.
setActiveTab
,
this
));
Backbone
.
history
.
start
();
this
.
firstRender
=
false
;
// Load from history.
this
.
router
.
navigate
((
Backbone
.
history
.
getFragment
()
||
'about_me'
),
{
trigger
:
true
});
}
else
{
// Restart the router so the tab will be brought up anew.
Backbone
.
history
.
stop
();
Backbone
.
history
.
start
();
}
}
else
{
// Restart the router so the tab will be brought up anew.
Backbone
.
history
.
stop
();
Backbone
.
history
.
start
();
this
.
$el
.
find
(
'.account-settings-container'
).
append
(
this
.
sectionTwoView
.
render
().
el
);
}
return
this
;
},
...
...
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