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

Remove "Show More" button from tables #10891

Merged
merged 8 commits into from
Apr 12, 2022
Merged
Changes from 5 commits
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
27 changes: 3 additions & 24 deletions app/views/grids/_notes.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -67,14 +67,6 @@
<% end %>
</tr>
<% end %>
<% if nodes.count > 10 %>
<tfoot>
<th class="show-all" id="notes-table-footer" style="min-width: 110px;"><a style="cursor: pointer;">Show more <b class="caret"></b></a></th>
<th></th>
<th></th>
<th></th>
</tfoot>
<% end %>
</table>
</div>

Expand All @@ -87,31 +79,18 @@
<p><i>Activities should include a materials list, costs and a step-by-step guide to construction with photos. Learn what <a href="https://publiclab.org/notes/warren/09-17-2016/what-makes-a-good-activity">makes a good activity here</a>.</i>
</p>
<% end %>

<script>
(function(){
$(".<%= className %>-<%= randomSeed %> .show-all a").click(function(event) {
var cName = ".<%= className %>-<%= randomSeed %>";
var sName = cName + " tr.extra";
$(sName).toggleClass("hide");
if ($(sName)[0].classList.contains("hide"))
var hiding = true;
var myElement = event.target;
if (event.target.classList.contains("caret"))
myElement = event.target.parentElement;
if (!hiding)
myElement.innerHTML = 'Show less <b class="caret" style = "transform: rotate(180deg);"></b>';
else
myElement.innerHTML = 'Show more <b class="caret"></b>';
});
//setupGridSorters(".<%= className %>-<%= randomSeed %>"); Should order the items by time. Commented out because it reorders the items each time show more/less is clicked
TildaDares marked this conversation as resolved.
Show resolved Hide resolved
})()
</script>

<style>
th {
position: sticky;
top: 0;
z-index: 5;
z-index: 3;
Copy link
Member

Choose a reason for hiding this comment

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

@Yavnikaa We don't need this change.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated that.
As per your previous comment, I figured out that I need to change the file test/unit/node_shared_test.rb , and replace 5 by 3. But I don't understand how did removing show more bring about these tests failing. Can you help me with this, and am I doing it right as per the error log in the comment?

Copy link
Member

Choose a reason for hiding this comment

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

But I don't understand how did removing show more bring about these tests failing.

All those tests that are failing count the number of a specific class name in the code. When you removed the JavaScript code, some of those classes were also removed. That's why we have to update the number from 5 to 3.

background: #fff;
}
</style>
Expand Down