Skip to content

Commit

Permalink
issue alaashafaee#211 Fixing conflicts with master
Browse files Browse the repository at this point in the history
  • Loading branch information
Mohamed Fadel authored and Mohamed Fadel committed Apr 25, 2014
2 parents fd5eaba + b64dad2 commit f73a7fe
Show file tree
Hide file tree
Showing 171 changed files with 5,664 additions and 1,266 deletions.
2 changes: 1 addition & 1 deletion tutor/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,4 @@ models.svg

# Ignoring .java and .class files
/students_solutions/Java/*.java
/students_solutions/Class/*.class
/students_solutions/Class/*.class
18 changes: 15 additions & 3 deletions tutor/Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,16 @@ ruby '2.1.0'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.0.4'

# User authentication
gem 'devise'

# File uploading
# gem 'carrierwave'
# gem 'rmagick'

# Use sqlite3 as the database for Active Record
gem 'sqlite3'
gem 'devise'

# Use SCSS for stylesheets
gem 'sass-rails', '~> 4.0.2'

Expand Down Expand Up @@ -47,7 +54,12 @@ gem 'foreman'
# Use debugger
# gem 'debugger', group: [:development, :test]

# User authentication

# Use composite primary keys in models
gem 'composite_primary_keys', '~> 6.0.1'

#search
gem 'tire'
gem 'json_builder', '3.1.0'

# whenever gem for scheduling tasks
gem 'whenever', :require => false
39 changes: 29 additions & 10 deletions tutor/Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,11 @@ GEM
multi_json (~> 1.3)
thread_safe (~> 0.1)
tzinfo (~> 0.3.37)
ansi (1.4.3)
arel (4.0.2)
atomic (1.1.16)
bcrypt (3.1.7)
builder (3.1.4)
chronic (0.10.2)
coffee-rails (4.0.1)
coffee-script (>= 2.2.0)
railties (>= 4.0.0, < 5.0)
Expand All @@ -44,12 +45,13 @@ GEM
railties (>= 3.2.6, < 5)
thread_safe (~> 0.1)
warden (~> 1.2.3)
dotenv (0.10.0)
dotenv (0.7.0)
erubis (2.7.0)
execjs (2.0.2)
foreman (0.63.0)
dotenv (>= 0.7)
thor (>= 0.13.6)
hashr (0.0.22)
hike (1.2.3)
i18n (0.6.9)
jbuilder (1.5.3)
Expand All @@ -59,6 +61,8 @@ GEM
railties (>= 3.0, < 5.0)
thor (>= 0.14, < 2.0)
json (1.8.1)
json_builder (3.1.0)
activesupport (>= 2.0.0)
kgio (2.9.2)
mail (2.5.4)
mime-types (~> 1.16)
Expand All @@ -85,15 +89,17 @@ GEM
rake (>= 0.8.7)
thor (>= 0.18.1, < 2.0)
raindrops (0.13.0)
rake (10.1.1)
rake (10.3.1)
rdoc (4.1.1)
json (~> 1.4)
sass (3.2.17)
sass-rails (4.0.2)
rest-client (1.6.7)
mime-types (>= 1.16)
sass (3.2.19)
sass-rails (4.0.3)
railties (>= 4.0.0, < 5.0)
sass (~> 3.2.0)
sprockets (~> 2.8, <= 2.11.0)
sprockets-rails (~> 2.0.0)
sprockets-rails (~> 2.0)
sdoc (0.4.0)
json (~> 1.8)
rdoc (~> 4.0, < 5.0)
Expand All @@ -107,14 +113,21 @@ GEM
activesupport (>= 3.0)
sprockets (~> 2.8)
sqlite3 (1.3.9)
thor (0.19.0)
thread_safe (0.3.1)
atomic (>= 1.1.7, < 2)
thor (0.19.1)
thread_safe (0.3.3)
tilt (1.4.1)
tire (0.6.2)
activemodel (>= 3.0)
activesupport
ansi
hashr (~> 0.0.19)
multi_json (~> 1.3)
rake
rest-client (~> 1.6)
treetop (1.4.15)
polyglot
polyglot (>= 0.3.1)
turbolinks (2.2.1)
turbolinks (2.2.2)
coffee-rails
tzinfo (0.3.39)
uglifier (2.5.0)
Expand All @@ -126,6 +139,9 @@ GEM
raindrops (~> 0.7)
warden (1.2.3)
rack (>= 1.0)
whenever (0.9.2)
activesupport (>= 2.3.4)
chronic (>= 0.6.3)

PLATFORMS
ruby
Expand All @@ -137,10 +153,13 @@ DEPENDENCIES
foreman
jbuilder (~> 1.2)
jquery-rails (~> 3.1.0)
json_builder (= 3.1.0)
rails (= 4.0.4)
sass-rails (~> 4.0.2)
sdoc
sqlite3
tire
turbolinks
uglifier (>= 1.3.0)
unicorn
whenever
Binary file added tutor/app/assets/images/add_buttom.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added tutor/app/assets/images/add_button.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added tutor/app/assets/images/delete_button.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions tutor/app/assets/javascripts/acknowledgements.js.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Place all the behaviors and hooks related to the matching controller here.
# All this logic will automatically be available in application.js.
# You can use CoffeeScript in this file: http://coffeescript.org/
2 changes: 2 additions & 0 deletions tutor/app/assets/javascripts/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,5 @@
//= require jquery_ujs
//= require turbolinks
//= require_tree .
//= require jquery.tokeninput
//= require utilities
7 changes: 7 additions & 0 deletions tutor/app/assets/javascripts/jquery.bpopup.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions tutor/app/assets/javascripts/lecturers.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
$(document).ready(function() {
$('.tabs .tab-links a').on('click', function(element) {
var currentAttrValue = $(this).attr('href');
// Show/Hide Tabs
$('.tabs ' + currentAttrValue).siblings().slideUp(400);
$('.tabs ' + currentAttrValue).delay(400).slideDown(400);
//or use fade
//$('.tabs ' + currentAttrValue).fadeIn(400).siblings().hide();
// Change/remove current tab to active
$(this).parent('li').addClass('active').siblings().removeClass('active');
element.preventDefault();
});
});
3 changes: 3 additions & 0 deletions tutor/app/assets/javascripts/posts.js.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Place all the behaviors and hooks related to the matching controller here.
# All this logic will automatically be available in application.js.
# You can use CoffeeScript in this file: http://coffeescript.org/
135 changes: 126 additions & 9 deletions tutor/app/assets/javascripts/solutions.js.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -11,40 +11,95 @@ index_number = 0
# Author: Mussab ElDash
@start_debug = (problem_id) ->
input = $('#solution_code').val()
test = $('#testcases').val()
if input.length is 0
alert "You didn't write any code"
return
test = $('#solution_input').val()
start_spin()
$.ajax
type: "POST"
url: '/debuggers/' + problem_id
data: {code : input , case : test}
datatype: 'json'
success: (data) ->
toggleDebug()
variables = data
stop_spin()
if !data["success"]
compilation_error data["data"]["errors"]
return
variables = data["data"]
toggleDebug()
debug_console()
jump_state 0
error: ->
stop_spin()
return
return

# [Debugger: Debug - Story 3.6]
# Fills the console with the compilation errors
# Parameters: none
# Returns: none
# Author: Mussab ElDash
compilation_error = (data) ->
$('.compilation_failed').html("Compilation Failed!")
$('.compilation_feedback').html(data)
return

# [Debugger: Debug - Story 3.6]
# Clears the console
# Parameters: none
# Returns: none
# Author: Mussab ElDash
clear_console = ->
$('.compilation_failed').html("")
$('.compilation_feedback').html("")
return

# [Debugger: Debug - Story 3.6]
# Write successful debug in the console
# Parameters: none
# Returns: none
# Author: Mussab ElDash
debug_console = ->
$('.compilation_succeeded').html("Debugging Succeeded!")
return

# [Debugger: Debug - Story 3.6]
# Starts the Spinner
# Parameters: none
# Returns: none
# Author: Mussab ElDash
@start_spin = ->
$('#spinner').attr "class" , "spinner"
$('#spinner').addClass "spinner"
return

# [Debugger: Debug - Story 3.6]
# Stops the Spinner
# Parameters: none
# Returns: none
# Author: Mussab ElDash
@stop_spin = ->
$('#spinner').attr "class" , ""
$('#spinner').removeClass "spinner"
return

# [Debugger: Debug - Story 3.6]
# Toggles the Spinner
# Parameters: none
# Returns: none
# Author: Mussab ElDash
@toggle_spin = ->
$('#spinner').toggleClass "spinner"

# [Execute Line By Line - Story 3.8]
# Toggles debugging mode by changing the available buttons.
# Parameters: none
# Returns: none
# Author: Rami Khalil (Temporary)
@toggleDebug = () ->
@toggleDebug = ->
$('#debugButton').prop 'hidden', !$('#debugButton').prop 'hidden'
$('#compileButton').prop 'hidden', !$('#compileButton').prop 'hidden'
$('#testButton').prop 'hidden', !$('#testButton').prop 'hidden'
$('#solution_code').prop 'disabled', !$('#solution_code').prop 'disabled'

$('#nextButton').prop 'hidden', !$('#nextButton').prop 'hidden'
$('#previousButton').prop 'hidden', !$('#previousButton').prop 'hidden'
Expand Down Expand Up @@ -130,9 +185,31 @@ index_number = 0
# Parameters:
# stateNumber: The target state number.
# Returns: none
# Author: Rami Khalil
# Author: Rami Khalil + Khaled Helmy
@jump_state = (stateNumber) ->
highlight_line variables[stateNumber]['line'] - 1
highlight_line variables[stateNumber]['line'] - 2
update_memory_contents stateNumber

# [View Variables - Story 3.7]
# Updates the variables values according to a certain state
# Parameters:
# stateNumber: The target state number.
# Returns: none
# Author: Khaled Helmy
@update_memory_contents = (stateNumber) ->
div = document.getElementById("memory")
list_of_variables = variables[stateNumber]["locals"]
content = '<table class="table table-striped table-bordered table-condensed table-hover" border="3">'
content += "<tr class='info'><th>Variable</th><th>Value</th></tr>"
i = 0
while i < list_of_variables.length
values = list_of_variables[i].split " = "
content += "<tr class='success'><td>" + values[0] + "</td>"
content += "<td>" + values[1] + "</td></tr>"
i++
content += "</table>"
div.innerHTML = content
return

# [Debug - Story 3.6]
# Stops the debugging session.
Expand All @@ -142,4 +219,44 @@ index_number = 0
@stop = () ->
toggleDebug()
index_number = 0;
variables = null;
variables = null;

# To be Used when changing to ajax in order not to refresh page
# [Compiler: Validate - Story 3.5]
# submits a solution in the form without refreshing
# using ajax showing an alert box for success and failure scenarios
# Parameters:
# problem_id: the id of the problem being solved
# Returns: a json object containing two arrays one for the errors
# of the current code and the other containing success messages
# Author: MOHAMEDSAEED
@validate_code = (problem_id) ->
code = $('#solution_code').val()
mins = parseInt($('#mins').text())
secs = parseInt($('#secs').text())
time = mins*60 + secs
start_spin()
$.ajax
type: "POST"
url: '/solutions'
data: {problem_id: problem_id, code: code, time: time}
datatype: 'json'
success: (data) ->
stop_spin()
success = $('#validate_success')
errors = $('#validate_error')
success.html("")
for i in data["success"]
success.append("#{i}<br>")
errors.html("")
for i in data["failure"]
errors.append("#{i}<br>")
if code.length isnt 0
alert 'Solution has been submitted successfully'
else
alert 'Blank submissions are not allowed'
return
error: (data) ->
stop_spin()
return
return
Loading

0 comments on commit f73a7fe

Please sign in to comment.