HomeHelpTrac

Changeset 15718 for trunk/templates


Ignore:
Timestamp:
12/01/11 00:20:03 (6 months ago)
Author:
Alexander Trofimov
Message:

Forms - switcher

Location:
trunk/templates/base
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/templates/base/css/forms.css

    r15697 r15718  
    188188} 
    189189 
     190/* switcher */ 
     191 
     192.bx-switcher-cont { 
     193    position:relative; 
     194    width:60px; 
     195    height:24px;     
     196    overflow:hidden; 
     197    cursor:pointer; 
     198    border:1px solid #ccc; 
     199    border:1px solid rgba(64, 64, 64, 0.5); 
     200 
     201    -moz-border-radius: 15px; 
     202    -webkit-border-radius: 15px; 
     203    border-radius: 15px; 
     204 
     205    -webkit-box-shadow: inset 0px 0px 8px rgba(0, 0, 0, 0.5); 
     206    -moz-box-shadow: inset 0px 0px 8px rgba(0, 0, 0, 0.5); 
     207    box-shadow: inset 0px 0px 8px rgba(0, 0, 0, 0.5); 
     208 
     209    -webkit-transition: background-color 0.2s linear; 
     210    -moz-transition: background-color 0.2s linear; 
     211    -ms-transition: background-color 0.2s linear; 
     212    -o-transition: background-color 0.2s linear; 
     213} 
     214 
     215.bx-switcher-cont input { 
     216    position:absolute;  
     217    top:-30px; 
     218} 
     219 
     220.bx-switcher-canvas { 
     221    position:relative;   
     222    width:90px;  
     223 
     224    -webkit-transition: left 0.2s ease-in-out; 
     225    -moz-transition: left 0.2s ease-in-out; 
     226    -ms-transition: left 0.2s ease-in-out; 
     227    -o-transition: left 0.2s ease-in-out; 
     228} 
     229 
     230.bx-switcher-cont.on { 
     231    background-color: #9c6; 
     232} 
     233 
     234.bx-switcher-cont.off { 
     235    background-color: #fff; 
     236} 
     237 
     238.bx-switcher-cont.on .bx-switcher-canvas { 
     239    left:5px; 
     240} 
     241 
     242.bx-switcher-cont.off .bx-switcher-canvas { 
     243    left:-31px; 
     244} 
     245 
     246.bx-switcher-on, 
     247.bx-switcher-off, 
     248.bx-switcher-handler { 
     249    position:absolute;   
     250    top:-1px; 
     251    width:30px; 
     252    height:30px; 
     253    line-height:28px; 
     254} 
     255 
     256.bx-switcher-on { 
     257    left:0px; 
     258    width:2px; 
     259    height:14px; 
     260    margin:5px 0 0 15px; 
     261    background-color:#050; 
     262    border:1px solid #050; 
     263 
     264    -moz-border-radius: 3px; 
     265    -webkit-border-radius: 3px; 
     266    border-radius: 3px; 
     267 
     268    -webkit-box-shadow: 1px 1px 1px rgba(255, 255, 255, 1); 
     269    -moz-box-shadow: 1px 1px 1px rgba(255, 255, 255, 1); 
     270    box-shadow: 1px 1px 1px rgba(255, 255, 255, 1); 
     271} 
     272 
     273.bx-switcher-off {   
     274    left:60px; 
     275    width:16px; 
     276    height:16px; 
     277    padding:0 0 0 0; 
     278    margin:5px 14px 0 3px; 
     279 
     280    background-color:#aaa; 
     281 
     282    -moz-border-radius: 10px; 
     283    -webkit-border-radius: 10px; 
     284    border-radius: 10px; 
     285 
     286    -webkit-box-shadow: inset 0px 1px 2px #777;  
     287    -moz-box-shadow: inset 0px 1px 2px #777; 
     288    box-shadow: inset 0px 1px 2px #777; 
     289} 
     290 
     291.bx-switcher-off div { 
     292    position:absolute; 
     293    top:3px; 
     294    left:3px; 
     295    width:10px; 
     296    height:10px; 
     297    background-color:#fff; 
     298 
     299    -moz-border-radius: 10px; 
     300    -webkit-border-radius: 10px; 
     301    border-radius: 10px; 
     302 
     303    -webkit-box-shadow: 0px 1px 2px #777;  
     304    -moz-box-shadow: 0px 1px 2px #777; 
     305    box-shadow: 0px 1px 2px #777; 
     306} 
     307 
     308.bx-switcher-handler { 
     309    left:30px; 
     310    height:24px; 
     311    width:24px; 
     312    margin:0px; 
     313 
     314    background-color: #ececec; 
     315    background-image: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#fff), to(#e0e0e0)); 
     316    background-image: -webkit-linear-gradient(top, #fff, #e0e0e0);  
     317    background-image: -moz-linear-gradient(top, #fff, #e0e0e0);  
     318    background-image: -ms-linear-gradient(top, #fff, #e0e0e0);  
     319    background-image: -o-linear-gradient(top, #fff, #e0e0e0);  
     320    background-image: linear-gradient(top, #fff, #e0e0e0); 
     321 
     322    border:1px solid #ccc; 
     323    border:1px solid rgba(64, 64, 64, 0.5); 
     324    -moz-border-radius: 15px; 
     325    -webkit-border-radius: 15px; 
     326    border-radius: 15px; 
     327 
     328    -webkit-box-shadow: inset 0px -1px 1px rgba(0, 0, 0, 0.3);  
     329    -moz-box-shadow: inset 0px -1px 1px rgba(0, 0, 0, 0.3); 
     330    box-shadow: inset 0px -1px 1px rgba(0, 0, 0, 0.3); 
     331 
     332} 
     333 
    190334/* extra features */ 
    191335 
  • trunk/templates/base/scripts/BxBaseFormView.php

    r15697 r15718  
    396396            case 'email': 
    397397            case 'url': 
    398             case 'checkbox': 
     398            case 'checkbox':             
    399399            case 'radio': 
    400400            case 'file': 
     
    406406            case 'hidden': 
    407407                $sInput = $this->genInputStandard($aInput); 
     408            break; 
     409 
     410            case 'switcher': 
     411                $sInput = $this->genInputSwitcher($aInput); 
    408412            break; 
    409413 
     
    536540 
    537541        return  "<input $sAttrs />\n"; 
     542    } 
     543 
     544    /** 
     545     * Generate Switcher Input Element (based on checkbox) 
     546     * 
     547     * @param array $aInput 
     548     * @return string 
     549     */ 
     550    function genInputSwitcher(&$aInput) { 
     551        $aInput['type'] = 'checkbox'; 
     552        $sCheckbox = $this->genInputStandard(&$aInput); 
     553 
     554        $sClass = 'off'; 
     555        if (isset($aInput['checked']) and $aInput['checked']) 
     556            $sClass = 'on'; 
     557 
     558        return ' 
     559            <div class="bx-switcher-cont ' . $sClass . '">' . $sCheckbox . ' 
     560                <div class="bx-switcher-canvas"> 
     561                    <div class="bx-switcher-on">&nbsp;</div> 
     562                    <div class="bx-switcher-off"><div></div></div> 
     563                    <div class="bx-switcher-handler">&nbsp;</div> 
     564                </div> 
     565            </div>'; 
    538566    } 
    539567 
Note: See TracChangeset for help on using the changeset viewer.