Skip to content

Commit

Permalink
Merged the bootstrap branch - we now use native bootstrap 3.1
Browse files Browse the repository at this point in the history
  • Loading branch information
michbarsinai committed Feb 19, 2014
1 parent 8e2feea commit ac8edd6
Show file tree
Hide file tree
Showing 28 changed files with 8,797 additions and 390 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
nb-configuration.xml
target
nbactions.xml

michael-local
# OS generated files #
######################
.DS_Store
Expand Down
25 changes: 25 additions & 0 deletions doc/Architecture/bootstrap-migration-tips.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
Bootstrap Migration Tips
========================

* `p:panel` -> `ui:fragment`, or just the content, when possible.
* Whenever possible, no xhtml at all
* `<h:outputText value="abc"/>` -> abc
* conditional rendering based on `ui:fragment`'s `rendered` property.
* Cant use HTML entities. Use the actual unicode char instead.
* HTML5's attributes using passthrough:

h:inputText id="email" value="#{bean.email}">
<f:passThroughAttribute name="type" value="email"/>
<f:passThroughAttribute name="placeholder"
value="Enter email"/>
</h:inputText>

* More on html5 and JSF 2.2 at http://jsflive.wordpress.com/2013/08/08/jsf22-html5/
* We have a bootstrap component lib, `iqbs`.
* Need to manually convert the font references to JSF compliant:
* from `url('../fonts/glyphicons-halflings-regular.eot');'
* to `url("#{resource['bs/fonts/glyphicons-halflings-regular.eot']}");`
* from `url('../fonts/glyphicons-halflings-regular.eot?SomeThings');' (note the parameter at the end)
* to `url("#{resource['bs/fonts/glyphicons-halflings-regular.eot']}?someThings");`
* same for `?` parameters at the end.

17 changes: 17 additions & 0 deletions src/main/java/edu/harvard/iq/dataverse/SampleCommandPage.java
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ public class SampleCommandPage {
private String newName;
private Long selectedDvObjectId;
private DataverseUser selectedUser;
private String message;


public void init() {
Expand All @@ -75,6 +76,14 @@ public void init() {
selectedDvObjectId = objects.get(0).getId();
}
}

}

public void addMessage( ActionEvent e ) {
JH.addMessage(FacesMessage.SEVERITY_FATAL, "FATAL! " + getMessage(), "Such useful details! Oh My!");
JH.addMessage(FacesMessage.SEVERITY_ERROR, "ERROR! " + getMessage(), "Such useful details! Oh My!");
JH.addMessage(FacesMessage.SEVERITY_WARN, "This is just a warning", getMessage());
JH.addMessage(FacesMessage.SEVERITY_INFO, "Informational message: " + getMessage() + ", for your info", "Such useful details! Oh My!");
}

public void actionSave( ActionEvent e ) {
Expand Down Expand Up @@ -206,6 +215,14 @@ public Long getSelectedDvObjectId() {
public void setSelectedDvObjectId(Long selectedDvObjectId) {
this.selectedDvObjectId = selectedDvObjectId;
}

public String getMessage() {
return message;
}

public void setMessage(String message) {
this.message = message;
}


}
2 changes: 0 additions & 2 deletions src/main/java/edu/harvard/iq/dataverse/api/Users.java
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
package edu.harvard.iq.dataverse.api;

import edu.harvard.iq.dataverse.DataverseUser;
import edu.harvard.iq.dataverse.DataverseUserServiceBean;
import static edu.harvard.iq.dataverse.api.JsonPrinter.json;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.ejb.EJB;
import javax.json.Json;
import javax.json.JsonArrayBuilder;
import javax.ws.rs.GET;
Expand Down
24 changes: 23 additions & 1 deletion src/main/webapp/WEB-INF/web.xml
Original file line number Diff line number Diff line change
Expand Up @@ -50,5 +50,27 @@
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.xhtml</url-pattern>
</servlet-mapping>



<!-- web fonts -->
<mime-mapping>
<extension>eot</extension>
<mime-type>application/vnd.ms-fontobject</mime-type>
</mime-mapping>
<mime-mapping>
<extension>otf</extension>
<mime-type>font/opentype</mime-type>
</mime-mapping>
<mime-mapping>
<extension>ttf</extension>
<mime-type>application/x-font-ttf</mime-type>
</mime-mapping>
<mime-mapping>
<extension>woff</extension>
<mime-type>application/x-font-woff</mime-type>
</mime-mapping>
<mime-mapping>
<extension>svg</extension>
<mime-type>image/svg+xml</mime-type>
</mime-mapping>
</web-app>
49 changes: 33 additions & 16 deletions src/main/webapp/dataverse.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -100,15 +100,27 @@
</ui:fragment>

<ui:fragment rendered="#{!empty dataverseSession.user and !DataversePage.editMode}">
<p:menuButton id="editDataverse" value="Edit Dataverse" iconPos="right">
<p:menuitem id="editInfo" value="Edit Info" actionListener="#{DataversePage.edit}" update="@all"/>
<p:menuitem id="manageRoles" value="Roles and Permissions" outcome="manage-roles">
<f:param name="dataverseId" value="#{DataversePage.dataverse.id}" />
<f:param name="objectType" value="DATAVERSE" />
</p:menuitem>
<p:menuitem value="Edit Theme" disabled="true"/>
<p:menuitem value="Edit Permissions" disabled="true"/>
</p:menuButton>
<div class="btn-group">
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
Edit Dataverse <span class="caret"></span>
</button>
<ul class="dropdown-menu" role="menu" style="text-align:left;">
<li>
<p:commandLink id="editInfo" actionListener="#{DataversePage.edit}" update="@all">
<h:outputText value="General Information" />
</p:commandLink>
</li>
<li>
<h:link id="manageRoles" outcome="manage-roles">
<h:outputText value="Roles + Permissions" />
<f:param name="dataverseId" value="#{DataversePage.dataverse.id}" />
<f:param name="objectType" value="DATAVERSE" />
</h:link>
</li>
<li><a href="#" style="pointer-events: none; color: grey;">Theme</a></li>
<li><a href="#" style="pointer-events: none; color: grey;">Permissions</a></li>
</ul>
</div>
</ui:fragment>
</p:panelGrid>
</p:panel>
Expand Down Expand Up @@ -149,13 +161,18 @@
<p:panelGrid styleClass="panelgridLayoutTable" columns="2" columnClasses="leftClass,rightClass">
<ui:fragment rendered="#{permissionServiceBean.on(DataversePage.dataverse).canIssueCommand('DatasetCreate')}">
<h:form id="shareForm" style="margin-left:auto;">
<p:menuButton id="shareData" value="Add Data" iconPos="right">
<p:menuitem id="createDataverse" value="Create Dataverse" url="/dataverse.xhtml?ownerId=#{DataversePage.dataverse.id}"/>
<p:menuitem id="UploadDataset" value="Add Dataset" url="/dataset.xhtml?ownerId=#{DataversePage.dataverse.id}"/>
<p:menuitem value="Link to Existing Dataverse" disabled="true"/>
<p:menuitem value="Link to Existing Dataset" disabled="true"/>
<p:menuitem value="Create Query" disabled="true"/>
</p:menuButton>
<div class="btn-group">
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
Add Data <span class="caret"></span>
</button>
<ul class="dropdown-menu" role="menu">
<li><a href="/dataverse.xhtml?ownerId=#{DataversePage.dataverse.id}">New Dataverse</a></li>
<li><a href="/dataset.xhtml?ownerId=#{DataversePage.dataverse.id}">New Dataset</a></li>
<li><a href="#" style="pointer-events: none; color: grey;">Existing Dataverse</a></li>
<li><a href="#" style="pointer-events: none; color: grey;">Existing Dataset</a></li>
<li><a href="#" style="pointer-events: none; color: grey;">New Query</a></li>
</ul>
</div>
</h:form>
</ui:fragment>
</p:panelGrid>
Expand Down
180 changes: 94 additions & 86 deletions src/main/webapp/dataverse_header.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -2,101 +2,109 @@
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:p="http://primefaces.org/ui">
xmlns:p="http://primefaces.org/ui"
xmlns:iqbs="http://xmlns.jcp.org/jsf/composite/iqbs">

<!-- Header Panel -->
<p:panel style="background-color: lightskyblue; height:70px;">
<p:panelGrid styleClass="panelgridHeaderTable" columns="2">
<ui:fragment>
<h:outputLink value="/dataverse.xhtml?id=#{dataverse.id}" rendered="#{dataverse.id != null}">
<h:outputText id="nameOutput" value="#{dataverse.name} Dataverse" style="font-size:1.5em;font-weight:bold; padding:4px 0 4px 34px; background: url(/resources/images/icon_dataverse.png) no-repeat 0 50%;"/>
</h:outputLink>
<nav class="navbar navbar-default" role="navigation">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#topNavBar">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="/dataverse.xhtml?id=#{dataverse.id}">#{dataverse.name} Dataverse</a>
</div>
<div class="collapse navbar-collapse" id="topNavBar">

<h:outputText value="New Dataverse" style="font-size:1.5em;font-weight:bold;" rendered="#{dataverse.id == null and ownerId != null}"/>

<h:outputText value="Welcome to the Dataverse Network" style="font-size:1.5em;font-weight:bold;" rendered="#{dataverse.id == null and ownerId == null}"/>
</ui:fragment>
<ui:fragment>
<p:panelGrid columns="3">
<ui:fragment>
<h:outputLink value="/guides/index.html" target="_blank">
User Guides
</h:outputLink>
</ui:fragment>
<ui:fragment>
<h:outputLink value="/dataverseuser.xhtml?editMode=CREATE" rendered="#{dataverseSession.user.guest}">
Create Account
</h:outputLink>
<h:outputLink value="/dataverseuser.xhtml?editMode=INFO" rendered="#{!dataverseSession.user.guest}">
<h:outputText value="#{dataverseSession.user.firstName} #{dataverseSession.user.lastName}" />
<span style="margin-left: 5px; font-size:10pt">
<h:outputLink value="loginpage.xhtml">
(not you?)
</h:outputLink>
</span>
</h:outputLink>
</ui:fragment>
<ui:fragment>
<h:outputLink value="/loginpage.xhtml" rendered="#{dataverseSession.user.guest}">
Log In
</h:outputLink>
<h:form id="headerForm">
<h:commandLink actionListener="#{dataverseSession.setUser(null)}" rendered="#{!dataverseSession.user.guest}">
Log Out
</h:commandLink>
</h:form>
<ul class="nav navbar-nav navbar-right">
<li>
<h:outputLink value="/guides/index.html" target="_blank">
User Guides
</h:outputLink>
</li>
<ui:fragment rendered="#{dataverseSession.user.guest}">
<li>
<h:outputLink value="/dataverseuser.xhtml?editMode=CREATE">
Create Account
</h:outputLink>
</li>
</ui:fragment>
<ui:fragment rendered="#{!dataverseSession.user.guest}">
<li>
<h:outputLink value="/dataverseuser.xhtml?editMode=INFO" >
<h:outputText value="#{dataverseSession.user.firstName} #{dataverseSession.user.lastName}" />
</h:outputLink>
</li>
</ui:fragment>
<ui:fragment rendered="#{dataverseSession.user.guest}">
<li>
<h:outputLink value="/loginpage.xhtml">
Log In
</h:outputLink>
</li>
</ui:fragment>
</p:panelGrid>
</ui:fragment>
</p:panelGrid>
</p:panel>
<ui:fragment rendered="#{not dataverseSession.user.guest}">
<h:form styleClass="navbar-form navbar-left" role="logout">
<h:commandButton value="Log Out" styleClass="btn btn-default" actionListener="#{dataverseSession.setUser(null)}"/>
</h:form>
</ui:fragment>
</ul>
</div>
</div>
</nav>

<!-- Breadcrumbs Panel -->
<p:panel id="breadcrumbNavBlock" styleClass="panelLayoutBlock" rendered="#{showBreadcrumbs}">
<!-- Dataverses -->
<ui:repeat value="#{dataverseHeaderFragment.getDataverses(dataverse)}" var="dv" varStatus="status">
<h:outputText value=" > " styleClass="breadcrumbCarrot" rendered="#{!status.first}"/>
<div class="container">
<ui:fragment rendered="#{!empty dataverseServiceBean.findByOwnerId(dv.getId())}">

<p:outputPanel id="breadcrumbPnlIcn" style="float:left; margin-top:.3em; width:16px; height:16px; background-image: url(/javax.faces.resource/images/ui-icons_333333_256x240.png.xhtml?ln=primefaces-bootstrap); background-position:-64px -16px;"/>

<!-- Breadcrumbs Panel -->
<p:panel id="breadcrumbNavBlock" styleClass="panelLayoutBlock" rendered="#{showBreadcrumbs}">
<!-- Dataverses -->
<ui:repeat value="#{dataverseHeaderFragment.getDataverses(dataverse)}" var="dv" varStatus="status">
<h:outputText value=" > " styleClass="breadcrumbCarrot" rendered="#{!status.first}"/>
<h:outputLink id="breadcrumbLnk" value="/dataverse.xhtml?id=#{dv.id}" style="padding-top:1px; display:block; float:left;">
<h:outputText value="#{dv.name} Dataverse"/>
</h:outputLink>

<!-- <p:commandButton id="breadcrumbBtn" value="#{dv.name} Dataverse" type="button" icon="/javax.faces.resource/images/ui-icons_333333_256x240.png.xhtml?ln=primefaces-bootstrap"/>-->

<ui:fragment rendered="#{!empty dataverseServiceBean.findByOwnerId(dv.getId())}">

<p:outputPanel id="breadcrumbPnlIcn" style="float:left; margin-top:.3em; width:16px; height:16px; background-image: url(/javax.faces.resource/images/ui-icons_333333_256x240.png.xhtml?ln=primefaces-bootstrap); background-position:-64px -16px;"/>

<h:outputLink id="breadcrumbLnk" value="/dataverse.xhtml?id=#{dv.id}" style="padding-top:1px; display:block; float:left;">
<h:outputText value="#{dv.name} Dataverse"/>
</h:outputLink>

<!-- <p:commandButton id="breadcrumbBtn" value="#{dv.name} Dataverse" type="button" icon="/javax.faces.resource/images/ui-icons_333333_256x240.png.xhtml?ln=primefaces-bootstrap"/>-->

<p:overlayPanel id="breadcrumbPanel" for="breadcrumbPnlIcn" hideEffect="fade">
<p:tree value="#{dataverseHeaderFragment.getDataverseTree(dv)}" var="node" dynamic="true" cache="true" id="tree">
<p:treeNode>
<h:outputText value="#{node.name} Dataverse" style="font-weight: #{dataverse.id == node.id ? 'bold' : 'normal'}" rendered="#{dataverse.id == node.id and dataset == null }"/>
<h:outputLink value="/dataverse.xhtml?id=#{node.id}" rendered="#{dataverse.id != node.id or dataset != null}">
<h:outputText value="#{node.name} Dataverse" style="font-weight: #{dataverse.id == node.id ? 'bold' : 'normal'}"/>
</h:outputLink>
</p:treeNode>
</p:tree>
</p:overlayPanel>
</ui:fragment>

<ui:fragment rendered="#{empty dataverseServiceBean.findByOwnerId(dv.getId())}">
<h:outputText value="#{dv.name} Dataverse" style="font-weight:#{dataverse.id == dv.id ? 'bold' : 'normal'}; padding-top:1px; margin-left:.2em; display:block; float:left;" rendered="#{dataverse.id == dv.id and dataset == null }"/>
<h:outputLink value="/dataverse.xhtml?id=#{dv.id}" style="padding-top:1px; display:block; float:left;" rendered="#{dataverse.id != dv.id or dataset != null}">
<h:outputText value="#{dv.name} Dataverse" style="font-weight: #{dataverse.id == dv.id ? 'bold' : 'normal'}"/>
</h:outputLink>
</ui:fragment>
</ui:repeat>
<!-- Dataset, if available -->
<ui:fragment rendered="#{!empty dataset.latestVersion.metadata.title}">
<h:outputText value=" > " styleClass="breadcrumbCarrot"/>
<h:outputText value="#{dataset.latestVersion.metadata.title}" style="float:left; font-weight:bold;"/>
</ui:fragment>
</p:panel>
<p:overlayPanel id="breadcrumbPanel" for="breadcrumbPnlIcn" hideEffect="fade">
<p:tree value="#{dataverseHeaderFragment.getDataverseTree(dv)}" var="node" dynamic="true" cache="true" id="tree">
<p:treeNode>
<h:outputText value="#{node.name} Dataverse" style="font-weight: #{dataverse.id == node.id ? 'bold' : 'normal'}" rendered="#{dataverse.id == node.id and dataset == null }"/>
<h:outputLink value="/dataverse.xhtml?id=#{node.id}" rendered="#{dataverse.id != node.id or dataset != null}">
<h:outputText value="#{node.name} Dataverse" style="font-weight: #{dataverse.id == node.id ? 'bold' : 'normal'}"/>
</h:outputLink>
</p:treeNode>
</p:tree>
</p:overlayPanel>

<ui:fragment rendered="#{empty dataverseServiceBean.findByOwnerId(dv.getId())}">
<h:outputText value="#{dv.name} Dataverse" style="font-weight:#{dataverse.id == dv.id ? 'bold' : 'normal'}; padding-top:1px; margin-left:.2em; display:block; float:left;" rendered="#{dataverse.id == dv.id and dataset == null }"/>
<h:outputLink value="/dataverse.xhtml?id=#{dv.id}" style="padding-top:1px; display:block; float:left;" rendered="#{dataverse.id != dv.id or dataset != null}">
<h:outputText value="#{dv.name} Dataverse" style="font-weight: #{dataverse.id == dv.id ? 'bold' : 'normal'}"/>
</h:outputLink>
</ui:fragment>
</ui:repeat>
<!-- Dataset, if available -->
<ui:fragment rendered="#{!empty dataset.latestVersion.metadata.title}">
<h:outputText value=" > " styleClass="breadcrumbCarrot"/>
<h:outputText value="#{dataset.latestVersion.metadata.title}" style="float:left; font-weight:bold;"/>
</ui:fragment>
</p:panel>
</ui:fragment>
</div>

<!-- Message Panel -->
<p:panel styleClass="panelLayoutTitleBlock" rendered="#{showMessagePanel}">
<p:messages id="messages" showDetail="true" autoUpdate="true" closable="true"/>
</p:panel>
<ui:fragment rendered="#{showMessagePanel}">
<div class="container">
<iqbs:messages collapsible="false" />
</div>
</ui:fragment>

</div>
Loading

0 comments on commit ac8edd6

Please sign in to comment.