当前位置: 首页>>代码示例>>Golang>>正文


Golang prop.Class函数代码示例

本文整理汇总了Golang中github.com/davelondon/vecty/prop.Class函数的典型用法代码示例。如果您正苦于以下问题:Golang Class函数的具体用法?Golang Class怎么用?Golang Class使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了Class函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。

示例1: TestBranchControlView_Render

func TestBranchControlView_Render(t *testing.T) {

	cb := ctests.New(t).SetApp(true, false, false)
	defer cb.Finish()

	b := NewBranchControlView(cb.Ctx(), models.NewBranchModel(cb.Ctx(), &models.RootContents{Name: "a"}))

	expected := elem.Div(
		elem.Anchor(
			vecty.ClassMap{
				"toggle": true,
				"empty":  true,
			},
			event.Click(nil),
		),
		elem.Div(
			vecty.ClassMap{
				"node-content": true,
			},
			elem.Span(
				prop.Class("node-label"),
				event.Click(nil),
				vecty.Text("a"),
			),
			elem.Span(
				prop.Class("badge"),
				vecty.Style("display", "none"),
			),
		),
	)
	equal(t, expected, b.Render())

	cb.AssertAppSuccess()

}
开发者ID:kego,项目名称:ke,代码行数:35,代码来源:branchcontrol_test.go

示例2: Render

func (v *IconEditorView) Render() *vecty.HTML {
	v.editor = editors.NewStringEditorView(v.Ctx, v.model.Node.Map["url"], editable.Inline)
	url := ""
	if v.icon.Url != nil {
		url = v.icon.Url.Value()
	}
	return elem.Div(
		prop.Class("container-fluid"),
		elem.Div(
			prop.Class("row"),
			elem.Div(
				prop.Class("col-sm-10"),
				vecty.Style("padding-left", "0"),
				vecty.Style("padding-right", "0"),
				v.editor,
			),
			elem.Div(
				prop.Class("col-sm-2"),
				elem.Image(
					prop.Class("img-responsive"),
					style.MaxHeight("200px"),
					prop.Src(url),
				),
			),
		),
	)
}
开发者ID:kego,项目名称:ke,代码行数:27,代码来源:editor.go

示例3: Render

func (v *PanelView) Render() *vecty.HTML {
	var editor vecty.Component
	if v.node != nil {
		switch v.node.Type.NativeJsonType(v.Ctx) {
		case system.J_MAP:
			editor = NewMapView(v.Ctx, v.node)
		case system.J_ARRAY:
			editor = NewArrayView(v.Ctx, v.node)
		default:
			editor = NewStructView(v.Ctx, v.node)
		}
	} else if v.branch != nil {
		switch v.branch.Contents.(type) {
		case *models.DataContents:
			editor = NewPanelNavView(v.Ctx, v.branch).Contents(
				func() vecty.MarkupOrComponentOrHTML {
					return elem.UnorderedList(
						prop.Class("nav navbar-nav navbar-right"),
						elem.ListItem(
							elem.Anchor(
								vecty.Text("Add"),
								prop.Href("#"),
								event.Click(func(ev *vecty.Event) {
									addNewFile(v.Ctx, v.App, true)
								}).PreventDefault(),
							),
						),
					)
				},
			)
		case *models.TypesContents:
			editor = NewPanelNavView(v.Ctx, v.branch).Contents(
				func() vecty.MarkupOrComponentOrHTML {
					return elem.UnorderedList(
						prop.Class("nav navbar-nav navbar-right"),
						elem.ListItem(
							elem.Anchor(
								vecty.Text("Add"),
								prop.Href("#"),
								event.Click(func(ev *vecty.Event) {
									addNewFile(v.Ctx, v.App, false)
								}).PreventDefault(),
							),
						),
					)
				},
			)
		default:
			editor = NewPanelNavView(v.Ctx, v.branch)
		}
	}
	v.panel = elem.Div(
		prop.Class("content content-panel"),
		editor,
	)
	return v.panel
}
开发者ID:kego,项目名称:ke,代码行数:57,代码来源:panel.go

示例4: Render

func (v *PanelNavView) Render() *vecty.HTML {
	return elem.Navigation(
		prop.Class("navbar navbar-default navbar-static-top nagative-margin"),
		elem.Div(
			prop.Class("container-fluid"),
			elem.Div(
				prop.Class("navbar-header"),
				NewBreadcrumbsView(v.Ctx, v.branch),
			),
			v.contents(),
		),
	)
}
开发者ID:kego,项目名称:ke,代码行数:13,代码来源:panelnav.go

示例5: modal

func (v *AddPopupView) modal(markup ...vecty.MarkupOrComponentOrHTML) *vecty.HTML {

	return elem.Div(
		prop.ID("add-modal"),
		prop.Class("modal"),
		vecty.Data("backdrop", "static"),
		vecty.Data("keyboard", "false"),
		elem.Div(
			prop.Class("modal-dialog"),
			elem.Div(
				prop.Class("modal-content"),
				elem.Div(
					prop.Class("modal-header"),
					elem.Button(
						prop.Type(prop.TypeButton),
						prop.Class("close"),
						elem.Span(
							vecty.Text("×"),
						),
						event.Click(func(ev *vecty.Event) {
							v.App.Dispatch(&actions.CloseAddPopup{})
						}).PreventDefault(),
					),
					elem.Header4(
						prop.Class("modal-title"),
						vecty.Text("Add item"),
					),
				),
				vecty.List(markup),
				elem.Div(
					prop.Class("modal-footer"),
					elem.Button(
						prop.Type(prop.TypeButton),
						prop.Class("btn btn-default"),
						elem.Span(
							vecty.Text("Close"),
						),
						event.Click(func(ev *vecty.Event) {
							v.App.Dispatch(&actions.CloseAddPopup{})
						}).PreventDefault(),
					),
					elem.Button(
						prop.Type(prop.TypeButton),
						prop.Class("btn btn-primary"),
						elem.Span(
							vecty.Text("Save"),
						),
						event.Click(func(ev *vecty.Event) {
							v.save()
						}).PreventDefault(),
					),
				),
			),
		),
	)
}
开发者ID:kego,项目名称:ke,代码行数:56,代码来源:addpop.go

示例6: TestBranchRender2

func TestBranchRender2(t *testing.T) {

	cb := ctests.New(t).SetApp(true, true, false)
	defer cb.Finish()

	b := NewBranchView(cb.Ctx(), models.NewBranchModel(cb.Ctx(), &models.RootContents{Name: "a"}))
	expected := elem.Div(
		prop.Class("node"),
		NewBranchControlView(cb.Ctx(), models.NewBranchModel(cb.Ctx(), nil)),
		elem.Div(
			prop.Class("children"),
		),
	)
	equal(t, expected, b.Render())

}
开发者ID:kego,项目名称:ke,代码行数:16,代码来源:branch_test.go

示例7: Render

func (v *BoolEditorView) Render() *vecty.HTML {

	v.input = elem.Input(
		prop.Type(prop.TypeCheckbox),
		prop.Checked(v.model.Node.ValueBool),
		event.Change(func(e *vecty.Event) {
			v.App.Dispatch(&actions.Modify{
				Undoer:    &actions.Undoer{},
				Editor:    v.model,
				Before:    v.model.Node.NativeValue(),
				After:     e.Target.Get("checked").Bool(),
				Immediate: true,
			})
		}),
	)

	return elem.Div(
		prop.Class("checkbox"),
		elem.Label(
			v.input,
			vecty.Text(v.model.Node.Label(v.Ctx)),
		),
	)

}
开发者ID:kego,项目名称:ke,代码行数:25,代码来源:bool.go

示例8: errorBlock

func (v *MapView) errorBlock() *vecty.HTML {
	if !v.node.Invalid {
		return nil
	}

	errors := vecty.List{}
	for _, e := range v.node.Errors {
		errors = append(errors, elem.ListItem(vecty.Text(e.Description)))
	}
	return elem.Div(
		prop.Class("has-error"),
		elem.Paragraph(
			prop.Class("help-block text-danger"),
			elem.UnorderedList(errors),
		),
	)
}
开发者ID:kego,项目名称:ke,代码行数:17,代码来源:map.go

示例9: Render

func (v *BreadcrumbsView) Render() *vecty.HTML {
	if v.branch == nil {
		return elem.Div()
	}

	b := v.branch
	crumbs := vecty.List{}

	for b != nil {

		// copy value of b into new var because it will be used in the click
		// handler
		current := b

		if v.branch.Parent != nil && current.Parent == nil {
			break
		}

		var content vecty.List
		if current == v.branch {
			content = append(content,
				vecty.Text(
					current.Contents.Label(v.Ctx),
				),
			)
		} else {
			content = append(content,
				elem.Anchor(
					prop.Href("#"),
					vecty.Text(
						current.Contents.Label(v.Ctx),
					),
					event.Click(func(ev *vecty.Event) {
						v.App.Dispatch(&actions.BranchSelecting{Branch: current, Op: models.BranchOpClickBreadcrumb})
					}).PreventDefault(),
				),
			)
		}

		crumbs = append(
			vecty.List{
				elem.ListItem(
					vecty.ClassMap{
						"active": current == v.branch,
					},
					content,
				),
			},
			crumbs...,
		)
		b = b.Parent
	}
	return elem.OrderedList(
		prop.Class("breadcrumb"),
		crumbs,
	)
}
开发者ID:kego,项目名称:ke,代码行数:57,代码来源:breadcrumbs.go

示例10: Render

func (v *TreeView) Render() *vecty.HTML {
	if v.Root == nil {
		return elem.Div()
	}
	return elem.Div(
		prop.Class("content content-tree"),
		NewBranchView(v.Ctx, v.Root),
	)
}
开发者ID:kego,项目名称:ke,代码行数:9,代码来源:tree.go

示例11: Render

func (v *PageView) Render() *vecty.HTML {
	return elem.Body(
		prop.ID("wrapper"),
		NewHeader(v.Ctx),
		elem.Div(
			prop.Class("wrapper"),
			elem.Div(
				prop.ID("tree"),
				prop.Class("split split-horizontal"),
				NewTreeView(v.Ctx),
			),
			elem.Div(
				prop.ID("main"),
				prop.Class("split split-horizontal"),
				NewPanelView(v.Ctx),
			),
		),
		NewAddPopupView(v.Ctx),
	)
}
开发者ID:kego,项目名称:ke,代码行数:20,代码来源:page.go

示例12: Render

func (v *BranchControlView) Render() *vecty.HTML {
	if v.model == nil {
		v.holder = elem.Div()
		return v.holder
	}

	selected := v.App.Branches.Selected() == v.model

	icon := v.model.Icon()

	v.holder = elem.Div(
		elem.Anchor(
			vecty.ClassMap{
				"toggle":   true,
				"selected": selected,
				"plus":     icon == "plus",
				"minus":    icon == "minus",
				"unknown":  icon == "unknown",
				"empty":    icon == "empty",
			},
			event.Click(v.toggleClick),
		),
		elem.Div(
			vecty.ClassMap{
				"node-content": true,
				"selected":     selected,
			},
			elem.Span(
				prop.Class("node-label"),
				event.Click(v.labelClick),
				vecty.Text(v.model.Contents.Label(v.Ctx)),
			),
			elem.Span(
				prop.Class("badge"),
				vecty.Style("display", "none"),
			),
		),
	)
	return v.holder

}
开发者ID:kego,项目名称:ke,代码行数:41,代码来源:branchcontrol.go

示例13: helpBlock

func (v *EditorView) helpBlock() *vecty.HTML {
	if v.model.Node.Rule == nil || v.model.Node.Rule.Interface == nil {
		return nil
	}
	description := v.model.Node.Rule.Interface.(system.ObjectInterface).GetObject(v.Ctx).Description
	if description == "" {
		return nil
	}
	return elem.Paragraph(
		prop.Class("help-block"),
		vecty.Text(description),
	)
}
开发者ID:kego,项目名称:ke,代码行数:13,代码来源:editor.go

示例14: nullEditor

func nullEditor(ctx context.Context, n *node.Node, app *stores.App) *EditorView {
	add := func(e *vecty.Event) {
		types := n.Rule.PermittedTypes()
		if len(types) == 1 {
			// if only one type is compatible, don't show the
			// popup, just add it.
			app.Dispatch(&actions.Add{
				Undoer: &actions.Undoer{},
				Parent: n.Parent,
				Node:   n,
				Key:    n.Key,
				Type:   types[0],
			})
			return
		}
		app.Dispatch(&actions.OpenAddPopup{
			Parent: n.Parent,
			Node:   n,
			Types:  types,
		})
	}
	return NewEditorView(ctx, n).Icons(
		func() vecty.MarkupOrComponentOrHTML {
			return elem.Anchor(
				prop.Href("#"),
				event.Click(add).PreventDefault(),
				elem.Italic(
					prop.Class("editor-icon editor-icon-after glyphicon glyphicon-plus-sign"),
				),
			)
		},
	).Dropdown(
		func() vecty.MarkupOrComponentOrHTML {
			return elem.ListItem(
				elem.Anchor(
					prop.Href("#"),
					vecty.Text("Add"),
					event.Click(add).PreventDefault(),
				),
			)
		},
	)
}
开发者ID:kego,项目名称:ke,代码行数:43,代码来源:structfragment.go

示例15: Render

func (v *StringEditorView) Render() *vecty.HTML {

	contents := vecty.List{
		prop.Value(v.model.Node.ValueString),
		prop.Class("form-control"),
		event.KeyUp(func(e *vecty.Event) {
			getVal := func() interface{} {
				return e.Target.Get("value").String()
			}
			val := getVal()
			changed := func() bool {
				return val != getVal()
			}
			go func() {
				<-time.After(common.EditorKeyboardDebounceShort)
				if changed() {
					return
				}
				v.App.Dispatch(&actions.Modify{
					Undoer:  &actions.Undoer{},
					Editor:  v.model,
					Before:  v.model.Node.NativeValue(),
					After:   val,
					Changed: changed,
				})
			}()
		}),
	}

	if sr, ok := v.model.Node.Rule.Interface.(*system.StringRule); ok && sr.Long {
		v.input = elem.TextArea(
			contents,
		)
	} else {
		v.input = elem.Input(
			prop.Type(prop.TypeText),
			contents,
		)
	}

	return elem.Div(v.input)
}
开发者ID:kego,项目名称:ke,代码行数:42,代码来源:string.go


注:本文中的github.com/davelondon/vecty/prop.Class函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。