Skip to content

Commit

Permalink
Fix merge conflict.
Browse files Browse the repository at this point in the history
  • Loading branch information
laceysanderson committed Nov 12, 2019
2 parents 9150dfd + ed14253 commit b3570bd
Show file tree
Hide file tree
Showing 14 changed files with 601 additions and 391 deletions.
4 changes: 3 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
},
"require-dev": {
"statonlab/tripal-test-suite": "1.5.*",
"phpunit/php-code-coverage": "^6.1"
"phpunit/php-code-coverage": "^6.1",
"squizlabs/php_codesniffer": "^2.9.1",
"drupal/coder": "^8.2"
},
"autoload": {
"psr-4": {
Expand Down
170 changes: 169 additions & 1 deletion composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file added docs/_static/img/imports_userdash.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
20 changes: 20 additions & 0 deletions docs/contributing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,23 @@ It provides a database seeder to make development a bit easier. Once you've inst
.. warning::

**NEVER** run seeders on production sites. They will insert fictitious data into Chado.

Coding Standards
------------------

This project uses code climate to ensure coding standards are met. We suggest you use php_codesniffer locally to check coding standards before submitting a Pull Request for a smoother experience. This can be done as follows:

1. Run ``composer up`` within the Tripal HQ directory. This will install php_codesniffer locally.
2. Check coding standards by running ``./vendor/bin/phpcs --standard=vendor/drupal/coder/coder_sniffer/Drupal/ruleset.xml [file]`` where ``[file]`` contains your changes. This will output a report meant to help you improve your code.
3. php_codesniffer includes a tool for automatically fixing many warnings you may have encountered. To run it execute ``./vendor/bin/phpcbf --standard=vendor/drupal/coder/coder_sniffer/Drupal/ruleset.xml [file]`` on the same file. Make sure to review any changes it makes.
4. Manually fix any remaining errors and re-run step 2 to confirm.

We truely appretiate your effort in keeping our project standards compliant!

Automated Testing
-------------------

This project uses TripalTestSuite and phpunit for automated testing. To run tests:

1. Run ``composer up`` within the Tripal HQ directory. This will install phpunit locally.
2. Run ``.vendor/bin/phpunit`` to execute all tests.
4 changes: 3 additions & 1 deletion docs/introduction.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,14 @@ What is Tripal HQ?

Tripal HQ provides a user-contributed content control center and administrative toolbox for your Tripal site. This means that users are able to create whatever Chado content you'd like them, but withhold inserting it into the database until someone has approved it.

Tripal HQ Imports extends this functionality to data importers. In this way your users can submit any single-page Tripal importer and both the file and associated metadata will remain in holding for administrative review. Once approved, the importer will be run, inserting all data into the database.

HQ also provides a Chado-specific permission (currently only supporting organisms). If you have lots of organisms on your site, and want to allow users to be the admin of a specific organism or set of organisms, this feature is for you!

Module Features
================

* Users create data using your existing Bundle configuration- no extra forms!
* Users create data using your existing Bundle configuration or Importers- no extra forms!
* User dashboard area for viewing pending submissions
* Admin dashboard for viewing submissions
* Chado-based permissions to create admins for certain projects or organisms
2 changes: 1 addition & 1 deletion docs/setup/install.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Clone the repo with github and enable the module with drush. For example:
cd /var/www/html/sites/all/modules/custom/
git clone https://github.com/statonlab/tripal_hq.git
drush pm-enable tripal_hq tripal_hq_permissions
drush pm-enable tripal_hq tripal_hq_imports tripal_hq_permissions
Expand Down
1 change: 1 addition & 0 deletions docs/setup/permissions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ On installation, HQ defines the following permissions:
* **Administer CHADO-specific Tripal HQ content**: Lets you specify what Chado content a user can administer.
* **Create Tripal HQ content requests**: Allows users to submit content requests and view their dashboard.
* **Propose Tripal HQ Content** permission for each of your defined bundles. This will let you configure which bundles can be proposed by users.
* **Propose Tripal HQ Data File** permission for each available Tripal Importer. This will let you configure which importers can be proposed by users.

To get started, you'll need to create a role for your content submitters, and give them the "Create Tripal Content Requests" permission, plus whatever specific bundle permissions you'd like them to see.

Expand Down
14 changes: 14 additions & 0 deletions docs/usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ Module Usage
Users
=======

Content Pages
---------------

User content submission can be reached at ``tripal_hq/bio_data``.


Expand All @@ -14,6 +17,17 @@ Approved, pending, and rejected content is displayed in the table. Clicking the

Click the "Submit Content" button to submit Tripal Content. The submission form is the **exact same form** as the admin content creation form.

Data Files
------------

Data files can be submitted by users at ``tripal_hq/bio_data/import-data``.

.. image:: /_static/img/imports_userdash.png

As you can see in the above screenshot when Tripal HQ Imports is enabled, it adds a second table to the user dashboard. This makes it easy to see the status of both your content and data file submissions.

To submit a new data file with associated metadata, click "Import data file". You can edit a pending submission by clicking the "Edit" link beside that particular data file. Both the submission add and edit forms match the administrative data import forms exactly which ensures consistent metadata and validation.

Admins
=======

Expand Down
8 changes: 7 additions & 1 deletion tripal_hq_imports/includes/tripal_hq_imports.api.inc
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ function tripal_hq_get_importers() {
*
* @param string $class
* The TripalImporter class to include.
*
* @return bool
* TRUE if the field type class file was found, FALSE otherwise.
*/
Expand Down Expand Up @@ -80,6 +81,7 @@ function tripal_hq_load_include_importer_class($class) {
*
* @param int $submission_id
* The id of the submission you would like returned.
*
* @return object
* An object describing the submission.
*/
Expand All @@ -97,6 +99,7 @@ function tripal_hq_imports_get_submission_by_id($submission_id) {
*
* @param object $submission
* An object describing the submission to be rejected.
*
* @return bool
* True if the rejection was successful, FALSE otherwise.
*/
Expand Down Expand Up @@ -124,6 +127,7 @@ function tripal_hq_imports_reject_submission($submission) {
*
* @param object $submission
* An object describing the submission to be approved.
*
* @return bool
* Returns FALSE if an error is encountered, otherwise TRUE.
*/
Expand Down Expand Up @@ -165,10 +169,12 @@ function tripal_hq_imports_approve_submission($submission) {
* A form field defined using the Drupal Form API.
* @param array $values
* The full values list for the form.
* @param string $element_key
* THe key of the element to be checked.
* @param string $op
* One of 'edit' or 'view' where the second will be read-only.
*/
function tripal_hq_editview_form_field(&$form_field, $values, $element_key, $op) {
function tripal_hq_editview_form_field(array &$form_field, array $values, $element_key, $op) {

if (isset($form_field['#type']) and ($form_field['#type'] == 'fieldset')) {
foreach (element_children($form_field) as $child_element) {
Expand Down
Loading

0 comments on commit b3570bd

Please sign in to comment.