Skip to content

Commit

Permalink
Merge pull request #980 from openstax/fix/period-tab-ellipsis-tooltip
Browse files Browse the repository at this point in the history
Student Scores: adds tooltips, ellipsis and scale/wrap to tabs
  • Loading branch information
philschatz committed Feb 23, 2016
2 parents 518d6d1 + 0776cb3 commit c858acd
Show file tree
Hide file tree
Showing 6 changed files with 55 additions and 8 deletions.
4 changes: 4 additions & 0 deletions resources/styles/components/course-settings.less
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@
.nav-tabs {
.tutor-nav-tabs();

span {
max-width: 100px;
}

li.active {
border: 1px solid @nav-tabs-border-color;
border-bottom: none;
Expand Down
4 changes: 4 additions & 0 deletions resources/styles/components/scores/table-cc.less
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
@pie-color-hover: #0DC0DC;
@finished-icon-size: 24px;

.nav.nav-tabs {
clear: both;
}

.header-cell {
.no-select();
cursor: pointer;
Expand Down
12 changes: 11 additions & 1 deletion resources/styles/mixins.less
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,9 @@

.tutor-nav-tabs() {
background: none;
li {
display: flex;
flex-wrap: wrap;
li.tab-item-period {
text-align: center;
background: @tutor-neutral-lighter;

Expand All @@ -80,6 +82,14 @@
a {
font-weight: 400;
color: @tutor-neutral !important;
span.tab-item-period-name {
overflow: hidden;
text-overflow: ellipsis;
display: block;
white-space: nowrap;
font-size: 1.3rem;
max-width: 100px;
}
}

&:hover {
Expand Down
1 change: 0 additions & 1 deletion resources/styles/mixins/tutor-modal.less
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@
}

.btn:not(.btn-link):not(.btn-flat) {
margin-top: 0;
margin-bottom: 0;
}
}
Expand Down
22 changes: 18 additions & 4 deletions src/components/course-periods-nav.cjsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ BS = require 'react-bootstrap'
LoadableItem = require './loadable-item'
_ = require 'underscore'
camelCase = require 'camelcase'
classnames = require 'classnames'

{CourseActions, CourseStore} = require '../flux/course'
PeriodHelper = require '../helpers/period'
Expand All @@ -18,6 +19,7 @@ CoursePeriodsNav = React.createClass
periods: React.PropTypes.array.isRequired
afterTabsItem: React.PropTypes.func


getDefaultProps: ->
initialActive: 0
sortedPeriods: []
Expand Down Expand Up @@ -58,13 +60,25 @@ CoursePeriodsNav = React.createClass
@setState(active: key)

renderPeriod: (period, key) ->
<BS.NavItem
className={'is-trouble' if period.is_trouble}
eventKey={key}
className = classnames('tab-item-period', {'is-trouble': period.is_trouble})
tooltip =
<BS.Tooltip>
{period.name}
</BS.Tooltip>
<BS.NavItem
className={className}
eventKey={key}
key="period-nav-#{period.id}">
{period.name}
<BS.OverlayTrigger
placement='top'
delayShow={1000}
delayHide={0}
overlay={tooltip}>
<span className='tab-item-period-name'>{period.name}</span>
</BS.OverlayTrigger>
</BS.NavItem>


render: ->
{active, sortedPeriods} = @state
{afterTabsItem} = @props
Expand Down
20 changes: 18 additions & 2 deletions src/components/course-settings/roster.cjsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
React = require 'react'
BS = require 'react-bootstrap'
_ = require 'underscore'
classnames = require 'classnames'

BindStoreMixin = require '../bind-store-mixin'
NoPeriods = require '../no-periods'

Expand Down Expand Up @@ -46,7 +48,21 @@ module.exports = React.createClass
{is_concept_coach} = course
periods = course.periods.length > 0
tabs = _.map course.periods, (period, index) =>
<BS.TabPane key={period.id}, eventKey={index} tab={period.name}>
className = classnames('tab-item-period', {'is-trouble': period.is_trouble})
tooltip =
<BS.Tooltip>
{period.name}
</BS.Tooltip>
name =
<BS.OverlayTrigger
placement='top'
delayShow={1000}
delayHide={0}
overlay={tooltip}>
<span className='tab-item-period-name'>{period.name}</span>
</BS.OverlayTrigger>

<BS.TabPane key={period.id}, eventKey={index} tab={name} className={className}>
<PeriodRoster
period={period}
courseId={@props.courseId}
Expand All @@ -56,7 +72,7 @@ module.exports = React.createClass
enrollmentButton =
<PeriodEnrollmentCode
activeTab={@getActivePeriod(@state.key, course.periods)}
periods={course.periods}
periods={course.periods}
bookUrl={course.webview_url}
bookName={course.salesforce_book_name} />
renameButton =
Expand Down

0 comments on commit c858acd

Please sign in to comment.