diff --git a/application/views/settings.twig b/application/views/settings.twig index 121c922053dd5166fec2567d8f89b3ca8136e5d9..5c61e3774f5eff21bbadba394c2fc2104a0ed4fe 100644 --- a/application/views/settings.twig +++ b/application/views/settings.twig @@ -10,6 +10,7 @@ {% block main_content %} <div class="pageProfileSettings"> <div class="settingsSection"> + <p>Логин может состоять из латинских букв, цифр и знаков: - и _</p> <div class="itemBlock"> <div class="title">Логин:</div> <div class="field"><input type="text" class="inputLogin inputText" value="{{ User.Login }}"></div> @@ -26,7 +27,7 @@ <div class="title">Новый адрес:</div> <div class="field"><input type="text" class="inputNewEmail inputText" value=""></div> </div> - <button class="changeEmail saveSettings">Сохранить адрес</button> + <button class="changeEmail saveSettings">Сохранить адрес not work now</button> </div> <div class="settingsSection"> @@ -34,6 +35,7 @@ <div class="title">Старый пароль:</div> <div class="field"><input type="text" class="inputCurrentPass inputText" value=""></div> </div> + <p>Пароль должен состоять из 5 и более символов</p> <div class="itemBlock"> <div class="title">Новый пароль:</div> <div class="field"><input type="text" class="inputNewPass inputText" value=""></div> diff --git a/media/css/settings.css b/media/css/settings.css index 98454fda16f84254f8fc4a05c7467f1ac2c8bd72..8e453053cf6e6d2644cf8f8d1a746e6208fbd85b 100644 --- a/media/css/settings.css +++ b/media/css/settings.css @@ -2,56 +2,16 @@ padding: 0 25px; } -h2.profileName { - display: inline; - float: left; - width: 50%; - font-size: 28px; - font-weight: normal; - color: #3399CC; - line-height: 160%; -} -p.level { - display: inline; - float: right; - width: 50%; - text-align: right; - font-size: 18px; - color: #363636; - line-height: 160%; -} -p.smallNotice { - clear: both; - padding-bottom: 15px; - font-size: 14px; - color: #666; - line-height: 160%; -} -.smallNotice a{ - color: red; -} - -.blockReport { - display: none; - background: #f4f4f4; - padding: 20px; -} - .blockReport textarea { - width: 900px; - height: 90px; - padding: 5px; - resize: vertical; - } - .blockReport .sendReport { - float: right - } - .settingsSection { position: relative; margin: 0 auto; margin-bottom: 10px; width: 500px; } + /* Подсказка */ + .settingsSection p{ + text-align: center; font-size: 15px; + } .settingsSection .itemBlock { margin: 25px 0px; } diff --git a/media/js/setRate.js b/media/js/setRate.js index 642b8a39e5b4292a26f481d4b17f2e611cd68eb3..6b58deaefbcf4010e78fcc503de2caf287de3bee 100644 --- a/media/js/setRate.js +++ b/media/js/setRate.js @@ -1,11 +1,13 @@ var $ = jQuery; $(function() { var tdClass = new Array();; - var isFocusCell = false; // + var isFocusCell = false; // Стоит фокус или нет + var oldRateCell; - // + // Ставим фокус function tdFocus(thisObj, thisClass){ tdClass = thisClass.split(' '); + oldRateCell = thisObj.children('input').val(); $('.'+tdClass[0]).each(function(){ $(this).css('background-color', '#f1f1f1'); }); @@ -14,8 +16,9 @@ $(function() { }); } - // + // Убираем фокус function tdUnFocus(thisObj){ + oldRateCell = undefined; $('.'+tdClass[0]).each(function(){ $(this).css('background-color', '#fff'); }); @@ -24,39 +27,36 @@ $(function() { }); } - function Rating($this) { + function Rating(thisObj) { // Получаем подмодуль var reg = /col_\d+/; - var col = ''+reg.exec($this.attr('class')); + var col = ''+reg.exec(thisObj.attr('class')); col = $('.'+col+':first').attr('id'); // Получаем студента var reg = /row_\d+/; - var row = ''+reg.exec($this.attr('class')); + var row = ''+reg.exec(thisObj.attr('class')); row = $('.'+row+':first').attr('id'); - alert(col+' '+row+' '+$this.children('input').val()); - var edit = false; // Типа говорим, что балл нужно добавить, а не изменить - if (-1 < $this.attr('class').indexOf('edit')) + if (-1 < thisObj.attr('class').indexOf('edit')) edit = true; // Типа изменить балл - if (edit) { - alert('changeRate'); - $.post('/~dev_rating/handler/rating/changeRate', {'student': row, 'submodule': col, 'rate': $this.children('input').val() }, - function(data){ - alert(data); - } - ); - } - else { - alert('setRate'); - $.post('/~dev_rating/handler/rating/setRate', {'student': row, 'submodule': col, 'rate': $this.children('input').val() }, - function(data){ - alert(data); - } - ); - } + if (oldRateCell != thisObj.children('input').val()) + if (edit) { + $.post('/~dev_rating/handler/rating/changeRate', {'student': row, 'submodule': col, 'rate': thisObj.children('input').val() }, + function(data){ + alert(data); + } + ); + } + else { + $.post('/~dev_rating/handler/rating/setRate', {'student': row, 'submodule': col, 'rate': thisObj.children('input').val() }, + function(data){ + alert(data); + } + ); + } } $('.rateCell').mouseenter(function(){ @@ -76,8 +76,8 @@ $(function() { $('.rateCell').focusout(function(){ isFocusCell = false; - tdUnFocus($(this)); Rating($(this)); + tdUnFocus($(this)); }); // В inputCredit (где баллы вводить) разрешаем вводить только цифры diff --git a/media/js/settings.js b/media/js/settings.js index 379094f32cc24f61ced11cdab08d885293272372..a08b540897f2a5bd4824316eded6ee156ff13e71 100644 --- a/media/js/settings.js +++ b/media/js/settings.js @@ -27,11 +27,10 @@ $(function() { if (checkInput['login'] == true) $.post('/~dev_rating/handler/settings/changeLogin', {'login': $('.inputLogin').val()}, function(data){ - alert(data); data = $.parseJSON(data); if(data.success === true) { alert('Ок'); - } else alert('fuck'); + } else alert('Error'); } ); }); @@ -74,6 +73,10 @@ $(function() { }, function(data){ alert(data); + data = $.parseJSON(data); + if(data.success === true) { + alert('Ок'); + } else alert('Error'); } ); });