From 936701aadb1084ffca75f07acb11a29914f00288 Mon Sep 17 00:00:00 2001 From: Lova ANDRIARIMALALA <43842786+Xpirix@users.noreply.github.com> Date: Tue, 13 Feb 2024 14:21:09 +0300 Subject: [PATCH] Add new stars images for plugins rating display --- qgis-app/plugins/views.py | 2 +- qgis-app/settings_docker.py | 5 +++ .../half-and-quarter-star-16.png | Bin 0 -> 828 bytes .../jquery-ratings/half-and-quarter-star.png | Bin 0 -> 1914 bytes .../static/jquery-ratings/half-star-16.png | Bin 0 -> 859 bytes qgis-app/static/jquery-ratings/half-star.png | Bin 0 -> 1815 bytes .../static/jquery-ratings/jquery.ratings.css | 14 ++++++++ .../static/jquery-ratings/jquery.ratings.js | 32 ++++++++++++++++-- .../static/jquery-ratings/quarter-star-16.png | Bin 0 -> 825 bytes .../static/jquery-ratings/quarter-star.png | Bin 0 -> 1801 bytes 10 files changed, 50 insertions(+), 3 deletions(-) create mode 100644 qgis-app/static/jquery-ratings/half-and-quarter-star-16.png create mode 100644 qgis-app/static/jquery-ratings/half-and-quarter-star.png create mode 100644 qgis-app/static/jquery-ratings/half-star-16.png create mode 100644 qgis-app/static/jquery-ratings/half-star.png create mode 100644 qgis-app/static/jquery-ratings/quarter-star-16.png create mode 100644 qgis-app/static/jquery-ratings/quarter-star.png diff --git a/qgis-app/plugins/views.py b/qgis-app/plugins/views.py index 8cb6adaf..d1897117 100644 --- a/qgis-app/plugins/views.py +++ b/qgis-app/plugins/views.py @@ -545,7 +545,7 @@ def get_context_data(self, **kwargs): messages.error(self.request, msg, fail_silently=True) context.update( { - "rating": int(plugin.rating.get_rating()), + "rating": plugin.rating.get_rating(), "votes": plugin.rating.votes, } ) diff --git a/qgis-app/settings_docker.py b/qgis-app/settings_docker.py index bb151b7f..1aa2d82e 100644 --- a/qgis-app/settings_docker.py +++ b/qgis-app/settings_docker.py @@ -5,6 +5,7 @@ SITE_ROOT = os.path.dirname(os.path.realpath(__file__)) from datetime import timedelta +from django.contrib.staticfiles.storage import ManifestStaticFilesStorage DEBUG = ast.literal_eval(os.environ.get("DEBUG", "True")) THUMBNAIL_DEBUG = DEBUG @@ -31,6 +32,10 @@ # Example: "http://example.com/static/", "http://static.example.com/" STATIC_URL = "/static/" +# Manage static files storage ensuring that their +# filenames contain a hash of their content for cache busting +STATICFILES_STORAGE = 'django.contrib.staticfiles.storage.ManifestStaticFilesStorage' + INSTALLED_APPS = [ "django.contrib.auth", "django.contrib.contenttypes", diff --git a/qgis-app/static/jquery-ratings/half-and-quarter-star-16.png b/qgis-app/static/jquery-ratings/half-and-quarter-star-16.png new file mode 100644 index 0000000000000000000000000000000000000000..09b5589b2b9419a4aed183a659d784d9eb9765f5 GIT binary patch literal 828 zcmV-C1H=4@P)Y|jTiR##@80mwmet{I-zmTkAZ1x$7{ zTd(X~k!#Pdmq13r-?&)D-<{^IKOU{$isSe$5k1gax0yMTwngtRH2OEUUoIgCJa{D& zm5K%1mVhpTD*G-jK6hcx^~-ys(P%FWLnKKuGEMVc>A0oOP6y6wo^QUnvRnb#5>O0i zjcM!z*p7oB2$1JF(lmuq>J!&>?}*w=)SKj;-S2)FfB*2$2zoRD_`kn?mXSu5WoWnC z*x%p(XgC~xY?@{&v}Ty5K$;xA@#Ed>x093PNmqJWO$25jiXyaHtuNv@{!mH@W`F1dZ!)jeuI=tTR_ji&c`8>8B6)45p#j$;ALs8@TxXZi654-Qtp3BzzD&lQ9yEd3Yv!Bj(`)J9SO0000`xXEyh4jLKWH{Kro=fHsj8|tGwfjNHcVQ0^79G#jBFf|!q z&u)Cxa%P-rXv6m`SQZ7P1cZ=H>)ertnhodl?kVlnYAyi4b8~N)I4|4G{c@ZLWL!ci zgFIK8*12sDoqYNcXZMu+Vyoq&*;qbJ57WEk=Rx;`)zDe?5&>hI_t3V18g+YiqDAal z@=UQNF^JcaMbn4`xaC$0#bgbs08afC98$n>B8ak*&9(GNt zhYi`+szols(1Gu-jtoM`=-epVilK>d`|NnjuxiyorDDT#82~_Q8&RauY8rcd+C*nQ7s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qvSNNEto8c}2rMFfpDF^!IIR7xF6eR!S^*LC4I z&Oqsxb#3!0V^lk-5r~r%7QHunx2w_aC^TCs7Hi>Lv#r0N(nV>lKFURKFbD!am&?KP zJTS%vjTwN6$;nA}`t)hD)_Us#O&$5{u8)3LqucGZ3$&#ml|iGa?bWy3mud~MU(ibz zl;(XLC$Tsf$DZ+3;R{{{`KPzCyVaQ_27U002ovPDHLk FV1kBzVHW@Z literal 0 HcmV?d00001 diff --git a/qgis-app/static/jquery-ratings/jquery.ratings.css b/qgis-app/static/jquery-ratings/jquery.ratings.css index 9c9cdbf4..cc55d031 100644 --- a/qgis-app/static/jquery-ratings/jquery.ratings.css +++ b/qgis-app/static/jquery-ratings/jquery.ratings.css @@ -11,3 +11,17 @@ .jquery-ratings-full { background-image: url('full-star-16.png'); } + + +.jquery-ratings-quarter { + background-image: url('quarter-star-16.png'); +} + +.jquery-ratings-half { + background-image: url('half-star-16.png'); +} + +.jquery-ratings-half-and-quarter { + background-image: url('half-and-quarter-star-16.png'); +} + diff --git a/qgis-app/static/jquery-ratings/jquery.ratings.js b/qgis-app/static/jquery-ratings/jquery.ratings.js index 3d5a2a77..30519668 100644 --- a/qgis-app/static/jquery-ratings/jquery.ratings.js +++ b/qgis-app/static/jquery-ratings/jquery.ratings.js @@ -42,8 +42,21 @@ jQuery.fn.ratings = function(stars, initialRating) { star.addClass('jquery-ratings-star'); //Add the full css class if the star is beneath the initial rating. + // The last star will depend on the decimal left if(starIdx < initialRating) { - star.addClass('jquery-ratings-full'); + let ratingDiff = initialRating - starIdx + if (ratingDiff > 0 && ratingDiff <= 0.3) { + star.addClass('jquery-ratings-quarter'); + } + else if (ratingDiff > 0.3 && ratingDiff <= 0.6) { + star.addClass('jquery-ratings-half'); + } + else if (ratingDiff > 0.6 && ratingDiff <= 0.9) { + star.addClass('jquery-ratings-half-and-quarter'); + } + else { + star.addClass('jquery-ratings-full'); + } } //add the star to the container @@ -65,13 +78,28 @@ jQuery.fn.ratings = function(stars, initialRating) { //Unhighlight unselected stars. for(var index = this.rating; index < stars; index++) { starsCollection[index].removeClass('jquery-ratings-full'); + starsCollection[index].removeClass('jquery-ratings-half-and-quarter'); + starsCollection[index].removeClass('jquery-ratings-half'); + starsCollection[index].removeClass('jquery-ratings-quarter'); } }); container.mouseleave(function() { //Highlight selected stars. for(var index = 0; index < containerElement.rating; index++) { - starsCollection[index].addClass('jquery-ratings-full'); + let ratingDiff = containerElement.rating - index + if (ratingDiff > 0 && ratingDiff <= 0.3) { + starsCollection[index].addClass('jquery-ratings-quarter'); + } + else if (ratingDiff > 0.3 && ratingDiff <= 0.6) { + starsCollection[index].addClass('jquery-ratings-half'); + } + else if (ratingDiff > 0.6 && ratingDiff <= 0.9) { + starsCollection[index].addClass('jquery-ratings-half-and-quarter'); + } + else { + starsCollection[index].addClass('jquery-ratings-full'); + } } //Unhighlight unselected stars. for(var index = containerElement.rating; index < stars ; index++) { diff --git a/qgis-app/static/jquery-ratings/quarter-star-16.png b/qgis-app/static/jquery-ratings/quarter-star-16.png new file mode 100644 index 0000000000000000000000000000000000000000..edbada17611ce0db876f597ff25870865972fd9b GIT binary patch literal 825 zcmV-91IGM`P)q$gGR5*=gl1*_OM{XhX6q(*4^;~_yb5}0TQSpQYoOQ7K8?x1k$*6X2$WycxLXsEJEEB zUg_*!J$lbMuXuCwNmg4G>Ptm_{OOp%V2bTXv@#r@tgL}xX<`2+=QO|g3jKbc{r!C` z0AmbFX;#~FXl+mm(o~T!zmBQbzOYl zCrwi(lL<hW|=yO_C%W930T;blxA0MjzO= zJ&{@)Y+EuJAH8sGJN~uT8zV3XAs+ZUKp2MX?(SZVqUb%#vM|PAEjLQ!q(BG=!tCXv z?s%_UO_5U0t}UfRDMi2E*TdoP?P9SwOC<}wh2!LqQjliyIjuAx5kmZLlv2_dvuaru z`FtMV_pv9n+S zGrf9nIC%BZrR!UE?vHD?{y1~Ig=Kre6MKV#ml%uSB$$l@CL%0@Z6aKF z$oKsxeBZyzbzO{F5Cn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