Skip to content

Commit 2dc9e22

Browse files
committed
!410 - Add views
1 parent f1a2156 commit 2dc9e22

File tree

2 files changed

+105
-112
lines changed

2 files changed

+105
-112
lines changed

apps/Core/Packages/Devtools/Modules/DevtoolsModules.php

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public function addModule($data)
3535
$moduleMethod = 'get' . ucfirst(substr($data['type'], 0, -1)) . 'ByAppTypeAndRepoAndName';
3636
$module = $this->modules->{$data['type']}->{$moduleMethod}($data['app_type'], $data['repo'], $data['name']);
3737
}
38-
//Need to add more checks. Repo can be as simple as "https://.../" for local, in that case there should be more checks.
38+
3939
if ($module) {
4040
$this->addResponse('Module already exists!', 1);
4141

@@ -47,9 +47,17 @@ public function addModule($data)
4747
$data['installed'] = '1';
4848
$data['updated_by'] = '0';
4949

50+
if ($data['type'] === 'views' && $data['base_view_module_id'] == 0) {
51+
$data['view_modules_version'] = '0.0.0.0';
52+
}
53+
54+
if ($data['apps'] === '') {
55+
$data['apps'] = Json::encode([]);
56+
}
57+
5058
if ($this->modules->{$data['type']}->add($data) &&
51-
$this->updateModuleJson($data) &&
52-
$this->generateNewFiles($data)
59+
$this->updateModuleJson($data)
60+
// $this->generateNewFiles($data)
5361
) {
5462
$this->addResponse('Module added');
5563

@@ -104,12 +112,17 @@ protected function checkTypeAndCategory($data)
104112
if (isset($data['app_type']['data'][0])) {
105113
$data['app_type'] = $data['app_type']['data'][0];
106114
} else if (isset($data['app_type']['newTags'][0])) {
107-
$this->apps->types->add(
108-
[
109-
'app_type' => strtolower($data['app_type']['newTags'][0]),
110-
'name' => $data['app_type']['newTags'][0]
111-
]
112-
);
115+
$appType = $this->apps->types->getFirst('app_type', strtolower($data['app_type']['newTags'][0]));
116+
117+
if (!$appType) {
118+
$this->apps->types->add(
119+
[
120+
'app_type' => strtolower($data['app_type']['newTags'][0]),
121+
'name' => $data['app_type']['newTags'][0]
122+
]
123+
);
124+
}
125+
113126
$data['app_type'] = strtolower($data['app_type']['newTags'][0]);
114127
}
115128
}

apps/Core/Views/Default/view.json

Lines changed: 83 additions & 103 deletions
Original file line numberDiff line numberDiff line change
@@ -1,105 +1,85 @@
1-
21
{
3-
"name" : "Default",
4-
"display_name" : "Bazaari Core Default View",
5-
"description" : "Default Core View",
6-
"module_type" : "views",
7-
"app_type" : "core",
8-
"category" : "tools",
9-
"version" : "0.0.0",
10-
"repo" : "https://.../",
11-
"dependencies" :
12-
{
13-
"core" :
14-
{
15-
"name" : "Core",
16-
"version" : "0.0.0",
17-
"repo" : "https://.../"
18-
},
19-
"components" : [],
20-
"packages" :
21-
[
22-
{
23-
"name" : "Adminltetags",
24-
"version" : "0.0.0",
25-
"repo" : "https://.../"
26-
}
27-
],
28-
"middlewares" : [],
29-
"views" : [],
30-
"external" : []
31-
},
32-
"settings" :
33-
{
34-
"mandatory" : true,
35-
"layouts" :
36-
[
37-
{
38-
"view" : "default",
39-
"name" : "Default"
40-
},
41-
42-
{
43-
"view" : "topnav",
44-
"name" : "Top Navigation",
45-
"active" : true
46-
},
47-
48-
{
49-
"view" : "topnavsidebar",
50-
"name" : "Top Navigation With Sidebar"
51-
}
52-
],
53-
"tags" : "Adminltetags",
54-
"head" :
55-
{
56-
"title" : "Bazaari Core",
57-
"meta" :
58-
{
59-
"charset" : "UTF-8",
60-
"viewport" : "width=device-width, initial-scale=1, shrink-to-fit=no",
61-
"description" : "Bazaari Core Views",
62-
"author" : "guru@bazaari.com.au",
63-
"keywords" : "HTML, CSS, JavaScript"
64-
},
65-
"link" :
66-
{
67-
"href" :
68-
[
69-
"core/default/css/plugins.css",
70-
"core/default/css/core.css"
71-
]
72-
},
73-
"script" :
74-
{
75-
"src" :
76-
[
77-
"core/default/js/header/jsHeaderDependencies.js",
78-
"core/default/js/header/jsHeaderCore.js",
79-
"core/default/js/header/jsHeaderPlugins.js"
80-
]
81-
}
82-
},
83-
"body" :
84-
{
85-
"jsscript" : ""
86-
},
87-
"footer" :
88-
{
89-
"script" :
90-
{
91-
"src" :
92-
[
93-
"core/default/js/footer/jsFooterDependencies.js"
94-
]
95-
},
96-
"jsscript" : "",
97-
"copyright" :
98-
{
99-
"fromYear" : "2014",
100-
"site" : "https://www.bazaari.com.au",
101-
"name" : "Bazaari E Trade Pty. Ltd."
102-
}
103-
}
104-
}
2+
"name" : "Default",
3+
"display_name" : "Bazaari Core Default View",
4+
"description" : "Default Core View",
5+
"module_type" : "views",
6+
"app_type" : "core",
7+
"category" : "tools",
8+
"version" : "0.0.0",
9+
"repo" : "https://.../",
10+
"dependencies" : {
11+
"core" : {
12+
"name" : "Core",
13+
"version" : "0.0.0",
14+
"repo" : "https://.../"
15+
},
16+
"components" : [],
17+
"packages" : [
18+
{
19+
"name": "Adminltetags",
20+
"version": "0.0.0",
21+
"repo": "https://.../"
22+
}
23+
],
24+
"middlewares" : [],
25+
"views" : []
26+
},
27+
"settings" : {
28+
"mandatory" : true,
29+
"layouts" : [
30+
{
31+
"view" : "default",
32+
"name" : "Default"
33+
},
34+
{
35+
"view" : "topnav",
36+
"name" : "Top Navigation",
37+
"active" : true
38+
},
39+
{
40+
"view" : "topnavsidebar",
41+
"name" : "Top Navigation With Sidebar"
42+
}
43+
],
44+
"tags" : "Adminltetags",
45+
"head" : {
46+
"title" : "Bazaari Core",
47+
"meta" : {
48+
"charset" : "UTF-8",
49+
"viewport" : "width=device-width, initial-scale=1, shrink-to-fit=no",
50+
"description" : "Bazaari Core Views",
51+
"author" : "guru@bazaari.com.au",
52+
"keywords" : "HTML, CSS, JavaScript"
53+
},
54+
"link" : {
55+
"href" : [
56+
"core/default/css/plugins.css",
57+
"core/default/css/core.css"
58+
]
59+
},
60+
"script" : {
61+
"src" : [
62+
"core/default/js/header/jsHeaderDependencies.js",
63+
"core/default/js/header/jsHeaderCore.js",
64+
"core/default/js/header/jsHeaderPlugins.js"
65+
]
66+
}
67+
},
68+
"body" : {
69+
"jsscript" : ""
70+
},
71+
"footer" : {
72+
"script" : {
73+
"src" : [
74+
"core/default/js/footer/jsFooterDependencies.js"
75+
]
76+
},
77+
"jsscript" : "",
78+
"copyright" : {
79+
"fromYear" : "2014",
80+
"site" : "https://www.bazaari.com.au",
81+
"name" : "Bazaari E Trade Pty. Ltd."
82+
}
83+
}
84+
}
10585
}

0 commit comments

Comments
 (0)