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

[Feature Request] Add a new_url parameter to render_table macro to direct to a route for creating new records/items #128

Closed
caffeinatedMike opened this issue Apr 28, 2021 · 4 comments · Fixed by #133
Labels

Comments

@caffeinatedMike
Copy link
Contributor

It would be great if the render_table macro had an additional parameter for a link that would lead to the route that creates new records that are shown in the table. I imagine this would be best suited as a button or anchor rendered either in the table header row (maybe inside the "Actions" td?) or next to the table title.

Example usages:

    {{ render_table(
            data,
            titles=titles,
            show_actions=True,
            new_url=url_for('add_account'),
            edit_url=url_for('edit_account', account_id=':primary_key'),
            delete_url=url_for('delete_account', account_id=':primary_key')
     ) }}

Thoughts?

@greyli greyli added the feature label May 18, 2021
@greyli
Copy link
Member

greyli commented May 18, 2021

Yes, it will be useful! I will try to implement it next week (PR is welcome).

@caffeinatedMike
Copy link
Contributor Author

@greyli Awesome, thanks! If I have time toward the tail-end of this week I plan to try helping with a PR to allow custom actions since it's something I'm in need of and noticed it in the list of TODOs in #50 .

I also noticed another item in that list

"Improve the display of table action buttons (the delete icon is not in line with others)."

I was able to easily fix the alignment (or at least improve it) with a single line of css:

td > form > input[type="image"][alt="Delete"] {
    /* Fixes alignment of inline buttons in Actions column of tables */
    vertical-align: middle;
}

Result:
2021-05-18 08_56_32-The Portal Portal

@greyli
Copy link
Member

greyli commented May 29, 2021

Hi @caffeinatedMike, the "new_url" feature was implemented in #133 with 1.6.0, check out the screenshot in that PR.

f I have time toward the tail-end of this week I plan to try helping with a PR to allow custom actions

Feel free to make a PR.

BTW, the delete icon issue was fixed in #132.

@caffeinatedMike
Copy link
Contributor Author

@greyli that's great news! The custom actions addition is at the top of my list for next week.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants