summaryrefslogtreecommitdiffstats
path: root/WebContent/pages
diff options
context:
space:
mode:
authorStefan Suhren <suhren.stefan@fh-swf.de>2015-12-13 22:07:46 +0100
committerStefan Suhren <suhren.stefan@fh-swf.de>2015-12-13 23:35:23 +0100
commit5f30a827fc84af1e54f0716a49995e98a044ebd6 (patch)
tree27a68fbd5640c445f549e696af8141aeba6e9769 /WebContent/pages
parenta14734c965fd7aaf6485bb2bb2a72a68bdb5d14d (diff)
downloadJCatalog-5f30a827fc84af1e54f0716a49995e98a044ebd6.tar.gz
JCatalog-5f30a827fc84af1e54f0716a49995e98a044ebd6.zip
Add editing capabilities
Diffstat (limited to 'WebContent/pages')
-rw-r--r--WebContent/pages/categories.xhtml22
-rw-r--r--WebContent/pages/category.xhtml20
-rw-r--r--WebContent/pages/product.xhtml7
-rw-r--r--WebContent/pages/products.xhtml16
4 files changed, 50 insertions, 15 deletions
diff --git a/WebContent/pages/categories.xhtml b/WebContent/pages/categories.xhtml
index cb6ef27..7c3ecac 100644
--- a/WebContent/pages/categories.xhtml
+++ b/WebContent/pages/categories.xhtml
@@ -43,17 +43,19 @@
<f:param name="selectedId" value="#{category.id}" />
</h:commandLink>
</h:column>
- <c:if test="#{UserManager.loggedIn}">
- <h:column>
- <f:facet name="header">
- <h:outputText value="" />
- </f:facet>
- <h:commandLink value="Edit Details ..." immediate="true" action="category">
- <f:param name="selectedId" value="#{category.id}" />
- </h:commandLink>
- </h:column>
- </c:if>
+ <h:column rendered="#{UserManager.loggedIn}">
+ <f:facet name="header">
+ <h:outputText value="" />
+ </f:facet>
+ <h:commandLink value="Edit" immediate="true"
+ actionListener="#{CategoryManager.edit}" action="edit">
+ <f:param name="selectedId" value="#{category.id}" />
+ </h:commandLink>
+ </h:column>
</h:dataTable>
+ <h:commandLink rendered="#{UserManager.loggedIn}" disabled="#{not UserManager.loggedIn}" value="New Category" immediate="true"
+ actionListener="#{CategoryManager.createCategory}" action="createCategory">
+ </h:commandLink>
</h:form>
</ui:define>
diff --git a/WebContent/pages/category.xhtml b/WebContent/pages/category.xhtml
index 4a5ea10..7d6f43a 100644
--- a/WebContent/pages/category.xhtml
+++ b/WebContent/pages/category.xhtml
@@ -13,7 +13,25 @@
<ui:define name="pageHeader">JCatalog Application</ui:define>
<ui:define name="body">
- <h2>Welcome to the JCatalog Demo Application <h:outputText id="category" value="#{CategoryManager.current.name}" /></h2>
+ <div style="width: 500px; padding: 5px; margin: 0px auto; float: left;">
+ <h:form>
+ <div class="row">
+ <label for="name">Name:</label>
+ <span class="formw"><h:inputText id="name" disabled="#{not UserManager.loggedIn}" value="#{CategoryManager.current.name}" accesskey="n" size="40" /></span>
+ </div>
+ <div class="row">
+ <label for="description">Description:</label>
+ <span class="formw"><h:inputTextarea rows="20" cols="40" id="description" disabled="#{not UserManager.loggedIn}" value="#{CategoryManager.current.description}" accesskey="d" /></span>
+ </div>
+ <div class="row">
+ <span class="formw">
+ <h:commandButton action="categories" id="back" value="Back" type="submit" accesskey="b" />
+ <h:commandButton action="#{CategoryManager.saveCategory}" rendered="#{UserManager.loggedIn}" disabled="#{not UserManager.loggedIn}" id="save" value="Save" type="submit" accesskey="s" />
+ </span>
+ </div>
+ <div class="spacer" />
+ </h:form>
+ </div>
</ui:define>
<ui:define name="pageFooter">JCatalog Footer</ui:define>
diff --git a/WebContent/pages/product.xhtml b/WebContent/pages/product.xhtml
index 84b49f6..d5f3f41 100644
--- a/WebContent/pages/product.xhtml
+++ b/WebContent/pages/product.xhtml
@@ -17,19 +17,20 @@
<h:form>
<div class="row">
<label for="name">Name:</label>
- <span class="formw"><h:inputText id="name" disabled="true" value="#{ProductManager.current.name}" accesskey="n" size="40" /></span>
+ <span class="formw"><h:inputText id="name" disabled="#{not UserManager.loggedIn}" value="#{ProductManager.current.name}" accesskey="n" size="40" /></span>
</div>
<div class="row">
<label for="price">Price:</label>
- <span class="formw"><h:inputText id="price" disabled="true" value="#{ProductManager.current.price}" accesskey="p" size="40" /></span>
+ <span class="formw"><h:inputText id="price" disabled="#{not UserManager.loggedIn}" value="#{ProductManager.current.price}" accesskey="p" size="40" /></span>
</div>
<div class="row">
<label for="description">Description:</label>
- <span class="formw"><h:inputTextarea rows="20" cols="40" id="description" disabled="true" value="#{ProductManager.current.description}" accesskey="d" /></span>
+ <span class="formw"><h:inputTextarea rows="20" cols="40" id="description" disabled="#{not UserManager.loggedIn}" value="#{ProductManager.current.description}" accesskey="d" /></span>
</div>
<div class="row">
<span class="formw">
<h:commandButton action="products" id="back" value="Back" type="submit" accesskey="b" />
+ <h:commandButton action="#{ProductManager.saveCurrentProduct}" rendered="#{UserManager.loggedIn}" disabled="#{not UserManager.loggedIn}" id="save" value="Save" type="submit" accesskey="s" />
</span>
</div>
<div class="spacer" />
diff --git a/WebContent/pages/products.xhtml b/WebContent/pages/products.xhtml
index 1b5e5e4..8050c30 100644
--- a/WebContent/pages/products.xhtml
+++ b/WebContent/pages/products.xhtml
@@ -50,8 +50,22 @@
<f:param name="selectedId" value="#{product.id}" />
</h:commandLink>
</h:column>
+ <h:column rendered="#{UserManager.loggedIn}">
+ <f:facet name="header">
+ <h:outputText value="" />
+ </f:facet>
+ <h:commandLink rendered="#{UserManager.loggedIn}" disabled="#{not UserManager.loggedIn}"
+ value="remove" immediate="true" actionListener="#{ProductManager.deleteProduct}" action="deleteProduct">
+ <f:param name="selectedId" value="#{product.id}" />
+ </h:commandLink>
+ </h:column>
</h:dataTable>
-
+ <h:commandLink rendered="#{UserManager.loggedIn}" value="New Product" immediate="true"
+ actionListener="#{ProductManager.newProduct}" action="newProduct">
+ </h:commandLink>
+ <h:commandLink rendered="#{UserManager.loggedIn}" disabled="#{!UserManager.loggedIn}" value="Delete Category" immediate="true"
+ actionListener="#{CategoryManager.deleteCurrentCategory}" action="deleteCurrentCategory">
+ </h:commandLink>
</h:form>
</ui:define>