1
0
Fork 0
mirror of https://github.com/documize/community.git synced 2025-07-19 13:19:43 +02:00

improvements to print display

This commit is contained in:
Harvey Kandola 2017-04-03 16:34:42 +01:00
parent c6ca284e6d
commit c5443fffb4
8 changed files with 838 additions and 673 deletions

View file

@ -23,6 +23,7 @@ export default Ember.Service.extend({
ajax: service(), ajax: service(),
localStorage: service(), localStorage: service(),
kcAuth: service(), kcAuth: service(),
apiHost: `${config.apiHost}`,
endpoint: `${config.apiHost}/${config.apiNamespace}`, endpoint: `${config.apiHost}/${config.apiNamespace}`,
orgId: '', orgId: '',
title: '', title: '',

View file

@ -9,22 +9,57 @@
// //
// https://documize.com // https://documize.com
@media print { @media print {
.non-printable, @page {
.zone-navigation, size: 8.5in 11in;
.zone-sidebar, margin: 20mm;
#sidebar-wrapper,
.document-heading, @top-right {
.edit-document-heading, font-size: 12px;
#sidebar-toggle, content: string(doctitle);
.back-to-space, color: $color-off-black;
.start-section, }
.new-section-wizard {
display: none !important; @bottom-left {
font-size: 12px;
content: 'Exported from Documize';
color: $color-off-black;
}
@bottom-right {
content: counter(page);
font-size: 12px;
color: $color-off-black;
}
} }
#page-content-wrapper, #wrapper { html, body {
padding: 0 !important; background-color: transparent !important;
max-width: none !important;
float: none !important;
position: relative !important;
height: initial !important;
min-height: initial !important;
}
.non-printable,
.zone-navigation,
#sidebar-wrapper,
.sidebar-wrapper,
.sidebar-common,
.sidebar-toolbar,
.sidebar-panel,
.edit-document-heading,
.back-to-space,
.start-section,
.start-button,
.is-a-tab,
.new-section-wizard {
float: none !important;
display: none !important;
margin: 0 !important; margin: 0 !important;
padding: 0 !important;
width: 0 !important;
z-index: 0 !important;
} }
.non-printable-message, .non-printable-message,
@ -32,9 +67,80 @@
display: block !important; display: block !important;
} }
.is-a-tab, .is-a-page { #wrapper {
padding: 0 !important; padding: 0 !important;
margin: 0 !important; margin: 0 !important;
box-shadow: none !important; position: relative !important;
box-shadow: initial !important;
border-radius: initial !important;
float: none !important;
overflow-x: initial !important;
padding-left: 0 !important;
.page-container {
padding: 0 !important;
margin: 0 !important;
position: initial !important;
box-shadow: initial !important;
border-radius: initial !important;
width: initial !important;
max-width: initial !important;
float: initial !important;
overflow-x: initial !important;
#page-content-wrapper {
padding: 0 !important;
margin: 0 !important;
position: initial !important;
box-shadow: initial !important;
border-radius: initial !important;
width: initial !important;
max-width: initial !important;
float: initial !important;
overflow-x: initial !important;
#zone-document-content {
padding: 0 !important;
margin: 0 !important;
position: initial !important;
box-shadow: initial !important;
border-radius: initial !important;
width: initial !important;
max-width: initial !important;
float: initial !important;
overflow-x: initial !important;
.document-heading {
.doc-title {
margin: 0 0 10px 0 !important;
}
}
.document-view {
padding: 0 !important;
margin: 0 !important;
position: initial !important;
box-shadow: initial !important;
border-radius: initial !important;
width: initial !important;
max-width: initial !important;
float: initial !important;
overflow-x: initial !important;
.is-a-page /*, .is-a-tab */ {
padding: 0 !important;
margin: 30px 0 20px 0 !important;
position: initial !important;
box-shadow: initial !important;
border-radius: initial !important;
width: initial !important;
max-width: initial !important;
float: initial !important;
overflow-x: initial !important;
}
}
}
}
}
} }
} }

View file

@ -7,7 +7,6 @@ $sidebar-width: 400px;
-moz-transition: all 0.5s ease; -moz-transition: all 0.5s ease;
-o-transition: all 0.5s ease; -o-transition: all 0.5s ease;
transition: all 0.5s ease; transition: all 0.5s ease;
background-color: $color-off-white;
} }
#sidebar-wrapper { #sidebar-wrapper {
@ -20,7 +19,6 @@ $sidebar-width: 400px;
height: 100%; height: 100%;
margin-left: -$sidebar-width; margin-left: -$sidebar-width;
border-right: 1px solid $color-stroke; border-right: 1px solid $color-stroke;
background: $color-off-white;
overflow-y: auto; overflow-y: auto;
-webkit-transition: all 0.5s ease; -webkit-transition: all 0.5s ease;
-moz-transition: all 0.5s ease; -moz-transition: all 0.5s ease;
@ -28,10 +26,6 @@ $sidebar-width: 400px;
transition: all 0.5s ease; transition: all 0.5s ease;
} }
#wrapper.toggled #sidebar-wrapper {
width: $sidebar-width;
}
.page-container { .page-container {
margin-right: auto; margin-right: auto;
margin-left: auto; margin-left: auto;
@ -42,7 +36,8 @@ $sidebar-width: 400px;
#page-content-wrapper { #page-content-wrapper {
width: 100%; width: 100%;
position: absolute; position: relative;
// position: absolute;
padding: 30px; padding: 30px;
margin: 0 auto; margin: 0 auto;
margin-top: 30px; margin-top: 30px;
@ -54,42 +49,19 @@ $sidebar-width: 400px;
} }
} }
#wrapper.toggled #page-content-wrapper {
position: absolute;
margin-right: -$sidebar-width;
}
@media(min-width:768px) { @media(min-width:768px) {
#wrapper { #wrapper {
padding-left: $sidebar-width; padding-left: $sidebar-width;
} }
#wrapper.toggled {
padding-left: 0;
padding-right: 0;
}
#sidebar-wrapper { #sidebar-wrapper {
width: $sidebar-width; width: $sidebar-width;
} }
#wrapper.toggled #sidebar-wrapper { // #page-content-wrapper {
width: 0; // padding: 30px;
// position: relative;
.sidebar-toolbar { // }
position: relative;
}
}
#page-content-wrapper {
padding: 30px;
position: relative;
}
#wrapper.toggled #page-content-wrapper {
position: relative;
margin-left: 0;
}
} }
.sidebar-toolbar { .sidebar-toolbar {

View file

@ -1,4 +1,4 @@
<div id="page-{{ page.id }}" class="is-a-tab wysiwyg {{if expanded 'tab-max' 'tab-min'}}" data-id="{{ page.id }}" data-type="{{ page.contentType }}"> <div id="page-{{ page.id }}" class="is-a-tab wysiwyg non-printable {{if expanded 'tab-max' 'tab-min'}}" data-id="{{ page.id }}" data-type="{{ page.contentType }}">
{{document/tab-heading tagName=page.tagName document=document folder=folder page=page isEditor=isEditor {{document/tab-heading tagName=page.tagName document=document folder=folder page=page isEditor=isEditor
onExpand=(action 'onExpand') onSavePageAsBlock=(action 'onSavePageAsBlock') onCopyPage=(action 'onCopyPage') onMovePage=(action 'onMovePage') onDeletePage=(action 'onDeletePage')}} onExpand=(action 'onExpand') onSavePageAsBlock=(action 'onSavePageAsBlock') onCopyPage=(action 'onCopyPage') onMovePage=(action 'onMovePage') onDeletePage=(action 'onDeletePage')}}
{{#if expanded}} {{#if expanded}}

View file

@ -227,16 +227,16 @@ textarea {
font-size: inherit; font-size: inherit;
line-height: inherit; line-height: inherit;
} }
a { /*a {
/*color: #337ab7;*/ color: #337ab7;
/*text-decoration: none;*/ text-decoration: none;
} }
/*a:hover, a:hover,
a:focus {*/ a:focus {
/*color: #23527c;*/ color: #23527c;
/*text-decoration: underline;*/ text-decoration: underline;
} }
/*a:focus { a:focus {
outline: thin dotted; outline: thin dotted;
outline: 5px auto -webkit-focus-ring-color; outline: 5px auto -webkit-focus-ring-color;
outline-offset: -2px; outline-offset: -2px;
@ -1155,7 +1155,7 @@ hr {
display: none !important; display: none !important;
} }
} }
.visible-print { /*.visible-print {
display: none !important; display: none !important;
} }
@media print { @media print {
@ -1201,4 +1201,4 @@ hr {
.hidden-print { .hidden-print {
display: none !important; display: none !important;
} }
} }*/

View file

@ -227,6 +227,93 @@ func Authorize(w http.ResponseWriter, r *http.Request, next http.HandlerFunc) {
} }
} }
// ValidToken finds and validates authentication token.
func ValidToken(r *http.Request) (context request.Context, valid bool) {
valid = false
token := findJWT(r)
hasToken := len(token) > 1
context, _, tokenErr := decodeJWT(token)
var org = entity.Organization{}
var err = errors.New("")
p := request.GetPersister(r)
// We always grab the org record regardless of token status.
// Why? If bad token we might be OK to alow anonymous access
// depending upon the domain in question.
if len(context.OrgID) == 0 {
org, err = p.GetOrganizationByDomain(request.GetRequestSubdomain(r))
} else {
org, err = p.GetOrganization(context.OrgID)
}
context.Subdomain = org.Domain
// Inability to find org record spells the end of this request.
if err != nil {
return
}
// If we have bad auth token and the domain does not allow anon access
if !org.AllowAnonymousAccess && tokenErr != nil {
return
}
domain := request.GetSubdomainFromHost(r)
domain2 := request.GetRequestSubdomain(r)
if org.Domain != domain && org.Domain != domain2 {
return
}
// If we have bad auth token and the domain allows anon access
// then we generate guest context.
if org.AllowAnonymousAccess {
// So you have a bad token
if hasToken {
if tokenErr != nil {
return
}
} else {
// Just grant anon user guest access
context.UserID = "0"
context.OrgID = org.RefID
context.Authenticated = false
context.Guest = true
}
}
// Refresh context and persister
request.SetContext(r, context)
p = request.GetPersister(r)
context.AllowAnonymousAccess = org.AllowAnonymousAccess
context.OrgName = org.Title
context.Administrator = false
context.Editor = false
context.Global = false
// Fetch user permissions for this org
if context.Authenticated {
user, err := getSecuredUser(p, org.RefID, context.UserID)
if err != nil {
return
}
context.Administrator = user.Admin
context.Editor = user.Editor
context.Global = user.Global
}
request.SetContext(r, context)
p = request.GetPersister(r)
valid = context.Authenticated || org.AllowAnonymousAccess
return
}
// Certain assets/URL do not require authentication. // Certain assets/URL do not require authentication.
// Just stops the log files being clogged up with failed auth errors. // Just stops the log files being clogged up with failed auth errors.
func preAuthorizeStaticAssets(r *http.Request) bool { func preAuthorizeStaticAssets(r *http.Request) bool {

View file

@ -175,7 +175,6 @@ func cors(w http.ResponseWriter, r *http.Request, next http.HandlerFunc) {
} }
func metrics(w http.ResponseWriter, r *http.Request, next http.HandlerFunc) { func metrics(w http.ResponseWriter, r *http.Request, next http.HandlerFunc) {
w.Header().Add("X-Documize-Version", Product.Version) w.Header().Add("X-Documize-Version", Product.Version)
w.Header().Add("Cache-Control", "no-cache") w.Header().Add("Cache-Control", "no-cache")

File diff suppressed because one or more lines are too long