-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #30 from Kabie/bootstrap3
Upgrade to Bootstrap 3, Ecto 0.4.0, and some UI improvements
- Loading branch information
Showing
47 changed files
with
599 additions
and
1,155 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
priv/repo/migrations/20150105165702_add_comments_count_to_post.exs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} |
Large diffs are not rendered by default.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Binary file not shown.
Oops, something went wrong.