8000 Form Debugger JavaScript improvements by wouterj · Pull Request #9857 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

Form Debugger JavaScript improvements #9857

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

Closed
wants to merge 16 commits into from
Closed
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
Prev Previous commit
Next Next commit
Added error badge
  • Loading branch information
wouterj committed Dec 29, 2013
commit f21dab223db91a16568f9807f7406587b9018bc5
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,22 @@
.hidden {
display: none;
}
.btn-toggle {
cursor: pointer;
}
.badge-error {
float: right;
background: #a33;
color: #fff;
padding: 1px 4px;
font-size: 10px;
vertical-align: middle;
border-radius: 6px;
}
.table-error th {
background: #a33;
color: #fff;
}
</style>

{% if collector.data.forms|length %}
Expand Down Expand Up @@ -142,20 +158,8 @@
};

this.toggle = function (element) {
var r;

if (element.style.display !== 'none') {
// this.collapse(element);

r = 'collapse';
} else {
// this.expand(element);
}

var imgs = element.parentElement.getElementsByTagName('img');
Sfjs.toggle(element, imgs[0], imgs[1]);

return r || 'expand';
}
}

Expand All @@ -168,11 +172,7 @@
var buttons = tree.querySelectorAll('.toggle-button');
for (var j = 0, l = buttons.length; j < l; j++) {
Copy link
Contributor

Choose a reason for hiding this comment

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

same question here

buttons[j].addEventListener('click', function (e) {
if ('collapse' === treeView.toggle(this.parentElement.parentElement.querySelector('ul'))) {
this.textContent = '+';
} else {
this.textContent = '-';
}
treeView.toggle(this.parentElement.parentElement.querySelector('ul'));
}, false);
}

Expand Down Expand Up @@ -266,6 +266,9 @@
<img class="toggle-button" src="{{ asset('bundles/framework/images/blue_picto_full.gif') }}">
{% endif %}
{{ name }}
{% if data.errors is defined and data.errors|length > 0 %}
<div class="badge-error">{{ data.errors|length }}</div>
{% endif %}
</div>

{% if data.children is not empty %}
Expand All @@ -290,7 +293,7 @@
{% if data.errors is defined and data.errors|length > 0 %}
<h3>Errors</h3>

<table>
<table class="table-error">
<tr>
<th width="50%">Message</th>
<th>Cause</th>
Expand All @@ -306,11 +309,11 @@

{% if data.default_data is defined %}
<h3>
<a onclick="toggle('{{ data.id }}', 'default_data')">
Default Data
<a class="btn-toggle" onclick="toggle('{{ data.id }}', 'default_data')">
<img style="display:none" id="{{ data.id }}-default_data-open" src="{{ asset('bundles/framework/images/blue_picto_more.gif') }}">
<img style="display:inline" id="{{ data.id }}-default_data-close" src="{{ asset('bundles/framework/images/blue_picto_less.gif') }}">
</a>
Default Data
</h3>

<div id="{{ data.id }}-default_data">
Expand Down Expand Up @@ -345,11 +348,11 @@

{% if data.submitted_data is defined %}
<h3>
<a onclick="toggle('{{ data.id }}', 'submitted_data')">
Submitted Data
<a class="btn-toggle" onclick="toggle('{{ data.id }}', 'submitted_data')">
<img style="display:none" id="{{ data.id }}-submitted_data-open" src="{{ asset('bundles/framework/images/blue_picto_more.gif') }}">
<img style="display:inline" id="{{ data.id }}-submitted_data-close" src="{{ asset('bundles/framework/images/blue_picto_less.gif') }}">
</a>
Submitted Data
</h3>

<div id="{{ data.id }}-submitted_data">
Expand Down Expand Up @@ -388,11 +391,11 @@

{% if data.passed_options is defined %}
<h3>
<a onclick="toggle('{{ data.id }}', 'passed_options')">
Passed Options
<a class="btn-toggle" onclick="toggle('{{ data.id }}', 'passed_options')">
<img style="display:none" id="{{ data.id }}-passed_options-open" src="{{ asset('bundles/framework/images/blue_picto_more.gif') }}">
<img style="display:inline" id="{{ data.id }}-passed_options-close" src="{{ asset('bundles/framework/images/blue_picto_less.gif') }}">
</a>
Passed Options
</h3>

<div id="{{ data.id }}-passed_options">
Expand Down Expand Up @@ -425,11 +428,11 @@

{% if data.resolved_options is defined %}
<h3>
<a onclick="toggle('{{ data.id }}', 'resolved_options')">
Resolved Options
<a class="btn-toggle" onclick="toggle('{{ data.id }}', 'resolved_options')">
<img style="display:inline" id="{{ data.id }}-resolved_options-open" src="{{ asset('bundles/framework/images/blue_picto_more.gif') }}">
<img style="display:none" id="{{ data.id }}-resolved_options-close" src="{{ asset('bundles/framework/images/blue_picto_less.gif') }}">
</a>
Resolved Options
</h3>

<div id="{{ data.id }}-resolved_options" style="display:none">
Expand All @@ -450,11 +453,11 @@

{% if data.view_vars is defined %}
<h3>
<a onclick="toggle('{{ data.id }}', 'view_vars')">
View Variables
<a class="btn-toggle" onclick="toggle('{{ data.id }}', 'view_vars')">
<img style="display:inline" id="{{ data.id }}-view_vars-open" src="{{ asset('bundles/framework/images/blue_picto_more.gif') }}">
<img style="display:none" id="{{ data.id }}-view_vars-close" src="{{ asset('bundles/framework/images/blue_picto_less.gif') }}">
</a>
View Variables
</h3>

<div id="{{ data.id }}-view_vars" style="display:none">
Expand Down
0