diff --git a/app/controllers/user_admin_controller.rb b/app/controllers/user_admin_controller.rb
--- a/app/controllers/user_admin_controller.rb
+++ b/app/controllers/user_admin_controller.rb
@@ -16,6 +16,16 @@
@hidden_columns = ['hashed_password', 'salt', 'created_at', 'updated_at']
end
+ def active
+ sessions = ActiveRecord::SessionStore::Session.find(:all, :conditions => ["updated_at >= ?", 60.minutes.ago])
+ @users = []
+ sessions.each do |session|
+ if session.data[:user_id]
+ @users << User.find(session.data[:user_id])
+ end
+ end
+ end
+
def show
@user = User.find(params[:id])
end
diff --git a/app/models/user.rb b/app/models/user.rb
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -125,6 +125,9 @@
begin
if self.site==nil
self.site = Site.find_by_name('default')
+ if self.site==nil
+ self.site = Site.find(1) # when 'default has be renamed'
+ end
end
rescue
end
diff --git a/app/views/main/login.html.haml b/app/views/main/login.html.haml
--- a/app/views/main/login.html.haml
+++ b/app/views/main/login.html.haml
@@ -19,7 +19,7 @@
%b= flash[:notice]
%hr/
- %div{ :style => "border: solid 1px gray; padding: 2px; background: #f0f0f0;"}
+ %div{ :style => "border: solid 1px gray; padding: 4px; background: #eeeeff;"}
- form_tag :controller => 'login', :action => 'login' do
%table
%tr
diff --git a/app/views/test/_test_request.html.haml b/app/views/test/_test_request.html.haml
--- a/app/views/test/_test_request.html.haml
+++ b/app/views/test/_test_request.html.haml
@@ -7,7 +7,10 @@
- else
(n/a)
%td{:align => "center"}
- = test_request.submission.number
+ - if test_request.submission
+ = test_request.submission.number
+ - else
+ n/a
%td{:align => "center"}
= test_request.status_str
%td{:align => "center"}
diff --git a/app/views/user_admin/active.html.haml b/app/views/user_admin/active.html.haml
new file mode 100644
--- /dev/null
+++ b/app/views/user_admin/active.html.haml
@@ -0,0 +1,19 @@
+%h1 Active users
+
+%i
+ I.e., those users that interacts with the system with in the last 60 minutes.
+%br/
+
+= link_to '[go back to index]', :action => 'index'
+
+%table
+ %tr
+ %th #
+ %th login
+ %th full name
+ - counter = 0
+ - for user in @users
+ %tr
+ %td= counter += 1
+ %td= user.login
+ %td= user.full_name
diff --git a/app/views/user_admin/list.rhtml b/app/views/user_admin/list.rhtml
--- a/app/views/user_admin/list.rhtml
+++ b/app/views/user_admin/list.rhtml
@@ -25,8 +25,14 @@
<% form_tag({:action => 'import'}, :multipart => true) do %>
File: <%= file_field_tag 'file' %> <%= submit_tag 'Import' %>
<% end %>
+
+What else:
+<%= link_to '[New user]', :action => 'new' %>
+<%= link_to '[New list of users]', :action => 'new_list' %>
+<%= link_to '[View active users]', :action => 'active' %>
+
<% for column in User.content_columns %>
diff --git a/config/locales/th.rb b/config/locales/th.rb
--- a/config/locales/th.rb
+++ b/config/locales/th.rb
@@ -1,3 +1,7 @@
+# Thai translation for Ruby on Rails
+# original by Prem Sichanugrist (s@sikachu.com/sikandsak@gmail.com)
+# activerecord keys fixed by Jittat Fakcharoenphol (jittat@gmail.com)
+
{
:'th' => {
:date => {
@@ -66,6 +70,22 @@
:format => '%n %u'
}
},
+ :human => {
+ :format => {
+ :precision => 1,
+ :delimiter => ''
+ },
+ :storage_units => {
+ :format => "%n %u",
+ :units => {
+ :byte => "B",
+ :kb => "KB",
+ :mb => "MB",
+ :gb => "GB",
+ :tb => "TB",
+ }
+ }
+ },
},
# Active Record
diff --git a/db/migrate/20081215012843_change_user_login_string_limit.rb b/db/migrate/20081215012843_change_user_login_string_limit.rb
--- a/db/migrate/20081215012843_change_user_login_string_limit.rb
+++ b/db/migrate/20081215012843_change_user_login_string_limit.rb
@@ -4,6 +4,6 @@
end
def self.down
- execute "ALTER TABLE `users` CHANGE `login` `login` VARCHAR( 10 )"
+ # don't have to revert
end
end
diff --git a/public/stylesheets/application.css b/public/stylesheets/application.css
--- a/public/stylesheets/application.css
+++ b/public/stylesheets/application.css
@@ -1,31 +1,66 @@
-/* Normal text */
+/* Main Default */
body {
+ background: white url(../images/topbg.jpg) repeat-x top center;
font-size: 13px;
- font-family: "Sans Serif";
+ font-family: Tahoma, "sans-serif";
+ margin: 10px;
+ padding: 10px;
+}
+
+/* Form Font */
+input {
+ font-family: Tahoma, "sans-serif";
+}
+
+/* Heading 1/2 */
+h1 {
+ font-size: 24px;
+ color: #334488;
+ line-height: 2em;
+}
+
+h2 {
+ font-size: 18px;
+ color: #5566bb;
+ line-height: 1.5em;
+}
+
+/* Bar Line Color and Thickness */
+hr {
+ border-top: 1px solid #dddddd;
+ border-bottom: 1px solid #eeeeee;
+}
+
+/* Link + Anchor Color */
+a, a:link, a:visited {
+ color: #6666cc;
+ text-decoration: none;
+}
+
+a:hover, a:focus {
+ color: #111166;
+ text-decoration: none;
}
/* This is the main menu bad*/
div.userbar {
- border-top: thin solid grey;
- border-bottom: thin solid grey;
+ line-height: 1.5em;
text-align: right;
font-size: 12px;
}
/* This is the top bar, displaying user's full name */
div.title {
- font-size: 12px;
- background: #ddffdd;
- border: 1px solid black;
- padding: 2px;
- margin-top: 3px;
- margin-bottom: 5px;
+ // background: #ddddff;
+ // border: 1px dashed blue;
+ padding: 10px 0px;
+ line-height: 1.5em;
+ font-size: 13px;
}
div.title span.contest-over-msg {
font-size: 15px;
color: red;
- font-weight: bold;
}
div.title table {
@@ -35,27 +70,36 @@
div.title td.left-col {
text-align: left;
vertical-align: top;
+ color: #444444;
}
div.title td.right-col {
text-align: right;
vertical-align: top;
+ font-size: 14px;
+ font-weight: bold;
+ color: #116699;
}
/* Standard table with header and rows with alternating background */
table.info {
- border: 1px solid black;
+ margin: 10px 0;
+ border: 1px solid #666666;
border-collapse: collapse;
font-size: 12px;
}
table.info th {
- border: 1px solid black;
+ border: 1px solid #666666;
+ line-height: 1.5em;
+ padding: 0 0.5em;
}
table.info td {
- border-left: 1px solid black;
- border-right: 1px solid black;
+ border-left: 1px solid #666666;
+ border-right: 1px solid #666666;
+ line-height: 1.5em;
+ padding: 0 0.5em;
}
tr.info-head {
@@ -64,29 +108,30 @@
}
tr.info-odd {
- background: #dddddd;
+ background: #eeeeee;
}
tr.info-even {
- background: #f0f0f0;
+ background: #f9f9f9;
}
/*******************************
[Main]
********************************/
div.submitbox {
- border: thin solid black;
+ background: #eeeeff;
+ border: 1px dotted #99aaee;
padding: 5px;
- color: white;
- background-color: #777777;
+ margin: 10px 0px;
+ color: black;
font-weight: bold;
font-size: 13px;
}
div.errorExplanation {
- border: 1px dashed black;
- color: black;
- padding: 5px;
+ border: 1px dotted gray;
+ color: #bb2222;
+ padding: 5px 15px 5px 15px;
margin-bottom: 5px;
background-color: white;
}
@@ -124,9 +169,10 @@
div.task-menu {
text-align: center;
font-size: 13px;
+ line-height: 1.75em;
font-weight: bold;
- border-top: 1px solid black;
- border-bottom: 1px solid black;
+ border-top: 1px dashed gray;
+ border-bottom: 1px dashed gray;
margin-top: 2px;
margin-bottom: 4px;
}
@@ -135,9 +181,10 @@
[Submission]
********************************/
table.taskdesc {
- border: 1px solid black;
+ border: 2px solid #dddddd;
border-collapse: collapse;
- width: 95%;
+ margin: 10px auto;
+ width: 90%;
font-size: 13px;
}
@@ -146,11 +193,12 @@
}
table.taskdesc tr.name {
- border: 1px solid black;
- background: #aaaaaa;
- color: white;
+ border: 2px solid #dddddd;
+ background: #dddddd;
+ color: #333333;
font-weight: bold;
font-size: 14px;
+ line-height: 1.5em;
text-align: center;
}
@@ -167,20 +215,20 @@
}
/**********************
- [Announcement]
+ Announcement
***********************/
div.announcementbox {
- margin-top: 10px;
- margin-bottom: 10px;
- background: green;
+ margin: 10px 0px;
+ background: #bbddee;
padding: 1px;
}
div.announcementbox span.title {
font-weight: bold;
- color: white;
+ color: #224455;
padding-left: 10px;
+ line-height: 1.6em;
}
div.announcement {
@@ -202,30 +250,44 @@
}
/******************
- [Messages
+ Messages
******************/
div.message {
- padding-top: 5px;
- padding-left: 10px;
+ margin: 10px 0 0;
+}
+
+div.message div.message {
+ margin: 0 0 0 30px;
}
div.message div.body {
- border: 1px solid green;
- background: #eeffee;
+ border: 2px solid #dddddd;
+ background: #fff8f8;
padding-left: 5px;
}
div.message div.reply-body {
- border: 1px solid black;
- background: #ffeeee;
+ border: 2px solid #bbbbbb;
+ background: #fffff8;
padding-left: 5px;
}
div.message div.stat {
font-size: 10px;
- color: white;
- background: green;
+ line-height: 1.75em;
+ padding: 0 5px;
+ color: #333333;
+ background: #dddddd;
+ font-weight: bold;
+}
+
+div.message div.message div.stat {
+ font-size: 10px;
+ line-height: 1.75em;
+ padding: 0 5px;
+ color: #444444;
+ background: #bbbbbb;
font-weight: bold;
}
@@ -234,17 +296,17 @@
********************/
div.contest-title {
color: white;
- background: #007700;
text-align: center;
- padding: 5px;
+ line-height: 2em;
}
div.registration-desc {
- margin-top: 5px;
- margin-bottom: 5px;
- border: solid 1px gray;
- padding: 10px;
- background: #f0f0f0;
+ border: 1px dotted gray;
+ background: #f5f5f5;
+ padding: 5px;
+ margin: 10px 0;
+ font-size: 12px;
+ line-height: 1.5em;
}
/********************
@@ -252,9 +314,10 @@
********************/
div.test-desc {
- border: solid 1px gray;
- background: #f0f0f0;
+ border: 1px dotted gray;
+ background: #f5f5f5;
padding: 5px;
+ margin: 10px 0;
font-size: 12px;
- margin-bottom: 5px;
+ line-height: 1.5em;
}