CRM-13823 - Switch statusPage to use tabbed interface
authorColeman Watts <coleman@civicrm.org>
Thu, 22 Oct 2015 19:33:47 +0000 (15:33 -0400)
committerColeman Watts <coleman@civicrm.org>
Thu, 22 Oct 2015 20:37:55 +0000 (16:37 -0400)
ang/crmStatusPage.js
ang/crmStatusPage/StatusPage.html
ang/crmStatusPage/StatusPageCtrl.js
ang/crmStatusPage/StatusPageServices.js

index eae10777a69b0ac7353ec1cbcea4cd4811ba0422..91a60466373d33239f4b885ad9869e5a9a72a4de 100644 (file)
 
       resolve: {
         statuses: function(statuspageGetStatuses) {
-          return statuspageGetStatuses({is_visible: 1});
-        },
-        statusModel: function(statuspageStatusModel) {
-          return statuspageStatusModel();
-        },
-        preferences: function(statuspageGetPreferences){
-          return statuspageGetPreferences();
-        }
-      }
-    });
-
-    $routeProvider.when('/status/hushed', {
-      controller: 'statuspageStatusPage',
-      templateUrl: '~/statuspage/StatusPage.html',
-
-      resolve: {
-        statuses: function(statuspageGetStatuses) {
-          return statuspageGetStatuses({is_visible: 0});
+          return statuspageGetStatuses({sequential: 1});
         },
         statusModel: function(statuspageStatusModel) {
           return statuspageStatusModel();
index 2c5a9cd3ac49eb75e22597ae38cf170af8b7f4fc..9100fcc8496048a82d98953456d49ec276da326d 100644 (file)
@@ -5,38 +5,46 @@
   <form name="crm-system-status" crm-ui-id-scope>
 
     <div>
-      <h1>Status Page</h1><br />
-      <button ng-if="(path === '/status/hushed')" ng-click="navigator.redirect('#/status')">Return home</button>
-      <button ng-if="(path === '/status')" ng-click="navigator.redirect('#/status/hushed')">Show snoozed and hushed</button>
+      <h1>Status Page</h1>
     </div>
-    <div id="crm-status-list" ng-repeat="status in statuses.values track by status.name" >
-      <h3 class="crm-severity-{{status.severity}}">
-        <i ng-if="status.icon" class="crm-i {{status.icon}}"></i>
-        {{status.title}}
-        <span class="status-snooze-options" ng-show="status.snoozeOptions.show" style="display: inline-block">
-          <div crm-snooze-options style="display: inline"></div>
-        </span>
-          <a  ng-if="(path === '/status')"  ng-click="showSnoozeOptions(status)" ng-show="!status.snoozeOptions.show" class="crm-hover-button" crm-icon="fa-clock-o" title="{{ts('Snooze')}}"></a>
-          <a ng-click="showSnoozeOptions(status)" ng-show="status.snoozeOptions.show" class="crm-hover-button" crm-icon="fa-times" style="display: inline" title="{{ts('Close')}}"></a>
-          <a ng-if="(path === '/status')" ng-click="hush(status.name, status.severity)" class="crm-hover-button" crm-icon="fa-bell-slash-o" title="{{ts('Hush')}}"></a>
-          <a ng-if="(path === '/status/hushed')" ng-click="unhush(status.name)" class="crm-hover-button" crm-icon="fa-bell-o" title="{{ts('Unhush And Unsnooze')}}"></a>
-      </h3>
-      <h4>
-        <div class="crm-block">
-          <div class="crm-group">
-            <div class="crm-status-message-body">
-              <span ng-bind-html="status.message | trusted"></span>
-              <a
-                ng-if="status.help"
-                class="helpicon"
-                ng-click="alert(status.help, status.title, 'info');"
-                href="javascript:void(0)"
-                >
-              </a>
+
+    <div crm-ui-tab-set>
+      <div
+        ng-repeat="tab in [{is_visible: 1, name: 'visible'}, {is_visible: 0, name: 'hidden'}]"
+        crm-ui-tab id="tab-{{tab.name}}"
+        crm-title="tab.is_visible ? ts('Active') : ts('Hushed/Snoozed')"
+        >
+        <div id="crm-status-list" ng-repeat="status in statuses.values | filter:{is_visible: tab.is_visible}" >
+          <h3 class="crm-severity-{{status.severity}}">
+            <i ng-if="status.icon" class="crm-i {{status.icon}}"></i>
+            {{status.title}}
+            <span class="status-snooze-options" ng-show="status.snoozeOptions.show" style="display: inline-block">
+              <div crm-snooze-options style="display: inline"></div>
+            </span>
+            <a  ng-if="status.is_visible"  ng-click="showSnoozeOptions(status)" ng-show="!status.snoozeOptions.show" class="crm-hover-button" crm-icon="fa-clock-o" title="{{ts('Snooze')}}"></a>
+            <a ng-click="showSnoozeOptions(status)" ng-show="status.snoozeOptions.show" class="crm-hover-button" crm-icon="fa-times" style="display: inline" title="{{ts('Close')}}"></a>
+            <a ng-if="status.is_visible" ng-click="hush(status.name, status.severity)" class="crm-hover-button" crm-icon="fa-bell-slash-o" title="{{ts('Hush')}}"></a>
+            <a ng-if="!status.is_visible" ng-click="unhush(status.name)" class="crm-hover-button" crm-icon="fa-bell-o" title="{{ts('Unhush And Unsnooze')}}"></a>
+          </h3>
+          <h4>
+            <div class="crm-block">
+              <div class="crm-group">
+                <div class="crm-status-message-body">
+                  <span ng-bind-html="status.message | trusted"></span>
+                  <a
+                    ng-if="status.help"
+                    class="helpicon"
+                    ng-click="alert(status.help, status.title, 'info');"
+                    href="javascript:void(0)"
+                    >
+                  </a>
+                </div>
+              </div>
             </div>
-          </div>
+          </h4><br/>
         </div>
-      </h4><br/>
+
+      </div>
     </div>
 
   </form>
index bec4df34f16136c0134d2b63e2f73b67274a6d23..52ec83b22e50cb7562eba79b58cb507e28be426c 100644 (file)
@@ -3,13 +3,9 @@
   // controller
 
   angular.module('statuspage').controller('statuspageStatusPage',
-    function($scope, $location, crmApi, crmStatus, crmUiHelp, statuses, crmNavigator, preferences) {
-    // The ts() and hs() functions help load strings for this module.
-    var ts = $scope.ts = CRM.ts('statuspage');
-    // var hs = $scope.hs = crmUiHelp({file: 'CRM/statuspage/StatusPage'}); // See: templates/CRM/statuspage/StatusPage.hlp
+    function($scope, crmApi, crmStatus, crmUiHelp, statuses, preferences) {
 
-    $scope.path = $location.path();
-    $scope.navigator = crmNavigator;
+    var ts = $scope.ts = CRM.ts();
     $scope.statuses = statuses;
     $scope.preferences = preferences;
     $scope.alert = CRM.alert;
@@ -33,7 +29,6 @@
       return  crmStatus(
         { start: ts('Saving Status Preference...')      , success: ts('Preference Saved') },
         crmApi('StatusPreference', 'create', {
-          "sequential": 1,
           "name": name,
           "ignore_severity": 0,
           "hush_until": ""
@@ -48,7 +43,6 @@
       return crmStatus(
         { status: ts('Saving Status Preference...')   , success: ts('Preference Saved') },
           crmApi('StatusPreference', 'create', {
-            "sequential": 1,
             "name": status.name,
             "ignore_severity": status.snoozeOptions.severity,
             "hush_until": status.snoozeOptions.until
index 5ece188e9d9d03afe78c041c3162be5cb6f32ae6..8f82941883764e1318b4a5947a753a200a621a03 100644 (file)
@@ -29,7 +29,6 @@
           _.each(apiResults.values, function(status){
             status.severity_id = status.severity;
             status.severity = statuspageSeverityList[status.severity];
-            status.displayTitle = status.name+' - '+status.title +' - '+status.severity.toUpperCase();
             status.snoozeOptions = {
               show: false,
               severity: status.severity