Commit 7280f398 authored by Olga Brani's avatar Olga Brani Committed by Kostas Papadimitriou
Browse files

astakos: Fix members list table checkbox bug

parent 57e66252
......@@ -207,14 +207,14 @@ a.button:hover { background-color: #F89A1C; border:0 none; color:#fff;}
.dataTables_paginate a:first-child:after { content: '';}
.dataTables_paginate a:first-child:before { content: '< ';}
.dataTables_paginate .paginate_enabled_next,
.dataTables_paginate .paginate_disabled_next { margin-left:15px; }
.dataTables_paginate .paginate_disabled_next { margin-left:20px; }
.dataTables_wrapper .select { margin-left: 40px; float: left;}
.dataTables_paginate .paginate_enabled_previous:hover,
.dataTables_paginate .paginate_enabled_next:hover { cursor: pointer; }
.dataTables_paginate .paginate_disabled_previous:hover,
.dataTables_paginate .paginate_disabled_previous,
.dataTables_paginate .paginate_disabled_next,
.dataTables_paginate .paginate_disabled_next:hover { color: gray; text-decoration: none}
.dataTables_paginate .paginate_disabled_next:hover { color: #B3B3B3; text-decoration: none}
.dataTables_filter { position: absolute; right: 0; top: -2px;}
.dataTables_filter input { border: 1px solid #9e9e9e; height: 21px; line-height: 21px; padding: 3px 10px;}
.dataTables_paginate .nums { text-align:left;}
......@@ -704,4 +704,6 @@ table.cols-3 tr.links td { font-size:1.154em}
.form-actions form.link-like input.approve[type="submit"] { background:#55B577;}
.form-actions form.link-like input[type="submit"]:hover { text-decoration:none; background:#3582AC; }
.form-actions.inactive form.link-like input[type="submit"] { background:#e8e8e8; cursor:default; }
.search-projects + #projects-list_wrapper table caption { font-size: 1.308em;}
......@@ -84,6 +84,35 @@ if (navigator.userAgent.match(/iPhone/i)) {
}
//end of fix
/* project members page js */
function check_form_actions_inactive(){
if ( $('#members-table tbody td.check input:checked').length >0 ) {
$('.projects .form-actions').removeClass('inactive');
} else {
$('.projects .form-actions').addClass('inactive');
}
// updating form data
var forms = $("form.link-like:has('input.members-batch-action')");
forms.each(function(index, form){
var member_ids, checked;
form = $(form);
form.find("input.member-option").remove();
checked = $('#members-table tbody td.check input:checked');
member_ids = _.map(checked, function(el) {
return parseInt($(el).val());
});
_.each(member_ids, function(id) {
var newel;
newel = $("<input name='members' class='member-option' type='hidden' value='"+id+"'>");
form.append(newel);
});
})
}
function tableSort(tableEl, iDisplayLength, bFilter) {
// bFilter is an optional parameter
......@@ -113,19 +142,32 @@ function tableSort(tableEl, iDisplayLength, bFilter) {
});
// control pagination & table sorting for projects intro page
tableEl.dataTable({
tableEl
.bind('page', function () {
$('#members-table input').attr('checked', false);
check_form_actions_inactive();
})
.dataTable({
"bFilter": bFilter,
"iDisplayLength": iDisplayLength,
"bLengthChange": true,
"sDom": '<"top">frt<"clearfix"i><"bottom"pl>',
"sDom": '<"top">frt<"clearfix"><"bottom"i<"select"l>p>',
"bStateSave": true,
"aoColumnDefs": [
{ "sType": "num-html", "aTargets": numHTMLArr },
{ "sType": "date-uk", "aTargets": dateArr },
]
],
"oLanguage": {
"sLengthMenu": 'Pagination <select>'+
'<option value="10">10</option>'+
'<option value="25">25</option>'+
'<option value="50">50</option>'+
'<option value="-1">All</option>'+
'</select>'
},
});
$('.dataTables_wrapper').addClass('clearfix');
$('.dataTables_wrapper').addClass('clearfix');
}
$(document).ready(function() {
......@@ -411,32 +453,8 @@ $(document).ready(function() {
$('#okeanos_recaptcha').parents('.form-row').find('.extra-img').hide();
check_form_actions_inactive();
/* project members page js */
function check_form_actions_inactive(){
if ( $('#members-table tbody td.check input:checked').length >0 ) {
$('.projects .form-actions').removeClass('inactive');
} else {
$('.projects .form-actions').addClass('inactive');
}
// updating form data
var forms = $("form.link-like:has('input.members-batch-action')");
forms.each(function(index, form){
var member_ids, checked;
form = $(form);
form.find("input.member-option").remove();
checked = $('#members-table tbody td.check input:checked');
member_ids = _.map(checked, function(el) {
return parseInt($(el).val());
});
_.each(member_ids, function(id) {
var newel;
newel = $("<input name='members' class='member-option' type='hidden' value='"+id+"'>");
form.append(newel);
});
})
}
$('#members-table td.email').click(function(e){
var that = $(this).parent('tr').find('.check').find('input[type="checkbox"]')
......@@ -449,10 +467,7 @@ $('#members-table td.email').click(function(e){
})
$('#members-table tr th.check input').click(function(e){
$('#members-table tr th.check input').change(function(e){
if($(this).is(":checked")){
$('#members-table tbody td.check input').attr('checked', 'checked');
} else {
......@@ -464,8 +479,6 @@ $('#members-table tr .check input').click(function(e){
check_form_actions_inactive()
});
/* end of project members page js */
$('.renew-token a.confirm').click(function(e){
e.preventDefault();
e.stopPropagation();
......@@ -488,8 +501,9 @@ $('#members-table tr .check input').click(function(e){
})
tableSort($('.projects-intro').siblings('table#projects-list'), 10, true );
tableSort($('.search-projects').siblings('table#projects-list'), 20, true);
tableSort($('#members-table'), 10, true);
tableSort($('.search-projects').siblings('table#projects-list'), 25, true);
tableSort($('#members-table'), 3, true);
});
......
......@@ -6,10 +6,10 @@
{% block page.body %}
<div class="maincol {% block innerpage.class %}{% endblock %}">
<div class="projects">
<h2>PROJECTS</h2>
{% if form %}
{% include "im/projects/search_form.html" %}
{% else %}
<h2>PROJECTS</h2>
{% include "im/projects/intro.html" %}
{% endif %}
{% if table %}
......
<div class="search-projects">
<p>Search for existing Projects and join the ones you like. </p><br>
</div>
<div class="search-projects"></div>
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment