Updates on assets

Former-commit-id: cca2d9c4c6b63346517dd1f422cbf927c06061e2
This commit is contained in:
Henrique Dias 2017-06-25 22:39:18 +01:00
parent b02ac893ec
commit 20405bc29a
3 changed files with 25 additions and 30 deletions

View File

@ -1,20 +1,18 @@
/*! normalize.css v5.0.0 | MIT License | github.com/necolas/normalize.css */ /*! normalize.css v7.0.0 | MIT License | github.com/necolas/normalize.css */
/**
* 1. Change the default font family in all browsers (opinionated).
* 2. Correct the line height in all browsers.
* 3. Prevent adjustments of font size after orientation changes in
* IE on Windows Phone and in iOS.
*/
/* Document /* Document
========================================================================== */ ========================================================================== */
/**
* 1. Correct the line height in all browsers.
* 2. Prevent adjustments of font size after orientation changes in
* IE on Windows Phone and in iOS.
*/
html { html {
font-family: sans-serif; /* 1 */ line-height: 1.15; /* 1 */
line-height: 1.15; /* 2 */ -ms-text-size-adjust: 100%; /* 2 */
-ms-text-size-adjust: 100%; /* 3 */ -webkit-text-size-adjust: 100%; /* 2 */
-webkit-text-size-adjust: 100%; /* 3 */
} }
/* Sections /* Sections
@ -108,17 +106,7 @@ a {
} }
/** /**
* Remove the outline on focused links when they are also active or hovered * 1. Remove the bottom border in Chrome 57- and Firefox 39-.
* in all browsers (opinionated).
*/
a:active,
a:hover {
outline-width: 0;
}
/**
* 1. Remove the bottom border in Firefox 39-.
* 2. Add the correct text decoration in Chrome, Edge, IE, Opera, and Safari. * 2. Add the correct text decoration in Chrome, Edge, IE, Opera, and Safari.
*/ */
@ -317,13 +305,11 @@ button:-moz-focusring,
} }
/** /**
* Change the border, margin, and padding in all browsers (opinionated). * Correct the padding in Firefox.
*/ */
fieldset { fieldset {
border: 1px solid #c0c0c0; padding: 0.35em 0.75em 0.625em;
margin: 0 2px;
padding: 0.35em 0.625em 0.75em;
} }
/** /**

View File

@ -81,6 +81,7 @@ type User struct {
type assets struct { type assets struct {
requiredJS *rice.Box // JS that is always required to have in order to be usable. requiredJS *rice.Box // JS that is always required to have in order to be usable.
baseTemplates *rice.Box baseTemplates *rice.Box
baseCSS *rice.Box
Templates *rice.Box Templates *rice.Box
CSS *rice.Box CSS *rice.Box
JS *rice.Box JS *rice.Box
@ -117,7 +118,7 @@ func New(scope string) *FileManager {
AfterSave: func(r *http.Request, m *FileManager, u *User) error { return nil }, AfterSave: func(r *http.Request, m *FileManager, u *User) error { return nil },
Assets: &assets{ Assets: &assets{
baseTemplates: rice.MustFindBox("./_assets/templates"), baseTemplates: rice.MustFindBox("./_assets/templates"),
CSS: rice.MustFindBox("./_assets/css"), baseCSS: rice.MustFindBox("./_assets/css"),
requiredJS: rice.MustFindBox("./_assets/js"), requiredJS: rice.MustFindBox("./_assets/js"),
}, },
} }

View File

@ -22,7 +22,15 @@ func serveAssets(w http.ResponseWriter, r *http.Request, m *FileManager) (int, e
switch { switch {
case strings.HasPrefix(filename, "/css"): case strings.HasPrefix(filename, "/css"):
filename = strings.Replace(filename, "/css/", "", 1) filename = strings.Replace(filename, "/css/", "", 1)
file, err = m.Assets.CSS.Bytes(filename)
if m.Assets.CSS != nil {
file, err = m.Assets.JS.Bytes(filename)
if err == nil {
break
}
}
file, err = m.Assets.baseCSS.Bytes(filename)
case strings.HasPrefix(filename, "/js"): case strings.HasPrefix(filename, "/js"):
filename = strings.Replace(filename, "/js/", "", 1) filename = strings.Replace(filename, "/js/", "", 1)
file, err = m.Assets.requiredJS.Bytes(filename) file, err = m.Assets.requiredJS.Bytes(filename)