Made the management table of 'other' accounts sortable. Everything here and in other views needs to be made at least a little pretty

This commit is contained in:
Everett Sochowski 2012-03-02 18:06:57 +01:00
parent 17b9704402
commit 68ff94f27e
4 changed files with 42 additions and 23 deletions

View File

@ -55,6 +55,11 @@
<artifactId>lift-mapper_2.9.1</artifactId>
<version>2.4-M4</version>
</dependency>
<dependency>
<groupId>net.liftweb</groupId>
<artifactId>lift-widgets_2.9.1</artifactId>
<version>2.4-M4</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>

View File

@ -38,6 +38,7 @@ import code.model._
import com.tesobe.utils._
import myapp.model.MongoConfig
import net.liftweb.util.Helpers._
import net.liftweb.widgets.tablesorter.TableSorter
/**
* A class that's instantiated early and run. It allows the application
* to modify lift's environment
@ -122,5 +123,7 @@ class Boot {
// Make a transaction span the whole HTTP request
S.addAround(DB.buildLoanWrapper)
TableSorter.init
}
}

View File

@ -9,9 +9,19 @@ import net.liftweb.http.SHtml
import net.liftweb.http.js.JsCmds.Noop
import net.liftweb.common.Full
import net.liftweb.common.Empty
import net.liftweb.widgets.tablesorter.{TableSorter, DisableSorting, Sorting, Sorter}
class Management {
val headers = (0, Sorter("text")) :: (5, DisableSorting()) :: Nil
val sortList = (0, Sorting.DSC) :: Nil
val options = TableSorter.options(headers, sortList)
def tableSorter(xhtml: NodeSeq) : NodeSeq = {
TableSorter("#other_acc_management", options)
}
def listAll(xhtml: NodeSeq) : NodeSeq = {
//temporary way to retrieve the account

View File

@ -33,29 +33,30 @@ Open Bank Project (http://www.openbankproject.com)
<body class="lift:content_id=main">
<div id="main" class="lift:surround?with=default;at=content">
Management
<table>
<thead>
<tr>
<th class="span-1">Account Name</th>
<th class="span-1">Image</th>
<th class="span-1">Public Alias</th>
<th class="span-1">Private Alias</th>
<th class="span-1">More Info</th>
<th class="span-1">Website</th>
</tr>
</thead>
<tbody>
<tr class=lift:Management.listAll>
<td class="real_name">Real name</td>
<td class="image">Image</td>
<td class="public_alias_name">Public alias name</td>
<td class="private_alias_name">Private alias name</td>
<td class="more_info">More information about this account</td>
<td class="website_url">Link to website</td>
</tr>
</tbody>
</table>
<table id="other_acc_management" class="tablesorter">
<thead>
<tr>
<th >Account Name</th>
<th >Public Alias</th>
<th >Private Alias</th>
<th >Image URL</th>
<th>Website URL</th>
<th >More Info</th>
</tr>
</thead>
<tbody>
<tr class=lift:Management.listAll>
<td class="real_name">Real name</td>
<td class="public_alias_name">Public alias name</td>
<td class="private_alias_name">Private alias name</td>
<td class="image">Image</td>
<td class="website_url">Link to website</td>
<td class="more_info">More information about this account</td>
</tr>
</tbody>
</table>
<div class="lift:Management.tableSorter"></div>
</div>
</body>
</html>