/// <summary>
        /// Creates the block config icon.
        /// </summary>
        /// <param name="block">The block.</param>
        /// <returns></returns>
        protected string CreateConfigIcon( Block block )
        {
            var blockPropertyUrl = ResolveUrl( string.Format( "~/BlockProperties/{0}?t=Block Properties", block.Id ) );

            return string.Format( "<i class=\"fa fa-th-large\">&nbsp;</i> <a href=\"javascript: Rock.controls.modal.show($(this), '{0}')\" title=\"Block Properties\"><i class=\"fa fa-cog\"></i>&nbsp;</a>",
                blockPropertyUrl );
        }
示例#2
0
        // Adds the configuration html elements for editing a block
        private void AddBlockConfig( HtmlGenericContainer blockWrapper, Block block, 
            Rock.Web.Cache.BlockInstance blockInstance, bool canConfig, bool canEdit )
        {
            if ( canConfig || canEdit )
            {
                // Add the config buttons
                HtmlGenericControl blockConfig = new HtmlGenericControl( "div" );
                blockConfig.ClientIDMode = ClientIDMode.AutoID;
                blockConfig.Attributes.Add( "class", "block-configuration" );
                blockWrapper.Controls.Add( blockConfig );

                HtmlGenericControl blockConfigLink = new HtmlGenericControl( "a" );
                blockConfigLink.Attributes.Add( "class", "icon-button blockinstance-config" );
                blockConfigLink.Attributes.Add( "href", "#" );
                blockConfig.Controls.Add( blockConfigLink );

                HtmlGenericControl blockConfigBar = new HtmlGenericControl( "div" );
                blockConfigBar.Attributes.Add( "class", "block-configuration-bar" );
                blockConfig.Controls.Add( blockConfigBar );

                HtmlGenericControl blockConfigTitle = new HtmlGenericControl( "span" );
                if (string.IsNullOrWhiteSpace(blockInstance.Name))
                    blockConfigTitle.InnerText = blockInstance.Block.Name;
                else
                    blockConfigTitle.InnerText = blockInstance.Name;
                blockConfigBar.Controls.Add( blockConfigTitle );

                foreach ( Control configControl in block.GetConfigurationControls( canConfig, canEdit ) )
                {
                    configControl.ClientIDMode = ClientIDMode.AutoID;
                    blockConfigBar.Controls.Add( configControl );
                }
            }
        }