misc/plugin/category.rb in tdiary-4.0.2.20140201 vs misc/plugin/category.rb in tdiary-4.0.3

- old
+ new

@@ -26,11 +26,11 @@ @category_icon = {} @conf['category.icon'].split(/\n/).each do |l| c, i = l.split next if c.nil? or i.nil? - @category_icon[c] = i if File.exists?("#{@category_icon_dir}#{i}".untaint) + @category_icon[c] = i if File.exist?("#{@category_icon_dir}#{i}".untaint) end end category_icon_init # @@ -40,11 +40,11 @@ # don't you need this method any more? end def category_anchor(category) period = @conf['category.period'] || 'quarter' - period_string = + period_string = case period when "month" "year=#{@date.year};month=#{'%02d' % @date.month};" when "quarter" "year=#{@date.year};month=#{(@date.month - 1) / 3 + 1}Q;" @@ -176,10 +176,10 @@ info = Category::Info.new(@cgi, @years, @conf) category = info.category if category.empty? return '' if @cgi.mobile_agent? - category = ['ALL'] + category = ['ALL'] end options = '' (['ALL'] + @categories.sort_by{|e| e.downcase}).each do |c| options << %Q|\t\t<option value="#{h c}"#{" selected" if category.include?(c)}>#{h c}</option>\n|