~evanj/cms

f11ba66454fc73b223ee249a4d0e9d6adedc56f2 — Evan M Jones 1 year, 7 months ago c90e0c8
WIP(css+queries): Removed CSS. Tweaked content type query order by.
M internal/s/db/content.go => internal/s/db/content.go +1 -2
@@ 98,8 98,7 @@ var (
		 	WHERE cms_content.CONTENTTYPE_ID = ? 
		 	AND cms_contenttype_to_valuetype.NAME = ?
	
			ORDER BY cms_value_string_small.VALUE %s, cms_value_string_big.VALUE %s, cms_value_date.VALUE %s
	
			ORDER BY cms_value_date.VALUE %s, cms_value_string_small.VALUE %s, cms_value_string_big.VALUE %s
		 	LIMIT ? OFFSET ?
		`, order.val, order.val, order.val)
	}

M internal/s/db/db.go => internal/s/db/db.go +8 -0
@@ 33,6 33,14 @@ func New(log *log.Logger, typ, creds string, sec securer) (*DB, error) {
		return nil, err
	}

	if err := conn.Ping(); err != nil {
		return nil, err
	}

	// TODO: Best numbers?
	conn.SetMaxIdleConns(10)
	conn.SetMaxOpenConns(100)

	db := &DB{
		conn,
		log,

M internal/s/tmpl/css/main.css => internal/s/tmpl/css/main.css +6 -133
@@ 1,139 1,12 @@
body {
body > * {
  max-width: 1000px;
  margin-left: auto;
  margin-right: auto;
}

header > h1 { 
header h1 { 
  max-width: 700px;
  margin-left: auto;
  margin-right: auto;
}

form { 
  max-width: 100%%;
}

dialog { 
  padding: 0;
  width: 300px; 
  max-width: 100%%;
}

dialog p { 
  margin-bottom: 16px;
}

dialog menu { 
  width: 100%%;
  padding: 0;
  margin: 0;
}

dialog menu > div { 
  padding: 16px;
}

dialog menu > div > div { 
  display: flex;
}

dialog .left {
  margin-right: 8px;
}

dialog .right {
  margin-left: 8px;
}

dialog menu span,
dialog menu input { 
  width: 100%%;
}

input,
textarea { 
  display: block;
  box-sizing: border-box;
}

input[type=button],
select { 
  display: inline-block;
}

a,
input, 
button[type=button],
button[type=submit],
summary {
  cursor: pointer;
}

textarea { 
  width: 100%%;
  resize: vertical;
  min-height: 250px;
}

.tox.tox-tinymce { 
  min-height: 500px;
}

.input-html,
.input-markdown { 
  display: block !important; /* tinymce hides this. */
  width: 0;
  height: 0;
  min-height: 0;
  resize: none;
  overflow: hidden;
  position: relative;
  left: 50%%;
  top: 100px;
  margin: 0;
  padding: 0;
}

/* To match stylesheet. */

form > legend,
.tox.tox-tinymce { 
  margin-bottom: 16px;
}

details > form {
  margin-top: 16px;
  margin-bottom: 16px;
}

/* For search dropdown. */

.algolia-autocomplete {
  width: 100%%;
}

.algolia-autocomplete .aa-input, .algolia-autocomplete .aa-hint {
  width: 100%%;
}

.algolia-autocomplete .aa-hint {
  color: #999;
}

.algolia-autocomplete .aa-dropdown-menu {
  width: 100%%;
  background: white;
  border: solid black 3px;
}

.algolia-autocomplete .aa-dropdown-menu .aa-suggestion {
  cursor: pointer;
  padding: 5px 4px;
}

.algolia-autocomplete .aa-dropdown-menu .aa-suggestion.aa-cursor {
  background-color: #B2D7FF;
}

.algolia-autocomplete .aa-dropdown-menu .aa-suggestion em {
  font-weight: bold;
  font-style: normal;
  text-align: center;
}

M internal/s/tmpl/html/content.html => internal/s/tmpl/html/content.html +0 -1
@@ 7,7 7,6 @@
</head>

<body>
  <style>{{ template "css/mvp.css" }}</style>
  <style>{{ template "css/main.css" }}</style>

  <main>

M internal/s/tmpl/html/contenttype.html => internal/s/tmpl/html/contenttype.html +0 -1
@@ 7,7 7,6 @@
</head>

<body>
  <style>{{ template "css/mvp.css" }}</style>
  <style>{{ template "css/main.css" }}</style>

  <main>

M internal/s/tmpl/html/hook.html => internal/s/tmpl/html/hook.html +0 -1
@@ 7,7 7,6 @@
</head>

<body>
  <style>{{ template "css/mvp.css" }}</style>
  <style>{{ template "css/main.css" }}</style>

  <main>

M internal/s/tmpl/html/index.html => internal/s/tmpl/html/index.html +0 -1
@@ 7,7 7,6 @@
</head>

<body>
  <style>{{ template "css/mvp.css" }}</style>
  <style>{{ template "css/main.css" }}</style>

  <main>

M internal/s/tmpl/html/space.html => internal/s/tmpl/html/space.html +0 -1
@@ 7,7 7,6 @@
</head>

<body>
  <style>{{ template "css/mvp.css" }}</style>
  <style>{{ template "css/main.css" }}</style>

  <main>

M internal/s/tmpl/tmpls_embed.go => internal/s/tmpl/tmpls_embed.go +7 -139
@@ 7,144 7,17 @@ var tmpls map[string]string
func init() {
	tmpls = make(map[string]string)

	tmpls["css/main.css"] = `body {
	tmpls["css/main.css"] = `body > * {
  max-width: 1000px;
  margin-left: auto;
  margin-right: auto;
}

header > h1 { 
header h1 { 
  max-width: 700px;
  margin-left: auto;
  margin-right: auto;
}

form { 
  max-width: 100%;
}

dialog { 
  padding: 0;
  width: 300px; 
  max-width: 100%;
}

dialog p { 
  margin-bottom: 16px;
}

dialog menu { 
  width: 100%;
  padding: 0;
  margin: 0;
}

dialog menu > div { 
  padding: 16px;
}

dialog menu > div > div { 
  display: flex;
}

dialog .left {
  margin-right: 8px;
}

dialog .right {
  margin-left: 8px;
}

dialog menu span,
dialog menu input { 
  width: 100%;
}

input,
textarea { 
  display: block;
  box-sizing: border-box;
}

input[type=button],
select { 
  display: inline-block;
}

a,
input, 
button[type=button],
button[type=submit],
summary {
  cursor: pointer;
}

textarea { 
  width: 100%;
  resize: vertical;
  min-height: 250px;
}

.tox.tox-tinymce { 
  min-height: 500px;
}

.input-html,
.input-markdown { 
  display: block !important; /* tinymce hides this. */
  width: 0;
  height: 0;
  min-height: 0;
  resize: none;
  overflow: hidden;
  position: relative;
  left: 50%;
  top: 100px;
  margin: 0;
  padding: 0;
}

/* To match stylesheet. */

form > legend,
.tox.tox-tinymce { 
  margin-bottom: 16px;
}

details > form {
  margin-top: 16px;
  margin-bottom: 16px;
}

/* For search dropdown. */

.algolia-autocomplete {
  width: 100%;
}

.algolia-autocomplete .aa-input, .algolia-autocomplete .aa-hint {
  width: 100%;
}

.algolia-autocomplete .aa-hint {
  color: #999;
}

.algolia-autocomplete .aa-dropdown-menu {
  width: 100%;
  background: white;
  border: solid black 3px;
}

.algolia-autocomplete .aa-dropdown-menu .aa-suggestion {
  cursor: pointer;
  padding: 5px 4px;
}

.algolia-autocomplete .aa-dropdown-menu .aa-suggestion.aa-cursor {
  background-color: #B2D7FF;
}

.algolia-autocomplete .aa-dropdown-menu .aa-suggestion em {
  font-weight: bold;
  font-style: normal;
  text-align: center;
}
`



@@ 521,7 394,7 @@ blockquote footer {
      <li><a href="/space/{{ .Space.ID }}">{{ .Space.Name }}</a></li>
      {{ end }}
      {{ if .Hook }}
      <li><a href="/space/{{ .Space.ID }}">{{ .Hook.URL }}</a></li>
      <li><a href="/space/{{ .Space.ID }}">{{ .Space.Name }}</a></li>
      {{ end }}
      {{ if .Content }}
      <li><a href="/contenttype/{{ .Space.ID}}/{{ .ContentType.ID }}">{{ .ContentType.Name }}</a></li>


@@ 542,7 415,6 @@ blockquote footer {
</head>

<body>
  <style>{{ template "css/mvp.css" }}</style>
  <style>{{ template "css/main.css" }}</style>

  <main>


@@ 660,7 532,6 @@ blockquote footer {
</head>

<body>
  <style>{{ template "css/mvp.css" }}</style>
  <style>{{ template "css/main.css" }}</style>

  <main>


@@ 792,7 663,6 @@ blockquote footer {
</head>

<body>
  <style>{{ template "css/mvp.css" }}</style>
  <style>{{ template "css/main.css" }}</style>

  <main>


@@ 829,7 699,6 @@ blockquote footer {
</head>

<body>
  <style>{{ template "css/mvp.css" }}</style>
  <style>{{ template "css/main.css" }}</style>

  <main>


@@ 909,7 778,6 @@ blockquote footer {
</head>

<body>
  <style>{{ template "css/mvp.css" }}</style>
  <style>{{ template "css/main.css" }}</style>

  <main>