-
Notifications
You must be signed in to change notification settings - Fork 348
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
208 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
require "v-accordion/dist/v-accordion.js" | ||
require "v-accordion/dist/v-accordion.css" | ||
|
||
module.exports = angular.module 'wordpress-hybrid-client.directives' | ||
.directive 'wphcMenu', ($log, RecursionHelper) -> | ||
restrict: 'E' | ||
transclude: false | ||
replace: false | ||
scope: | ||
list: "=" | ||
template: require './menu.html' | ||
bindToController: true | ||
controllerAs: 'menuCtrl' | ||
compile: (el) -> | ||
RecursionHelper.compile el | ||
controller: ($log, $scope, $element) -> | ||
vm = @ | ||
.directive 'wphcMenuSref', () -> | ||
restrict: 'A' | ||
scope: false | ||
controller: ($log, $scope, $element, $attrs, $ionicSideMenuDelegate) -> | ||
$attrs.$observe 'wphcMenuSrefIsExpandable', (value) => | ||
isExpandable = parseInt(value) > 0 | ||
$element.on 'click', (event) -> | ||
if isExpandable then event.preventDefault() else $ionicSideMenuDelegate.toggleLeft() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<div> | ||
<v-accordion> | ||
<div ng-repeat="item in ::menuCtrl.list track by $index"> | ||
<v-pane ng-if="item.type == 'external'" ng-class="::{'is-expandable': item.list}"> | ||
<v-pane-header wphc-href-in-app class="item" ng-class="::{'item-icon-left': item.icon}" menu-close target="_blank" ng-href="{{::item.href}}"> | ||
<i class="{{::item.icon}}" ng-if="::item.icon"></i> {{item.trans | translate}} | ||
</v-pane-header> | ||
<v-pane-content> | ||
<wphc-menu ng-if="::item.list" list="item.list"></wphc-menu> | ||
</v-pane-content> | ||
</v-pane> | ||
<v-pane ng-if="item.type == 'internal'" ng-class="::{'is-expandable': item.list}"> | ||
<v-pane-header class="item" ng-class="::{'item-icon-left': item.icon}" wphc-menu-sref wphc-menu-sref-is-expandable="{{::item.list.length}}" ui-sref="{{::item.route}}" ui-sref-active-eq="active"> | ||
<i class="{{::item.icon}}" ng-if="::item.icon"></i> {{item.trans | translate}} | ||
</v-pane-header> | ||
<v-pane-content> | ||
<wphc-menu ng-if="::item.list" list="item.list"></wphc-menu> | ||
</v-pane-content> | ||
</v-pane> | ||
<v-pane ng-if="item.type == 'separator'"> | ||
<v-pane-header class="item item-divider"> | ||
{{item.trans | translate}} | ||
</v-pane-header> | ||
<v-pane-content></v-pane-content> | ||
</v-pane> | ||
</div> | ||
</v-accordion> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
@mixin item($color, $amount) { | ||
> .item { | ||
background-color: $color; | ||
border-color: darken($color, $amount + 7%); | ||
i.icon { | ||
color: darken($menu-icon-color, $amount + 2%); | ||
} | ||
&.active{ | ||
background-color: darken($color, $amount + 10%); | ||
} | ||
&:after { | ||
color: darken($menu-icon-level-color, $amount + 2%); | ||
} | ||
&.item-divider { | ||
background-color: darken($color, $amount + 6%); | ||
border-color: darken($color, $amount + 10%); | ||
} | ||
} | ||
} | ||
@mixin recursive-item($from:1, $to:6, $color: #FFFFFF, $amount: 4%) { | ||
@if $from < $to { | ||
v-pane { | ||
$color: darken($color, $amount); | ||
@include item($color, $amount); | ||
@include recursive-item($from+1, $to, $color, $amount + 1%); | ||
} | ||
} | ||
} | ||
wphc-menu { | ||
v-accordion { | ||
v-pane { | ||
transition: transform $menu-pane-expand-duration; | ||
&.is-expanded-add > v-pane-content, | ||
&.is-expanded-remove > v-pane-content { | ||
transition: max-height $menu-pane-expand-duration; | ||
} | ||
&.is-expandable { | ||
> v-pane-header { | ||
padding-right: 30px; | ||
&:after { | ||
transform-origin: 50% 50%; | ||
transition: all $menu-pane-hover-duration; | ||
color: $menu-icon-level-color; | ||
content: "\f3d3"; | ||
font-family: "Ionicons"; | ||
position: absolute; | ||
right: 11px; | ||
top: 17px; | ||
font-size: 30px; | ||
} | ||
} | ||
> v-pane-content > div { | ||
will-change: transform, opacity; | ||
opacity: 0; | ||
transform: translate3d(0, 30px, 0); | ||
transition: transform $menu-pane-expand-duration, opacity $menu-pane-expand-duration; | ||
} | ||
} | ||
&.is-expanded { | ||
> v-pane-header { | ||
&:after { | ||
transform: rotate(90deg); | ||
|
||
// content: "\f3d0"; | ||
} | ||
} | ||
> v-pane-content > div { | ||
opacity: 1; | ||
transform: translate3d(0, 0, 0); | ||
} | ||
} | ||
i.icon { | ||
color: $menu-icon-color; | ||
} | ||
@include item($menu-starting-bg-color, 0%); | ||
@include recursive-item(1, $menu-max-depth, $menu-starting-bg-color, $menu-starting-darken-amount); | ||
} | ||
} | ||
} | ||
v-accordion { | ||
display: block; | ||
} | ||
v-pane { | ||
display: block; | ||
&.is-expanded { | ||
> v-pane-content > div { | ||
visibility: visible; | ||
} | ||
} | ||
} | ||
v-pane-header { | ||
display: block; | ||
position: relative; | ||
cursor: pointer; | ||
user-select: none; | ||
outline: none; | ||
&:focus { | ||
outline: none; | ||
} | ||
&[disabled] { | ||
pointer-events: none; | ||
} | ||
> div { | ||
display: block; | ||
} | ||
} | ||
v-pane-content { | ||
display: block; | ||
position: relative; | ||
overflow: hidden; | ||
max-height: 0; | ||
> div { | ||
visibility: none; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters