Skip to content

Commit

Permalink
Merge pull request #163 from gtugablue/develop
Browse files Browse the repository at this point in the history
Updating master branch with latest develop changes
  • Loading branch information
silva95gustavo authored Jan 6, 2017
2 parents 9793741 + 35c67a3 commit fe82392
Show file tree
Hide file tree
Showing 59 changed files with 11,931 additions and 391 deletions.
56 changes: 46 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,22 @@
# Associação Cuidadores

Associação Cuidadores aims to fully support carers around Portugal, providing a set of services in order to improve their quality of life. Their main partner is the Carers Trust organization, which has a validated model in the United Kingdom for more than 30 years. Cuidadores wants to know the context, needs and profile of all portuguese carers, therefore recognizing their role.

This project consists of two website components and a mobile app: the institutional website of the association, a forum for carers inside the website and an app to quickly acccess both components.

- [Getting started](#getting-started)
- [Prerequisites](#prerequisites)
- [Installation](#installation)
- [Website](#website)
- [Mobile app](#mobile-app)
- [Running the tests](#running-the-tests)
- [Updating](#updating)
- [Usage](#usage)
- [Account system](#account-system)
- [Charts](#charts)
- [Forms](#forms)
- [Newsletter](#newsletter)
- [Custom content](#custom-content)
- [Export user info](#export-user-info)
- [System architecture](#system-architecture)
- [Built width](#built-width)
Expand All @@ -27,6 +33,7 @@
- Minimum 512MB disk space in the web server. Keep in mind you need much more for the database, files uploaded by the users, media, backups and other files.
- MySQL 5.5.3 or higher with PDO and an InnoDB-compatible primary storage engine.
- SSH (command-line) access to the server folders.
- NodeJS 6.9

### Installation

Expand All @@ -35,19 +42,38 @@
1. Open a command line on folder `/web/scripts/`.
2. Copy the file `/web/sites/default/settings.local.example.php` to `/web/sites/default/settings.local.php` and update it with the configurations of your database, as well as the folder where the temporary files will be stored.
3. Copy the file `/web/comunidade/config.local.example.php` to `/web/comunidade/config.local.php` and update it with your database configurations, as well as the path to the online community page.
4. Open a command line in folder `/web/scripts/`.
5. Run the command `install.bat <dbuser> <dbpass> <dbname>`. If the database has no _password_ write `""` in the `<dbpass>` field.
6. In order for the admin to be automatically notified when a community user becomes an adult, a cronjob must be set up. This means adding the following line to the crontab file: `0 0 * * * php -q /var/www/staging/comunidade/young_adult/notify_admin.php`
4. Copy the file `/web/register/config.local.example.php` to `/web/register/config.local.php` and update it with your SMTP server configuration, as well as the website's address and administrator's email.
5. Open a command line in folder `/web/scripts/`.
6. Run the command `install.bat <dbuser> <dbpass> <dbname>`. If the database has no _password_ write `""` in the `<dbpass>` field.
7. In order for the admin to be automatically notified when a community user becomes an adult, a cronjob must be set up. This means adding the following line to the crontab file: `0 0 * * * php -q /var/www/staging/comunidade/young_adult/notify_admin.php`

#### Mobile app
1. Get the website up and runnning.
2. Install latest Node.js.
3. Run `npm install -g cordova ionic`.
4. To test the app in your browser run `ionic serve`.

### Running the tests
The website unit tests use PHPUnit and can be run with the following command: `/web/core/vendor/bin/phpunit --testsuite=unit`.
The website acceptance tests use Selenium and Google Chrome as the browser. They can be run with the following command: `/web/scripts/acceptance/compile_and_run.bat`.

### Updating

#### Drupal
You are highly recommended not to update Drupal, unless a security update is available. The reason for this is that some files that are modified by the update must be manually edited to restore their original content.

To update, the "Update Manager" module must be enabled. Then you should backup the following files:
- .htaccess
- robots.txt
- core/lib/Drupal/Core/Password/PhpassHashedPassword.php

After updating, you must merge the files you previously backed up with the new changes. Also, you need to remove the following test files:
- core/lib/Drupal/Core/Password/PhpassHashedPassword.php
- core/tests/Drupal/Tests/Core/PageCache/CommandLineOrUnsafeMethodTest.php

#### Flarum
Run `composer update` in a command line open on folder `/web/comunidade/`.

## Usage
In this section, the usage of specific parts of the website will be explained.

Expand Down Expand Up @@ -77,15 +103,25 @@ The newsletter system allows the subscription of guests or logged-in users. It a

![Newsletter subscription](images/newsletter_subscription.gif)

### Custom content
Some special content of the website can be created using the appropriate content type. The following list explains some of the custom content types available:
- **Chart:** Creates a chart (using EasyChart) to be displayed in the sidebar of the main page.
- **Event:** Creates a new event that will be displayed in the calendar and in the News & Events section.
- **News:** Creates a news article that will be displayed in the News & Events section as well as the main page.
- **Partner:** Adds an image to the Partners/Supporters section.
- **Responsive slideshow:** Adds a new image to the main page slideshow.
- **Newsletter issue:** Creates a new issue of a newsletter, to be later sent to the subscribers.
- **Training video:** Adds a new video to the Training Videos section.

### Export user info
The administrator is able to export a list of all users of both the website and community to an Excel spreadsheet. In order to do that, one must acess the Configuration page and click "Export User Information" in the development section. The generated spreadsheet contains the following columns:
- **Account type:** - Can be one of three values: "Website", "Community" or "Both". The value depends on where the user is registered.
- **Email:** - The email of the user.
- **Name:** - The name of the user (optional field).
- **Associate number:** - The associate number of the user (optional field).
- **Username:** - The username of the user (if registered in the forum).
- **Age group:** - Young (17-) or Adult (18+).
- **Account activated:** - Activated or Not Activated, depending on whether or not the user has activated the email associated to the account.
- **Account type:** Can be one of three values: "Website", "Community" or "Both". The value depends on where the user is registered.
- **Email:** The email of the user.
- **Name:** The name of the user (optional field).
- **Associate number:** The associate number of the user (optional field).
- **Username:** The username of the user (if registered in the forum).
- **Age group:** Young (17-) or Adult (18+).
- **Account activated:** Activated or Not Activated, depending on whether or not the user has activated the email associated to the account.

## System architecture

Expand Down
1 change: 0 additions & 1 deletion app/www/scripts/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ angular.module('starter', ['ionic', 'starter.services', 'starter.controllers', '
.state('contacts', {
parent: 'menu',
url: '/contacts',
cache: false,
views: {
'menuContent': {
templateUrl: 'views/contacts.html',
Expand Down
19 changes: 14 additions & 5 deletions app/www/scripts/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,17 @@ angular.module('starter.constants', [])
images: 'http://localhost:8100/api/images/'
})*/

.constant('API', {
domain: 'http://cuidadores.tk/',
login: 'http://cuidadores.tk/user/login/',
images: 'http://localhost:8100/api/images/'
})
.constant('API', (function() {
var domain = 'http://cuidadores.tk/';
return {
login: domain + 'user/login/',
logout: domain + 'user/logout/',
images: 'http://localhost:8100/api/images/',
carer: domain + 'pt-pt/node/35/',
community: domain + 'comunidade/',
contacts: domain + 'pt-pt/node/33/',
domain: domain,
restricted: domain + 'pt-pt/area-restrita/',
services: domain + 'pt-pt/node/34/'
}
})())
4 changes: 3 additions & 1 deletion app/www/scripts/controllers/carer.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
angular.module('starter.controllers.carer', [])

.controller('carerCtrl', function ($scope, $ionicLoading) {
.controller('carerCtrl', function ($scope, $ionicLoading, API, $sce) {
var ctrl = this;
ctrl.domain = $sce.trustAsResourceUrl(API.carer);
$scope.loading = $ionicLoading.show();

$('iframe').on('load', function() {
Expand Down
4 changes: 3 additions & 1 deletion app/www/scripts/controllers/community.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
angular.module('starter.controllers.community', [])

.controller('communityCtrl', function ($scope, $ionicLoading) {
.controller('communityCtrl', function ($scope, $ionicLoading, API, $sce) {
var ctrl = this;
ctrl.domain = $sce.trustAsResourceUrl(API.community);

$scope.loading = $ionicLoading.show();

Expand Down
4 changes: 3 additions & 1 deletion app/www/scripts/controllers/contacts.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
angular.module('starter.controllers.contacts', [])

.controller('contactsCtrl', function ($scope, $ionicLoading) {
.controller('contactsCtrl', function ($scope, $ionicLoading, $sce, API) {
var ctrl = this;
ctrl.domain = $sce.trustAsResourceUrl(API.carer);
$scope.loading = $ionicLoading.show();

$('iframe').on('load', function () {
Expand Down
3 changes: 2 additions & 1 deletion app/www/scripts/controllers/home.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
angular.module('starter.controllers.home', ['ngSanitize'])

.controller('homeCtrl', function ($scope, $ionicLoading) {
.controller('homeCtrl', function ($scope, $ionicLoading, $sce, API) {
var ctrl = this;
ctrl.domain = $sce.trustAsResourceUrl(API.domain);
$scope.loading = $ionicLoading.show();

$('iframe').on('load', function() {
Expand Down
7 changes: 5 additions & 2 deletions app/www/scripts/controllers/restricted.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
angular.module('starter.controllers.restricted', [])

.controller('restrictedCtrl', function ($window, $scope, $ionicModal, $ionicLoading, API) {

.controller('restrictedCtrl', function ($window, $scope, $ionicModal, $ionicLoading, API, $sce) {
var ctrl = this;
ctrl.domain = $sce.trustAsResourceUrl(API.restricted);

localforage.getItem('session').then(function (value) {
ctrl.session = value;
});

$scope.loading = $ionicLoading.show();

if(!ctrl.session)
$scope.loading = $ionicLoading.hide()

$('iframe').on('load', function () {
$ionicLoading.hide();
$('iframe').contents().find("#cuidadores_header").remove();
Expand Down
4 changes: 3 additions & 1 deletion app/www/scripts/controllers/services.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
angular.module('starter.controllers.services', [])

.controller('servicesCtrl', function ($scope, $ionicLoading) {
.controller('servicesCtrl', function ($scope, $ionicLoading, $sce, API) {
var ctrl = this;
ctrl.domain = $sce.trustAsResourceUrl(API.services);
$scope.loading = $ionicLoading.show();

$('iframe').on('load', function () {
Expand Down
2 changes: 1 addition & 1 deletion app/www/scripts/services.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
});
},
logout: function () {
return $http.get(API.domain + '/user/logout/');
return $http.get(API.logout);
}
}
});"@@"
2 changes: 1 addition & 1 deletion app/www/views/carer.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<ion-view view-title="Sou um Cuidador?">
<ion-content>
<iframe class='webPage' src="http://cuidadores.tk/pt-pt/node/35">
<iframe class='webPage' ng-src="{{carer.domain}}">
</iframe>
</ion-content>
</ion-view>
2 changes: 1 addition & 1 deletion app/www/views/community.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<ion-view view-title="Comunidade Online">
<ion-content>
<iframe class='webPage' src="http://cuidadores.tk/comunidade/"></iframe>
<iframe class='webPage' ng-src="{{community.domain}}"></iframe>
</ion-content>
</ion-view>
2 changes: 1 addition & 1 deletion app/www/views/contacts.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<ion-view view-title="Contactos">
<ion-content>
<iframe class='webPage' src="http://cuidadores.tk/pt-pt/node/33">
<iframe class='webPage' ng-src="{{contacts.domain}}">
</iframe>
</ion-content>
</ion-view>
2 changes: 1 addition & 1 deletion app/www/views/home.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
<ion-spinner icon="spiral" class="spinner-positive"></ion-spinner>
</div>-->
<ion-content>
<iframe class='webPage' src="http://cuidadores.tk/"></iframe>
<iframe class='webPage' ng-src="{{home.domain}}"></iframe>
</ion-content>
</ion-view>
2 changes: 1 addition & 1 deletion app/www/views/restricted.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<ion-view view-title="Área Restrita">
<ion-content ng-show="restricted.session">
<iframe class='webPage' src="http://cuidadores.tk/pt-pt/area-restrita">
<iframe class='webPage' ng-src="{{restricted.domain}}">
</iframe>
</ion-content>
<ion-content ng-hide="restricted.session">
Expand Down
2 changes: 1 addition & 1 deletion app/www/views/services.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<ion-view view-title="Serviços">
<ion-content>
<iframe class='webPage' src="http://cuidadores.tk/pt-pt/node/34">
<iframe class='webPage' ng-src="{{services.domain}}">
</iframe>
</ion-content>
</ion-view>
Loading

0 comments on commit fe82392

Please sign in to comment.