In the same way that other elements can know when a FileAction is
registered or a default action is set this commit makes possible to be
notified before and after a FileAction is executed.
This is achieved by wrapping the registered action handler in a custom
function that notifies the listeners before and after executing the
handler itself. Due to this approach only FileActions registered through
"registerAction" trigger the events, although that is not a problem as
this is how the actions should be added to the FileActions anyway.
Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
The notification tests were not restoring the clock properly, but
indirectly helped other tests pass.
Since now we're restoring the clock properly, the other tests were fixed
to still work.
The favorite icon in the sidebar now triggers the file action and also
updates itself according to the model's state when triggered from the
file row.
The thumbnail triggers the default action.
Currently only one FileInfoModel is used for the selection and state
synchronization between views.
FileList reload now auto-closes the sidebar.
This improves the OCA.Files.FileActions class to support passing a
"render" function in the action object.
The default function "_defaultRenderFunction" is used by default and
renders actions in the usual actions container.
Moved "Rename" and "Delete" to custom render functions.
Whenever an app needs to register an event late, it does that on the
original file actions object.
Since the file actions that the file list work on is a merged list, not
the original one, the registration event needs to be propagated there as
well.
Whenever file actions are registered later, now the file lists are
automatically notified.
Added FileActions.addUpdateListener() to be able to receive such
notifications.
This removes the need for apps to manually call FileActions.display()
after registering new actions.
This fixes issues with race conditions when file actions are
registered after the file list was already rendered.
When renaming or deleting a file that is in a subdirectory, performing
the action from the sharing overview or another file list view, the
actual directory of the file must be used instead of the current
directory.
- Fixed renaming and fileActionsReady event
- Added unit tests for shares list
- Fixed public page with defer
- Fixed file actions in sharing overview
- Fixed sharing counterpart list (10 entries max)
- Fixed file path attribute to be used in download action
- Fix sharing list headers
- OC.Share icons now operate on fileList instance
- Fix OC.Share.updateIcon when more than one list in DOM
Legacy file actions are registered by legacy apps through
window.FileActions.register(). These actions can only be used by the
main file list ("all files") because legacy apps can only deal with a
single list / container.
New file actions of compatible apps must be registered through
OCA.Files.fileActions. These will be used for other lists like the
sharing overview.
Fixed versions and sharing actions to use OCA.Files.fileActions, which
makes them available in the sharing overview list.
Added "dir" in file actions handler context so that handlers can know
what the path of the file was without having to look it up from the file
list.
Fixed versions app to use the context.dir instead of the old $('#dir')
element. This makes the versions popup work in the sharing overview.
- fixed upload and storage statistics
- fixed infinite scroll to use the correct contain for scroll detection
- fixed unit test that sometimes fail for rename case
- controls are now sticky again
- fixed selection overlay to be aligned with the table
- fixed "select all" checkbox that had id conflicts
- fixed public page
- fixed global actions permissions detection
- fix when URL contains an invalid view id
- viewer mode now hides the sidebar (ex: text editor)
- added unit tests for trashbin
- clean up storage info in template (most is retrieved via ajax call now)
- FileList is now an instantiable class
- FileActions is now in namespace
- added App class for trashbin app
- moved trashbin overrides into classes extending FileList
- replaced many static calls with "this." or "self." to make the classes
reusable/extendable
- new URL parameter "view" to specify which view is shown, for example
"files" or "trashbin"
- added OC.Util.History utility class in core for handling history
- moved URL handling/routing to OCA.Files.App
- popstate will correctly update the current view and notify the view of
the URL change so it can update the current dir
- added JS unitt tests for the trashbin app
- fixed public app to work with the new namespaces
Removed "insert" flag, inserting is by default for FileList.add().
Added "animate" flag to FileList.add().
Added logic to correctly detect when to insert/append elements whenever
the insertion point is visible or not.
Fixed "render next page" logic to work correctly when many pages of
files have been added.
Files app:
- removed file list template, now rendering list from JSON response
- FileList.addFile/addDir is now FileList.add() and takes a JS map with all required
arguments instead of having a long number of function arguments
- added unit tests for many FileList operations
- fixed newfile.php, newfolder.php and rename.php to return the file's
full JSON on success
- removed obsolete/unused undo code
- removed download_url / loading options, now using
Files.getDownloadUrl() for that
- server side now uses Helper::getFileInfo() to prepare file JSON response
- previews are now client-side only
Breadcrumbs are now JS only:
- Added BreadCrumb class to handle breadcrumb rendering and events
- Added unit test for BreadCrumb class
- Moved all relevant JS functions to the BreadCrumb class
Public page now uses ajax to load the file list:
- Added Helper class in sharing app to make it easier to authenticate
and retrieve the file's real path
- Added ajax/list.php to retrieve the file list
- Fixed FileActions and FileList to work with the ajax list
Core:
- Fixed file picker dialog to use the same list format as files app
- When all files are selected, do not send the whole file list
- Download will trigger download for the parent folder, also works
with root
- Delete will send "allfiles" to the server that will find the file
list or the passed directory by itself
- Also fixes a few JSHint warnings in files app
- Added "global" comment on top of files app to suppress warning and
also inform devs about what globals are use
- rename action is now checked inside of ".nametext" element
- added test to ensure that display() correctly resets all actions
including the rename one
- Refactored download URL building to make it overridable
- Added download URL override in public page
- Added JS unit tests for download URL
- Added OC.redirect() method to facilitate unit testing