Merge branch 'develop' into 'master'

Develop



See merge request !23
This commit is contained in:
Jan Tuomi
2017-04-06 19:16:41 +03:00
8 changed files with 55 additions and 73 deletions
-1
View File
@@ -5,6 +5,5 @@ all_tests:
- sh ./scripts/autoinstall.sh
- docker-compose run web python manage.py test
after_script:
- docker-compose exec -T web find . -path '*/migrations*' -delete
- docker-compose exec -T web find . -type f -name '*.pyc' -delete
when: on_success
+9 -4
View File
@@ -1,3 +1,6 @@
#footer-div {
height:10vh;
}
.footer {
position: fixed;
bottom: 0;
@@ -6,6 +9,8 @@
text-align: center;
background-color: #cfcfcf;
padding: 1rem;
max-height: 10vh;
font-size: 3vh;
}
#fi-button {
@@ -19,8 +24,8 @@
}
.lang-button {
height: 20px;
width: 30px;
margin-left: 10px;
margin-right: 10px;
height: 4vh;
width: 6vh;
margin-left: 1vh;
margin-right: 1vh;
}
@@ -1,4 +1,4 @@
<div ng-controller="infoadmin_externalimage_create" style="margin-top:20px;">
<div ng-controller="infoadmin_external_image_create" style="margin-top:20px;">
<div>
Create new image. Enter name and full url for any image available in internet (eg. https://i.imgur.com/XXSSqDG.gif)
</div>
+21 -42
View File
@@ -123,43 +123,6 @@ app.controller('infoadmin_ctrl', function($scope, $http, $window, ItemList, Inst
});
ItemList.loadItems();
});
app.controller('infoadmin_externalimage_create', function($scope, $http,ItemList){
$scope.item = {}
$scope.send = function(){
$http.post("/infoscreen/create_external_image", $scope.item).then(ItemList.loadItems)
}
});
app.controller('infoadmin_abbitem_create', function($scope, $http,ItemList){
$scope.item = {}
$scope.send = function(){
$http.post("/infoscreen/create_abbitem", $scope.item).then(ItemList.loadItems)
}
});
app.controller('infoadmin_sossoitem_create', function($scope, $http,ItemList){
$scope.item = {}
$scope.send = function(){
$http.post("/infoscreen/create_sossoitem", $scope.item).then(ItemList.loadItems)
}
});
app.controller('infoadmin_eventitem_create', function($scope, $http,ItemList){
$scope.item = {}
$scope.send = function(){
$http.post("/infoscreen/create_eventitem", $scope.item).then(ItemList.loadItems)
}
});
app.controller('infoadmin_hslitem_create', function($scope, $http,ItemList){
$scope.item = {}
$scope.send = function(){
$http.post("/infoscreen/create_hslitem", $scope.item).then(ItemList.loadItems)
}
});
app.controller('infoadmin_websiteitem_create', function($scope, $http,ItemList){
$scope.item = {}
$scope.send = function(){
$http.post("/infoscreen/create_websiteitem", $scope.item).then(ItemList.loadItems)
}
});
app.controller('infoadmin_image_create', ['$scope', 'Upload', '$timeout',"ItemList", function ($scope, Upload, $timeout,ItemList) {
$scope.send = function(file) {
@@ -182,9 +145,25 @@ app.controller('infoadmin_image_create', ['$scope', 'Upload', '$timeout',"ItemLi
}
}]);
app.controller('infoadmin_apyitem_create', function($scope, $http,ItemList){
$scope.item = {}
$scope.send = function(){
$http.post("/infoscreen/create_apyitem", $scope.item).then(ItemList.loadItems)
function itemGenerator(create_url){
return function($scope, $http, ItemList){
$scope.item = {}
$scope.send = function(){
$http.post(create_url, $scope.item).then(ItemList.loadItems)
}
}
});
}
function controllerGenerator(name){
app.controller("infoadmin_" + name + "_create",
itemGenerator("/infoscreen/create_" + name));
}
var simple_controllers = [
"external_image",
"abbitem",
"sossoitem",
"eventitem",
"hslitem",
"websiteitem",
"apyitem",
];
_.each(simple_controllers, controllerGenerator);
@@ -129,7 +129,7 @@ app.controller('timetableCtrl',
objects=data['data'];
for(var objectIndex in objects){
var stop = objects[objectIndex];
var lineIndex;
for (lineIndex in stop['lines']){
var elem=stop['lines'][lineIndex].split(":");
@@ -165,7 +165,7 @@ app.controller('timetableCtrl',
departure['stop']="A. A. puisto"
var trigger = true;
for (var arrIndex = $scope.arr.length - 1; arrIndex >= 0; arrIndex--) {
if ($scope.arr[arrIndex]['bus'] == departure['bus'] &&
if ($scope.arr[arrIndex]['bus'] == departure['bus'] &&
$scope.arr[arrIndex]['laststop'] == departure['laststop']) {
if ($scope.arr[arrIndex]['dist'] == departure['dist']){
@@ -226,4 +226,3 @@ app.controller('timetableCtrl',
var inter3=$interval(updateTime, 1000);
}
);
+4 -1
View File
@@ -15,7 +15,7 @@
<form name="memberTextForm">
<div class="row">
<div class="col-sm-4">
<textarea ng-model="memberData" rows="20" cols="120" placeholder="Salli, Vahvonen, salli.vahvonen@notmail.dom, Kerava, 0, 0" style="border:solid 3px #c9c9c9; transition:box-shadow 0.3s, border 0.3s; align:middle;"></textarea>
<textarea ng-model="memberData" rows=5 cols=80 placeholder="Salli, Vahvonen, salli.vahvonen@notmail.dom, Kerava, 0, 0" style="border:solid 3px #c9c9c9; transition:box-shadow 0.3s, border 0.3s; align:middle;"></textarea>
</div>
</div>
<div class="row">
@@ -23,6 +23,9 @@
<button ng-click="sendCSV()" type="submit" class="btn btn-success" id="sendMembers">Lähetä</button>
</div>
</div>
<div id="footer-div"/>
</form>
</div>
{% endblock content %}
+17 -20
View File
@@ -1,5 +1,11 @@
#!/bin/bash
export DOCKER_OPTS=""
PROJECT="web20"
echo "SIKWEB 2.0 Dockerific install script"
echo "===================================="
echo "Checking if docker is installed..."
docker --version
if [ "$?" -ne 0 ]
@@ -8,9 +14,7 @@ then
curl -fsSL https://get.docker.com/ | sh
fi
echo "Starting docker daemon and sleeping for 10 seconds..."
dockerd &
sleep 10
systemctl status docker.service >/dev/null || { echo "Docker daemon is not running. Please start it!"; exit 1; }
echo "Checking if docker-compose is installed..."
docker-compose --version
@@ -21,40 +25,33 @@ then
chmod +x /usr/local/bin/docker-compose
fi
echo "Building db container..."
docker-compose build db
docker-compose -p "$PROJECT" build db || { echo "Failed to build db!"; exit 1; }
echo "Starting db container..."
docker-compose up -d db
docker-compose -p "$PROJECT" up -d db || { echo "Failed to start db container!"; exit 1; }
echo "Waiting 10 seconds..."
sleep 10
echo "Importing database settings..."
docker-compose exec -T db sh /db/install.sh
if [ "$?" -eq 0 ]
then
echo "Success!"
else
echo "Failure!"
exit 1
fi
docker-compose -p "$PROJECT" exec -T db sh /db/install.sh || { echo "Failed to import database settings!"; exit 1; }
echo "Shutting down db container..."
docker-compose down db
echo "Copying settings..."
cp sikweb/settings-docker-sample.py sikweb/settings.py
cp sikweb/settings-docker-sample.py sikweb/settings.py || { echo "Failed to copy settings!"; exit 1; }
echo "Building web container..."
docker-compose build web
docker-compose -p "$PROJECT" build web
echo "Running manage.py commands..."
docker-compose run web python manage.py migrate
docker-compose run web python manage.py makemigrations infoscreen members webapp
docker-compose run web python manage.py migrate
docker-compose run web python manage.py createdefaultadmin
docker-compose -p "$PROJECT" run web python manage.py migrate || { echo "Failed to apply migrations!"; exit 1; }
docker-compose -p "$PROJECT" run web python manage.py createdefaultadmin || { echo "Failed to create default admin user."; }
echo "Starting all containers..."
docker-compose up -d
docker-compose -p "$PROJECT" up -d || { echo "Failed to start containers!"; exit 1; }
echo "Done."
@@ -17,4 +17,4 @@ class Command(BaseCommand):
u.is_staff = True
u.save()
self.stdout.write("Created default user {} with password {}.")
self.stdout.write("Created default user {} with password {}.".format(self.user_name, self.password))