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

[RFR] Update ui-bootstrap #947

Merged
merged 2 commits into from
Mar 2, 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
3 changes: 1 addition & 2 deletions doc/Production.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ Here is a snippet showing all required scripts:
<link rel="stylesheet" href="node_modules/ng-admin/build/ng-admin-only.min.css" />

<script src="node_modules/angular/angular.js"></script>
<script src="node_modules/angular-bootstrap/ui-bootstrap-tpls.min.js"></script>
<script src="node_modules/angular-bootstrap/ui-bootstrap.min.js"></script>
<script src="node_modules/angular-ui-bootstrap/dist/ui-bootstrap-tpls.js"></script>
<script src="node_modules/angular-resource/angular-resource.min.js"></script>
<script src="node_modules/angular-sanitize/angular-sanitize.min.js"></script>
<script src="node_modules/angular-ui-codemirror/ui-codemirror.min.js"></script>
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@
"devDependencies": {
"admin-config": "^0.11.0",
"angular": "~1.4.8",
"angular-bootstrap": "^0.12.0",
"angular-mocks": "~1.4.8",
"angular-numeraljs": "^1.1.6",
"angular-sanitize": "^1.3.15",
"angular-ui-bootstrap": "~1.2.1",
"angular-ui-codemirror": "^0.3.0",
"angular-ui-router": "^0.2.14",
"angularjs": "0.0.1",
Expand Down
2 changes: 1 addition & 1 deletion src/javascripts/ng-admin/Crud/CrudModule.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ CrudModule.service('RestWrapper', require('./misc/RestWrapper'));

CrudModule.directive('maJsonValidator', require('./validator/maJsonValidator'));

CrudModule.directive('datepickerPopup', require('./field/datepickerPopup'));
CrudModule.directive('uibDatepickerPopup', require('./field/datepickerPopup'));
CrudModule.directive('maField', require('./field/maField'));
CrudModule.directive('maButtonField', require('./field/maButtonField'));
CrudModule.directive('maChoiceField', require('./field/maChoiceField'));
Expand Down
2 changes: 1 addition & 1 deletion src/javascripts/ng-admin/Crud/button/maViewBatchActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export default function maViewBatchActionsDirective() {
},
// the ng-class hidden is necessary to hide the inner blank space used for spacing buttons when the selection is not empty
template:
`<span ng-if="selection" ng-class="{hidden:!selection || selection.length==0}"> <span class="btn-group" dropdown is-open="isopen"><button type="button" ng-if="selection.length" class="btn btn-default dropdown-toggle" dropdown-toggle >
`<span ng-if="selection" ng-class="{hidden:!selection || selection.length==0}"> <span class="btn-group" uib-dropdown is-open="isopen"><button type="button" ng-if="selection.length" class="btn btn-default dropdown-toggle" uib-dropdown-toggle >
{{ selection.length }} Selected <span class="caret"></span>
</button>
<ul class="dropdown-menu" role="menu">
Expand Down
6 changes: 5 additions & 1 deletion src/javascripts/ng-admin/Crud/field/datepickerPopup.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,23 @@
/**
* Fixes an issue with Bootstrap Date Picker
* @see https://github.com/angular-ui/bootstrap/issues/2659
* @see https://github.com/angular-ui/bootstrap/pull/4062
*
* How does it work? AngularJS allows multiple directives with the same name,
* and each is treated independently though they are instantiated based on the
* same element/attribute/comment.
*
* So this directive goes along with ui.bootstrap's datepicker-popup directive.
* So this directive goes along with ui.bootstrap's uib-datepicker-popup directive.
* @see http://angular-ui.github.io/bootstrap/versioned-docs/0.12.0/#/datepicker
*/
export default function datepickerPopup() {
return {
restrict: 'EAC',
require: 'ngModel',
link: function(scope, element, attr, controller) {
// 'new Date' fallback
scope.value = scope.value instanceof Date ? scope.value:new Date(scope.value);

//remove the default formatter from the input directive to prevent conflict
controller.$formatters.shift();
}
Expand Down
2 changes: 1 addition & 1 deletion src/javascripts/ng-admin/Crud/field/maDateField.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export default function maDateField() {
`<div class="input-group datepicker">
<input
type="text" ng-model="rawValue" id="{{ name }}" name="{{ name }}" class="form-control"
datepicker-popup="{{ format }}" is-open="isOpen" close-text="Close" ng-required="v.required" />
uib-datepicker-popup="{{ format }}" is-open="isOpen" close-text="Close" ng-required="v.required" />
<span class="input-group-btn">
<button type="button" class="btn btn-default" ng-click="toggleDatePicker($event)">
<i class="glyphicon glyphicon-calendar"></i>
Expand Down
4 changes: 2 additions & 2 deletions src/javascripts/ng-admin/Crud/filter/maFilterButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ export default function maFilterButton() {
scope.hasFilters = () => scope.notYetEnabledFilters().length > 0;
},
template:
`<span class="btn-group" dropdown is-open="isopen" ng-if="hasFilters()">
<button type="button" class="btn btn-default dropdown-toggle" dropdown-toggle >
`<span class="btn-group" uib-dropdown is-open="isopen" ng-if="hasFilters()">
<button type="button" class="btn btn-default dropdown-toggle" uib-dropdown-toggle >
<span class="glyphicon glyphicon-filter" aria-hidden="true"></span>&nbsp;<span class="hidden-xs">Add filter </span><span class="caret"></span>
</button>
<ul class="dropdown-menu" role="menu">
Expand Down
3 changes: 1 addition & 2 deletions src/javascripts/test/karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ module.exports = function (config) {
frameworks: ['jasmine'],
files: [
'../../node_modules/angular/angular.js',
'../../node_modules/angular-bootstrap/ui-bootstrap.min.js',
'../../node_modules/angular-bootstrap/ui-bootstrap-tpls.min.js',
'../../node_modules/angular-ui-bootstrap/dist/ui-bootstrap-tpls.js',
'../../node_modules/angular-mocks/angular-mocks.js',
'../../node_modules/angular-numeraljs/dist/angular-numeraljs.min.js',
'../../node_modules/numeral/numeral.js',
Expand Down
6 changes: 3 additions & 3 deletions src/javascripts/test/unit/Crud/field/maDateFieldSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ describe('directive: date-field', function() {
scope.value = date;
var element = $compile(directiveUsage)(scope);
scope.$digest();
expect(element.find('input').eq(0).attr('datepicker-popup')).toBe('yyyy-MM');
expect(element.find('input').eq(0).attr('uib-datepicker-popup')).toBe('yyyy-MM');
});

it("should add any supplied attribute", function () {
Expand All @@ -55,9 +55,9 @@ describe('directive: date-field', function() {
});

it("should contain the bounded value", function () {
var now = '2015-04-05';
scope.value = new Date(now);
scope.field = new DateField();
var now = '2015-03-05';
scope.value = now;
var element = $compile(directiveUsage)(scope);
scope.$digest();
expect(element.find('input').eq(0).val()).toBe(now);
Expand Down
3 changes: 1 addition & 2 deletions src/javascripts/vendors.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ require('textangular');
require('ui-select');

require('../../node_modules/angular-numeraljs/dist/angular-numeraljs');
require('angular-bootstrap/ui-bootstrap');
require('angular-bootstrap/ui-bootstrap-tpls');
require('angular-ui-bootstrap/dist/ui-bootstrap-tpls');
require('../../node_modules/ng-file-upload/dist/ng-file-upload');

global._ = require('underscore');