- Posts: 182
- Thank you received: 0
个人事务
Fabrikar:Custom Styling a List
- btt
- [btt]
- Topic Author
- Offline
- Administrator
Less
More
13 Sep 2020 22:05 - 13 Sep 2020 22:07 #80
by btt
New Topic
Major CSS styling
If you need to make major changes to the CSS, we recommend you use the #Template_Overrides method outlined in the main Advanced Lists wiki entry. But that means you are completely replacing Fabrik's standard CSS, and you will no longer automatically inherit any CSS improvements that are made in these templates.
So if you just need to make a few simple tweaks or additions to a given template, you can use a custom_css.php file, which is included after (rather than used instead of) the default template_css.php for the template.
To create your custom_css.php in standard Fabrik view folder, copy the example file provided with Fabrik from:
components/com_fabrik/views/list/tmpl/default/custom_css_example.php
to:
components/com_fabrik/views/list/tmpl/default/custom_css.php
Replace 'default' with whatever template you are using. There is also an example custom CSS in the default list template folder. Read the comments in this file for details of how to use it. Your custom_css.php will not be affected by updating Fabrik (either by ZIP or github), as we never include these files in the Git Repo.
Note: We will also include a custom.css file if one is present, for backward compatibility with Fabrik 2.x, however we recommend that you convert your custom.css to custom_css.php, see the example file for details.
Minor CSS Styling
The best method of tweaking CSS styling is to use a developer tool like firebug (firefox addon) to examine the CSS classes you want to modify.
If the modifications should be applied to one list only use:
#listform_X_com_fabrik_X (X is your list ID)
instead of:
#listform_$c
Examples
Change header background to green,transparent
Change header text color to black, without shadow
Change one column (header + entries)
Replace FULL_ELEMENTNAME with your element name (tablename___elementname):
Change group heading
Hide "CheckAll" checkbox
To hide the header checkbox (X= list ID)
Hide "View" button
To hide the View button (if Render Buttons as = Inline)
Styling a Row based on element selection
If you need to make major changes to the CSS, we recommend you use the #Template_Overrides method outlined in the main Advanced Lists wiki entry. But that means you are completely replacing Fabrik's standard CSS, and you will no longer automatically inherit any CSS improvements that are made in these templates.
So if you just need to make a few simple tweaks or additions to a given template, you can use a custom_css.php file, which is included after (rather than used instead of) the default template_css.php for the template.
To create your custom_css.php in standard Fabrik view folder, copy the example file provided with Fabrik from:
components/com_fabrik/views/list/tmpl/default/custom_css_example.php
to:
components/com_fabrik/views/list/tmpl/default/custom_css.php
Replace 'default' with whatever template you are using. There is also an example custom CSS in the default list template folder. Read the comments in this file for details of how to use it. Your custom_css.php will not be affected by updating Fabrik (either by ZIP or github), as we never include these files in the Git Repo.
Note: We will also include a custom.css file if one is present, for backward compatibility with Fabrik 2.x, however we recommend that you convert your custom.css to custom_css.php, see the example file for details.
Minor CSS Styling
The best method of tweaking CSS styling is to use a developer tool like firebug (firefox addon) to examine the CSS classes you want to modify.
If the modifications should be applied to one list only use:
#listform_X_com_fabrik_X (X is your list ID)
instead of:
#listform_$c
Examples
Change header background to green,transparent
Code:
#listform_$c th {
background: green;
opacity:0.3;
filter:alpha(opacity=30); /* For IE8 and earlier */
}
Change header text color to black, without shadow
Code:
#listform_$c .fabrik___heading {
color: #000000;
text-shadow: none;
}
Change one column (header + entries)
Replace FULL_ELEMENTNAME with your element name (tablename___elementname):
Code:
#listform_$c .FULL_ELEMENTNAME {
max-width: 20px;
overflow: hidden;
background:yellow
}
Change group heading
Code:
.listform_$c .fabrik_groupheading td {background:green;color:yellow}
.listform_$c .fabrik_groupheading a {color:yellow}
Hide "CheckAll" checkbox
To hide the header checkbox (X= list ID)
Code:
.list_X_checkAll {
display: none;
}
Hide "View" button
To hide the View button (if Render Buttons as = Inline)
Code:
#listform_$c .fabrik_actions .btn.fabrik_view {display:none}
Styling a Row based on element selection
Code:
td.fabrik_element.fabrik_list_1_group_1{background-color:rgba(255, 0, 0, 0)!important;}
tr[id^="list_1_com_fabrik_1_row_"].fabrik_row.pending.statuspending{
background-color: #f2d3d5;
}
tr[id^="list_1_com_fabrik_1_row_"].fabrik_row.sent.statussent{
background-color: #FFCC66;
}
tr[id^="list_1_com_fabrik_1_row_"].fabrik_row.complete.statuscomplete{
background-color: #CCFFCC;
}
Last edit: 13 Sep 2020 22:07 by btt.
Please Log in or Create an account to join the conversation.