Skip to content

Commit

Permalink
#17 added imei registration page in new template
Browse files Browse the repository at this point in the history
  • Loading branch information
Sushil committed Apr 22, 2015
1 parent 4a52ff3 commit 1fb1621
Show file tree
Hide file tree
Showing 24 changed files with 605 additions and 1,424 deletions.
7 changes: 3 additions & 4 deletions app/controllers/Application.scala
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import play.api._
import play.api.cache.Cache
import play.api.Play.current
import model.repository.User
import model.repository.BrandRepository

/**
* Contains application generated controllers javaScriptRoutes to make ajax calls
Expand All @@ -23,10 +24,8 @@ class Application extends Controller {
* Display the home page
*/
def index: Action[play.api.mvc.AnyContent] = Action { implicit request =>
val username = request.session.get(Security.username).getOrElse("None")
val user: Option[User] = Cache.getAs[User](username)
Logger.info("USERNAME:::::" + user)
Ok(views.html.users.index("Welcome", user))
val allBrands=BrandRepository.getAllBrands
Ok(views.html.users.index("Welcome",MobileController.mobileregistrationform,allBrands))
}

/**
Expand Down
30 changes: 4 additions & 26 deletions app/controllers/MobileController.scala
Original file line number Diff line number Diff line change
Expand Up @@ -41,37 +41,15 @@ class MobileController(mobileRepo: MobileRepository, brandRepo: BrandRepository,
"regType" -> nonEmptyText,
"document" -> nonEmptyText)(MobileRegisterForm.apply)(MobileRegisterForm.unapply))

/**
* Display the new mobile registration form for stolen mobile
*/
def stolenMobileRegistrationForm: Action[play.api.mvc.AnyContent] = Action { implicit request =>
Logger.info("MobileController:mobileRegistrationForm -> called")
val mobileBrands = brandRepo.getAllBrands
val username = request.session.get(Security.username).getOrElse("None")
val user: Option[User] = Cache.getAs[User](username)
Ok(views.html.users.contents.stolenMobileRegistrationForm(mobileregistrationform, mobileBrands, user))
}

/**
* Display the new secure mobile registration form
*/
def secureMobileRegistrationForm: Action[AnyContent] = Action { implicit request =>
Logger.info("MobileController:mobileRegistrationSecureForm -> called")
val mobileBrands = brandRepo.getAllBrands
val username = request.session.get(Security.username).getOrElse("None")
val user: Option[User] = Cache.getAs[User](username)
Ok(views.html.users.contents.secureMobileRegistrationForm(mobileregistrationform, mobileBrands, user))
}

/**
* Handle the new mobile registration form submission and add new mobile
*/
def saveMobileUser: Action[MultipartFormData[Files.TemporaryFile]] = Action(parse.multipartFormData) { implicit request =>
val username = request.session.get(Security.username).getOrElse("None")
val mobileBrands = brandRepo.getAllBrands
val brands = brandRepo.getAllBrands
val user: Option[User] = Cache.getAs[User](username)
mobileregistrationform.bindFromRequest.fold(
formWithErrors => BadRequest(views.html.users.contents.stolenMobileRegistrationForm(formWithErrors, mobileBrands, user)),
formWithErrors => BadRequest("Invalid form data"),
mobileuser => {
val date = commonUtils.getSqlDate()
val index = mobileuser.document.indexOf(".")
Expand All @@ -87,9 +65,9 @@ class MobileController(mobileRepo: MobileRepository, brandRepo: BrandRepository,
val fileToSave = image.ref.file.asInstanceOf[File]
s3Util.store(documentName, fileToSave)
}
Redirect(routes.MobileController.stolenMobileRegistrationForm).flashing("SUCCESS" -> Messages("messages.mobile.register.success"))
Ok("success")
case _ =>
Redirect(routes.MobileController.stolenMobileRegistrationForm).flashing("ERROR" -> Messages("messages.mobile.register.error"))
Ok("error")
}
})
}
Expand Down
62 changes: 24 additions & 38 deletions app/views/users/contents/carousell.scala.html
Original file line number Diff line number Diff line change
@@ -1,53 +1,39 @@
@* carousell Template File *@
@(param: Any)
<div id="myCarousel" class="carousel slide" data-ride="carousel">
<!-- Indicators -->

<ol class="carousel-indicators">
<li data-target="#myCarousel" data-slide-to="0" class="active"></li>
<li data-target="#myCarousel" data-slide-to="1"></li>
<li data-target="#myCarousel" data-slide-to="2"></li>
</ol>
<div id="myCarousel" class="carousel slide">
<div class="carousel-inner">
<div class="item active"> <img src="@routes.Assets.at("user/img/bg.jpg")" style="width:100%" alt="First slide">
<div class="container">
<h2></h2>
<div class="carousel-caption">
<h1>Slide 1</h1>
<p>Aenean a rutrum nulla. Vestibulum a arcu at nisi tristique pretium.</p>
<p><a class="btn btn-lg btn-primary" href="#" role="button">Sign up today</a></p>
<div class="active item">
<div class="fill" style="background-image:url('assets/example/bg1.jpg');">
<div class="container">
<div class="blocky"><h1 class="pull-left pull-middle light-color"><span><a href="#">Single Page App</a></span></h1></div>
</div>
</div>
</div>
<div class="item"> <img src="@routes.Assets.at("user/img/bg.jpg")" style="width:100%" data-src="" alt="Second slide">
<div class="container">
<div class="carousel-caption">
<h1>Slide 2</h1>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed vitae egestas purus. </p>
<p><a class="btn btn-lg btn-primary" href="#" role="button">Learn more</a></p>
<div class="item">
<div class="fill" style="background-image:url('assets/example/bg_smartphones.jpg');">
<div class="container">
<div class="blocky"><h1 class="pull-left pull-middle light-color"><span><a href="#">Make Fast Updates</a></span></h1></div>
</div>
</div>
</div>
<div class="item"> <img src="@routes.Assets.at("user/img/bg.jpg")" style="width:100%" data-src="" alt="Third slide">
<div class="container">
<div class="carousel-caption">
<h1>Slide 3</h1>
<p>Donec sit amet mi imperdiet mauris viverra accumsan ut at libero.</p>
<p><a class="btn btn-lg btn-primary" href="#" role="button">Browse gallery</a></p>
<div class="item">
<div class="fill" style="background-image:url('assets/example/bg_dogcat.jpg');">
<div class="container">
<div class="blocky"><h1 class="pull-left pull-middle light-color"><span><a href="#">About Your Brand</a></span></h1></div>
</div>
</div>
</div>
</div>
<a class="left carousel-control" href="#myCarousel" data-slide="prev">
<span class="glyphicon glyphicon-chevron-left"></span>
</a>
<a class="right carousel-control" href="#myCarousel" data-slide="next">
<span class="glyphicon glyphicon-chevron-right"></span></a>
</div>
</div>
<a class="left carousel-control" href="#myCarousel" data-slide="prev"></a>
<a class="right carousel-control" href="#myCarousel" data-slide="next"></a>
</div>

<script>
$(function(){
$('#myCarousel').on('slid.bs.carousel', function () {
});
});
$('.carousel').carousel();
$('#myCarousel').on('slide',function(){
$('.blocky').fadeOut(300);
});
$('#myCarousel').on('slid',function(){
$('.blocky').fadeIn(600).animate({marginLeft:"+=12%"},200).animate({marginLeft:"-=15%"},300).animate({marginLeft:"+=4%"},600);
});
</script>
11 changes: 5 additions & 6 deletions app/views/users/contents/checkIMEIStatus.scala.html
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
@* checkIMEIModal Template File *@
@(title:String)

<section>
<section id="imeiStatus">
<div class="container">
<div class="headline">
<h3>Check IMEI status</h3>
</div>
<h5>Ensure that you are not buying a lemon!</h5>
<p>A lemon cell is analogous to a <a href="http://en.wikipedia.org/wiki/Lemon_(automobile)">lemon automobile</a> where
you find out problems, much after the purchase has been
Expand Down Expand Up @@ -44,10 +46,8 @@ <h3 style="color: rgba(228, 137, 0, 1);">Check Status Of your IMEI number</h3>
</div>
</div>
<hr>
<button class="btn btn-success" onClick="clearr()">Cancel</button>
<button class="btn btn-success" onClick="clearFields();">Close</button>
</div>
<hr>

</div>
</div>
</div>
Expand All @@ -56,6 +56,5 @@ <h3 style="color: rgba(228, 137, 0, 1);">Check Status Of your IMEI number</h3>

</div>
</section>

<script src="@routes.Assets.at("user/javascripts/jquery.validate.min.js")" type="text/javascript"></script>

<script src="@routes.Assets.at("user/js/myscript/checkIMEIStatus.js")"></script>
9 changes: 3 additions & 6 deletions app/views/users/contents/dashboard.scala.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,9 @@
<!-- Dashboard on Home Page -->
<section id="portfolio">
<div class="container">
<div class="row">
<div class="col-lg-12 text-center">
<h2>Dashboard</h2>
<hr class="star-primary">
</div>
</div>
<div class="headline">
<h3>Dashboard</h3>
</div>
<div class="row">
<div class="col-sm-4 portfolio-item">
<a href="#portfolioModal1" class="portfolio-link" data-toggle="modal">
Expand Down
12 changes: 10 additions & 2 deletions app/views/users/contents/errorPage.scala.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@

@(message: String)
@views.html.users.main("Welcome to Play",user=None) {
<html>
<head>
<title>Not found</title>
<script src="@routes.Assets.at("user/js/jquery.js")"></script>
<!-- Bootstrap Core CSS - Uses Bootswatch Flatly Theme: http://bootswatch.com/flatly/ -->
<link href="@routes.Assets.at("user/css/bootstrap.min.css")" rel="stylesheet">
</head>
<body>
<div class ="container">
<div class="row" style="margin-top: 100px;">
<div class="col-md-5">
Expand All @@ -15,4 +22,5 @@ <h1 style="color:rgba(171, 59, 59, 1);">404 Page Not Found</h1>
</div>
</div>
</div>
}
</body>
</html>
39 changes: 39 additions & 0 deletions app/views/users/contents/imeiRegistration.scala.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
@(title:String,mobileRegistrationForm: Form[model.repository.MobileRegisterForm], brands: List[model.repository.Brand])
<section id="registerImei">
<div class="container">
<div class="headline">
<h3>IMEI Registration</h3>
</div>
<div class="row">
<div class="col-sm-9">
<p>Chances are that you are visiting this page, because, you or someone close to you, has lost his/her cell phone.
The feeling of losing a cell phone is analogous to losing a part of your life.
We have been in the same situation. This site with its database of over 50,000 (and growing) lost / stolen cell phones, is an attempt to break the cycle of cell phone thefts.</p>
<p>Register your mobile IMEI number with us and be safe.</p>
<a href="#imeiRegisterModal" class="portfolio-link" role="button" data-toggle="modal"><button class="btn btn-success">Click here to register IMEI number</button></a>
</div>
<div class="col-sm-3">
<img src="@routes.Assets.at("user/img/cell.jpg")" alt="">
</div>
</div>

<!-- Modal -->
<div class="portfolio-modal modal fade" id="imeiRegisterModal" tabindex="-1" role="dialog" aria-hidden="true">
<div class="modal-content">
<div class="container">
<div class="row">
<div class="col-md-12">
<div class="modal-body" style="text-align: left;">
<h3>Register your IMEI</h3>
<div class="well form-horizontal">
<h4 style="color: rgba(23, 110, 94, 1);">Please provide authentic IMEI proof</h4>
@registerForm("clean", mobileRegistrationForm, brands)
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</section>
Loading

0 comments on commit 1fb1621

Please sign in to comment.