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

Custom module fixes #2145

Merged
merged 5 commits into from Jul 4, 2018

Conversation

chrisdicarlo
Copy link

Some fixes for custom modules to handle non-default routes, etc

@@ -32,6 +32,12 @@ public function entity()
$publicId = $this->$field;
}
}
if (! $publicId) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you explain why this change is needed?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's to handle the situation for custom modules where the entityType is different from the pluralized version.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, understood

@@ -125,8 +125,22 @@ public function boot()
return '';
}


if(! Utils::isNinjaProd() && \App::isLocale('en') == false) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And this one...

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Handles fixing a mismatched breadcrumb when the module name is different. The reason it specifically looks for the non-English locales is there is another check at line 142 that handles the English locale using the built-in str_singular function.

That being said, I'm wondering if the issue lies deeper inside the module translation code; I might keep looking a bit at it to see if I can fix the issue more elegantly.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm happy to help try to find a better solution, the purpose of the code is a bit hard to understand.

@hillelcoren
Copy link
Member

Hi, just wanted to follow up.

I'd like to merge the PR but the changes affect code paths used by most requests, I want to make sure I fully understand it.

@chrisdicarlo
Copy link
Author

chrisdicarlo commented Jun 11, 2018 via email

@hillelcoren
Copy link
Member

If you can improve it it'd be great, otherwise if you can separate out the change I'll merge the rest.

@chrisdicarlo
Copy link
Author

chrisdicarlo commented Jul 4, 2018

I modified the AppServiceProvider to check the breadcrumb against a defined 'base-route' entry in the module.json. This way if the module defines the base-route it will correctly resolve the module name for further translation but if not, it will just fallback to the currently defined behaviour. This leverages previous changes added in commit 035ac82.

@hillelcoren hillelcoren merged commit 91db499 into invoiceninja:develop Jul 4, 2018
@chrisdicarlo chrisdicarlo deleted the custom-module-fixes branch July 4, 2018 14:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants