Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
agotsinas committed Feb 28, 2023
1 parent ed74a17 commit b154f86
Show file tree
Hide file tree
Showing 11 changed files with 72 additions and 18 deletions.
17 changes: 11 additions & 6 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,35 +12,40 @@
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/css/bootstrap.min.css" rel="stylesheet">
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/js/bootstrap.bundle.min.js"></script>

<title>AngularJS App Template</title>
<title>Converter Application</title>
</head>
<body ng-app="appName" ng-controller="indexController">

<div class="container">
<div class="row">
<h1 class="text-center"> Template App </h1>
<h1 class="text-center"> Converter Application </h1>
</div>
<div class="row mb-2">
<nav class="navbar navbar-expand-sm bg-primary navbar-dark">
<div class="container-fluid">
<ul class="navbar-nav">
<li class="nav-item">
<a class="nav-link active" href="#/!">Αρχική</a>
<a class="nav-link active" href="#/!" ng-click="onMenuClicked('main')">Αρχική</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#!page1">Page1</a>
<a class="nav-link" href="#!converters" ng-click="onMenuClicked('converters')">Μετατροπές</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#!page2">Page2</a>
<a class="nav-link" href="#!calculations" ng-click="onMenuClicked('calculations')">Υπολογισμοί</a>
</li>
</ul>
</div>
</nav>
</div>
<div class="row">
<div class="col-sm-12">
<div class="col-sm-9">
<div ng-view></div>
</div>
<div class="col-sm-3">
<div ng-repeat="item in actionList">
<a href="{{item.ref}}" ng-click="onMenuClicked('{{item.Name}}')"><button class="btn btn-primary w-100 mb-1">{{item.Name}}</button></a>
</div>
</div>
</div>
</div>
<script src="scripts/app.js"></script>
Expand Down
64 changes: 54 additions & 10 deletions scripts/controllers.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,41 @@
app.controller('indexController',['$scope',function($scope){
$scope.test = "Hello World from indexController";

$scope.actionList = [];

$scope.converterList = [{'Name':'Velocity','ref':"#!velocity"},
{'Name':'Distance','ref':"#!distance"},
{'Name':'Temperature','ref':"#!temperature"}];

$scope.calculationList = [{'Name':'Ohm','ref':"#!ohmslaw"},
{'Name':'Triangle Area','ref':"#!trianglearea"}];


$scope.onMenuClicked = function(menuClicked){
switch(menuClicked){
case 'main':
$scope.actionList = null;
break;
case 'converters':
$scope.actionList = $scope.converterList;
break;
case 'calculations':
$scope.actionList = $scope.calculationList;
break;
}
}
}])

app.controller('mainPageController',['$scope',function($scope){
$scope.test = "Hello World from mainPageController";
}])

app.controller('page1Controller',['$scope',function($scope){
$scope.test = "Hello World from page1Controller";
app.controller('convertersController',['$scope',function($scope){
$scope.test = "Hello World from convertersController";
}])

app.controller('page2Controller',['$scope',function($scope){
$scope.test = "Hello World from page2Controller";
app.controller('calculationsController',['$scope',function($scope){
$scope.test = "Hello World from calculationsController";
}])

app.config(function($routeProvider){
Expand All @@ -20,12 +44,32 @@ app.config(function($routeProvider){
templateUrl : "templates/main.html",
controller: "mainPageController"
})
.when("/page1", {
templateUrl : "templates/page1.html",
controller : "page1Controller"
.when("/converters", {
templateUrl : "templates/converters.html",
controller : "convertersController"
})
.when("/calculations", {
templateUrl : "templates/calculations.html",
controller : "calculationsController"
})
.when("/velocity", {
templateUrl : "templates/velocity.html",
controller : "converterController"
})
.when("/distance", {
templateUrl : "templates/distance.html",
controller : "converterController"
})
.when("/ohmslaw", {
templateUrl : "templates/ohmslaw.html",
controller : "calculationsController"
})
.when("/trianglearea", {
templateUrl : "templates/trianglearea.html",
controller : "calculationsController"
})
.when("/page2", {
templateUrl : "templates/page2.html",
controller : "page2Controller"
.when("/temperature", {
templateUrl : "templates/temperature.html",
controller : "converterController"
})
})
1 change: 1 addition & 0 deletions templates/calculations.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<h1>Calculations page</h1>
1 change: 1 addition & 0 deletions templates/converters.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<h1>Converters page</h1>
1 change: 1 addition & 0 deletions templates/distance.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<h1>Distance converter page</h1>
1 change: 1 addition & 0 deletions templates/ohmslaw.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<h1>Ohms law calculation</h1>
1 change: 0 additions & 1 deletion templates/page1.html

This file was deleted.

1 change: 0 additions & 1 deletion templates/page2.html

This file was deleted.

1 change: 1 addition & 0 deletions templates/temperature.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<h1>Temperature converter</h1>
1 change: 1 addition & 0 deletions templates/trianglearea.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<h1>Triangle Area Calculation</h1>
1 change: 1 addition & 0 deletions templates/velocity.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<h1>Velocity converter page</h1>

0 comments on commit b154f86

Please sign in to comment.