View | Details | Raw Unified | Return to bug 25110
Collapse All | Expand All

(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref (-1 / +1 lines)
Lines 56-62 OPAC: Link Here
56
            - "Show star-ratings on"
56
            - "Show star-ratings on"
57
            - pref: OpacStarRatings
57
            - pref: OpacStarRatings
58
              choices:
58
              choices:
59
                  all: "results and details"
59
                  all: "results, details, and user"
60
                  disable: "no"
60
                  disable: "no"
61
                  details: "only details"
61
                  details: "only details"
62
            - "pages."
62
            - "pages."
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/includes/user-star-ratings.inc (+53 lines)
Line 0 Link Here
1
<div class="results_summary ratings" id="rating-[% item.itemnumber | html %]">
2
3
    [% SET rating_avg = item.ratings.get_avg_rating() %]
4
    [% rating_avg_int = BLOCK %][% rating_avg | format("%.0f") %][% END %]
5
6
    <div class="br-wrapper br-theme-fontawesome-stars js-hide">
7
        <div class="br-widget br-readonly">
8
            [% FOREACH i IN [ 1 2 3 4 5  ] %]
9
                [% IF rating_avg_int == i %]
10
                    <a href="#" class="br-selected br-current"></a>
11
                [% ELSIF rating_avg_int > i %]
12
                    <a href="#" class="br-selected"></a>
13
                [% ELSE %]
14
                    <a href="#"></a>
15
                [% END %]
16
            [% END %]
17
        </div>
18
    </div>
19
20
    <select class="star_rating" id="star_rating-[% item.itemnumber | html %]" name="rating" autocomplete="off" data-biblionumber="[% item.biblionumber | html %]" data-context="rating-[% item.itemnumber | html %]">
21
22
        [% IF ( rating_avg_int == 0 ) %]
23
            <option value="" selected="selected"></option>
24
        [% END %]
25
        [% FOREACH i IN [ 1 2 3 4 5  ] %]
26
            [% IF rating_avg_int == i %]
27
                <option value="[% i | html %]" selected="selected">[% i | html %]</option>
28
            [% ELSE %]
29
                <option value="[% i | html %]">[% i | html %]</option>
30
            [% END %]
31
        [% END %]
32
    </select>
33
    <img id="rating-loading" style="display:none" src="[% interface | html %]/[% theme | html %]/images/spinner-small.gif" alt="" />
34
35
    <!-- define some hidden vars for ratings -->
36
37
    <input type="hidden" name="biblionumber" value="[% item.biblionumber | html %]" />
38
    <input type="hidden" name="rating_value" class="rating_value" value="[% item.my_rating.rating_value | html %]" />
39
40
    <input name="rate_button" type="submit" class="js-show" value="Rate me" />
41
42
    [% IF item.my_rating %]
43
        <div>
44
            <span class="rating_value_text">Your rating: [% item.my_rating.rating_value | html %].</span>
45
            <span class="cancel_rating_text js-show"><a href="#" data-context="star_rating-[% item.itemnumber | html %]"><i class="fa fa-remove"></i> Cancel rating</a>.</span>
46
        </div>
47
    [% ELSE %]
48
        <span class="rating_value_text"></span>
49
        <span class="cancel_rating_text" style="display:none;"><a href="#" data-context="star_rating-[% item.itemnumber | html %]"><i class="fa fa-remove"></i> Cancel rating</a>.</span>
50
    [% END %]
51
52
    <div class="rating_text">Average rating: [% rating_avg | html %] ([% item.ratings.count | html %] votes)</div>
53
</div>
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-readingrecord.tt (-18 / +10 lines)
Lines 145-168 Link Here
145
                                                [% END %]
145
                                                [% END %]
146
                                                <p class="results-summary item-details">[% issue.author | html %]</p>
146
                                                <p class="results-summary item-details">[% issue.author | html %]</p>
147
147
148
                                                    [% IF ( Koha.Preference( 'OpacStarRatings' ) == 'all' && issue.my_rating ) %]
148
                                                    [% IF ( Koha.Preference( 'OpacStarRatings' ) == 'all' ) %]
149
                                                        <div class="results_summary ratings">
149
                                                        [% INCLUDE 'user-star-ratings.inc' item=issue %]
150
                                                            <div class="br-wrapper br-theme-fontawesome-stars">
150
                                                    [% END %]
151
                                                                <div class="br-widget br-readonly">
152
                                                                    [% FOREACH i IN [ 1 2 3 4 5  ] %]
153
                                                                        [% IF issue.my_rating.rating_value == i %]
154
                                                                            <a href="#" class="br-selected br-current"></a>
155
                                                                        [% ELSIF issue.my_rating.rating_value > i %]
156
                                                                            <a href="#" class="br-selected"></a>
157
                                                                        [% ELSE %]
158
                                                                            <a href="#"></a>
159
                                                                        [% END %]
160
                                                                    [% END %]
161
                                                                </div>
162
                                                            </div>
163
                                                            Rated on [% issue.my_rating.timestamp | $KohaDates %]
164
                                                        </div> <!-- / .results_summary -->
165
                                                    [% END # / IF OpacStarRatings %]
166
151
167
                                                </td>
152
                                                </td>
168
                                                <td>
153
                                                <td>
Lines 235-239 Link Here
235
            }
220
            }
236
        });
221
        });
237
    });
222
    });
223
    var borrowernumber = "[% borrowernumber | html %]";
224
    var MSG_YOUR_RATING = _("Your rating: %s, ");
225
    var MSG_AVERAGE_RATING = _("Average rating: %s (%s votes)");
238
</script>
226
</script>
227
    [% IF ( Koha.Preference('OpacStarRatings') == 'all' ) %]
228
        [% Asset.js("lib/jquery/plugins/jquery.barrating.min.js") | $raw %]
229
        [% Asset.js("js/ratings.js") | $raw %]
230
    [% END %]
239
[% END %]
231
[% END %]
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt (-2 / +11 lines)
Lines 294-299 Link Here
294
                                                <td class="title">
294
                                                <td class="title">
295
                                                    <a class="title" href="/cgi-bin/koha/opac-detail.pl?biblionumber=[% ISSUE.biblionumber | html %]">[% INCLUDE 'biblio-title.inc' biblio=ISSUE %]</a>
295
                                                    <a class="title" href="/cgi-bin/koha/opac-detail.pl?biblionumber=[% ISSUE.biblionumber | html %]">[% INCLUDE 'biblio-title.inc' biblio=ISSUE %]</a>
296
                                                    [% IF ( ISSUE.enumchron ) %] [% ISSUE.enumchron | html %][% END %]
296
                                                    [% IF ( ISSUE.enumchron ) %] [% ISSUE.enumchron | html %][% END %]
297
298
                                                    [% IF ( Koha.Preference('OpacStarRatings') == 'all' ) %]
299
                                                        [% INCLUDE 'user-star-ratings.inc' item=ISSUE %]
300
                                                    [% END %]
297
                                                </td>
301
                                                </td>
298
302
299
                                                <td class="author">[% ISSUE.author | html %]</td>
303
                                                <td class="author">[% ISSUE.author | html %]</td>
Lines 778-785 Link Here
778
782
779
        $(document).ready(function(){
783
        $(document).ready(function(){
780
            $('#opac-user-views').tabs();
784
            $('#opac-user-views').tabs();
781
            $(".js-show").show();
782
            $(".js-hide").hide();
783
            $(".modal-nojs").addClass("modal").addClass("hide").removeClass("modal-nojs");
785
            $(".modal-nojs").addClass("modal").addClass("hide").removeClass("modal-nojs");
784
            $(".suspend-until").prop("readonly",1);
786
            $(".suspend-until").prop("readonly",1);
785
787
Lines 963-969 Link Here
963
            }
965
            }
964
        });
966
        });
965
        //]]>
967
        //]]>
968
        var borrowernumber = "[% borrowernumber | html %]";
969
        var MSG_YOUR_RATING = _("Your rating: %s, ");
970
        var MSG_AVERAGE_RATING = _("Average rating: %s (%s votes)");
966
    </script>
971
    </script>
972
    [% IF ( Koha.Preference('OpacStarRatings') == 'all' ) %]
973
        [% Asset.js("lib/jquery/plugins/jquery.barrating.min.js") | $raw %]
974
        [% Asset.js("js/ratings.js") | $raw %]
975
    [% END %]
967
    [% IF Koha.Preference('OverDriveCirculation') %]
976
    [% IF Koha.Preference('OverDriveCirculation') %]
968
    [% Asset.js("js/overdrive.js") | $raw %]
977
    [% Asset.js("js/overdrive.js") | $raw %]
969
    <script>
978
    <script>
(-)a/koha-tmpl/opac-tmpl/bootstrap/js/script.js (-1 / +3 lines)
Lines 42-47 $(document).ready(function(){ Link Here
42
        window.close();
42
        window.close();
43
    });
43
    });
44
    $(".focus").focus();
44
    $(".focus").focus();
45
    $(".js-show").show();
46
    $(".js-hide").hide();
45
47
46
    if( $(window).width() < 768 ){
48
    if( $(window).width() < 768 ){
47
        facetMenu("hide");
49
        facetMenu("hide");
Lines 70-73 $(document).ready(function(){ Link Here
70
        e.preventDefault();
72
        e.preventDefault();
71
        $("#loginModal").modal("show");
73
        $("#loginModal").modal("show");
72
    });
74
    });
73
});
75
});
(-)a/opac/opac-user.pl (-1 / +7 lines)
Lines 43-48 use Koha::Patrons; Link Here
43
use Koha::Patron::Messages;
43
use Koha::Patron::Messages;
44
use Koha::Patron::Discharge;
44
use Koha::Patron::Discharge;
45
use Koha::Patrons;
45
use Koha::Patrons;
46
use Koha::Ratings;
46
use Koha::Token;
47
use Koha::Token;
47
48
48
use constant ATTRIBUTE_SHOW_BARCODE => 'SHOW_BCODE';
49
use constant ATTRIBUTE_SHOW_BARCODE => 'SHOW_BCODE';
Lines 267-272 if ( $pending_checkouts->count ) { # Useless test Link Here
267
            $issue->{'description'} = $itemtypes->{$itemtype}->{'description'};
268
            $issue->{'description'} = $itemtypes->{$itemtype}->{'description'};
268
        }
269
        }
269
270
271
        if ( C4::Context->preference('OpacStarRatings') eq 'all' ) {
272
            my $ratings = Koha::Ratings->search({ biblionumber => $issue->{biblionumber} });
273
            $issue->{ratings} = $ratings;
274
            $issue->{my_rating} = $borrowernumber ? $ratings->search({ borrowernumber => $borrowernumber })->next : undef;
275
        }
276
270
        $issue->{biblio_object} = Koha::Biblios->find($issue->{biblionumber});
277
        $issue->{biblio_object} = Koha::Biblios->find($issue->{biblionumber});
271
        push @issuedat, $issue;
278
        push @issuedat, $issue;
272
        $count++;
279
        $count++;
273
- 

Return to bug 25110