Skip to content

Commit

Permalink
Merge "Branding: Detail Actions need Context"
Browse files Browse the repository at this point in the history
  • Loading branch information
Jenkins authored and openstack-gerrit committed Jul 30, 2016
2 parents c5cc56d + c1ff33a commit 5943123
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
7 changes: 3 additions & 4 deletions horizon/tables/base.py
Expand Up @@ -711,7 +711,7 @@ def get_data(self, datum, column, row):
form_field_attributes)
table._data_cache[column][table.get_object_id(datum)] = data
elif column.auto == "actions":
data = table.render_row_actions(datum, pull_right=False)
data = table.render_row_actions(datum)
table._data_cache[column][table.get_object_id(datum)] = data
else:
data = column.get_data(datum)
Expand Down Expand Up @@ -1454,7 +1454,7 @@ def render_table_actions(self):
self.set_multiselect_column_visibility(len(bound_actions) > 0)
return table_actions_template.render(context)

def render_row_actions(self, datum, pull_right=True, row=False):
def render_row_actions(self, datum, row=False):
"""Renders the actions specified in ``Meta.row_actions`` using the
current row data. If `row` is True, the actions are rendered in a row
of buttons. Otherwise they are rendered in a dropdown box.
Expand All @@ -1467,8 +1467,7 @@ def render_row_actions(self, datum, pull_right=True, row=False):
row_actions_template = template.loader.get_template(template_path)
bound_actions = self.get_row_actions(datum)
extra_context = {"row_actions": bound_actions,
"row_id": self.get_object_id(datum),
"pull_right": pull_right}
"row_id": self.get_object_id(datum)}
context = template.RequestContext(self.request, extra_context)
return row_actions_template.render(context)

Expand Down
Expand Up @@ -5,7 +5,7 @@
{% if row_actions|length == 1 %}
{% include "horizon/common/_data_table_action.html" with action=row_actions.0 is_single=1 %}
{% elif row_actions|length > 1 %}
<div class="btn-group {% if pull_right %}pull-right{% endif %}">
<div class="btn-group">
{% for action in row_actions %}
{% if forloop.first %}
{% include "horizon/common/_data_table_action.html" with is_small=1 is_single=1 %}
Expand Down
8 changes: 4 additions & 4 deletions horizon/templates/horizon/common/_detail_header.html
@@ -1,12 +1,12 @@
<div class='page-header'>
<div class='page-header detail-header'>
<div class="row">
<div class="col-xs-12 col-sm-9 text-left">
<div class="detail-title col-xs-12 col-sm-9">
<span class="h1">{{ page_title }}</span>
</div>

<div class="col-xs-12 col-sm-3 text-right">
<div class="detail-actions col-xs-12 col-sm-3 text-right">
{% if actions %}
<form class='actions_column' action='{{ url }}' method="POST">
<form class='detail-actions-form actions_column' action='{{ url }}' method="POST">
{% csrf_token %}
{{ actions }}
</form>
Expand Down

0 comments on commit 5943123

Please sign in to comment.