]> git.openstreetmap.org Git - rails.git/commitdiff
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 165f4130621162208996584dc6aca905616439e3..2599bd479dd24ec15e901d042913da3297996ac4 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 6e42e0306df1b53e14bcf8fa7d991ef81bf0dc76..b8a4955d4c29247d756715a1f5426ced73f5d74a 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 ccb7521d78415d56e02245ca4d135e0c05691241..3e77d979705a5dbc0bf5dee688c0a5aba684347c 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