name: 'api-documentation/app'
out: '<%= pkg.assets %>build/js/api-documentation/app.js'
+ drilldown: options:
+ name: 'drilldown/app'
+ out: '<%= pkg.assets %>build/js/drilldown/app.js'
+
handlebars:
options:
@$(activeHeaderItem).addClass 'active'
+ enableBarItem: (item) ->
+ @$(item).click()
+
+
showExpandedBar: (e) ->
el = $(e.currentTarget)
active = el.is '.active'
@sourceView.render()
- enablePeriod: (periodKey, scope = 'scm') ->
+ enablePeriod: (periodKey) ->
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 =>
@filterByCurrentIssue()
@headerView.render()
else
- @sourceView.render()
+ unless @state.get 'hasIssues'
+ @requestIssues(@key).done => @sourceView.render()
+ else
+ @sourceView.render()
hideIssues: (store = false) ->
--- /dev/null
+requirejs.config
+ baseUrl: "#{baseUrl}/js"
+
+ paths:
+ 'backbone': 'third-party/backbone'
+ 'backbone.marionette': 'third-party/backbone.marionette'
+ 'handlebars': 'third-party/handlebars'
+ 'jquery.mockjax': 'third-party/jquery.mockjax'
+
+ shim:
+ 'backbone.marionette':
+ deps: ['backbone']
+ exports: 'Marionette'
+ 'backbone':
+ exports: 'Backbone'
+ 'handlebars':
+ exports: 'Handlebars'
+
+
+requirejs [
+ 'backbone.marionette'
+ 'component-viewer/main'
+], (
+ Marionette
+ ComponentViewer
+) ->
+
+ $ = jQuery
+ App = new Marionette.Application()
+
+
+ App.addRegions
+ viewerRegion: '#accordion-panel'
+
+
+ App.requestComponentViewer = ->
+ unless App.componentViewer?
+ App.componentViewer = new ComponentViewer()
+ App.viewerRegion.show App.componentViewer
+ App.componentViewer
+
+
+
+ App.addInitializer ->
+ # Define parameters
+ drilldown = window.drilldown || {}
+ activeHeaderTab = 'issues'
+ activeHeaderItem = '.js-filter-unresolved-issues'
+ if drilldown.rule?
+ activeHeaderTab = 'issues'
+ activeHeaderItem = ".js-filter-rule[data-rule='#{drilldown.rule}']"
+ else if drilldown.severity?
+ activeHeaderTab = 'issues'
+ activeHeaderItem = ".js-filter-#{drilldown.severity}-issues"
+
+ # Add event listeners
+ $('.js-drilldown-link').on 'click', (e) ->
+ e.preventDefault()
+ key = $(e.currentTarget).data 'key'
+ viewer = App.requestComponentViewer()
+ viewer.open(key).done ->
+ if activeHeaderTab? && activeHeaderItem?
+ viewer.state.set activeHeaderTab: activeHeaderTab, activeHeaderItem: activeHeaderItem
+ viewer.headerView.render()
+ if drilldown.period?
+ viewer.enablePeriod drilldown.period
+
+
+ # Message bundles
+ l10nXHR = window.requestMessages()
+
+
+ $.when(l10nXHR).done ->
+ # Remove the initial spinner
+ $('#coding-rules-page-loader').remove()
+
+ # Start the application
+ App.start()
additionalChoices = []
if !assignee || currentUser != assignee
- additionalChoices.push id: currentUser, text: translate('assignedToMe')
+ additionalChoices.push id: currentUser, text: t('assigned_to_me')
if !!assignee
- additionalChoices.push id: '', text: translate('unassigned')
+ additionalChoices.push id: '', text: t('unassigned')
select2Options =
allowClear: false
width: '250px'
- formatNoMatches: -> translate('select2.noMatches')
- formatSearching: -> translate('select2.searching')
- formatInputTooShort: -> translate('select2.tooShort')
+ formatNoMatches: -> t('select2.noMatches')
+ formatSearching: -> t('select2.searching')
+ formatInputTooShort: -> t('select2.tooShort')
if additionalChoices.length > 0
select2Options.minimumInputLength = 0
<ul class="code-issue-actions code-issue-list">
{{#inArray actions "comment"}}
<li>
- <a id="issue-comment" class="link-action">{{translate "actions.comment" }}</a>
+ <a id="issue-comment" class="link-action">{{t 'issue.comment.formlink' }}</a>
</li>
{{/inArray}}
<li>
- {{statusIcon status}}{{translate "statuses" status}}
- {{#if resolution}}({{translate "resolutions" resolution}}){{/if}}
+ {{statusIcon status}}{{t 'issue.status' status}}
+ {{#if resolution}}({{t 'issue.resolution' resolution}}){{/if}}
{{#ifNotEmpty transitions}}
{{#each transitions}}
- <a class="link-action issue-transition spacer-left" data-transition="{{this}}">{{translate "transitions" this}}</a>
+ <a class="link-action issue-transition spacer-left" data-transition="{{this}}">{{t 'issue.transition' this}}</a>
{{/each}}
{{/ifNotEmpty}}
</li>
{{#if assigneeName}}
<a id="issue-assign" class="link-action">{{t 'assigned_to'}}</a> {{assigneeName}}</li>
{{else}}
- <a id="issue-assign" class="link-action">{{translate "actions.assign" }}</a>
+ <a id="issue-assign" class="link-action">{{t 'issue.assign.formlink' }}</a>
{{#inArray actions "assign_to_me"}}
- [<a id="issue-assign-to-me" class="link-action">{{translate "actions.assign_to_me" }}</a>]
+ [<a id="issue-assign-to-me" class="link-action">{{t 'issue.assign.to_me' }}</a>]
{{/inArray}}
{{/if}}
</li>
<ul style="display: none" class="dropdown-menu">
{{#inArray actions "set_severity"}}
<li>
- <a id="issue-set-severity" class="link-action spacer-right">{{translate "actions.set_severity"}}</a>
+ <a id="issue-set-severity" class="link-action spacer-right">{{t "issue.set_severity"}}</a>
</li>
{{/inArray}}
{{#pluginActions actions}}
<li>
- <a class="link-action spacer-right issue-action" data-action="{{this}}">{{translate "actions" this}}</a>
+ <a class="link-action spacer-right issue-action" data-action="{{this}}">{{t "actions" this}}</a>
</li>
{{/pluginActions}}
</ul>
{{else}}
{{#inArray actions "set_severity"}}
<li>
- <a id="issue-set-severity" class="link-action">{{translate "actions.set_severity"}}</a>
+ <a id="issue-set-severity" class="link-action">{{t "issue.set_severity"}}</a>
</li>
{{/inArray}}
{{/ifHasExtraActions}}
ret = arg;
}
});
- return ret;
+ return ret || '';
});
Handlebars.registerHelper('percent', function(value, total) {
+<% content_for :script do %>
+ <script data-main="<%= ApplicationController.root_context -%>/js/drilldown/app" src="<%= ApplicationController.root_context -%>/js/require.js"></script>
+<% end %>
+
<%= render :partial => 'header' -%>
<div class="line-block">
<% end %>
<%= qualifier_icon(resource) -%>
<% if resource.source_code? %>
- <a href="#" onclick="$j('#col_<%= index -%> tr').removeClass('selected'); $j('#row_<%= index -%>_<%= row_index -%>').addClass('selected'); d(<%= resource.id -%>);"
- alt="<%= h resource.name(true) -%>" title="<%= h resource.name(true) -%>" class="chevron-link highlighted-link"><%= h resource.name(false) %></a>
+ <a href="#" alt="<%= h resource.name(true) -%>" title="<%= h resource.name(true) -%>" data-key="<%= resource.key -%>"
+ class="js-drilldown-link chevron-link highlighted-link"><%= h resource.name(false) %></a>
<% else %>
<%= link_to(h(resource.name), {:only_path => true, :overwrite_params => {:rids => (selected ? rids-[resource.id] : rids+[resource.id])}}, :class => 'chevron-link highlighted-link') -%>
<% end %>
$j(document).ready(function() {
// displayIssues();
});
+
+ window.drilldown = {
+ metric: <% if @metric %>'<%= @metric.id -%>'<% else %>null<% end %>,
+ rule: <% if @rule %>'<%= @rule.key -%>'<% else %>null<% end %>,
+ severity: <% if @severity %>'<%= @severity -%>'<% else %>null<% end %>,
+ period: <% if @period %><%= @period -%><% else %>null<% end %>
+ };
</script>
<div id="accordion-panel"/>