Skip to content
This repository has been archived by the owner on Jan 25, 2022. It is now read-only.

まとめ詳細: 「ほかのまとめを見る」を追加 #53

Merged
merged 2 commits into from
Dec 14, 2013
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
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ gem 'settingslogic'

# ページングに利用(TODO: kaminariに切り替え)
gem 'will_paginate', '~> 3.0.3'
gem 'kaminari'

# DBデータのインポート/エクスポート
gem 'yaml_db'
Expand Down
1 change: 1 addition & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -400,6 +400,7 @@ DEPENDENCIES
image_size
jquery-rails (~> 2.1.4)
jquery-ui-rails
kaminari
masonry-rails
mini_magick
mysql2
Expand Down
5 changes: 4 additions & 1 deletion app/assets/javascripts/wall.js.coffee.erb
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ window.initialize_masonry = ($container) ->
isAnimated: false
})
@.animate({ opacity: 1 })
@.infinitescroll('retrieve') unless can_scroll()
)

window.register_event_for_close_clip_detail_pane =->
Expand Down Expand Up @@ -79,7 +80,9 @@ infinitescroll_options = ->
state: {
isDestroyed: false,
isDone: false
}
},
errorCallback: ->
$('#done').removeClass('hidden')
}

window.can_scroll = ->
Expand Down
25 changes: 25 additions & 0 deletions app/assets/stylesheets/wall.css.scss.erb
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,31 @@ ul.comments li p {
letter-spacing: 0;
}

/* done */
#done a {
display: block;
margin-top: 10px;
width: 100%;
height: 50px;
line-height: 50px;
font-family: $font_gothic;
font-size: large;
font-weight: bold;
text-align: center;
color: #fa4;
background-color: #ffd;
border: 1px solid #fa0;
@include border-radius(4px);
@include transition-property(opacity);
@include transition-duration(0.25s);
opacity: 0.5;

&:hover {
text-decoration: none;
opacity: 1;
}
}



/* jQuery */
Expand Down
3 changes: 2 additions & 1 deletion app/controllers/matomes_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@ def index
def show
@matome = Matome.find(params[:id])
@matome.increment_view_count!(request)
@clips = @matome.clips
@clips = @matome.clips.page(params[:page])
@cover_clip = @clips.try(:first)
render 'home/next_page', layout: false unless first_page?
end

# GET /matomes/new
Expand Down
1 change: 1 addition & 0 deletions app/models/clip.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ class Clip < ActiveRecord::Base

before_create :create_image

# TODO: kaminari に移行する
self.per_page = Settings.page

include OpenUriSweet
Expand Down
2 changes: 2 additions & 0 deletions app/models/matome.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ class Matome < ActiveRecord::Base
attr_accessible :view_count
attr_accessible :last_access_ip

paginates_per Settings.page

def increment_view_count!(request = nil)
return false if self.last_access_ip == request.remote_ip
self.update_attributes(
Expand Down
2 changes: 1 addition & 1 deletion app/views/base/_wall.html.slim
Original file line number Diff line number Diff line change
Expand Up @@ -68,4 +68,4 @@
= form.submit 'クリップ', class: 'hidden btn'

#page-nav
= link_to 'next', page: @clips.next_page if @clips.respond_to?(:next_page) && @clips.next_page.present?
= link_to 'next', page: @clips.current_page + 1 if @clips.respond_to? :current_page
3 changes: 3 additions & 0 deletions app/views/matomes/show.html.slim
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,6 @@
== render partial: '/base/wall'
- else
p クリップが存在しません

#done.hidden
= link_to "ほかのまとめを見る", matomes_path