Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix selection behavior for polymer 1.0 #75

Merged
merged 2 commits into from
Sep 3, 2015
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions assets/behavior.html
Original file line number Diff line number Diff line change
Expand Up @@ -170,8 +170,7 @@

this.setId()
var handler = function (ev) {
var val = self.multi ?
(elem.selectedValues || []) :
var val = self.multi ? (elem.selectedValues || []) :
(elem.selected || 0)

self.update(elem, self.name, val)
Expand Down
6 changes: 2 additions & 4 deletions src/basics/behavior.jl
Original file line number Diff line number Diff line change
Expand Up @@ -131,11 +131,10 @@ end

render(t::Selectable, state) =
render(t.tile, state) <<
Elem("selectable-behavior",
Elem("selectable-behavior", multi = t.multi,
attributes = @d(
:name=>t.name,
:selector=>t.selector,
:multi=>t.multi
:selector=>t.selector
)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The right way to fix this is to change this line to :multi=>boolattr(t.multi) right here. moving it out from attributes will cause updates to not trigger "multi-changed" event (assuming there is one).

)

Expand Down Expand Up @@ -231,4 +230,3 @@ wire(a, b, chan, attribute) =
arg(chan::Symbol, doc="The name of the channel.")
arg(attr::Symbol, doc="The attribute/property to connect.")
end

5 changes: 2 additions & 3 deletions src/library/layout2.jl
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ wrapbehavior(w::IconButton) =
clickable(w, name=w.name)


abstract Selection <: Widget
abstract Selection <: Widget

@api pages => (Pages <: Selection) begin #FIXME: Why is this a widget?
doc("A set of pages. Only one selected page will be visible at any given time.")
Expand All @@ -67,7 +67,7 @@ end

render(ps::Pages, state) =
Elem("iron-pages",
map(t -> Elem("section", render(t, state)), ps.pages.tiles),
map(t -> Elem("div", render(t, state)), ps.pages.tiles),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why was this needed?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is not required, the current docs for iron-pages indicate that these should be divs. I'd assume that selection would work, but I went with consistency.

https://elements.polymer-project.org/elements/iron-pages

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah, I guess that's fine.

attributes = @d(:selected=>ps.selected-1))

@api tabs => (Tabs <: Selection) begin
Expand Down Expand Up @@ -225,4 +225,3 @@ render(dm::DropdownMenu, state) = begin
)
end
wrapbehavior(d::DropdownMenu) = selectable(d, name=d.name, selector=".dropdown-content")