Browse Source

Refactor more.

pull/24/head
Ben Kurtovic 11 years ago
parent
commit
ad9a71a8ef
3 changed files with 12 additions and 21 deletions
  1. +4
    -4
      pages/index.mako
  2. +1
    -2
      pages/settings.mako
  3. +7
    -15
      static/style.css

+ 4
- 4
pages/index.mako View File

@@ -3,16 +3,16 @@
<%namespace module="copyvios.misc" import="urlstrip"/>\ <%namespace module="copyvios.misc" import="urlstrip"/>\
<% query, bot, all_langs, all_projects, page, result = main(environ) %>\ <% query, bot, all_langs, all_projects, page, result = main(environ) %>\
% if query.project and query.lang and query.title and not page: % if query.project and query.lang and query.title and not page:
<div class="red-box">
<div id="info-box" class="red-box">
<p>The given site (project=<b><span class="mono">${query.project | h}</span></b>, language=<b><span class="mono">${query.lang | h}</span></b>) doesn't seem to exist. It may also be closed or private. <a href="//${query.lang | h}.${query.project | h}.org/">Confirm its URL.</a></p> <p>The given site (project=<b><span class="mono">${query.project | h}</span></b>, language=<b><span class="mono">${query.lang | h}</span></b>) doesn't seem to exist. It may also be closed or private. <a href="//${query.lang | h}.${query.project | h}.org/">Confirm its URL.</a></p>
</div> </div>
% elif query.project and query.lang and query.title and page and not result: % elif query.project and query.lang and query.title and page and not result:
<div class="red-box">
<div id="info-box" class="red-box">
<p>The given page doesn't seem to exist: <a href="${page.url}">${page.title | h}</a>.</p> <p>The given page doesn't seem to exist: <a href="${page.url}">${page.title | h}</a>.</p>
</div> </div>
% elif query.project and query.lang and query.title and query.url and page and result == "bad URI": % elif query.project and query.lang and query.title and query.url and page and result == "bad URI":
<% result = None %> <% result = None %>
<div class="red-box">
<div id="info-box" class="red-box">
<p>Unsupported URI scheme: <a href="${query.url | h}">${query.url | h}</a>.</p> <p>Unsupported URI scheme: <a href="${query.url | h}">${query.url | h}</a>.</p>
</div> </div>
% endif % endif
@@ -100,7 +100,7 @@
% if page and result: % if page and result:
<% show_details = "CopyviosShowDetails" in cookies and cookies["CopyviosShowDetails"].value == "True" %> <% show_details = "CopyviosShowDetails" in cookies and cookies["CopyviosShowDetails"].value == "True" %>
<div class="divider"></div> <div class="divider"></div>
<div id="cv-result-${'yes' if result.violation else 'no'}">
<div id="cv-result" class="${'red' if result.violation else 'green'}-box">
% if result.violation: % if result.violation:
<h2 id="cv-result-header"><a href="${page.url}">${page.title | h}</a> is a suspected violation of <a href="${result.url | h}">${result.url | urlstrip, h}</a>.</h2> <h2 id="cv-result-header"><a href="${page.url}">${page.title | h}</a> is a suspected violation of <a href="${result.url | h}">${result.url | urlstrip, h}</a>.</h2>
% else: % else:


+ 1
- 2
pages/settings.mako View File

@@ -3,11 +3,10 @@
<%include file="/support/header.mako" args="environ=environ, cookies=cookies, title='Settings - Earwig\'s Copyvio Detector'"/>\ <%include file="/support/header.mako" args="environ=environ, cookies=cookies, title='Settings - Earwig\'s Copyvio Detector'"/>\
<%! from json import dumps, loads %>\ <%! from json import dumps, loads %>\
% if status: % if status:
<div class="green-box">
<div id="info-box" class="green-box">
<p>${status}</p> <p>${status}</p>
</div> </div>
% endif % endif
<h1>Settings</h1>
<p>This page contains some configurable options for the copyvio detector. Settings are saved as cookies. You can view and delete all cookies generated by this site at the bottom of this page.</p> <p>This page contains some configurable options for the copyvio detector. Settings are saved as cookies. You can view and delete all cookies generated by this site at the bottom of this page.</p>
<form action="${environ['SCRIPT_URL']}" method="post"> <form action="${environ['SCRIPT_URL']}" method="post">
<table> <table>


+ 7
- 15
static/style.css View File

@@ -11,9 +11,8 @@ ul, ol {
line-height: 1.5; line-height: 1.5;
} }


h1, h2, h3, h4, h5, h6 {
margin-top: 0.20em;
margin-bottom: 0.20em;
h2 {
margin-bottom: 0.2em;
} }


div#header { div#header {
@@ -44,18 +43,14 @@ div#footer {
background: #DDDDDD; background: #DDDDDD;
} }


div#cv-result-yes {
padding: 5px 10px 0 10px;
margin: 0 5px 10px 5px;
background-color: #FEE;
border: 1px solid #F77;
div#info-box {
padding: 0 10px 0 10px;
margin: 10px 5px 10px 5px;
} }


div#cv-result-no {
div#cv-result {
padding: 5px 10px 0 10px; padding: 5px 10px 0 10px;
margin: 0 5px 10px 5px; margin: 0 5px 10px 5px;
background-color: #EFE;
border: 1px solid #7F7;
} }


div#cv-result-detail { div#cv-result-detail {
@@ -100,6 +95,7 @@ td#cv-col4 {
} }


h2#cv-result-header { h2#cv-result-header {
margin-top: 0.2em;
margin-bottom: 0; margin-bottom: 0;
} }


@@ -135,15 +131,11 @@ div.divider {
} }


div.green-box { div.green-box {
padding: 0 10px 0 10px;
margin: 0 5px 10px 5px;
background-color: #EFE; background-color: #EFE;
border: 1px solid #7F7; border: 1px solid #7F7;
} }


div.red-box { div.red-box {
padding: 0 10px 0 10px;
margin: 0 5px 10px 5px;
background-color: #FEE; background-color: #FEE;
border: 1px solid #F77; border: 1px solid #F77;
} }


Loading…
Cancel
Save