<div class="container">
<ul class="nav navbar-nav nav-crumbs">
- <li>
- <a href="{{link '/settings'}}">{{t 'layout.settings'}}</a>
- </li>
+ <li>
+ <a href="{{link '/settings'}}">{{t 'layout.settings'}}</a>
+ </li>
</ul>
<ul class="nav navbar-nav nav-tabs">
{{t 'sidebar.system'}} <i class="icon-dropdown"></i>
</a>
<ul class="dropdown-menu">
- {{#if settings.showUpdateCenter}}
- <li>
- <a href="{{link '/updatecenter'}}">{{t 'update_center.page'}}</a>
- </li>
- {{/if}}
+ <li>
+ <a href="{{link '/updatecenter'}}">
+ {{t 'update_center.page'}}
+ {{#unless settings.showUpdateCenter}}
+ <span class="spacer-left badge badge-warning">offline</span>
+ {{/unless}}
+ </a>
+ </li>
<li>
<a href="{{link '/system'}}">{{t 'system_info.page'}}</a>
</li>
var App = new Marionette.Application(),
init = function (options) {
// State
- this.state = new Backbone.Model();
+ this.state = new Backbone.Model({
+ updateCenterActive: window.SS.updateCenterActive
+ });
// Layout
this.layout = new Layout({ el: options.el });
this.listenTo(this.options.state, 'change', this.render);
},
+ onRender: function () {
+ this.$('[data-toggle="tooltip"]').tooltip({ container: 'body', placement: 'bottom' });
+ },
+
+ onDestroy: function () {
+ this.$('[data-toggle="tooltip"]').tooltip('destroy');
+ },
+
onFilterChange: function () {
var value = this.$('[name="update-center-filter"]:checked').val();
this.filter(value);
</li>
<li>
<input type="radio" name="update-center-filter" value="updates" id="update-center-filter-updates"
- {{#eq state.section 'updates'}}checked{{/eq}}>
- <label for="update-center-filter-updates">Updates Only</label>
+ {{#eq state.section 'updates'}}checked{{/eq}} {{#unless state.updateCenterActive}}disabled{{/unless}}>
+ <label for="update-center-filter-updates"
+ {{#unless state.updateCenterActive}}data-toggle="tooltip" title="Update Center is not activated."{{/unless}}>
+ Updates Only
+ </label>
</li>
<li>
<input type="radio" name="update-center-filter" value="available" id="update-center-filter-available"
- {{#eq state.section 'available'}}checked{{/eq}}>
- <label for="update-center-filter-available">Available</label>
+ {{#eq state.section 'available'}}checked{{/eq}} {{#unless state.updateCenterActive}}disabled{{/unless}}>
+ <label for="update-center-filter-available"
+ {{#unless state.updateCenterActive}}data-toggle="tooltip" title="Update Center is not activated."{{/unless}}>
+ Available
+ </label>
</li>
</ul>
<ul class="radio-toggle">
<li>
<input type="radio" name="update-center-filter" value="system" id="update-center-filter-system"
- {{#eq state.section 'system'}}checked{{/eq}}>
- <label for="update-center-filter-system">System Upgrades</label>
+ {{#eq state.section 'system'}}checked{{/eq}} {{#unless state.updateCenterActive}}disabled{{/unless}}>
+ <label for="update-center-filter-system"
+ {{#unless state.updateCenterActive}}data-toggle="tooltip" title="Update Center is not activated."{{/unless}}>
+ System Upgrades
+ </label>
</li>
</ul>
</div>
{{#notEq state.section 'system'}}
<form id="update-center-search-form" class="search-box display-inline-block text-top">
- <button id="update-center-search-submit" class="search-box-submit button-clean"><i class="icon-search"></i></button>
+ <button id="update-center-search-submit" class="search-box-submit button-clean"><i class="icon-search"></i>
+ </button>
<input id="update-center-search-query" class="search-box-input" type="search" name="q" placeholder="Search"
maxlength="100" autocomplete="off">
</form>
font-weight: 500;
}
+ input[type="radio"]:disabled + label {
+ color: #bbb;
+ border-color: #ddd;
+ background: #ebebeb;
+ cursor: not-allowed;
+ }
+
}
lf: {
enableGravatar: <%= configuration('sonar.lf.enableGravatar', true) %>,
gravatarServerUrl: '<%= configuration('sonar.lf.gravatarServerUrl') %>'
- }
+ },
+ updateCenterActive: <%= configuration('sonar.updatecenter.activate', true) %>
};
</script>
<script src="<%= ApplicationController.root_context -%>/js/sonar.js?v=<%= sonar_version -%>"></script>
lf: {
enableGravatar: false,
gravatarServerUrl: ''
- }
+ },
+ updateCenterActive: true
};
</script>
<script>requirejs.config({ baseUrl: baseUrl + '../../build/js' });</script>
.checkElementExist('li[data-id="abap"]');
});
+ bdd.it('should work offline', function () {
+ return this.remote
+ .open('')
+ .mockFromString('/api/l10n/index', '{}')
+ .mockFromFile('/api/plugins/installed', 'update-center-spec/installed.json')
+ .mockFromFile('/api/plugins/updates', 'update-center-spec/updates.json')
+ .mockFromFile('/api/plugins/pending', 'update-center-spec/pending.json')
+ .execute(function () {
+ window.SS.updateCenterActive = false;
+ })
+ .startApp('update-center', { urlRoot: '/test/medium/base.html' })
+ .checkElementExist('.js-plugin-name')
+ .checkElementCount('li[data-id]', 5)
+ .checkElementExist('li[data-id="scmgit"]')
+ .checkElementExist('li[data-id="javascript"]')
+ .checkElementNotExist('#update-center-filter-installed[disabled]')
+ .checkElementExist('#update-center-filter-updates[disabled]')
+ .checkElementExist('#update-center-filter-available[disabled]')
+ .checkElementExist('#update-center-filter-system[disabled]');
+ });
+
bdd.it('should switch between views', function () {
return this.remote
.open('#installed')