Method: BaseHelper#container_title

Defined in:
app/helpers/base_helper.rb

#container_titleObject



181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
# File 'app/helpers/base_helper.rb', line 181

def container_title
  app_base = configatron.community_name
  title = app_base

  case controller.controller_name
    when 'pages'
      if @page and @page.title
        title = @page.title
      end
    when 'posts'
      if @post and @post.title
        title = @post.title
        @canonical_url = user_post_url(@post.user, @post)
      end
    when 'users'
      if @user && !@user.new_record? && @user.
        title = @user.
        @canonical_url = user_url(@user)
      else
        title = :showing_users.l
      end
    when 'photos'
      if @user and @user.
        title = :users_photos.l(:user => @user.)
      end
    when 'clippings'
      if @user and @user.
        title = :user_clippings.l(:user => @user.)
      end
    when 'tags'
      case controller.action_name
        when 'show'
          if params[:type]
            title = I18n.translate('all_' + params[:type].downcase.pluralize + '_tagged', :tag_name => @tags.map(&:name).join(', '))
          else
            title = :posts_photos_and_bookmarks.l(:name => @tags.map(&:name).join(', '))
          end
          title += " (#{:related_tags.l}: #{@related_tags.join(', ')})" if @related_tags
          @canonical_url = tag_url(URI.escape(URI.escape(@tags_raw), /[\/.?#]/)) if @tags_raw
        else
          title = "Showing tags"
        end
    when 'categories'
      if @category and @category.name
        title = :posts_photos_and_bookmarks.l(:name => @category.name)
      else
        title = :showing_categories.l
      end
    when 'sessions'
      title = :login.l
  end

  if @page_title
    title = @page_title
  elsif title == app_base
    title = :showing.l + ' ' + controller.controller_name
  end

  title
end