Module CharactersHelper
In: app/helpers/characters_helper.rb

Methods

Public Instance methods

[Source]

    # File app/helpers/characters_helper.rb, line 95
95:   def character_meanings_column(record)
96:     display_array(filter_by_language_id(record.character_meanings,session[:language_target_id]), @@MAXIMUM_TO_DISPLAY_LIST, :meaning)
97:   end

[Source]

     # File app/helpers/characters_helper.rb, line 99
 99:   def character_meanings_show_column(record)
100:     display_array(filter_by_language_id(record.character_meanings,session[:language_target_id]), @@MAXIMUM_TO_DISPLAY_SHOW, :meaning)
101:   end

[Source]

     # File app/helpers/characters_helper.rb, line 111
111:   def character_names_show_column(record)
112:     display_array(record.character_names, @@MAXIMUM_TO_DISPLAY_SHOW, :name)    
113:   end

[Source]

    # File app/helpers/characters_helper.rb, line 25
25:   def character_radicals_column(record)
26:     character_radicals = Array.new
27:     for character_radical in record.character_radicals
28:       character_radicals << link_to(character_radical.to_label, :action => :show, :id => character_radical.radical_id)
29:     end 
30:     character_radicals.join(' ')
31:   end

[Source]

    # File app/helpers/characters_helper.rb, line 33
33:   def character_radicals_popup(record)
34:     character_radicals = Array.new
35:     for character_radical in record.character_radicals
36:       character_radicals << link_to_character_of_moment_popup(character_radical.to_label, :character_id => character_radical.radical_id )
37:     end 
38:     character_radicals.join(' ')
39:   end

[Source]

     # File app/helpers/characters_helper.rb, line 103
103:   def character_readings_column(record)
104:     display_array(record.character_readings, @@MAXIMUM_TO_DISPLAY_LIST, :reading)    
105:   end

[Source]

     # File app/helpers/characters_helper.rb, line 107
107:   def character_readings_show_column(record)
108:     display_array(record.character_readings, @@MAXIMUM_TO_DISPLAY_SHOW, :reading)    
109:   end

[Source]

    # File app/helpers/characters_helper.rb, line 62
62:   def characters_label
63:     return "<h1>#{t('character_of_moment.characters')}</h1>"
64:   end

[Source]

    # File app/helpers/characters_helper.rb, line 91
91:   def comments_show_column(record)
92:     render :active_scaffold => 'comments', :constraints => { :commentable_id => record.id, :commentable_type => 'Character'}
93:   end

[Source]

    # File app/helpers/characters_helper.rb, line 66
66:   def emphasize_part(part)
67:     parts = part.split('.')
68:     case parts.size
69:     when 2
70:       return "<span class='kb_emphasis'>#{parts[0]}</span>#{parts[1]}"
71:     else
72:       return "<span class='kb_emphasis'>#{part}</span>"
73:     end
74:   end

[Source]

    # File app/helpers/characters_helper.rb, line 76
76:   def language_meanings_map(meanings)
77:     language_meanings_map = Hash.new
78:     for meaning in meanings
79:       language            = meaning.language.language
80:       language_meaning    = meaning.meaning
81:       logger.error("There is no meaning language [#{meaning.inspect}]") unless language
82:       logger.error("There is no meaning [#{meaning.inspect}]") unless language_meaning
83:       unless language_meanings_map[language]
84:         language_meanings_map[language] = Array.new
85:       end
86:       language_meanings_map[language] << language_meaning
87:     end
88:     return language_meanings_map
89:   end

[Source]

    # File app/helpers/characters_helper.rb, line 41
41:   def language_readings_map(readings)
42:     language_readings_map = Hash.new
43:     for reading in readings
44:       language            = reading.language_character_reading.to_label
45:       language_reading    = reading.reading
46:       unless language_readings_map[language]
47:         language_readings_map[language] = Array.new
48:       end
49:       language_readings_map[language] << emphasize_part(language_reading)
50:     end
51:     return language_readings_map
52:   end

[Source]

    # File app/helpers/characters_helper.rb, line 7
 7:   def radical_characters_column(record)
 8:     radical_characters = Array.new
 9:     for radical in record.radical_characters
10:       character = Character.find_by_id(radical.character.id)
11:       radical_characters << link_to(character.to_label, :action => :show, :id => character.id)
12:     end 
13:     radical_characters.join(' ')
14:   end

[Source]

    # File app/helpers/characters_helper.rb, line 16
16:   def radical_characters_of_moment(record)
17:     radical_characters = Array.new
18:     for radical in record.radical_characters
19:       character = Character.find_by_id(radical.character.id)
20:       radical_characters << link_to_character_of_moment(character)
21:     end 
22:     radical_characters.join(' ')
23:   end

[Source]

    # File app/helpers/characters_helper.rb, line 54
54:   def radicals_label
55:     return "<h1>#{t('character_of_moment.radicals')}</h1>"
56:   end

[Source]

    # File app/helpers/characters_helper.rb, line 58
58:   def readings_label
59:     return "<h1>#{t('character_of_moment.readings')}</h1>"
60:   end

[Source]

     # File app/helpers/characters_helper.rb, line 115
115:   def sentences_column(record)
116:     return [] if record.character.empty?
117:     display_array(filter_by_language_id(record.sentences, session[:language_dictionary_id]), @@MAXIMUM_TO_DISPLAY_LIST, :sentence)
118:   end

[Source]

     # File app/helpers/characters_helper.rb, line 120
120:   def sentences_show_column(record)
121:     return if record.character.empty?
122:     render :active_scaffold => 'sentences', :conditions => ['sentences.language_id = ? and sentences.sentence LIKE ?', record.language_id, '%' + record.character + '%']
123:   end

[Source]

     # File app/helpers/characters_helper.rb, line 125
125:   def words_column(record)
126:     return [] if record.character.empty?
127:     display_array(filter_by_language_id(record.words, session[:language_dictionary_id]), @@MAXIMUM_TO_DISPLAY_LIST, :spelling)
128:   end

[Source]

     # File app/helpers/characters_helper.rb, line 130
130:   def words_show_column(record)
131:     return if record.character.empty?
132:     render :active_scaffold => 'words', :conditions => ['words.language_id = ? and words.spelling LIKE ?', record.language_id, record.character+'%']
133:   end

[Validate]