folder i18n
Change-Id: If8bb0ec83eb794b456e5e5912a6947192bb4a148 Reviewed-on: https://gerrit.instructure.com/4142 Tested-by: Hudson <hudson@instructure.com> Reviewed-by: Cody Cutrer <cody@instructure.com>
This commit is contained in:
parent
68029325d5
commit
e693123f82
|
@ -52,7 +52,9 @@ class FoldersController < ApplicationController
|
|||
|
||||
# Destroy any previous zip downloads that might exist for this folder,
|
||||
# except the last one (cause we might be able to use it)
|
||||
@attachments = Attachment.find_all_by_context_id_and_context_type_and_display_name_and_user_id(@folder.id, @folder.class.to_s, "folder.zip", user_id).
|
||||
folder_filename = "#{t :folder_filename, "folder"}.zip"
|
||||
|
||||
@attachments = Attachment.find_all_by_context_id_and_context_type_and_display_name_and_user_id(@folder.id, @folder.class.to_s, folder_filename, user_id).
|
||||
select{|a| ['to_be_zipped', 'zipping', 'zipped'].include?(a.workflow_state) && !a.deleted? }.
|
||||
sort_by{|a| a.created_at }
|
||||
@attachment = @attachments.pop
|
||||
|
@ -64,7 +66,7 @@ class FoldersController < ApplicationController
|
|||
end
|
||||
|
||||
if @attachment.nil?
|
||||
@attachment = @folder.file_attachments.build(:display_name => "folder.zip")
|
||||
@attachment = @folder.file_attachments.build(:display_name => folder_filename)
|
||||
@attachment.user_id = user_id
|
||||
@attachment.workflow_state = 'to_be_zipped'
|
||||
@attachment.file_state = '0'
|
||||
|
@ -85,7 +87,7 @@ class FoldersController < ApplicationController
|
|||
end
|
||||
format.json { render :json => @attachment.to_json(:methods => :readable_size) }
|
||||
else
|
||||
flash[:notice] = "File zipping still in process..."
|
||||
flash[:notice] = t :file_zip_in_process, "File zipping still in process..."
|
||||
format.html { redirect_to named_context_url(@context, :context_folder_url, @folder.id) }
|
||||
format.zip { redirect_to named_context_url(@context, :context_folder_url, @folder.id) }
|
||||
format.json { render :json => @attachment.to_json }
|
||||
|
@ -112,7 +114,7 @@ class FoldersController < ApplicationController
|
|||
@folder.parent_folder = Folder.root_folders(@context).first
|
||||
@folder.save
|
||||
end
|
||||
flash[:notice] = 'Event was successfully updated.'
|
||||
flash[:notice] = t :event_updated, 'Event was successfully updated.'
|
||||
format.html { redirect_to named_context_url(@context, :context_files_url) }
|
||||
format.xml { head :ok }
|
||||
format.json { render :json => @folder.to_json(:methods => [:currently_locked], :permissions => {:user => @current_user, :session => session}), :status => :ok }
|
||||
|
@ -142,7 +144,7 @@ class FoldersController < ApplicationController
|
|||
end
|
||||
respond_to do |format|
|
||||
if @folder.save
|
||||
flash[:notice] = 'Folder was successfully created.'
|
||||
flash[:notice] = t :folder_created, 'Folder was successfully created.'
|
||||
format.html { redirect_to named_context_url(@context, :context_files_url) }
|
||||
format.xml { head :created, @folder.to_xml }
|
||||
format.json { render :json => @folder.to_json(:permissions => {:user => @current_user, :session => session}) }
|
||||
|
|
|
@ -201,7 +201,7 @@ class Folder < ActiveRecord::Base
|
|||
end
|
||||
end
|
||||
end
|
||||
context.log_merge_result("Folder \"#{dup.full_name}\" created")
|
||||
context.log_merge_result(t :folder_created, "Folder \"%{name}\" created", :name => dup.full_name)
|
||||
dup.updated_at = Time.now
|
||||
dup.clone_updated = true
|
||||
dup
|
||||
|
@ -219,10 +219,12 @@ class Folder < ActiveRecord::Base
|
|||
root_folders << context.folders.create(:name => ROOT_FOLDER_NAME, :full_name => ROOT_FOLDER_NAME, :workflow_state => "visible")
|
||||
end
|
||||
elsif context.is_a? User
|
||||
# TODO i18n
|
||||
if root_folders.select{|f| f.name == "my files" }.empty?
|
||||
root_folders << context.folders.create(:name => "my files", :full_name => "my files", :workflow_state => "visible")
|
||||
end
|
||||
else
|
||||
# TODO i18n
|
||||
if root_folders.select{|f| f.name == "files" }.empty?
|
||||
root_folders << context.folders.create(:name => "files", :full_name => "files", :workflow_state => "visible")
|
||||
end
|
||||
|
@ -274,6 +276,7 @@ class Folder < ActiveRecord::Base
|
|||
if folder_id
|
||||
current_folder = context.folders.active.find(folder_id)
|
||||
else
|
||||
# TODO i18n
|
||||
if context.is_a? Course
|
||||
current_folder = context.folders.active.find_by_full_name("course content")
|
||||
elsif @context.is_a? User
|
||||
|
|
Loading…
Reference in New Issue