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"; ...@@ -138,6 +138,7 @@ COMMENT="Methods predefined in the platform or stored by users for cloning";
CREATE TABLE IF NOT EXISTS `office` ( CREATE TABLE IF NOT EXISTS `office` (
`id` int(11) NOT NULL AUTO_INCREMENT, `id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(80) COLLATE utf8_unicode_ci NOT NULL, `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, `address` varchar(180) COLLATE utf8_unicode_ci NOT NULL,
`country` varchar(2) COLLATE utf8_unicode_ci NOT NULL, `country` varchar(2) COLLATE utf8_unicode_ci NOT NULL,
`lang` varchar(5) COLLATE utf8_unicode_ci NOT NULL, `lang` varchar(5) COLLATE utf8_unicode_ci NOT NULL,
......
...@@ -50,6 +50,25 @@ module.exports = { ...@@ -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 * Return all offices
* @param {request} req {} * @param {request} req {}
* @param {response} res * @param {response} res
......
...@@ -31,6 +31,11 @@ module.exports = { ...@@ -31,6 +31,11 @@ module.exports = {
type: "string", type: "string",
size: 80 size: 80
}, },
logo_url: {
required: true,
type: "string",
size: 240
},
contactPerson: { contactPerson: {
columnName: "contact_person", columnName: "contact_person",
required: true, required: true,
...@@ -85,4 +90,4 @@ module.exports = { ...@@ -85,4 +90,4 @@ module.exports = {
via: 'office' via: 'office'
} }
} }
}; };
\ No newline at end of file
...@@ -56,6 +56,11 @@ dashboardApp.config(function ($stateProvider, $urlRouterProvider) { ...@@ -56,6 +56,11 @@ dashboardApp.config(function ($stateProvider, $urlRouterProvider) {
templateUrl: 'modules/login/views/login.html', templateUrl: 'modules/login/views/login.html',
controller: 'LoginCtrl' controller: 'LoginCtrl'
}) })
.state('login_office', {
url: '/login/:office',
templateUrl: 'modules/login/views/login.html',
controller: 'LoginCtrl'
})
.state('login_validate', { .state('login_validate', {
url: '/login/:code/:email', url: '/login/:code/:email',
templateUrl: 'modules/login/views/login.html', templateUrl: 'modules/login/views/login.html',
......
...@@ -16,12 +16,18 @@ function LoginCtrl( ...@@ -16,12 +16,18 @@ function LoginCtrl(
config, config,
$stateParams, $stateParams,
ngToast) { ngToast) {
$scope.credentials = { $scope.credentials = {
email: '', email: '',
password: '', password: '',
lang: 'es-es' lang: 'es-es'
}; };
$scope.office = {
logo_url : 'img/logo_pictogram.png',
name : 'Pictogram'
};
// Validation of account // Validation of account
// if the code has been sent in the url "...app/login/code/email" // if the code has been sent in the url "...app/login/code/email"
if ($stateParams.code && $stateParams.email) { if ($stateParams.code && $stateParams.email) {
...@@ -39,6 +45,15 @@ function LoginCtrl( ...@@ -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.login = function () {
$scope.submitted = true; $scope.submitted = true;
$http $http
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
</p> </p>
--> -->
<p class="text-center"> <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> </p>
<!-- Formulario --> <!-- Formulario -->
<!-- LoginCtrl controls here, see app.js --> <!-- LoginCtrl controls here, see app.js -->
......
...@@ -8,9 +8,9 @@ ...@@ -8,9 +8,9 @@
href="/app/#/students"> href="/app/#/students">
<img <img
class="topbar__logo__image" class="topbar__logo__image"
src="img/logo_pictogram.png" src="{{user.office.logo_url}}"
alt="Pictogram" alt="{{user.office.name}}"
title="Pictogram" /> title="{{user.office.name}}" />
</a> </a>
</div> </div>
<div class="topbar__supervisor nav navbar-nav navbar-right"> <div class="topbar__supervisor nav navbar-nav navbar-right">
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
<!-- Default panel contents --> <!-- Default panel contents -->
<div class="panel-heading"><h3 class="panel-title" translate>students</h3> <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> <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 --> <!-- Add Student Form -->
<div ng-include="'modules/supervisor/views/students_add.html'" ng-init="hidestudentadd = true" ng-hide="hidestudentadd"></div> <div ng-include="'modules/supervisor/views/students_add.html'" ng-init="hidestudentadd = true" ng-hide="hidestudentadd"></div>
......
...@@ -5,8 +5,8 @@ ...@@ -5,8 +5,8 @@
<button type="button" class="btn btn-link" ng-click="changeLanguage('en-gb')">English</button> <button type="button" class="btn btn-link" ng-click="changeLanguage('en-gb')">English</button>
</div> </div>
<div> <div>
<p class="text-center"> <p class="text-center" style="margin-top:10px">
<small>Powered by <a href="http://www.yottacode.com"><img src="img/logo_pictogram.png" width="60px" alt="Pictogram" title="Pictogram" /></a></small> <small>Powered by <a href="http://www.yottacode.com"><img src="img/logo_pictogram.png" width="40px" alt="Pictogram" title="Pictogram" /></a></small>
</p> </p>
</div> </div>
</div> </div>
...@@ -62,6 +62,7 @@ module.exports.policies = { ...@@ -62,6 +62,7 @@ module.exports.policies = {
OfficeController: { OfficeController: {
getAll: ['tokenAuth', 'isAdmin'], getAll: ['tokenAuth', 'isAdmin'],
get: ['tokenAuth'], get: ['tokenAuth'],
getBasic: true,
supervisors: ['tokenAuth', 'isAdmin'] supervisors: ['tokenAuth', 'isAdmin']
}, },
......
...@@ -52,6 +52,7 @@ module.exports.routes = { ...@@ -52,6 +52,7 @@ module.exports.routes = {
'DELETE /method/template/:id': 'MetaMethodController.destroy', 'DELETE /method/template/:id': 'MetaMethodController.destroy',
'GET /office/get_all': 'OfficeController.getAll', 'GET /office/get_all': 'OfficeController.getAll',
'GET /office/:code': 'OfficeController.getBasic',
'GET /office/get/:id': 'OfficeController.get', 'GET /office/get/:id': 'OfficeController.get',
'GET /office/get/:id/supervisors': 'OfficeController.supervisors', '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