camlistore.org: camlistore.org/server/camlistored/ui/goui/sharebutton Index | Files

package sharebutton

import "camlistore.org/server/camlistored/ui/goui/sharebutton"

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

Package Files

gen_ShareItemsBtn_reactGen.go sharebutton.go

func New Uses

func New(key string, config map[string]string, cbs *Callbacks) react.Element

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.

type Callbacks Uses

type Callbacks struct {

    // GetSelection returns the list of items selected for sharing.
    GetSelection func() []SharedItem `js:"getSelection"`

    // ShowSharedURL displays in a dialog an anchor with anchorURL for its
    // 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 Uses

type ShareItemsBtnDef struct {
    react.ComponentDef
}

ShareItemsBtnDef is the definition for the button, that Renders as a React Button.

func (ShareItemsBtnDef) OnClick Uses

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 Uses

func (s ShareItemsBtnDef) Props() ShareItemsBtnProps

Props is an auto-generated proxy to the current props of ShareItemsBtn

func (ShareItemsBtnDef) Render Uses

func (d ShareItemsBtnDef) Render() react.Element

func (ShareItemsBtnDef) ShouldComponentUpdateIntf Uses

func (s ShareItemsBtnDef) ShouldComponentUpdateIntf(nextProps react.Props, prevState, nextState react.State) bool

type ShareItemsBtnElem Uses

type ShareItemsBtnElem struct {
    react.Element
}

func ShareItemsBtn Uses

func ShareItemsBtn(p ShareItemsBtnProps) *ShareItemsBtnElem

type ShareItemsBtnProps Uses

type ShareItemsBtnProps struct {
    // contains filtered or unexported fields
}

func (ShareItemsBtnProps) EqualsIntf Uses

func (s ShareItemsBtnProps) EqualsIntf(val react.Props) bool

func (ShareItemsBtnProps) IsProps Uses

func (s ShareItemsBtnProps) IsProps()

IsProps is an auto-generated definition so that ShareItemsBtnProps implements the myitcv.io/react.Props interface.

type SharedItem Uses

type SharedItem map[string]string

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.

Package sharebutton imports 11 packages (graph) and is imported by 1 packages. Updated 2018-02-01. Refresh now. Tools for package owners.