foam-framework
Version:
MVC metaprogramming framework
124 lines (109 loc) • 3.6 kB
JavaScript
/**
* @license
* Copyright 2015 Google Inc. All Rights Reserved.
*
* 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.
*/
CLASS({
package: 'foam.apps.mbug.ui',
name: 'ChangeProjectView',
extends: 'foam.ui.DetailView',
traits: [ 'foam.ui.layout.PositionedDOMViewTrait' ],
requires: [
// TODO: Hack to ensure that the CSS for appcontroller comes before
// ChangeProjectView.
'foam.ui.md.AppController',
'foam.ui.ImageView'
],
properties: [
{ name: 'preferredWidth', defaultValue: 304 },
{ name: 'className', defaultValue: 'change-project-view' },
],
templates: [
function CSS() {/*
.change-project-view {
margin: 0;
padding: 0;
box-shadow: 1px 0 1px rgba(0,0,0,.1);
font-size: 14px;
font-weight: 500;
background: white;
display: flex;
flex-direction: column;
height: 100%;
}
.change-project-view .header {
width: 100%;
height: 172px;
margin-bottom: 0;
background-image: url('images/projectBackground.png');
}
.change-project-view span[name=email] {
color: white;
display: block;
margin-top: 40;
padding-left: 16px;
font-weight: 500;
font-size: 16px;
}
.change-project-view .projectList {
flex: 1;
overflow-y: auto;
padding: 8px 0;
}
.change-project-view .monogram-string-view {
margin: 16px;
}
.project-citation {
margin-top: 0;
height: 48px;
}
.project-citation img {
margin-right: 0;
width: 24px;
height: 24px;
margin: 12px 16px;
vertical-align: middle;
}
.project-citation .project-name {
color: rgba(0,0,0,.8);
font-size: 14px;
margin-left: 16px;
vertical-align: middle;
}
.project-citation .project-name.selected {
color: #3e50b4;
}
*/},
function toInnerHTML() {/*
<div class="header">
$$email{model_: 'foam.ui.md.MonogramStringView', width: 64}
$$email{mode: 'display-only'}
<br><br>
</div>
<div class="projectList">
<%
var projects = this.data.preferredProjects;
if ( projects.indexOf('chromium') == -1 ) projects.push('chromium');
if ( projects.indexOf('foam-framework') == -1 ) projects.push('foam-framework');
projects.forEach(function(project) { %>
<% if ( ' chromium-os chromedriver cinc crwm chrome-os-partner ee-testers-external '.indexOf(' ' + project + ' ') != -1 ) return; %>
<div id="<%= self.on('click', function() { self.X.stack.back(); self.X.mbug.setProject(project); }, self.nextID()) %>" class="project-citation">
<%= self.ImageView.create({backupImage: 'images/defaultlogo.png', data: self.X.baseURL + project + '/logo'}) %>
<span class="project-name <%= self.X.projectName === project ? 'selected' : '' %>"><%= project %></span>
</div>
<% }); %>
</div>
*/}
]
});