'click .js-select-period-start': 'selectPeriodStart'
'click .js-select-period-end': 'selectPeriodEnd'
+ 'click .js-last-week': 'onLastWeekClick'
+ 'click .js-last-month': 'onLastMonthClick'
+ 'click .js-last-year': 'onLastYearClick'
+
onRender: ->
@$el.toggleClass 'search-navigator-facet-box-collapsed', !@model.get('enabled')
value = query[prop]
@$("input[name=#{prop}]").val value if value?
- @$('.js-barchart').barchart @model.getValues()
-
- @$('select').select2
- width: '100%'
- minimumResultsForSearch: 999
+ values = @model.getValues()
+ if _.isArray(values) && values.length > 0
+ @$('.js-barchart').barchart values
+ else
+ @$('.js-barchart').addClass 'hidden'
selectPeriodStart: ->
@$('.js-period-end').datepicker 'show'
-
applyFacet: ->
obj = {}
@$('input').each ->
@options.app.state.updateFilter createdAfter: null, createdBefore: null, createdAt: null
+ onLastWeekClick: ->
+ createdAfter = moment().subtract(1, 'weeks').format 'YYYY-MM-DD'
+ @options.app.state.updateFilter createdAfter: createdAfter, createdBefore: null, createdAt: null
+
+
+ onLastMonthClick: ->
+ createdAfter = moment().subtract(1, 'months').format 'YYYY-MM-DD'
+ @options.app.state.updateFilter createdAfter: createdAfter, createdBefore: null, createdAt: null
+
+
+ onLastYearClick: ->
+ createdAfter = moment().subtract(1, 'years').format 'YYYY-MM-DD'
+ @options.app.state.updateFilter createdAfter: createdAfter, createdBefore: null, createdAt: null
+
+
serializeData: ->
_.extend super,
periodStart: @options.app.state.get('query').createdAfter
<input class="js-period-end search-navigator-date-facet-selection-input-right"
type="text" value="{{#if periodEnd}}{{ds periodEnd}}{{/if}}" name="createdBefore">
</div>
+
+ <div class="spacer-top">
+ <span class="spacer-right">{{t 'issues.facet.createdAt.or'}}</span>
+ <a class="js-last-week spacer-right">{{t 'issues.facet.createdAt.last_week'}}</a>
+ <a class="js-last-month spacer-right">{{t 'issues.facet.createdAt.last_month'}}</a>
+ <a class="js-last-year">{{t 'issues.facet.createdAt.last_year'}}</a>
+ </div>
</div>
{{/if}}
})
.attr('title', function (d, i) {
var beginning = moment(d.val),
- ending = i < data.length - 1 ? moment(data[i].val).subtract(1, 'days') : moment();
+ ending = i < data.length - 1 ? moment(data[i + 1].val).subtract(1, 'days') : moment();
return d.count + ' | ' + beginning.format('LL') + ' - ' + ending.format('LL');
})
.attr('data-placement', 'right')
issues.facet.resolutions=Resolution
issues.facet.languages=Language
issues.facet.createdAt=Creation Date
+issues.facet.createdAt.or=Or:
+issues.facet.createdAt.last_week=Last week
+issues.facet.createdAt.last_month=Last month
+issues.facet.createdAt.last_year=Last year
issues.facet.reporters=Reporter
issues.facet.authors=Author
issues.facet.issues=Issue Key