Commit 2a41c00b by root

issue #603 implemented: customized corporative image of Pictogram

parent cd3921d9
......@@ -138,6 +138,7 @@ COMMENT="Methods predefined in the platform or stored by users for cloning";
CREATE TABLE IF NOT EXISTS `office` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(80) COLLATE utf8_unicode_ci NOT NULL,
`logo_url` varchar(240) COLLATE utf8_unicode_ci NOT NULL,
`address` varchar(180) COLLATE utf8_unicode_ci NOT NULL,
`country` varchar(2) COLLATE utf8_unicode_ci NOT NULL,
`lang` varchar(5) COLLATE utf8_unicode_ci NOT NULL,
......
......@@ -50,6 +50,25 @@ module.exports = {
},
/**
* Get basic informacion (logo_url and name) about an office identified by a code
*/
getBasic: function (req, res) {
// We simply remove first 3 characters
var id = req.params.code.substr(3, req.params.code.length-1);
Office.findOne({ id: id }).populate('admin').then(function (office) {
if (office) {
res.ok({logo_url: office.logo_url, name: office.name});
} else {
res.notFound();
}
})
.catch(function () {
res.badRequest();
});
},
/**
* Return all offices
* @param {request} req {}
* @param {response} res
......
......@@ -31,6 +31,11 @@ module.exports = {
type: "string",
size: 80
},
logo_url: {
required: true,
type: "string",
size: 240
},
contactPerson: {
columnName: "contact_person",
required: true,
......@@ -85,4 +90,4 @@ module.exports = {
via: 'office'
}
}
};
\ No newline at end of file
};
......@@ -56,6 +56,11 @@ dashboardApp.config(function ($stateProvider, $urlRouterProvider) {
templateUrl: 'modules/login/views/login.html',
controller: 'LoginCtrl'
})
.state('login_office', {
url: '/login/:office',
templateUrl: 'modules/login/views/login.html',
controller: 'LoginCtrl'
})
.state('login_validate', {
url: '/login/:code/:email',
templateUrl: 'modules/login/views/login.html',
......
......@@ -16,12 +16,18 @@ function LoginCtrl(
config,
$stateParams,
ngToast) {
$scope.credentials = {
email: '',
password: '',
lang: 'es-es'
};
$scope.office = {
logo_url : 'img/logo_pictogram.png',
name : 'Pictogram'
};
// Validation of account
// if the code has been sent in the url "...app/login/code/email"
if ($stateParams.code && $stateParams.email) {
......@@ -39,6 +45,15 @@ function LoginCtrl(
});
}
// Corporate login, office code has been passed
if ($stateParams.office) {
$http
.get(config.backend + '/office/' + $stateParams.office)
.success(function (data) {
$scope.office = data;
});
}
$scope.login = function () {
$scope.submitted = true;
$http
......
......@@ -11,7 +11,7 @@
</p>
-->
<p class="text-center">
<img src="https://www.dropbox.com/s/6v4hwp9rflvak4s/Logomakr_0PxJqJ.png?raw=1" alt="Centro Autismo Jaén" title="Centro Autismo Jaén">
<img src="{{office.logo_url}}" alt="{{office.name}}" title="{{office.name}}">
</p>
<!-- Formulario -->
<!-- LoginCtrl controls here, see app.js -->
......
......@@ -8,9 +8,9 @@
href="/app/#/students">
<img
class="topbar__logo__image"
src="img/logo_pictogram.png"
alt="Pictogram"
title="Pictogram" />
src="{{user.office.logo_url}}"
alt="{{user.office.name}}"
title="{{user.office.name}}" />
</a>
</div>
<div class="topbar__supervisor nav navbar-nav navbar-right">
......
......@@ -3,7 +3,7 @@
<!-- Default panel contents -->
<div class="panel-heading"><h3 class="panel-title" translate>students</h3>
<span ng-if="user.isAdmin">({{user.office.currentStudents}}/{{user.office.maxStudents}} - <span translate="licenses_left" translate-values="{number: num_licenses_left}"></span>)</span>
</divuser.office.currentStudents}}/ivuser.office.maxStudents}} <div class="panel-body">
<div class="panel-body">
<!-- Add Student Form -->
<div ng-include="'modules/supervisor/views/students_add.html'" ng-init="hidestudentadd = true" ng-hide="hidestudentadd"></div>
......
......@@ -5,8 +5,8 @@
<button type="button" class="btn btn-link" ng-click="changeLanguage('en-gb')">English</button>
</div>
<div>
<p class="text-center">
<small>Powered by <a href="http://www.yottacode.com"><img src="img/logo_pictogram.png" width="60px" alt="Pictogram" title="Pictogram" /></a></small>
<p class="text-center" style="margin-top:10px">
<small>Powered by <a href="http://www.yottacode.com"><img src="img/logo_pictogram.png" width="40px" alt="Pictogram" title="Pictogram" /></a></small>
</p>
</div>
</div>
......@@ -62,6 +62,7 @@ module.exports.policies = {
OfficeController: {
getAll: ['tokenAuth', 'isAdmin'],
get: ['tokenAuth'],
getBasic: true,
supervisors: ['tokenAuth', 'isAdmin']
},
......
......@@ -52,6 +52,7 @@ module.exports.routes = {
'DELETE /method/template/:id': 'MetaMethodController.destroy',
'GET /office/get_all': 'OfficeController.getAll',
'GET /office/:code': 'OfficeController.getBasic',
'GET /office/get/:id': 'OfficeController.get',
'GET /office/get/:id/supervisors': 'OfficeController.supervisors',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment