ember-tribe 1.2.13 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -4
- package/blueprints/ember-tribe/files/public/php/_body.php +0 -0
- package/blueprints/ember-tribe/files/public/php/_body_footer.php +0 -0
- package/blueprints/ember-tribe/files/public/php/_head.php +39 -0
- package/blueprints/ember-tribe/files/public/php/_head_footer.php +1 -0
- package/blueprints/ember-tribe/files/public/php/_init.php +25 -0
- package/blueprints/ember-tribe/files/public/robots.txt +3 -0
- package/blueprints/ember-tribe/files/sync-dist.php +58 -0
- package/blueprints/ember-tribe/files/sync-types.php +9 -11
- package/blueprints/ember-tribe/index.js +0 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -8,9 +8,8 @@ Tribe is a project management framework by Postcode - https://github.com/tribe-f
|
|
|
8
8
|
Compatibility
|
|
9
9
|
------------------------------------------------------------------------------
|
|
10
10
|
|
|
11
|
-
* Ember.js
|
|
12
|
-
* Ember CLI
|
|
13
|
-
* Node.js v12 or above
|
|
11
|
+
* Ember.js v5.4 or above
|
|
12
|
+
* Ember CLI v5.4 or above
|
|
14
13
|
|
|
15
14
|
|
|
16
15
|
Installation
|
|
@@ -28,7 +27,15 @@ ember install ember-tribe
|
|
|
28
27
|
```
|
|
29
28
|
php sync-types.php
|
|
30
29
|
```
|
|
31
|
-
|
|
30
|
+
4. To serve front-end webapp from backend server and for using page-wise meta tags
|
|
31
|
+
- On local:
|
|
32
|
+
```
|
|
33
|
+
php sync-dist.php
|
|
34
|
+
```
|
|
35
|
+
- On server:
|
|
36
|
+
```
|
|
37
|
+
bash -c "$(wget --no-cache --no-cookie https://raw.githubusercontent.com/tribe-framework/tribe/master/install/ember.sh -O -)"
|
|
38
|
+
```
|
|
32
39
|
|
|
33
40
|
Usage
|
|
34
41
|
------------------------------------------------------------------------------
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
<?php
|
|
2
|
+
//SEO code and Meta tags
|
|
3
|
+
|
|
4
|
+
$core = new \Tribe\Core;
|
|
5
|
+
$uploads = new \Tribe\Uploads;
|
|
6
|
+
|
|
7
|
+
//Website's title, description, twitter handle and cover image link
|
|
8
|
+
$meta_title = "";
|
|
9
|
+
$meta_description = "";
|
|
10
|
+
$meta_image_url = "";
|
|
11
|
+
$twitter_handle = "";
|
|
12
|
+
|
|
13
|
+
if ($type ?? false && $slug ?? false) {
|
|
14
|
+
$postdata = $core->getObject(array('type'=>$type, 'slug'=>$slug));
|
|
15
|
+
|
|
16
|
+
if ($postdata['title'] ?? false)
|
|
17
|
+
$meta_title = $postdata['title'];
|
|
18
|
+
|
|
19
|
+
if ($postdata['short_description'] ?? false)
|
|
20
|
+
$meta_description = $postdata['short_description'];
|
|
21
|
+
|
|
22
|
+
$meta_image_url = ($uploads->getUploadedImageInSize($postdata['cover_url'], 'md')['url'] ??
|
|
23
|
+
($postdata['cover_url'] ??
|
|
24
|
+
$meta_image_url)
|
|
25
|
+
);
|
|
26
|
+
}
|
|
27
|
+
?>
|
|
28
|
+
|
|
29
|
+
<title><?=$meta_title?></title>
|
|
30
|
+
<meta name="description" content="<?=$meta_description?>">
|
|
31
|
+
|
|
32
|
+
<meta name="twitter:card" content="summary_large_image" />
|
|
33
|
+
<meta name="twitter:site" content="@<?=$twitter_handle?>" />
|
|
34
|
+
<meta name="twitter:creator" content="@<?=$twitter_handle?>" />
|
|
35
|
+
|
|
36
|
+
<meta property="og:title" content="<?=$meta_title?>">
|
|
37
|
+
<meta property="og:description" content="<?=$meta_description?>">
|
|
38
|
+
|
|
39
|
+
<meta property="og:image" content="<?=$meta_image_url?>">
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<!-- analytics code -->
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
<?php
|
|
2
|
+
/*
|
|
3
|
+
|
|
4
|
+
This file provides 4 URL variables for use across the middleware of an Ember app
|
|
5
|
+
|
|
6
|
+
$url = URL of the app
|
|
7
|
+
$type = type
|
|
8
|
+
$slug = slug
|
|
9
|
+
$params = query parameters array
|
|
10
|
+
*/
|
|
11
|
+
require __DIR__ . '/../../../../_init.php';
|
|
12
|
+
|
|
13
|
+
$url_parts = parse_url($_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']);
|
|
14
|
+
|
|
15
|
+
$url_path_parts = explode('/', $url_parts['path']);
|
|
16
|
+
|
|
17
|
+
parse_str(parse_url($_SERVER['REQUEST_URI'], PHP_URL_QUERY), $params);
|
|
18
|
+
|
|
19
|
+
$url = 'https://'
|
|
20
|
+
.$url_parts['host']
|
|
21
|
+
.($url_parts['path'] ?? '');
|
|
22
|
+
|
|
23
|
+
$type = $url_path_parts[1] ?? '';
|
|
24
|
+
$slug = $url_path_parts[2] ?? '';
|
|
25
|
+
?>
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
<?php
|
|
2
|
+
if (file_exists('dist/index.html') !== false) {
|
|
3
|
+
//get html
|
|
4
|
+
$html = file_get_contents('dist/index.html');
|
|
5
|
+
|
|
6
|
+
//replace head, before title
|
|
7
|
+
$html = str_replace('<title>', '<?php include_once("php/_head.php");?><title>', $html);
|
|
8
|
+
|
|
9
|
+
//replace head-footer, before </head> ends
|
|
10
|
+
$html = str_replace('</head>', '<?php include_once("php/_head_footer.php");?></head>', $html);
|
|
11
|
+
|
|
12
|
+
//replace body-footer, before </body> ends
|
|
13
|
+
$html = str_replace('</body>', '<?php include_once("php/_body_footer.php");?></body>', $html);
|
|
14
|
+
|
|
15
|
+
//load dom
|
|
16
|
+
$dom = new DOMDocument();
|
|
17
|
+
$dom->loadHTML($html);
|
|
18
|
+
|
|
19
|
+
//for tags to be removed
|
|
20
|
+
$remove = [];
|
|
21
|
+
|
|
22
|
+
//remove meta description tag
|
|
23
|
+
$metas = $dom->getElementsByTagName('meta');
|
|
24
|
+
for($i=0; $i <$metas-> length; $i++) {
|
|
25
|
+
$name = $metas->item($i)->getAttribute("name");
|
|
26
|
+
if ($name == 'description')
|
|
27
|
+
$remove[] = $metas->item($i);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
//remove title tag
|
|
31
|
+
$titles = $dom->getElementsByTagName('title');
|
|
32
|
+
foreach($titles as $item)
|
|
33
|
+
$remove[] = $item;
|
|
34
|
+
|
|
35
|
+
//remove identified tags
|
|
36
|
+
foreach ($remove as $item)
|
|
37
|
+
$item->parentNode->removeChild($item);
|
|
38
|
+
|
|
39
|
+
//save edit dom html
|
|
40
|
+
$html = $dom->saveHTML();
|
|
41
|
+
|
|
42
|
+
//prepend _init.php for $type and $slug and Tribe composer
|
|
43
|
+
$html = '<?php include_once("php/_init.php");?>'.$html;
|
|
44
|
+
|
|
45
|
+
//save to file
|
|
46
|
+
file_put_contents('dist/index.php', $html);
|
|
47
|
+
|
|
48
|
+
//echo success message on commandline
|
|
49
|
+
echo '~~~~~~~~~~'."\r\n";
|
|
50
|
+
echo `tput setaf 2`.'Middleware successfully installed. Synced "/dist" folder with PHP.'.`tput sgr0`."\r\n";
|
|
51
|
+
echo '~~~~~~~~~~'."\r\n";
|
|
52
|
+
}
|
|
53
|
+
else {
|
|
54
|
+
echo '~~~~~~~~~~'."\r\n";
|
|
55
|
+
echo `tput setaf 1`.'Run "ember build -prod" before syncing with PHP.'.`tput sgr0`."\r\n";
|
|
56
|
+
echo '~~~~~~~~~~'."\r\n";
|
|
57
|
+
}
|
|
58
|
+
?>
|
|
@@ -1,20 +1,18 @@
|
|
|
1
1
|
<?php
|
|
2
2
|
$types = json_decode(file_get_contents('../../config/types.json'), true);
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
$commands = "
|
|
6
|
-
|
|
4
|
+
// re-create models folder
|
|
5
|
+
$commands = "[[ app/models ]] && rm -r app/models && mkdir app/models; ";
|
|
6
|
+
// remove test for models
|
|
7
|
+
$commands .= "[[ -d tests/unit/models ]] && rm -r tests/unit/models; ";
|
|
7
8
|
|
|
8
9
|
foreach (array_keys($types) as $type) {
|
|
10
|
+
if ($type == 'webapp' || in_array($type, ($types['webapp']['interface_urls'][basename(dirname(__FILE__))]['types'] ?? array_keys($types)))) {
|
|
9
11
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
$commands .= "echo \"import Model, { attr } from '@ember-data/model'; export default class ".$type_ucwords."Model extends Model { @attr slug; @attr modules; }\" > app/models/".$type_hyphen.".js; ";
|
|
15
|
-
|
|
16
|
-
}
|
|
12
|
+
$type_hyphen = str_replace('_', '-', $type);
|
|
13
|
+
$type_ucwords = str_replace(' ', '', ucwords(str_replace('_', ' ', $type)));
|
|
14
|
+
$commands .= "echo \"import Model, { attr } from '@ember-data/model'; export default class ".$type_ucwords."Model extends Model { @attr slug; @attr modules; }\" > app/models/".$type_hyphen.".js; ";
|
|
15
|
+
}
|
|
17
16
|
}
|
|
18
17
|
|
|
19
18
|
exec($commands);
|
|
20
|
-
?>
|
|
@@ -12,7 +12,6 @@ module.exports = {
|
|
|
12
12
|
{ name: '@ember/optional-features' },
|
|
13
13
|
{ name: '@ember/render-modifiers' },
|
|
14
14
|
{ name: 'ember-modifier' },
|
|
15
|
-
{ name: 'ember-prop-modifier' },
|
|
16
15
|
{ name: 'ember-composable-helpers' },
|
|
17
16
|
{ name: 'ember-truth-helpers' },
|
|
18
17
|
{ name: 'ember-math-helpers' },
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ember-tribe",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "The default blueprint for using Tribe within EmberJS.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ember-addon"
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"babel-eslint": "^10.1.0",
|
|
39
39
|
"broccoli-asset-rev": "^3.0.0",
|
|
40
40
|
"ember-auto-import": "^2.2.4",
|
|
41
|
-
"ember-cli": "^4.
|
|
41
|
+
"ember-cli": "^5.4.0",
|
|
42
42
|
"ember-cli-dependency-checker": "^3.2.0",
|
|
43
43
|
"ember-cli-inject-live-reload": "^2.1.0",
|
|
44
44
|
"ember-cli-sri": "^2.1.1",
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"ember-page-title": "^7.0.0",
|
|
50
50
|
"ember-qunit": "^5.1.5",
|
|
51
51
|
"ember-resolver": "^8.0.3",
|
|
52
|
-
"ember-source": "^4.
|
|
52
|
+
"ember-source": "^5.4.0",
|
|
53
53
|
"ember-source-channel-url": "^3.0.0",
|
|
54
54
|
"ember-template-lint": "^3.15.0",
|
|
55
55
|
"ember-try": "^2.0.0",
|