Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
chamerling committed Sep 20, 2011
0 parents commit 3645f9a
Show file tree
Hide file tree
Showing 23 changed files with 2,520 additions and 0 deletions.
18 changes: 18 additions & 0 deletions .gitignore
@@ -0,0 +1,18 @@
target/
modules/

#Eclipse
.project
.metadata
eclipse/
test-result/
bin/**
tmp/**
tmp/**/*
*.tmp
*.bak
*.swp
*~.nib
.classpath
.settings/
.loadpath
7 changes: 7 additions & 0 deletions README.md
@@ -0,0 +1,7 @@
# Play Bootstrap Skeleton
A Play project skeleton using Twitter bootstrap and preconfigured with Play CRUD and Secure modules, some classes and required routes. Just fork it and start creating your app.

Cheers!

Christophe H.
@chamerling
36 changes: 36 additions & 0 deletions app/Bootstrap.java
@@ -0,0 +1,36 @@
/*
* Copyright 2011 Christophe Hamerling
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import play.jobs.Job;
import play.jobs.OnApplicationStart;
import play.test.Fixtures;

/**
* Bootstrap some init data to avoid some useless test for the application long
* life time
*
*
*/
@OnApplicationStart
public class Bootstrap extends Job {

@Override
public void doJob() throws Exception {
int count = 1; // load things from database...
if (count == 0) {
Fixtures.load("initial-data.yml");
}
}
}
16 changes: 16 additions & 0 deletions app/controllers/Application.java
@@ -0,0 +1,16 @@
package controllers;

import play.*;
import play.mvc.*;

import java.util.*;

import models.*;

public class Application extends Controller {

public static void index() {
render();
}

}
21 changes: 21 additions & 0 deletions app/controllers/Security.java
@@ -0,0 +1,21 @@
package controllers;

import play.Play;

public class Security extends Secure.Security {

static boolean authenticate(String username, String password) {
return username.equals(Play.configuration
.getProperty("secure.admin.username"))
&& password.equals(Play.configuration
.getProperty("secure.admin.password"));
}

static boolean check(String profile) {
if (profile.equals("Admin")) {
return session.get("username").equals(
Play.configuration.getProperty("secure.admin.username"));
}
return false;
}
}
6 changes: 6 additions & 0 deletions app/views/Application/index.html
@@ -0,0 +1,6 @@
#{extends 'main.html' /}
#{set title:'Home' /}

<div class="well">
So what?
<div>
19 changes: 19 additions & 0 deletions app/views/errors/404.html
@@ -0,0 +1,19 @@
<!DOCTYPE html>

<html>
<head>
<title>Not found</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
</head>
<body>
#{if play.mode.name() == 'DEV'}
#{404 result /}
#{/if}
#{else}
<h1>Not found</h1>
<p>
${result.message}
</p>
#{/else}
</body>
</html>
21 changes: 21 additions & 0 deletions app/views/errors/500.html
@@ -0,0 +1,21 @@
<!DOCTYPE html>

<html>
<head>
<title>Application error</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
</head>
<body>
#{if play.mode.name() == 'DEV'}
#{500 exception /}
#{/if}
#{else}
<h1>Oops, an error occured</h1>
#{if exception instanceof play.exceptions.PlayException}
<p>
This exception has been logged with id <strong>${exception.id}</strong>.
</p>
#{/if}
#{/else}
</body>
</html>
69 changes: 69 additions & 0 deletions app/views/main.html
@@ -0,0 +1,69 @@
<!DOCTYPE html>

<html>
<head>
<title>#{get 'title' /}</title>
<meta charset="utf-8">
<link rel="stylesheet" media="screen" href="@{'/public/stylesheets/bootstrap-1.2.0.css'}">
#{get 'moreStyles' /}
<link rel="shortcut icon" type="image/png" href="@{'/public/images/favicon.png'}">
<script src="@{'/public/javascripts/jquery-1.5.2.min.js'}" type="text/javascript" charset="utf-8"></script>
<script src="@{'/public/javascripts/application.js'}" type="text/javascript" charset="utf-8"></script>
#{get 'moreScripts' /}
</head>
<body>

<div class="topbar">
<div class="fill">
<div class="container">
<h3><a href="@{Application.index()}">App Name</a></h3>
<ul>
<!--- browse -->
<ul class="nav secondary-nav">
<li class="menu">
<a href="#" class="menu">Menu A</a>
<ul class="menu-dropdown">
<li><a href="@{Application.index()}">One</a></li>
<li><a href="@{Application.index()}">Two</a></li>
</ul>
</li>
<li class="menu">
<a href="#" class="menu">Menu B</a>
<ul class="menu-dropdown">
<li><a href="@{Application.index()}">Three</a></li>
</ul>
</li>
<li class="menu">
<a href="#" class="menu">Menu C</a>
<ul class="menu-dropdown">
<li><a href="@{Application.index()}">Four</a></li>
</ul>
</li>
</ul>
</ul>
<ul class="nav secondary-nav">
<li><a href="">Connected to xxx</a></li>
</ul>
</div>
</div> <!-- /fill -->
</div>

<div class="container">

#{if flash.success}
<div class="alert-message success">
<a class="close" href="#">&times;</a>
<p><strong>${flash.success}</strong></p>
</div>
#{/if}
#{if flash.error}
<div class="alert-message error">
<a class="close" href="#">&times;</a>
<p><strong>${flash.error}</strong></p>
</div>
#{/if}

#{doLayout /}
</div>
</body>
</html>

0 comments on commit 3645f9a

Please sign in to comment.