Add placeholder for CLA views

This change generalizes the admin view to a placeholder view and uses
it for both the admin new and new CLA views.

Feature: Issue 5781
Change-Id: I48b6ac648fa0ad3492bc8840daef13c381226422
This commit is contained in:
Becky Siegel
2017-03-15 11:09:39 -07:00
parent 3e16c806cc
commit 04fc240733
8 changed files with 145 additions and 29 deletions

View File

@@ -15,38 +15,11 @@ limitations under the License.
-->
<link rel="import" href="../../../bower_components/polymer/polymer.html">
<link rel="import" href="../../shared/gr-placeholder/gr-placeholder.html">
<dom-module id="gr-admin-view">
<template>
<style>
main {
margin: 2em auto;
max-width: 46em;
}
h1 {
margin-bottom: .1em;
}
@media only screen and (max-width: 67em) {
main {
margin: 2em 0 2em 15em;
}
}
@media only screen and (max-width: 53em) {
.loading {
padding: 0 var(--default-horizontal-margin);
}
main {
margin: 2em 1em;
}
</style>
<main>
<h1>Admin</h1>
<section>
This page is not yet implemented in PolyGerrit. View it in the
<a id="gwtLink" href$="/?polygerrit=0#[[path]]" rel="external">
Old UI</a>
</section>
</main>
<gr-placeholder title="Admin" path="[[path]]"></gr-placeholder>
</template>
<script src="gr-admin-view.js"></script>
</dom-module>

View File

@@ -198,6 +198,17 @@
app.params = params;
});
page(/^\/settings\/(agreements|new-agreement)/, loadUser, function(data) {
restAPI.getLoggedIn().then(function(loggedIn) {
if (loggedIn) {
data.params.view = 'gr-cla-view';
app.params = data.params;
} else {
page.redirect('/login/' + encodeURIComponent(data.canonicalPath));
}
});
});
page(/^\/settings\/VE\/(\S+)/, function(data) {
restAPI.getLoggedIn().then(function(loggedIn) {
if (loggedIn) {

View File

@@ -30,6 +30,7 @@ limitations under the License.
<link rel="import" href="./change-list/gr-dashboard-view/gr-dashboard-view.html">
<link rel="import" href="./change/gr-change-view/gr-change-view.html">
<link rel="import" href="./diff/gr-diff-view/gr-diff-view.html">
<link rel="import" href="./settings/gr-cla-view/gr-cla-view.html">
<link rel="import" href="./settings/gr-registration-dialog/gr-registration-dialog.html">
<link rel="import" href="./settings/gr-settings-view/gr-settings-view.html">
@@ -128,6 +129,9 @@ limitations under the License.
<template is="dom-if" if="[[_showAdminView]]" restamp="true">
<gr-admin-view path="[[_path]]"></gr-admin-view>
</template>
<template is="dom-if" if="[[_showCLAView]]" restamp="true">
<gr-cla-view path="[[_path]]"></gr-cla-view>
</template>
<div id="errorView" class="errorView" hidden>
<div class="errorEmoji">[[_lastError.emoji]]</div>
<div class="errorText">[[_lastError.text]]</div>

View File

@@ -121,6 +121,7 @@
this.set('_showDiffView', view === 'gr-diff-view');
this.set('_showSettingsView', view === 'gr-settings-view');
this.set('_showAdminView', view === 'gr-admin-view');
this.set('_showCLAView', view === 'gr-cla-view');
if (this.params.justRegistered) {
this.$.registration.open();
}

View File

@@ -0,0 +1,25 @@
<!--
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="../../../bower_components/polymer/polymer.html">
<link rel="import" href="../../shared/gr-placeholder/gr-placeholder.html">
<dom-module id="gr-cla-view">
<template>
<gr-placeholder title="Agreements" path="[[path]]"></gr-placeholder>
</template>
<script src="gr-cla-view.js"></script>
</dom-module>

View File

@@ -0,0 +1,24 @@
// 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.
(function() {
'use strict';
Polymer({
is: 'gr-cla-view',
properties: {
path: String,
},
});
})();

View File

@@ -0,0 +1,53 @@
<!--
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="../../../bower_components/polymer/polymer.html">
<dom-module id="gr-placeholder">
<template>
<style>
main {
margin: 2em auto;
max-width: 46em;
}
h1 {
margin-bottom: .1em;
}
@media only screen and (max-width: 67em) {
main {
margin: 2em 0 2em 15em;
}
}
@media only screen and (max-width: 53em) {
.loading {
padding: 0 var(--default-horizontal-margin);
}
main {
margin: 2em 1em;
}
}
</style>
<main>
<h1>[[title]]</h1>
<section>
This page is not yet implemented in PolyGerrit. View it in the
<a id="gwtLink" href$="/?polygerrit=0#[[path]]" rel="external">
Old UI</a>
</section>
</main>
</template>
<script src="gr-placeholder.js"></script>
</dom-module>

View File

@@ -0,0 +1,25 @@
// 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.
(function() {
'use strict';
Polymer({
is: 'gr-placeholder',
properties: {
path: String,
title: String,
},
});
})();