sharebutton

package
v0.0.0-...-89f6ccf Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 20, 2017 License: Apache-2.0 Imports: 10 Imported by: 0

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

func New(key string, config map[string]string, getSelection func() []SharedItem,
	showSharedURL func(string, string)) 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.

getSelection returns the list of items selected for sharing.

showSharedURL displays in a dialog an anchor with anchorURL for its href and anchorText for its text.

Types

type ShareItemsBtnDef

type ShareItemsBtnDef struct {
	react.ComponentDef
}

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

func ShareItemsBtn

func ShareItemsBtn(p ShareItemsBtnProps) *ShareItemsBtnDef

func (*ShareItemsBtnDef) Props

func (*ShareItemsBtnDef) Render

func (d *ShareItemsBtnDef) Render() react.Element

type ShareItemsBtnProps

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

type SharedItem

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL