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

Added dashboard standalone page #1429

Merged
merged 4 commits into from
Oct 26, 2016
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
43 changes: 43 additions & 0 deletions caravel/templates/caravel/dashboard_standalone.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<html>
<body>
<div
class="dashboard container-fluid"
data-dashboard="{{ dashboard.json_data }}"
data-css="{{ dashboard.css }}"
data-user="{{ user_id }}"
>
{% include 'caravel/flash_wrapper.html' %}

<!-- Modal -->
<div class="modal fade" id="css_modal" tabindex="-1" role="dialog">
<div class="modal-dialog" role="document">
<div class="modal-content css">
<div class="modal-body">
<textarea id="dash_css" rows="30" cols="60">{{ dashboard.css }}</textarea>
</div>
</div>
</div>
</div>

<div class="title">
<div class="row">
<h1>
<strong>
{{ dashboard.dashboard_title }}
</strong>
</h1>
</div>
</div>

<!-- gridster class used for backwards compatibility -->
<div id="grid-container" class="slice-grid gridster"></div>

</div>
</body>
{% with filename="css-theme" %}
{% include "caravel/partials/_script_tag.html" %}
{% endwith %}
{% with filename="dashboard" %}
{% include "caravel/partials/_script_tag.html" %}
{% endwith %}
</html>
6 changes: 6 additions & 0 deletions caravel/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -1793,6 +1793,12 @@ def dashboard(self, dashboard_id):
def dashboard(**kwargs): # noqa
pass
dashboard(dashboard_id=dash.id)
if request.args.get("standalone") == "true":
return self.render_template(
"caravel/dashboard_standalone.html",
Copy link
Contributor

Choose a reason for hiding this comment

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

do we need to render a new template for the standalone view? or could we add some logic to basic.html where if we are on the dashboard page and the standalone arg is true, don't show the header. we are doing something similar for the standalone viz's afaik.

https://github.com/ascott/caravel/blob/master/caravel/templates/caravel/basic.html#L24-L25

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I saw that we have a separate standalone template for explore view: https://github.com/ascott/caravel/blob/f837733d858643152304469c899c096e31d2bf24/caravel/views.py#L1194

Apart from the header, I also took out the button groups, fav star to limit interactions on dashboard standalone page. We could have if statements in both basic.html and dashboard.html for rendering specific parts based on standalone argument, but I was thinking that having a separate template would be cleaner?

Copy link
Contributor

Choose a reason for hiding this comment

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

i think keeping one template for the dashboard and adding the conditions where needed will be more clear in the long run since we won't have to maintain 2 templates. the conditional for show/hiding the header should work the same way in basic.html for both the slice and dashboard view, so we will probably only need the conditionals in the dashboard template.

dashboard=dash,
user_id=g.user.get_id(),
templates=templates)
dash_edit_perm = check_ownership(dash, raise_if_false=False)
dash_save_perm = \
dash_edit_perm and self.can_access('can_save_dash', 'Caravel')
Expand Down