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

ui patch agent show #1326

Merged
merged 17 commits into from
Mar 12, 2016
32 changes: 23 additions & 9 deletions app/views/agents/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -161,17 +161,31 @@
<b>Options:</b>
<pre><%= Utils.pretty_jsonify @agent.options || {} %></pre>
</p>

<p id="memory" data-agent-id="<%= @agent.id %>">
<b>Memory:</b>
<% if @agent.memory.present? %>
<i class="fa fa-spinner fa-pulse spinner"></i>
<i class="fa fa-trash action-icon clear"></i>
<% end %>
<pre class="memory"><%= Utils.pretty_jsonify @agent.memory || {} %></pre>
</p>
<button type="submit" class="btn btn-default" id="target">Reveal Memory</button>
<button type="submit" class="btn btn-default" id="target1">Hide Memory</button>
<div id="memorytoggle" class="hidden">
<p id="memory" data-agent-id="<%= @agent.id %>">
<b>Memory:</b>
<% if @agent.memory.present? %>
<i class="fa fa-spinner fa-pulse spinner"></i>
<i class="fa fa-trash action-icon clear"></i>
<% end %>
<pre class="memory"><%= Utils.pretty_jsonify @agent.memory || {} %></pre>
</p>
</div>
Copy link
Collaborator

Choose a reason for hiding this comment

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

You added one opening div and two closing /divs, I think one of the closing divs needs to be removed.

</div>
</div>
</div>
</div>
</div>


<%= javascript_tag do %>
Copy link
Member

Choose a reason for hiding this comment

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

New code should go in agent-show-page.js.coffee. Can bind it at the top. Also see the jQuery toggle method.

$( "#target" ).click(function() {
$("#memorytoggle").removeClass("hidden");
});

$( "#target1" ).click(function() {
$("#memorytoggle").addClass("hidden");
});
<% end %>