You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by ad...@apache.org on 2014/11/29 17:10:27 UTC

svn commit: r1642445 - in /ofbiz/branches/boostrap_theme/themes/bootstrap: includes/templates/htmlScreenMacroLibrary.ftl webapp/bootstrap/js/bootified.js

Author: adrianc
Date: Sat Nov 29 16:10:27 2014
New Revision: 1642445

URL: http://svn.apache.org/r1642445
Log:
Bootstrap theme - applied latest patches from Jira issue.

https://issues.apache.org/jira/browse/OFBIZ-5840

Modified:
    ofbiz/branches/boostrap_theme/themes/bootstrap/includes/templates/htmlScreenMacroLibrary.ftl
    ofbiz/branches/boostrap_theme/themes/bootstrap/webapp/bootstrap/js/bootified.js

Modified: ofbiz/branches/boostrap_theme/themes/bootstrap/includes/templates/htmlScreenMacroLibrary.ftl
URL: http://svn.apache.org/viewvc/ofbiz/branches/boostrap_theme/themes/bootstrap/includes/templates/htmlScreenMacroLibrary.ftl?rev=1642445&r1=1642444&r2=1642445&view=diff
==============================================================================
--- ofbiz/branches/boostrap_theme/themes/bootstrap/includes/templates/htmlScreenMacroLibrary.ftl (original)
+++ ofbiz/branches/boostrap_theme/themes/bootstrap/includes/templates/htmlScreenMacroLibrary.ftl Sat Nov 29 16:10:27 2014
@@ -153,7 +153,7 @@ under the License.
 
 <#macro renderContentFrame fullUrl width height border><iframe src="${fullUrl}" width="${width}" height="${height}" <#if border?has_content>border="${border}"</#if> /></#macro>
 <#macro renderScreenletBegin id title collapsible saveCollapsed collapsibleAreaId expandToolTip collapseToolTip fullUrlString padded menuString showMore collapsed javaScriptEnabled>
-<div class="panel panel-default"<#if id?has_content> id="${id}"</#if>><#-- <#rt/> -->
+<div class="panel panel-default"<#if id?has_content> id="${id}"</#if>>
 <#-- <#if showMore> -->
 <#if title?has_content>
 	<div class="panel-heading">
@@ -161,14 +161,12 @@ under the License.
 			<#assign btnId = "${id}-btn">
 			<div class="pull-left"><h3 class="panel-title">${title}</h3></div>
 			<div class="pull-right">
-				<a id="${btnId}" class="btn btn-default btn-sm" data-toggle="collapse" href="#${collapsibleAreaId}"><span class="glyphicon glyphicon-chevron-up"></span></a>
+				<a id="${btnId}" class="btn btn-default btn-sm" data-toggle="collapse" href="#${collapsibleAreaId}" aria-expanded="true" aria-controls="${btnId}"><span class="glyphicon glyphicon-chevron-up"></span></a>
 			</div>
 			<div class="clear"></div>
 			<script type="text/javascript">
-				jQuery(document).ready( function($){
-					$('#${btnId}').click(function(){
-						$(this).find('span').toggleClass('glyphicon-chevron-down glyphicon-chevron-up');
-					});
+				$('#${btnId}').click(function(){
+					$(this).find('span').toggleClass('glyphicon-chevron-up glyphicon-chevron-down');
 				});
 		    </script>
 		<#else>
@@ -176,24 +174,12 @@ under the License.
 		</#if>
 	</div>
 </#if>
-<#--
-<li class="<#rt/>
-<#if collapsed>
-collapsed"><a <#if javaScriptEnabled>onclick="javascript:toggleScreenlet(this, '${collapsibleAreaId}', '${saveCollapsed?string}', '${expandToolTip}', '${collapseToolTip}');"<#else>href="${fullUrlString}"</#if><#if expandToolTip?has_content> title="${expandToolTip}"</#if>
-<#else>
-expanded"><a <#if javaScriptEnabled>onclick="javascript:toggleScreenlet(this, '${collapsibleAreaId}', '${saveCollapsed?string}', '${expandToolTip}', '${collapseToolTip}');"<#else>href="${fullUrlString}"</#if><#if collapseToolTip?has_content> title="${collapseToolTip}"</#if>
-</#if>
->&nbsp;</a></li> -->
-<#-- </#if> -->
-<#--
-<#if !collapsed>
 ${menuString}
+<#if collapsible>
+	<div <#if collapsibleAreaId?has_content> id="${collapsibleAreaId}" </#if> class="panel-body collapse in">
+<#else>
+	<div <#if collapsibleAreaId?has_content> id="${collapsibleAreaId}" </#if> class="panel-body">
 </#if>
- -->
-${menuString}
-<#-- <br class="clear" /> -->
-<#-- </#if> -->
-<div <#if collapsibleAreaId?has_content> id="${collapsibleAreaId}" <#if collapsed> style="display: none;"</#if></#if><#-- <#if padded> --> class="panel-body" <#-- <#else> class="panel-body no-padding"</#if> -->>
 </#macro>
 <#macro renderScreenletSubWidget></#macro>
 <#macro renderScreenletEnd></div></div></#macro>

Modified: ofbiz/branches/boostrap_theme/themes/bootstrap/webapp/bootstrap/js/bootified.js
URL: http://svn.apache.org/viewvc/ofbiz/branches/boostrap_theme/themes/bootstrap/webapp/bootstrap/js/bootified.js?rev=1642445&r1=1642444&r2=1642445&view=diff
==============================================================================
--- ofbiz/branches/boostrap_theme/themes/bootstrap/webapp/bootstrap/js/bootified.js (original)
+++ ofbiz/branches/boostrap_theme/themes/bootstrap/webapp/bootstrap/js/bootified.js Sat Nov 29 16:10:27 2014
@@ -28,6 +28,28 @@ adds functionality to style layout eleme
 **************************************************/
 //Screen transforms
 OFBOOT.screenTransform = function(){
+	//Transform Layout containers
+	jQuery('div#column-container').addClass('row');
+	if(jQuery('div.left').length > 0){
+		if(jQuery('div.right').length > 0){
+			jQuery('div.left').removeClass('left').addClass('col-sm-2');
+			jQuery('div.right').removeClass('right').addClass('col-sm-2');
+			jQuery('div.center').removeClass('center').addClass('col-sm-8');
+		}else{
+			if(jQuery('div#content-main-section.leftonly')){
+				jQuery('div#content-main-section.leftonly').removeClass('leftonly').addClass('col-sm-10');
+			}
+			jQuery('div.left').removeClass('left').addClass('col-sm-2');
+		}
+	}else{
+		if(jQuery('div.right').length > 0){
+			jQuery('div.right').removeClass('right').addClass('col-sm-2');
+			jQuery('div.rightonly').removeClass('rightonly').addClass('col-sm-10');
+		}else{
+			jQuery('div#content-main-section').addClass('col-sm-12');
+		}
+	}
+	
 	if(jQuery('div.screenlet')){
 		jQuery('div.screenlet').removeClass( "screenlet" ).addClass( "panel panel-default" );
 		if('div.screenlet-body'){
@@ -170,6 +192,100 @@ OFBOOT.formTranforms = function(){
 			}*/
 		}
 	});
+	//Transform lookup field button
+	jQuery('form span.field-lookup a').each(function(){
+		var $id = jQuery(this).attr('id');
+		if ($id.indexOf("_lookupId_button") >= 0){
+			jQuery(this).addClass('btn btn-primary btn-sm').html('<span class="glyphicon glyphicon-search"></span>');
+		}
+	});
+	//Transform a:buttontext
+	jQuery('a.buttontext').removeClass('buttontext').addClass('btn btn-link btn-sm');
+}
+/************************
+ * Navigation Tansforms
+ ************************/
+OFBOOT.navigationTranforms = function(){
+	//Tansform button bar - style 1
+	jQuery('div.button-bar.button-style-1').each(function(){
+		jQuery(this).children('a').each(function(){
+			var btnClass = "btn btn-primary btn-sm";
+			var icon = "";
+			var contents = jQuery(this).text();
+			//jQuery(console.log(contents));
+			if(jQuery(this).hasClass('create')){
+				icon = '<span class="glyphicon glyphicon-plus"></span>';
+				jQuery(this).html(icon+ " "+contents);
+				jQuery(this).removeClass('create');
+			}else{
+				if(jQuery(this).hasClass('delete')){
+					jQuery(console.log(contents));
+					icon = '<span class="glyphicon glyphicon-remove"></span>';
+					jQuery(this).html(icon+ " "+contents);
+					jQuery(this).removeClass('delete');
+				}else{
+					if(jQuery(this).hasClass('search')){
+						jQuery(console.log(contents));
+						icon = '<span class="glyphicon glyphicon-search"></span>';
+						jQuery(this).html(icon+ " "+contents);
+						jQuery(this).removeClass('search');
+					}else{
+						if(jQuery(this).hasClass('refresh')){
+							jQuery(console.log(contents));
+							icon = '<span class="glyphicon glyphicon-refresh"></span>';
+							jQuery(this).html(icon+ " "+contents);
+							jQuery(this).removeClass('refresh');
+						}
+					}
+				}
+			}
+			jQuery(this).addClass(btnClass);
+		});
+		jQuery(this).removeClass('button-bar button-style-1').addClass('btn-group');
+	});
+	//Tansform button bar - style 2
+	jQuery('div.button-bar.button-style-2').each(function(){
+		//Wrap inline forms in form-group
+		var hasForm = jQuery(this).has("form").length;
+		if(!hasForm == 0){
+			jQuery(this).children('form').addClass('form-group').css('display','inline');
+		}
+		//Transform buttons
+		jQuery(this).children('a').each(function(){
+			var btnClass = "btn btn-link btn-sm";
+			var icon = "";
+			var contents = jQuery(this).text();
+			//jQuery(console.log(contents));
+			if(jQuery(this).hasClass('create')){
+				icon = '<span class="glyphicon glyphicon-plus"></span>';
+				jQuery(this).html(icon+ " "+contents);
+				jQuery(this).removeClass('create');
+			}else{
+				if(jQuery(this).hasClass('delete')){
+					jQuery(console.log(contents));
+					icon = '<span class="glyphicon glyphicon-remove"></span>';
+					jQuery(this).html(icon+ " "+contents);
+					jQuery(this).removeClass('delete');
+				}else{
+					if(jQuery(this).hasClass('search')){
+						jQuery(console.log(contents));
+						icon = '<span class="glyphicon glyphicon-search"></span>';
+						jQuery(this).html(icon+ " "+contents);
+						jQuery(this).removeClass('search');
+					}else{
+						if(jQuery(this).hasClass('refresh')){
+							jQuery(console.log(contents));
+							icon = '<span class="glyphicon glyphicon-refresh"></span>';
+							jQuery(this).html(icon+ " "+contents);
+							jQuery(this).removeClass('refresh');
+						}
+					}
+				}
+			}
+			jQuery(this).addClass(btnClass);
+		});
+		jQuery(this).removeClass('button-bar button-style-2').addClass('btn-group');
+	});
 }
 /************************
  * Miscellanous Transforms
@@ -186,6 +302,7 @@ LOAD 'EM UP
 //LOAD GLOBAL BOOTSTRAP FUNCTIONS
 jQuery(window).load(function(){
 	OFBOOT.screenTransform();
+	OFBOOT.navigationTranforms();
 	OFBOOT.tableTranforms();
 	OFBOOT.formTranforms();
 	OFBOOT.miscTranforms();