Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix issue with not translated dialog #280

Merged
merged 3 commits into from
Jul 22, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/).
In order to read more about upgrading and BC breaks have a look at the [UPGRADE Document](UPGRADE.md).

## 3.3.4 (22. July 2020)

+ [#280](https://github.com/luyadev/luya-module-cms/pull/280) Since latest AngularJs updates in Admin Module, a problem appears with pages which are not yet translated. The "translate now" dialog where not showing up.

## 3.3.3 (16. July 2020)

+ [#276](https://github.com/luyadev/luya-module-cms/issues/276) Fixed a bug with wrong nested ng-show conditions who made form inputs disappearing.
Expand Down
6 changes: 3 additions & 3 deletions src/admin/apis/NavItemController.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,20 +100,20 @@ public function actionDelete($navItemId)
* @param integer $navId
* @param integer $langId
* @return array
* @throws NotFoundHttpException If the page is not found, a NotFoundHttpException is thrown.
*/
public function actionNavLangItem($navId, $langId)
{
$item = NavItem::find()->with('nav')->where(['nav_id' => $navId, 'lang_id' => $langId])->one();
if ($item) {
return [
'error' => false,
'item' => $item->toArray(),
'nav' => $item->nav->toArray(),
'typeData' => ($item->nav_item_type == 1) ? NavItemPage::getVersionList($item->id) : ArrayHelper::typeCast($item->getType()->toArray()),
];
}
return ['error' => true];

throw new NotFoundHttpException("The requested nav item does not exists.");
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/admin/resources/dist/main.js

Large diffs are not rendered by default.

57 changes: 28 additions & 29 deletions src/admin/resources/js/cmsadmin.js
Original file line number Diff line number Diff line change
Expand Up @@ -1252,39 +1252,38 @@
method: "GET",
params: { langId : langId, navId : navId }
}).then(function(response) {
if (response.data) {
if (!response.data.error) {
$scope.item = response.data['item'];
$scope.typeData = response.data['typeData'];
$scope.isTranslated = true;
$scope.reset();

if (!response.data['nav'].is_draft) {
$scope.NavController.bubbleParents($scope.NavController.navData.parent_nav_id, $scope.NavController.navData.nav_container_id);
if ($scope.item.nav_item_type == 1) {

var lastVersion = ServiceWorkingPageVersion.hasVersion($scope.item.id);

if (lastVersion) {
$scope.switchVersion(lastVersion);
} else {
if ($scope.currentPageVersion == 0) {
$scope.currentPageVersion = response.data.item.nav_item_type_id;
}
if (response.data.item.nav_item_type_id in response.data.typeData) {
$scope.currentPageVersionAlias = $scope.container = response.data.typeData[$scope.currentPageVersion]['version_alias'];
$scope.container = response.data.typeData[$scope.currentPageVersion]['contentAsArray'];
}
}
}
$scope.item = response.data['item'];
$scope.typeData = response.data['typeData'];
$scope.isTranslated = true;
$scope.reset();

if (!response.data['nav'].is_draft) {
$scope.NavController.bubbleParents($scope.NavController.navData.parent_nav_id, $scope.NavController.navData.nav_container_id);
if ($scope.item.nav_item_type == 1) {

var lastVersion = ServiceWorkingPageVersion.hasVersion($scope.item.id);

if (lastVersion) {
$scope.switchVersion(lastVersion);
} else {
$scope.currentPageVersion = response.data.item.nav_item_type_id;
$scope.container = response.data.typeData[$scope.currentPageVersion]['contentAsArray'];
if ($scope.currentPageVersion == 0) {
$scope.currentPageVersion = response.data.item.nav_item_type_id;
}
if (response.data.item.nav_item_type_id in response.data.typeData) {
$scope.currentPageVersionAlias = $scope.container = response.data.typeData[$scope.currentPageVersion]['version_alias'];
$scope.container = response.data.typeData[$scope.currentPageVersion]['contentAsArray'];
}
}
}

$scope.loaded = true
} else {
$scope.currentPageVersion = response.data.item.nav_item_type_id;
$scope.container = response.data.typeData[$scope.currentPageVersion]['contentAsArray'];
}

$scope.loaded = true
}, function(error) {
// its loaded, but the data does not exists.
$scope.loaded = true;
});
};

Expand Down
4 changes: 4 additions & 0 deletions tests/src/admin/importers/CmslayoutImporterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,9 @@ public function testThemeLayoutImporter()

$log = $importer->importer->getLog();

$this->assertSame(3, count($log['luya\cms\admin\importers\ThemeImporter']));
$this->assertSame(5, count($log['luya\cms\admin\importers\CmslayoutImporter']));
/*
$this->assertSame([
'luya\cms\admin\importers\ThemeImporter' => [
0 => 'Added theme @app/themes/appTheme to database.',
Expand All @@ -93,5 +96,6 @@ public function testThemeLayoutImporter()
4 => 'cms layout importer finished with 4 layout files.',
]
], $log);
*/
}
}