Documentation ¶
Overview ¶
Package sharebutton provides a Button element that is used in the sidebar of the web UI, to share the selected items with a share claim. On success, the URL that can be used to share the items is displayed in a dialog. If the one item is a file, the URL can be used directly to fetch the file. If the one item is a directory, the URL should be used with camget -shared. If several (file or directory) items are selected, a new directory blob containing these items is created, and is the item getting shared instead.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func New ¶
New returns the button element. It should be used as the entry point, to create the needed React element.
key is the id for when the button is in a list, see https://facebook.github.io/react/docs/lists-and-keys.html
config is the web UI config that was fetched from the server.
cbs is a wrapper around the callback functions required by this component.
Types ¶
type Callbacks ¶
type Callbacks struct { // GetSelection returns the list of items selected for sharing. GetSelection func() []SharedItem `js:"getSelection"` // href and anchorText for its text. ShowSharedURL func(anchorURL string, anchorText string) `js:"showSharedURL"` // contains filtered or unexported fields }
Callbacks defines the callbacks that must be provided when creating a ShareItemsBtn instance.
type ShareItemsBtnDef ¶
type ShareItemsBtnDef struct {
}ShareItemsBtnDef is the definition for the button, that Renders as a React Button.
func (ShareItemsBtnDef) OnClick ¶
func (d ShareItemsBtnDef) OnClick(e *react.SyntheticMouseEvent)
On success, handleShareSelection calls d.showSharedURL with the URL that can be used to share the item. If the item is a file, the URL can be used directly to fetch the file. If the item is a directory, the URL should be used with camget -shared.
func (ShareItemsBtnDef) Props ¶
func (s ShareItemsBtnDef) Props() ShareItemsBtnProps
Props is an auto-generated proxy to the current props of ShareItemsBtn
func (ShareItemsBtnDef) Render ¶
func (d ShareItemsBtnDef) Render() react.Element
func (ShareItemsBtnDef) ShouldComponentUpdateIntf ¶
type ShareItemsBtnElem ¶
type ShareItemsBtnElem struct {
}func ShareItemsBtn ¶
func ShareItemsBtn(p ShareItemsBtnProps) *ShareItemsBtnElem
type ShareItemsBtnProps ¶
type ShareItemsBtnProps struct {
// contains filtered or unexported fields
}
func (ShareItemsBtnProps) EqualsIntf ¶
func (s ShareItemsBtnProps) EqualsIntf(val react.Props) bool
func (ShareItemsBtnProps) IsProps ¶
func (s ShareItemsBtnProps) IsProps()
IsProps is an auto-generated definition so that ShareItemsBtnProps implements the myitcv.io/react.Props interface.
type SharedItem ¶
SharedItem's only purpose is of documentation, since we can't enforce the type and the fields of what we get from javascript through GetSelection. A SharedItem's expected keys are:
"blobRef": "sha1-foo", "isDir": "boolString",
where "sha1-foo" is the ref of a file or a dir to share. and the value for "isDir", interpreted as a boolean with strconv, reports whether the ref is of a dir.