Commit fd8b642d authored by Ozzieisaacs's avatar Ozzieisaacs

Code cosmetics css

Code cosmetics js
Fixes for links with remote_login
parent d5ed5cd6
...@@ -41,6 +41,7 @@ from cps.shelf import shelf ...@@ -41,6 +41,7 @@ from cps.shelf import shelf
from cps.admin import admi from cps.admin import admi
from cps.gdrive import gdrive from cps.gdrive import gdrive
from cps.editbooks import editbook from cps.editbooks import editbook
from cps.remotelogin import remotelogin
from cps.error_handler import init_errorhandler from cps.error_handler import init_errorhandler
try: try:
...@@ -68,6 +69,7 @@ def main(): ...@@ -68,6 +69,7 @@ def main():
app.register_blueprint(about) app.register_blueprint(about)
app.register_blueprint(shelf) app.register_blueprint(shelf)
app.register_blueprint(admi) app.register_blueprint(admi)
app.register_blueprint(remotelogin)
# if config.config_use_google_drive: # if config.config_use_google_drive:
app.register_blueprint(gdrive) app.register_blueprint(gdrive)
app.register_blueprint(editbook) app.register_blueprint(editbook)
......
...@@ -26,6 +26,7 @@ from datetime import datetime ...@@ -26,6 +26,7 @@ from datetime import datetime
from flask import Blueprint, request, make_response, abort, url_for, flash, redirect from flask import Blueprint, request, make_response, abort, url_for, flash, redirect
from flask_login import login_required, current_user, login_user from flask_login import login_required, current_user, login_user
from flask_babel import gettext as _ from flask_babel import gettext as _
from sqlalchemy.sql.expression import true
from . import config, logger, ub from . import config, logger, ub
from .render_template import render_title_template from .render_template import render_title_template
...@@ -60,7 +61,7 @@ def remote_login(): ...@@ -60,7 +61,7 @@ def remote_login():
ub.session.add(auth_token) ub.session.add(auth_token)
ub.session.commit() ub.session.commit()
verify_url = url_for('web.verify_token', token=auth_token.auth_token, _external=true) verify_url = url_for('remotelogin.verify_token', token=auth_token.auth_token, _external=true)
log.debug(u"Remot Login request with token: %s", auth_token.auth_token) log.debug(u"Remot Login request with token: %s", auth_token.auth_token)
return render_title_template('remote_login.html', title=_(u"login"), token=auth_token.auth_token, return render_title_template('remote_login.html', title=_(u"login"), token=auth_token.auth_token,
verify_url=verify_url, page="remotelogin") verify_url=verify_url, page="remotelogin")
......
This diff is collapsed.
...@@ -25,10 +25,9 @@ body { ...@@ -25,10 +25,9 @@ body {
overflow: hidden; overflow: hidden;
-webkit-transition: -webkit-transform 0.4s, width 0.2s; -webkit-transition: -webkit-transform 0.4s, width 0.2s;
-moz-transition: -webkit-transform 0.4s, width 0.2s; -moz-transition: -webkit-transform 0.4s, width 0.2s;
-ms-transition: -webkit-transform 0.4s, width 0.2s; transition: -webkit-transform 0.4s, width 0.2s;
-moz-box-shadow: inset 0 0 50px rgba(0, 0, 0, 0.1); -moz-box-shadow: inset 0 0 50px rgba(0, 0, 0, 0.1);
-webkit-box-shadow: inset 0 0 50px rgba(0, 0, 0, 0.1); -webkit-box-shadow: inset 0 0 50px rgba(0, 0, 0, 0.1);
-ms-box-shadow: inset 0 0 50px rgba(0, 0, 0, 0.1);
box-shadow: inset 0 0 50px rgba(0, 0, 0, 0.1); box-shadow: inset 0 0 50px rgba(0, 0, 0, 0.1);
} }
...@@ -45,7 +44,7 @@ body { ...@@ -45,7 +44,7 @@ body {
text-align: center; text-align: center;
-webkit-transition: opacity 0.5s; -webkit-transition: opacity 0.5s;
-moz-transition: opacity 0.5s; -moz-transition: opacity 0.5s;
-ms-transition: opacity 0.5s; transition: opacity 0.5s;
z-index: 10; z-index: 10;
} }
...@@ -79,7 +78,6 @@ body { ...@@ -79,7 +78,6 @@ body {
color: rgba(0, 0, 0, 0.6); color: rgba(0, 0, 0, 0.6);
-moz-box-shadow: inset 0 0 6px rgba(155, 155, 155, 0.8); -moz-box-shadow: inset 0 0 6px rgba(155, 155, 155, 0.8);
-webkit-box-shadow: inset 0 0 6px rgba(155, 155, 155, 0.8); -webkit-box-shadow: inset 0 0 6px rgba(155, 155, 155, 0.8);
-ms-box-shadow: inset 0 0 6px rgba(155, 155, 155, 0.8);
box-shadow: inset 0 0 6px rgba(155, 155, 155, 0.8); box-shadow: inset 0 0 6px rgba(155, 155, 155, 0.8);
} }
...@@ -121,7 +119,6 @@ body { ...@@ -121,7 +119,6 @@ body {
font-weight: bold; font-weight: bold;
cursor: pointer; cursor: pointer;
-webkit-user-select: none; -webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none; -moz-user-select: none;
-ms-user-select: none; -ms-user-select: none;
user-select: none; user-select: none;
...@@ -147,7 +144,7 @@ body { ...@@ -147,7 +144,7 @@ body {
height: 100%; height: 100%;
-webkit-transition: -webkit-transform 0.5s; -webkit-transition: -webkit-transform 0.5s;
-moz-transition: -moz-transform 0.5s; -moz-transition: -moz-transform 0.5s;
-ms-transition: -moz-transform 0.5s; transition: -moz-transform 0.5s;
overflow: hidden; overflow: hidden;
} }
...@@ -183,7 +180,6 @@ body { ...@@ -183,7 +180,6 @@ body {
height: 14px; height: 14px;
-moz-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.6); -moz-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
-webkit-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.6); -webkit-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
-ms-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.6); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
} }
...@@ -232,7 +228,6 @@ body { ...@@ -232,7 +228,6 @@ body {
input::-webkit-input-placeholder { color: #454545; } input::-webkit-input-placeholder { color: #454545; }
input:-moz-placeholder { color: #454545; } input:-moz-placeholder { color: #454545; }
input:-ms-placeholder { color: #454545; }
#divider { #divider {
position: absolute; position: absolute;
...@@ -268,18 +263,18 @@ input:-ms-placeholder { color: #454545; } ...@@ -268,18 +263,18 @@ input:-ms-placeholder { color: #454545; }
width: 25%; width: 25%;
height: 100%; height: 100%;
visibility: hidden; visibility: hidden;
-webkit-transition: visibility 0 ease 0.5s; -webkit-transition: visibility 0s ease 0.5s;
-moz-transition: visibility 0 ease 0.5s; -moz-transition: visibility 0s ease 0.5s;
-ms-transition: visibility 0 ease 0.5s; transition: visibility 0s ease 0.5s;
} }
#sidebar.open #tocView, #sidebar.open #tocView,
#sidebar.open #bookmarksView { #sidebar.open #bookmarksView {
overflow-y: auto; overflow-y: auto;
visibility: visible; visibility: visible;
-webkit-transition: visibility 0 ease 0; -webkit-transition: visibility 0s ease 0s;
-moz-transition: visibility 0 ease 0; -moz-transition: visibility 0s ease 0s;
-ms-transition: visibility 0 ease 0; transition: visibility 0s ease 0s;
} }
#sidebar.open #tocView { #sidebar.open #tocView {
...@@ -495,9 +490,8 @@ input:-ms-placeholder { color: #454545; } ...@@ -495,9 +490,8 @@ input:-ms-placeholder { color: #454545; }
position: fixed; position: fixed;
top: 50%; top: 50%;
left: 50%; left: 50%;
width: 50%; // width: 50%;
width: 630px; width: 630px;
height: auto; height: auto;
z-index: 2000; z-index: 2000;
visibility: hidden; visibility: hidden;
...@@ -518,7 +512,6 @@ input:-ms-placeholder { color: #454545; } ...@@ -518,7 +512,6 @@ input:-ms-placeholder { color: #454545; }
background: rgba(255, 255, 255, 0.8); background: rgba(255, 255, 255, 0.8);
-webkit-transition: all 0.3s; -webkit-transition: all 0.3s;
-moz-transition: all 0.3s; -moz-transition: all 0.3s;
-ms-transition: all 0.3s;
transition: all 0.3s; transition: all 0.3s;
} }
...@@ -588,7 +581,6 @@ input:-ms-placeholder { color: #454545; } ...@@ -588,7 +581,6 @@ input:-ms-placeholder { color: #454545; }
opacity: 0; opacity: 0;
-webkit-transition: all 0.3s; -webkit-transition: all 0.3s;
-moz-transition: all 0.3s; -moz-transition: all 0.3s;
-ms-transition: all 0.3s;
transition: all 0.3s; transition: all 0.3s;
} }
...@@ -601,7 +593,7 @@ input:-ms-placeholder { color: #454545; } ...@@ -601,7 +593,7 @@ input:-ms-placeholder { color: #454545; }
} }
.md-content > .closer { .md-content > .closer {
font-size: 18px; //font-size: 18px;
position: absolute; position: absolute;
right: 0; right: 0;
top: 0; top: 0;
...@@ -663,7 +655,7 @@ input:-ms-placeholder { color: #454545; } ...@@ -663,7 +655,7 @@ input:-ms-placeholder { color: #454545; }
-ms-transform: translate(0, 0); -ms-transform: translate(0, 0);
-webkit-transition: -webkit-transform .3s; -webkit-transition: -webkit-transform .3s;
-moz-transition: -moz-transform .3s; -moz-transition: -moz-transform .3s;
-ms-transition: -moz-transform .3s; transition: -moz-transform .3s;
} }
#main.closed { #main.closed {
...@@ -778,7 +770,7 @@ and (orientation : landscape) ...@@ -778,7 +770,7 @@ and (orientation : landscape)
} }
[class^="icon-"]:before, [class*=" icon-"]:before { [class^="icon-"]:before, [class*=" icon-"]:before {
font-family: "fontello"; font-family: "fontello", serif;
font-style: normal; font-style: normal;
font-weight: normal; font-weight: normal;
speak: none; speak: none;
......
...@@ -241,7 +241,7 @@ span.glyphicon.glyphicon-tags { ...@@ -241,7 +241,7 @@ span.glyphicon.glyphicon-tags {
.button-link {color: #fff; } .button-link {color: #fff; }
.btn-primary:hover, .btn-primary:focus, .btn-primary:active, .btn-primary.active, .open .dropdown-toggle.btn-primary{ background-color: #1C5484; } .btn-primary:hover, .btn-primary:focus, .btn-primary:active, .btn-primary.active, .open .dropdown-toggle.btn-primary{ background-color: #1C5484; }
.btn-primary.disabled, .btn-primary[disabled], fieldset[disabled] .btn-primary, .btn-primary.disabled:hover, .btn-primary[disabled]:hover, fieldset[disabled] .btn-primary:hover, .btn-primary.disabled:focus, .btn-primary[disabled]:focus, fieldset[disabled] .btn-primary:focus, .btn-primary.disabled:active, .btn-primary[disabled]:active, fieldset[disabled] .btn-primary:active, .btn-primary.disabled.active, .btn-primary[disabled].active, fieldset[disabled] .btn-primary.active { background-color: #89B9E2; } .btn-primary.disabled, .btn-primary[disabled], fieldset[disabled] .btn-primary, .btn-primary.disabled:hover, .btn-primary[disabled]:hover, fieldset[disabled] .btn-primary:hover, .btn-primary.disabled:focus, .btn-primary[disabled]:focus, fieldset[disabled] .btn-primary:focus, .btn-primary.disabled:active, .btn-primary[disabled]:active, fieldset[disabled] .btn-primary:active, .btn-primary.disabled.active, .btn-primary[disabled].active, fieldset[disabled] .btn-primary.active { background-color: #89B9E2; }
.btn-toolbar>.btn+.btn, .btn-toolbar>.btn-group+.btn, .btn-toolbar>.btn+.btn-group, .btn-toolbar>.btn-group+.btn-group { margin-left: 0px; } .btn-toolbar>.btn+.btn, .btn-toolbar>.btn-group+.btn, .btn-toolbar>.btn+.btn-group, .btn-toolbar>.btn-group+.btn-group { margin-left: 0; }
.panel-body {background-color: #f5f5f5; } .panel-body {background-color: #f5f5f5; }
.spinner {margin: 0 41%; } .spinner {margin: 0 41%; }
.spinner2 {margin: 0 41%; } .spinner2 {margin: 0 41%; }
...@@ -311,11 +311,11 @@ input.pill:not(:checked) + label .glyphicon { display: none; } ...@@ -311,11 +311,11 @@ input.pill:not(:checked) + label .glyphicon { display: none; }
.editable-input { display:inline-block; } .editable-input { display:inline-block; }
.editable-cancel { .editable-cancel {
margin-bottom: 0px !important; margin-bottom: 0 !important;
margin-left: 7px !important; margin-left: 7px !important;
} }
.editable-submit { margin-bottom: 0px !important; } .editable-submit { margin-bottom: 0 !important; }
.filterheader { margin-bottom: 20px; } .filterheader { margin-bottom: 20px; }
.errorlink { margin-top: 20px; } .errorlink { margin-top: 20px; }
.emailconfig { margin-top: 10px; } .emailconfig { margin-top: 10px; }
...@@ -326,7 +326,7 @@ input.pill:not(:checked) + label .glyphicon { display: none; } ...@@ -326,7 +326,7 @@ input.pill:not(:checked) + label .glyphicon { display: none; }
} }
div.log { div.log {
font-family: Courier New; font-family: Courier New, serif;
font-size: 12px; font-size: 12px;
box-sizing: border-box; box-sizing: border-box;
height: 700px; height: 700px;
......
...@@ -19,16 +19,9 @@ var direction = 0; // Descending order ...@@ -19,16 +19,9 @@ var direction = 0; // Descending order
var sort = 0; // Show sorted entries var sort = 0; // Show sorted entries
$("#sort_name").click(function() { $("#sort_name").click(function() {
var class_name = $("h1").attr('Class') + "_sort_name"; var className = $("h1").attr("Class") + "_sort_name";
var obj = {}; var obj = {};
obj[class_name] = sort; obj[className] = sort;
/*$.ajax({
method:"post",
contentType: "application/json; charset=utf-8",
dataType: "json",
url: window.location.pathname + "/../../ajax/view",
data: JSON.stringify({obj}),
});*/
var count = 0; var count = 0;
var index = 0; var index = 0;
......
...@@ -45,14 +45,13 @@ $(function() { ...@@ -45,14 +45,13 @@ $(function() {
if (selections.length < 1) { if (selections.length < 1) {
$("#delete_selection").addClass("disabled"); $("#delete_selection").addClass("disabled");
$("#delete_selection").attr("aria-disabled", true); $("#delete_selection").attr("aria-disabled", true);
} } else {
else{
$("#delete_selection").removeClass("disabled"); $("#delete_selection").removeClass("disabled");
$("#delete_selection").attr("aria-disabled", false); $("#delete_selection").attr("aria-disabled", false);
} }
}); });
$("#delete_selection").click(function() { $("#delete_selection").click(function() {
$("#books-table").bootstrapTable('uncheckAll'); $("#books-table").bootstrapTable("uncheckAll");
}); });
$("#merge_confirm").click(function() { $("#merge_confirm").click(function() {
...@@ -63,8 +62,8 @@ $(function() { ...@@ -63,8 +62,8 @@ $(function() {
url: window.location.pathname + "/../../ajax/mergebooks", url: window.location.pathname + "/../../ajax/mergebooks",
data: JSON.stringify({"Merge_books":selections}), data: JSON.stringify({"Merge_books":selections}),
success: function success() { success: function success() {
$('#books-table').bootstrapTable('refresh'); $("#books-table").bootstrapTable("refresh");
$("#books-table").bootstrapTable('uncheckAll'); $("#books-table").bootstrapTable("uncheckAll");
} }
}); });
}); });
...@@ -76,11 +75,11 @@ $(function() { ...@@ -76,11 +75,11 @@ $(function() {
dataType: "json", dataType: "json",
url: window.location.pathname + "/../../ajax/simulatemerge", url: window.location.pathname + "/../../ajax/simulatemerge",
data: JSON.stringify({"Merge_books":selections}), data: JSON.stringify({"Merge_books":selections}),
success: function success(book_titles) { success: function success(booTitles) {
$.each(book_titles.from, function(i, item) { $.each(booTitles.from, function(i, item) {
$("<span>- " + item + "</span>").appendTo("#merge_from"); $("<span>- " + item + "</span>").appendTo("#merge_from");
}); });
$('#merge_to').text("- " + book_titles.to); $("#merge_to").text("- " + booTitles.to);
} }
}); });
...@@ -126,34 +125,35 @@ $(function() { ...@@ -126,34 +125,35 @@ $(function() {
formatNoMatches: function () { formatNoMatches: function () {
return ""; return "";
}, },
// eslint-disable-next-line no-unused-vars
onEditableSave: function (field, row, oldvalue, $el) { onEditableSave: function (field, row, oldvalue, $el) {
if (field === 'title' || field === 'authors') { if (field === "title" || field === "authors") {
$.ajax({ $.ajax({
method:"get", method:"get",
dataType: "json", dataType: "json",
url: window.location.pathname + "/../../ajax/sort_value/" + field + '/' + row.id, url: window.location.pathname + "/../../ajax/sort_value/" + field + "/" + row.id,
success: function success(data) { success: function success(data) {
var key = Object.keys(data)[0] var key = Object.keys(data)[0];
$("#books-table").bootstrapTable('updateCellByUniqueId', { $("#books-table").bootstrapTable("updateCellByUniqueId", {
id: row.id, id: row.id,
field: key, field: key,
value: data[key] value: data[key]
}); });
console.log(data); // console.log(data);
} }
}); });
} }
}, },
// eslint-disable-next-line no-unused-vars
onColumnSwitch: function (field, checked) { onColumnSwitch: function (field, checked) {
var visible = $("#books-table").bootstrapTable('getVisibleColumns'); var visible = $("#books-table").bootstrapTable("getVisibleColumns");
var hidden = $("#books-table").bootstrapTable('getHiddenColumns'); var hidden = $("#books-table").bootstrapTable("getHiddenColumns");
var visibility =[] var st = "";
var st = ""
visible.forEach(function(item) { visible.forEach(function(item) {
st += "\""+ item.field + "\":\"" +"true"+ "\"," st += "\"" + item.field + "\":\"" + "true" + "\",";
}); });
hidden.forEach(function(item) { hidden.forEach(function(item) {
st += "\""+ item.field + "\":\"" +"false"+ "\"," st += "\"" + item.field + "\":\"" + "false" + "\",";
}); });
st = st.slice(0, -1); st = st.slice(0, -1);
$.ajax({ $.ajax({
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
<button type="submit" name="forgot" value="forgot" class="btn btn-default">{{_('Forgot Password?')}}</button> <button type="submit" name="forgot" value="forgot" class="btn btn-default">{{_('Forgot Password?')}}</button>
{% endif %} {% endif %}
{% if config.config_remote_login %} {% if config.config_remote_login %}
<a href="{{url_for('web.remote_login')}}" class="pull-right">{{_('Log in with Magic Link')}}</a> <a href="{{url_for('remotelogin.remote_login')}}" id="remote_login" class="pull-right">{{_('Log in with Magic Link')}}</a>
{% endif %} {% endif %}
{% if config.config_login_type == 2 %} {% if config.config_login_type == 2 %}
{% if 1 in oauth_check %} {% if 1 in oauth_check %}
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
<h2 style="margin-top: 0">{{_('Magic Link - Authorise New Device')}}</h2> <h2 style="margin-top: 0">{{_('Magic Link - Authorise New Device')}}</h2>
<p> <p>
{{_('On another device, login and visit:')}} {{_('On another device, login and visit:')}}
<h4><a href="{{verify_url}}">{{verify_url}}</a></b> <h4><a id="verify_url" href="{{verify_url}}">{{verify_url}}</a></b>
</h4> </h4>
<p> <p>
{{_('Once verified, you will automatically be logged in on this device.')}} {{_('Once verified, you will automatically be logged in on this device.')}}
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
(function () { (function () {
// Poll the server to check if the user has authenticated // Poll the server to check if the user has authenticated
var t = setInterval(function () { var t = setInterval(function () {
$.post('{{url_for("web.token_verified")}}', { token: '{{token}}' }) $.post('{{url_for("remotelogin.token_verified")}}', { token: '{{token}}' })
.done(function(response) { .done(function(response) {
if (response.status === 'success') { if (response.status === 'success') {
// Wait a tick so cookies are updated // Wait a tick so cookies are updated
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment