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 = render :partial => 'problem_title', :collection => @problems, :as => :problem
21 = render :partial => 'problem_title', :collection => @problems, :as => :problem
22 .problem-content
22 .problem-content
23 %span{:id => "problem-panel-filler", :style => (@current_problem_id!=nil) ? "display:none" : ""}
23 %span{:id => "problem-panel-filler", :style => (@current_problem_id!=nil) ? "display:none" : ""}
24 %h2
24 %h2
25 Welcome to Code Jom
25 Welcome to Code Jom
26 %br/
26 %br/
27 Choose problems from the list on the right.
27 Choose problems from the list on the right.
28 = render :partial => 'problem', :collection => @problems
28 = render :partial => 'problem', :collection => @problems
29
29
30 %br{:clear=>'both'}/
30 %br{:clear=>'both'}/
31 %hr/
31 %hr/
32
32
33 - %script{:type => "text/javascript"}
33 + %script{:type => 'text/javascript'}
34 + = "Announcement.refreshUrl = '#{url_for :controller => 'main', :action => 'announcements'}';"
34 Announcement.registerRefreshEventTimer();
35 Announcement.registerRefreshEventTimer();
35 = render :partial => 'submission_timeouts'
36 = render :partial => 'submission_timeouts'
36 CodejomTimeout.updateProblemMessages();
37 CodejomTimeout.updateProblemMessages();
37 CodejomTimeout.registerRefreshEvent();
38 CodejomTimeout.registerRefreshEvent();
38
39
@@ -1,28 +1,30
1
1
2 var Announcement = {
2 var Announcement = {
3
3
4 mostRecentId: 0,
4 mostRecentId: 0,
5
5
6 + refreshUrl: '/main/announcements',
7 +
6 setMostRecentId: function(id) {
8 setMostRecentId: function(id) {
7 Announcement.mostRecentId = id;
9 Announcement.mostRecentId = id;
8 },
10 },
9
11
10 updateRecentId: function(id) {
12 updateRecentId: function(id) {
11 if(Announcement.mostRecentId < id)
13 if(Announcement.mostRecentId < id)
12 Announcement.mostRecentId = id;
14 Announcement.mostRecentId = id;
13 },
15 },
14
16
15 refreshAnnouncement: function() {
17 refreshAnnouncement: function() {
16 - var url = '/main/announcements';
18 + var url = Announcement.refreshUrl;
17 new Ajax.Request(url, {
19 new Ajax.Request(url, {
18 method: 'get',
20 method: 'get',
19 parameters: { recent: Announcement.mostRecentId },
21 parameters: { recent: Announcement.mostRecentId },
20 onSuccess: function(transport) {
22 onSuccess: function(transport) {
21 if(transport.responseText.match(/\S/)!=null) {
23 if(transport.responseText.match(/\S/)!=null) {
22 var announcementBody = $("announcementbox-body");
24 var announcementBody = $("announcementbox-body");
23 announcementBody.insert({ top: transport.responseText });
25 announcementBody.insert({ top: transport.responseText });
24 var announcementBoxes = $$(".announcementbox");
26 var announcementBoxes = $$(".announcementbox");
25 if(announcementBoxes.length!=0)
27 if(announcementBoxes.length!=0)
26 announcementBoxes[0].show();
28 announcementBoxes[0].show();
27 }
29 }
28 }
30 }
You need to be logged in to leave comments. Login now