diff options
Diffstat (limited to 'polygerrit-ui/app/behaviors/gr-list-view-behavior/gr-list-view-behavior.html')
-rw-r--r-- | polygerrit-ui/app/behaviors/gr-list-view-behavior/gr-list-view-behavior.html | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/polygerrit-ui/app/behaviors/gr-list-view-behavior/gr-list-view-behavior.html b/polygerrit-ui/app/behaviors/gr-list-view-behavior/gr-list-view-behavior.html new file mode 100644 index 0000000000..597300e315 --- /dev/null +++ b/polygerrit-ui/app/behaviors/gr-list-view-behavior/gr-list-view-behavior.html @@ -0,0 +1,62 @@ +<!-- +Copyright (C) 2017 The Android Open Source Project + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + +http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +--> +<link rel="import" href="../base-url-behavior/base-url-behavior.html"> +<link rel="import" href="../gr-url-encoding-behavior.html"> +<script> +(function(window) { + 'use strict'; + + window.Gerrit = window.Gerrit || {}; + + /** @polymerBehavior Gerrit.ListViewBehavior */ + Gerrit.ListViewBehavior = [{ + computeLoadingClass(loading) { + return loading ? 'loading' : ''; + }, + + computeShownItems(items) { + return items.slice(0, 25); + }, + + getUrl(path, item) { + return this.getBaseUrl() + path + this.encodeURL(item, true); + }, + + /** + * @param {Object} params + * @return {string} + */ + getFilterValue(params) { + if (!params) { return ''; } + return params.filter || ''; + }, + + /** + * @param {Object} params + * @return {number} + */ + getOffsetValue(params) { + if (params && params.offset) { + return params.offset; + } + return 0; + }, + }, + Gerrit.BaseUrlBehavior, + Gerrit.URLEncodingBehavior, + ]; +})(window); +</script> |