discussion topics i18n

Change-Id: If789a2abdcaac911f4ed8181b2a11eb023dd2666
Reviewed-on: https://gerrit.instructure.com/4121
Reviewed-by: Jon Jensen <jon@instructure.com>
Tested-by: Hudson <hudson@instructure.com>
This commit is contained in:
JT Olds 2011-06-08 16:29:03 -06:00
parent ebe1c46d0c
commit 9b31d0fb19
8 changed files with 94 additions and 103 deletions

View File

@ -19,7 +19,7 @@
class DiscussionTopicsController < ApplicationController
before_filter :require_context, :except => :public_feed
add_crumb("Discussions", :except => [:public_feed]) { |c| c.send :named_context_url, c.instance_variable_get("@context"), :context_discussion_topics_url }
add_crumb(lambda { t('#crumbs.discussions', "Discussions")}, :except => [:public_feed]) { |c| c.send :named_context_url, c.instance_variable_get("@context"), :context_discussion_topics_url }
before_filter { |c| c.active_tab = "discussions" }
def index
@ -42,7 +42,7 @@ class DiscussionTopicsController < ApplicationController
if authorized_action(@context, @current_user, :moderate_forum)
@topics = @context.discussion_topics
@topics.first.update_order(params[:order].split(",").map{|id| id.to_i}.reverse) unless @topics.empty?
flash[:notice] = "Topics successfully reordered"
flash[:notice] = t :reordered_topics_notice, "Topics successfully reordered"
redirect_to named_context_url(@context, :context_discussion_topics_url)
end
end
@ -66,7 +66,7 @@ class DiscussionTopicsController < ApplicationController
@context.assert_assignment_group rescue nil
add_crumb(@topic.title, named_context_url(@context, :context_discussion_topic_url, @topic.id))
if @topic.deleted?
flash[:notice] = "That topic has been deleted"
flash[:notice] = t :deleted_topic_notice, "That topic has been deleted"
redirect_to named_context_url(@context, :context_discussion_topics_url)
return
end
@ -88,7 +88,7 @@ class DiscussionTopicsController < ApplicationController
@topics = @topic.child_topics.to_a
@topics = @topics.select{|t| @groups.include?(t.context) } unless @topic.grants_right?(@current_user, session, :update)
@group_entry = @topic.discussion_entries.build(:message => render_to_string(:partial => 'group_assignment_discussion_entry'))
@group_entry.new_record_header = "Group Discussion"
@group_entry.new_record_header = t '#titles.group_discussion', "Group Discussion"
@topic_uneditable = true
@entries = [@group_entry]
end
@ -105,7 +105,7 @@ class DiscussionTopicsController < ApplicationController
log_asset_access(@topic, 'topics', 'topics')
respond_to do |format|
if @topic.deleted?
flash[:notice] = "That topic has been deleted"
flash[:notice] = t :deleted_topic_notice, "That topic has been deleted"
format.html { redirect_to named_context_url(@context, :discussion_topics_url) }
elsif @topics && @topics.length == 1 && !@topic.grants_right?(@current_user, session, :update)
format.html { redirect_to named_context_url(@topics[0].context, :context_discussion_topics_url, :root_discussion_topic_id => @topic.id) }
@ -187,7 +187,7 @@ class DiscussionTopicsController < ApplicationController
@topic.attachment = @attachment
@topic.save
end
flash[:notice] = 'Topic was successfully created.'
flash[:notice] = t :topic_created_notice, 'Topic was successfully created.'
format.html { redirect_to named_context_url(@context, :context_discussion_topic_url, @topic) }
format.xml { head :created, :location => named_context_url(@context, :context_discussion_topic_url, @topic) }
format.json { render :json => @topic.to_json(:include => [:assignment,:attachment], :methods => :user_name, :permissions => {:user => @current_user, :session => session}), :status => :created }
@ -241,7 +241,7 @@ class DiscussionTopicsController < ApplicationController
@topic.attachment = @attachment
@topic.save
end
flash[:notice] = 'Topic was successfully updated.'
flash[:notice] = t :topic_updated_notice, 'Topic was successfully updated.'
format.html { redirect_to named_context_url(@context, :context_discussion_topic_url, @topic) }
format.xml { head :ok }
format.json { render :json => @topic.to_json(:include => [:assignment, :attachment], :methods => :user_name, :permissions => {:user => @current_user, :session => session}), :status => :ok }
@ -271,7 +271,7 @@ class DiscussionTopicsController < ApplicationController
def public_feed
return unless get_feed_context
feed = Atom::Feed.new do |f|
f.title = "#{@context.name} Discussion Feed"
f.title = t :discussion_feed_title, "%{title} Discussion Feed", :title => @context.name
f.links << Atom::Link.new(:href => named_context_url(@context, :context_discussion_topics_url))
f.updated = Time.now
f.id = named_context_url(@context, :context_discussion_topics_url)

View File

@ -64,7 +64,7 @@ class DiscussionTopic < ActiveRecord::Base
def default_values
self.context_code = "#{self.context_type.underscore}_#{self.context_id}"
self.title ||= "No Title"
self.title ||= t :default_title, "No Title"
@content_changed = self.message_changed? || self.title_changed?
if self.assignment_id != self.assignment_id_was
@old_assignment_id = self.assignment_id_was
@ -347,9 +347,10 @@ class DiscussionTopic < ActiveRecord::Base
end
def to_atom(opts={})
prefix = self.is_announcement ? "Announcement" : "Discussion"
prefix = [self.is_announcement ? t('#titles.announcement', "Announcement") : t('#titles.discussion', "Discussion")]
prefix << self.context.name if opts[:include_context]
Atom::Entry.new do |entry|
entry.title = "#{prefix}#{", " + self.context.name if opts[:include_context]}: #{self.title}"
entry.title = [before_label(prefix.to_sentence), self.title].join(" ")
entry.updated = self.updated_at
entry.published = self.created_at
entry.id = "tag:#{HostUrl.default_host},#{self.created_at.strftime("%Y-%m-%d")}:/discussion_topics/#{self.feed_code}"
@ -391,7 +392,7 @@ class DiscussionTopic < ActiveRecord::Base
end
def user_name
self.user.name rescue "User Name"
self.user.name rescue t :default_user_name, "User Name"
end
def locked_for?(user=nil, opts={})
@ -507,7 +508,7 @@ class DiscussionTopic < ActiveRecord::Base
item.migration_id = hash[:migration_id]
item.title = hash[:title]
item.message = ImportedHtmlConverter.convert(hash[:description] || hash[:text], context)
item.message = "No message" if item.message.blank?
item.message = t(:empty_message, "No message") if item.message.blank?
item.posted_at = Canvas::MigratorHelper.get_utc_time_from_timestamp(hash[:posted_at]) if hash[:posted_at]
item.delayed_post_at = Canvas::MigratorHelper.get_utc_time_from_timestamp(hash[:delayed_post_at]) if hash[:delayed_post_at]
item.delayed_post_at ||= Canvas::MigratorHelper.get_utc_time_from_timestamp(hash[:start_date]) if hash[:start_date]
@ -596,7 +597,7 @@ class DiscussionTopic < ActiveRecord::Base
asset = elem.podcast_associated_asset
next unless asset
item = RSS::Rss::Channel::Item.new
item.title = (asset.title rescue "") + ": " + elem.name
item.title = before_label((asset.title rescue "")) + elem.name
link = nil
if asset.is_a?(DiscussionTopic)
link = "http://#{HostUrl.context_host(asset.context)}/#{asset.context_url_prefix}/discussion_topics/#{asset.id}"

View File

@ -29,7 +29,7 @@
<% if @topic_agglomerated && entry %>
<a href="<%= context_url(entry_context, :context_discussion_topic_url, entry ? entry.discussion_topic_id : '{{ topic_id }}') %>" style="font-weight: bold;"><%= entry.context.name %></a>
<% end %>
<a title="Author's name" href="<%= context_url(entry_context, :context_user_url, user_id) %>" class="user_name"><%= context_user_name(@context, entry && entry.user_id) %></a>
<a title="<%= t :authors_name, "Author's name" %>" href="<%= context_url(entry_context, :context_user_url, user_id) %>" class="user_name"><%= context_user_name(@context, entry && entry.user_id) %></a>
<% end %>
</div>
<div class="teaser_message"></div>
@ -37,14 +37,14 @@
<div class="link_box">
<span class="links">
<% if !@topic_agglomerated && (!entry || !entry.new_record?) %>
<a href="<%= context_url(entry_context, :new_context_discussion_entry_url) %>" class="add_entry_link disabled_link atr-reply">Reply to this Message</a>
<a href="<%= context_url(entry_context, :edit_context_discussion_entry_url, entry_id) %>" class="edit_entry_link disabled_link atr-edit">Edit this Message</a>
<a href="<%= context_url(entry_context, :context_discussion_entry_url, entry_id) %>" class="delete_entry_link disabled_link atr-delete">Delete this Message</a>
<a href="<%= context_url(entry_context, :new_context_discussion_entry_url) %>" class="add_entry_link disabled_link atr-reply"><%= t :reply_to_message, "Reply to this Message" %></a>
<a href="<%= context_url(entry_context, :edit_context_discussion_entry_url, entry_id) %>" class="edit_entry_link disabled_link atr-edit"><%= t :edit_message, "Edit this Message" %></a>
<a href="<%= context_url(entry_context, :context_discussion_entry_url, entry_id) %>" class="delete_entry_link disabled_link atr-delete"><%= t :delete_message, "Delete this Message" %></a>
<% end %>
</span>
</div>
<% end %>
<div class="post_date time_ago_date"><%= entry.try_rescue(:created_at).try_rescue(:strftime, "%b %d at %I:%M%p") || "Date Created" %></div>
<div class="post_date time_ago_date"><%= entry.try_rescue(:created_at).tap{|time| time && datetime_string(time)} %></div>
<div class="clear"></div>
<% end %>
</div>
@ -55,7 +55,7 @@
<textarea class="message_html" style="display: none;"><%= h(entry.try_rescue(:message)) %></textarea>
<div class="link_box">
<div class="attachment_data" style="<%= hidden unless entry && entry.attachment %>; float: left;">
Attached File: <a href="<%= context_url(entry_context, :context_file_download_url, entry && entry.attachment ? entry.attachment_id : "{{ attachment_id }}") %>" class="attachment_name"><%= entry.try_rescue(:attachment).try_rescue(:display_name) || nbsp %></a>
<%= before_label :attached_file, "Attached File" %> <a href="<%= context_url(entry_context, :context_file_download_url, entry && entry.attachment ? entry.attachment_id : "{{ attachment_id }}") %>" class="attachment_name"><%= entry.try_rescue(:attachment).try_rescue(:display_name) || nbsp %></a>
<a href="<%= context_url(entry_context, :context_file_download_url, "{{ attachment_id }}") %>" class="entry_attachment_url" style="display: none;">&nbsp;</a>
</div>
<div class="clear"></div>
@ -68,7 +68,7 @@
<% if entries.length > 3 %>
<div class="communication_sub_message">
<div class="content behavior_content">
<a href="#" class="show_sub_messages_link">Show <%= pluralize(entries.length - 2, "More Entry") %></a>
<a href="#" class="show_sub_messages_link"><%= t :show_more_entries, { :one => "Show 1 More Entry", :other => "Show %{count} More Entries" }, :count => (entries.length - 2) %></a>
</div>
</div>
<% end %>
@ -78,12 +78,12 @@
<% end %>
<% if entry && entry.editor_id && entry.editor_id != entry.user_id %>
<div style="font-size: 0.8em;">
This comment was edited by <%= link_to(context_user_name(entry_context, entry.editor_id), context_url(entry_context, :context_user_url, entry.editor_id)) %>.
<%= t :edited_comment, "This comment was edited by %{user}.", :user => link_to(context_user_name(entry_context, entry.editor_id), context_url(entry_context, :context_user_url, entry.editor_id)) %>
</div>
<% end %>
<div class="communication_sub_message reply_message <%= 'lonely_behavior_message' if entries.empty? %>" style="display: none;">
<div class="content behavior_content">
<a href="#" class="add_entry_link textarea">Make a Side Comment...</a>
<a href="#" class="add_entry_link textarea"><%= t :make_side_comment, "Make a Side Comment..." %></a>
</div>
</div>
<%= render :partial => 'discussion_topics/sub_entry', :object => nil, :locals => {:parent_entry => entry || topic} %>

View File

@ -1,9 +1,9 @@
The conversation for this topic has been separated into separate groups. Below are all the group topics you have access to.
<%= t :separated_conversation_notice, "The conversation for this topic has been separated into separate groups. Below are all the group topics you have access to." %>
<ul class="unstyled_list" style="line-height: 1.8em; margin: 5px 20px 10px;">
<% @groups.select{|g| can_do(g, @current_user, :read) }.each do |group| %>
<li class="unstyled_list">
<% cnt = (@topics || []).find{|t| t.context_id == group.id && t.context_type == group.class.to_s}.discussion_entries.count rescue 0 %>
<b><a href="<%= context_url(group, :context_discussion_topics_url, :root_discussion_topic_id => @topic.id) %>"><%= group.name %></a></b> - <%= pluralize(cnt, 'Post') %>
<b><a href="<%= context_url(group, :context_discussion_topics_url, :root_discussion_topic_id => @topic.id) %>"><%= group.name %></a></b> - <%= t :posts, "Post", :count => cnt %>
</li>
<% end %>
</ul>

View File

@ -2,7 +2,7 @@
<div id="<%= "entry_#{entry.id}" if entry %>" style="<%= hidden unless entry %>" class="communication_sub_message <%= 'toggled_communication_sub_message' if hide_entry %> <%= 'blank' unless entry %>">
<div class="header">
<div class="header_title">
<a title="Author's name" href="<%= context_url(entry_context, :context_user_url, entry ? entry.user_id : nil) %>" class="user_name">
<a title="<%= t :authors_name, "Author's name" %>" href="<%= context_url(entry_context, :context_user_url, entry ? entry.user_id : nil) %>" class="user_name">
<%= context_user_name(entry ? entry.context : nil, entry ? entry.user_id : nil) %>
</a>
</div>
@ -23,8 +23,8 @@
<%= f.hidden_field :parent_id, :value => parent_entry.id, :class => "parent_id" %>
<%= f.text_area :message, :style => "height: 200px;", :class => "rich_text" %>
<div class="button-container" style="padding-bottom: 5px;">
<button type="submit" class="button small-button submit_button">Post Message</button>
<button type="button" class="button button-secondary cancel_button">Cancel</button>
<button type="submit" class="button small-button submit_button"><%= t :post_message, "Post Message" %></button>
<button type="button" class="button button-secondary cancel_button"><%= t "#buttons.cancel", "Cancel" %></button>
</div>
<% end %>
<% end %>

View File

@ -1,10 +1,10 @@
<% content_for :page_title do %>Discussions: <%= @context.name %><% end %>
<% content_for :page_title do %><%= before_label(t('#titles.discussions', "Discussions")) %> <%= @context.name %><% end %>
<% content_for :auto_discovery do %>
<% if @context_enrollment %>
<%= auto_discovery_link_tag(:atom, feeds_forum_format_path(@context_enrollment.feed_code, :atom), {:title => "Course Discussions Atom Feed"}) %>
<%= auto_discovery_link_tag(:atom, feeds_forum_format_path(@context_enrollment.feed_code, :atom), {:title => t(:course_discussions_atom_feed_title, "Course Discussions Atom Feed")}) %>
<% elsif @context.available? %>
<%= auto_discovery_link_tag(:atom, feeds_forum_format_path(@context.feed_code, :atom), {:title => "Course Discussions Atom Feed"}) %>
<%= auto_discovery_link_tag(:atom, feeds_forum_format_path(@context.feed_code, :atom), {:title => t(:course_discussions_atom_feed_title, "Course Discussions Atom Feed")}) %>
<% end %>
<% end %>
@ -12,42 +12,24 @@
<div id="sidebar_content" class="rs-margin-lr rs-margin-top">
<div>
<% if can_do(@context.discussion_topics.new, @current_user, :create) %>
<a href="#" class="add_topic_link button button-sidebar-wide"><%= image_tag 'add.png', :alt => '' %> Start a New Topic</a>
<a href="<%= context_url(@context, :context_announcements_url) %>" class="button button-sidebar-wide" style="display: none;"><%= image_tag 'announcement_icon.png', :alt => '' %> Manage Announcements</a>
<a href="#" class="add_topic_link button button-sidebar-wide"><%= image_tag 'add.png', :alt => '' %> <%= t :start_new_topic, "Start a New Topic" %></a>
<a href="<%= context_url(@context, :context_announcements_url) %>" class="button button-sidebar-wide" style="display: none;"><%= image_tag 'announcement_icon.png', :alt => '' %> <%= t :manage_announcements, "Manage Announcements" %></a>
<% if can_do(@context, @current_user, :moderate_forum) %>
<a href="#" class="reorder_topics_link button button-sidebar-wide"><%= image_tag 'move-ns.png', :alt => '' %> Reorder Topics</a>
<a href="#" class="reorder_topics_link button button-sidebar-wide"><%= image_tag 'move-ns.png', :alt => '' %> <%= t "#buttons.reorder_topics", "Reorder Topics" %></a>
<% end %>
<% end %>
</div>
<!-- TODO: fix the counts
<table class="summary">
<tr>
<th>Recent</td>
<td style="font-size: 0.8em; line-height: 1.7em;">
<% @topics.select{|t| t.last_reply_at > (Time.now - 14.days) }[0,5].each do |topic| %>
<a href="<%= context_url(@context, :context_discussion_topic_url, topic.id) %>" class="<%= topic.is_announcement ? "announcement-icon-small" : "discussion-icon-small" %>"><%= topic.title %></a><br/>
<% end %>
</td>
</tr><tr>
<th>Totals</th>
<td>
<%= pluralize(@context.discussion_topics.active.count - @context.announcements.active.count, "Topic") %><br/>
<%= pluralize(@context.announcements.active.count, "Announcement") %>
</td>
</tr>
</table>
-->
<div>
<% if params[:include_announcements] == "1" %>
<a href="<%= context_url(@context, :context_discussion_topics_url) %>" class="button button-sidebar-wide"><%= image_tag 'word_bubble.png', :alt => '' %> View Only Topics</a>
<a href="<%= context_url(@context, :context_discussion_topics_url) %>" class="button button-sidebar-wide"><%= image_tag 'word_bubble.png', :alt => '' %> <%= t :view_only_topics, "View Only Topics" %></a>
<% else %>
<a href="<%= context_url(@context, :context_discussion_topics_url, :include_announcements => "1") %>" class="button button-sidebar-wide"><%= image_tag 'word_bubble.png', :alt => '' %> View Topics and Announcements</a>
<a href="<%= context_url(@context, :context_discussion_topics_url, :include_announcements => "1") %>" class="button button-sidebar-wide"><%= image_tag 'word_bubble.png', :alt => '' %> <%= t :view_topics_and_announcements, "View Topics and Announcements" %></a>
<% end %>
</div>
</div>
<%= render :partial => "shared/wiki_sidebar" %>
<% end %>
<h2>Discussions</h2>
<h2><%= t "#titles.discussions", "Discussions" %></h2>
<% js_block do %><%= javascript_include_tag "tinymce/jscripts/tiny_mce/tiny_mce.js" %><% end %>
<% jammit_js :topics %>
@ -59,7 +41,7 @@
$('#topic_list').pageless({
totalPages: <%= @topics.total_pages %>,
url: "<%= context_url(@context, :context_discussion_topics_url, :format => :json, :only_discussion_topics => params[:only_discussion_topics]) %>",
loaderMsg: "Loading more results",
loaderMsg: I18n.t("loading_results", "Loading more results"),
scrape: function(data) {
if(typeof(data) == 'string') {
try {
@ -81,16 +63,15 @@
<div id="reorder_topics_dialog" style="display: none;">
<% form_for :discussion_topic, :url => context_url(@context, :reorder_context_discussion_topics_url), :html => {:id => "reorder_topics_form"} do %>
<input type="hidden" name="order" value="" id="reorder_topics_ids"/>
You can manually define the order in which discussions will appear.
Click and drag any topic to change where it will appear in the list.
<%= t :drag_and_drop_notice, "You can manually define the order in which discussions will appear. Click and drag any topic to change where it will appear in the list." %>
<ul id="topics_reorder_list" class="unstyled_list">
<% @all_topics[0..50].each do |topic| %>
<li class="topic topic_<%= topic.id %>"><%= topic.title %></li>
<% end %>
</ul>
<div class="button-container">
<button class="button reorder_topics_button" type="submit">Reorder Topics</button>
<button class="button button-secondary cancel_button" type="button">Cancel</button>
<button class="button reorder_topics_button" type="submit"><%= t :reorder_topics, "Reorder Topics" %></button>
<button class="button button-secondary cancel_button" type="button"><%= t "#buttons.cancel", "Cancel" %></button>
</div>
<% end %>
</div>
@ -115,6 +96,6 @@
<% if @context.try_rescue(:module_based?) && !can_do(@context, @current_user, :manage_content) %>
<a href="<%= context_url(@context, :context_locks_url) %>" id="discussion_topic_locks_url" style="display: none;">&nbsp;</a>
<%= image_tag "lock.png", :style => "display: none;", :id => "discussion_topic_lock_icon", :title => "This topic is currently locked. Visit the topic details page for more information.", :alt => "locked" %>
<%= image_tag "lock.png", :style => "display: none;", :id => "discussion_topic_lock_icon", :title => t(:locked_message, "This topic is currently locked. Visit the topic details page for more information."), :alt => t(:locked_title, "locked") %>
<% end %>

View File

@ -1,15 +1,15 @@
<% content_for :page_title do %>Topic: <%= @topic.title %><% end %>
<% content_for :page_title do %><%= before_label :topic, "Topic" %> <%= @topic.title %><% end %>
<% content_for :auto_discovery do %>
<% if @context_enrollment %>
<%= auto_discovery_link_tag(:atom, feeds_topic_format_path(@topic.id, @context_enrollment.feed_code, :atom), {:title => "Discussion Atom Feed"}) %>
<%= auto_discovery_link_tag(:atom, feeds_topic_format_path(@topic.id, @context_enrollment.feed_code, :atom), {:title => t(:discussion_atom_feed_title, "Discussion Atom Feed")}) %>
<% if @topic.podcast_enabled %>
<%= auto_discovery_link_tag(:rss, feeds_topic_format_path(@topic.id, @context_enrollment.feed_code, :rss), {:title => "Discussion Podcast Feed"}) %>
<%= auto_discovery_link_tag(:rss, feeds_topic_format_path(@topic.id, @context_enrollment.feed_code, :rss), {:title => t(:discussion_podcast_feed_title, "Discussion Podcast Feed")}) %>
<% end %>
<% elsif @context.available? %>
<%= auto_discovery_link_tag(:atom, feeds_topic_format_path(@topic.id, @context.feed_code, :atom), {:title => "Discussion Atom Feed"}) %>
<%= auto_discovery_link_tag(:atom, feeds_topic_format_path(@topic.id, @context.feed_code, :atom), {:title => t(:discussion_atom_feed_title, "Discussion Atom Feed")}) %>
<% if @topic.podcast_enabled %>
<%= auto_discovery_link_tag(:rss, feeds_topic_format_path(@topic.id, @context.feed_code, :rss), {:title => "Discussion Podcast Feed"}) %>
<%= auto_discovery_link_tag(:rss, feeds_topic_format_path(@topic.id, @context.feed_code, :rss), {:title => t(:discussion_podcast_feed_title, "Discussion Podcast Feed")}) %>
<% end %>
<% end %>
<% end %>
@ -18,39 +18,38 @@
<% content_for :right_side do %>
<% if @topic_uneditable %>
<div class="rs-margin-lr">
The conversation for this topic has been separated into separate groups. Below are the list of group topics you have access to.
<%= t :separated_conversation_notice, "The conversation for this topic has been separated into separate groups. Below are the list of group topics you have access to." %>
<ul class="unstyled_list" style="line-height: 1.8em; margin: 5px 20px 10px;">
<% @groups.select{|g| can_do(g, @current_user, :read) }.each do |group| %>
<li class="unstyled_list">
<% cnt = (@topics || []).find{|t| t.context == group}.discussion_entries.count rescue 0 %>
<b><a href="<%= context_url(group, :context_discussion_topics_url, :root_discussion_topic_id => @topic.id) %>"><%= group.name %></a></b> - <%= pluralize(cnt, 'Post') %>
<b><a href="<%= context_url(group, :context_discussion_topics_url, :root_discussion_topic_id => @topic.id) %>"><%= group.name %></a></b> - <%= t :post_count, "Post", :count => cnt %>
</li>
<% end %>
</ul>
</div>
<div class="rs-margin-lr">
<% if can_do(@context, @current_user, :manage_grades) %>
<a href="<%= context_url(@context, :context_discussion_topic_url, @topic, :combined => 1) %>" class="button"><%= image_tag "forward.png" %> Show Posts from all Topics</a>
<a href="<%= context_url(@context, :context_discussion_topic_url, @topic, :combined => 1) %>" class="button"><%= image_tag "forward.png" %> <%= t :show_all_posts, "Show Posts from all Topics" %></a>
<% end %>
</div>
<% else %>
<div class="rs-margin-all">
<div id="sidebar_content">
<p>
<b><span class="message_count"><%= @entries.length %></span> <span class="message_count_text"><%= @entries.length == 1 ? 'post' : 'posts' %></span></b>
<b><%= t :message_count, { :one => "%{count_start}1%{count_end} %{text_start}post%{text_end}", :other => "%{count_start}%{count}%{count_end} %{text_start}posts%{text_end}" }, :count_start => '<span class="message_count">', :count_end => '</span>', :text_start => '<span class="message_count_text">', :text_end => '</span>', :count => @entries.length %></b>
<% if @entries.length > 0 && !@topic_agglomerated %>
<span style="font-size: 0.8em; padding-left: 10px;">( <span class="total_message_count"><%= @topic.discussion_entries.active.length %></span> including subtopics )</span>
<span style="font-size: 0.8em; padding-left: 10px;">( <%= t :total_message_count, "%{count_start}%{count}%{count_end} including subtopics", :count_start => '<span class="total_message_count">', :count => @topic.discussion_entries.active.length, :count_end => '</span>' %> )</span>
<% end %>
</p>
<p>
<% if @topic_agglomerated %>
This view shows all the messages from all this topic's group topics. If you want to
comment or edit posts, you'll have to visit each topic individually.
<%= t :topic_agglomerated_notice, "This view shows all the messages from all this topic's group topics. If you want to comment or edit posts, you'll have to visit each topic individually." %>
<ul class="unstyled_list" style="line-height: 1.8em; margin: 5px 20px 10px;">
<% @groups.select{|g| can_do(g, @current_user, :read) }.each do |group| %>
<li class="unstyled_list">
<% cnt = (@topics || []).find{|t| t.context == group}.discussion_entries.count rescue 0 %>
<b><a href="<%= context_url(group, :context_discussion_topics_url, :root_discussion_topic_id => @topic.id) %>"><%= group.name %></a></b> - <%= pluralize(cnt, 'Post') %>
<b><a href="<%= context_url(group, :context_discussion_topics_url, :root_discussion_topic_id => @topic.id) %>"><%= group.name %></a></b> - <%= t :post_count, "Post", :count => cnt %>
</li>
<% end %>
</ul>
@ -59,23 +58,23 @@
</p>
<p>
<% if can_do(@topic, @current_user, :update) %>
<a href="#" class="edit_topic_link button button-sidebar-wide"><%= image_tag "edit.png", :alt => "" %> Edit Topic</a>
<a href="#" class="edit_topic_link button button-sidebar-wide"><%= image_tag "edit.png", :alt => "" %> <%= t :edit_topic, "Edit Topic" %></a>
<% end %>
<% if can_do(@topic, @current_user, :reply) && !params[:combined] %>
<a href="#" class="add_entry_link button button-sidebar-wide"><%= image_tag "add.png", :alt => "" %> Add New Entry</a>
<a href="#" class="add_entry_link button button-sidebar-wide"><%= image_tag "add.png", :alt => "" %> <%= t :add_new_topic, "Add New Entry" %></a>
<% end %>
<% if can_do(@topic, @current_user, :delete) && !params[:combined] %>
<%= link_to image_tag('delete.png') + " Delete Topic", context_url(@context, :context_discussion_topic_url, @topic), :method => :delete, :confirm => "Are you sure you want to delete this topic?", :class => "button button-sidebar-wide" %>
<%= link_to image_tag('delete.png') + " " + t(:delete_topic, "Delete Topic"), context_url(@context, :context_discussion_topic_url, @topic), :method => :delete, :confirm => t(:delete_confirm, "Are you sure you want to delete this topic?"), :class => "button button-sidebar-wide" %>
<% end %>
</p>
<div id="podcast_link_holder" style="<%= hidden unless @topic.podcast_enabled %>">
<% if @context_enrollment %>
<p>
<a class="feed" href="<%= feeds_topic_format_path(@topic.id, @context_enrollment.feed_code, :rss) %>">Topic Podcast Feed</a>
<a class="feed" href="<%= feeds_topic_format_path(@topic.id, @context_enrollment.feed_code, :rss) %>"><%= t :topic_podcast_feed_link, "Topic Podcast Feed" %></a>
</p>
<% elsif @context.available? %>
<p>
<a class="feed" href="<%= feeds_topic_format_path(@topic.id, @context.feed_code, :rss) %>">Topic Podcast Feed</a>
<a class="feed" href="<%= feeds_topic_format_path(@topic.id, @context.feed_code, :rss) %>"><%= t :topic_podcast_feed_link, "Topic Podcast Feed" %></a>
</p>
<% end %>
</div>
@ -85,23 +84,28 @@
<% end %>
<% if @topic.for_assignment? %>
<div class="rs-margin-lr">
This topic is for the assignment<br/><strong><%= @topic.assignment.title %></strong>
<%= mt :topic_for_assignment, "This topic is for the assignment \n**%{title}**", :title => @topic.assignment.title %>
<div style="font-size: 0.8em; margin-bottom: 10px;">
<% if @topic.assignment.points_possible %>
<%= pluralize(@topic.assignment.points_possible, "pt") %><%= ',' if @topic.assignment.due_at %>
<% end %>
<% if @topic.assignment.due_at %>
due <%= datetime_string(@topic.assignment.due_at) %>
<% if @topic.assignment.due_at %>
<%= t :points_possible_and_due, {:one => "1 pt, due %{date}", :other => "%{count} pts, due %{date}"}, :count => @topic.assignment.points_possible, :date => datetime_string(@topic.assignment.due_at) %>
<% else %>
<%= t :points_possible, {:one => "1 pt", :other => "%{count} pts"}, :count => @topic.assignment.points_possible %>
<% end %>
<% else %>
<% if @topic.assignment.due_at %>
<%= t :just_due, "due %{date}", :date => datetime_string(@topic.assignment.due_at) %>
<% end %>
<% end %>
</div>
<% if can_do(@topic.assignment, @current_user, :grade) || can_do(@topic.assignment.context, @current_user, :manage_assignments) %>
<a href="<%= context_url(@topic.assignment.context, :edit_context_assignment_url, @topic.assignment_id, :return_to => request.url) %>" class="button button-sidebar button-sidebar-wide"><%= image_tag "edit.png" %> Edit Assignment Settings</a>
<a href="<%= context_url(@topic.assignment.context, :edit_context_assignment_url, @topic.assignment_id, :return_to => request.url) %>" class="button button-sidebar button-sidebar-wide"><%= image_tag "edit.png" %> <%= t :edit_assignment_settings, "Edit Assignment Settings" %></a>
<% if !@topic.assignment.submissions.having_submission.empty? %>
<a target="_blank" class="button button-sidebar button-sidebar-wide" href="<%= context_url(@topic.assignment.context, :speed_grader_context_gradebook_url, :assignment_id => @topic.assignment_id) %>"><%= image_tag "grading_icon.png" %> Speed Grader</a>
<a target="_blank" class="button button-sidebar button-sidebar-wide" href="<%= context_url(@topic.assignment.context, :speed_grader_context_gradebook_url, :assignment_id => @topic.assignment_id) %>"><%= image_tag "grading_icon.png" %> <%= t :speed_grader, "Speed Grader" %></a>
<% end %>
<% end %>
<% if can_do(@topic.assignment, @current_user, :update) || @assignment.try(:rubric_association).try(:rubric) %>
<a href="#" rel="<%= context_url(@assignment.context, :context_assignment_rubric_url, @assignment.id) %>" class="show_rubric_link button button-sidebar-wide"><%= image_tag "rubric.png" %> Show Assignment Rubric</a>
<a href="#" rel="<%= context_url(@assignment.context, :context_assignment_rubric_url, @assignment.id) %>" class="show_rubric_link button button-sidebar-wide"><%= image_tag "rubric.png" %> <%= t :show_assignment_rubric, "Show Assignment Rubric" %></a>
<% end %>
</div>
<% end %>
@ -130,7 +134,7 @@
<h2><%= @topic.title %></h2>
<% end %>
<% if @locked %>
<%= @locked.is_a?(Hash) ? lock_explanation(@locked, 'topic', @context) : "This topic is currently locked." %>
<%= @locked.is_a?(Hash) ? lock_explanation(@locked, 'topic', @context) : t(:locked_topic, "This topic is currently locked.") %>
<% else %>
<% jammit_js :wiki, :topics %>
<% js_block do %><%= javascript_include_tag "tinymce/jscripts/tiny_mce/tiny_mce.js" %><% end %>
@ -143,7 +147,7 @@
<div style="display: none;" class="current_user_name"><%= h context_user_name(@context, @current_user) %></div>
<div id="entry_list" class="entry_list <%= 'agglomerated' if @topic_agglomerated %>">
<% if @initial_post_required %>
<h3 id="initial_post_required" style="margin: 20px 0;">Replies are only visible to those who have posted at least one reply.</h3>
<h3 id="initial_post_required" style="margin: 20px 0;"><%= t :initial_post_required, "Replies are only visible to those who have posted at least one reply." %></h3>
<% else %>
<%= render :partial => "entry", :collection => @entries, :locals => {:topic => @topic} %>
<% end %>
@ -151,7 +155,7 @@
<% end %>
<% if !@topic_uneditable && can_do(@topic, @current_user, :reply) && !params[:combined]%>
<div style="text-align: center; margin: 10px;">
<a href="#" class="add_entry_link add button big-button"> <%= image_tag "add.png" %> Add New Entry</a><br/>
<a href="#" class="add_entry_link add button big-button"> <%= image_tag "add.png" %> <%= t :add_new_entry, "Add New Entry" %></a><br/>
</div>
<% end %>
<%= render :partial => "entry", :object => nil, :locals => {:topic => @topic} %>
@ -159,7 +163,7 @@
<%= f.hidden_field :discussion_topic_id %>
<%= f.hidden_field :parent_id %>
<div class="details_box" style="margin-bottom: 0px;">
<div style="float: right;"><a href="#" class="switch_entry_views_link" style="font-size: 0.8em;">Switch Views</a></div>
<div style="float: right;"><a href="#" class="switch_entry_views_link" style="font-size: 0.8em;"><%= t :switch_views, "Switch Views" %></a></div>
<div class="clear"></div>
</div>
<div class="content_box" style="margin-bottom: 5px;">
@ -168,26 +172,26 @@
<% if can_do(@topic.discussion_entries.new, @current_user, :attach) %>
<div>
<div class="no_attachment" style="float: right;">
<a href="#" class="add_attachment_link add"> Attach File</a>
<a href="#" class="add_attachment_link add"> <%= t :attach_file, "Attach File" %></a>
</div>
<div class="current_attachment" style="display: none; text-align: left;">
<div>
<input type="hidden" name="discussion_entry[remove_attachment]" value="0" class="entry_remove_attachment"/>
<span style="font-size: 0.8em;">File Attached: </span>
<span style="font-size: 0.8em;"><%= before_label :file_attached, "File Attached" %> </span>
<span class="attachment_name" style="font-weight: bold;">&nbsp;</span>
<a href="#" class="delete_attachment_link no-hover"><%= image_tag "delete_circle.png" %></a>
</div>
<a href="#" class="replace_attachment_link" style="font-size: 0.8em; padding-left: 20px;">Replace File</a>
<a href="#" class="replace_attachment_link" style="font-size: 0.8em; padding-left: 20px;"><%= t :replace_file, "Replace File" %></a>
</div>
<div style="display: none;" class="upload_attachment">
File: <input type="file" name="attachment[uploaded_data]" class="attachment_uploaded_data"/>
<% before_label :file, "File" %> <input type="file" name="attachment[uploaded_data]" class="attachment_uploaded_data"/>
<a href="#" class="cancel_attachment_link no-hover" style="padding-left: 10px;"><%= image_tag "delete_circle.png" %></a>
</div>
</div>
<% end %>
<div class="button_box button-container" style="float: left;">
<button type="submit" class="button">Post Entry</button>
<button type="button" class="cancel_button button-secondary">Cancel</button>
<button type="submit" class="button"><%= t :post_entry, "Post Entry" %></button>
<button type="button" class="cancel_button button-secondary"><%= t "#buttons.cancel", "Cancel" %></button>
</div>
<div class="clear"></div>
<% end %>
@ -209,32 +213,32 @@
<li>
<span class="keycode">j</span>
<span class="colon">:</span>
<span class="description">Next Message</span>
<span class="description"><%= t :next_message, "Next Message" %></span>
</li>
<li>
<span class="keycode">k</span>
<span class="colon">:</span>
<span class="description">Previous Message</span>
<span class="description"><%= t :previous_message, "Previous Message" %></span>
</li>
<li>
<span class="keycode">e</span>
<span class="colon">:</span>
<span class="description">Edit Current Message</span>
<span class="description"><%= t :edit_current_message, "Edit Current Message" %></span>
</li>
<li>
<span class="keycode">d</span>
<span class="colon">:</span>
<span class="description">Delete Current Message</span>
<span class="description"><%= t :delete_current_message, "Delete Current Message" %></span>
</li>
<li>
<span class="keycode">r</span>
<span class="colon">:</span>
<span class="description">Reply to Current Message</span>
<span class="description"><%= t :reply_to_message, "Reply to Current Message" %></span>
</li>
<li>
<span class="keycode">n</span>
<span class="colon">:</span>
<span class="description">Reply to Topic</span>
<span class="description"><%= t :reply_to_topic, "Reply to Topic" %></span>
</li>
</ul>
<% end %>

View File

@ -163,6 +163,11 @@ ActiveRecord::Base.class_eval do
I18n.translate(key, default, options)
end
alias :t :translate
def before_label(text_or_key, default_value = nil)
text_or_key = t('labels.' + text_or_key.to_s, default_value) if text_or_key.is_a?(Symbol)
t("before_label_wrapper", "%{text}:", :text => text_or_key)
end
end
end