I use event_calendar gem and it works probably for me, but I face problem of how to change color of events by type, I mean how to make for example personal events like birthday or trip colored with blue and work events like meetings colored with red etc..
Can this be done by css or code? I hope you can help me with this -- Thanks.
http://dev.elevationblog.com/2009/07/23/event-calendar-rails-plugin/
After loading almost all the comments I found the answer to that question.
just override the color method in your event model.
def color
# color logic based on event type
# or maybe associated calendar?, ie
# self.calendar.color
if self.type = correct_type
return "#3399BB" #any html acceptable color
end
end
answered by jeff
do your logic then return the color you want to used
I did things a little differently for more flexibility based on info I found on this site.
Output
<div class="btn-group event_color" data-toggle="buttons-radio">
<button type="button" class="btn btn-success" value="#00a651">Active</button>
<button type="button" class="btn btn-warning" value="#ecef0b">Pending</button>
<button type="button" class="btn btn-danger" value="#ef0b0b">On Hold</button>
<%=f.hidden_field :color %>
<%=f.hidden_field :event_status %>
</div>
JS
$(".event_color .btn").click(function() {
// whenever a button is clicked, set the hidden helper
$('#event_color').val($(this).val());
});
$(".event_color .btn").click(function() {
// whenever a button is clicked, set the hidden helper
$("#event_event_status").val($(this).text());
});
Related
I use this vue-stripe-checkout (Vue.js), all works fine but if i write a fake number of card a automatic message is display and say "you'r number is incorrect".
Is what i want but i don't know how to add style on that, because is as 0 style and is very ugly.
The style object don't work on that, i found in documentation a Slots for "card-errors" but i don't know what means.
If someone can help me ?
<stripe-elements
:styleObject="style"
ref="elementsRef"
:pk="publishableKey"
locale="fr"
#token="tokenCreated"
#loading="loading = $event"
>
</stripe-elements>
<button class="btn btn-success px-5" #click="submit">Payer</button>
Q. Same kind of class applied to all Download button,How to distinct them from each other? Let's say i want to click on 3rd number of download button. Find a xpath for that button.
I have tried this but it's common for all.
//div[#class='statement-download']
<div class="statement-download">
<button class="btn btn-sm btn-icon btn-outline btn-default mb-0" type="button">
<i class="mdi mdi-download m-r-5"></i>
<span>Download</span>
</button>
</div>
use the index of the parent div.
//div[#class='statement-card'][3]/div[#class='statement-download']
For 3rd, try following xpath:
(//div[#class='statement-download'])[3]
You can use the date as a starting point
date = 'July 2048'
//div[.='{date}']/following-sibling::div[#class='statement-download']
It's a better way you can do it by using loops if you have multiple operations
List<WebElement> statementdownload =
driver.findElements(By.xpath("//div[#class='statement-download']"));
for (int i=0;i<statementdownload.size();i++) {
statementdownload.get(i).click();
statementdownload.get(i).getText();
// You can use your condition here
}
I have same button like Save & Close on different tab in my application. If I write XPath like //button[contains(text(), 'Save')] it shows result for all button with 'Save' text present on different tab either active or inactive. Is there any way to get result for 'Save' button only for currently opened active tab?
These are HTML for 'Save' button for different places. I want to write one XPath which should work for all 'Save' button so that I can use it in a method. Wanted to know is there any way to get result for presently opened tab?
1)
<button class="btn ng-binding btn-primary" style="margin-right:5px;" ng-class="checkDeleteCrud()" ng-click="modalActionManager()" ng-disabled="disableSaveButton()" ng-hide="crudStatus==='V'" type="button" aria-hidden="false">Save
</button>
2)
<button class="btn ng-binding btn-primary" ng-class="checkDeleteCrud()" ng-click="modalActionManager()" ng-disabled="( notValidType() || locksavebutton || !createStatisticsForm.$dirty ) && saveButtonText=='Save' " ng-hide="crudStatus==='V'" type="button" aria-hidden="false">
Save
</button>
3)
<button class="btn ng-binding btn-primary" style="margin-right:5px;" ng-class="checkDeleteCrud()" ng-click="modalActionManager()" ng-disabled="disableSaveButton()" ng-hide="crudStatus==='V'" type="button" aria-hidden="false">Save
</button>
If you are looking for something generic for visible button why not simply go with CSS Selector like :
button[ng-disabled*=' ']
If I explain currently all your disabled elements have ng-disabled value equal to disableSaveButton() but the active element doesn't have this function but contains data with spaces so I will look in any spaces within button ng-disabled data simple.
Hope this helped.
First look for the active tab, for this you need to know how the active tab in the Dom differs from non-active tabs. Then look in this element for a button with the text "Save". Use a dot as the first character in your XPath expression.
Let say webelement "tab" is the active tab then you can find the button as follows (C# code):
tab.FindElement(ByXPath(".//button[contains(text(),'Save')]")
I am trying to get the data using the Materilize css's chips. But no data is received when I try to submit it using a form.
I checked that the input fields value was null once I added the chips.
I wrote a jquery code to verify this
$('#showvalues').on('click', function(){
alert($('#emotiontags').val())
})
and my chips code looks like
<div class="chips chips-autocomplete col s4 offset-s3">
<input placeholder="You Emotions" id="emotiontags" type="text"
name="emotiontags">
</div>
<button class="btn waves-effect waves-light" id="showvalues">
Show values
<i class="material-icons right">send</i>
</button>
Here is its out with normal text
and here is the output when I try to add chips
Well it has been 6 months but I wanted to give an answer for people encountering this question. According to the documentation of MaterializeCSS, chipsData is the property that stores an array of the current chips data.
After getting the instance of your chips elements by something like this;
var chipInstance = M.Chips.getInstance($(".chips"));
Chips array can be accessed and logged to the console via
console.log(chipInstance.chipsData);
NOTE: Please see edit below. Primary issue is that I did something dumb.
This question is a duplicate, but the accepted answer didn't actually address the problem, and the listed workaround didn't work for me.
My HTML looks like this:
<div class="row checkbox_row">
<div class="col-xs-1 checkbox_cell">
<input type="radio" class="answerCheckbox assessmentQuestion" name="currently_employed_select" value="yes" id="currently_employed_select_1"/>
</div>
<div class="col-xs-11">Yes</div>
</div>
<div class="row checkbox_row">
<div class="col-xs-1 checkbox_cell">
<input type="radio" class="answerCheckbox assessmentQuestion" name="currently_employed_select" value="no" id="currently_employed_select_2"/>
</div>
<div class="col-xs-11">No</div>
</div>
Neither this jQuery:
var name = $(this).attr('name');
var value = $('input[name=' + name + ']:radio:checked').val();
Nor this Javascript:
var radios = document.getElementsByTagName(name);
for(var x = 0; x < radios.length; x++){
if(radios[x].checked){
return radios[x].value;
}
}
... are getting a value out of the radio button.
Is there something obvious and stupid I'm overlooking here? Is there some Bootstrap formatting that's mandatory when using radio buttons?
EDIT: I've figured out what piece of code is killing me, and it has bugger-all to do with Bootstrap.
This:
$(document).ready(function() {
$('.answerCheckbox').val(function() {
highlightCheckedRow(this);
});
... is meant to highlight the container rows of any checked boxes (including radio buttons) on page load. Which it does, admirably, but apparently at the expense of nuking the values of said radio buttons.
... which, given that val() overwrites the value when you give it a parameter, should not come as a surprise to me.
That'll teach me to do cargo cult programming.
Right, so, need to figure out some other way to run that function on all my answerCheckbox elements on page load, and I'm all set.