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

Dashboard tabs active #41

Merged
merged 2 commits into from
Jun 3, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
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
1 change: 0 additions & 1 deletion Bowerfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ asset 'angular-devise'
asset 'ng-focus-if'
asset 'angular-ui-router'
asset 'intl-tel-input'
asset 'angular-ui-router-tabs'
asset 'angular-bootstrap-datetimepicker', github: 'dalelotts/angular-bootstrap-datetimepicker'
asset 'angular-ui-router-anim-in-out'
asset 'angular-credit-cards'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class DashboardController extends @NGController
{
heading: 'Profil'
route: 'dashboard.profile.personal'
routeActive: 'dashboard.profile'
isActive: @state.includes.bind(@state, 'dashboard.profile')
banner: "<%= asset_path('dashboard-banners/profil.jpg') %>"
}
{
Expand All @@ -33,13 +33,13 @@ class DashboardController extends @NGController
{
heading: 'Mes réservations'
route: 'dashboard.reservations.current'
routeActive: 'dashboard.reservations'
isActive: @state.includes.bind(@state, 'dashboard.reservations')
banner: "<%= asset_path('dashboard-banners/mes-reservations.jpg') %>"
}
{
heading: 'Compte'
route: 'dashboard.account.payment'
routeActive: 'dashboard.account'
isActive: @state.includes.bind(@state, 'dashboard.account')
banner: "<%= asset_path('dashboard-banners/compte.jpg') %>"
}
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,6 @@ class ProfileController extends @NGController
'$state'
]

tabs2: [
{ heading: 'Profil', route: 'dashboard.profile.personal' }
{ heading: 'Commentaires', route: 'dashboard.profile.reviews.received', routeActive: 'dashboard.profile.reviews' }
]

tabsReviews: [
{ heading: 'Reçus', route: 'dashboard.profile.reviews.received' }
{ heading: 'Envoyés', route: 'dashboard.profile.reviews.sent' }
Expand All @@ -23,6 +18,17 @@ class ProfileController extends @NGController
map: null

init: =>
@scope.tabs2 = [
{
heading: 'Profil'
route: 'dashboard.profile.personal'
}
{
heading: 'Commentaires'
route: 'dashboard.profile.reviews.received'
isActive: @state.includes.bind(@state, 'dashboard.profile.reviews')
}
]
@User
.get(1)
.then (user)=>
Expand Down
2 changes: 1 addition & 1 deletion app/assets/javascripts/application.js.erb
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
//= require angular-bootstrap/ui-bootstrap-tpls.min
//= require angular-devise/lib/devise-min
//= require ng-focus-if/focusIf.min
//= require angular-ui-router-tabs/src/ui-router-tabs
//= require angular-ui-router-tabs
//= require angular-bootstrap-datetimepicker/src/js/datetimepicker
//= require angular-bootstrap-datetimepicker/src/js/datetimepicker.templates
//= require angular-animate/angular-animate.min
Expand Down
47 changes: 0 additions & 47 deletions vendor/assets/bower_components/angular-ui-router-tabs/.bower.json

This file was deleted.

21 changes: 0 additions & 21 deletions vendor/assets/bower_components/angular-ui-router-tabs/LICENSE

This file was deleted.

125 changes: 0 additions & 125 deletions vendor/assets/bower_components/angular-ui-router-tabs/README.md

This file was deleted.

37 changes: 0 additions & 37 deletions vendor/assets/bower_components/angular-ui-router-tabs/bower.json

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,9 @@ angular.module('ui.router.tabs').directive(

/* whether to highlight given route as part of the current state */
$scope.active = function(tab) {
if (typeof tab.isActive === 'function') {
return tab.isActive();
}

var isAncestorOfCurrentRoute = $state.includes(tab.route, tab.params, tab.options);
return isAncestorOfCurrentRoute;
Expand All @@ -94,14 +97,14 @@ angular.module('ui.router.tabs').directive(
};

$scope.update_tabs();
}],
}],
templateUrl: function(element, attributes) {
return attributes.templateUrl || 'ui-router-tabs-default-template.html';
}
};
}]
}]
).run(
['$templateCache', function($templateCache) {
['$templateCache', function($templateCache) {
var CUSTOM_UI_VIEW_TEMPLATE = '<div>' +
'<uib-tabset class="tab-container" type="{{type}}" vertical="{{vertical}}" justified="{{justified}}" class="{{class}}">' +
'<uib-tab class="tab" ng-repeat="tab in tabs" heading="{{tab.heading}}" ' +
Expand All @@ -122,5 +125,5 @@ angular.module('ui.router.tabs').directive(

$templateCache.put('ui-router-tabs-custom-ui-view-template.html', CUSTOM_UI_VIEW_TEMPLATE);
$templateCache.put('ui-router-tabs-default-template.html', INLINE_TEMPLATE);
}]
}]
);