name: 'common/select-list'
out: '<%= pkg.assets %>build/js/common/select-list.js'
+ apiDocumentation: options:
+ name: 'api-documentation/app'
+ out: '<%= pkg.assets %>build/js/api-documentation/app.js'
+
handlebars:
options:
'<%= pkg.sources %>hbs/common/**/*.hbs'
'<%= pkg.sources %>hbs/issues/**/*.hbs'
]
+ '<%= pkg.assets %>js/templates/api-documentation.js': [
+ '<%= pkg.sources %>hbs/api-documentation/**/*.hbs'
+ ]
clean:
--- /dev/null
+requirejs.config
+ baseUrl: "#{baseUrl}/js"
+
+ paths:
+ 'jquery': 'third-party/jquery'
+ 'backbone': 'third-party/backbone'
+ 'backbone.marionette': 'third-party/backbone.marionette'
+ 'handlebars': 'third-party/handlebars'
+ 'moment': 'third-party/moment'
+
+ shim:
+ 'backbone.marionette':
+ deps: ['backbone']
+ exports: 'Marionette'
+ 'backbone':
+ exports: 'Backbone'
+ 'handlebars':
+ exports: 'Handlebars'
+ 'moment':
+ exports: 'moment'
+
+
+requirejs [
+ 'backbone', 'backbone.marionette', 'handlebars',
+ 'api-documentation/collections/web-services',
+ 'api-documentation/views/api-documentation-list-view',
+ 'api-documentation/layout',
+ 'common/handlebars-extensions'
+], (
+ Backbone, Marionette, Handlebars,
+ WebServices,
+ ApiDocumentationListView,
+ ApiDocumentationLayout
+) ->
+
+ # Create a Quality Gate Application
+ App = new Marionette.Application
+
+
+ App.webServices = new WebServices
+
+ # Construct layout
+ App.addInitializer ->
+ @layout = new ApiDocumentationLayout app: @
+ jQuery('#body').append @layout.render().el
+
+ # Construct sidebar
+ App.addInitializer ->
+ @apiDocumentationListView = new ApiDocumentationListView
+ collection: @webServices
+ app: @
+ @layout.resultsRegion.show @apiDocumentationListView
+
+ webServicesXHR = App.webServices.fetch()
+
+ jQuery.when(webServicesXHR)
+ .done ->
+ # Remove the initial spinner
+ jQuery('#api-documentation-page-loader').remove()
+
+ # Start the application
+ App.start()
--- /dev/null
+define [
+ 'backbone',
+ 'api-documentation/models/web-service-action'
+], (
+ Backbone,
+ WebServiceAction
+) ->
+
+ class WebServiceActions extends Backbone.Collection
+ model: WebServiceAction
+ comparator: 'key'
--- /dev/null
+define [
+ 'backbone',
+ 'api-documentation/models/web-service'
+], (
+ Backbone,
+ WebService
+) ->
+
+ class WebServices extends Backbone.Collection
+ model: WebService
+
+ url: ->
+ "#{baseUrl}/api/webservices/list"
+
+ parse: (r) ->
+ r.webServices.map (webService) ->
+ _.extend webService
+
+ comparator: (item) -> item.get('path')
--- /dev/null
+define [
+ 'backbone.marionette',
+ 'templates/api-documentation'
+], (
+ Marionette,
+ Templates
+) ->
+
+ class AppLayout extends Marionette.Layout
+ className: 'api-documentation-layout'
+ template: Templates['api-documentation-layout']
+
+ regions:
+ resultsRegion: '.api-documentation-results'
--- /dev/null
+define [
+ 'backbone'
+], (
+ Backbone
+) ->
+
+ class WebServiceAction extends Backbone.Model
--- /dev/null
+define [
+ 'backbone'
+], (
+ Backbone
+) ->
+
+ class WebService extends Backbone.Model
--- /dev/null
+define [
+ 'backbone.marionette',
+ 'templates/api-documentation'
+], (
+ Marionette,
+ Templates
+) ->
+
+ class ApiDocumentationActionView extends Marionette.ItemView
+ tagName: 'div'
+ className: 'api-documentation-action'
+ template: Templates['api-documentation-action']
+ spinner: '<i class="spinner"></i>'
+
--- /dev/null
+define [
+ 'backbone.marionette',
+ 'templates/api-documentation'
+ 'api-documentation/models/web-service-action',
+ 'api-documentation/views/api-documentation-action-view'
+], (
+ Marionette,
+ Templates
+ WebServiceAction,
+ ApiDocumentationActionView
+) ->
+
+ class ApiDocumentationActionsListView extends Marionette.CompositeView
+ tagName: 'div'
+ template: Templates['api-documentation-actions']
+ itemView: ApiDocumentationActionView
+ itemViewContainer: '.api-documentation-actions-list'
+
--- /dev/null
+define [
+ 'backbone.marionette',
+ 'api-documentation/views/api-documentation-web-service-view'
+], (
+ Marionette,
+ ApiDocumentationWebServiceView
+) ->
+
+ class ApiDocumentationListView extends Marionette.CollectionView
+ tagName: 'table'
+ className: 'web-services-list'
+ itemView: ApiDocumentationWebServiceView
+
+
+ itemViewOptions: (model) ->
+ app: @options.app
--- /dev/null
+define [
+ 'backbone.marionette',
+ 'templates/api-documentation',
+ 'api-documentation/collections/web-service-actions'
+ 'api-documentation/views/api-documentation-actions-list-view'
+], (
+ Marionette,
+ Templates,
+ WebServiceActions,
+ ApiDocumentationActionsListView
+) ->
+
+ class ApiDocumentationWebServiceView extends Marionette.Layout
+ tagName: 'tr'
+ template: Templates['api-documentation-web-service']
+ spinner: '<i class="spinner"></i>'
+
+ regions:
+ actionsRegion: '.web-service-actions'
+
+ onRender: ->
+ @showActions()
+
+
+ showActions: ->
+ actions = new WebServiceActions @model.get('actions')
+ view = new ApiDocumentationActionsListView
+ app: @options.app
+ collection: actions
+ webService: @model
+ @actionsRegion.show view
--- /dev/null
+<h3>{{key}}</h3>
+<p>{{description}}</p>
\ No newline at end of file
--- /dev/null
+<div class="api-documentation-actions-list"></div>
\ No newline at end of file
--- /dev/null
+<div class="api-documentation-layout">
+ <div class="api-documentation-results">
+ </div>
+</div>
--- /dev/null
+<td><h2>{{path}}</h2></td>
+<td>
+ <p class="web-service-description">{{description}}</p>
+ <div class="web-service-actions">
+ </div>
+</td>
\ No newline at end of file
--- /dev/null
+@import "variables";
+@import "mixins";
+@import "navigator/config";
+
+.web-services-list {
+ width: 100%;
+ margin: 10px;
+
+ td {
+ vertical-align: top;
+ padding-bottom: 10px;
+ }
+
+ .web-service-description {
+ margin-bottom: 20px;
+ }
+
+ .api-documentation-action {
+ margin-bottom: 10px;
+ }
+}
--- /dev/null
+#
+# SonarQube, open source software quality management tool.
+# Copyright (C) 2008-2014 SonarSource
+# mailto:contact AT sonarsource DOT com
+#
+# SonarQube is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 3 of the License, or (at your option) any later version.
+#
+# SonarQube is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+
+class ApiDocumentationController < ApplicationController
+
+ # GET /api_documentation/index
+ def index
+
+ end
+
+end
--- /dev/null
+<% content_for :script do %>
+ <script data-main="<%= ApplicationController.root_context -%>/js/api-documentation/app" src="<%= ApplicationController.root_context -%>/js/require.js"></script>
+<% end %>
+
+<div id="api-documentation-page-loader" class="navigator-page-loader">
+ <i class="spinner"></i>
+</div>
<a href="http://www.sonarqube.org" target="sonar">Community</a> -
<a href="http://www.sonarqube.org/documentation" target="sonar_doc">Documentation</a> -
<a href="http://www.sonarqube.org/support" target="support">Get Support</a> -
- <a href="http://sonar-plugins.codehaus.org" target="plugins">Plugins</a>
+ <a href="http://sonar-plugins.codehaus.org" target="plugins">Plugins</a> -
+ <a href="<%= ApplicationController.root_context -%>/api_documentation">API</a>
<% unless DatabaseVersion.production? %>
<br><br><span class="error big" id="evaluation_warning">Embedded database should be used for evaluation purpose only</span>
<br><br><span class="error">The embedded database will not scale, it will not support upgrading to newer versions of SonarQube, and there is no support for migrating your data out of it into a different database engine.</span>