Skip to content

Commit

Permalink
Refactor question card (#9922)
Browse files Browse the repository at this point in the history
* refactor question card

* fixed typo

* fixed some of the failing tests
  • Loading branch information
Manasa2850 committed Jul 30, 2021
1 parent 9ab6f34 commit 4b835cf
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
10 changes: 10 additions & 0 deletions app/views/notes/_card.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,16 @@
</span>
<% elsif node.type == 'page' %>
Wiki page by <%= node.revisions.collect(&:uid).uniq.length %> people
<% elsif node.type == 'question' %>
<div class="card bg-white rounded<% if node.status == 4 %> moderated<% end %>">
<div class="card-header">
<%= render partial: 'dashboard/node_moderate', locals: { node: node } %>
<h4><a <% if @widget %>target="_blank"<% end %> href="<%= node.path(:question) %>"><%= node.title %></a></h4>
</div>
<div class="card-footer">
<p class="meta"><%= render partial: "dashboard/node_meta", locals: { node: node } %></p>
</div>
</div>
<% end %>
</p>
</div>
Expand Down
10 changes: 1 addition & 9 deletions app/views/questions/_questions.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,7 @@
<div class="card-view questions-page row">
<% questions.each_with_index do |node,i| %>
<div class="<% if @widget %>col-xs-4 col-sm-4 col-md-4 <% end %>col-lg-4" style="margin-top:20px;">
<div class="card bg-white rounded<% if node.status == 4 %> moderated<% end %>">
<div class="card-header">
<%= render partial: 'dashboard/node_moderate', locals: { node: node } %>
<h4><a <% if @widget %>target="_blank"<% end %> href="<%= node.path(:question) %>"><%= node.title %></a></h4>
</div>
<div class="card-footer">
<p class="meta"><%= render partial: "dashboard/node_meta", locals: { node: node } %></p>
</div>
</div>
<%= render partial: 'notes/card', locals: { node: node, i: i, tagname: @tagname } %>
</div>
<% unless @widget %><hr class="d-lg-none" /><% end %>
Expand Down

0 comments on commit 4b835cf

Please sign in to comment.