Skip to content
This repository has been archived by the owner on Jun 23, 2019. It is now read-only.
/ activatoradmin Public archive

✅ Slim/Backbone application for (de)activating items

Notifications You must be signed in to change notification settings

jenbuzz/activatoradmin

Repository files navigation

ActivatorAdmin

Build Status

Screenshot

Third-Party Libraries

PHP

JS

CSS

Grunt

Gulp

NodeJS

Requirements

  • PHP 7.1
  • MySQL or MongoDB

Usage

Login using these fixed credentials: Username = admin & Password = admin. The credentials are set in config/config.ini. To change to password you need to first generate a new one using PHP's password_hash() function. Example: "password_hash('activatoradmin_' . 'your_new_password_goes_here', PASSWORD_DEFAULT)".

A default database structure can be found in docs/db.sql. Use database mapping as explained under Configuration if the default database structure is different.

Command-Line Usage

It is possible to (de)activate items using the command-line. Node.js is required for this. You need to know the ID of the item to activate beforehand. Enter the following command and follow instructions:

$ node cli/activatoradmin.js

Configuration

Setup the configuration in config/config.ini and config/config.js. Changes to config/config.js should be followed by "grunt minify" or "gulp minifyConfig" for minifying the javascript.

It is possible to use MongoDB or MySQL as the database. This is how you set the currently active database (mongodb or mysql):

[db]
activedb = "mysql"

Mapping of column names in tables allows changing the names for "name", "isactive", and "image" to whatever matches the table in use. It must be set up in both configuration files!

[db_mapping]
name = "name"
isactive = "isactive"
image = "image"

Setting up the host and baseurl must also be specified in both configuration files (.js and .ini). Baseurl is only needed if ActivatorAdmin is not located in the root directory. Here is the format of "host" and "baseUrl" - notice that the protocol http(s) is not needed:

[url]
host: 'localhost'
baseUrl: '/activatoradmin/'

Enable/Disable logging in config/config.ini: (logging to docs/activatoradmin.log)

[logging]
log = 0

It is possible to enable and disable certain frontend features using configuration variables in config.js:

showInfo: true // Show info button for each item
showDelete: true // Show delete button for deleting a single item

Docker

To run the entire application in a Docker environment for further development:

$ docker-compose up --build -d

Setup database with:

$ make setup-db

Import dummy data with:

$ make import-data

Documentation

Generate API Documentation locally using phpDocumentor and the script ROOT_DIRECTORY/docs/update_phpdoc.sh and find the results in ROOT_DIRECTORY/docs/phpdoc/

See the results from PHPLOC in ROOT_DIRECTORY/docs/phploc.csv. Update the results by running update_phploc.sh.

Testing

Test cases have been created and tested using Jasmine v2.3.4, CasperJS v1.1.3, Mocha v3.2.0, and PHPUnit 6.1.4.

Run both Jasmine, CasperJS, and PHPUnit test cases using grunt:

$ grunt test

PHPUnit

Run PHPUnit test cases from ROOT_DIRECTORY:

$ phpunit test/phpunit

CasperJS

Run CasperJS test cases from ROOT_DIRECTORY:

$ casperjs test test/casperjs

Jasmine

Run Jasmine test cases by opening the following URL in a browser: ROOT_URL/test/jasmine/SpecRunner.html

Mocha

Run test of command-line version of activatoradmin using Mocha from ROOT_DIRECTORY:

$ mocha test/nodejs/test-cli-activatoradmin.js

License

ActivatorAdmin is open-sourced software licensed under the MIT license