Description:
fixed wrong url for announcement refresh when rail app runs on sub url
Commit status:
[Not Reviewed]
References:
Diff options:
Comments:
0 Commit comments
0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
r243:e7c40b8ab664 - - 2 files changed: 5 inserted, 2 deleted
@@ -11,27 +11,28 | |||
|
11 | 11 | = render :partial => 'announcement', :collection => @announcements |
|
12 | 12 | |
|
13 | 13 | - if Configuration.show_submitbox_to?(@user) |
|
14 | 14 | .submitbox |
|
15 | 15 | = error_messages_for 'submission' |
|
16 | 16 | = render :partial => 'submission_box' |
|
17 | 17 | |
|
18 | 18 | |
|
19 | 19 | %hr/ |
|
20 | 20 | |
|
21 | 21 | - if (Configuration.contest_mode?) and (@user.site!=nil) and (@user.site.started!=true) |
|
22 | 22 | %p=t 'main.start_soon' |
|
23 | 23 | |
|
24 | 24 | - if Configuration.show_tasks_to?(@user) |
|
25 | 25 | %table.info |
|
26 | 26 | %tr.info-head |
|
27 | 27 | %th |
|
28 | 28 | %th Tasks |
|
29 | 29 | %th # of sub(s) |
|
30 | 30 | %th Results |
|
31 | 31 | = render :partial => 'problem', :collection => @problems |
|
32 | 32 | |
|
33 | 33 | %hr/ |
|
34 | 34 | |
|
35 | - :javascript | |
|
35 | + %script{:type => 'text/javascript'} | |
|
36 | + = "Announcement.refreshUrl = '#{url_for :controller => 'main', :action => 'announcements'}';" | |
|
36 | 37 | Announcement.registerRefreshEventTimer(); |
|
37 | 38 |
@@ -1,38 +1,40 | |||
|
1 | 1 | |
|
2 | 2 | var Announcement = { |
|
3 | 3 | |
|
4 | 4 | mostRecentId: 0, |
|
5 | 5 | |
|
6 | + refreshUrl: '/main/announcements', | |
|
7 | + | |
|
6 | 8 | setMostRecentId: function(id) { |
|
7 | 9 | Announcement.mostRecentId = id; |
|
8 | 10 | }, |
|
9 | 11 | |
|
10 | 12 | updateRecentId: function(id) { |
|
11 | 13 | if(Announcement.mostRecentId < id) |
|
12 | 14 | Announcement.mostRecentId = id; |
|
13 | 15 | }, |
|
14 | 16 | |
|
15 | 17 | refreshAnnouncement: function() { |
|
16 |
- var url = |
|
|
18 | + var url = Announcement.refreshUrl; | |
|
17 | 19 | new Ajax.Request(url, { |
|
18 | 20 | method: 'get', |
|
19 | 21 | parameters: { recent: Announcement.mostRecentId }, |
|
20 | 22 | onSuccess: function(transport) { |
|
21 | 23 | if(transport.responseText.match(/\S/)!=null) { |
|
22 | 24 | var announcementBody = $("announcementbox-body"); |
|
23 | 25 | announcementBody.insert({ top: transport.responseText }); |
|
24 | 26 | var announcementBoxes = $$(".announcementbox"); |
|
25 | 27 | if(announcementBoxes.length!=0) |
|
26 | 28 | announcementBoxes[0].show(); |
|
27 | 29 | } |
|
28 | 30 | } |
|
29 | 31 | }); |
|
30 | 32 | Announcement.registerRefreshEventTimer(); |
|
31 | 33 | }, |
|
32 | 34 | |
|
33 | 35 | registerRefreshEventTimer: function() { |
|
34 | 36 | setTimeout(function () { |
|
35 | 37 | Announcement.refreshAnnouncement(); |
|
36 | 38 | }, 30000); |
|
37 | 39 | } |
|
38 | 40 | }; |
You need to be logged in to leave comments.
Login now