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: 95 inserted, 50 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 | 1 | source 'https://rubygems.org' |
|
2 | 2 | |
|
3 | 3 | gem 'rails', '3.2.21' |
|
4 | 4 | |
|
5 | + gem 'select2-rails' | |
|
6 | + | |
|
5 | 7 | # Bundle edge Rails instead: |
|
6 | 8 | # gem 'rails', :git => 'git://github.com/rails/rails.git' |
|
7 | 9 | |
|
8 | 10 | gem 'mysql2' |
|
9 | 11 | |
|
10 | 12 | # Gems used only for assets and not required |
@@ -132,12 +132,14 | |||
|
132 | 132 | rspec-mocks (~> 2.99.0) |
|
133 | 133 | sass (3.4.11) |
|
134 | 134 | sass-rails (3.2.6) |
|
135 | 135 | railties (~> 3.2.0) |
|
136 | 136 | sass (>= 3.1.10) |
|
137 | 137 | tilt (~> 1.3) |
|
138 | + select2-rails (4.0.1) | |
|
139 | + thor (~> 0.14) | |
|
138 | 140 | sprockets (2.2.3) |
|
139 | 141 | hike (~> 1.2) |
|
140 | 142 | multi_json (~> 1.0) |
|
141 | 143 | rack (~> 1.0) |
|
142 | 144 | tilt (~> 1.1, != 1.3.0) |
|
143 | 145 | test-unit (3.0.9) |
@@ -173,10 +175,11 | |||
|
173 | 175 | prototype-rails |
|
174 | 176 | rails (= 3.2.21) |
|
175 | 177 | rdiscount |
|
176 | 178 | rouge |
|
177 | 179 | rspec-rails (~> 2.99.0) |
|
178 | 180 | sass-rails (~> 3.2.6) |
|
181 | + select2-rails | |
|
179 | 182 | test-unit |
|
180 | 183 | uglifier |
|
181 | 184 | verification! |
|
182 | 185 | will_paginate (~> 3.0.7) |
@@ -7,12 +7,20 | |||
|
7 | 7 | // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the |
|
8 | 8 | // the compiled file. |
|
9 | 9 | // |
|
10 | 10 | // WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD |
|
11 | 11 | // GO AFTER THE REQUIRES BELOW. |
|
12 | 12 | // |
|
13 |
- //= require |
|
|
14 |
- //= require |
|
|
15 | - //= require effects | |
|
16 | - //= require dragdrop | |
|
17 | - //= require controls | |
|
13 | + //= require jquery | |
|
14 | + //= require jquery_ujs | |
|
15 | + //= require jquery.ui.all | |
|
18 | 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 | 8 | * You're free to add application-wide styles to this file and they'll appear at the bottom of the |
|
9 | 9 | * compiled file so the styles you add here take precedence over styles defined in any styles |
|
10 | 10 | * defined in the other CSS/SCSS files in this directory. It is generally better to create a new |
|
11 | 11 | * file per style scope. |
|
12 | 12 | * |
|
13 | - *= require_tree . | |
|
14 |
- *= require_ |
|
|
13 | + // bootstrap says that we should not do this, but @import each file instead | |
|
14 | + # *= require_tree . | |
|
15 | + # *= require_self | |
|
15 | 16 | */ |
|
16 | 17 | |
|
17 | - | |
|
18 | + @import jquery.ui.all | |
|
19 | + @import jquery.ui.core | |
|
18 | 20 | @import jquery.ui.core |
|
19 | 21 | @import jquery.ui.theme |
|
20 | 22 | @import jquery.ui.datepicker |
|
21 | 23 | @import jquery.ui.slider |
|
22 | 24 | @import jquery-ui-timepicker-addon |
|
23 | 25 | @import jquery-tablesorter/theme.metro-dark |
|
24 | 26 | @import tablesorter-theme.cafe |
|
25 | 27 | |
|
26 | - | |
|
27 |
- @import |
|
|
28 | - @import "bootstrap" | |
|
28 | + @import bootstrap-sprockets | |
|
29 | + @import bootstrap | |
|
30 | + @import select2 | |
|
31 | + @import select2-bootstrap | |
|
29 | 32 | |
|
30 | 33 | .secondnavbar |
|
31 | 34 | top: 50px |
|
32 | 35 | |
|
33 | 36 | body |
|
34 | 37 | background: white image-url("topbg.jpg") repeat-x top center |
|
35 |
- |
|
|
36 |
- |
|
|
38 | + //font-size: 13px | |
|
39 | + //font-family: Tahoma, "sans-serif" | |
|
37 | 40 | margin: 10px |
|
38 | 41 | padding: 10px |
|
39 | 42 | padding-top: 100px |
|
40 | 43 | |
|
41 | 44 | |
|
42 | 45 | input |
@@ -1,12 +1,19 | |||
|
1 | 1 | class ApplicationController < ActionController::Base |
|
2 | 2 | protect_from_forgery |
|
3 | 3 | |
|
4 | + before_filter :current_user | |
|
5 | + | |
|
4 | 6 | SINGLE_USER_MODE_CONF_KEY = 'system.single_user_mode' |
|
5 | 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 | 14 | def admin_authorization |
|
8 | 15 | return false unless authenticate |
|
9 | 16 | user = User.find(session[:user_id], :include => ['roles']) |
|
10 | 17 | unless user.admin? |
|
11 | 18 | flash[:notice] = 'You are not authorized to view the page you requested' |
|
12 | 19 | redirect_to :controller => 'main', :action => 'login' unless user.admin? |
@@ -12,20 +12,20 | |||
|
12 | 12 | left_menu << add_menu("#{I18n.t 'menu.test'}", 'test', 'index') |
|
13 | 13 | end |
|
14 | 14 | |
|
15 | 15 | if GraderConfiguration['right.user_hall_of_fame'] |
|
16 | 16 | left_menu << add_menu("#{I18n.t 'menu.hall_of_fame'}", 'report', 'problem_hof') |
|
17 | 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 | 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 | 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 | 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 | 28 | end |
|
29 | 29 | |
|
30 | 30 | def add_menu(title, controller, action,html_option = {}) |
|
31 | 31 | link_option = {controller: controller, action: action} |
@@ -6,25 +6,10 | |||
|
6 | 6 | = javascript_include_tag "application" |
|
7 | 7 | = csrf_meta_tags |
|
8 | 8 | = content_for :header |
|
9 | 9 | = yield :head |
|
10 | 10 | |
|
11 | 11 | %body |
|
12 | - %nav.navbar.navbar-default.navbar-fixed-top | |
|
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 | |
|
12 | + = render 'layouts/header' | |
|
27 | 13 | |
|
28 | 14 | = content_tag(:p,flash[:notice],:style => "color:green") if flash[:notice]!=nil |
|
29 | 15 | = yield |
|
30 | - |
@@ -19,20 +19,22 | |||
|
19 | 19 | |
|
20 | 20 | - if (GraderConfiguration.contest_mode?) and (@user.site!=nil) and (@user.site.started!=true) |
|
21 | 21 | %p=t 'main.start_soon' |
|
22 | 22 | |
|
23 | 23 | - if GraderConfiguration.show_tasks_to?(@user) |
|
24 | 24 | - if not GraderConfiguration.multicontests? |
|
25 | - %table.info | |
|
26 |
- %t |
|
|
27 | - %th | |
|
28 |
- %th |
|
|
29 |
- %th |
|
|
30 | - %th # of sub(s) | |
|
31 |
- %th |
|
|
32 | - = render :partial => 'problem', :collection => @problems | |
|
25 | + %table.table.table-striped | |
|
26 | + %thead | |
|
27 | + %tr.info-head | |
|
28 | + %th # | |
|
29 | + %th Tasks name | |
|
30 | + %th Full name | |
|
31 | + %th # of sub(s) | |
|
32 | + %th Results | |
|
33 | + %tbody | |
|
34 | + = render :partial => 'problem', :collection => @problems | |
|
33 | 35 | - else |
|
34 | 36 | - @contest_problems.each do |cp| |
|
35 | 37 | - if cp[:problems].length > 0 |
|
36 | 38 | %h2{:class =>'contest-title'} |
|
37 | 39 | = "#{cp[:contest] ? cp[:contest].title : 'Public problems'}" |
|
38 | 40 | %table.info |
deleted file |
You need to be logged in to leave comments.
Login now