Override btn-primary with btn-default

polarweb

Jeremiah
Alright, first off, why did folks decide btn-primary was the best option? Its retarded ugly. Why didn't folks just use btn-default? Its so much more friendly.

Anyhow, I dont want to change my base bootstrap css, I am going to build template overrides.

I need to know which file under form->bootstrap I need to edit to change btn-ugly-primary to btn-happy-default. Im looking and not finding it. .
 
Joomla 3 uses btn-primary for everything in the core. Login, Registration, Contact, everything. You either have two options:

1- Change the bootstrap.css file adjust the btn-primary css colors.
2- Create template overrides for each form, change btn-primary to btn-default.

Fabrik also uses btn-primary. As shown here:
 

Attachments

  • btn_primary.png
    btn_primary.png
    3.9 KB · Views: 248
See, i would just change the bootstrap css colors for the buttons, but i do alot of sites and its easier to copy all my overrides over as btn-default, than having to change the colors every single time I build a site.
 
Fabrik is using your Joomla template CSS.

So override your template CSS or set a Fabrik buttons CSS in custom_css.php.
 
Thanks man, i know thats a solution, but where can I change the actual button ouput, I don't want my submit button to use the btn-primary class.

I think its located around here, in form/bootstrap/default_actions.php

Code:
<?php
/**
* Bootstrap Form Template - Actions
*
* @package    Joomla
* @subpackage  Fabrik
* @copyright  Copyright (C) 2005-2013 fabrikar.com - All rights reserved.
* @license    GNU/GPL http://www.gnu.org/copyleft/gpl.html
* @since      3.1
*/
 
// No direct access
defined('_JEXEC') or die('Restricted access');
 
$form = $this->form;
if ($this->hasActions) : ?>
<div class="fabrikActions form-actions">
    <div class="row-fluid">
        <div class="span4">
            <div class="btn-group">
            <?php
            echo $form->submitButton . ' ';
            echo $form->applyButton . ' ';
            echo $form->copyButton;
            ?>
            </div>
        </div>
        <div class="span1"></div>
        <div class="span2">
            <div class="btn-group">
                <?php echo $form->prevButton . ' ' . $form->nextButton; ?>
            </div>
        </div>
        <div class="span1"></div>
 
        <div class="span4">
            <div class="pull-right btn-group">
                <?php
                echo $form->gobackButton  . ' ' . $this->message;
                echo $form->resetButton . ' ';
                echo  $form->deleteButton;
                ?>
            </div>
        </div>
    </div>
</div>
<?php
endif;
 
You can create a custom form template and do some string handling in default_actions.php

But why don't you just set something like
.fabrikForm .btn-primary ...
 
I suspect at some point we may apply layouts to the buttons, so you can change the markup for individual buttons, but for the moment they are "black boxed", as you can see in the template. In other words, the entire button is "prebuilt" in $form->whateverButton, with the code that builds them hard-wired into the view's PHP (or model, I forget which).

So as troester says, if you need to actually change the markup, you'd have to use some PHP string handling in a custom template, like preg_replace(), to get rid of the class you don't want in those whateverButton variables.

Or you might be able to do it with some custom JS on load, by selecting everything with that class, iterating through and removing the class.

-- hugh
 
I'll probably just do what troe said in the first place and in my custom css file just update the style for all btn-primary. I can just copy and paste this over to all my custom stylesheets until a different approach is available

Thanks guys.
 
the use of btn-primary is because its the primary action on the form. The css styling is kind of a separate issue, and really up to the user to do what they like with .
 
We are in need of some funding.
More details.

Thank you.

Staff online

Members online

Back
Top