Factor out <ins>/<del> css from #c-post-versions to .diff-list.
This commit is contained in:
21
app/assets/stylesheets/common/diffs.scss
Normal file
21
app/assets/stylesheets/common/diffs.scss
Normal file
@@ -0,0 +1,21 @@
|
||||
.diff-list {
|
||||
ins, ins a {
|
||||
color: green;
|
||||
text-decoration: none;
|
||||
margin-right: 0.5em;
|
||||
}
|
||||
|
||||
ins.obsolete, ins.obsolete a {
|
||||
color: darkGreen;
|
||||
}
|
||||
|
||||
del, del a {
|
||||
color: red;
|
||||
text-decoration: line-through;
|
||||
margin-right: 0.5em;
|
||||
}
|
||||
|
||||
del.obsolete, del.obsolete a {
|
||||
color: darkRed;
|
||||
}
|
||||
}
|
||||
9
app/assets/stylesheets/specific/post_versions.scss
Normal file
9
app/assets/stylesheets/specific/post_versions.scss
Normal file
@@ -0,0 +1,9 @@
|
||||
@import "../common/000_vars.scss";
|
||||
|
||||
div#c-post-versions {
|
||||
div#a-index {
|
||||
tr.hilite {
|
||||
background: $highlight_color;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -482,30 +482,6 @@ div#c-post-versions, div#c-artist-versions {
|
||||
a {
|
||||
word-wrap: break-word
|
||||
}
|
||||
|
||||
tr.hilite {
|
||||
background: $highlight_color;
|
||||
}
|
||||
|
||||
ins, ins a {
|
||||
color: green;
|
||||
text-decoration: none;
|
||||
margin-right: 0.5em;
|
||||
}
|
||||
|
||||
ins.obsolete, ins.obsolete a {
|
||||
color: darkGreen;
|
||||
}
|
||||
|
||||
del, del a {
|
||||
color: red;
|
||||
text-decoration: line-through;
|
||||
margin-right: 0.5em;
|
||||
}
|
||||
|
||||
del.obsolete, del.obsolete a {
|
||||
color: darkRed;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
module ArtistVersionsHelper
|
||||
def artist_version_other_names_diff(artist_version)
|
||||
diff = artist_version.other_names_diff(artist_version.previous)
|
||||
html = []
|
||||
html = '<span class="diff-list">'
|
||||
|
||||
diff[:added_names].each do |name|
|
||||
prefix = diff[:obsolete_added_names].include?(name) ? '<ins class="obsolete">' : '<ins>'
|
||||
html << prefix + h(name) + '</ins>'
|
||||
@@ -13,12 +14,15 @@ module ArtistVersionsHelper
|
||||
diff[:unchanged_names].each do |name|
|
||||
html << '<span>' + h(name) + '</span>'
|
||||
end
|
||||
return html.join(" ").html_safe
|
||||
|
||||
html << "</span>"
|
||||
return html.html_safe
|
||||
end
|
||||
|
||||
def artist_version_urls_diff(artist_version)
|
||||
diff = artist_version.urls_diff(artist_version.previous)
|
||||
html = []
|
||||
html = '<ul class="diff-list">'
|
||||
|
||||
diff[:added_urls].each do |url|
|
||||
prefix = diff[:obsolete_added_urls].include?(url) ? '<ins class="obsolete">' : '<ins>'
|
||||
html << '<li>' + prefix + h(url) + '</ins></li>'
|
||||
@@ -30,6 +34,8 @@ module ArtistVersionsHelper
|
||||
diff[:unchanged_urls].each do |url|
|
||||
html << '<li><span>' + h(url) + '</span></li>'
|
||||
end
|
||||
return html.join(" ").html_safe
|
||||
|
||||
html << "</ul>"
|
||||
html.html_safe
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
module PostVersionsHelper
|
||||
def post_version_diff(post_version)
|
||||
diff = post_version.diff(post_version.previous)
|
||||
html = []
|
||||
html = '<span class="diff-list">'
|
||||
|
||||
diff[:added_tags].each do |tag|
|
||||
prefix = diff[:obsolete_added_tags].include?(tag) ? '+<ins class="obsolete">' : '<ins>+'
|
||||
html << prefix + link_to(wordbreakify(tag), posts_path(:tags => tag)) + '</ins>'
|
||||
@@ -13,6 +14,8 @@ module PostVersionsHelper
|
||||
diff[:unchanged_tags].each do |tag|
|
||||
html << '<span>' + link_to(wordbreakify(tag), posts_path(:tags => tag)) + '</span>'
|
||||
end
|
||||
return html.join(" ").html_safe
|
||||
|
||||
html << "</span>"
|
||||
html.html_safe
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,12 +1,15 @@
|
||||
module UploadTagsReportHelper
|
||||
def diff_to_current(report)
|
||||
html = []
|
||||
html = '<span class="diff-list">'
|
||||
|
||||
report.added_tags_array.each do |tag|
|
||||
html << '<ins>+' + link_to(wordbreakify(tag), posts_path(:tags => tag)) + '</ins>'
|
||||
end
|
||||
report.removed_tags_array.each do |tag|
|
||||
html << '<del>-' + link_to(wordbreakify(tag), posts_path(:tags => tag)) + '</del>'
|
||||
end
|
||||
return html.join(" ").html_safe
|
||||
|
||||
html << "</span>"
|
||||
html.html_safe
|
||||
end
|
||||
end
|
||||
|
||||
@@ -42,7 +42,7 @@
|
||||
<% end %>
|
||||
<td><%= artist_version.is_active? %></td>
|
||||
<% if artist_version.visible? %>
|
||||
<td><ul><%= artist_version_urls_diff(artist_version) %></ul></td>
|
||||
<td><%= artist_version_urls_diff(artist_version) %></td>
|
||||
<% else %>
|
||||
<td></td>
|
||||
<% end %>
|
||||
|
||||
Reference in New Issue
Block a user