expo-16 rating, js part is ready

remotes/origin/1203
pavel 11 years ago
parent 18343fa4d0
commit f2db7ed26c
  1. 9
      templates/client/includes/accounts/current_user.html
  2. 8
      templates/client/includes/company/company_edit.html
  3. 2
      templates/client/static_client/css_min/main.min.css
  4. 25
      templates/client/static_client/js/_modules/page.company.js
  5. 28
      templates/client/static_client/js/_modules/page.profile.js
  6. 2
      templates/client/static_client/js_min/_modules/page.company.min.js
  7. 2
      templates/client/static_client/js_min/_modules/page.profile.min.js

@ -56,10 +56,10 @@
</div> </div>
</div> </div>
</div> </div>
<div class="i-rating" title="Рейтинг: 551">551</div> <div class="i-rating" title="{% trans 'Рейтинг' %}: 551" id="profile-rating">551</div>
<div class="reason_block"> <div class="reason_block">
<p>Заполните свой<br>профиль, чтобы<br>повысить рейтинг</p> <p>{% trans 'Заполните свой профиль, чтобы повысить рейтинг' %}</p>
<p>Чем выше<br>рейтинг —<br>тем больше<br>преимуществ!</p> <p>{% trans 'Чем выше рейтинг — тем больше преимуществ!' %}</p>
</div> </div>
</aside> </aside>
{# END avatar #} {# END avatar #}
@ -550,6 +550,9 @@
addCompany:{ addCompany:{
modalId:'pw-company', modalId:'pw-company',
formId:'create_company_form' formId:'create_company_form'
},
rating:{
id:'profile-rating'
} }
}); });

@ -58,7 +58,7 @@
</div> </div>
<!--!!--> <!--!!-->
<div class="i-rating" title="Рейтинг: 551">551</div> <div id="profile-rating" class="i-rating" title="{% trans 'Рейтинг' %}: 551">551</div>
</aside> </aside>
<div class="i-info"> <div class="i-info">
@ -625,10 +625,10 @@
// some helper text in current language // some helper text in current language
lang:{ lang:{
workIn:'в'// there must be 'at' in English workIn:'в'// there must be 'at' in English
},
rating:{
id:'profile-rating'
} }
}); });
</script> </script>
{% endblock %} {% endblock %}

File diff suppressed because one or more lines are too long

@ -16,6 +16,26 @@ if (EXPO.company){
//dependences //dependences
var $waiter; var $waiter;
//private //private
/**
* Rating functional. Object stores data, HTML Instance of rating field, and can refresh its value
* @param {Object} opt - options for rating instance, like HTML Id and other
* @constructor
*/
function Rating(opt){
this.opt = opt;
this.$inst = $('#'+opt.id);
this.value = this.$inst.text;
}
Rating.prototype = {
/**
* refreshes value of HTML instance with new.
* @param {number} newRating - new profile rating value
*/
refresh: function (newRating) {
this.value = newRating;
this.$inst.text(this.value);
}
};
// factory for on page form objects // factory for on page form objects
function Forms(){} function Forms(){}
// methods to perform ajax responses to send and receive data from the server // methods to perform ajax responses to send and receive data from the server
@ -34,6 +54,9 @@ if (EXPO.company){
contentType: false, contentType: false,
success: function(data) { success: function(data) {
self.pullHandler(data); self.pullHandler(data);
if(data.success){
EXPO.company.rating.refresh(data.rating);
}
$('#wait-ajax').fadeOut(); $('#wait-ajax').fadeOut();
} }
}); });
@ -400,6 +423,8 @@ if (EXPO.company){
$(selector).inputmasks(maskOpts); $(selector).inputmasks(maskOpts);
}; };
this.rating = new Rating(this.opt.rating);
this.forms = {}; this.forms = {};
$(function () { $(function () {
var $editables = $('.'+self.opt.editableClass); var $editables = $('.'+self.opt.editableClass);

@ -19,9 +19,30 @@ if (EXPO.profile){
$waiter; $waiter;
//private //private
// factory for on page form objects
/**
* Rating functional. Object stores data, HTML Instance of rating field, and can refresh its value
* @param {Object} opt - options for rating instance, like HTML Id and other
* @constructor
*/
function Rating(opt){
this.opt = opt;
this.$inst = $('#'+opt.id);
this.value = this.$inst.text;
}
Rating.prototype = {
/**
* refreshes value of HTML instance with new.
* @param {number} newRating - new profile rating value
*/
refresh: function (newRating) {
this.value = newRating;
this.$inst.text(this.value);
}
};
function Forms(){}; function Forms(){};
// methods to perform ajax responses to send and receive data from the server // methods to perform ajax responses to send and receive data from the server
// factory for on page form objects
Forms.prototype = { Forms.prototype = {
// ajax request realization // ajax request realization
getajax: function (dataToSend) { getajax: function (dataToSend) {
@ -37,6 +58,9 @@ if (EXPO.profile){
contentType: false, contentType: false,
success: function(data) { success: function(data) {
self.pullHandler(data); self.pullHandler(data);
if(data.success){
EXPO.profile.rating.refresh(data.rating);
}
$('#wait-ajax').fadeOut(); $('#wait-ajax').fadeOut();
} }
}); });
@ -107,6 +131,7 @@ if (EXPO.profile){
this.$editable.removeClass('hidden'); this.$editable.removeClass('hidden');
this.$description.addClass('hidden'); this.$description.addClass('hidden');
} }
} }
}; };
Forms.factory = function (type, ajaxpath) { Forms.factory = function (type, ajaxpath) {
@ -425,6 +450,7 @@ if (EXPO.profile){
$(selector).inputmasks(maskOpts); $(selector).inputmasks(maskOpts);
}; };
this.rating = new Rating(this.opt.rating);
this.forms = {}; this.forms = {};
$(function () { $(function () {
var $editables = $('.'+self.opt.editableClass); var $editables = $('.'+self.opt.editableClass);

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long
Loading…
Cancel
Save