Internationalize Views::Overview templates
This commit is contained in:
@@ -23,3 +23,10 @@ en:
|
|||||||
title: Latest Changes (Globally)
|
title: Latest Changes (Globally)
|
||||||
precious/views/layout:
|
precious/views/layout:
|
||||||
title: Home
|
title: Home
|
||||||
|
precious/views/overview:
|
||||||
|
back_to_top: Back to Top
|
||||||
|
delete_confirmation: "Are you sure you want to delete %{name}?"
|
||||||
|
no_pages_in: There are no pages in
|
||||||
|
on: "on"
|
||||||
|
title: "Overview of %{ref}"
|
||||||
|
|
||||||
|
|||||||
@@ -21,25 +21,38 @@
|
|||||||
<span class="pr-2">{{{icon}}}</span>
|
<span class="pr-2">{{{icon}}}</span>
|
||||||
<span><a href="{{url}}">{{name}}</a></span>
|
<span><a href="{{url}}">{{name}}</a></span>
|
||||||
{{#allow_editing}}
|
{{#allow_editing}}
|
||||||
{{#is_file}}<button class="btn btn-sm float-right delete-file" data-file-path="{{file_path}}" data-confirm="Are you sure you want to delete {{name}}?">{{#octicon}}trash{{/octicon}}</button>{{/is_file}}
|
{{#is_file}}
|
||||||
{{/allow_editing}}
|
<button
|
||||||
|
class="btn btn-sm float-right delete-file"
|
||||||
|
data-confirm="{{t.delete_confirmation}}"
|
||||||
|
data-file-path="{{file_path}}"
|
||||||
|
>
|
||||||
|
{{#octicon}}trash{{/octicon}}
|
||||||
|
</button>
|
||||||
|
{{/is_file}}
|
||||||
|
{{/allow_editing}}
|
||||||
</li>
|
</li>
|
||||||
{{/files_folders}}
|
{{/files_folders}}
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
{{/has_results}}
|
{{/has_results}}
|
||||||
|
|
||||||
{{#no_results}}
|
{{#no_results}}
|
||||||
<p id="no-results">
|
<p id="no-results">
|
||||||
There are no pages in <strong>{{current_path}}</strong> on <strong>{{ref}}</strong>.
|
{{t.no_pages_in}}
|
||||||
|
<strong>{{current_path}}</strong>
|
||||||
|
{{t.on}}
|
||||||
|
<strong>{{ref}}</strong>.
|
||||||
</p>
|
</p>
|
||||||
{{/no_results}}
|
{{/no_results}}
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="pt-4" id="footer">
|
<div class="pt-4" id="footer">
|
||||||
<a href="#">Back to Top</a>
|
<a href="#">
|
||||||
|
{{t.back_to_top}}
|
||||||
|
</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -3,11 +3,11 @@ require 'pathname'
|
|||||||
module Precious
|
module Precious
|
||||||
module Views
|
module Views
|
||||||
class Overview < Layout
|
class Overview < Layout
|
||||||
attr_reader :results, :ref, :allow_editing, :newable
|
attr_reader :name, :results, :ref, :allow_editing, :newable
|
||||||
HIDDEN_PATHS = ['.gitkeep']
|
HIDDEN_PATHS = ['.gitkeep']
|
||||||
|
|
||||||
def title
|
def title
|
||||||
"Overview of #{@ref}"
|
t[:title]
|
||||||
end
|
end
|
||||||
|
|
||||||
# def editable
|
# def editable
|
||||||
@@ -38,21 +38,21 @@ module Precious
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
def files_folders
|
def files_folders
|
||||||
if has_results
|
if has_results
|
||||||
files_and_folders = []
|
files_and_folders = []
|
||||||
|
|
||||||
@results.each do |result|
|
@results.each do |result|
|
||||||
result_path = result.url_path
|
result_path = result.url_path
|
||||||
result_path = result_path.sub(/^#{Regexp.escape(@path)}\//, '') unless @path.nil?
|
result_path = result_path.sub(/^#{Regexp.escape(@path)}\//, '') unless @path.nil?
|
||||||
if result_path.include?('/')
|
if result_path.include?('/')
|
||||||
# result contains a folder
|
# result contains a folder
|
||||||
folder_name = result_path.split('/').first
|
folder_name = result_path.split('/').first
|
||||||
folder_path = @path ? "#{@path}/#{folder_name}" : folder_name
|
folder_path = @path ? "#{@path}/#{folder_name}" : folder_name
|
||||||
folder_url = "#{overview_path}/#{folder_path}/"
|
folder_url = "#{overview_path}/#{folder_path}/"
|
||||||
files_and_folders << {name: folder_name, icon: rocticon('file-directory'), type: 'dir', url: folder_url, is_file: false}
|
files_and_folders << {name: folder_name, icon: rocticon('file-directory'), type: 'dir', url: folder_url, is_file: false}
|
||||||
elsif !HIDDEN_PATHS.include?(result_path)
|
elsif !HIDDEN_PATHS.include?(result_path)
|
||||||
file_url = page_route(result.escaped_url_path)
|
file_url = page_route(result.escaped_url_path)
|
||||||
files_and_folders << {name: result.filename, icon: rocticon('file'), type: 'file', url: file_url, file_path: result.escaped_url_path, is_file: true}
|
files_and_folders << {name: result.filename, icon: rocticon('file'), type: 'file', url: file_url, file_path: result.escaped_url_path, is_file: true}
|
||||||
end
|
end
|
||||||
@@ -61,7 +61,7 @@ module Precious
|
|||||||
files_and_folders.uniq{|f| f[:name]}.sort_by!{|f| [f[:type], f[:name]]}
|
files_and_folders.uniq{|f| f[:name]}.sort_by!{|f| [f[:type], f[:name]]}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
def has_results
|
def has_results
|
||||||
!@results.empty?
|
!@results.empty?
|
||||||
@@ -70,12 +70,12 @@ module Precious
|
|||||||
def no_results
|
def no_results
|
||||||
@results.empty?
|
@results.empty?
|
||||||
end
|
end
|
||||||
|
|
||||||
def latest_changes
|
def latest_changes
|
||||||
true
|
true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user