Commit 2d38b2a0 authored by AllenShaw's avatar AllenShaw
Browse files

Merge branch 'refactor-to-use-service' of...

Merge branch 'refactor-to-use-service' of github.com:twomice/org.civicrm.extensionsui into refactor-to-use-service
parents 9344d441 b525f68e
......@@ -2,5 +2,9 @@
// Declare a list of dependencies.
angular.module('crmExt', [
'crmUi', 'crmUtil', 'ngRoute', 'dialogService'
]);
])
// Make utilities globally available in the app
.run(function($rootScope) {
$rootScope.ts = CRM.ts('org.civicrm.extensionsui');
});
})(angular, CRM.$, CRM._);
......@@ -11,8 +11,12 @@
<td class="label">{{ts('Description')}}</td>
<td>
{{model.extension.description}}
<!-- TODO: Upgrade-available messaging is not yet ready for prime time. -->
<div class="crm-extensions-upgrade" ng-if="(model.extension.getUpgradeVersion())">Version {{model.extension.getUpgradeVersion()}} is available. <a href="" crm-confirm="{message: ts('Upgrade <em>%1 (%2)</em>?', {1: model.extension.name, 2: model.extension.key})}" on-yes="model.extension.lifecycle('upgrade')">Upgrade</a></div>
<div class="crm-extensions-upgrade" ng-if="(model.extension.getUpgradeVersion())">
{{ts('Version %1 is available.', {1: model.extension.getUpgradeVersion()})}}
<a href="" crm-confirm="{message: ts('Upgrade <em>%1 (%2)</em>?', {1: model.extension.name, 2: model.extension.key})}" on-yes="model.extension.lifecycle('upgrade')">
{{ts('Upgrade')}}
</a>
</div>
</td>
</tr>
<tr>
......@@ -21,7 +25,6 @@
</tr>
<tr>
<td class="label">{{ts('Compatible with')}}</td>
<!-- td><span ng-repeat="(key, value) in model.extension.compatibility.ver">{{value}}&nbsp;</span></td -->
<td>{{model.extension.compatibleVersions.join(', ')}}</td>
</tr>
<tr>
......@@ -62,7 +65,7 @@
</div>
<div id="crmExt-detail-details">
<h4>Details</h4>
<h4>{{ts('Details')}}</h4>
<table class="crm-info-panel">
<tr>
<td class="label">{{ts('Version')}}</td>
......
(function(angular, $, _) {
// Controller for the "Extension Details" dialog content.
angular.module('crmExt').controller('ExtDetailCtrl', function ExtDetailCtrl($scope) {
var ts = $scope.ts = CRM.ts(null);
angular.module('crmExt').controller('ExtDetailCtrl', function ExtDetailCtrl() {
});
})(angular, CRM.$, CRM._);
<div crm-ui-debug="extensions"></div>
<h1 crm-page-title>{{ts('CiviCRM Extensions')}}</h1>
<p class="help">
{{ts("Thank you for trying out this pre-release of CiviCRM's next-generation extensions manager. As this project is in its early stages, you may find that it does not yet contain all the features of its predecessor.")}}
<!-- Note: This is not translated because Angular's ts() function does not support HTML in strings. -->
Thank you for trying out this pre-release of CiviCRM's next-generation extensions manager. As this project is in its early stages,
you may find that it does not yet contain all the features of its predecessor. The <a href="{{legacyExtensionsURL}}">legacy
interface</a> is still available, should you need it.
The <a href="{{legacyExtensionsURL}}">legacy interface</a> is still available, should you need it.
</p>
<div ng-include="'~/crmExt/BlockPageActionLinks.html'"></div>
<div class="crm-container">
......
......@@ -28,8 +28,7 @@
angular.module('crmExt').controller('ExtensionsuicrmExt', function ($scope, crmApi, crmStatus, crmUiHelp, dialogService, $q, $timeout, extensions, Extension) {
$scope.extensions = extensions;
// The ts() and hs() functions help load strings for this module.
var ts = $scope.ts = CRM.ts('crmExt');
// The hs() function helps load strings for this module.
var hs = $scope.hs = crmUiHelp({file: 'CRM/crmExt/crmExt'}); // See: templates/CRM/crmExt/crmExt.hlp
$scope.addNewHelpText = ts('These extensions are compatible with your version of CiviCRM and have passed a quality review by the CiviCRM community. You may also want to check the <a href="https://civicrm.org/extensions">CiviCRM Extensions Directory</a> for CiviCRM-related <a href="https://civicrm.org/extensions/%1">%1 modules</a>, which are not listed here.', {1: CRM.config.userFramework});
......
......@@ -15,7 +15,6 @@
>
<td class="crm-ext-name">
<!-- todo: ng-click okay? encapsulate this in the directive instead? -->
<!-- todo: pass the extension data in -->
<span ng-click="showDetail(extension)" class="crmExt-detail-link">{{extension.name}}</span>
<br/>{{extension.maintainer.author}} <span ng-if="(extension.maintainer.email.length)">({{extension.maintainer.email}})</span>
</td>
......
......@@ -8,7 +8,7 @@
},
templateUrl: '~/crmExt/directives/crmExtTable.html',
controller: ['$scope', '$http', function crmExtTable($scope, $http) {
var ts = $scope.ts = CRM.ts('crmExt');
$scope.ts = $scope.$root.ts;
var displayedStatuses = ($scope.extContext === 'installed'
? ['disabled', 'disabled-missing', 'installed', 'installed-missing']
......
......@@ -109,24 +109,24 @@
switch (action) {
case 'disable':
messages.start = `Disabling ${this.name} (${this.key})...`;
messages.success = `${this.name} (${this.key}) disabled`;
messages.start = ts('Disabling %1 (%2)…', {1: this.name, 2: this.key});
messages.success = ts('%1 (%2) disabled', {1: this.name, 2: this.key});
break;
case 'enable':
messages.start = `Enabling ${this.name} (${this.key})...`;
messages.success = `${this.name} (${this.key}) enabled`;
messages.start = ts('Enabling %1 (%2)…', {1: this.name, 2: this.key});
messages.success = ts('%1 (%2) enabled', {1: this.name, 2: this.key});
break;
case 'install':
messages.start = `Installing ${this.name} (${this.key})...`;
messages.success = `${this.name} (${this.key}) installed`;
messages.start = ts('Installing %1 (%2)…', {1: this.name, 2: this.key});
messages.success = ts('%1 (%2) installed', {1: this.name, 2: this.key});
break;
case 'uninstall':
messages.start = `Uninstalling ${this.name} (${this.key})...`;
messages.success = `${this.name} (${this.key}) uninstalled`;
messages.start = ts('Uninstalling %1 (%2)…', {1: this.name, 2: this.key});
messages.success = ts('%1 (%2) uninstalled', {1: this.name, 2: this.key});
break;
case 'upgrade':
messages.start = `Upgrading ${this.name} (${this.key})...`;
messages.success = `${this.name} (${this.key}) upgraded`;
messages.start = ts('Upgrading %1 (%2)…', {1: this.name, 2: this.key});
messages.success = ts('%1 (%2) upgraded', {1: this.name, 2: this.key});
break;
}
......@@ -143,7 +143,7 @@
var localVersion = _.result(this.local, 'version');
var remoteVersion = _.result(this.remote, 'version');
var hasUpgrade = version_compare (localVersion, remoteVersion, '<');
return (hasUpgrade ? remoteVersion : false);
return (hasUpgrade && localVersion !== null ? remoteVersion : false);
};
/**
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment