Skip to content
Snippets Groups Projects
Commit 0c8823ec authored by CupCakeArmy's avatar CupCakeArmy
Browse files

Cleaning up code

parent 4131af41
No related branches found
No related tags found
No related merge requests found
<div class="users-table-wrapper"> <div class="users-table-wrapper">
<div class="tools-full-height"> <div class="tools-full-height">
<table class="table table-hover events-table" id="events-table"> <table class="table table-hover events-table" id="events-table">
<thead> <thead>
<tr> <tr>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
</tbody> </tbody>
</table> </table>
</div> </div>
</div> </div>
<!-- modal for details of events--> <!-- modal for details of events-->
<div class="modal fade" id="detail-modal" role="dialog"> <div class="modal fade" id="detail-modal" role="dialog">
<div class="modal-dialog"> <div class="modal-dialog">
<div class="modal-content"> <div class="modal-content">
<div class="modal-header"> <div class="modal-header">
<button type="button" class="close" data-dismiss="modal">&times;</button> <button type="button" class="close" data-dismiss="modal">&times;</button>
<h4 id="event-modal-title" class="modal-title"></h4> <h4 id="event-modal-title" class="modal-title"></h4>
</div> </div>
<div class="modal-body"> <div class="modal-body">
<table class="table table-hover" id="event-details-table"> <table class="table table-hover" id="event-details-table">
<thead> <thead>
<tr> <tr>
<th>field</th> <th>field</th>
<th>value</th> <th>value</th>
</tr> </tr>
</thead> </thead>
<tbody name="table-body"> <tbody name="table-body">
</tbody> </tbody>
</table> </table>
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button> <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<!-- modal for creating new events--> <!-- modal for creating new events-->
<div class="modal fade" id="new-modal" role="dialog"> <div class="modal fade" id="new-modal" role="dialog">
<div class="modal-dialog"> <div class="modal-dialog">
<div class="modal-content"> <div class="modal-content">
<div class="modal-header"> <div class="modal-header">
<button type="button" class="close" data-dismiss="modal">&times;</button> <button type="button" class="close" data-dismiss="modal">&times;</button>
<h4 class="modal-title">Create new Event</h4> <h4 class="modal-title">Create new Event</h4>
</div>
<div class="modal-body">
<div class="form-group">
<label for="title_de">Title</label>
<input type="text" class="form-control" id="title_de"></input>
</div>
<div class="form-group">
<label for="description_de">Description</label>
<textarea type="text" class="form-control" rows="3" id="description_de"></textarea>
</div>
<div class="form-group">
<label for="catchphrase_de">Catchphrase</label>
<input type="text" class="form-control" id="catchphrase_de"></input>
</div>
<div class="form-group">
<label for="time_start">Start Time</label>
<input type="datetime" class="form-control" id="time_start"></input>
</div>
<div class="form-group">
<label for="time_end">End Time</label>
<input type="datetime" class="form-control" id="time_end"></input>
</div>
<label class="checkbox-inline">
<input type="checkbox" id="signup-required" value="">No Signup
</label>
<label class="checkbox-inline">
<input type="checkbox" id="no-signup-limit" value="">No Signup Limit
</label>
<div class="form-group">
<label for="spots">Spots</label>
<input type="number" class="form-control" id="spots"></input>
</div>
<label class="checkbox-inline">
<input type="checkbox" id="allow_email_signup" value="">Only amiv Members
</label>
<div class="form-group">
<label for="time_register_start">Start of Registration</label>
<input type="datetime" class="form-control" id="time_register_start"></input>
</div>
<div class="form-group">
<label for="time_register_end">End of Registration</label>
<input type="datetime" class="form-control" id="time_register_end"></input>
</div>
<div class="form-group">
<label for="location">Location</label>
<input type="text" class="form-control" id="location"></input>
</div>
<div class="form-group">
<label for="price">Price</label>
<input type="text" class="form-control" id="price"></input>
</div>
<div>
<label class="checkbox-inline">
<input type="checkbox" id="show_website" value="">Show on Webstite (requires banner image and title)
</label>
</div>
<div>
<label class="checkbox-inline">
<input type="checkbox" id="show_infoscreen" value="">Show ond Infoscreen (requires infoscreen image)
</label>
</div>
<div>
<label class="checkbox-inline">
<input type="checkbox" id="show announce" value="">Show in Announce (requires stuff)
</label>
</div>
<button data-toggle="collapse" data-target="#english-collapse">show english fields</button>
<div id="english-collapse" class="collapse">
<div class=form-group>
<label for="title_en">Title english</label>
<input type="text" class="form-control" id="title_en"></input>
</div> </div>
<div class="form-group"> <div class="modal-body">
<label for="description_en">Description english</label> <div class="form-group">
<textarea type="text" class="form-control" rows="3" id="description_en"></textarea> <label for="title_de">Title</label>
</div> <input type="text" class="form-control" id="title_de"></input>
<div class="form-group"> </div>
<label for="catchphrase_en">Catchphrase english</label> <div class="form-group">
<input type="text" class="form-control" id="catchphrase_en"></input> <label for="description_de">Description</label>
</div> <textarea type="text" class="form-control" rows="3" id="description_de"></textarea>
</div> </div>
<div class="form-group">
<label for="catchphrase_de">Catchphrase</label>
<input type="text" class="form-control" id="catchphrase_de"></input>
</div>
<div class="form-group">
<label for="time_start">Start Time</label>
<input type="datetime" class="form-control" id="time_start"></input>
</div>
<div class="form-group">
<label for="time_end">End Time</label>
<input type="datetime" class="form-control" id="time_end"></input>
</div>
<label class="checkbox-inline">
<input type="checkbox" id="signup-required" value="">No Signup
</label>
<label class="checkbox-inline">
<input type="checkbox" id="no-signup-limit" value="">No Signup Limit
</label>
<div class="form-group">
<label for="spots">Spots</label>
<input type="number" class="form-control" id="spots"></input>
</div>
<label class="checkbox-inline">
<input type="checkbox" id="allow_email_signup" value="">Only amiv Members
</label>
<div class="form-group">
<label for="time_register_start">Start of Registration</label>
<input type="datetime" class="form-control" id="time_register_start"></input>
</div>
<div class="form-group">
<label for="time_register_end">End of Registration</label>
<input type="datetime" class="form-control" id="time_register_end"></input>
</div>
<div class="form-group">
<label for="location">Location</label>
<input type="text" class="form-control" id="location"></input>
</div>
<div class="form-group">
<label for="price">Price</label>
<input type="text" class="form-control" id="price"></input>
</div>
<div>
<label class="checkbox-inline">
<input type="checkbox" id="show_website" value="">Show on Webstite (requires banner image and title)
</label>
</div>
<div>
<label class="checkbox-inline">
<input type="checkbox" id="show_infoscreen" value="">Show ond Infoscreen (requires infoscreen image)
</label>
</div>
<div>
<label class="checkbox-inline">
<input type="checkbox" id="show announce" value="">Show in Announce (requires stuff)
</label>
</div>
<button data-toggle="collapse" data-target="#english-collapse">show english fields</button>
<div id="english-collapse" class="collapse">
<div class=form-group>
<label for="title_en">Title english</label>
<input type="text" class="form-control" id="title_en"></input>
</div>
<div class="form-group">
<label for="description_en">Description english</label>
<textarea type="text" class="form-control" rows="3" id="description_en"></textarea>
</div>
<div class="form-group">
<label for="catchphrase_en">Catchphrase english</label>
<input type="text" class="form-control" id="catchphrase_en"></input>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div> </div>
<div class="modal-footer"> </div>
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div> </div>
<style> <style>
.users-table-wrapper { .users-table-wrapper {
position: relative; position: relative;
} }
.users-table-wrapper>div {
overflow: auto;
}
.users-sidebar {
background: #fff;
}
</style>
<script type="text/javascript"> .users-table-wrapper>div {
var showInTable = ['title_de', 'time_start', 'show_website', 'spots']; overflow: auto;
var tableTitles = ['Title', 'Date', 'on website', 'spots'];
amivcore.events.GET({data:{'max_results':'50'}}, function(ret){
console.log(ret);
if(!ret || ret['_items'].length == 0){
tools.log('No Data', 'w');
return;
}
tableTitles.forEach(function(i){
$('.events-table thead tr').append('<th>'+ i +'</th>');
});
for(var n in ret['_items']){
var tmp = '';
showInTable.forEach(function(i){
tmp += '<td>'+ ret['_items'][n][i] +'</td>';
});
$('#events-table tbody').append('<tr name="'+ret['_items'][n]['id']+'"">'+tmp+'</tr>');
}
//show modal on click of the table
$('#events-table tbody tr').click(function(event) {
var id = $(this).attr('name')
var clickedEvent = $.grep(ret['_items'], function(e){return e.id == id;})[0];
console.log(clickedEvent);
$('#detail-modal .modal-title').text(clickedEvent['title_de']);
$('#detail-modal').modal('show');
for(var field in clickedEvent){
var temp = '<td>'+field+'</td><td>'+clickedEvent[field]+'</td>';
$('#event-details-table tbody').append('<tr>'+temp+'</tr>');
} }
//var clicked = $.grep(_items, function(e){ return e.id == ; })[];
});
}); .users-sidebar {
$('#detail-modal').on("hidden.bs.modal", function (e) { background: #fff;
$(e.target).removeData("bs.modal").find(".modal-content tbody").empty(); }
}); </style>
$(document).ready(function(){ <script type="text/javascript">
// $('#time_start').datetimepicker({ var showInTable = ['title_de', 'time_start', 'show_website', 'spots'];
// locale: 'de' var tableTitles = ['Title', 'Date', 'on website', 'spots'];
//});
}); amivcore.events.GET({
data: {
'max_results': '50'
}
}, function(ret) {
console.log(ret);
if (!ret || ret['_items'].length == 0) {
tools.log('No Data', 'w');
return;
}
tableTitles.forEach(function(i) {
$('.events-table thead tr').append('<th>' + i + '</th>');
});
for (var n in ret['_items']) {
var tmp = '';
showInTable.forEach(function(i) {
tmp += '<td>' + ret['_items'][n][i] + '</td>';
});
$('#events-table tbody').append('<tr name="' + ret['_items'][n]['id'] + '"">' + tmp + '</tr>');
}
//show modal on click of the table
$('#events-table tbody tr').click(function(event) {
var id = $(this).attr('name')
var clickedEvent = $.grep(ret['_items'], function(e) {
return e.id == id;
})[0];
console.log(clickedEvent);
$('#detail-modal .modal-title').text(clickedEvent['title_de']);
$('#detail-modal').modal('show');
for (var field in clickedEvent) {
var temp = '<td>' + field + '</td><td>' + clickedEvent[field] + '</td>';
$('#event-details-table tbody').append('<tr>' + temp + '</tr>');
}
//var clicked = $.grep(_items, function(e){ return e.id == ; })[];
});
});
$('#detail-modal').on("hidden.bs.modal", function(e) {
$(e.target).removeData("bs.modal").find(".modal-content tbody").empty();
});
$(document).ready(function() {
// $('#time_start').datetimepicker({
// locale: 'de'
//});
});
</script> </script>
<div class="users-table-wrapper"> <div class="users-table-wrapper">
<div class="tools-full-height"> <table class="table table-hover users-table">
<table class="table table-hover users-table"> <thead>
<thead> <tr>
<tr> </tr>
</tr> </thead>
</thead> <tbody>
<tbody> </tbody>
</tbody> </table>
</table>
</div>
</div> </div>
<style> <style>
.users-table-wrapper { .users-table-wrapper {
position: relative; width: 100%;
} height: 100%;
.users-table-wrapper>div {
overflow: auto; overflow: auto;
} }
.users-sidebar {
background: #fff;
}
</style> </style>
<script type="text/javascript"> <script type="text/javascript">
tools.ui.menu({ tools.ui.menu({
'Add User': { 'Add User': {
callback: function(){ callback: function() {
console.log('noice'); console.log('noice');
}
} }
}
}); });
var showInTable = ['firstname', 'lastname', 'email', 'membership']; function showDetails() {
console.log($(this).attr('data-id'));
}
var showInTable = ['firstname', 'lastname', 'email', 'membership'],
curData = null;
amivcore.users.GET({ amivcore.users.GET({
data: { data: {
'max_results': '50' 'max_results': '50'
...@@ -45,6 +42,8 @@ ...@@ -45,6 +42,8 @@
return; return;
} }
curData = ret['_items'];
showInTable.forEach(function(i) { showInTable.forEach(function(i) {
$('.users-table thead tr').append('<th>' + i + '</th>'); $('.users-table thead tr').append('<th>' + i + '</th>');
}); });
...@@ -54,8 +53,8 @@ ...@@ -54,8 +53,8 @@
showInTable.forEach(function(i) { showInTable.forEach(function(i) {
tmp += '<td>' + ret['_items'][n][i] + '</td>'; tmp += '<td>' + ret['_items'][n][i] + '</td>';
}); });
$('.users-table tbody').append('<tr>' + tmp + '</tr>'); $('.users-table tbody').append('<tr data-id="' + ret['_items'][n]['id'] + '">' + tmp + '</tr>');
//$('.users-table tbody').append('<tr><td>'+ret['_items'][n].firstname+'</td></tr>');
} }
$('.users-table tbody tr').click(showDetails);
}); });
</script> </script>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment