From 9af9145cb632455d9a953fc7bae35328112fd65d Mon Sep 17 00:00:00 2001
From: "Endi S. Dewata" <edewata@redhat.com>
Date: Fri, 11 Apr 2014 15:02:51 -0400
Subject: [PATCH] Replaced activity dialog with activity page.

The dialog used to view activity attributes has been replaced with
a details page since it will be required for breadcrumbs. A new
HTML template has been added for this page.

Ticket #654
---
 base/tps-tomcat/shared/webapps/tps/js/activity.js  | 48 +++++++++++++++++-----
 .../shared/webapps/tps/ui/activities.html          | 29 -------------
 .../tps-tomcat/shared/webapps/tps/ui/activity.html | 39 ++++++++++++++++++
 base/tps-tomcat/shared/webapps/tps/ui/index.html   |  2 +-
 4 files changed, 78 insertions(+), 40 deletions(-)
 create mode 100644 base/tps-tomcat/shared/webapps/tps/ui/activity.html

diff --git a/base/tps-tomcat/shared/webapps/tps/js/activity.js b/base/tps-tomcat/shared/webapps/tps/js/activity.js
index 66e54b3ce6f23adc69f62598cac2982a62ffe4fe..5b636b69e02c3ba0e6785f0c2bd82c76ce8ac5c1 100644
--- a/base/tps-tomcat/shared/webapps/tps/js/activity.js
+++ b/base/tps-tomcat/shared/webapps/tps/js/activity.js
@@ -66,21 +66,49 @@ var ActivityCollection = Collection.extend({
     }
 });
 
-var ActivityPage = Page.extend({
+var ActivityPage = EntryPage.extend({
+    initialize: function(options) {
+        var self = this;
+        ActivityPage.__super__.initialize.call(self, options);
+        self.parentPage = options.parentPage;
+    },
+    close: function() {
+        var self = this;
+        if (self.parentPage) {
+            self.parentPage.open();
+        } else {
+            ActivityPage.__super__.close.call(self);
+        }
+    }
+});
+
+var ActivitiesTable = ModelTable.extend({
+    initialize: function(options) {
+        var self = this;
+        ActivitiesTable.__super__.initialize.call(self, options);
+        self.parentPage = options.parentPage;
+    },
+    open: function(item, column) {
+        var self = this;
+
+        var page = new ActivityPage({
+            el: self.parentPage.$el,
+            url: "activity.html",
+            model: self.collection.get(item.entry.id)
+        });
+
+        page.open();
+    }
+});
+
+var ActivitiesPage = Page.extend({
     load: function() {
         var self = this;
 
-        var editDialog = new Dialog({
-            el: $("#activity-dialog"),
-            title: "Edit Activity",
-            readonly: ["id", "tokenID", "userID", "ip",
-                "operation", "result", "date"]
-        });
-
-        var table = new Table({
+        var table = new ActivitiesTable({
             el: $("table[name='activities']"),
             collection: new ActivityCollection(),
-            editDialog: editDialog
+            parentPage: self
         });
 
         table.render();
diff --git a/base/tps-tomcat/shared/webapps/tps/ui/activities.html b/base/tps-tomcat/shared/webapps/tps/ui/activities.html
index 8f6aabfb3b8f92a058afe77741c7fdf10022fa40..51cc3b105e351e99a9b363854b80fccf4e9a0a66 100644
--- a/base/tps-tomcat/shared/webapps/tps/ui/activities.html
+++ b/base/tps-tomcat/shared/webapps/tps/ui/activities.html
@@ -76,32 +76,3 @@
     </tr>
 </tfoot>
 </table>
-
-<div id="activity-dialog" class="rcue-dialog-background">
-    <div class="rcue-dialog">
-        <header>
-            <h1>Activity</h1>
-            <a class="rcue-button-close" href="#"></a>
-        </header>
-        <fieldset>
-            <label>Activity ID</label>
-            <input name="id" readonly="readonly"><br>
-            <label>Token ID</label>
-            <input name="tokenID" readonly="readonly"><br>
-            <label>User ID</label>
-            <input name="userID" readonly="readonly"><br>
-            <label>IP</label>
-            <input name="ip" readonly="readonly"><br>
-            <label>operation</label>
-            <input name="operation" readonly="readonly"><br>
-            <label>Result</label>
-            <input name="result" readonly="readonly"><br>
-            <label>Date</label>
-            <input name="date" readonly="readonly"><br>
-        </fieldset>
-        <footer>
-            <button name="save" class="primary">Save</button>
-            <button name="cancel">Cancel</button>
-        </footer>
-    </div>
-</div>
diff --git a/base/tps-tomcat/shared/webapps/tps/ui/activity.html b/base/tps-tomcat/shared/webapps/tps/ui/activity.html
new file mode 100644
index 0000000000000000000000000000000000000000..5845d045853542b83250c6fa622351225520b84f
--- /dev/null
+++ b/base/tps-tomcat/shared/webapps/tps/ui/activity.html
@@ -0,0 +1,39 @@
+<!-- --- BEGIN COPYRIGHT BLOCK ---
+     This program is free software; you can redistribute it and/or modify
+     it under the terms of the GNU General Public License as published by
+     the Free Software Foundation; version 2 of the License.
+
+     This program 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 General Public License for more details.
+
+     You should have received a copy of the GNU 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.
+
+     Copyright (C) 2013 Red Hat, Inc.
+     All rights reserved.
+     --- END COPYRIGHT BLOCK --- -->
+<div class="pki-header">
+<span class="pki-title">Activity <span name="id"></span></span>
+</div>
+
+<div name="activity" class="pki-fields">
+<fieldset>
+    <label>Activity ID</label>
+    <input name="id" readonly="readonly"><br>
+    <label>Token ID</label>
+    <input name="tokenID" readonly="readonly"><br>
+    <label>User ID</label>
+    <input name="userID" readonly="readonly"><br>
+    <label>IP</label>
+    <input name="ip" readonly="readonly"><br>
+    <label>operation</label>
+    <input name="operation" readonly="readonly"><br>
+    <label>Result</label>
+    <input name="result" readonly="readonly"><br>
+    <label>Date</label>
+    <input name="date" readonly="readonly"><br>
+</fieldset>
+</div>
diff --git a/base/tps-tomcat/shared/webapps/tps/ui/index.html b/base/tps-tomcat/shared/webapps/tps/ui/index.html
index 412892b01caeadcb6f0d8c335dff9162dc6b7825..a0a265a21837d69a15826d3877d431f59a242d0b 100644
--- a/base/tps-tomcat/shared/webapps/tps/ui/index.html
+++ b/base/tps-tomcat/shared/webapps/tps/ui/index.html
@@ -61,7 +61,7 @@ $(function() {
 
     var content = $("#content");
 
-    navigation.page("activities", new ActivityPage({
+    navigation.page("activities", new ActivitiesPage({
         el: content,
         url: "activities.html"
     }));
-- 
1.8.4.2

