Merge pull request #3067 from evazion/fix-3065

Fix #3065: <div> id incorrect for certain controllers
This commit is contained in:
Albert Yi
2017-05-22 12:15:47 -07:00
committed by GitHub
34 changed files with 285 additions and 318 deletions

View 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;
}
}

View File

@@ -0,0 +1,11 @@
div#c-post-events {
#a-index {
tr.resolved-true {
background: #DDD;
}
tr.resolved-false {
background: #FFF;
}
}
}

View File

@@ -0,0 +1,9 @@
@import "../common/000_vars.scss";
div#c-post-versions {
div#a-index {
tr.hilite {
background: $highlight_color;
}
}
}

View File

@@ -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;
}
}
}

View File

@@ -1,6 +1,6 @@
@import "../common/000_vars.scss";
div#terms-of-service {
div#c-static div#a-terms-of-service {
width: 40em;
h1 {

View File

@@ -0,0 +1,56 @@
div#c-user-upgrades {
div#a-new {
max-width: 40em;
font-size: 1.2em;
form.stripe {
display: inline;
}
div.section {
margin-bottom: 2em;
}
div#feature-comparison {
overflow: hidden;
margin-bottom: 1em;
table {
width: 100%;
colgroup {
width: 10em;
}
colgroup#basic {
}
colgroup#gold {
background-color: #FFF380;
}
colgroup#platinum {
background-color: #eee;
}
td, th {
text-align: center;
vertical-align: top;
padding: 0.5em 0;
}
tbody {
tr:hover {
background-color: #FEF;
}
}
p.cost-footnote {
font-size: 80%;
color: gray;
margin: 0;
}
}
}
}
}

View File

@@ -86,59 +86,4 @@ div#c-users {
margin-bottom: 2em;
}
}
div#a-upgrade-information {
max-width: 40em;
font-size: 1.2em;
form.stripe {
display: inline;
}
div.section {
margin-bottom: 2em;
}
div#feature-comparison {
overflow: hidden;
margin-bottom: 1em;
table {
width: 100%;
colgroup {
width: 10em;
}
colgroup#basic {
}
colgroup#gold {
background-color: #FFF380;
}
colgroup#platinum {
background-color: #eee;
}
td, th {
text-align: center;
vertical-align: top;
padding: 0.5em 0;
}
tbody {
tr:hover {
background-color: #FEF;
}
}
p.cost-footnote {
font-size: 80%;
color: gray;
margin: 0;
}
}
}
}
}

View File

@@ -0,0 +1,25 @@
div#c-wiki-page-versions {
#a-diff {
del {
background: #FCC;
text-decoration: none;
}
ins {
background: #CFC;
text-decoration: none;
}
}
#a-index {
table {
margin-bottom: 1em;
}
}
#a-show {
span.version {
color: #AAA;
}
}
}

View File

@@ -1,40 +1,19 @@
div#c-wiki-pages, div#excerpt {
span.version {
color: #AAA;
}
div.notice {
font-size: 0.8em;
padding: 1em;
margin: 1em 0;
}
del {
background: #FCC;
text-decoration: none;
}
ins {
background: #CFC;
text-decoration: none;
}
table {
margin-bottom: 1em;
}
#content {
margin-left: 15em;
padding-left: 1em;
}
.hint {
div#c-wiki-pages {
form span.hint {
display: block;
}
.other-name {
background-color: #EEE;
padding: 3px;
border-radius: 3px;
#a-new {
div.notice {
font-size: 0.8em;
padding: 1em;
margin: 1em 0;
}
}
}
.wiki-other-name {
background-color: #EEE;
padding: 3px;
border-radius: 3px;
}

View File

@@ -1,6 +1,6 @@
class UsersController < ApplicationController
respond_to :html, :xml, :json
before_filter :member_only, :only => [:edit, :update, :upgrade]
before_filter :member_only, :only => [:edit, :update]
skip_before_filter :api_check
def new

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -18,7 +18,7 @@ module WikiPagesHelper
end
def wiki_page_other_names_list(wiki_page)
names_html = wiki_page.other_names_array.map{|name| link_to(name, "http://www.pixiv.net/search.php?s_mode=s_tag_full&word=#{u(name)}", :class => "other-name")}
names_html = wiki_page.other_names_array.map{|name| link_to(name, "http://www.pixiv.net/search.php?s_mode=s_tag_full&word=#{u(name)}", :class => "wiki-other-name")}
names_html.join(" ").html_safe
end
end

View File

@@ -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 %>

View File

@@ -1,5 +1,5 @@
<div class="bans">
<div class="new">
<div class="c-bans">
<div class="a-new">
<h1>New Ban</h1>
<%= render "form", :ban => @ban %>
</div>

View File

@@ -1,5 +1,5 @@
<div id="c-explore-posts">
<div id="a-index">
<div id="a-missed-searches">
<h1>Missed Searches (past seven days)</h1>
<table class="striped" width="100%">

View File

@@ -1,5 +1,5 @@
<div id="c-explore-posts">
<div id="a-index">
<div id="a-popular">
<h1>Popular: <%= @post_set.presenter.range_text %></h1>
<%= @post_set.presenter.nav_links(self) %>
@@ -18,4 +18,4 @@
<% content_for(:html_header) do %>
<meta name="description" content="The most popular posts per day">
<% end %>
<% end %>

View File

@@ -1,5 +1,5 @@
<div id="c-explore-posts">
<div id="a-index">
<div id="a-searches">
<h1>Popular Searches: <%= @search_service.date %> (by <%= @search_service.scale %>)</h1>
<table class="striped" width="100%">

View File

@@ -3,9 +3,13 @@
<h1>IP Addresses</h1>
<% if params[:search][:user_id].present? || params[:search][:user_name].present? %>
<%= render "ip_listing" %>
<div id="p-ip-listing">
<%= render "ip_listing" %>
</div>
<% else %>
<%= render "user_listing" %>
<div id="p-user-listing">
<%= render "user_listing" %>
</div>
<% end %>
</div>
</div>

View File

@@ -1,4 +1,4 @@
<div id="c-pools">
<div id="c-pool-versions">
<div id="a-diff">
<h1>Pool Version Comparison: <%= @pool_version.name %></h1>

View File

@@ -1,4 +1,4 @@
<div id="c-pools">
<div id="c-pool-versions">
<div id="a-index">
<h1>Pool History</h1>

View File

@@ -1,4 +1,4 @@
<div id="c-post-flags">
<div id="c-post-events">
<div id="a-index">
<h1>Flags &amp; Appeals</h1>

View File

@@ -1,5 +1,5 @@
<div id="c-post-versions">
<div id="a-index">
<div id="c-upload-tags-report">
<div id="a-show">
<h1>Upload tag changes report for <%= @user.pretty_name %></h1>
<table class="striped">
<thead>

View File

@@ -1,5 +1,5 @@
<div id="terms-of-service">
<div class="section">
<div id="c-static">
<div id="a-terms-of-service">
<h1>Rules</h1>
<p>Please read the following before using the site:</p>

View File

@@ -1,4 +1,4 @@
<div id="c-users">
<div id="c-user-reverts">
<div id="a-new">
<h1>Revert Changes</h1>

View File

@@ -1,5 +1,5 @@
<div id="c-users">
<div id="a-upgrade-information">
<div id="c-user-upgrades">
<div id="a-new">
<h1>Upgrade Account</h1>
<% unless params[:user_id] %>

View File

@@ -1,5 +1,5 @@
<div id="c-users">
<div id="a-upgrade-result">
<div id="c-user-upgrades">
<div id="a-show">
<% if flash[:success] %>
<h1>Congradulations!</h1>

View File

@@ -1,102 +0,0 @@
<div id="c-users">
<div id="a-upgrade-information">
<h1>Upgrade Your Account</h1>
<p class="copy">Want more searching power? Upgrade your account and become a power user of the best database of anime artwork on the internet.</p>
<div id="feature-comparison">
<table>
<thead>
<tr>
<th></th>
<th>Basic</th>
<th>Gold</th>
<th>Platinum</th>
</tr>
</thead>
<tbody>
<colgroup id="labels"></colgroup>
<colgroup id="basic"></colgroup>
<colgroup id="gold"></colgroup>
<colgroup id="platinum"></colgroup>
<tr>
<td>Cost</td>
<td>Free</td>
<td>$20<p class="cost-footnote">One time fee</p></td>
<td>$40<p class="cost-footnote">One time fee</p></td>
</tr>
<tr>
<td>Tag Limit</td>
<td>2</td>
<td>6</td>
<td>12</td>
</tr>
<tr>
<td>Favorite Limit</td>
<td>10,000</td>
<td>20,000</td>
<td>Unlimited</td>
</tr>
<tr>
<td>Page Limit</td>
<td>1,000</td>
<td>2,000</td>
<td>5,000</td>
</tr>
<% if SavedSearch.enabled? %>
<tr>
<td>Saved Searches</td>
<td>No</td>
<td>Yes</td>
<td>Yes</td>
</tr>
<% end %>
<tr>
<td>See Censored Tags</td>
<td>No</td>
<td>Yes</td>
<td>Yes</td>
</tr>
<tr>
<td>API Hourly Limit</td>
<td>3,000</td>
<td>10,000</td>
<td>20,000</td>
</tr>
<tr>
<td>Database Timeout</td>
<td>3 sec</td>
<td>6 sec</td>
<td>9 sec</td>
</tr>
<tr>
<td>Variable Posts Per Page</td>
<td>No</td>
<td>Yes</td>
<td>Yes</td>
</tr>
<tr>
<td>Name Changes</td>
<td>No</td>
<td>Yes</td>
<td>Yes</td>
</tr>
</tbody>
</table>
</div>
<p><strong>Upgrading from Gold to Platinum will only cost $20.</strong> If you have any further questions or concerns, feel free to contact me at <%= mail_to Danbooru.config.contact_email, nil, :encode => :javascript %>.</p>
<% if CurrentUser.user.level < User::Levels::GOLD %>
<%= stripe_button("Upgrade to Gold", 2000) %>
<%= stripe_button("Upgrade to Platinum", 4000) %>
<% elsif CurrentUser.user.level < User::Levels::PLATINUM %>
<%= stripe_button("Upgrade Gold to Platinum", 2000) %>
<% end %>
</div>
</div>
<%= render "secondary_links" %>
<% content_for(:page_title) do %>
Upgrade - <%= Danbooru.config.app_name %>
<% end %>

View File

@@ -0,0 +1,38 @@
<div id="p-global-listing">
<table width="100%" class="striped">
<thead>
<tr>
<th>Title</th>
<th width="3%">Del</th>
<th width="5%"></th>
<% if CurrentUser.is_moderator? %>
<th width="10%">IP Address</th>
<% end %>
<th width="26%">Last edited</th>
</tr>
</thead>
<tbody>
<% @wiki_page_versions.each do |wiki_page_version| %>
<tr>
<td class="category-<%= wiki_page_version.category_name %>">
<%= link_to wiki_page_version.title, wiki_page_version_path(wiki_page_version) %>
</td>
<td><%= wiki_page_version.is_deleted? ? "Y" : "" %></td>
<td><%= link_to "wiki", wiki_page_path(wiki_page_version.wiki_page_id) %></td>
<% if CurrentUser.is_moderator? %>
<td>
<%= link_to_ip wiki_page_version.updater_ip_addr %>
</td>
<% end %>
<td>
<%= compact_time(wiki_page_version.updated_at) %>
<% if wiki_page_version.updater %>
by
<%= link_to_user wiki_page_version.updater %>
<% end %>
</td>
</tr>
<% end %>
</tbody>
</table>
</div>

View File

@@ -0,0 +1,56 @@
<div id="p-page-listing">
<%= form_tag(diff_wiki_page_versions_path, :method => :get) do %>
<table width="100%" class="striped">
<thead>
<tr>
<th width="3%"></th>
<th width="2%"></th>
<th width="2%"></th>
<th>Title</th>
<th width="3%">Del</th>
<th width="5%"></th>
<% if CurrentUser.is_moderator? %>
<th width="10%">IP Address</th>
<% end %>
<th width="26%">Last edited</th>
</tr>
</thead>
<tbody>
<% @wiki_page_versions.each_with_index do |wiki_page_version, i| %>
<tr>
<td>
<% if i < @wiki_page_versions.length - 1 %>
<%= link_to "diff", diff_wiki_page_versions_path(:otherpage => wiki_page_version.id, :thispage => @wiki_page_versions[i + 1].id) %>
<% else %>
diff
<% end %>
</td>
<td><%= radio_button_tag "thispage", wiki_page_version.id, (i == 1) %></td>
<td><%= radio_button_tag "otherpage", wiki_page_version.id, (i == 0) %></td>
<td class="category-<%= wiki_page_version.category_name %>">
<%= link_to wiki_page_version.title, wiki_page_version_path(wiki_page_version) %>
</td>
<td><%= wiki_page_version.is_deleted? ? "Y" : "" %></td>
<td><%= link_to "wiki", wiki_page_path(wiki_page_version.wiki_page_id) %></td>
<% if CurrentUser.is_moderator? %>
<td>
<%= link_to_ip wiki_page_version.updater_ip_addr %>
</td>
<% end %>
<td>
<%= compact_time(wiki_page_version.updated_at) %>
<% if wiki_page_version.updater %>
by
<%= link_to_user wiki_page_version.updater %>
<% end %>
</td>
</tr>
<% end %>
</tbody>
</table>
<%= submit_tag "Diff" %>
<% end %>
</div>

View File

@@ -1,4 +1,4 @@
<div id="c-wiki-pages">
<div id="c-wiki-page-versions">
<div id="a-diff">
<h1>Wiki Page: <%= @thispage.title %></h1>

View File

@@ -1,77 +1,14 @@
<div id="c-wiki-pages">
<div id="c-wiki-page-versions">
<div id="a-index">
<%= render "wiki_pages/sidebar" %>
<section id="content">
<h1>Wiki Pages</h1>
<%= form_tag(diff_wiki_page_versions_path, :method => :get) do %>
<table width="100%" class="striped">
<thead>
<tr>
<% if params[:search] && params[:search][:wiki_page_id] && @wiki_page_versions.length > 1 %>
<th width="3%"></th>
<th width="2%"></th>
<th width="2%"></th>
<% end %>
<th>Title</th>
<th width="3%">Del</th>
<th width="5%"></th>
<% if CurrentUser.is_moderator? %>
<th width="10%">IP Address</th>
<% end %>
<th width="26%">Last edited</th>
</tr>
</thead>
<tbody>
<% @wiki_page_versions.each_with_index do |wiki_page_version, i| %>
<tr>
<% if params[:search] && params[:search][:wiki_page_id] && @wiki_page_versions.length > 1 %>
<td>
<% if i < @wiki_page_versions.length - 1 %>
<%= link_to "diff", diff_wiki_page_versions_path(:otherpage => wiki_page_version.id, :thispage => @wiki_page_versions[i + 1].id) %>
<% else %>
diff
<% end %>
</td>
<td>
<% if i == 1 %>
<%= radio_button_tag "thispage", wiki_page_version.id, :checked => true %>
<% else %>
<%= radio_button_tag "thispage", wiki_page_version.id %>
<% end %>
</td>
<td>
<% if i == 0 %>
<%= radio_button_tag "otherpage", wiki_page_version.id, :checked => true %>
<% else %>
<%= radio_button_tag "otherpage", wiki_page_version.id %>
<% end %>
</td>
<% end %>
<td class="category-<%= wiki_page_version.category_name %>"><%= link_to wiki_page_version.title, wiki_page_version_path(wiki_page_version) %></td>
<td><%= wiki_page_version.is_deleted? ? "Y" : "" %></td>
<td><%= link_to "wiki", wiki_page_path(wiki_page_version.wiki_page_id) %></td>
<% if CurrentUser.is_moderator? %>
<td>
<%= link_to_ip wiki_page_version.updater_ip_addr %>
</td>
<% end %>
<td>
<%= compact_time(wiki_page_version.updated_at) %>
<% if wiki_page_version.updater %>
by
<%= link_to_user wiki_page_version.updater %>
<% end %>
</td>
</tr>
<% end %>
</tbody>
</table>
<% if params[:search] && params[:search][:wiki_page_id] %>
<%= submit_tag "Diff" %>
<% end %>
<% if params.dig(:search, :wiki_page_id).present? %>
<%= render "page_listing" %>
<% else %>
<%= render "global_listing" %>
<% end %>
<%= numbered_paginator(@wiki_page_versions) %>

View File

@@ -1,4 +1,4 @@
<div id="c-wiki-pages">
<div id="c-wiki-page-versions">
<div id="a-show">
<%= render "wiki_pages/sidebar" %>