Skip to content

Commit

Permalink
Work in progress
Browse files Browse the repository at this point in the history
  • Loading branch information
RaphaelGauthier committed Apr 3, 2017
1 parent 3b9b52b commit 384d25e
Show file tree
Hide file tree
Showing 3 changed files with 249 additions and 18 deletions.
203 changes: 200 additions & 3 deletions builder/css/custom.css
Original file line number Diff line number Diff line change
Expand Up @@ -502,6 +502,166 @@ button.btn-save.saving span.saving{
span.text-fit {
font-weight: normal;
}
.ng-toast.ng-toast--right .ng-toast__message {
text-align: left;
}

/* DEPRECATED METHODS */
li.deprecated{
display: none;
}
li.deprecated h4.panel-title > span{
text-decoration: line-through;
}
li.deprecated.used, li.deprecated.show {
display: block;
}

/* CUSTOM CHECKBOX */
.rudder-form input[type=checkbox] + .label-radio{
border-radius: 3px;
}
.rudder-form input[type=radio] + .label-radio,.rudder-form input[type=checkbox] + .label-radio{
display: inline-block;
height: 15px;
width: 15px;
border: 2px solid rgb(198, 200, 201);
text-align: center;
line-height: 34px;
position: relative;
top: 5px;
margin-bottom:0;
background-color: #fff;
}
.rudder-form input[type=radio] + .label-radio{
border-radius: 50%;
}
.rudder-form input[type=radio] + .label-radio + .text-radio,.rudder-form input[type=checkbox] + .label-radio + .text-radio{
-webkit-animation: text-radio-off .2s ease-in forwards;
-moz-animation: text-radio-off .2s ease-in forwards;
-o-animation: text-radio-off .2s ease-in forwards;
animation: text-radio-off .2s ease-in forwards;
}
.rudder-form input[type=radio]:checked + .label-radio + .text-radio,.rudder-form input[type=checkbox]:checked + .label-radio + .text-radio{
-webkit-animation: text-radio-on .2s ease-in forwards;
-moz-animation: text-radio-on .2s ease-in forwards;
-o-animation: text-radio-on .2s ease-in forwards;
animation: text-radio-on .2s ease-in forwards;
}
.rudder-form input[type=radio] + .label-radio span,.rudder-form input[type=checkbox] + .label-radio span{
font-size: 9px;
top: -12.5px;
left: 0.1px;
position: relative;
visibility:hidden;
animation: opacity-0 .2s linear forwards;
}
.rudder-form input[type=radio]:checked + .label-radio span,.rudder-form input[type=checkbox]:checked + .label-radio span{
visibility:visible;
animation: opacity-1 .2s linear forwards;
}
.rudder-form .text-radio{
position: relative;
top: -6px;
margin-left: 8px;
}
.rudder-form input[type=radio],.rudder-form input[type=checkbox]{
display: none;
}
.rudder-form input[type=radio]:disabled + .label-radio,.rudder-form input[type=checkbox]:disabled + .label-radio{
background-color: rgb(236,236,236);
}
.rudder-form input[type=radio]:disabled + .label-radio span,.rudder-form input[type=checkbox]:disabled + .label-radio span{
color:#898989;
}
.rudder-form input[type=radio]:checked:disabled + .label-radio + .text-radio, .rudder-form input[type=checkbox]:checked:disabled + .label-radio + .text-radio,.rudder-form input[type=radio]:disabled + .label-radio + .text-radio, .rudder-form input[type=checkbox]:disabled + .label-radio + .text-radio{
color: #B7B4B4;
-webkit-animation:none;
-moz-animation:none;
-o-animation:none;
animation:none;
}
ul.list-sm{
list-style-type: none;
}
ul.list-sm .rudder-form input[type=checkbox] + .label-radio + .check-icon{
font-size:12px;
}
ul > li.rudder-form:first-child > .input-group label.form-control,ul > li.rudder-form:first-child > .input-group .input-group-addon{
border-top:1px solid #d0d0d0;
}
#denyBadClocksForm ul > li:first-child > .input-group .input-group-addon,ul > li.rudder-form:first-child > .input-group .input-group-addon{
border-top-left-radius:4px;
}
#denyBadClocksForm ul > li:last-child > .input-group .input-group-addon,ul > li.rudder-form:last-child > .input-group .input-group-addon{
border-bottom-left-radius:4px;
}
ul > li.rudder-form:first-child > .input-group label.form-control{
border-top-right-radius:4px;
}
ul > li.rudder-form label{
cursor:pointer;
}
ul > li.rudder-form > .input-group label.form-control{
border-top-right-radius:0;
border-bottom-right-radius:0;
font-weight: 500;
color: #555;
font-size: 14px;
}
ul.list-sm > li.rudder-form > .input-group label.form-control{
height: auto;
min-height: 34px;
font-size: 12px;
}
ul > li.rudder-form > .input-group .input-group-addon{
padding: 3px 11px;
background-color: #f4f4f4;
}
ul.list-sm > li.rudder-form > .input-group .input-group-addon{
padding: 0 11px;
}
ul > li.rudder-form > .input-group label.form-control .glyphicon.info{
top:3px;
}
ul > li.rudder-form:last-child > .input-group label.form-control{
border-bottom-right-radius:4px;
padding-top: 8px;
}
ul > li.rudder-form > .input-group label.form-control,ul > li.rudder-form > .input-group .input-group-addon{
border-top:none;
}
ul > li.rudder-form > .input-group label.form-control{
padding-right: 40px;
}
ul > li.rudder-form > .input-group.disabled label.form-control,ul > li.rudder-form > .input-group.disabled .input-group-addon{
background-color: #eeeeee;
cursor:no-drop;
}
ul > li.rudder-form > .input-group.disabled *{
cursor:no-drop;
}
.rudder-form input[type=checkbox] + .label-radio + .check-icon,.rudder-form input[type=radio] + .label-radio + .check-icon{
position: absolute;
top: calc(50% - 7px);
right: 15px;
color: #222d32;
z-index: 10;
visibility:hidden;
animation: opacity-0 .1s linear forwards;
}
.list-sm .rudder-form input[type=checkbox] + .label-radio + .check-icon,.rudder-form input[type=radio] + .label-radio + .check-icon{
top: 11px;
}
.rudder-form .disabled input[type=checkbox] + .label-radio + .check-icon,.rudder-form .disabled input[type=radio] + .label-radio + .check-icon{
color: #7d7d7d;
}
.rudder-form input[type=checkbox]:checked + .label-radio + .check-icon,.rudder-form input[type=radio]:checked + .label-radio + .check-icon{
visibility:visible;
animation: opacity-1 .1s linear forwards;
}


@-webkit-keyframes saving {
0% {
-ms-transform: rotate(0deg);
Expand Down Expand Up @@ -534,7 +694,44 @@ span.text-fit {
transform: rotate(360deg);
}
}

.ng-toast.ng-toast--right .ng-toast__message {
text-align: left;
@keyframes opacity-1 {
0% {opacity:0;visibility: visible;}
100% {opacity:1;visibility: visible;}
}
@keyframes opacity-0 {
0% {opacity:1;visibility: visible;}
99% {opacity:0;visibility: visible;}
100% {opacity:0;visibility: hidden;}
}
@-webkit-keyframes text-radio-on {
0% {color: #646464;}
100% {color: #222D32;}
}
@-moz-keyframes text-radio-on {
0% {color: #646464;}
100% {color: #222D32;}
}
@-o-keyframes text-radio-on {
0% {color: #646464;}
100% {color: #222D32;}
}
@keyframes text-radio-on {
0% {color: #646464;}
100% {color: #222D32;}
}
@-webkit-keyframes text-radio-off {
0% {color: #222D32;}
100% {color: #646464;}
}
@-moz-keyframes text-radio-off {
0% {color: #222D32;}
100% {color: #646464;}
}
@-o-keyframes text-radio-off {
0% {color: #222D32;}
100% {color: #646464;}
}
@keyframes text-radio-off {
0% {color: #222D32;}
100% {color: #646464;}
}
20 changes: 18 additions & 2 deletions builder/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ <h3 >{{originalTechnique.name}} <span ng-hide="originalTechnique.name">New Techn
</div>

<ul id="methods" class="list-unstyled" dnd-list="selectedTechnique.method_calls" dnd-drop="dropCallback(item, index, type);" >
<li ng-click="selectMethod(method_call)" ng-repeat="method_call in selectedTechnique.method_calls" class="panel-margin-top btn btn-block btn-default btn-method" ng-class="{'active': isSelectedMethod(method_call)}" dnd-draggable="method_call" dnd-effect-allowed="ove" dnd-moved="selectedTechnique.method_calls.splice($index,1)">
<li ng-click="selectMethod(method_call)" ng-repeat="method_call in selectedTechnique.method_calls" class="panel-margin-top btn btn-block btn-default btn-method" ng-class="{'active': isSelectedMethod(method_call),'deprecated used':method_call.deprecated}" dnd-draggable="method_call" dnd-effect-allowed="ove" dnd-moved="selectedTechnique.method_calls.splice($index,1)">
<div class="input-group">
<span class="input-group-addon cursorMove"><b>:::</b></span>
<div class="panel-heading" style="overflow:hidden">
Expand Down Expand Up @@ -393,9 +393,25 @@ <h4 style="text-align:left; margin-top:0px;" class="panel-title">
<div class="col-lg-4 col-md-4 col-sm-10 col-xs-8 generic-methods ncf_col" ng-if="selectedMethod === undefined">
<div class="title">Library</div>
<h3 >Generic methods</h3>
<ul class="form-group list-sm">
<li class="rudder-form">
<div class="input-group">
<label for="showDeprecated" class="input-group-addon" id="labelShowDeprecated">
<input id="showDeprecated" type="checkbox" ng-model="showDeprecated">
<label class="label-radio" for="showDeprecated">
<span class="glyphicon glyphicon-ok"></span>
</label>
<span class="glyphicon glyphicon-ok check-icon"></span>
</label>
<label for="showDeprecated" class="form-control">
Show deprecated generic methods
</label>
</div>
</li>
</ul>
<ul class="list-unstyled" ng-repeat="(kind,methods) in methodsByCategory" >
<h4 id={{kind}}>{{capitaliseFirstLetter(kind)}} </h4>
<li ng-click="addMethod(method)" ng-repeat="method in methods" class="panel-margin-top btn btn-block btn-default btn-method" dnd-draggable="method" dnd-effect-allowed="move" dnd-type="'bundle'" >
<li ng-click="addMethod(method)" ng-repeat="method in methods" class="panel-margin-top btn btn-block btn-default btn-method" dnd-draggable="method" dnd-effect-allowed="move" dnd-type="'bundle'" ng-class="{'deprecated':method.deprecated, 'used':isUsed(method), 'show':showDeprecated}">
<div class="input-group">
<span class="input-group-addon cursorMove"><b>:::</b></span>
<div class="panel-heading" style="overflow:hidden">
Expand Down
44 changes: 31 additions & 13 deletions builder/js/ncf.js
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@ return {
app.controller('ncf-builder', function ($scope, $modal, $http, $log, $location, $anchorScroll, ngToast, $timeout, focus) {
initScroll();
// Variable we use in the whole application
$scope.showDeprecated = false;
// Give access to the "General information" form
$scope.editForm;
// Path of ncf files, defined as a url parameter
Expand Down Expand Up @@ -385,17 +386,17 @@ $scope.getMethodsAndTechniques = function () {
$scope.groupMethodsByCategory = function () {
var groupedMethods = {};
for (var methodKey in $scope.generic_methods) {
var method = $scope.generic_methods[methodKey];
var name = methodKey.split('_')[0];
var grouped = groupedMethods[name];
if (grouped === undefined) {
groupedMethods[name] = [method];
} else {
groupedMethods[name].push(method);
}
};
return groupedMethods;
var method = $scope.generic_methods[methodKey];
var name = methodKey.split('_')[0];
var grouped = groupedMethods[name];
if (grouped === undefined) {
groupedMethods[name] = [method];
} else {
groupedMethods[name].push(method);
}
};
return groupedMethods;
};

// Method used to check if we can select a technique without losing changes
$scope.checkSelect = function(technique, select) {
Expand Down Expand Up @@ -538,13 +539,14 @@ $scope.groupMethodsByCategory = function () {
function toMethodCall(bundle) {
var original_index = undefined;
var call = {
"method_name" : bundle.bundle_name
"method_name" : bundle.bundle_name
, "original_index" : original_index
, "class_context" : "any"
, "parameters": bundle.parameter.map(function(v,i) {
, "class_context" : "any"
, "parameters" : bundle.parameter.map(function(v,i) {
v["value"] = undefined
return v;
})
, 'deprecated' : bundle.deprecated
}
defineMethodClassContext(call)
return angular.copy(call)
Expand Down Expand Up @@ -942,6 +944,22 @@ $scope.groupMethodsByCategory = function () {
window.top.location.reload();
}

$scope.isUsed = function(method){
var result = false;
var i,j = 0;
if(method.deprecated){
for(i=0; i<$scope.techniques.length; i++){
while(j<$scope.techniques[i].method_calls.length && !result){
if($scope.techniques[i].method_calls[j].method_name == method.bundle_name){
result=true;
}
j++;
}
}
}
return result;
};

$scope.reloadData();
$scope.setPath();
});
Expand Down

0 comments on commit 384d25e

Please sign in to comment.