Finished initial implementation of songs and services page.

This commit is contained in:
Jonathan Bernard 2015-03-17 19:46:50 -05:00
parent 29f00f806b
commit 5bcd4d91c3
6 changed files with 53 additions and 75 deletions

View File

@ -41,9 +41,11 @@ dependencies {
war {
from "resources/webapp"
from "build/webapp"
filter(ReplaceTokens, tokens: [version: version])
rename '(.+)(\\..*(css|js))', '$1-' + version + '$2'
webInf { from 'src/main/webapp/WEB-INF' }
version = project.version.releaseVersion
webInf { from 'resources/main/WEB-INF' }
}
test { testLogging { events 'failed' } }
@ -52,9 +54,22 @@ task testWar(type: War) {
from 'resources/webapp'
filter(ReplaceTokens, tokens: [version: version])
rename '(.+)(\\..*(css|js))', '$1-' + version + '$2'
webInf { from 'resources/test/webapp/WEB-INF' }
version = project.version.releaseVersion
webInf { from 'resources/test/WEB-INF' }
classifier 'test' }
task compileScss(
group: 'build',
description: 'Compile SCSS files into CSS.',
type: Exec
) {
executable "scss"
args "--update", "src/main/webapp/css:build/webapp/css"
}
war.dependsOn compileScss
testWar.dependsOn compileScss
// ## Build Versioning task
task incrementBuildNumber(
group: 'versioning',
@ -76,12 +91,13 @@ task markReleaseBuild(
description: "Mark this version of the project as a release version."
) << { version.release = true }
build.dependsOn << incrementBuildNumber
war.dependsOn << incrementBuildNumber
testWar.dependsOn << incrementBuildNumber
// ## Custom tasks for local deployment
task deployLocal(dependsOn: ['build']) << {
def warName = "${project.name}-${version}.war"
def warName = "${project.name}-${version.releaseVersion}.war"
def jettyHome = System.getenv("JETTY_HOME")
def deployedWar = new File("$jettyHome/webapps/$warName")
@ -124,6 +140,8 @@ class ProjectVersion {
@Override String toString() { "$major.$minor${release ? '' : '-build' + build}" }
public String getReleaseVersion() { "$major.$minor" }
public void setMajor(int major) {
this.major = major; minor = build = 0; release = false; save() }

View File

@ -48,4 +48,10 @@ header {
}
} } } }
th { font-family: "Roboto Condensed"; }
table {
th { font-family: "Roboto Condensed"; }
td a {
color: $dark;
display: block;
text-decoration: none; } }

View File

@ -21,12 +21,16 @@
/// ### SongsView
NLS.SongsView = Backbone.View.extend({
el: $("#songs-table")[0],
initialize: function(options) { this.$el.dataTables(); }
});
/// ### ServicesView
NLS.ServicesView = Backbone.View.extend({
el: $("#services-table")[0],
initialize: function(options) { this.$el.dataTables(); }
});
})();

View File

@ -1,54 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<link rel="shortcut icon" href="../images/favicon.ico">
<title>Services - New Life Songs Database</title>
<script type="application/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<script type="application/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.8.2/underscore-min.js"></script>
<script type="application/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/backbone.js/1.1.2/backbone-min.js"></script>
<script type="application/javascript" src="https://cdn.datatables.net/1.10.5/js/jquery.dataTables.js"></script>
<!--<script type="application/javascript" src="https://cdn.datatables.net/1.10.5/js/jquery.dataTables.min.js"></script>-->
<script type="application/javascript" src="../js/new-life-songs.js"></script>
<link href='http://fonts.googleapis.com/css?family=Roboto+Condensed|Roboto|Lato|Cuprum|Dosis|Cantarell' rel='stylesheet' type='text/css'>
<link href='http://cdn.datatables.net/1.10.5/css/jquery.dataTables.css' rel='stylesheet' type='text/css'>
<link href='../css/new-life-songs.css' rel='stylesheet' type='text/css'>
</head>
<body>
<header>
<h1>New Life Songs</h1>
<h2>Services</h2>
<nav><ul>
<li><a href="../admin/">Admin</a></li>
<li><a href="../songs/">Songs</a></li>
<li><a href="../services/">Services</a></li>
</ul></nav>
</header>
<section class=songs>
<table id=songs-table class="row-border hover compact" cellspacing=0>
<thead><tr>
<th class="dt-left">Date</th>
<th class="dt-left">Service Type</th>
</tr></thead>
<tfoot><tr>
<th class="dt-left">Date</th>
<th class="dt-left">Service Type</th>
</tr></tfoot>
</table>
</section>
<script type="application/javascript">
window.onload = function() {
$("#songs-table").dataTable( {
"ajax": {
"url": "http://localhost:8080/new-life-songs-2.0/api/v1/services/",
"dataSrc": "" },
"columns": [
{ "data": "date" },
{ "data": "serviceType" } ] }); };
</script>
</body>
</html>

View File

@ -1,4 +1,10 @@
<!DOCTYPE html>
<%
import com.jdbernard.nlsongs.servlet.NLSongsContext
songsDB = NLSongsContext.songsDB
%>
<html>
<head>
<meta charset="UTF-8">
@ -6,14 +12,14 @@
<title>Songs - New Life Songs Database</title>
<script type="application/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<script type="application/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.8.2/underscore-min.js"></script>
<script type="application/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/backbone.js/1.1.2/backbone-min.js"></script>
<!--<script type="application/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.8.2/underscore-min.js"></script>-->
<!--<script type="application/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/backbone.js/1.1.2/backbone-min.js"></script>-->
<script type="application/javascript" src="https://cdn.datatables.net/1.10.5/js/jquery.dataTables.js"></script>
<!--<script type="application/javascript" src="https://cdn.datatables.net/1.10.5/js/jquery.dataTables.min.js"></script>-->
<script type="application/javascript" src="../js/new-life-songs.js"></script>
<!--<script type="application/javascript" src="../js/new-life-songs-@version@.js"></script>-->
<link href='http://fonts.googleapis.com/css?family=Roboto+Condensed|Roboto|Lato|Cuprum|Dosis|Cantarell' rel='stylesheet' type='text/css'>
<link href='http://cdn.datatables.net/1.10.5/css/jquery.dataTables.css' rel='stylesheet' type='text/css'>
<link href='../css/new-life-songs.css' rel='stylesheet' type='text/css'>
<link href='../css/new-life-songs-@version@.css' rel='stylesheet' type='text/css'>
</head>
<body>
<header>
@ -27,11 +33,16 @@
</ul></nav>
</header>
<section class=songs>
<table id=songs-table class="row-border hover compact" cellspacing=0>
<table id=songs-table class="row-border dataTable hover compact" cellspacing=0>
<thead><tr>
<th class="dt-left">Name</th>
<th class="dt-left">Artists</th>
</tr></thead>
<tbody>
<% songsDB.findAllSongs().sort { it.name }.each { song -> %>
<tr><td><a href='../song/<%= song.id %>'><%= song.name %></a></td>
<td><%= song.artists.join(", ") %></td></tr> <% } %>
</tbody>
<tfoot><tr>
<th class="dt-left">Name</th>
<th class="dt-left">Artists</th>
@ -40,15 +51,8 @@
</section>
<script type="application/javascript">
window.onload = function() {
$("#songs-table").dataTable( {
"ajax": {
"url": "http://localhost:8080/new-life-songs-2.0/api/v1/songs/",
"dataSrc": "" },
"columns": [
{ "data": "name" },
{ "data": "artists" } ] }); };
window.onload = function() { \$("#songs-table").dataTable(); };
</script>
</body>
</html>

View File

@ -1,6 +1,6 @@
#
#Tue Mar 17 18:13:28 CDT 2015
#Tue Mar 17 19:44:02 CDT 2015
major=2
version.release=false
minor=0
build=13
build=43