AngularJS Bootstrap make the datetimer picker responsive - angularjs

I am trying to make the datetimepicker responsive for bootstrap but having issues.
I have seen this plugin:
https://github.com/niftylettuce/bootstrap-datepicker-mobile#requirements
which would be great to use in my application, but the problem is my application doesn't use jQuery (nor do I want it to).
I have the datepicker set up like this:
<div class="col-md-4">
<div ng-model="controller.today" datepicker ng-change="controller.getArchive()"></div>
</div>
Does anyone know how I can make the datetimepicker responsive without using jQuery?

Well I managed to fix this myself.
I created my own templates which looked like this:
<script id="template/datepicker/datepicker.html" type="text/ng-template">
<div class="datepicker" ng-switch="datepickerMode" role="application" ng-keydown="keydown($event)">
<daypicker ng-switch-when="day" tabindex="0"></daypicker>
<monthpicker ng-switch-when="month" tabindex="0"></monthpicker>
<yearpicker ng-switch-when="year" tabindex="0"></yearpicker>
</div>
</script>
<script id="template/datepicker/day.html" type="text/ng-template">
<div>
<div class="row">
<div class="col-xs-2">
<button class="btn btn-default btn-block" ng-click="move(-1)" tabindex="-1"><span class="fa fa-chevron-left"></span></button>
</div>
<div class="col-xs-8">
<button class="btn btn-default btn-block" ng-click="toggleMode()" ng-disabled="datepickerMode === maxMode" tabindex="-1">{{ title }}</button>
</div>
<div class="col-xs-2">
<button class="btn btn-default btn-block"><span class="fa fa-chevron-right"></span></button>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="flexbox">
<div ng-repeat="label in labels track by $index">
<small aria-label="{{ label.full }}">{{ label.abbr }}</small>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="flexbox" ng-repeat="row in rows track by $index">
<div ng-repeat="dt in row track by dt.date">
<button class="btn btn-default btn-block" ng-class="{'btn-info': dt.selected, active isactive(dt)}" ng-click="select(dt.date)" ng-disabled="dt.disabled" tabindex="-1"><span ng-class="{'text-muted': dt.secondary, 'text-info' dt.current}">{{ dt.label }}</span></button>
</div>
</div>
</div>
</div>
</div>
</script>
Then I created 2 SASS files, one for the actual datepicker:
.datepicker {
text-align: center;
.row {
> div {
padding-left: 1px;
padding-right: 1px;
&:first-child {
padding-left: 15px;
}
&:last-child {
padding-right: 15px;
}
}
> .col-xs-12,
> .col-sm-12,
> .col-md-12,
> .col-lg-12 {
padding-left: 15px;
padding-right: 15px;
}
}
.flexbox {
margin-top: -1px;
&:first-child {
margin-top: 2px;
}
}
}
and a flexbox one:
.flexbox {
display: flex;
> div {
-ms-flex: 1 auto;
flex: 1 auto;
margin-left: -1px;
&:first-child {
margin-left: 0;
}
}
}
This solved my issue.
I will update this when I have all templates replaced and I will add a jsfiddle.

Related

Expression working with static condition but not working with scope object in html file in angularjs

In the below code for Button, I have added ng-disabled condition it is working when I use "qty > 10" but the same condition not working when I add "qty > maxQtySeats" where "maxQtySeats" is my scope variable in which I have assigned value and its printed on html page but not working with condition.
Following is the code of one of the modal
<div class="rectangleSeats">
<div style="width: 300px; float: left;">
<span class="removeSeatstxt" l10n-text="cancellation.removeSeats"></span>
<br/><br/>
<span class="opt-box" style="font-size: 12px;" l10n-text="cancellation.seatstoRemove"></span>
</div>
<div class="quantity buttons_added" style="float: right;">
<form id='myform' ng-app="gemAppSu" ng-controller="ModalInstanceCtrl">
<button ng-click="decrement()" class='qtyminus' ng-disabled="qty<=0" style="background-color: transparent;border: none;">
<img src="assets/img/minus.svg" width="12px" height="12px"/>
</button>
<input ng-model="qty" type='text' name='quantity' id='qty' class='qty' style="font-size: 12px; font-weight: bold;
border: none;height: 44px;width: 52px;text-align: center;"/>
<button ng-click="increment()" style="background-color: transparent;border: none;">
<img src="assets/img/plus.svg" width="12px" height="12px"/>
</button>
</form>
</div>
</div>
<div class="cancellationbtndiv" >
<button type="button" class="btn btn-default nxt-btn" ng-disabled="qty > maxQtySeats">
<span l10n-text="cancellation.buttonnext"></span></button>
</div>
Controller.js
$scope.maxQtySeats = 0;
$scope.maxQtySeats = $scope.activeItem.lineItem.totalQuantity;
Got the solution...
It was a problem of parseInt(), After parseInt($scope.activeItem.lineItem.totalQuantity) it is wokring fine.
Thanks.

Cypress with the ContextMenu not work - React Contextify

i'm using a library called React Contexty, and it has a menu that is inside of the Contextify and is called of ContextMenu, when i do request for it to click in the Item of the ContextMenu, it click but the action not happens.
Cypress:
cy.get("img[data-test=img--menu-candidate]")
.click({
force: true
})
cy.get(".testinhoImg").click({
force: true
})
My MenuContext:
<ContextMenu id={`menu-${this.props.candidate.id}`} animation={animation.fade} theme={theme.light}>
<Item>
<div style={{ width: '50px', marginLeft: '0.5em', marginRight: '0.5em' }}>
<img src={ViewSrc} alt="View" />
</div>
<span className="ibm-plex-sans-serif-regular ibm-textcolor-blue-60"> View </span>
</Item>
Somebody know why? And help-me please?
HTML:
<div class="react-contexify react-contexify__theme--light react-contexify__will-enter--fade" style="left: 447px; top: 308px; opacity: 1;">
<div>
<div class="react-contexify__item" role="presentation">
<div class="react-contexify__item__data">
<div style="width: 50px; margin-left: 0.5em; margin-right: 0.5em;"><img src="/static/media/view.2844f64a.svg" alt="View"></div><span class="ibm-plex-sans-serif-regular ibm-textcolor-blue-60"> View </span></div>
</div>
<div class="react-contexify__separator"></div>
<div class="react-contexify__item" role="presentation">
<div class="react-contexify__item__data">
<div style="width: 65px;"><img src="/static/media/move.f7f8dc44.svg" alt="Move to folder" style="margin-left: 0.5em; margin-right: 0.5em;"></div><span class="ibm-plex-sans-serif-regular ibm-textcolor-blue-60">Move to folder</span></div>
</div>
<div class="react-contexify__item" role="presentation">
<div class="react-contexify__item__data">
<div style="width: 50px; padding-right: 1em;"><img src="/static/media/email.330dcb30.svg" alt="Send Email" style="padding-right: 1em;"></div><span class="ibm-plex-sans-serif-regular ibm-textcolor-blue-60">Send Email</span></div>
</div>
<div class="react-contexify__item react-contexify__item--disabled" role="presentation">
<div class="react-contexify__item__data">
<div style="width: 65px;"><img src="/static/media/remove-folder.d620c9fb.svg" alt="Move to folder" style="margin-left: 0.5em; margin-right: 0.5em;"></div><span class="ibm-plex-sans-serif-regular ibm-textcolor-blue-60">Remove from folder</span></div>
</div>
<div class="react-contexify__item" role="presentation">
<div class="react-contexify__item__data">
<div style="width: 50px; margin-left: 0.5em; margin-right: 0.5em;"><img src="/static/media/delete.e899d653.svg" alt="Delete" style="padding-right: 1.2em;"></div><span class="ibm-plex-sans-serif-regular ibm-textcolor-blue-60">Delete</span></div>
</div>
</div>
</div>

Thumbnail in angularjs

I created a thumbnail with ng-repeat directive.When i click the add button,cards will be created automatically.What i want to do is to pass add button automatically right side after every thumbnail is added.In my code, there is an add button(it is fixed) and it creates thumbnails.Here is my code
`<div ng-show="list">
<div class="row-sm-3 row-md-3">
<div class="thumbnail"
style="width: 270px; height: auto; display: inline-block; text-overflow:ellipsis; white-space:nowrap; overflow:hidden; border: 1px solid #5bc0de"
ng-repeat="location in list track by $index">
<div class="name"><strong>Name :</strong> {{location.name}}</div><br>
</div>
</div>
</div>
</div> `
`<div>
<button type="submit" class="btn btn-info btn-sm" style="width:180px; height:200px; margin-top:7px;
border-radius:10px; margin-bottom:20px; background-color:#ffffff;border-color:#46b8da"
ui-sref="context.location"><span style="font-size:18px; color:#337ab7">Add</span>
</button>
</div> `

angular app animations not working with ng-repeat and bootstrap panel

I am trying to work with the ngAnimate directive of angular but it is not working and also not showing any problem..
I had tried almost every thing but it didn't worked out..
the link to the my code is :
// Code goes here
var ngTodo = angular.module('ngTodo', ['ngAnimate','ngStorage']);
ngTodo.controller('mainController',function($scope,$localStorage){
$scope.todoArray = [];
if($localStorage.todoArray == undefined){
$localStorage.todoArray = $scope.todoArray;
}
else{
$scope.todoArray = $localStorage.todoArray;
}
$scope.addTodo = function(newTodo){
$scope.todoArray.splice(0,0, { title : newTodo.name, details : newTodo.details});
$localStorage.todoArray = $scope.todoArray;
}
$scope.removeTodo = function(index){
$scope.todoArray.splice(index,1);
$localStorage.todoArray = $scope.todoArray;
}
});
/* Styles go here */
body, html {
height: 100%;
}
body{
font-family: sans-serif;
line-height: 1.428;
font-size: 14px;
background-image: url(../../images/bg-image.jpg);
background-attachment: fixed;
background-position: center;
background-repeat: no-repeat;
background-size: cover;
}
/* navbar top styles starts here */
input.search-todo-list{
margin-top: 20px;
}
.navbar-fixed-top{
background-color: #80bfff;
}
/* navbar top styles ends here */
/* content section starts here */
.content{
margin-top: 64px;
margin-bottom: 50px;
}
.empty-todo-list-message{
height: 200px;
margin-top: 30px;
text-align: center;
}
.todo-item{
margin-top: 10px;
}
.panel-heading,
.panel-footer{
padding: 5px 5px;
}
.panel-body{
padding: 7px;
}
.panel-default>.panel-heading,
.panel-body,
.panel-footer{
background-color: yellow;
}
/* content section starts here */
/* navbar bottom styles starts here */
.navbar-fixed-bottom input{
width: 100%;
margin-right: 20px;
}
.navbar-fixed-bottom input,
button{
margin-top: 10px;
}
.navbar-fixed-bottom{
background-color: #80bfff;
}
/* navbar bottom styles ends here */
/* animation styles */
.move-animation.ng-move {
transition: 1.75s;
opacity: 0;
}
.move-animation.ng-move.ng-move-active {
opacity: 1;
}
<!DOCTYPE html>
<html lang="en" ng-app="ngTodo">
<head>
<meta charset="UTF-8">
<link href="assets/bootstrap/css/bootstrap.min.css" rel="stylesheet">
<link href="assets/font-awesome-4.7.0/font-awesome-4.7.0/css/font-awesome.min.css" type="text/css" rel="stylesheet">
<link href="style.css" rel="stylesheet">
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.6.5/angular.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.4/angular-animate.js">
</script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/ngStorage/0.3.11/ngStorage.min.js"></script>
<script src="script.js"></script>
</head>
<body>
<div class="container-fluid" ng-controller="mainController">
<!-- navbar top starts here -->
<nav class="navbar navbar-default navbar-fixed-top">
<div class="container-fluid">
<div class="row">
<div class="col-sm-2">
<div class="navbar-header">
<a class="navbar-brand" href="#">
<img width="40px" alt="Todo App Icon" class="img-circle img-responsive" src="assets/icon/icon.jpg">
</a>
</div>
</div>
<div class="col-sm-8">
<h2 class="text-center">Today's Todo List</h2>
</div>
<div class="col-sm-2">
<input type="text" placeholder="search..." ng-model="query" class="search-todo-list">
</div>
</div>
</div>
</nav>
<!-- navbar top ends here -->
<!-- content section starts here -->
<div class="row">
<div class="col-sm-12 content">
<div class="row">
<div class="col-sm-6 col-sm-offset-3 empty-todo-list-message" ng-if="todoArray.length == 0">
<div class="panel panel-default ">
<div class="panel-body">
<h1><strong>Your Todo List is EMPTY</strong></h1>
</div>
</div>
</div>
<!-- item starts here -->
<div class="col-sm-6 col-sm-offset-3 todo-item" ng-repeat="todo in todoArray | filter : query" ng-animate=" 'animate' ">
<div class="panel panel-default ">
<div class="panel-heading text-center">
<h3><strong>{{ todo.title + " : " }}</strong></h3>
</div>
<div class="panel-body">
<strong>{{ todo.details}}</strong>
</div>
<div class="panel-footer text-center">
<button ng-click="removeTodo($index)"><i class="fa fa-trash-o fa-2x" aria-hidden="true"></i>
delete</button>
</div>
</div>
</div>
<!-- item ends here -->
</div>
</div>
</div>
<!-- content section ends here -->
<!-- navbar bottom starts here -->
<nav class="navbar navbar-default navbar-fixed-bottom">
<div class="container-fluid">
<div class="row">
<div class="col-sm-4">
<input type="text" placeholder="Add Todo Item" required ng-model="newTodo.name" >
</div>
<div class=" col-sm-4">
<input type="text" placeholder="Add Todo Item Details" required ng-model="newTodo.details">
</div>
<div class=" col-sm-2">
<button ng-click="addTodo(newTodo)" ><i class="fa fa-plus" aria-hidden="true"></i> Add ToDo</button>
</div>
</div>
</div>
</nav>
<!-- navbar bottom ends here -->
</div>
</body>
</html>

locators in Selenium Webdriver

<div class="ui-dialog ui-widget ui-widget-content ui-corner-all ui-draggable ui-resizable" style="display: block; z-index: 1002; outline: 0px none; position: absolute; height: auto; width: 500px; top: 156px; left: 706px;" tabindex="-1" role="dialog" aria-labelledby="ui-dialog-title-comment-dialog">
<div class="ui-dialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfix">
<div id="comment-dialog" class="ui-dialog-content ui-widget-content" style="background-color: white; width: auto; min-height: 0px; height: 208.267px;">
<div class="ui-resizable-handle ui-resizable-n"></div>
<div class="ui-resizable-handle ui-resizable-e"></div>
<div class="ui-resizable-handle ui-resizable-s"></div>
<div class="ui-resizable-handle ui-resizable-w"></div>
<div class="ui-resizable-handle ui-resizable-se ui-icon ui-icon-gripsmall-diagonal-se ui-icon-grip-diagonal-se" style="z-index: 1001;"></div>
<div class="ui-resizable-handle ui-resizable-sw" style="z-index: 1002;"></div>
<div class="ui-resizable-handle ui-resizable-ne" style="z-index: 1003;"></div>
<div class="ui-resizable-handle ui-resizable-nw" style="z-index: 1004;"></div>
<div class="ui-dialog-buttonpane ui-widget-content ui-helper-clearfix">
<div class="ui-dialog-buttonset">
<button class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" role="button" aria-disabled="false">
<span class="ui-button-text">Edit Approved Data</span>
</button>
<button class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" role="button" aria-disabled="false">
<span class="ui-button-text">Cancel</span>
i want to locate the "Edit Approved Data" button but gets an error always saying element not found.
//div[#class='ui-dialog-buttonset']/button
//div[#class='ui-dialog-buttonset']/button[1]
//div[#class='ui-dialog-buttonset']/button/span
//span[text()='Edit Approved Data']
//\*[text()='Edit Approved Data']
The way to use:
driver.findElement(By.xpath(xpath)).click();
Every presented xpath should work

Resources