about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--app/assets/stylesheets/main/entries.scss50
-rw-r--r--app/assets/stylesheets/main/layout.scss4
-rw-r--r--app/controllers/blogs_controller.rb3
-rw-r--r--app/controllers/tags_controller.rb2
-rw-r--r--app/views/blogs/_list.html.haml5
-rw-r--r--app/views/blogs/summary.html.haml4
-rw-r--r--app/views/tags/show.html.haml6
7 files changed, 70 insertions, 4 deletions
diff --git a/app/assets/stylesheets/main/entries.scss b/app/assets/stylesheets/main/entries.scss index 1a42d85..a4e9463 100644 --- a/app/assets/stylesheets/main/entries.scss +++ b/app/assets/stylesheets/main/entries.scss
@@ -305,3 +305,53 @@
305 } 305 }
306 } 306 }
307} 307}
308
309.pagination {
310 text-align: center;
311 padding: 0.3em;
312 cursor: default;
313 margin-bottom: 1em;
314
315 a, span, em {
316 padding: 0.2em 0.5em;
317 }
318
319 .disabled {
320 color: #aaaaaa;
321 }
322
323 .current {
324 font-style: normal;
325 font-weight: bold;
326 color: #ff0084;
327 }
328
329 a {
330 border: 1px solid #dddddd;
331 color: #0063dc;
332 text-decoration: none;
333
334 &:hover, &:focus {
335 border-color: #003366;
336 background: #0063dc;
337 color: white;
338 }
339 }
340
341 .page_info {
342 color: #aaaaaa;
343 padding-top: 0.8em;
344 }
345
346 .previous_page, .next_page {
347 border-width: 2px;
348 }
349
350 .previous_page {
351 margin-right: 1em;
352 }
353
354 .next_page {
355 margin-left: 1em;
356 }
357}
diff --git a/app/assets/stylesheets/main/layout.scss b/app/assets/stylesheets/main/layout.scss index 9283f36..281d820 100644 --- a/app/assets/stylesheets/main/layout.scss +++ b/app/assets/stylesheets/main/layout.scss
@@ -203,3 +203,7 @@ blockquote.bubble.bottom::after {
203.clear { 203.clear {
204 clear: both; 204 clear: both;
205} 205}
206
207h2.centered {
208 text-align: center;
209}
diff --git a/app/controllers/blogs_controller.rb b/app/controllers/blogs_controller.rb index c35a05d..39a578a 100644 --- a/app/controllers/blogs_controller.rb +++ b/app/controllers/blogs_controller.rb
@@ -2,6 +2,9 @@ class BlogsController < ApplicationController
2 2
3 def summary 3 def summary
4 @blogs = Blog.where(published: true).order(published_at: :desc).paginate(page: params[:page], per_page: 10) 4 @blogs = Blog.where(published: true).order(published_at: :desc).paginate(page: params[:page], per_page: 10)
5 if not params[:page]
6 @main_page = true
7 end
5 end 8 end
6 9
7 def index 10 def index
diff --git a/app/controllers/tags_controller.rb b/app/controllers/tags_controller.rb index cf5d50b..bceb3cf 100644 --- a/app/controllers/tags_controller.rb +++ b/app/controllers/tags_controller.rb
@@ -1,8 +1,8 @@
1class TagsController < ApplicationController 1class TagsController < ApplicationController
2 2
3 def show 3 def show
4 @tag_name = params[:name]
4 @blogs = Blog.tagged_with(params[:name]).where(published: true).order(published_at: :desc).paginate(page: params[:page], per_page: 10) 5 @blogs = Blog.tagged_with(params[:name]).where(published: true).order(published_at: :desc).paginate(page: params[:page], per_page: 10)
5 render "blogs/summary"
6 end 6 end
7 7
8 def suggest 8 def suggest
diff --git a/app/views/blogs/_list.html.haml b/app/views/blogs/_list.html.haml new file mode 100644 index 0000000..3618bdb --- /dev/null +++ b/app/views/blogs/_list.html.haml
@@ -0,0 +1,5 @@
1- if not @main_page
2 = will_paginate @blogs
3- @blogs.each do |blog|
4 = render blog, short: true
5= will_paginate @blogs
diff --git a/app/views/blogs/summary.html.haml b/app/views/blogs/summary.html.haml index e9639ca..79811b1 100644 --- a/app/views/blogs/summary.html.haml +++ b/app/views/blogs/summary.html.haml
@@ -1,3 +1 @@
1- @blogs.each do |blog| = render "list"
2 = render blog, short: true
3= will_paginate @blogs
diff --git a/app/views/tags/show.html.haml b/app/views/tags/show.html.haml new file mode 100644 index 0000000..1d34b37 --- /dev/null +++ b/app/views/tags/show.html.haml
@@ -0,0 +1,6 @@
1- title "Tag #{@tag_name}"
2%h2.centered
3 Blog posts tagged
4 = surround "\"" do
5 = @tag_name
6= render "blogs/list"