Skip to content

Commit

Permalink
Added Bootstrap Icon Picker
Browse files Browse the repository at this point in the history
  • Loading branch information
marcemarc committed Feb 26, 2013
1 parent 9093315 commit eb291ec
Show file tree
Hide file tree
Showing 9 changed files with 7,314 additions and 3 deletions.
6,307 changes: 6,307 additions & 0 deletions css/bootstrap.css

Large diffs are not rendered by default.

873 changes: 873 additions & 0 deletions css/bootstrap.min.css

Large diffs are not rendered by default.

Binary file added img/glyphicons-halflings-white.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/glyphicons-halflings.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 4 additions & 1 deletion test.aspx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="test.aspx.cs" Inherits="monosnow.umbraco.uCssClassNameDropdown.test" %>
<%@ Register Src="/usercontrols/FontAwesomeIconPicker.ascx" TagName="FontAwesomeIconPicker" TagPrefix="monosnow" %>
<%@ Register Src="/usercontrols/BootstrapIconPicker.ascx" TagName="BootstrapIconPicker" TagPrefix="monosnow" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
Expand All @@ -10,7 +11,9 @@
<body>
<form id="form1" runat="server">
<div>
<monosnow:FontAwesomeIconPicker ID="faip1" runat="server" />

<hr />
<monosnow:BootstrapIconPicker ID="bip2" runat="server" />
</div>
</form>

Expand Down
4 changes: 2 additions & 2 deletions test.aspx.designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 25 additions & 0 deletions usercontrols/BootstrapIconPicker.ascx
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="BootstrapIconPicker.ascx.cs" Inherits="monosnow.umbraco.uCssClassNameDropdown.usercontrols.BootstrapIconPicker" %>
<asp:ListView ID="lvIcons" runat="server" ItemPlaceholderID="itemPlaceHolder" GroupItemCount="4" GroupPlaceholderID="groupPlaceHolder">
<LayoutTemplate>
<div style="height:250px; width:650px;overflow:scroll">
<asp:PlaceHolder ID="groupPlaceHolder" runat="server"></asp:PlaceHolder>
</div>
</LayoutTemplate>
<GroupTemplate>
<div style="clear:both"></div>
<div>
<asp:PlaceHolder ID="itemPlaceHolder" runat="server"></asp:PlaceHolder>
</div>
</GroupTemplate>
<ItemTemplate>
<a style="text-decoration:none; font-size:1.4em;color:#000000" href="#" onclick="setDropdownValue('<%#Container.DataItem %>');"><div style="width:150px;height:50px;float:left;"><i class="icon-<%#Container.DataItem %>"></i> <%#Container.DataItem %></div></a>
</ItemTemplate>
</asp:ListView>
<asp:DropDownList ID="ddlIcons" runat="server"></asp:DropDownList>
<script type="text/javascript">
function setDropdownValue(selectedValue) {
document.getElementById("<%=ddlIcons.ClientID %>").value = selectedValue;
}
</script>
70 changes: 70 additions & 0 deletions usercontrols/BootstrapIconPicker.ascx.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using monosnow.umbraco.uCssClassNameDropdown.Services;

namespace monosnow.umbraco.uCssClassNameDropdown.usercontrols
{
public partial class BootstrapIconPicker : System.Web.UI.UserControl
{
protected override void OnPreRender(EventArgs e)
{
bool linkIncluded = false;
foreach (Control c in Page.Header.Controls)
{
if (c.ID == "BootstrapStylesheet")
{
linkIncluded = true;
}
}
if (!linkIncluded)
{
HtmlGenericControl csslink = new HtmlGenericControl("link");
csslink.ID = "BootstrapStylesheet";
csslink.Attributes.Add("href", "/css/bootstrap.css");
csslink.Attributes.Add("type", "text/css");
csslink.Attributes.Add("rel", "stylesheet");
Page.Header.Controls.Add(csslink);
}
}
protected void Page_Load(object sender, EventArgs e)
{

if (!Page.IsPostBack)
{
ClassNameRetrievalService _service = new ClassNameRetrievalService("/css/bootstrap.css", "bar", @".icon-(\S*?)\s{");
lvIcons.DataSource = _service.GetClassNames();
lvIcons.DataBind();
ddlIcons.DataSource = _service.GetClassNames();
ddlIcons.DataBind();
ddlIcons.Items.Insert(0, new ListItem("Choose...", ""));


}

}

#region IUsercontrolDataEditor Members

public object value
{
get
{
return ddlIcons.SelectedValue;
}
set
{
if (!String.IsNullOrEmpty(value.ToString()))
{
ddlIcons.SelectedValue = value.ToString();
}
}
}

#endregion
}
}
33 changes: 33 additions & 0 deletions usercontrols/BootstrapIconPicker.ascx.designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit eb291ec

Please sign in to comment.