@barRegion.show new bar.view
main: @options.main, state: @state, component: @component, settings: @settings, source: @model, header: @
@ui.expandLinks.filter("[data-scope=#{scope}]").addClass 'active'
-
-
- enableBarItem: (item) ->
- @$(item).click()
+ activeHeaderItem = @state.get 'activeHeaderItem'
+ if activeHeaderItem
+ @$(activeHeaderItem).addClass 'active'
showExpandedBar: (e) ->
main: @options.main
bottom: true
popup.render()
- popup.on 'change', (period) => @main.enableSCMPeriod period
+ popup.on 'change', (period) => @main.enablePeriod period
filterByLinesToCover: (e) ->
bottom: true
prefix: 'Added'
popup.render()
- popup.on 'change', (period) => @main.enableIssuesPeriod period
+ popup.on 'change', (period) => @main.enablePeriod period
filterByCurrentIssue: (e) ->
serializeData: ->
- _.extend super, period: @state.get('issuesPeriod')?.toJSON()
\ No newline at end of file
+ _.extend super, period: @state.get('period')?.toJSON()
\ No newline at end of file
main: @options.main
bottom: true
popup.render()
- popup.on 'change', (period) => @main.enableSCMPeriod period
+ popup.on 'change', (period) => @main.enablePeriod period
serializeData: ->
@sourceView.render()
+ enablePeriod: (periodKey, scope = 'scm') ->
+ period = if periodKey == '' then null else @periods.findWhere key: periodKey
+ @state.set 'period', period
+ $.when(@requestMeasures(@key, period?.get('key')), @requestIssuesPeriod(@key, period?.get('key'))).done =>
+ @headerView.render()
+ unless @state.get('activeHeaderItem')
+ if @state.get('activeHeaderTab') == 'issues'
+ @filterByUnresolvedIssues()
+ else
+ @filterBySCM()
+
+
addTransition: (transition, options) ->
@workspace.add
key: @component.get 'key'
@state.set rules: rules, severities: severities
- enableIssuesPeriod: (periodKey) ->
- period = if periodKey == '' then null else @periods.findWhere key: periodKey
- @state.set 'issuesPeriod', period
- periodKey = if period? then period.get 'key' else null
- @requestIssuesPeriod(@key, periodKey).done => @headerView.render()
-
-
filterLinesByIssues: ->
issues = @source.get 'issues'
@sourceView.resetShowBlocks()
filterByIssues: (predicate, requestIssues = true) ->
- issuesPeriod = @state.get('issuesPeriod')
- if issuesPeriod
+ period = @state.get('period')
+ if period
p = predicate
predicate = (issue) =>
- (new Date(issue.creationDate) >= issuesPeriod.get('sinceDate')) && p issue
+ (new Date(issue.creationDate) >= period.get('sinceDate')) && p issue
if requestIssues && !@state.get 'hasIssues'
@requestIssues(@key).done => @_filterByIssues(predicate)
@sourceView.addShowBlock scmBlockLine, line.lineNumber - 1
if predicate
@sourceView.addShowBlock scmBlockLine, _.size @source.get 'source'
- @sourceView.render()
-
-
- enableSCMPeriod: (periodKey) ->
- period = if periodKey == '' then null else @periods.findWhere key: periodKey
- @state.set 'period', period
- @requestMeasures(@key, period?.get('key')).done =>
- @headerView.render()
- @filterBySCM() unless @state.get('activeHeaderItem')
\ No newline at end of file
+ @sourceView.render()
\ No newline at end of file