Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Adding model-namespace, columns and action options to Generator #12

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

Merged
yajra merged 6 commits into yajra:master from lk77:master
Apr 20, 2017

Conversation

@lk77
Copy link
Contributor

@lk77 lk77 commented Mar 23, 2017
edited
Loading

Hello,

i've added some options to the DataTable Generator :

  • model-namespace :

allow to overwrite the namespace set in config
implictly enable --model option
usage : --model-namespace="Models\Client"

  • columns :

allow to set custom columns
usage : --columns="id,label,url,address"

  • action :

allow to choose the view to use for column action
usage : --action="client.action"

i've also introduced a way to use a custom datatables.stub.

if something is wrong, tell me and i will correct it.

thanks

yajra reacted with heart emoji
public function query()
{
$query = ModelName::query();
$query = ModelName::select($this->getColumns);
Copy link
Owner

@yajra yajra Mar 28, 2017
edited
Loading

Choose a reason for hiding this comment

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

Missing function call here. I suggest you add a query before select for better IDE support.

$query = ModelName::query()->select($this->getColumns());

return __DIR__ . '/stubs/datatables.stub';
$config = $this->laravel['config'];
return $config->get('datatables.custom_template')
? $config->get('datatables.custom_path') . '/datatables.stub'
Copy link
Owner

Choose a reason for hiding this comment

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

I think we should use the buttons config namespace and maybe set the key to stub for clarity?

return $config->get('datatables-buttons.stub')

return [
['model', null, InputOption::VALUE_NONE, 'Use the provided name as the model.', null],
['action', null, InputOption::VALUE_OPTIONAL, 'Force the use of singular in filename.', null],
['columns', null, InputOption::VALUE_OPTIONAL, 'Use the provided columns.', null],
Copy link
Owner

Choose a reason for hiding this comment

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

Maybe a better description?

Force the use of singular in filename.

to something like:

Path to action column template.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oops, i've totally messed this, it's a copy/paste of an other package, but i've forgotten to change the description

Copy link
Owner

yajra commented Mar 28, 2017

@lk77 as per testing the PR looks good with some minor changes needed. Looking forward to merging this. 👍

Correcting wrong description and wrong query in datatables.stub
Copy link
Contributor Author

lk77 commented Mar 29, 2017

@yajra I've pushed your changes.

'DummyColumns'
];
}

Copy link
Owner

Choose a reason for hiding this comment

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

Excess indent. Please reduce one tab/4 spaces back.

* @return string
*/
protected function parseArray($definition, $delimiter = ',', $indentation = 16)
{
Copy link
Owner

Choose a reason for hiding this comment

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

I think 12 is the proper indention here to have a perfectly aligned columns. $indention = 12

Copy link
Owner

yajra commented Apr 19, 2017

@lk77 works like a charm as per testing. Need some more minor updates for proper code style for the generated code and this should be good to go. Thanks a lot!

Copy link
Contributor Author

lk77 commented Apr 19, 2017

@yajra it's done !

@yajra yajra merged commit 24db1f6 into yajra:master Apr 20, 2017
Copy link
Owner

yajra commented Apr 20, 2017

Released on v1.3.0 🚀 !

BTW, if you can. Please also send a PR for the official docs @ https://github.com/yajra/laravel-datatables-docs. Thanks!

Copy link
Contributor Author

lk77 commented Apr 21, 2017

Ok, it's done. PR #3 on documentation.
Tell me if something is wrong, english is not my first language.

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@yajra yajra yajra approved these changes

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

2 participants

AltStyle によって変換されたページ (->オリジナル) /