mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2024-11-25 18:20:20 -06:00
Default the file browser view to list, and make it configurable. Fixes #2579
This commit is contained in:
parent
d1e7254fbd
commit
97cd74a373
@ -26,6 +26,7 @@ from flask_security import login_required
|
||||
from pgadmin.utils import PgAdminModule
|
||||
from pgadmin.utils import get_storage_directory
|
||||
from pgadmin.utils.ajax import make_json_response
|
||||
from pgadmin.utils.preferences import Preferences
|
||||
|
||||
# Checks if platform is Windows
|
||||
if _platform == "win32":
|
||||
@ -172,6 +173,13 @@ class FileManagerModule(PgAdminModule):
|
||||
gettext("Last directory visited"), 'text', '/',
|
||||
category_label=gettext('Options')
|
||||
)
|
||||
self.file_dialog_view = self.preference.register(
|
||||
'options', 'file_dialog_view',
|
||||
gettext("File dialog view"), 'options', 'list',
|
||||
category_label=gettext('Options'),
|
||||
options=[{'label': gettext('List'), 'value': 'list'},
|
||||
{'label': gettext('Grid'), 'value': 'grid'}]
|
||||
)
|
||||
|
||||
|
||||
# Initialise the module
|
||||
@ -232,9 +240,13 @@ def file_manager_config(trans_id):
|
||||
"""render the required json"""
|
||||
# trans_id = Filemanager.create_new_transaction()
|
||||
data = Filemanager.get_trasaction_selection(trans_id)
|
||||
pref = Preferences.module('file_manager')
|
||||
file_dialog_view = pref.preference('file_dialog_view').get()
|
||||
|
||||
return Response(response=render_template(
|
||||
"file_manager/js/file_manager_config.json", _=gettext,
|
||||
data=data),
|
||||
data=data,
|
||||
file_dialog_view=file_dialog_view),
|
||||
status=200,
|
||||
mimetype="application/json")
|
||||
|
||||
|
@ -6,9 +6,9 @@
|
||||
<div class="file_manager">
|
||||
<div id="uploader" class='col-xs-12'>
|
||||
<div class="btn-group filemanager-path-group col-sm-7 col-xs-12" role="group">
|
||||
<button name="home" type="button" value="Home" title="Home" class="fa fa-home btn home"><span></span>
|
||||
<button name="home" type="button" value="Home" title="{{ _('Home') }}" class="fa fa-home btn home"><span></span>
|
||||
</button>
|
||||
<button name="level-up" type="button" title="Back" value="LevelUp" class="btn fa fa-level-up level-up"
|
||||
<button name="level-up" type="button" title="{{ _('Back') }}" value="LevelUp" class="btn fa fa-level-up level-up"
|
||||
disabled><span></span></button>
|
||||
<input class='input-path' title='' type="text"/>
|
||||
|
||||
@ -17,17 +17,17 @@
|
||||
<div class="uploadresponse"></div>
|
||||
<input class="mode" name="mode" type="hidden" value="add"/>
|
||||
<input class="currentpath" name="currentpath" type="hidden"/>
|
||||
<button type="button" title="Refresh" class="btn fa fa-refresh refresh"></button>
|
||||
<button type="button" title="Download File" class="btn fa fa-download download" disabled><span></span>
|
||||
<button type="button" title="{{ _('Refresh') }}" class="btn fa fa-refresh refresh"></button>
|
||||
<button type="button" title="{{ _('Download File') }}" class="btn fa fa-download download" disabled><span></span>
|
||||
</button>
|
||||
<button name="delete" type="button" title="Delete File/Folder" class="btn fa fa-trash delete" disabled>
|
||||
<button name="delete" type="button" title="{{ _('Delete File/Folder') }}" class="btn fa fa-trash delete" disabled>
|
||||
<span></span></button>
|
||||
<button name="rename" type="button" title="Rename File/Folder" class="btn fa fa-pencil-square-o rename">
|
||||
<button name="rename" type="button" title="{{ _('Rename File/Folder') }}" class="btn fa fa-pencil-square-o rename">
|
||||
<span></span></button>
|
||||
<button name="newfolder" type="button" title="Create new folder" value="New Folder"
|
||||
<button name="newfolder" type="button" title="{{ _('Create new folder') }}" value="New Folder"
|
||||
class="btn fa fa-folder-open create"><span></span></button>
|
||||
<button class="ON fa fa-th btn grid" type="button" title="View as grid"><span></span></button>
|
||||
<button type="button" class="btn fa fa-list list" title="View as Table"><span></span></button>
|
||||
<button class="ON fa fa-th btn grid" type="button" title="{{ _('View as grid') }}"><span></span></button>
|
||||
<button type="button" class="btn fa fa-list list" title="{{ _('View as table') }}"><span></span></button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="fileinfo">
|
||||
@ -39,17 +39,17 @@
|
||||
<div class="allowed_file_types"></div>
|
||||
<div class='fm_dimmer'></div>
|
||||
<div class='delete_item'>
|
||||
<span>Are you sure you want to delete this item ?</span>
|
||||
<span>{{ _('Are you sure you want to delete this item?') }}</span>
|
||||
<span class="pull-right">
|
||||
<button type='button' class='btn btn_yes'>YES</button>
|
||||
<button type='button' class='btn btn_no'>NO</button>
|
||||
<button type='button' class='btn btn_yes'>{{ _('Yes') }}</button>
|
||||
<button type='button' class='btn btn_no'>{{ _('No') }}</button>
|
||||
</span>
|
||||
</div>
|
||||
<div class='replace_file'>
|
||||
<span>Are you sure you want to replace this file ?</span>
|
||||
<span>{{ _('Are you sure you want to replace this file?') }}</span>
|
||||
<span class="pull-right">
|
||||
<button type='button' class='btn btn_yes'>YES</button>
|
||||
<button type='button' class='btn btn_no'>NO</button>
|
||||
<button type='button' class='btn btn_yes'>{{ _('Yes') }}</button>
|
||||
<button type='button' class='btn btn_no'>{{ _('No') }}</button>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -2,7 +2,7 @@
|
||||
"options": {
|
||||
"culture": "en",
|
||||
"lang": "py",
|
||||
"defaultViewMode": "grid",
|
||||
"defaultViewMode": "{{file_dialog_view}}",
|
||||
"autoload": true,
|
||||
"showFullPath": false,
|
||||
"dialog_type": "{{data.dialog_type}}",
|
||||
|
@ -668,8 +668,8 @@ var getFolderInfo = function(path, file_type) {
|
||||
file_name_original + '">' + fm_filename + '</span></p></td>';
|
||||
}
|
||||
if (props.Size && props.Size != '') {
|
||||
result += '<td><abbr title="' + props.Size + '">' +
|
||||
props.Size + '</abbr></td>';
|
||||
result += '<td><span title="' + props.Size + '">' +
|
||||
props.Size + '</span></td>';
|
||||
} else {
|
||||
result += '<td></td>';
|
||||
}
|
||||
@ -1566,7 +1566,7 @@ pgAdmin.FileUtils = {
|
||||
"<td title='' class='fa fa-folder-open tbl_folder'>" +
|
||||
"<p><input type='text' class='fm_file_rename'><span>" +
|
||||
lg.new_folder + "</span></p>" +
|
||||
"</td><td><abbr title=''></abbr></td>" +
|
||||
"</td><td><span title=''></span></td>" +
|
||||
"<td></td>" +
|
||||
"</tr>"
|
||||
);
|
||||
|
Loading…
Reference in New Issue
Block a user