-
-
Notifications
You must be signed in to change notification settings - Fork 108
スマートフォン版のDojo表示を地方ごとから都道府県ごとに変更 #1701
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
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
3c3bae4
スマートフォン版のDojo表示を地方ごとから都道府県ごとに変更
nacchan99 05d8e9d
Fix nil error for @prefectures_and_dojos in stats view
nacchan99 4bc62ff
dojosリストの見た目を整理&dojo数1件時は単数形で表示
nacchan99 a177db1
fix: add missing newline at end of file
nacchan99 d75a1be
home_controller.rb のインデントを統一(L5〜L11を一段下げ)
nacchan99 ab3ff2a
dojo数の集計とラベル生成処理をヘルパーに移動し、ビューをシンプルに整理
nacchan99 31b69f4
dojo_count後と閉じdiv後の空行を削除してコードスタイルを統一
nacchan99 cb71937
ファイル末尾に改行を追加
nacchan99 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,6 +1,7 @@ | ||
class HomeController < ApplicationController | ||
def show | ||
@dojo_count = Dojo.active_dojos_count | ||
@dojo_count = Dojo.active_dojos_count | ||
@regions_and_dojos = Dojo.group_by_region_on_active | ||
@prefectures_and_dojos = Dojo.group_by_prefecture_on_active | ||
end | ||
end |
This file contains hidden or 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 @@ | ||
module DojoHelper | ||
def dojo_count_label(count) | ||
if count == 1 | ||
"#{count} Dojo" | ||
else | ||
"#{count} Dojos" | ||
end | ||
end | ||
|
||
def total_dojos_count(dojos) | ||
dojos.sum(&:counter) | ||
end | ||
end |
This file contains hidden or 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 hidden or 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,33 +1,41 @@ | ||
<div id="accordion" class="panel-group" aria-multiselectable="true" role="tablist"> | ||
<% regions_and_dojos.each_with_index do |(region, dojos), index| %> | ||
<div class="panel panel-default"> | ||
<div class="panel-heading" id="heading<%= index %>" role="tab"> | ||
<h4 class="panel-title"> | ||
<a data-toggle="collapse" | ||
href="#collapse<%= index %>" role="button"> | ||
<i class="fa fa-chevron-right" aria-hidden="true"></i> | ||
<%= region %> | ||
- <%= dojos.pluck(:counter).sum %> Dojos | ||
</a> | ||
</h4> | ||
</div> | ||
<div class="panel-collapse collapse" id="collapse<%= index %>" role="tabpanel"> | ||
<div class="panel-body grayscale-bg dojo-flex"> | ||
<%= render partial: 'shared/dojo', collection: dojos %> | ||
<% if @prefectures_and_dojos.present? %> | ||
<% @prefectures_and_dojos.each_with_index do |(prefecture, dojos), index| %> | ||
<% dojo_count = total_dojos_count(dojos) %> | ||
<div class="panel panel-default"> | ||
<div class="panel-heading" id="heading<%= index %>" role="tab"> | ||
<h4 class="panel-title"> | ||
<a data-toggle="collapse" href="#collapse<%= index %>" role="button"> | ||
<i class="fa fa-chevron-right" aria-hidden="true"></i> | ||
<%= prefecture %> - <%= dojo_count_label(dojo_count) %> | ||
</a> | ||
</h4> | ||
</div> | ||
<div class="panel-collapse collapse" id="collapse<%= index %>" role="tabpanel"> | ||
<div class="panel-body grayscale-bg dojo-flex"> | ||
<%= render partial: 'shared/dojo', collection: dojos %> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
<% end %> | ||
<% end %> | ||
</div> | ||
|
||
<script> | ||
$(document).ready(function() { | ||
$('.collapse').on('shown.bs.collapse', function() { | ||
$(this).parent().find(".fa-chevron-right").removeClass("fa-chevron-right").addClass("fa-chevron-down"); | ||
$(this) | ||
.parent() | ||
.find(".fa-chevron-right") | ||
.removeClass("fa-chevron-right") | ||
.addClass("fa-chevron-down"); | ||
}); | ||
|
||
$('.collapse').on('hidden.bs.collapse', function() { | ||
$(this).parent().find(".fa-chevron-down").removeClass("fa-chevron-down").addClass("fa-chevron-right"); | ||
$(this) | ||
.parent() | ||
.find(".fa-chevron-down") | ||
.removeClass("fa-chevron-down") | ||
.addClass("fa-chevron-right"); | ||
}); | ||
}); | ||
</script> | ||
</script> |
This file contains hidden or 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 |
---|---|---|
|
@@ -18,4 +18,4 @@ | |
</a> | ||
</li> | ||
<%# コメントアウトされたLINEのボタンは省略 %> | ||
</ol> | ||
</ol> |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.