module Admin::WebComponentHelper
  include ActionView::Helpers::TagHelper

  def alert_block_tag(title="",context="",*args)
    content_tag(:div,:class=>"alert alert-block alert-error fade in") do
      a = ActiveSupport::SafeBuffer.new
      a << button_tag( 'x',:class=>"close",:data=>{:dismiss=>"alert"}) if (args.first[:close] rescue false)
      a << content_tag(:h4,:class=>"alert-heading") do
        title
      end
      a << content_tag(:p) do
        context
      end
      # TODO : 可以提供更多功能
      # a << content_tag(:p) do
      #   b = link_to("Take this action","",:class=>"btn btn-danger") 
      #   b << link_to("Or do this","",:class=>"btn") 
      #   b
      # end
    end

  end
  end