I have created a custom input in simple_form and I'm using Foundation 5.
class CurrencyInput < SimpleForm::Inputs::Base
def input
input_html_classes.unshift("string currency")
input_html_options[:type] ||= input_type if html5?
"$ #{#builder.text_field(attribute_name, input_html_options)}".html_safe
end
end
The input field created has the default browser style. How do I apply the Foundation text field styles to this currency field so that it looks like all my other text fields. I have tried using the class names used by Foundation for the other fields but it deosn't have any effect. I haven't been able to find any documentation on how to do this. How can I do this?Any help is appreciated.
Have a look at /bower_components/foundation/scss/foundation/components/_forms.scss in your Foundation installation.
Starting from line 407 (of the most latest Foundation) you should see:
/* We use this to get basic styling on all basic form elements */
input[type="text"],
input[type="password"],
input[type="date"],
input[type="datetime"],
input[type="datetime-local"],
input[type="month"],
input[type="week"],
input[type="email"],
input[type="number"],
input[type="search"],
input[type="tel"],
input[type="time"],
input[type="url"],
textarea {
-webkit-appearance: none;
-webkit-border-radius: 0px;
#include form-element;
#if $input-include-glowing-effect == false {
#include single-transition(all, 0.15s, linear);
}
&.radius {
#include radius($input-border-radius);
}
}
There follows a number of styles that you can copy into your app.scss file to incorporate your <input type="currency"> into your final CSS. For example:
input[type="currency"] {
-webkit-appearance: none;
-webkit-border-radius: 0px;
#include form-element;
#if $input-include-glowing-effect == false {
#include single-transition(all, 0.15s, linear);
}
&.radius {
#include radius($input-border-radius);
}
}
You could simply add your type into those styles there, but I don't think it's a good idea to change this in foundation's own files as it would probably be removed by future updates to your local foundation.
Related
Im trying to figure out how to remove bullets from Django's MultipleChoiceField. So far I have tried this very popular solution by changing my css file that basically states to input this code in my css file
ul {
list-style-type: none;
}
This didnt work and I also tried:
li {
list-style-type: none;
}
This also didnt work. Is there something Django specific why the list keeps on showing up with bulletpoints? I also tried adding the style in my forms class but also without success
class SearchForm(forms.Form):
job_industry = forms.MultipleChoiceField(
widget=forms.CheckboxSelectMultiple(attrs={'class': 'form-check', 'style': 'list-style:none;'}),
choices=industry,
)
I noticed that whatever attrs I enter to the forms.CheckboxSelectMultiple it only gets passed to the <label> tag and not the <ul> or <li> tag of the list. Im using Bootstrap5 if that makes any difference.
How to delete bulletpoints from Django forms.MultipleChoiceField?
The problem turned out to be because of cache. Previously I set up memcache and had set the 'TIMEOUT': None Thats the reason why changing the css didnt have no effect
I am trying to add the plugin: nativescript-fonticon
I am currently stuck on the part where I have to convert the css file.
In the readme it states that I have to configure my css and converter before I can start converting:
import * as application from 'application';
import {TNSFontIcon, fonticon} from 'nativescript-fonticon';
TNSFontIcon.debug = true; <-- Optional. Will output the css mapping to console.
TNSFontIcon.paths = {
'fa': 'font-awesome.css',
'ion': 'ionicons.css'
};
TNSFontIcon.loadCss();
application.resources['fonticon'] = fonticon;
application.start({ moduleName: 'main-page' });
How am I supposed to do this in nativescript-vue?
You look like you're on the right track. You should put the initialising code in your main.js file (or whatever the entry point file is named).
Here's how to get it to work in NativeScript-Vue.
Download and extract fontawesome-free-5.9.0-web.zip from here.
Add webfonts/fa-brands-400.ttf, webfonts/fa-regular-400.ttf and webfonts/fa-solid-900.ttf to app/fonts directory.
Add css/fontawesome.css to app/assets directory. Remove any non fa-*:before classes from this file.
In your app's main.js. You should see a console log for each class when starting your app.
import { TNSFontIcon, fonticon } from 'nativescript-fonticon'
TNSFontIcon.debug = true
TNSFontIcon.paths = {
'fa': './assets/fontawesome.css',
}
TNSFontIcon.loadCss()
Vue.filter('fonticon', fonticon)
In your app's main css file, e.g. app.scss.
.fa-brands {
font-family: "Font Awesome 5 Brands", "fa-brands-400";
}
.far {
font-family: "Font Awesome 5 Free", "fa-regular-400";
font-weight: 400;
}
.fas {
font-family: "Font Awesome 5 Free", "fa-solid-900";
font-weight: 900;
}
Now use them in your view.
<Label :text="'fa-facebook-f' | fonticon" class="fa-brands" />
<Label :text="'fa-eye' | fonticon" class="far" />
<Label :text="'fa-eye' | fonticon" class="fas" />
I have found a blog that actually uses the fonticons plugin and how to use it:
https://nativescript-vue.org/blog/using-fonticons/
EDIT:
After a few Nativescript and Nativescript-Vue updates it does not seem to work properly. It's rather hard to use.
I suggest importing the font and using the respective unicodes like this:
Data:
icon: '\ue905'
Markup:
<Label class="ico" :text="icon"/>
I am preparing an historical book manuscript, written in R-Markdown with Bookdown, which will have 8 chapters, each with 100+ Chicago-style endnotes, using the GitBook-style web format.
My goal is to restart endnote numbering after each chapter, to avoid running into high digits and to resemble the appearance of traditional history books.
I have experimented with most of the settings described here (https://bookdown.org/yihui/bookdown/html.html#gitbook-style), but cannot produce the desired web output. Here's the relevant portion of my index.Rmd:
output:
bookdown::gitbook:
dev: svglite
css: css/style.css
split_by: rmd
split_bib: true
See my simplified mockup demo:
https://jackdougherty.github.io/bookdown-test/book/
and source code:
https://github.com/JackDougherty/bookdown-test
Note that in bookdown v 0.9, the <a> tag's class inside the citation changed from .footnote-ref to .footnoteRef.
So you need to extend some of your CSS to account for that when using an updated version of bookdown:
/* don't show the wrong footnote calls */
.footnote-ref sup,
.footnoteRef sup {
display: none;
}
...
.footnote-ref,
.footnoteRef {
counter-increment: fn-call;
}
.footnote-ref::after,
.footnoteRef::after {
content: counter(fn-call);
position: relative;
top: -.5em;
font-size: 85%;
line-height: 0;
vertical-align: baseline;
}
...
See https://github.com/rstudio/bookdown/issues/589#issuecomment-462149512 for more details.
Im writing a python script which reads from a file and plots graphs in seperate html files with plotly.I would like to have a button to redirect from one page to another(load from disc).I've come across this :
updatemenus = list([
dict(type="buttons",
buttons=list([dict(label = 'Next',method = 'update', args = ['shapes', []])])
)])
layout=go.Layout(title="Iteration_Number:"+str(counter_iter),updatemenus=updatemenus)
But this is used for updating data or changing layout. What i want is open another html page from disc on button click. Is that possible ?
I have also seen this :
import webbrowser
url = "file:///home/tinyOS/Simulation_"+str(counter_iter+1)+".html"
webbrowser.open(url)
Which helps me open a new page but again i want it to happen when clicking on the button.Any ideas? Thanks a lot !
From the question I understand that you want a group of buttons on the plotly graph, that are going to open a plotly graph in new tab.
So you need not use plotly buttons for this requirements.because they are mainly used for restyle, relayout, etc., so there is no relation between these buttons and opening links in new tabs.
I would recommend having simple html buttons which on click are going to take you to the new tab.
A simple way to do it will be, wrap the plot in a div set to relative positioning and make the div wrapping the button absolute positioned and position it anywhere over the graph, please refer the below example and let me know if this solves your issue!
Solution:
import plotly.plotly as py
import plotly.graph_objs as go
import plotly.offline as py_offline
from IPython.core.display import display, HTML
py_offline.init_notebook_mode()
display(HTML("""
<style>
.wrapper{
position:relative;
}
.button-group{
position:absolute;
top:40px;
left:90%;
z-index: 30000;
}
.button-group a{
display:block;
}
</style>
"""))
What is happening in the above piece of code is, first we include the necessary packages, then styles needed!
data = [go.Bar(
x=['giraffes', 'orangutans', 'monkeys'],
y=[20, 14, 23]
)]
display(HTML("""
<div class="wrapper">
<div class="button-group">
Google It
Yahoo It
</div>"""
+str(py_offline.plot(data, filename='plot_name' ,output_type="div", include_plotlyjs=False))
+ '</div>'))
The main piece of code, with which we embed the buttons is shown above, first we define the plotly plot , then using display and html functions, we can embed the buttons inside a div with class button-group and with CSS we position that button.
Please do try the above code and let me know if there are any doubts regarding the working!
I have two seperate images right next to one another, and I want them to be contiguous. The problem is that I need to move the right-most image over to the left. I could use the size modifiers for the span mixin (narrow | wide ) but that would change the proportions of the two respective images in relation to one antoher.
Instead I need to move the second image in the flow over to the left by temporarily removing the gutter.
I read from his old post here: https://stackoverflow.com/a/13044025 that I can use with-grid-settings, which is now with-layout.
However there doesn't seem to be any documentation on how to accomplish this particular action.
What would be the proper way to execute such a task?
Thanks in advance
--EDIT--
HTML (Simplified)
<main id="grid">
<section id="main_background_container">
<img id="main_side_img"></img>
<div id="main_primary_container"></div>
</section>
</main>
SCSS
#grid{
#include container(8);
#include background-grid;
}
#main_background_container{
#extend %debug;
#include span(8);
height: auto;
float: right;
margin-top:-16px;
}
#main_side_img{
height: 65%;
#include span(1 no gutter);
}
#main_primary_container{
#include span(4 wide);
background-image: url('../images/background-2b.png');
background-position: top;
background-size: cover;
height: 65%;
}
The with-layout mixin accepts any layout definition using a settings-map, or the shorthand syntax, or any combination of the two — similar to other Susy mixins. But I don't think that's what you want. Changing the gutter size actually changes the grid math, and your elements wont align. I think you want something like this (I'm making things up, since I can't see your code):
.left-area {
#include span(3 no-gutter); // remove the gutter here
}
.right-area {
#include span(9 wide); // span across what would have been the gutter
}