Skip to content

Commit

Permalink
Merge pull request #887 from kenichiice/fix-for-category-legacy
Browse files Browse the repository at this point in the history
category-legacy.rb使用時に全カテゴリ表示が正しく表示されない
  • Loading branch information
tdtds committed Jun 6, 2020
2 parents 21d8b51 + 1a48b3f commit 74e717f
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 3 deletions.
6 changes: 4 additions & 2 deletions js/category.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ $(function(){
});

// reverse list of category
var list = $('ul.category li').toArray().reverse();
$('ul.category').empty().append(list);
$('ul.category').each(function(){
var ul = $(this);
ul.append(ul.children().toArray().reverse());
});
});
6 changes: 5 additions & 1 deletion misc/plugin/category-legacy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -597,7 +597,7 @@ def category_edit_support_dropdown
ret
end

if @conf['category.edit_support'] != 0 then
if @mode =~ /^(form|edit)$/ and @conf['category.edit_support'] != 0 then
enable_js( 'category.js' )
add_edit_proc do |date|
ret = ''
Expand All @@ -611,6 +611,9 @@ def category_edit_support_dropdown
end
end

if @mode =~ /^categoryview$/ and @conf['category.show_reverse']
enable_js('category.js')
end

#
# when update diary, update cache
Expand Down Expand Up @@ -695,6 +698,7 @@ def category_icon_sample
@conf["category.period"] = @cgi.params["category.period"][0]
end
@conf['category.edit_support'] = (@cgi.params['category.edit_support'][0] || '1').to_i
@conf['category.show_reverse'] = !!(@cgi.params['category.show_reverse'][0] == 'true')
end
category_conf_html
end
Expand Down
5 changes: 5 additions & 0 deletions misc/plugin/en/category-legacy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,11 @@ def category_conf_html
</select>
</p>
<h3 class="subtitle">Display Order</h3>
<p><label for="category.show_reverse">
<input type="checkbox" id="category.show_reverse" name="category.show_reverse" value="true"#{" checked" if @conf['category.show_reverse']}>Sorts the list from newest to oldest
</label></p>
<h3 class="subtitle">Default period</h3>
<p>
Specify the default display period for category view.
Expand Down
5 changes: 5 additions & 0 deletions misc/plugin/ja/category-legacy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,11 @@ def category_conf_html
</select>
</p>
<h3 class="subtitle">表示順</h3>
<p><label for="category.show_reverse">
<input type="checkbox" id="category.show_reverse" name="category.show_reverse" value="true"#{" checked" if @conf['category.show_reverse']}>リストを新しい順に表示
</label></p>
<h3 class="subtitle">表示期間の初期状態</h3>
<p>
カテゴリ表示画面を表示した時の、最初の表示期間を指定します。
Expand Down

0 comments on commit 74e717f

Please sign in to comment.