Skip to content

Commit

Permalink
Merge branch 'release/1.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
bmesuere committed Sep 28, 2016
2 parents 03579db + d899510 commit c604464
Show file tree
Hide file tree
Showing 39 changed files with 209 additions and 133 deletions.
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ gem 'autoprefixer-rails'
# cas authentication
gem 'devise'
gem 'devise_cas_authenticatable'
gem 'rubycas-client', git: 'https://github.com/bmesuere/rubycas-client.git'

# authorization
gem 'pundit'
Expand Down
40 changes: 23 additions & 17 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
GIT
remote: git://github.com/sinatra/sinatra.git
revision: 1b0edc0aeaaf4839cadfcec1b21da86e6af1d4c0
revision: af6dad2a6c31e31617712b15f455b2a3d3eb1c06
specs:
rack-protection (2.0.0.beta2)
rack
Expand All @@ -10,10 +10,17 @@ GIT
rack-protection (= 2.0.0.beta2)
tilt (~> 2.0)

GIT
remote: https://github.com/bmesuere/rubycas-client.git
revision: 7e102b4a0a910ab000058268c0b1f27ece9c9070
specs:
rubycas-client (2.3.10.rc1)
activesupport

GEM
remote: https://rubygems.org/
specs:
ace-rails-ap (4.1.0)
ace-rails-ap (4.1.1)
actioncable (5.0.0.1)
actionpack (= 5.0.0.1)
nio4r (~> 1.2)
Expand Down Expand Up @@ -52,14 +59,14 @@ GEM
minitest (~> 5.1)
tzinfo (~> 1.1)
addressable (2.3.8)
airbrussh (1.1.0)
airbrussh (1.1.1)
sshkit (>= 1.6.1, != 1.7.0)
annotate (2.7.1)
activerecord (>= 3.2, < 6.0)
rake (>= 10.4, < 12.0)
arel (7.1.1)
arel (7.1.2)
ast (2.3.0)
autoprefixer-rails (6.4.0.3)
autoprefixer-rails (6.4.1.1)
execjs
bcrypt (3.1.11)
builder (3.2.2)
Expand All @@ -76,7 +83,7 @@ GEM
capistrano-harrow (0.5.3)
capistrano-passenger (0.2.0)
capistrano (~> 3.0)
capistrano-rails (1.1.7)
capistrano-rails (1.1.8)
capistrano (~> 3.1)
capistrano-bundler (~> 1.1)
capistrano-rvm (0.1.2)
Expand Down Expand Up @@ -104,7 +111,7 @@ GEM
activerecord (> 3.0.0)
delayed_job (> 2.0.3)
sinatra (>= 1.4.4)
devise (4.0.0.rc2)
devise (4.2.0)
bcrypt (~> 3.0)
orm_adapter (~> 0.1)
railties (>= 4.1.0, < 5.1)
Expand Down Expand Up @@ -170,7 +177,7 @@ GEM
mini_portile2 (~> 2.1.0)
pkg-config (~> 1.1.7)
orm_adapter (0.5.0)
parser (2.3.1.2)
parser (2.3.1.4)
ast (~> 2.2)
pkg-config (1.1.7)
powerpack (0.1.1)
Expand Down Expand Up @@ -199,7 +206,7 @@ GEM
nokogiri (~> 1.6.0)
rails-html-sanitizer (1.0.3)
loofah (~> 2.0)
rails-i18n (5.0.0)
rails-i18n (5.0.1)
i18n (~> 0.7)
railties (~> 5.0)
railties (5.0.0.1)
Expand All @@ -209,23 +216,21 @@ GEM
rake (>= 0.8.7)
thor (>= 0.18.1, < 2.0)
rainbow (2.1.0)
rake (11.2.2)
rake (11.3.0)
rb-fsevent (0.9.7)
rb-inotify (0.9.7)
ffi (>= 0.5.0)
ref (2.0.0)
responders (2.3.0)
railties (>= 4.2.0, < 5.1)
rouge (1.10.1)
rubocop (0.42.0)
rubocop (0.43.0)
parser (>= 2.3.1.1, < 3.0)
powerpack (~> 0.1)
rainbow (>= 1.99.1, < 3.0)
ruby-progressbar (~> 1.7)
unicode-display_width (~> 1.0, >= 1.0.1)
ruby-progressbar (1.8.1)
rubycas-client (2.3.9)
activesupport
slack-notifier (1.5.1)
spring (1.7.2)
spring-watcher-listen (2.0.0)
Expand All @@ -234,11 +239,11 @@ GEM
sprockets (3.7.0)
concurrent-ruby (~> 1.0)
rack (> 1, < 3)
sprockets-rails (3.1.1)
sprockets-rails (3.2.0)
actionpack (>= 4.0)
activesupport (>= 4.0)
sprockets (>= 3.0.0)
sshkit (1.11.2)
sshkit (1.11.3)
net-scp (>= 1.1.2)
net-ssh (>= 2.8.0)
therubyracer (0.12.2)
Expand All @@ -251,7 +256,7 @@ GEM
thread_safe (~> 0.1)
uglifier (3.0.2)
execjs (>= 0.3.0, < 3)
unicode-display_width (1.1.0)
unicode-display_width (1.1.1)
warden (1.2.6)
rack (>= 1.0)
web-console (3.3.1)
Expand All @@ -262,7 +267,7 @@ GEM
websocket-driver (0.6.4)
websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.2)
will_paginate (3.1.0)
will_paginate (3.1.3)

PLATFORMS
ruby
Expand Down Expand Up @@ -302,6 +307,7 @@ DEPENDENCIES
rails-i18n
rouge (= 1.10.1)
rubocop
rubycas-client!
sinatra!
slack-notifier
spring
Expand Down
32 changes: 24 additions & 8 deletions app/assets/javascripts/exercise.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ function init_exercise_show(exerciseId, programmingLanguage, loggedIn, editorSho
$("#exercise-handin-link").on('shown.bs.tab', function () {
// refresh editor after show
editor.resize(true);
editor.focus();
});

// configure mathjax
Expand Down Expand Up @@ -62,6 +61,7 @@ function init_exercise_show(exerciseId, programmingLanguage, loggedIn, editorSho
editor.getSession().setUseWrapMode(true);
editor.$blockScrolling = Infinity; // disable warning
editor.focus();
editor.on("focus", enableSubmitButton);
}

function initLightboxes() {
Expand Down Expand Up @@ -96,18 +96,22 @@ function init_exercise_show(exerciseId, programmingLanguage, loggedIn, editorSho
}

function swapActionButtons() {
$("#exercise-handin-link").on("shown.bs.tab", function (e) {
$("#exercise-handin-link").on("show.bs.tab", function (e) {
$("#submission-copy-btn").addClass("hidden-fab");
$("#editor-process-btn").removeClass("hidden-fab");
});
$("#exercise-handin-link").on("hide.bs.tab", function (e) {
$("#editor-process-btn").addClass("hidden-fab");
$("#exercise-submission-link").on("show.bs.tab", function (e) {
$("#submission-copy-btn").addClass("hidden-fab");
if(lastSubmission) {
$("#editor-process-btn").removeClass("hidden-fab");
} else {
$("#editor-process-btn").addClass("hidden-fab");
}
});
$("#exercise-feedback-link").on("shown.bs.tab", function (e) {
$("#exercise-feedback-link").on("show.bs.tab", function (e) {
$("#editor-process-btn").addClass("hidden-fab");
$("#submission-copy-btn").removeClass("hidden-fab");
});
$("#exercise-feedback-link").on("hide.bs.tab", function (e) {
$("#submission-copy-btn").addClass("hidden-fab");
});
}

function submitSolution(code) {
Expand Down Expand Up @@ -138,17 +142,29 @@ function init_exercise_show(exerciseId, programmingLanguage, loggedIn, editorSho
if ($("#exercise-submission-link").parent().hasClass("active")) {
$submissionRow.find(".load-submission").click();
}
setTimeout(enableSubmitButton, 100);
showNotification(I18n.t("js.submission-processed"));
lastSubmission = null;
}
}
}

function enableSubmitButton() {
$("#editor-process-btn").prop("disabled", false).removeClass("busy");
$("#editor-process-btn .glyphicon").removeClass("glyphicon-hourglass").addClass("glyphicon-play");
}

function disableSubmitButton() {
$("#editor-process-btn").prop("disabled", true).addClass("busy");
$("#editor-process-btn .glyphicon").removeClass("glyphicon-play").addClass("glyphicon-hourglass");
}

function submissionSuccessful(data) {
lastSubmission = data.id;
showNotification(I18n.t("js.submission-saved"));
$.get("submissions.js");
$('#exercise-submission-link').tab('show');
disableSubmitButton();
}

function submissionFailed() {
Expand Down
5 changes: 4 additions & 1 deletion app/assets/javascripts/index.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
function init_filter_index(baseUrl) {
function init_filter_index(baseUrl, eager) {
var PARAM = "filter";
var $filter;

function init() {
initFilter();
if (eager) {
search();
}
}

function initFilter() {
Expand Down
7 changes: 7 additions & 0 deletions app/assets/stylesheets/components.css.less
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,10 @@
line-height: 1;
margin: auto;
}
.btn-fab.disabled,
.btn-fab[disabled]{
opacity: 1;
}
.btn-fab + .btn-fab {
margin-left: 20px;
}
Expand All @@ -247,6 +251,9 @@ a.btn-fab .glyphicon {
.btn-fab .glyphicon {
margin-left: 3px;
}
.btn-fab .glyphicon.glyphicon-hourglass {
margin-left: 1px;
}
a.btn-fab .glyphicon.glyphicon-repeat {
margin-left: 0px;
margin-top: 8px;
Expand Down
10 changes: 10 additions & 0 deletions app/assets/stylesheets/exercises.css.less
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,16 @@ center img {
.hidden-fab {
display: none;
}
#editor-process-btn.busy .glyphicon{
animation-name: spin;
animation-duration: 800ms;
animation-iteration-count: infinite;
animation-timing-function: ease;
}
@keyframes spin {
from {transform:rotate(0deg);}
to {transform:rotate(359deg);}
}

// editor
#editor-window {
Expand Down
4 changes: 2 additions & 2 deletions app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ def user_not_authorized
end

def set_locale
I18n.locale = params[:locale] || (current_user && current_user.lang) || I18n.default_locale
current_user.update(lang: I18n.locale.to_s) if current_user
I18n.locale = params[:locale] || (current_user&.lang) || I18n.default_locale
current_user&.update(lang: I18n.locale.to_s)
end

def default_url_options
Expand Down
4 changes: 4 additions & 0 deletions app/controllers/courses_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,25 @@ class CoursesController < ApplicationController
def index
authorize Course
@courses = Course.all
@title = I18n.t('courses.index.title')
end

# GET /courses/1
# GET /courses/1.json
def show
@title = @course.name
end

# GET /courses/new
def new
authorize Course
@course = Course.new
@title = I18n.t('courses.new.title')
end

# GET /courses/1/edit
def edit
@title = @course.name
end

# POST /courses
Expand Down
3 changes: 3 additions & 0 deletions app/controllers/exercises_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ def index
authorize Exercise
@exercises = policy_scope(Exercise).merge(apply_scopes(Exercise).all).order('name_' + I18n.locale.to_s).paginate(page: params[:page])
@series = Series.find(params[:series_id]) if params[:series_id]
@title = I18n.t('exercises.index.title')
end

def show
Expand All @@ -22,9 +23,11 @@ def show
@edit_submission = Submission.find(params[:edit_submission])
authorize @edit_submission, :edit?
end
@title = @exercise.name
end

def edit
@title = @exercise.name
end

def update
Expand Down
4 changes: 4 additions & 0 deletions app/controllers/judges_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,25 @@ class JudgesController < ApplicationController
def index
authorize Judge
@judges = Judge.all
@title = I18n.t('judges.index.title')
end

# GET /judges/1
# GET /judges/1.json
def show
@title = @judge.name
end

# GET /judges/new
def new
authorize Judge
@judge = Judge.new
@title = I18n.t('judges.new.title')
end

# GET /judges/1/edit
def edit
@title = @judge.name
end

# POST /judges
Expand Down
4 changes: 4 additions & 0 deletions app/controllers/repositories_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,25 @@ class RepositoriesController < ApplicationController
def index
authorize Repository
@repositories = Repository.all
@title = I18n.t('repositories.index.title')
end

# GET /repositories/1
# GET /repositories/1.json
def show
@title = @repository.name
end

# GET /repositories/new
def new
authorize Repository
@repository = Repository.new
@title = I18n.t('repositories.new.title')
end

# GET /repositories/1/edit
def edit
@title = @repository.name
end

# POST /repositories
Expand Down
Loading

0 comments on commit c604464

Please sign in to comment.