-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from platform-coop-toolkit/dev
Merge pcc platform coop changes into fork
- Loading branch information
Showing
91 changed files
with
10,055 additions
and
638 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
name: Generate MO from PO files | ||
|
||
on: | ||
push: | ||
branches: | ||
- dev | ||
paths: | ||
- '**.po' | ||
|
||
jobs: | ||
generate-mo: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Install xgettext | ||
run: sudo apt-get install -y gettext | ||
- name: Generate MO files | ||
run: for file in resources/lang/*.po ; do msgfmt $file -o `echo $file | sed 's/\(.*\.\)po/\1mo/'` ; done | ||
- name: Commit updated MO files | ||
uses: stefanzweifel/[email protected] | ||
with: | ||
commit_message: 'chore(localization): update MO files' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
name: Test, build, and deploy | ||
|
||
on: [push] | ||
on: [push, pull_request] | ||
|
||
jobs: | ||
test: | ||
|
@@ -28,21 +28,6 @@ jobs: | |
run: | | ||
composer install | ||
composer test | ||
update-pot: | ||
needs: test | ||
if: github.ref == 'refs/heads/dev' | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Install xgettext | ||
run: sudo apt-get install -y gettext | ||
- name: Update POT | ||
run: npm run pot | ||
- name: Commit updated POT | ||
uses: stefanzweifel/[email protected] | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
commit_message: 'chore(localization): update resources/lang/pcc.pot' | ||
deploy-staging: | ||
needs: test | ||
if: github.ref == 'refs/heads/dev' | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
name: Update POT file | ||
|
||
on: | ||
push: | ||
branches: | ||
- dev | ||
paths: | ||
- '**.php' | ||
- '**.js' | ||
|
||
jobs: | ||
update-pot: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Install xgettext | ||
run: sudo apt-get install -y gettext | ||
- name: Update POT | ||
run: npm run pot | ||
- name: Commit updated POT | ||
uses: stefanzweifel/[email protected] | ||
with: | ||
commit_message: 'chore(localization): update resources/lang/pcc.pot' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<?php namespace App\Controllers\Partials; | ||
|
||
trait Story | ||
{ | ||
|
||
/* | ||
Get an array of regions for a story. Returns false if there are no regions. | ||
*/ | ||
public static function storyRegions() | ||
{ | ||
$terms = get_the_terms(get_the_id(), 'pcc-region'); | ||
if ($terms && ! is_wp_error($terms)) { | ||
foreach ($terms as $term) { | ||
$regions[] = $term->name; | ||
} | ||
return $regions; | ||
} | ||
return false; | ||
} | ||
|
||
/* | ||
Get the organization for a story, otherwise returns false. | ||
*/ | ||
public function storyOrg() | ||
{ | ||
$orgs = get_the_terms(get_the_id(), 'pcc-pcc_story_organization'); | ||
|
||
if ($orgs && ! is_wp_error($orgs)) { | ||
return $orgs[0]; | ||
} | ||
|
||
return false; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
<?php | ||
|
||
namespace App\Controllers; | ||
|
||
use Sober\Controller\Controller; | ||
|
||
class SinglePccProject extends Controller | ||
{ | ||
public static function projectTitle() | ||
{ | ||
global $id, $post; | ||
return SinglePccProject::rootPage($id, $post)->post_title; | ||
} | ||
|
||
public static function rootPage($id, $post) | ||
{ | ||
$root_id = ""; | ||
|
||
if ($post->post_parent) { | ||
$ancestors = get_post_ancestors($id); | ||
$root_id = (!empty($ancestors) ? array_pop($ancestors): $post_id); | ||
} else { | ||
$root_id = $id; | ||
} | ||
return get_post($root_id); | ||
} | ||
|
||
public static function ancestors() | ||
{ | ||
global $id, $post; | ||
$ancestors = array_reverse(get_post_ancestors($id)); | ||
$output = []; | ||
|
||
foreach ($ancestors as $a_id) { | ||
$name = get_the_title($a_id); | ||
$output[$name] = [ | ||
'name' => $name, | ||
'url' => get_permalink($a_id) | ||
]; | ||
} | ||
return $output; | ||
} | ||
|
||
public static function banner() | ||
{ | ||
global $id, $post; | ||
$banner = ""; | ||
|
||
if ($post->post_parent) { | ||
$ancestors = get_post_ancestors($id); | ||
$root_id = (!empty($ancestors) ? array_pop($ancestors): $post_id); | ||
$banner = get_post($root_id)->post_title; | ||
} else { | ||
$title = $post->post_title; | ||
} | ||
|
||
return $title; | ||
} | ||
|
||
public static function menuName() | ||
{ | ||
global $id, $post; | ||
$output = []; | ||
|
||
$root_page = SinglePccProject::rootPage($id, $post); | ||
|
||
$menu_name = get_post_meta($root_page->ID, 'project_menu_name', true); | ||
|
||
return $menu_name; | ||
} | ||
|
||
public static function researchers() | ||
{ | ||
global $id, $wp; | ||
$output = []; | ||
|
||
$project_id = get_post_meta($id, 'pcc_project_id', true); | ||
|
||
$researchers = get_post_meta($project_id, 'pcc_project_researchers', true); | ||
|
||
if ($researchers) { | ||
foreach ($researchers as $researcher_id) { | ||
$name = get_the_title($researcher_id); | ||
$output[ $name ] = [ | ||
'name' => $name, | ||
'short_title' => get_post_meta($researcher_id, 'pcc_person_short_title', true), | ||
'slug' => get_post($researcher_id)->post_name | ||
]; | ||
} | ||
} | ||
|
||
return $output; | ||
} | ||
} |
Oops, something went wrong.