CSS Box Model Attribute Ordering Convention - attributes

If you ever wonder in what order to enter your CSS attributes like border, padding, font-family, etc. Two common approaches seem to be Alphabetical and Box Model. (See:
Conventional Order of CSS properties)
This not to be confused with selectors (#id, .class, :hover, tagname) in which case the order matters very much.
The Alphabetical option does not make much sense to me. For one thing it sticks padding and line-height in the middle of width and height or left and top.
I will post a CW answer with the list from fordinteractive.com which was provided by jacobangel.
It is very nice, but it is not complete. There are a few items missing. I hope to find out where the missing ones go like font-style and clip.
Where should these new ones go in the list? Are there any others that are missing? If there was already a suggestion for the same thing then vote for that comment to show you think it is a good idea. Also there will probably be more that are missing. I hope for this to be a complete list. It would also be a good idea if there was a tool or IDE feature that would sort by this list.
I am posting this because there does not seem to be another page that can be found on Google and the one I do know of is incomplete (not even on Google that I could find). I expect that if new ones are edited in that we will have a complete list that everyone can follow.

Box Model Convention copied from http://fordinteractive.com/tools/propertyorder/propertyorder.css.
Additions should be edited in when they are found to be missing from the list. Please comment on where you think that additions and wait for some agreement before adding them to the final list.
display: ;
visibility: ;
float: ;
clear: ;
position: ;
top: ;
right: ;
bottom: ;
left: ;
z-index: ;
width: ;
min-width: ;
max-width: ;
height: ;
min-height: ;
max-height: ;
overflow: ;
margin: ;
margin-top: ;
margin-right: ;
margin-bottom: ;
margin-left: ;
padding: ;
padding-top: ;
padding-right: ;
padding-bottom: ;
padding-left: ;
border: ;
border-top: ;
border-right: ;
border-bottom: ;
border-left: ;
border-width: ;
border-top-width: ;
border-right-width: ;
border-bottom-width: ;
border-left-width: ;
border-style: ;
border-top-style: ;
border-right-style: ;
border-bottom-style: ;
border-left-style: ;
border-color: ;
border-top-color: ;
border-right-color: ;
border-bottom-color: ;
border-left-color: ;
outline: ;
list-style: ;
table-layout: ;
caption-side: ;
border-collapse: ;
border-spacing: ;
empty-cells: ;
font: ;
font-family: ;
font-size: ;
line-height: ;
font-weight: ;
text-align: ;
text-indent: ;
text-transform: ;
text-decoration: ;
letter-spacing: ;
word-spacing: ;
white-space: ;
vertical-align: ;
color: ;
background: ;
background-color: ;
background-image: ;
background-repeat: ;
background-position: ;
opacity: ;
cursor: ;
content: ;
quotes: ;
Where should clip go?
Where should user-select go? (not supported except by Mozilla with -moz-user-select and Chrome with -webkit-user-select. IE uses JavaScript onselectstart)
Where should border-radius go? (not supported except by Mozilla with -moz-border-radius and Chrome with -webkit-border-radius)
Please comment if you have a suggestion as to where something should go.

It makes sense to:
Group the properties with similar functions (like height and width or clear and float) because if we change the value of one property, we often change the value of other properties in the group too.
Order the property groups such that they are in decision sequence. For example position before float, because if I choose position: absolute, float will be irrelevant.

Related

No read access for Product in backoffice with new usergroup

I created a new usergroup but i'm trying to view the product node and i dont have permisions for read and write that.
I tried to add permissions using this but is not working.
$START_USERRIGHTS; ; ; ; ; ; ; ; ;
Type ; UID ; MemberOfGroups ; Password ; Target ; read ; change ; create ; remove ; change_perm
UserGroup ; xxxxxxxxxxxRole ; ; ; ; ; ; ; ;
; ; ; ; Category ; + ; + ; + ; + ;
; ; ; ; Product ; + ; + ; + ; + ;
; ; ; ; BaseStore ; + ; + ; + ; + ;
; ; ; ; CronJob ; + ; + ; + ; + ;
; ; ; ; Job ; + ; + ; + ; + ;
$END_USERRIGHTS; ; ; ; ;
Simple UserGroup is not respected by backoffice ,to support this create new backoffice role.
A BackofficeRole is an extension of UserGroup that is meant to be used for restricting access in Backoffice (i.e. UI configuration context defines an dimension called principal which actually work exactly on BackofficeRoles). It also introduces an attribute called authorities which extends restriction possibilities (i.e. widget access may be restricted only to specified authorities) - user may use only one role at the moment, but different roles may have same authorities.
You cannot use simple UserGroup then - it will not be respected by Backoffice.
Below you may find examples of restriction capabilities:
<context type="Product" component="myComponent" principal="user1">
...
</context>
<context type="Product" component="myComponent" principal="backofficeRole1">
...
</context>
<widget id="someWidget" widgetDefinitionId="com.hybris.someWidget"
access="backofficeRole1" />
<widget id="someWidget" widgetDefinitionId="com.hybris.someWidget"
access="authority1" />
The new usergroup newUserGroup should be given a read access (or even a write access if required) to the productCatalogVersion in which the members of that group will be able to view (read) the products details of that catalog version (Staged or Online, etc ..)
Here is an example of impex to give newUserGroup read access and write access to XYZ_ProductCatalog
INSERT_UPDATE CatalogVersion; catalog(id)[unique = true]; version[unique = true]; readPrincipals(uid)[mode = append]; writePrincipals(uid)[mode = append]
; XYZ_ProductCatalog ; Staged ; newUserGroupUID ; newUserGroupUID
; XYZ_ProductCatalog ; Online ; newUserGroupUID ; newUserGroupUID
You may modify the above impex to suit your use case.

Replace next N lines before a first/second/third/... match including the match

I'm trying to comment on the next 14 lines from the first match only.
This is the text to edit:
...
Text
{
id: userNameText
text: userName
color: ( hoverEnabled && hover ? colors.textHover : colors.text )
font: fonts.listItemMed
elide: Text.ElideRight
x: itemRoot.height + 12
y: 0
width: itemRoot.width - itemRoot.height - 26
}
Text
{
id: userLoginText
text: userLogin
color: ( hoverEnabled && hover ? (userName == "" ? colors.textHover : colors.textDimmedHover ) : (userName == "" ? colors.text : colors.textDimmed ) )
y: userName == "" ? 7 : userNameText.height * 0.8
font: userName == "" ? fonts.listItemBig : fonts.listItemSub
x: itemRoot.height + 12
elide: Text.ElideRight
width: itemRoot.width - itemRoot.height - 26
}
}
I am using sed and these are the 2 closest options I have gotten.
sed -e '/^ Text$/ {s/^/\/\//; n; s/^/\/\//; n; s/^/\/\//; n; s/^/\/\//; n; s/^/\/\//; n; s/^/\/\//; n; s/^/\/\//; n; s/^/\/\//; n; s/^/\/\//; n; s/^/\/\//; n; s/^/\/\//; n; s/^/\/\//; n; s/^/\/\//; n; s/^/\/\//; n; s/^/\/\//;}'
^^^
This comment next 14 lines in both "^ Text$"
sed -e '0,/^ Text$/ {s/^ Text$/\/\/ Text/}'
^^^
And this comment only the first match, if I invert the match with "!" I can comment the rest of the file instead but is not the idea 😅
The expected output would be:
...
// Text
// {
// id: userNameText
// text: userName
// color: ( hoverEnabled && hover ? colors.textHover : colors.text )
//
// font: fonts.listItemMed
//
// elide: Text.ElideRight
//
// x: itemRoot.height + 12
// y: 0
//
// width: itemRoot.width - itemRoot.height - 26
// }
Text
{
id: userLoginText
text: userLogin
color: ( hoverEnabled && hover ? (userName == "" ? colors.textHover : colors.textDimmedHover ) : (userName == "" ? colors.text : colors.textDimmed ) )
y: userName == "" ? 7 : userNameText.height * 0.8
font: userName == "" ? fonts.listItemBig : fonts.listItemSub
x: itemRoot.height + 12
elide: Text.ElideRight
width: itemRoot.width - itemRoot.height - 26
}
}
Any way to achieve this without inserting the exact lines is welcome!
Thank you so much to 'potong' and 'Cole Tierney', your answers made the way for me, I don't want to copy and paste, but you gave me good patterns to follow, you are awesome!
Here's a BSD sed version (comment.sed):
/Text/, /}/ {
s|^|//|
/}/ {
:idle
n
b idle
}
}
The first line /Text/, /}/ is a regex address range. Every line within that that range (inclusive) will be commented out. At the end of this range, the second /}/, we loop back to the idle label consuming the rest of the file. Otherwise the address range would also comment out the second Text block.
A one line version:
sed '/Text/, /}/ {s|^|//|; /}/ {:idle; n; b idle}}' input
To test:
diff expect <(sed -f comment.sed input) && echo ok
This might work for you (GNU sed):
sed '/^\s*Text/{:a;N;/^\(\s*\).*\n\1*}$/!ba;s/.*/\/\/ &/mg;:b;n;bb}' file
Gather up the lines from Text to }, insert // before them and then read the remainder of the file.

variable to switch the pre-requisites for a target in a Makefile

I wish to use 'MY_TYPE' to switch the prerequisites for the target 'top'.
based on MY_TYPE Can I select the pre-requisites required
For example, for
MY_TYPE=FOO , I wish to have $(BUILD) $(TARGETS) $(X_LOCALS) as pre-requisites for top
MY_TYPE=BAR , I wish to have $(BUILD) $(TARGETS) $(Y_LOCALS) as pre-requisites for top
How can I achieve it?
Below is a simple code snippet.
BUILD = build
TARGETS = targets
XLOCALS = xlocals
YLOCALS = ylocals
# can be FOO or BAR
MY_TYPE ?= FOO
$(BUILD):
printf "\t Doing Build\n"
$(TARGETS):
printf "\t Doing target\n"
$(XLOCALS):
printf "\t my local build for X \n"
$(YLOCALS):
printf "\t my local build for Y \n"
# based on MY_TYPE Can I select the pre-requisites required
# For example, for
# MY_TYPE=FOO , I wish to have $(BUILD) $(TARGETS) $(X_LOCALS) as pre-requisites for 'top' target
# MY_TYPE=BAR , I wish to have $(BUILD) $(TARGETS) $(Y_LOCALS) as pre-requisites for 'top' target
# How can I achieve it .
top: $(BUILD) $(TARGETS) $(XLOCALS)
printf "\t doing top\n"
Happy to take your thoughts.
Nothing easier, just use conditionals:
ifeq ($(MY_TYPE),FOO)
top: $(X_LOCALS)
endif
ifeq ($(MY_TYPE),BAR)
top: $(Y_LOCALS)
endif
top: $(BUILD) $(TARGETS)
#echo prereqs are $^

How to use tabs OOTB in hybris on mine custom tabs?

I want to create my custom tabs in hybris. I saw OOTB example for product details page. There has TabsSlot and for cmsComponents(&componentRef) use TabPanelContainer which contains 3 jsps with JspIncludeComponents. In my way I want to have in my custom page templete MyTabs for Slot and inside it I have again 3 jsps, but when load the page the content inside body is ok, but in head looks bad.
There don't has css classes , why is that and how can I make it?
The situaton is, I have 3 tabs for example, 2 of them I don't want to be editable in smartedit ( to be jspincludecomponent ) , but for other 1 I want to be custom component and will be editable from smatedit.
In cms-content.impex I created this.
INSERT_UPDATE JspIncludeComponent; $contentCV[unique = true]; uid[unique = true]; name ; page ; actions(uid, $contentCV); &componentRef
; ; Contact ; Contact ; contact.jsp ; ; Contact
; ; MySupportTickets ; My Support Tickets ; mySupportTickets.jsp ; ; MySupportTickets
; ; Faq ; Faq ; faqTab.jsp ; ; Faq
INSERT_UPDATE ContentSlot; $contentCV[unique = true]; uid[unique = true] ; name ; active; cmsComponents(&componentRef)
; ; Tabs ; Body Content Slot for Support and FAQ ; true ; FAQTabsContainer
INSERT_UPDATE ContentSlotForPage; $contentCV[unique = true]; uid[unique = true] ; position[unique = true]; page(uid, $contentCV)[unique = true][default = 'supportAndFAQPage']; contentSlot(uid, $contentCV)[unique = true]
; ; BodyContent-support-and-faq ; Tabs ; ; Tabs
INSERT_UPDATE CMSTabParagraphContainer; $contentCV[unique = true]; uid[unique = true]; name ; visible; simpleCMSComponents(uid, $contentCV); &componentRef
; ; FAQTabsContainer ; Tab container ; true ; Contact,MySupportTickets,Faq ; FAQTabsContainer
also I have one page which will use these jspincludecomponents inside it as <cms:PageSlot position="Tabs"/>
In jsps I use for head tabs <tabshead>....</tabshead> and for body <tabsbody>...</tabsbody> . The body looks ok with the html but header tabs looks bad. I don't know what is the reason

how to configure OOTB "inStockFlag" and "reviewAvgRating" index property as facets

Please help to achieve this. I added these two properties from non facets index property to facet index property in solr.implex file. Run the full indexer ,
added customer review for some of the products and approved the status as well in spite of that these two properties are not showing as facets in storefront.
Please guide me step by step how can I achieve this. I have already wasted 2.5 days to achieve the same.
I am using hybris 6.4
First, run the below Impex form the HAC. Don't forget to change apparel-ukProductType with your Indexed type.
$solrIndexedType=apparel-ukProductType
# Facet properties
INSERT_UPDATE SolrIndexedProperty ; solrIndexedType(identifier)[unique=true] ; name[unique=true] ; type(code) ; sortableType(code) ; currency[default=false] ; localized[default=false] ; multiValue[default=false] ; useForSpellchecking[default=false] ; useForAutocomplete[default=false] ; fieldValueProvider ; valueProviderParameters[map-delimiter=|] ; ftsPhraseQuery[default=false] ; ftsPhraseQueryBoost ; ftsQuery[default=false] ; ftsQueryBoost ; ftsFuzzyQuery[default=false] ; ftsFuzzyQueryBoost ; ftsWildcardQuery[default=false] ; ftsWildcardQueryType(code)[default=POSTFIX] ; ftsWildcardQueryBoost ; ftsWildcardQueryMinTermLength ; facetType(code) ; facetSort(code) ; priority ; visible ; facet[default=true]
; $solrIndexedType ; reviewAvgRating ; double ; ; ; TRUE ; ; ; ; productReviewAverageRatingValueProvider ; ; ; ; ; ; ; ; ; ; ; ; MultiSelectOr ; Custom ; 10000 ; true ;
; $solrIndexedType ; inStockFlag ; boolean ; ; ; ; ; ; ; productInStockFlagValueProvider ; ; ; ; ; ; ; ; ; ; ; ; MultiSelectOr ; Custom ; 10000 ; true ;
You can do the same changes from backoffice/hmc.
Go to System > Facet Search > Indexed Type > select your type from list > Find the inStockFlag under Properties filed > scroll to end (right) to edit inStockFlag properties > In popup go to facet setting tab > Mark Facet to true and edit other fields.
Lastly, run the full indexer.

Resources