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

Temp u4 7342 #892

Merged
merged 8 commits into from Nov 17, 2015
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 6 additions & 6 deletions src/NuGet.Config
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<add key="nuget.org" value="https://www.nuget.org/api/v2/" />
<add key="umbracocore" value="http://www.myget.org/f/umbracocore/" />
</packageSources>
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<add key="nuget.org" value="https://www.nuget.org/api/v2/" />
<add key="umbracocore" value="http://www.myget.org/f/umbracocore/" />
</packageSources>
</configuration>
@@ -0,0 +1,70 @@
(function() {
'use strict';

function TableDirective() {

function link(scope, el, attr, ctrl) {

scope.clickItem = function(item, $event) {
if(scope.onClick) {
scope.onClick(item);
$event.stopPropagation();
}
};

scope.selectItem = function(item, $index, $event) {
if(scope.onSelect) {
scope.onSelect(item, $index, $event);
$event.stopPropagation();
}
};

scope.selectAll = function($event) {
if(scope.onSelectAll) {
scope.onSelectAll($event);
}
};

scope.isSelectedAll = function() {
if(scope.onSelectedAll && scope.items && scope.items.length > 0) {
return scope.onSelectedAll();
}
};

scope.isSortDirection = function (col, direction) {
if (scope.onSortingDirection) {
return scope.onSortingDirection(col, direction);
}
};

scope.sort = function(field, allow) {
if(scope.onSort) {
scope.onSort(field, allow);
}
};

}

var directive = {
restrict: 'E',
replace: true,
templateUrl: 'views/components/umb-table.html',
scope: {
items: '=',
itemProperties: "=",
onSelect: '=',
onClick: "=",
onSelectAll: "=",
onSelectedAll: "=",
onSortingDirection: "=",
onSort:"="
},
link: link
};

return directive;
}

angular.module('umbraco.directives').directive('umbTable', TableDirective);

})();
Expand Up @@ -12,7 +12,7 @@
var item = null;

if ($event.shiftKey === true) {

if(selectedIndex > firstSelectedIndex) {

start = firstSelectedIndex;
Expand Down Expand Up @@ -94,11 +94,89 @@
}
}

function selectAllItems(items, selection, $event) {

var checkbox = $event.target;
var clearSelection = false;

if (!angular.isArray(items)) {
return;
}

selection.length = 0;

for (var i = 0; i < items.length; i++) {

var item = items[i];

if (checkbox.checked) {
selection.push({id: item.id});
} else {
clearSelection = true;
}

item.selected = checkbox.checked;

}

if (clearSelection) {
selection.length = 0;
}

}

function isSelectedAll(items, selection) {

var numberOfSelectedItem = 0;

for(var itemIndex = 0; items.length > itemIndex; itemIndex++) {
var item = items[itemIndex];

for(var selectedIndex = 0; selection.length > selectedIndex; selectedIndex++) {
var selectedItem = selection[selectedIndex];

if(item.id === selectedItem.id) {
numberOfSelectedItem++;
}
}

}

if(numberOfSelectedItem === items.length) {
return true;
}

}


function setSortingDirection(col, direction, options) {
return options.orderBy.toUpperCase() === col.toUpperCase() && options.orderDirection === direction;
}


function setSorting(field, allow, options) {
if (allow) {
options.orderBy = field;

if (options.orderDirection === "desc") {
options.orderDirection = "asc";
} else {
options.orderDirection = "desc";
}
}
}



var service = {
selectHandler: selectHandler,
selectItem: selectItem,
deselectItem: deselectItem,
clearSelection: clearSelection
clearSelection: clearSelection,
selectAllItems: selectAllItems,
isSelectedAll: isSelectedAll,
setSortingDirection: setSortingDirection,
setSorting: setSorting
};

return service;
Expand Down
11 changes: 6 additions & 5 deletions src/Umbraco.Web.UI.Client/src/less/belle.less
Expand Up @@ -73,14 +73,14 @@
@import "gridview.less";
@import "footer.less";
@import "dragdrop.less";
@import "dashboards.less";
@import "dashboards.less";

@import "forms/umb-validation-label.less";

// Umbraco Components
@import "components/editor.less";
@import "components/overlays.less";
@import "components/card.less";
@import "components/editor.less";
@import "components/overlays.less";
@import "components/card.less";
@import "components/umb-sub-views.less";
@import "components/umb-editor-navigation.less";
@import "components/umb-editor-sub-views.less";
Expand All @@ -90,6 +90,7 @@
@import "components/umb-child-selector.less";
@import "components/umb-group-builder.less";
@import "components/umb-list-view.less";
@import "components/umb-table.less";
@import "components/umb-confirm-delete.less";
@import "components/umb-keyboard-shortcuts-overview.less";
@import "components/umb-checkbox-list.less";
Expand All @@ -112,7 +113,7 @@
@import "components/umb-file-dropzone.less";

//page specific styles
@import "pages/document-type-editor.less";
@import "pages/document-type-editor.less";
@import "pages/login.less";


Expand Down