-
Notifications
You must be signed in to change notification settings - Fork 0
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
Styling #29
Styling #29
Changes from all commits
21e6238
08a0a5a
6a3dfea
bdcd6b5
dbd87a1
1bfd5ad
674f33b
6bd11b4
e673aa3
b9d3026
e15e983
ddebe32
b1358f0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -70,6 +70,28 @@ | |
cursor: pointer; | ||
text-decoration: underline; | ||
} | ||
|
||
.comment { | ||
max-width: 1215px; | ||
overflow-wrap: anywhere; | ||
} | ||
.post-subtext { | ||
height:5px; | ||
} | ||
.header-space { | ||
height:10px | ||
} | ||
.page-table { | ||
border:0; | ||
border-collapse: collapse; | ||
} | ||
.page-table td, | ||
.page-table th { | ||
padding: 0; | ||
} | ||
.paginate-spacing { | ||
Comment on lines
+74
to
+92
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would put line breaks between all of these blocks to clean them up. |
||
padding-top: 10px; | ||
} | ||
|
||
|
||
a:link { color:#000000; text-decoration:none; } | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,40 @@ | ||
module CommentsHelper | ||
def render_comment_tree(comment) | ||
content_tag :li do | ||
concat content_tag(:p, comment.text) | ||
concat content_tag(:div, style: "display: flex; align-items: center;") { | ||
safe_concat "Posted by " | ||
safe_concat link_to(comment.user.name, comment.user) | ||
safe_concat " on #{comment.created_at.strftime("%B %d, %Y at %I:%M %p")}" | ||
safe_concat " - Score: " | ||
safe_concat content_tag(:span, comment.score, id: "score-Comment-#{comment.id}") | ||
|
||
safe_concat button_to("Upvote", upvote_article_comment_path(comment.article, comment), method: :post, class: "btn btn-sm upvote-button", data: {votable_type: "Comment", votable_id: comment.id, article_id: comment.article.id}) | ||
safe_concat button_to("Downvote", downvote_article_comment_path(comment.article, comment), method: :post, class: "btn btn-sm downvote-button", data: {votable_type: "Comment", votable_id: comment.id, article_id: comment.article.id}) | ||
content_tag :div do | ||
paulmckissock marked this conversation as resolved.
Show resolved
Hide resolved
|
||
concat content_tag(:table, border: "0", cellpadding: "0", cellspacing: "0") { | ||
paulmckissock marked this conversation as resolved.
Show resolved
Hide resolved
|
||
concat content_tag(:tbody) { | ||
concat content_tag(:tr) { | ||
concat content_tag(:td, valign: "top") { | ||
content_tag(:center) { | ||
concat button_to(upvote_article_comment_path(comment), method: :post, class: "btn btn-sm upvote-button", data: {votable_type: "Comment", votable_id: comment.id, article_id: comment.article.id}) { | ||
content_tag(:i, "", class: "fas fa-arrow-up") | ||
} | ||
concat button_to(downvote_article_comment_path(comment), method: :post, class: "btn btn-sm downvote-button", data: {votable_type: "Comment", votable_id: comment.id, article_id: comment.article.id}) { | ||
content_tag(:i, "", class: "fas fa-arrow-down") | ||
} | ||
} | ||
} | ||
concat content_tag(:td, comment.text) | ||
} | ||
concat content_tag(:tr) { | ||
concat content_tag(:td, "", colspan: "1") | ||
concat content_tag(:td, class: "subtext") { | ||
safe_concat content_tag(:span, "#{comment.score} points", id: "score-Comment-#{comment.id}", class: "score") | ||
concat raw(" ") | ||
safe_concat "by" | ||
concat raw(" ") | ||
safe_concat link_to(comment.user.name, comment.user) | ||
concat raw(" ") | ||
safe_concat content_tag(:span, "on #{comment.created_at.strftime("%B %d, %Y at %I:%M %p")}") | ||
safe_concat " | " | ||
safe_concat link_to(" reply", article_comment_path(comment.article, comment)) | ||
} | ||
} | ||
concat content_tag(:tr, "", class: "post-subtext") | ||
} | ||
} | ||
concat content_tag(:p) { | ||
safe_concat link_to("reply", article_comment_path(comment.article, comment)) | ||
} | ||
|
||
if comment.replies.any? | ||
concat(content_tag(:ul) do | ||
concat(content_tag(:ul, style: "padding-left: 20px;") do | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would replace this with a class instead of the inline styling. |
||
comment.replies.each do |reply| | ||
concat render_comment_tree(reply) | ||
end | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,35 @@ | ||
<h1>New Article</h1> | ||
<tr class="header-space"></tr> | ||
<tr> | ||
<td> | ||
<h1>New Article</h1> | ||
|
||
<%= form_with model: @article do |form| %> | ||
<div> | ||
<div> | ||
<%= form.label :title %> | ||
</div> | ||
<%= form.text_field :title %> | ||
<% @article.errors.full_messages_for(:title).each do |message| %> | ||
<div><%= message %></div> | ||
<% end %> | ||
</div> | ||
<%= form_with model: @article do |form| %> | ||
paulmckissock marked this conversation as resolved.
Show resolved
Hide resolved
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since you made |
||
<div> | ||
<div> | ||
<%= form.label :title %> | ||
</div> | ||
<%= form.text_field :title %> | ||
<% @article.errors.full_messages_for(:title).each do |message| %> | ||
<div><%= message %></div> | ||
<% end %> | ||
</div> | ||
|
||
<div> | ||
<div> | ||
<%= form.label :link %> | ||
<div> | ||
<%= form.label :link %> | ||
</div> | ||
<div> | ||
<%= form.text_area :link %> | ||
</div> | ||
<% @article.errors.full_messages_for(:link).each do |message| %> | ||
<div><%= message %></div> | ||
<% end %> | ||
</div> | ||
|
||
<div> | ||
<%= form.text_area :link %> | ||
<%= form.submit %> | ||
</div> | ||
<% @article.errors.full_messages_for(:link).each do |message| %> | ||
<div><%= message %></div> | ||
<% end %> | ||
</div> | ||
</td> | ||
</tr> | ||
|
||
<div> | ||
<%= form.submit %> | ||
</div> | ||
<% end %> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,54 @@ | ||
<h1><%= @article.title %></h1> | ||
<p><%= link_to @article.link, @article.link %></p> | ||
|
||
<%= form_with(model: [@article, @comment], local: true) do |form| %> | ||
<div class="field"> | ||
<%= form.text_area :text %> | ||
</div> | ||
<div class="actions"> | ||
<%= form.submit %> | ||
</div> | ||
<% end %> | ||
|
||
<h2>Comments</h2> | ||
<ul> | ||
<% @comments.each do |comment| %> | ||
<%= render_comment_tree(comment) %> | ||
<% end %> | ||
</ul> | ||
<tr class="header-space"></tr> | ||
<tr> | ||
<td> | ||
<table class="page-table"> | ||
<tbody> | ||
<tr> | ||
<td> | ||
<center> | ||
<%= button_to upvote_article_path(article), method: :post, class: "btn btn-sm upvote-button", data: { votable_type: 'Article', votable_id: article.id } do %> | ||
<i class="fas fa-arrow-up"></i> | ||
<% end %> | ||
<%= button_to downvote_article_path(article), method: :post, class: "btn btn-sm downvote-button", data: { votable_type: 'Article', votable_id: article.id } do %> | ||
<i class="fas fa-arrow-down"></i> | ||
<% end %> | ||
</center> | ||
</td> | ||
<td class="title"> | ||
<%= link_to article.title, article.link, target: "_blank" %> | ||
</td> | ||
</tr> | ||
<tr> | ||
<td colspan="1"></td> | ||
<td class="subtext"> | ||
<span id="score-Article-<%= article.id %>" class="score"><%= article.score %> points</span> | ||
by <%= link_to article.user.name, user_path(article.user) %> | ||
<span class="age"><%= time_ago_in_words(article.created_at) %> ago</span> | ||
</td> | ||
</tr> | ||
<tr class="header-space"></tr> | ||
<tr> | ||
<td colspan="3"> | ||
<%= form_with(model: [@article, @comment], local: true) do |form| %> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Would also use the helper method here. |
||
<div class="field"> | ||
<%= form.text_area :text %> | ||
</div> | ||
<div class="actions"> | ||
<%= form.submit %> | ||
</div> | ||
<% end %> | ||
</td> | ||
</tr> | ||
<tr> | ||
<td colspan="3"> | ||
<ul style="list-style-type: none; padding-left: 0;"> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Some more inline styling I would replace. |
||
<% @comments.each do |comment| %> | ||
<%= render_comment_tree(comment) %> | ||
<% end %> | ||
</ul> | ||
</td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
</td> | ||
</tr> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,45 @@ | ||
<h1>Comment by <%= link_to comment.user.name, comment.user %></h1> | ||
<p><%= comment.text %></p> | ||
<div style="display: flex; align-items: center;"> | ||
Posted on <%= comment.created_at.strftime("%B %d, %Y at %I:%M %p") %> | ||
- Score: <span id="score-Comment-<%= comment.id %>"><%= comment.score %></span> | ||
<% user_vote = @user_votes[comment.id] %> | ||
<%= button_to "Upvote", upvote_article_comment_path(comment), method: :post, class: "btn btn-sm upvote-button", data: { votable_type: 'Comment', votable_id: comment.id, article_id: comment.article.id } %> | ||
<%= button_to "Downvote", downvote_article_comment_path(comment), method: :post, method: :post, class: "btn btn-sm downvote-button", data: { votable_type: 'Comment', votable_id: comment.id, article_id: comment.article.id } %> | ||
</div> | ||
<h2>Replies</h2> | ||
<ul> | ||
<% comment.replies.each do |reply| %> | ||
<%= render_comment_tree(reply) %> | ||
<% end %> | ||
</ul> | ||
|
||
<h3>Write a Reply</h3> | ||
<%= form_with(model: [comment.article, @reply], local: true) do |form| %> | ||
<div class="field"> | ||
<%= form.text_area :text %> | ||
</div> | ||
<%= form.hidden_field :parent_id, value: comment.id %> | ||
<div class="actions"> | ||
<%= form.submit "Reply" %> | ||
</div> | ||
<% end %> | ||
|
||
<tr class="header-space"></tr> | ||
<tr> | ||
<td> | ||
<table class="page-table"> | ||
<tbody> | ||
<tr> | ||
<td align="right"> | ||
<span ><%= 1 %>.</span> | ||
</td> | ||
<td valign="top"> | ||
<center> | ||
<%= button_to upvote_article_comment_path(comment), method: :post, class: "btn btn-sm upvote-button", data: { votable_type: 'Comment', votable_id: comment.id, article_id: comment.article.id } do %> | ||
<i class="fas fa-arrow-up"></i> | ||
<% end %> | ||
<%= button_to downvote_article_comment_path(comment), method: :post, class: "btn btn-sm downvote-button", data: { votable_type: 'Comment', votable_id: comment.id, article_id: comment.article.id } do %> | ||
<i class="fas fa-arrow-down"></i> | ||
<% end %> | ||
</center> | ||
</td> | ||
<td> | ||
<%= comment.text %> | ||
</td> | ||
</tr> | ||
<tr> | ||
<td colspan="2"></td> | ||
<td class="subtext"> | ||
<span id="score-Comment-<%= comment.id %>"><%= comment.score %> points</span> | ||
by <%= link_to comment.user.name, user_path(comment.user) %> | ||
<span class="age"><%= time_ago_in_words(comment.created_at) %> ago</span> | ||
</td> | ||
</tr> | ||
<tr class="post-subtext"></tr> | ||
</tbody> | ||
</table> | ||
<%= form_with(model: [comment.article, @reply], local: true) do |form| %> | ||
<div class="field"> | ||
<%= form.text_area :text %> | ||
</div> | ||
<%= form.hidden_field :parent_id, value: comment.id %> | ||
<div> | ||
<%= form.submit "Reply" %> | ||
</div> | ||
<% end %> | ||
</td> | ||
</tr> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be tabbed in.