Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bootstrap 3, ecto 0.4.0 #30

Merged
merged 19 commits into from
Jan 6, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions lib/elixir_china/repo.ex
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
defmodule Repo do
use Ecto.Repo, adapter: Ecto.Adapters.Postgres
use Ecto.Repo, adapter: Ecto.Adapters.Postgres

def conf do
config = Application.get_all_env(:elixir_china)[:postgres]
parse_url "ecto://#{config[:username]}:#{config[:password]}@#{config[:host]}/#{config[:database]}"
end
def conf do
config = Application.get_all_env(:elixir_china)[:postgres]
parse_url "ecto://#{config[:username]}:#{config[:password]}@#{config[:host]}/#{config[:database]}"
end

def priv do
app_dir(:elixir_china, "priv/repo")
end
end
def priv do
app_dir(:elixir_china, "priv/repo")
end
end
13 changes: 13 additions & 0 deletions lib/elixir_china/util.ex
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
defmodule ElixirChina.Util do
defimpl String.Chars, for: Ecto.DateTime do
def to_string(%Ecto.DateTime{year: year, month: month, day: day, hour: hour, min: min, sec: sec}) do
"#{pad year, 4}-#{pad month}-#{pad day}T#{pad hour}:#{pad min}:#{pad sec}Z"
end

defp pad(num, len \\ 2) do
num
|> Integer.to_string
|> String.rjust(len, ?0)
end
end
end
2 changes: 1 addition & 1 deletion mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ defmodule ElixirChina.Mixfile do
{:linguist, "~> 0.1.4"},
{:cowboy, "~> 1.0.0"},
{:postgrex, ">= 0.0.0"},
{:ecto, "0.2.5"},
{:ecto, "~> 0.4.0"},
{:bcrypt, github: "opscode/erlang-bcrypt"},
{:uuid, github: "okeuday/uuid"}
]
Expand Down
8 changes: 4 additions & 4 deletions mix.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
"cowboy": {:hex, :cowboy, "1.0.0"},
"cowlib": {:hex, :cowlib, "1.0.1"},
"decimal": {:hex, :decimal, "0.2.5"},
"ecto": {:hex, :ecto, "0.2.5"},
"ecto": {:hex, :ecto, "0.4.0"},
"linguist": {:hex, :linguist, "0.1.4"},
"phoenix": {:hex, :phoenix, "0.7.2"},
"plug": {:hex, :plug, "0.9.0"},
"poison": {:hex, :poison, "1.3.0"},
"poolboy": {:hex, :poolboy, "1.2.1"},
"poolboy": {:hex, :poolboy, "1.4.2"},
"postgrex": {:hex, :postgrex, "0.6.0"},
"quickrand": {:git, "https://github.com/okeuday/quickrand.git", "0395a10b94472ccbe38b62bbfa9d0fc1ddac1dd7", [tag: "v1.3.2"]},
"quickrand": {:hex, :quickrand, "1.4.0"},
"ranch": {:hex, :ranch, "1.0.0"},
"uuid": {:git, "git://github.com/okeuday/uuid.git", "f7c141c8359cd690faba0d2684b449a07db8e915", []}}
"uuid": {:git, "git://github.com/okeuday/uuid.git", "f154016f3a73075f7cf3f05be01edeea93564367", []}}
14 changes: 14 additions & 0 deletions priv/repo/migrations/20150105165702_add_comments_count_to_post.exs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
defmodule Repo.Migrations.AddCommentsCountToPost do
use Ecto.Migration

def up do
[
"ALTER TABLE posts ADD comments_count integer DEFAULT 0",
"UPDATE posts p SET comments_count=c.cnt FROM (SELECT post_id, count(*) cnt FROM comments GROUP BY post_id) c WHERE p.id=c.post_id"
]
end

def down do
"ALTER TABLE posts DROP comments_count"
end
end
78 changes: 37 additions & 41 deletions priv/static/css/app.css
Original file line number Diff line number Diff line change
@@ -1,65 +1,61 @@
.actions * {
display: inline-block;
color: white !important;
@media (max-width: 992px) {
div[role=main] {
padding: 0px;
}
}

.reply_author {
margin-left: -7px;
display: block;
text-align: center;
width: 45px;
line-height: 12px;
@media (min-width: 1600px) {
.container {
width: 1400px;
}
}

.span-danger {
background-color: #da4f49;
body {
background-color: #DBD9DB;
}

#signup-btn {
color: white;
.panel {
padding: 0;
}

.signup-signin input {
display: block;
margin-bottom: 0.5em;
.nav.category-list > li > a {
padding: 3px 6px;
}

input:focus, input:active, input:hover {
border: 1px solid #ccc !important;
box-shadow: inset 0 1px 1px rgba(0,0,0,.075) !important;
.topic > .panel-heading {
background-color: #FFFFFF;
}

.span-primary:focus, .span-primary:hover,
.span-common:focus, .span-common:hover {
border: 0px !important;
}
h1.panel-title { font-size: 36px; }
h2.panel-title { font-size: 30px; }
h3.panel-title { font-size: 24px; }

#topic_list .user_avatar {
margin-right: 1em;
margin-left: 1em;
.markdown-text {
word-break: break-all;
}

#topic_list {
border-bottom: 1px solid #f0f0f0;
.list-group-item.media {
margin-top: 0;
}

.user_avatar {
display: inline-block;
.media-body {
width: 100%;
}

.pagination {
padding-top: 5px;
padding-bottom: 5px;
margin: 0 25px;
.topics_pagination .pagination {
margin: 0;
}

.navbar .brand {
height: 0;
padding: 10px 15px !important;
margin-left: 0;
.reply .CodeMirror {
height: 160px;
}

img[alt=emoji] {
width: 20px;
height: 20px;
}
width: 20px;
height: 20px;
}

#footer {
padding: 24px 0px;
background-color: #fff;
}
10 changes: 10 additions & 0 deletions priv/static/css/bootstrap.min.css

Large diffs are not rendered by default.

56 changes: 0 additions & 56 deletions priv/static/css/icomoon/fonts/icomoon.dev.svg

This file was deleted.

Binary file removed priv/static/css/icomoon/fonts/icomoon.eot
Binary file not shown.
Loading