Skip to content

Commit

Permalink
Shopping cart styles (step 1)
Browse files Browse the repository at this point in the history
  • Loading branch information
semancik committed Oct 11, 2016
1 parent a28cb89 commit d2a9007
Show file tree
Hide file tree
Showing 6 changed files with 160 additions and 43 deletions.
@@ -1,3 +1,18 @@
/*
* Copyright (c) 2016 Evolveum
*
* 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.
*/
package com.evolveum.midpoint.web.component.assignment;

import com.evolveum.midpoint.gui.api.component.BasePanel;
Expand All @@ -24,7 +39,9 @@
* Created by honchar.
*/
public class AssignmentCatalogPanel<F extends AbstractRoleType> extends BasePanel {
private static String ID_TREE_PANEL_CONTAINER = "treePanelContainer";
private static final long serialVersionUID = 1L;

private static String ID_TREE_PANEL_CONTAINER = "treePanelContainer";
private static String ID_TREE_PANEL = "treePanel";
private static String ID_CATALOG_ITEMS_PANEL_CONTAINER = "catalogItemsPanelContainer";
private static String ID_CATALOG_ITEMS_PANEL = "catalogItemsPanel";
Expand Down
@@ -1,3 +1,18 @@
/*
* Copyright (c) 2016 Evolveum
*
* 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.
*/
package com.evolveum.midpoint.web.component.assignment;

import com.evolveum.midpoint.gui.api.component.BasePanel;
Expand Down Expand Up @@ -46,7 +61,9 @@
* Created by honchar
*/
public class CatalogItemsPanel extends BasePanel implements IPageableItems {
private static String ID_MULTI_BUTTON_TABLE = "multiButtonTable";
private static final long serialVersionUID = 1L;

private static final String ID_MULTI_BUTTON_TABLE = "multiButtonTable";
private static final String ID_SEARCH_FORM = "searchForm";
private static final String ID_SEARCH = "search";
private static final String ID_PAGING_FOOTER = "pagingFooter";
Expand All @@ -57,7 +74,7 @@ public class CatalogItemsPanel extends BasePanel implements IPageableItems {
private static final String ID_BUTTON_TOOLBAR = "buttonToolbar";
private static final String ID_FOOTER = "footer";
private static final String ID_CART_BUTTON = "cartButton";
private static String ID_CART_ITEMS_COUNT = "itemsCount";
private static final String ID_CART_ITEMS_COUNT = "itemsCount";
private static final String ID_HEADER_PANEL = "headerPanel";

private static final String DOT_CLASS = CatalogItemsPanel.class.getName();
Expand Down
Expand Up @@ -17,13 +17,28 @@
xmlns:wicket="http://wicket.apache.org">
<body>
<wicket:panel>
<div class="row" wicket:id="row">
<div class="row shopping-cart-row" wicket:id="row">
<div wicket:id="cell">
<a wicket:id="assignmentButton" class="col-sm-3 btn btn-app" style="height: 80px;">
<span wicket:id="plusIcon" class="badge bg-green" style="font-size: 24px;"></span>
<i wicket:id="typeIcon"></i>
<label wicket:id="buttonLabel"></label>
</a>
<div class="col-lg-3 col-xs-6">
<div class="small-box bg-green shopping-cart-item-box">
<div wicket:id="inner" class="inner">
<h4 wicket:id="innerLabel"></h4>
</div>
<div class="icon">
<i wicket:id="typeIcon"></i>
</div>
<div class="shopping-cart-item-box-footer">
<span wicket:id="detailsLink" class="shopping-cart-item-button-details">
<!-- TODO: convert static text to tranlatable message -->
Details <i class="fa fa-arrow-circle-right"></i>
</span>
<span wicket:id="addToCartLink" class="shopping-cart-item-button-add">
<!-- TODO: convert static text to tranlatable message -->
Add to cart <i class="fa fa-plus-circle"></i>
</span>
</div>
</div>
</div>
</div>
</div>
</wicket:panel>
Expand Down
@@ -1,3 +1,18 @@
/*
* Copyright (c) 2016 Evolveum
*
* 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.
*/
package com.evolveum.midpoint.web.component.data;

import com.evolveum.midpoint.gui.api.component.BasePanel;
Expand All @@ -22,12 +37,15 @@
* Created honchar.
*/
public class MultiButtonTable extends BasePanel<List<AssignmentEditorDto>> {
private static final String ID_ROW = "row";
private static final long serialVersionUID = 1L;

private static final String ID_ROW = "row";
private static final String ID_CELL = "cell";
private static final String ID_BUTTON_TYPE_ICON = "typeIcon";
private static final String ID_BUTTON_LABEL = "buttonLabel";
private static final String ID_BUTTON_PLUS_ICON = "plusIcon";
private static final String ID_BUTTON = "assignmentButton";
private static final String ID_INNER = "inner";
private static final String ID_INNER_LABEL = "innerLabel";
private static final String ID_TYPE_ICON = "typeIcon";
private static final String ID_ADD_TO_CART_LINK = "addToCartLink";
private static final String ID_DETAILS_LINK = "detailsLink";

private long itemsCount = 0;
private long itemsPerRow = 0;
Expand Down Expand Up @@ -77,7 +95,7 @@ private void initLayout(){
}

protected void populateCell(WebMarkupContainer cellContainer, final AssignmentEditorDto assignment){
AjaxLink assignmentButton = new AjaxLink(ID_BUTTON) {
AjaxLink inner = new AjaxLink(ID_INNER) {
private static final long serialVersionUID = 1L;

@Override
Expand Down Expand Up @@ -107,45 +125,51 @@ public void detach() {
}
}
};
// assignmentButton.add(new AttributeModifier("class", "col-md-4"));
Label plusLabel = new Label(ID_BUTTON_PLUS_ICON, "+");
// plusLabel.add(new AttributeAppender("title", getPageBase().createStringResource("MultiButtonPanel.plusIconTitle")));
plusLabel.add(new AjaxEventBehavior("click") {
private static final long serialVersionUID = 1L;

@Override
protected void onEvent(AjaxRequestTarget target) {
addAssignmentPerformed(assignment, target);
}
});
assignmentButton.add(plusLabel);
cellContainer.add(inner);

Label nameLabel = new Label(ID_INNER_LABEL, assignment.getName());
inner.add(nameLabel);

AjaxLink detailsLink = new AjaxLink(ID_DETAILS_LINK) {
private static final long serialVersionUID = 1L;

@Override
public void onClick(AjaxRequestTarget target) {
// TODO
}

};
cellContainer.add(detailsLink);

AjaxLink addToCartLink = new AjaxLink(ID_ADD_TO_CART_LINK) {
private static final long serialVersionUID = 1L;

@Override
public void onClick(AjaxRequestTarget target) {
addAssignmentPerformed(assignment, target);
}

};
cellContainer.add(addToCartLink);


WebMarkupContainer icon = new WebMarkupContainer(ID_BUTTON_TYPE_ICON);
WebMarkupContainer icon = new WebMarkupContainer(ID_TYPE_ICON);
icon.add(new AttributeAppender("class", getIconClass(assignment.getType())));
assignmentButton.add(icon);

Label nameLabel = new Label(ID_BUTTON_LABEL, assignment.getName());
// nameLabel.add(new AjaxEventBehavior("click") {
// private static final long serialVersionUID = 1L;
// @Override
// protected void onEvent(AjaxRequestTarget ajaxRequestTarget) {
//
// }
// });
assignmentButton.add(nameLabel);
cellContainer.add(assignmentButton);
cellContainer.add(icon);

}

protected void assignmentDetailsPerformed(AjaxRequestTarget target){
}

private String getIconClass(AssignmentEditorDtoType type){
// TODO: switch to icon constants
if (AssignmentEditorDtoType.ROLE.equals(type)){
return "fa fa-street-view object-role-color";
return "fa fa-street-view";
}else if (AssignmentEditorDtoType.SERVICE.equals(type)){
return "fa fa-cloud object-service-color";
return "fa fa-cloud";
}else if (AssignmentEditorDtoType.ORG_UNIT.equals(type)){
return "fa fa-building object-org-color";
return "fa fa-building";
} else {
return "";
}
Expand Down
@@ -1,3 +1,18 @@
/*
* Copyright (c) 2016 Evolveum
*
* 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.
*/
package com.evolveum.midpoint.web.page.self;

import com.evolveum.midpoint.gui.api.page.PageBase;
Expand Down Expand Up @@ -42,6 +57,8 @@
label = "PageAssignmentShoppingKart.auth.requestAssignment.label",
description = "PageAssignmentShoppingKart.auth.requestAssignment.description")})
public class PageAssignmentShoppingKart extends PageSelf {
private static final long serialVersionUID = 1L;

private static final String ID_MAIN_PANEL = "mainPanel";
private static final String ID_MAIN_FORM = "mainForm";
private static final String ID_VIEW_TYPE = "type";
Expand Down
27 changes: 27 additions & 0 deletions gui/admin-gui/src/main/webapp/less/midpoint-theme.less
Expand Up @@ -1082,4 +1082,31 @@ th.cog, td.cog {

dd.stacktrace::before {
content: none;
}

// Shopping cart

.shopping-cart-item-box {

.inner {
min-height: 90px;
}
}

.shopping-cart-item-box-footer {
padding: 3px;
padding-left: 8px;
padding-right: 8px;
color: rgba(255, 255, 255, 0.8);
display: block;
z-index: 10;
background: rgba(0, 0, 0, 0.1);

.shopping-cart-item-button-details {

}

.shopping-cart-item-button-add {
float: right;
}
}

0 comments on commit d2a9007

Please sign in to comment.