diary entries (list and rss) for a given language.
authorŠtefan Baebler <stefan.baebler@gmail.com>
Fri, 12 Jun 2009 06:34:18 +0000 (06:34 +0000)
committerŠtefan Baebler <stefan.baebler@gmail.com>
Fri, 12 Jun 2009 06:34:18 +0000 (06:34 +0000)
TODO: language rss link, linking the localized lists

app/controllers/diary_entry_controller.rb
config/locales/en.yml
config/locales/sl.yml

index 165f413..2599bd4 100644 (file)
@@ -68,6 +68,12 @@ class DiaryEntryController < ApplicationController
 
         render :action => 'no_such_user', :status => :not_found
       end
+    elsif params[:language]
+      @title = t 'diary_entry.list.in_language_title', :language => Language.find(params[:language]).english_name
+      @entry_pages, @entries = paginate(:diary_entries, :include => :user,
+                                        :conditions => ["users.visible = ? AND diary_entries.language_code = ?", true, params[:language]],
+                                        :order => 'created_at DESC',
+                                        :per_page => 20)
     else
       @title = t 'diary_entry.list.title'
       @entry_pages, @entries = paginate(:diary_entries, :include => :user,
@@ -93,10 +99,10 @@ class DiaryEntryController < ApplicationController
       end
     elsif params[:language]
       @entries = DiaryEntry.find(:all, :include => :user,
-        :conditions => ["users.visible = ? AND diary_entries.language = ?", true, params[:language]],
+        :conditions => ["users.visible = ? AND diary_entries.language_code = ?", true, params[:language]],
         :order => 'created_at DESC', :limit => 20)
-      @title = "OpenStreetMap diary entries in #{params[:language]}"
-      @description = "Recent diary entries from users of OpenStreetMap"
+      @title = "OpenStreetMap diary entries in #{Language.find(params[:language]).english_name}"
+      @description = "Recent diary entries from users of OpenStreetMap in #{Language.find(params[:language]).english_name} language"
       @link = "http://#{SERVER_URL}/diary/#{params[:language]}"
     else
       @entries = DiaryEntry.find(:all, :include => :user,
index 6e42e03..b8a4955 100644 (file)
@@ -247,6 +247,7 @@ en:
     list:
       title: "Users' diaries"
       user_title: "{{user}}'s diary"
+      in_language_title: "Diary entries in {{language}} language"
       new: New Diary Entry
       new_title: Compose a new entry in your user diary
       no_entries: No diary entries
index ccb7521..3e77d97 100644 (file)
@@ -245,7 +245,8 @@ sl:
       title: Nov zapis v dnevnik uporabnikov
     list:
       title: "Dnevniki uporabnikov"
-      user_title: "Dnavnik uporabnika {{user}}"
+      user_title: "Dnevnik uporabnika {{user}}"
+      in_language_title: "Dnevniki v jeziku {{language}}"
       new: Nov zapis v dnevnik uporabnikov
       new_title: Napišite nov zapis v vaš uporabniški dnevnik
       no_entries: Ni zapisov v dnevnik