Description:
use jquery by default
Commit status:
[Not Reviewed]
References:
Diff options:
Comments:
0 Commit comments
0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
r554:50143f71e61a - - 12 files changed: 89 inserted, 44 deleted
@@ -0,0 +1,35 | |||||
|
|
1 | + %header.navbar.navbar-default.navbar-fixed-top | ||
|
|
2 | + %nav | ||
|
|
3 | + .container-fluid | ||
|
|
4 | + .navbar-header | ||
|
|
5 | + %a.navbar-brand{href: main_list_path} หน้าหลัก | ||
|
|
6 | + .collapse.navbar-collapse | ||
|
|
7 | + %ul.nav.navbar-nav | ||
|
|
8 | + - if (@current_user!=nil) and (GraderConfiguration.show_tasks_to?(@current_user)) | ||
|
|
9 | + = add_menu("#{I18n.t 'menu.tasks'}", 'tasks', 'list') | ||
|
|
10 | + = add_menu("#{I18n.t 'menu.submissions'}", 'main', 'submission') | ||
|
|
11 | + = add_menu("#{I18n.t 'menu.test'}", 'test', 'index') | ||
|
|
12 | + - if GraderConfiguration['right.user_hall_of_fame'] | ||
|
|
13 | + = add_menu("#{I18n.t 'menu.hall_of_fame'}", 'report', 'problem_hof') | ||
|
|
14 | + %ul.nav.navbar-nav.navbar-right | ||
|
|
15 | + = add_menu("#{content_tag(:span,'',class: 'glyphicon glyphicon-question-sign')}".html_safe, 'main', 'help') | ||
|
|
16 | + = add_menu("#{content_tag(:span,'',class: 'glyphicon glyphicon-comment')}".html_safe, 'messages', 'list', {title: I18n.t('menu.messages'), data: {toggle: 'tooltip'}}) | ||
|
|
17 | + - if GraderConfiguration['system.user_setting_enabled'] | ||
|
|
18 | + = add_menu("#{content_tag(:span,'',class: 'glyphicon glyphicon-cog')}".html_safe, 'users', 'index', {title: I18n.t('menu.settings'), data: {toggle: 'tooltip'}}) | ||
|
|
19 | + = add_menu("#{content_tag(:span,'',class: 'glyphicon glyphicon-log-out')} #{@current_user.full_name}".html_safe, 'main', 'login', {title: I18n.t('menu.log_out'), data: {toggle: 'tooltip'}}) | ||
|
|
20 | + | ||
|
|
21 | + - if (@current_user!=nil) and (session[:admin]) | ||
|
|
22 | + %nav.navbar.navbar-default.navbar-fixed-top.navbar-inverse.secondnavbar | ||
|
|
23 | + .container-fluid | ||
|
|
24 | + .collapse.navbar-collapse | ||
|
|
25 | + %ul.nav.navbar-nav | ||
|
|
26 | + = add_menu( '[Announcements]', 'announcements', 'index') | ||
|
|
27 | + = add_menu( '[Msg console]', 'messages', 'console') | ||
|
|
28 | + = add_menu( '[Problems]', 'problems', 'index') | ||
|
|
29 | + = add_menu( '[Users]', 'user_admin', 'index') | ||
|
|
30 | + = add_menu( '[Results]', 'user_admin', 'user_stat') | ||
|
|
31 | + = add_menu( '[Report]', 'report', 'multiple_login') | ||
|
|
32 | + = add_menu( '[Graders]', 'graders', 'list') | ||
|
|
33 | + = add_menu( '[Contests]', 'contest_management', 'index') | ||
|
|
34 | + = add_menu( '[Sites]', 'sites', 'index') | ||
|
|
35 | + = add_menu( '[System config]', 'configurations', 'index') |
@@ -0,0 +1,6 | |||||
|
|
1 | + = form_tag({:action => 'submit'}, :multipart => true) do | ||
|
|
2 | + %b Problem: | ||
|
|
3 | + = select 'submission', 'problem_id', [[(t 'main.specified_in_header'),'-1']] + @problems.collect {|p| [p.full_name, p.id]}, {:selected => '-1'}, { class: 'select2' } | ||
|
|
4 | + %b File: | ||
|
|
5 | + = file_field_tag 'file' | ||
|
|
6 | + = submit_tag 'Submit' |
@@ -1,10 +1,12 | |||||
|
1 | source 'https://rubygems.org' |
|
1 | source 'https://rubygems.org' |
|
2 |
|
2 | ||
|
3 | gem 'rails', '3.2.21' |
|
3 | gem 'rails', '3.2.21' |
|
4 |
|
4 | ||
|
|
5 | + gem 'select2-rails' | ||
|
|
6 | + | ||
|
5 | # Bundle edge Rails instead: |
|
7 | # Bundle edge Rails instead: |
|
6 | # gem 'rails', :git => 'git://github.com/rails/rails.git' |
|
8 | # gem 'rails', :git => 'git://github.com/rails/rails.git' |
|
7 |
|
9 | ||
|
8 | gem 'mysql2' |
|
10 | gem 'mysql2' |
|
9 |
|
11 | ||
|
10 | # Gems used only for assets and not required |
|
12 | # Gems used only for assets and not required |
@@ -132,12 +132,14 | |||||
|
132 | rspec-mocks (~> 2.99.0) |
|
132 | rspec-mocks (~> 2.99.0) |
|
133 | sass (3.4.11) |
|
133 | sass (3.4.11) |
|
134 | sass-rails (3.2.6) |
|
134 | sass-rails (3.2.6) |
|
135 | railties (~> 3.2.0) |
|
135 | railties (~> 3.2.0) |
|
136 | sass (>= 3.1.10) |
|
136 | sass (>= 3.1.10) |
|
137 | tilt (~> 1.3) |
|
137 | tilt (~> 1.3) |
|
|
138 | + select2-rails (4.0.1) | ||
|
|
139 | + thor (~> 0.14) | ||
|
138 | sprockets (2.2.3) |
|
140 | sprockets (2.2.3) |
|
139 | hike (~> 1.2) |
|
141 | hike (~> 1.2) |
|
140 | multi_json (~> 1.0) |
|
142 | multi_json (~> 1.0) |
|
141 | rack (~> 1.0) |
|
143 | rack (~> 1.0) |
|
142 | tilt (~> 1.1, != 1.3.0) |
|
144 | tilt (~> 1.1, != 1.3.0) |
|
143 | test-unit (3.0.9) |
|
145 | test-unit (3.0.9) |
@@ -173,10 +175,11 | |||||
|
173 | prototype-rails |
|
175 | prototype-rails |
|
174 | rails (= 3.2.21) |
|
176 | rails (= 3.2.21) |
|
175 | rdiscount |
|
177 | rdiscount |
|
176 | rouge |
|
178 | rouge |
|
177 | rspec-rails (~> 2.99.0) |
|
179 | rspec-rails (~> 2.99.0) |
|
178 | sass-rails (~> 3.2.6) |
|
180 | sass-rails (~> 3.2.6) |
|
|
181 | + select2-rails | ||
|
179 | test-unit |
|
182 | test-unit |
|
180 | uglifier |
|
183 | uglifier |
|
181 | verification! |
|
184 | verification! |
|
182 | will_paginate (~> 3.0.7) |
|
185 | will_paginate (~> 3.0.7) |
@@ -7,12 +7,20 | |||||
|
7 | // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the |
|
7 | // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the |
|
8 | // the compiled file. |
|
8 | // the compiled file. |
|
9 | // |
|
9 | // |
|
10 | // WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD |
|
10 | // WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD |
|
11 | // GO AFTER THE REQUIRES BELOW. |
|
11 | // GO AFTER THE REQUIRES BELOW. |
|
12 | // |
|
12 | // |
|
13 |
- //= require |
|
13 | + //= require jquery |
|
14 |
- //= require |
|
14 | + //= require jquery_ujs |
|
15 | - //= require effects |
|
15 | + //= require jquery.ui.all |
|
16 | - //= require dragdrop |
|
||
|
17 | - //= require controls |
|
||
|
18 | //= require bootstrap-sprockets |
|
16 | //= require bootstrap-sprockets |
|
|
17 | + //= require custom | ||
|
|
18 | + //= require select2 | ||
|
|
19 | + | ||
|
|
20 | + | ||
|
|
21 | + // since this is after blank line, it is not downloaded | ||
|
|
22 | + //x= require prototype | ||
|
|
23 | + //x= require prototype_ujs | ||
|
|
24 | + //x= require effects | ||
|
|
25 | + //x= require dragdrop | ||
|
|
26 | + //x= require controls |
@@ -7,36 +7,39 | |||||
|
7 | * |
|
7 | * |
|
8 | * You're free to add application-wide styles to this file and they'll appear at the bottom of the |
|
8 | * You're free to add application-wide styles to this file and they'll appear at the bottom of the |
|
9 | * compiled file so the styles you add here take precedence over styles defined in any styles |
|
9 | * compiled file so the styles you add here take precedence over styles defined in any styles |
|
10 | * defined in the other CSS/SCSS files in this directory. It is generally better to create a new |
|
10 | * defined in the other CSS/SCSS files in this directory. It is generally better to create a new |
|
11 | * file per style scope. |
|
11 | * file per style scope. |
|
12 | * |
|
12 | * |
|
13 | - *= require_tree . |
|
13 | + // bootstrap says that we should not do this, but @import each file instead |
|
14 |
- *= require_ |
|
14 | + # *= require_tree . |
|
|
15 | + # *= require_self | ||
|
15 | */ |
|
16 | */ |
|
16 |
|
17 | ||
|
17 | - |
|
18 | + @import jquery.ui.all |
|
|
19 | + @import jquery.ui.core | ||
|
18 | @import jquery.ui.core |
|
20 | @import jquery.ui.core |
|
19 | @import jquery.ui.theme |
|
21 | @import jquery.ui.theme |
|
20 | @import jquery.ui.datepicker |
|
22 | @import jquery.ui.datepicker |
|
21 | @import jquery.ui.slider |
|
23 | @import jquery.ui.slider |
|
22 | @import jquery-ui-timepicker-addon |
|
24 | @import jquery-ui-timepicker-addon |
|
23 | @import jquery-tablesorter/theme.metro-dark |
|
25 | @import jquery-tablesorter/theme.metro-dark |
|
24 | @import tablesorter-theme.cafe |
|
26 | @import tablesorter-theme.cafe |
|
25 |
|
27 | ||
|
26 | - |
|
28 | + @import bootstrap-sprockets |
|
27 |
- @import |
|
29 | + @import bootstrap |
|
28 | - @import "bootstrap" |
|
30 | + @import select2 |
|
|
31 | + @import select2-bootstrap | ||
|
29 |
|
32 | ||
|
30 | .secondnavbar |
|
33 | .secondnavbar |
|
31 | top: 50px |
|
34 | top: 50px |
|
32 |
|
35 | ||
|
33 | body |
|
36 | body |
|
34 | background: white image-url("topbg.jpg") repeat-x top center |
|
37 | background: white image-url("topbg.jpg") repeat-x top center |
|
35 |
- |
|
38 | + //font-size: 13px |
|
36 |
- |
|
39 | + //font-family: Tahoma, "sans-serif" |
|
37 | margin: 10px |
|
40 | margin: 10px |
|
38 | padding: 10px |
|
41 | padding: 10px |
|
39 | padding-top: 100px |
|
42 | padding-top: 100px |
|
40 |
|
43 | ||
|
41 |
|
44 | ||
|
42 | input |
|
45 | input |
@@ -1,12 +1,19 | |||||
|
1 | class ApplicationController < ActionController::Base |
|
1 | class ApplicationController < ActionController::Base |
|
2 | protect_from_forgery |
|
2 | protect_from_forgery |
|
3 |
|
3 | ||
|
|
4 | + before_filter :current_user | ||
|
|
5 | + | ||
|
4 | SINGLE_USER_MODE_CONF_KEY = 'system.single_user_mode' |
|
6 | SINGLE_USER_MODE_CONF_KEY = 'system.single_user_mode' |
|
5 | MULTIPLE_IP_LOGIN_CONF_KEY = 'right.multiple_ip_login' |
|
7 | MULTIPLE_IP_LOGIN_CONF_KEY = 'right.multiple_ip_login' |
|
6 |
|
8 | ||
|
|
9 | + # Returns the current logged-in user (if any). | ||
|
|
10 | + def current_user | ||
|
|
11 | + @current_user ||= User.find(session[:user_id]) | ||
|
|
12 | + end | ||
|
|
13 | + | ||
|
7 | def admin_authorization |
|
14 | def admin_authorization |
|
8 | return false unless authenticate |
|
15 | return false unless authenticate |
|
9 | user = User.find(session[:user_id], :include => ['roles']) |
|
16 | user = User.find(session[:user_id], :include => ['roles']) |
|
10 | unless user.admin? |
|
17 | unless user.admin? |
|
11 | flash[:notice] = 'You are not authorized to view the page you requested' |
|
18 | flash[:notice] = 'You are not authorized to view the page you requested' |
|
12 | redirect_to :controller => 'main', :action => 'login' unless user.admin? |
|
19 | redirect_to :controller => 'main', :action => 'login' unless user.admin? |
@@ -12,20 +12,20 | |||||
|
12 | left_menu << add_menu("#{I18n.t 'menu.test'}", 'test', 'index') |
|
12 | left_menu << add_menu("#{I18n.t 'menu.test'}", 'test', 'index') |
|
13 | end |
|
13 | end |
|
14 |
|
14 | ||
|
15 | if GraderConfiguration['right.user_hall_of_fame'] |
|
15 | if GraderConfiguration['right.user_hall_of_fame'] |
|
16 | left_menu << add_menu("#{I18n.t 'menu.hall_of_fame'}", 'report', 'problem_hof') |
|
16 | left_menu << add_menu("#{I18n.t 'menu.hall_of_fame'}", 'report', 'problem_hof') |
|
17 | end |
|
17 | end |
|
18 | - left_menu << add_menu("#{I18n.t 'menu.help'}", 'main', 'help') |
|
||
|
19 | - |
|
||
|
20 |
|
18 | ||
|
21 |
- right_menu << add_menu("#{content_tag(:span,'',class: 'glyphicon glyphicon- |
|
19 | + right_menu << add_menu("#{content_tag(:span,'',class: 'glyphicon glyphicon-question-sign')}".html_safe, 'main', 'help') |
|
|
20 | + right_menu << add_menu("#{content_tag(:span,'',class: 'glyphicon glyphicon-comment')}".html_safe, 'messages', 'list', {title: I18n.t('menu.messages'), data: {toggle: 'tooltip'}}) | ||
|
22 | if GraderConfiguration['system.user_setting_enabled'] |
|
21 | if GraderConfiguration['system.user_setting_enabled'] |
|
23 |
- right_menu << add_menu("#{content_tag(:span,'',class: 'glyphicon glyphicon-cog')} |
|
22 | + right_menu << add_menu("#{content_tag(:span,'',class: 'glyphicon glyphicon-cog')}".html_safe, 'users', 'index', {title: I18n.t('menu.settings'), data: {toggle: 'tooltip'}}) |
|
24 | end |
|
23 | end |
|
25 |
- right_menu << add_menu("#{content_tag(:span,'',class: 'glyphicon glyphicon-log-out')} #{ |
|
24 | + right_menu << add_menu("#{content_tag(:span,'',class: 'glyphicon glyphicon-log-out')} #{user.full_name}".html_safe, 'main', 'login', {title: I18n.t('menu.log_out'), data: {toggle: 'tooltip'}}) |
|
|
25 | + | ||
|
26 |
|
26 | ||
|
27 | result = content_tag(:ul,left_menu.html_safe,class: 'nav navbar-nav') + content_tag(:ul,right_menu.html_safe,class: 'nav navbar-nav navbar-right') |
|
27 | result = content_tag(:ul,left_menu.html_safe,class: 'nav navbar-nav') + content_tag(:ul,right_menu.html_safe,class: 'nav navbar-nav navbar-right') |
|
28 | end |
|
28 | end |
|
29 |
|
29 | ||
|
30 | def add_menu(title, controller, action,html_option = {}) |
|
30 | def add_menu(title, controller, action,html_option = {}) |
|
31 | link_option = {controller: controller, action: action} |
|
31 | link_option = {controller: controller, action: action} |
@@ -6,25 +6,10 | |||||
|
6 | = javascript_include_tag "application" |
|
6 | = javascript_include_tag "application" |
|
7 | = csrf_meta_tags |
|
7 | = csrf_meta_tags |
|
8 | = content_for :header |
|
8 | = content_for :header |
|
9 | = yield :head |
|
9 | = yield :head |
|
10 |
|
10 | ||
|
11 | %body |
|
11 | %body |
|
12 | - %nav.navbar.navbar-default.navbar-fixed-top |
|
12 | + = render 'layouts/header' |
|
13 | - .container-fluid |
|
||
|
14 | - .navbar-header |
|
||
|
15 | - %a.navbar-brand{href: main_list_path} หน้าหลัก |
|
||
|
16 | - .collapse.navbar-collapse |
|
||
|
17 | - = navbar_user_header #call helper function |
|
||
|
18 | - %nav.navbar.navbar-default.navbar-fixed-top.navbar-inverse.secondnavbar |
|
||
|
19 | - .container-fluid |
|
||
|
20 | - .collapse.navbar-collapse |
|
||
|
21 | - %ul.nav.navbar-nav |
|
||
|
22 | - %li |
|
||
|
23 | - %a{href:'#'}hahaha |
|
||
|
24 | - |
|
||
|
25 | - %div.userbar |
|
||
|
26 | - = user_header |
|
||
|
27 |
|
13 | ||
|
28 | = content_tag(:p,flash[:notice],:style => "color:green") if flash[:notice]!=nil |
|
14 | = content_tag(:p,flash[:notice],:style => "color:green") if flash[:notice]!=nil |
|
29 | = yield |
|
15 | = yield |
|
30 | - |
|
@@ -19,19 +19,21 | |||||
|
19 |
|
19 | ||
|
20 | - if (GraderConfiguration.contest_mode?) and (@user.site!=nil) and (@user.site.started!=true) |
|
20 | - if (GraderConfiguration.contest_mode?) and (@user.site!=nil) and (@user.site.started!=true) |
|
21 | %p=t 'main.start_soon' |
|
21 | %p=t 'main.start_soon' |
|
22 |
|
22 | ||
|
23 | - if GraderConfiguration.show_tasks_to?(@user) |
|
23 | - if GraderConfiguration.show_tasks_to?(@user) |
|
24 | - if not GraderConfiguration.multicontests? |
|
24 | - if not GraderConfiguration.multicontests? |
|
25 | - %table.info |
|
25 | + %table.table.table-striped |
|
|
26 | + %thead | ||
|
26 | %tr.info-head |
|
27 | %tr.info-head |
|
27 | - %th |
|
28 | + %th # |
|
28 | %th Tasks name |
|
29 | %th Tasks name |
|
29 | %th Full name |
|
30 | %th Full name |
|
30 | %th # of sub(s) |
|
31 | %th # of sub(s) |
|
31 | %th Results |
|
32 | %th Results |
|
|
33 | + %tbody | ||
|
32 | = render :partial => 'problem', :collection => @problems |
|
34 | = render :partial => 'problem', :collection => @problems |
|
33 | - else |
|
35 | - else |
|
34 | - @contest_problems.each do |cp| |
|
36 | - @contest_problems.each do |cp| |
|
35 | - if cp[:problems].length > 0 |
|
37 | - if cp[:problems].length > 0 |
|
36 | %h2{:class =>'contest-title'} |
|
38 | %h2{:class =>'contest-title'} |
|
37 | = "#{cp[:contest] ? cp[:contest].title : 'Public problems'}" |
|
39 | = "#{cp[:contest] ? cp[:contest].title : 'Public problems'}" |
deleted file |
You need to be logged in to leave comments.
Login now