Tuesday 11 June 2013

Enable Small Social Buttons in SharePoint 2010

To convert the large social buttons to smaller ones you simply have to modify the following:
Within your custom Master Page search for: “GlobalSiteLink3
Simply Add “-mini” to the control ID

Original Large Control:
<SharePoint:DelegateControl ControlId="GlobalSiteLink3" Scope="Farm" runat="server"/>
image

New Small Control ID:
<SharePoint:DelegateControl ControlId="GlobalSiteLink3-mini" Scope="Farm" runat="server"/>
image

If you want to make the small buttons horizontal versus vertical simply add the following to your custom CSS:

.ms-mini-socialNotif-Container{
white-space: nowrap;
}

image

How To: Hide Left Side Navigation on Home Page

"How can I hide the side nav bar on the main homepage layout ?? I want to be able to use the side NAV with in the team site etc etc, but I don't want it on the front page.. "

There are a couple of ways to do this in SharePoint 2010. If you are using a non-publishing site you can add a Content Editor Web Part to the page and add the following to the HTML Source.

image

<Style>
body #s4-leftpanel
{
display: none;
}     


.s4-ca
{
margin-left: 0px;
}
</style>


Basically the CSS above hides the left navigation Div, and then sets the content area to not have a left margin.

Once you are done, simply modify the web part and hide it on the page.
image

If you are using a publishing site for your homepage simply add the same styles specified above to a custom page layout. That way if you have a need for other pages that do not need the left side navigation you can re-use the page layout.

Change SharePoint 2010 Site Logo Via CSS

If you simply want to change the site logo via CSS globally, or for a single site. Without having to go to the Site Actions > Site Settings > Title and description > adding in a URL to site logo. Then simply do the following:
  • Copy your image anywhere users can access it
  • Paste in the following CSS into your custom CSS file

.s4-titlelogo{
background-image: url(/_layouts/images/centraladmin_security_48x48.png);
background-position:left center;
background-repeat: no-repeat;
}

.s4-titlelogo > a > img{
visibility: hidden;
width: 48px;
height: 48px;
}
  • Update the background image URL path above in red to where you uploaded the image
  • Change the width and height above in Blue to match the image dimensions.
Before: image

After: image

Display user profile picture next to welcome name

Here is a simple way to add in the logged in users profile picture right before or after the users name in the SharePoint 2010 ribbon.

1.) Add the following to the top of your custom master page right before the doctype: <%@ Register Tagprefix="SPSWC" Namespace="Microsoft.SharePoint.Portal.WebControls" Assembly="Microsoft.SharePoint.Portal, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
image

2.) Add in the following control right before the welcome text:
image

A nice feature that you can customize is if you don’t want to show a placeholder image if a users has not uploaded a custom picture you can simply change ShowPlaceholder="true" to “false”. and it will only show a picture if someone has specified a custom one in their profile.

Before:
image

After:
image

If you want to have the image on the right simply move the control after the welcome and muiselctor controls, also remove the float:left in the picture style:

<wssuc:Welcome id="IdWelcome" runat="server" EnableViewState="false"></wssuc:Welcome>

<wssuc:MUISelector ID="IdMuiSelector" runat="server"/>

<SPSWC:ProfilePropertyImage PropertyName="PictureUrl" style="height: 20px;" ShowPlaceholder="true" id="PictureUrlImage" runat="server"/>
The 20px height is that golden number because any larger and the image will get cropped off on the bottom in IE7 and in IE8 you will start to see some separation and cropping of the ribbon when viewing the other ribbon tabs.

30px height:
image

20px Height:
image

The inline CSS above on the control is just to keep this blog post simple, Its recommended to move that inline style into your custom CSS file.

Fix Long Quick Launch Flowing Over Footer


In some cases when you need to add a footer to a custom brand you will notice that on pages that have really tall left navigations (Quick Launch) and a small content area the left side navigation will overflow and display on top of your custom footer.

The reason for this is that your left side navigation is floating to the left of the content area. And therefore it is no longer being considered for height and will ignore your footer. By default your content area will push your custom footer down as it grows larger.

Here is an example where the left navigation is really long and floats on top of the custom footer:

image

To fix this you will need to set the footer div to have a inline-block property and also set the width to 100%. Your custom footer will be included right below that DIV. See below example.
<div id="s4-bodyContainer">
<div id="s4-mainarea"> <div id="s4-leftpanel"></div>
<div class="s4-ca”></div>
</div>
<div class="custom-footer"></div>
</div>
Here is some sample CSS that you can use to fix this:

Before:
.custom-footer{
padding: 20px 0px 20px 0px;
background-color: #21374c;
color: #FFF;
text-align: center;
width: 100%;
}

After:
.custom-footer{
display: inline-block;
width: 100%;

margin-top: 20px;
padding: 20px 0px 20px 0px;
background-color: #21374c;
color: #FFF;
text-align: center;
}

The top margin is just used to give some extra space between the footer and the left navigation.
This is how the page should look now.

image

For Center fixed width designs you would have something like this:

body #s4-workspace{
background-color: #000;
}
body #s4-bodyContainer{
width: 900px !important;
margin: auto !important;
background-color: #FFF;
}

.custom-footer{
display: inline-block;
width: 100%;

margin-top: 20px;
padding: 20px 0px 20px 0px;
background-color: #21374c;
color: #FFF;
text-align: center;
}

And the result would look like this:
image