Skip to content

Commit

Permalink
NashTech-Labs#17 changed user and admin templates into new responsive…
Browse files Browse the repository at this point in the history
… templates
  • Loading branch information
Sushil committed Apr 6, 2015
1 parent 7ca7eb6 commit 6785ea8
Show file tree
Hide file tree
Showing 859 changed files with 147,055 additions and 1,508 deletions.
12 changes: 9 additions & 3 deletions app/controllers/AdminController.scala
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,13 @@ class AdminController(mobileRepo: MobileRepository, auditRepo: AuditRepository,
mapping(
"imeiMeid" -> nonEmptyText)(MobileStatus.apply)(MobileStatus.unapply))

def adminHome : Action[AnyContent] = withAuth { username =>
implicit request =>
Logger.info("AdminController:adminHome -> called.")
val user: Option[User] = Cache.getAs[User](username)
Ok(views.html.admin.adminIndex("Welcome", user))
}

/**
* Renders MobileUser Page
* @param status, mobile status(pending, approved and proofdemanded)
Expand All @@ -41,7 +48,6 @@ class AdminController(mobileRepo: MobileRepository, auditRepo: AuditRepository,
Logger.info("AdminController:mobiles -> called.")
val user: Option[User] = Cache.getAs[User](username)
val mobiles = mobileRepo.getAllMobilesUserWithBrandAndModel(status)
Logger.info("mobiles Admin Controller::::" + mobiles)
Ok(views.html.admin.mobiles(status, mobiles, user))
}

Expand Down Expand Up @@ -134,7 +140,7 @@ class AdminController(mobileRepo: MobileRepository, auditRepo: AuditRepository,
* Changes mobile status to clean or stolen
* @param imeiId of mobile
* @return success or error page
**/
*/
def changeMobileRegType(imeiId: String): Action[AnyContent] = withAuth { username =>
implicit request =>
Logger.info("AdminController:changeMobileRegType - change Registration type : " + imeiId)
Expand Down Expand Up @@ -246,7 +252,7 @@ class AdminController(mobileRepo: MobileRepository, auditRepo: AuditRepository,
}
}
/**
* Lets other classes, traits, objects access all the behaviors defined in the class AdminController
* Lets other classes, traits, objects access all the behaviors defined in the class AdminController
*/

object AdminController extends AdminController(MobileRepository, AuditRepository, MailUtil, S3Util)
2 changes: 1 addition & 1 deletion app/controllers/Application.scala
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class Application extends Controller {
val username = request.session.get(Security.username).getOrElse("None")
val user: Option[User] = Cache.getAs[User](username)
Logger.info("USERNAME:::::" + user)
Ok(views.html.index("Welcome", user))
Ok(views.html.index("Welcome",user))
}

/**
Expand Down
12 changes: 6 additions & 6 deletions app/controllers/AuditController.scala
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@ class AuditController(auditRepo: AuditRepository) extends Controller with Secure
/**
* Display audit page
*/
def auditPage: Action[AnyContent] = withAuth { username =>
def timestampForm: Action[AnyContent] = withAuth { username =>
implicit request =>
val user: Option[User] = Cache.getAs[User](username)
val list = List()
Ok(views.html.audit.overviews("imeid", list, user))
Ok(views.html.admin.mobileCheckStatusTimestamp("imeid", list, user))
}

/**
Expand All @@ -49,11 +49,11 @@ class AuditController(auditRepo: AuditRepository) extends Controller with Secure
timestampform.bindFromRequest().fold(
hasErrors = { form =>
val list = List()
Ok(views.html.audit.overviews("imeid", list, user)).flashing("error" -> "Please correct the errors in the form")
Ok(views.html.admin.mobileCheckStatusTimestamp("imeid", list, user)).flashing("error" -> "Please correct the errors in the form")
},
success = { timestamp =>
val list = auditRepo.getAllTimestampsByIMEID(timestamp.imeiMeid)
Ok(views.html.audit.overviews("imeid", list, user))
Ok(views.html.admin.mobileCheckStatusTimestamp("imeid", list, user))
})
}

Expand All @@ -64,7 +64,7 @@ class AuditController(auditRepo: AuditRepository) extends Controller with Secure
implicit request =>
val user: Option[User] = Cache.getAs[User](username)
val list = auditRepo.getAllTimestamps
Ok(views.html.audit.overviews("all", list, user))
Ok(views.html.admin.mobileCheckStatusTimestamp("all", list, user))
}

def registrationRecordsByYear(year: String): Action[AnyContent] = withAuth { username =>
Expand All @@ -74,7 +74,7 @@ class AuditController(auditRepo: AuditRepository) extends Controller with Secure
val monthList = List("Jan", "Feb", "Mar", "Apr", "May", "Jun", "July", "Aug", "Sep", "Oct", "Nov", "Dec")
val recordList = auditRepo.getRecordByDate(year)
val recordsList = monthList zip recordList
Ok(views.html.audit.analytics(user, recordsList, years))
Ok(views.html.admin.analytics(user, recordsList, years))
}
}

Expand Down
6 changes: 3 additions & 3 deletions app/controllers/AuthController.scala
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,15 @@ class AuthController extends Controller with Secured {
loginForm.bindFromRequest.fold(
formWithErrors => BadRequest(views.html.admin.login(formWithErrors)),
user =>
Redirect(routes.AdminController.mobiles("pending")).withSession(Security.username -> user._1))
Redirect(routes.AdminController.adminHome()).withSession(Security.username -> user._1))
}

/**
* Handles admin logout
*/
def logout: Action[AnyContent] = Action {
Redirect(routes.AuthController.login).withNewSession.flashing(
"success" -> "You are now logged out.")
"SUCCESS" -> "You are now logged out.")
}
}

Expand All @@ -80,7 +80,7 @@ trait Secured {
* Handle unauthorized user
*/
def onUnauthorized(request: RequestHeader): Result = {
Results.Redirect(routes.AuthController.login).withNewSession.flashing("success" -> Messages("messages.user.expired"))
Results.Redirect(routes.AuthController.login)
}

def withAuth(f: => String => Request[AnyContent] => Result): Action[AnyContent] = {
Expand Down
8 changes: 4 additions & 4 deletions app/controllers/MobileController.scala
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ class MobileController(mobileRepo: MobileRepository, brandRepo: BrandRepository,
implicit request =>
Logger.info("MobileController:brandRegistrationForm -> called")
val user: Option[User] = Cache.getAs[User](username)
Ok(views.html.createMobileNameForm(brandform, user))
Ok(views.html.admin.newBrandForm(brandform, user))
}

/**
Expand All @@ -103,7 +103,7 @@ class MobileController(mobileRepo: MobileRepository, brandRepo: BrandRepository,
Logger.info("MobileController:modelRegistrationForm -> called")
val user: Option[User] = Cache.getAs[User](username)
val mobileBrands = brandRepo.getAllBrands
Ok(views.html.createMobileModelForm(modelform, mobileBrands, user))
Ok(views.html.admin.newModelForm(modelform, mobileBrands, user))
}

/**
Expand Down Expand Up @@ -242,7 +242,7 @@ class MobileController(mobileRepo: MobileRepository, brandRepo: BrandRepository,
val email = request.session.get(Security.username).getOrElse("")
val user: Option[User] = Cache.getAs[User](email)
brandform.bindFromRequest.fold(
formWithErrors => BadRequest(views.html.createMobileNameForm(formWithErrors, user)),
formWithErrors => BadRequest(views.html.admin.newBrandForm(formWithErrors, user)),
brand => {
if (brandRepo.getAllBrands.filter { x => x.name.equalsIgnoreCase(brand.name) }.isEmpty) {
val insertedBrand = brandRepo.insertBrand(Brand(brand.name))
Expand All @@ -269,7 +269,7 @@ class MobileController(mobileRepo: MobileRepository, brandRepo: BrandRepository,
val email = request.session.get(Security.username).getOrElse("")
val user: Option[User] = Cache.getAs[User](email)
modelform.bindFromRequest.fold(
formWithErrors => BadRequest(views.html.createMobileModelForm(formWithErrors, brands, user)),
formWithErrors => BadRequest(views.html.admin.newModelForm(formWithErrors, brands, user)),
modell => {
if (modelRepo.getAllModelByBrandId(modell.brandName.toInt).filter { x => x.name.equalsIgnoreCase(modell.modelName) }.isEmpty) {
val insertedModel = modelRepo.insertModel(Model(modell.modelName, modell.brandName.toInt))
Expand Down
12 changes: 5 additions & 7 deletions app/views/FAQ.scala.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
@(user: Option[model.repository.User])
@main("Mycellwasstolen: Blogs",user) {
<div class="container">

<br><br>
<div class="page-header">
<h1>FAQs</h1>
</div>
Expand All @@ -17,13 +16,12 @@ <h3 class="panel-title">Frequently Asked Question</h3>
<div class="panel-body">For any further information write to us at <h4>info&#64;mycellwasstolen.com</h4>

<h3>Follow us on:</h3>
<a href="https://plus.google.com/u/0/104973335853978601065/posts"><img src="@routes.Assets.at("images/googleplus_logo.png")" alt="..." class="img-thumbnail"></img></a>
<a href="http://www.linkedin.com/profile/view?id=219381188&trk=nav_responsive_tab_profile_pic"><img src="@routes.Assets.at("images/link.png")" alt="..." class="img-thumbnail"></img></a>
<a href="https://twitter.com/mycellwasstolen"><img src="@routes.Assets.at("images/tw.png")" alt="..." class="img-thumbnail"></img></a>
<a href="https://www.facebook.com/mycellwasstolen.mcws"><img src="@routes.Assets.at("images/face.jpg")" alt="..." class="img-thumbnail"></img></a>
<a href="https://plus.google.com/u/0/104973335853978601065/posts"><img src="@routes.Assets.at("user/images/googleplus_logo.png")" alt="..." class="img-thumbnail"></img></a>
<a href="http://www.linkedin.com/profile/view?id=219381188&trk=nav_responsive_tab_profile_pic"><img src="@routes.Assets.at("user/images/link.png")" alt="..." class="img-thumbnail"></img></a>
<a href="https://twitter.com/mycellwasstolen"><img src="@routes.Assets.at("user/images/tw.png")" alt="..." class="img-thumbnail"></img></a>
<a href="https://www.facebook.com/mycellwasstolen.mcws"><img src="@routes.Assets.at("user/images/face.jpg")" alt="..." class="img-thumbnail"></img></a>
<!-- </div> -->
</div>
</div>
</div>
</div>
}
166 changes: 166 additions & 0 deletions app/views/admin/admin.scala.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,166 @@
@* admin Template File *@
@(action:String,user: Option[model.repository.User])(contents:Html)
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="admin panel">
<meta name="author" content="mcws">

<title>MCWS Admin</title>

<!-- DataTables CSS -->
<link href="@routes.Assets.at("admin/bower_components/datatables-plugins/integration/bootstrap/3/dataTables.bootstrap.css")" rel="stylesheet">

<!-- DataTables Responsive CSS -->
<link href="@routes.Assets.at("admin/bower_components/datatables-responsive/css/dataTables.responsive.css")" rel="stylesheet">

<!-- Bootstrap Core CSS -->
<link href="@routes.Assets.at("admin/bower_components/bootstrap/dist/css/bootstrap.min.css")" rel="stylesheet">

<!-- MetisMenu CSS -->
<link href="@routes.Assets.at("admin/bower_components/metisMenu/dist/metisMenu.min.css")" rel="stylesheet">

<!-- Timeline CSS -->
<link href="@routes.Assets.at("admin/dist/css/timeline.css")" rel="stylesheet">

<!-- Custom CSS -->
<link href="@routes.Assets.at("admin/bower_components/font-awesome/css/font-awesome.min.css")" rel="stylesheet">
<link href="@routes.Assets.at("admin/dist/css/sb-admin-2.css")" rel="stylesheet">

<!-- Morris Charts CSS -->
<link href="@routes.Assets.at("admin/bower_components/morrisjs/morris.css")" rel="stylesheet">

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

<script type="text/javascript" src='@routes.Application.javascriptRoutes()'></script>

</head>

<body>
<div id="wrapper">
<!-- Navigation -->
<nav class="navbar navbar-default navbar-static-top" role="navigation" style="margin-bottom: 0; border-bottom: 1px solid black;">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<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="/admin"><i class="fa fa-dashboard fa-fw"></i>Admin</a>
<a class="navbar-brand" target="blank" href="/"><i class="fa fa-home fa-fw"></i> MCWS</a>
</div>
<!-- /.navbar-header -->

<ul class="nav navbar-top-links navbar-right">
<!-- /.dropdown -->
<li class="dropdown">
<a class="dropdown-toggle" data-toggle="dropdown" href="#">
<i class="fa fa-user fa-fw"></i> <i class="fa fa-caret-down"></i>
</a>
<ul class="dropdown-menu dropdown-user">
<li><a href="/logout"><i class="fa fa-sign-out fa-fw"></i> Logout</a>
</li>
</ul>
<!-- /.dropdown-user -->
</li>
<!-- /.dropdown -->
</ul>
<!-- /.navbar-top-links -->

<div class="navbar-default sidebar" role="navigation">
<div class="sidebar-nav navbar-collapse">
<ul class="nav" id="side-menu">
<li class="sidebar-search">
<div class="input-group custom-search-form">
<input type="text" class="form-control" placeholder="Search...">
<span class="input-group-btn">
<button class="btn btn-default" type="button">
<i class="fa fa-search"></i>
</button>
</span>
</div>
<!-- /input-group -->
</li>
<li>
<a href="#"><i class="fa fa-bar-chart-o fa-fw"></i>Analytics<span class="fa arrow"></span></a>
<ul class="nav nav-second-level">
<li>
<a href="/registrationRecord?year=2015">Registrations</a>
</li>
<li>
<a href="/auditAllRecords">Timestamps</a>
</li>
</ul>
<!-- /.nav-second-level -->
</li>
<li>
<a href="tables.html"><i class="fa fa-table fa-fw"></i>Data<span class="fa arrow"></span></a>
<ul class="nav nav-second-level">
<li>
<a href="/requests?status=pending">Requests</a>
</li>
<li>
<a href="/changeMobileRegTypeForm">Change mobile status</a>
</li>
</ul>
</li>
<li>
<a href="forms.html"><i class="fa fa-edit fa-fw"></i>Forms<span class="fa arrow"></span></a>
<ul class="nav nav-second-level">
<li>
<a href="/brandForm">Add New Brand</a>
</li>
<li>
<a href="/modelForm">Add New Model</a>
</li>
</ul>
</li>

</ul>
</div>
<!-- /.sidebar-collapse -->
</div>
<!-- /.navbar-static-side -->
</nav>

<div id="page-wrapper">
<div class="row">
<div class="col-lg-12">
<h2 style="color: rgba(194, 8, 8, 1);" class="page-header">@action</h2>
</div>
<!-- /.col-lg-12 -->
</div

<!-- render html content parameter -->
@contents

</div>
<!-- /#page-wrapper -->

</div>
<!-- /#wrapper -->

<!-- jQuery -->
<script src="@routes.Assets.at("admin/bower_components/jquery/dist/jquery.min.js")"></script>

<!-- Bootstrap Core JavaScript -->
<script src="@routes.Assets.at("admin/bower_components/bootstrap/dist/js/bootstrap.min.js")"></script>

<!-- Metis Menu Plugin JavaScript -->
<script src="@routes.Assets.at("admin/bower_components/metisMenu/dist/metisMenu.min.js")"></script>

<!-- DataTables JavaScript -->
<script src="@routes.Assets.at("admin/bower_components/DataTables/media/js/jquery.dataTables.min.js")"></script>
<script src="@routes.Assets.at("admin/bower_components/datatables-plugins/integration/bootstrap/3/dataTables.bootstrap.min.js")"></script>

<!-- Custom Theme JavaScript -->
<script src="@routes.Assets.at("admin/dist/js/sb-admin-2.js")"></script>

</body>

</html>
5 changes: 5 additions & 0 deletions app/views/admin/adminIndex.scala.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
@* adminIndex Template File *@
@(action:String,user: Option[model.repository.User])
@admin(action,user){
<h4>Welcome in admin panel of my cell was stolen</h4>
}
Loading

0 comments on commit 6785ea8

Please sign in to comment.