From 82fb4f053ca7fef28c739eab2c2f9abe1ca30165 Mon Sep 17 00:00:00 2001 From: Dru Jensen Date: Mon, 4 Apr 2016 13:47:54 -0700 Subject: [PATCH] remove api and limit height on index page --- Dockerfile | 6 +++++- config/routes.cr | 2 -- public/stylesheets/main.css | 11 +++++++---- src/controllers/api_controller.cr | 17 ----------------- src/controllers/session_controller.cr | 4 ++-- src/views/post/index.ecr | 2 +- 6 files changed, 15 insertions(+), 27 deletions(-) delete mode 100644 src/controllers/api_controller.cr diff --git a/Dockerfile b/Dockerfile index efc2118..48194a1 100644 --- a/Dockerfile +++ b/Dockerfile @@ -15,9 +15,13 @@ RUN echo "deb http://dist.crystal-lang.org/apt crystal main" > /etc/apt/sources. # Install Dependencies RUN apt-get update && apt-get install -y \ build-essential \ - libyaml-0-2 \ libpq-dev \ + libyaml-dev \ libssl-dev \ + zlib1g-dev \ + libevent-dev \ + libgc-dev \ + libpq-dev \ git \ crystal diff --git a/config/routes.cr b/config/routes.cr index 9e5dffc..31ec418 100644 --- a/config/routes.cr +++ b/config/routes.cr @@ -14,5 +14,3 @@ get "/posts/:id", PostController::Show.instance get "/posts/:id/edit", PostController::Edit.instance put "/posts/:id", PostController::Update.instance delete "/posts/:id", PostController::Delete.instance - -get "/api/posts/:id", ApiController::Show.instance diff --git a/public/stylesheets/main.css b/public/stylesheets/main.css index 06a4d90..88fb1d5 100644 --- a/public/stylesheets/main.css +++ b/public/stylesheets/main.css @@ -73,11 +73,9 @@ h6, .h6 { border-left: 5px solid transparent; } - /* * Blog name and description */ - .blog-header { padding-top: 20px; padding-bottom: 20px; @@ -93,7 +91,6 @@ h6, .h6 { color: #999; } - /* * Main column and sidebar layout */ @@ -132,7 +129,6 @@ h6, .h6 { border-radius: 30px; } - /* * Blog posts */ @@ -149,6 +145,13 @@ h6, .h6 { color: #999; } +.truncate { + text-overflow: ellipsis; + word-wrap: break-word; + overflow: hidden; + max-height: 12em; + line-height: 1.5em; +} /* * Footer diff --git a/src/controllers/api_controller.cr b/src/controllers/api_controller.cr deleted file mode 100644 index 1638ebe..0000000 --- a/src/controllers/api_controller.cr +++ /dev/null @@ -1,17 +0,0 @@ -require "../models/post" -include Kemalyst - -module ApiController - class Show < Controller - def call(context) - id = context.params["id"] - post = Post.find(id) - if post - json post, 200 - else - json %({"error":"#{id} could not be found""}), 404 - end - end - end -end - diff --git a/src/controllers/session_controller.cr b/src/controllers/session_controller.cr index fed5c02..6e93b72 100644 --- a/src/controllers/session_controller.cr +++ b/src/controllers/session_controller.cr @@ -16,8 +16,8 @@ module SessionController username = context.params["username"] password = context.params["password"] - #puts "Encrypted Password: #{Crypto::MD5.hex_digest(password)}" - if username == "admin" && Crypto::MD5.hex_digest(password as String) == "5f4dcc3b5aa765d61d8327deb882cf99" + # puts "Encrypted Password: #{Crypto::MD5.hex_digest(password as String)}" + if username == "admin" && Crypto::MD5.hex_digest(password as String) == "ff2fca5e688561ed5237c9a9445c427a" context.session["authorized"] = "true" end redirect "/" diff --git a/src/views/post/index.ecr b/src/views/post/index.ecr index d416645..5be739c 100644 --- a/src/views/post/index.ecr +++ b/src/views/post/index.ecr @@ -5,7 +5,7 @@

<%= post.last_updated %> by Dru Jensen

-

<%= post.markdown_body %>

+
<%= post.markdown_body %>

read