makes use of Mono.Web.Xdt at deploy time * PayPalController.cs: implements a Paypal controller * Abort.aspx: Paypal paiement aborting page * Commit.aspx: Paypal paiement commit page * IPN.aspx: Paypal paiement notification page * Index.aspx: Paypal paiement form page * WebTasks.dll: thanks to he Marcelo Zabani's coding blog: <https://mzabani.wordpress.com/2013/09/24/mono-asp-net-project-deployment-with-web-config-xdt-transformations/> * .gitignore: ignore my new config transformation sources * pkg.mdproj: * Presta.csproj: * TestAPI.csproj: * fortune.csproj: * SalesCatalog.csproj: * ITContentProvider.csproj: * NpgsqlMRPProviders.csproj: * NpgsqlBlogProvider.csproj: * NpgsqlContentProvider.csproj: adds a build target named "Lua" * Makefile: instead of `deploy`, start Xsp, in the `dist` folder * Yavsc.sln: * YavscModel.csproj: * WebControls.csproj: * YavscClient.csproj: Lua config * yavsc.rate.js: refactoring, still needs a cleanning * RateSkillControl.ascx: give it the `rate-site-skill` `data-type` html attribute * RateUserSkillControl.ascx: cleans an obsolete code chunk * Web.csproj: Fixes the missing RateSkillControl at deploy time, adds my deployment config
58 lines
1.8 KiB
JavaScript
58 lines
1.8 KiB
JavaScript
(function() {
|
|
(function(jQuery) {
|
|
return jQuery.widget('Yavsc.rate', {
|
|
options: {
|
|
target: null,
|
|
disabled: false
|
|
},
|
|
sendRate: function (rating,callback) {
|
|
Yavsc.ajax(this.options.target+'/Rate', rating, callback);
|
|
},
|
|
_create: function() {
|
|
var $ratectl = $(this.element);
|
|
var _this = this;
|
|
$ratectl.onChanged = function (newrate) {
|
|
// build the five stars
|
|
_this.updateRate($ratectl,newrate);
|
|
};
|
|
var id = $ratectl.data('id');
|
|
$ratectl.addClass('rate');
|
|
$ratectl.click(function (e) {
|
|
var oset = $ratectl.offset();
|
|
var x = ((e.pageX - oset.left) * 100 ) / $ratectl.width();
|
|
// here, x may be greater than 100, or lower than 0 here,
|
|
// depending on padding & mergin on the $ratectl node,
|
|
// when it's a span, and there is a line return within,
|
|
// the values on second star line are false.
|
|
// time to sanitize
|
|
x = Math.ceil(x);
|
|
if (x<0) x = 0;
|
|
if (x>100) x = 100;
|
|
var data = { Id: id, Rate: x };
|
|
_this.sendRate(data, function () {
|
|
$ratectl.onChanged(x); });
|
|
});
|
|
},
|
|
updateRate: function (ctl,rate) {
|
|
var rounded = Math.round(rate / 10);
|
|
var HasHalf = (rounded % 2 == 1);
|
|
var NbFilled = Math.floor(rounded / 2);
|
|
var NbEmpty = (5 - NbFilled) - ((HasHalf)?1:0) ;
|
|
ctl.empty();
|
|
var i=0;
|
|
for (i=0; i<NbFilled; i++)
|
|
ctl.append('<i class="fa fa-star"></i>');
|
|
if (HasHalf)
|
|
ctl.append('<i class="fa fa-star-half-o"></i>');
|
|
for (var j=0; j<NbEmpty; j++, i++ )
|
|
ctl.append('<i class="fa fa-star-o"></i>');
|
|
},
|
|
})})(jQuery);
|
|
}).call(this);
|
|
|
|
$(document).ready(function(){
|
|
$('[data-type="rate-site-skill"]').rate({target: 'Skill/RateSkill'});
|
|
$('[data-type="rate-user-skill"]').rate({target: 'Skill/RateUserSkill'});
|
|
$('[data-type="rate-bill"]').rate({target: 'Blogs/Rate'});
|
|
});
|