Description:
Merge branch 'master' into codejom (announcement refresh bug fix)
Commit status:
[Not Reviewed]
References:
merge default
Comments:
0 Commit comments 0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
Add another comment

r244:72b95c87a51a - - 2 files changed: 5 inserted, 2 deleted

@@ -21,18 +21,19
21 21 = render :partial => 'problem_title', :collection => @problems, :as => :problem
22 22 .problem-content
23 23 %span{:id => "problem-panel-filler", :style => (@current_problem_id!=nil) ? "display:none" : ""}
24 24 %h2
25 25 Welcome to Code Jom
26 26 %br/
27 27 Choose problems from the list on the right.
28 28 = render :partial => 'problem', :collection => @problems
29 29
30 30 %br{:clear=>'both'}/
31 31 %hr/
32 32
33 - %script{:type => "text/javascript"}
33 + %script{:type => 'text/javascript'}
34 + = "Announcement.refreshUrl = '#{url_for :controller => 'main', :action => 'announcements'}';"
34 35 Announcement.registerRefreshEventTimer();
35 36 = render :partial => 'submission_timeouts'
36 37 CodejomTimeout.updateProblemMessages();
37 38 CodejomTimeout.registerRefreshEvent();
38 39
@@ -1,28 +1,30
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 = '/main/announcements';
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 }
You need to be logged in to leave comments. Login now