mirror of
https://github.com/bodyrep/DemoApp.git
synced 2026-01-26 07:01:38 +00:00
added methods and routes for getting an exercises history, and the sum of a workouts musclearrays -- incl a modifier
This commit is contained in:
@@ -66,30 +66,41 @@ $(document).ready(function() {
|
||||
$("#newworkout").bind('sortupdate', function(event, ui) {
|
||||
$('#exercises > li').each(function(){
|
||||
var itemindex= $(this).index();
|
||||
var newname = $(this).find('input, select').attr('name').replace(/elements\[[0-9]*\]/,'elements[' + itemindex + ']');
|
||||
// var newname = $(this).find('input, select').attr('name').replace(/elements\[[0-9]*\]/,'elements[' + itemindex + ']');
|
||||
$(this).find('input, select').each(function() {
|
||||
var newname = $(this).attr('name').replace(/elements\[[0-9]*\]/,'elements[' + itemindex + ']');
|
||||
$(this).attr('name', newname);
|
||||
});
|
||||
// $(this).find('label').each(function() {
|
||||
// var value = $(this).attr('href');
|
||||
// console.log ('value -' + value);
|
||||
// $(this).attr('href', value.replace(/elements\[[0-9]*\]/,'elements[' + itemindex + ']'));
|
||||
|
||||
$(this).children('label').html(newname);
|
||||
$(this).children('input').attr('name', newname);
|
||||
// //var newname = $(this).html.replace(/elements\[[0-9]*\]/,'elements[' + itemindex + ']');
|
||||
// //$(this).html(newname);
|
||||
// });
|
||||
|
||||
$(this).find('ul li').each(function(){
|
||||
var itemindex2= $(this).index();
|
||||
|
||||
$(this).children('input').each(function(){
|
||||
var newname2 = $(this).attr('name').replace(/\[splits\]\[[0-9]*\]/,'[splits][' + itemindex2 + ']');
|
||||
newname2 = newname2.replace(/elements\[[0-9]*\]/,'elements[' + itemindex + ']');
|
||||
$(this).attr('name', newname2);
|
||||
});
|
||||
});
|
||||
|
||||
$(this).children('label').each(function(){
|
||||
var newname2 = $(this).attr('name').replace(/\[splits\]\[[0-9]*\]/,'[splits][' + itemindex2 + ']');
|
||||
newname2 = newname2.replace(/elements\[[0-9]*\]/,'elements[' + itemindex + ']');
|
||||
$(this).children('label').each(function(){
|
||||
//var newname2 = $(this).attr('name').replace(/\[splits\]\[[0-9]*\]/,'[splits][' + itemindex2 + ']');
|
||||
//newname2 = newname2.replace(/elements\[[0-9]*\]/,'elements[' + itemindex + ']');
|
||||
var newname2 = 'Set '+ (itemindex2 + 1 ) + '';
|
||||
$(this).html(newname2);
|
||||
});
|
||||
});
|
||||
|
||||
//Only show delete if more than 1 set
|
||||
if ( $(this).siblings('.set').length > 0 ) {
|
||||
$(this).children('.delete').show();
|
||||
console.log(">1 " + $(this).siblings('.set').length);
|
||||
} else {
|
||||
$(this).children('.delete').hide();
|
||||
console.log("=1 " + $(this).siblings('.set').length);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user