Permalink
Browse files

add datepicker, exercise, and date

  • Loading branch information...
panagiotis2011 committed May 26, 2012
1 parent 62bc3cd commit 341178fbc35a8aecfe775970c61d34d013ebd737
Showing with 974 additions and 156 deletions.
  1. +1 −0 .gitignore
  2. +4 −0 .gitignore~
  3. +4 −1 Gemfile
  4. +18 −0 Gemfile.lock
  5. +3 −2 Gemfile~
  6. +2 −1 app/controllers/admin_controller.rb
  7. +2 −9 app/controllers/admin_controller.rb~
  8. +1 −1 app/controllers/application_controller.rb
  9. +2 −2 app/controllers/application_controller.rb~
  10. +14 −3 app/controllers/exercises_controller.rb
  11. +15 −4 app/controllers/exercises_controller.rb~
  12. +1 −1 app/controllers/questions_controller.rb
  13. +3 −5 app/controllers/questions_controller.rb~
  14. +1 −0 app/controllers/users_controller.rb
  15. +11 −2 app/controllers/users_controller.rb~
  16. +58 −0 app/controllers/writings_controller.rb
  17. +58 −0 app/controllers/writings_controller.rb~
  18. +8 −0 app/helpers/writings_herlper.rb
  19. +8 −0 app/helpers/writings_herlper.rb~
  20. +9 −2 app/models/exercise.rb
  21. +9 −2 app/models/exercise.rb~
  22. +1 −1 app/models/user.rb
  23. +1 −1 app/models/user.rb~
  24. +1 −0 app/models/writing.rb
  25. +3 −0 app/models/writing.rb~
  26. +12 −0 app/views/admin/edit.html.erb
  27. 0 app/views/admin/edit.html.erb~
  28. +15 −6 app/views/admin/index.html.erb
  29. +11 −16 app/views/admin/index.html.erb~
  30. +11 −0 app/views/admin/show.html.erb
  31. +18 −0 app/views/admin/show.html.erb~
  32. +6 −5 app/views/exercises/_form.html.erb
  33. +6 −5 app/views/exercises/_form.html.erb~
  34. +2 −2 app/views/exercises/edit.html.erb
  35. +2 −2 app/views/exercises/edit.html.erb~
  36. +13 −12 app/views/exercises/index.html.erb
  37. +14 −13 app/views/exercises/index.html.erb~
  38. +29 −0 app/views/exercises/myexercises.html.erb
  39. 0 app/views/exercises/myexercises.html.erb~
  40. +1 −0 app/views/exercises/new.html.erb
  41. +3 −1 app/views/exercises/new.html.erb~
  42. +4 −1 app/views/exercises/show.html.erb
  43. +4 −1 app/views/exercises/show.html.erb~
  44. +4 −3 app/views/layouts/application.html.erb
  45. +4 −3 app/views/layouts/application.html.erb~
  46. +2 −2 app/views/questions/_form.html.erb
  47. +3 −4 app/views/questions/_form.html.erb~
  48. +5 −2 app/views/questions/show.html.erb
  49. +5 −2 app/views/questions/show.html.erb~
  50. +4 −4 app/views/users/registrations/edit.html.erb~
  51. +31 −0 app/views/writings/_form.html.erb
  52. +32 −0 app/views/writings/_form.html.erb~
  53. 0 app/views/writings/edit.html.erb
  54. +23 −0 app/views/writings/index.html.erb
  55. +23 −0 app/views/writings/index.html.erb~
  56. +7 −0 app/views/writings/new.html.erb
  57. +7 −0 app/views/writings/new.html.erb~
  58. +23 −0 app/views/writings/show.html.erb
  59. +23 −0 app/views/writings/show.html.erb~
  60. +1 −1 config/initializers/omniauth.rb
  61. +3 −2 config/initializers/omniauth.rb~
  62. +12 −12 config/locales/el.yml
  63. +4 −0 config/locales/el.yml~
  64. +6 −1 config/routes.rb
  65. +11 −3 config/routes.rb~
  66. +4 −0 config/s3.yml~
  67. +1 −0 db/migrate/20120514223800_create_writings.rb
  68. +16 −0 db/migrate/20120514223800_create_writings.rb~
  69. +15 −0 db/migrate/20120517142448_add_attachment_askisi_to_exercises.rb
  70. +6 −2 db/schema.rb
  71. BIN public/images/calendar.gif
  72. +10 −0 public/javascripts/application.js
  73. +13 −0 public/javascripts/application.js~
  74. +11 −0 public/javascripts/datepickers.js
  75. +11 −0 public/javascripts/datepickers.js~
  76. +26 −0 public/javascripts/jquery-ui.datepicker-el.js~
  77. +26 −0 public/javascripts/jquery-ui.datepicker-i18n.js~
  78. +24 −0 public/javascripts/jquery.ui.datepicker-el.js~
  79. +24 −0 public/javascripts/ui.datepicker-el.js
  80. +24 −0 public/javascripts/ui.datepicker-el.js~
  81. +67 −4 public/stylesheets/diplomatiki.css
  82. +67 −5 public/stylesheets/diplomatiki.css~
  83. BIN public/stylesheets/images/calendar.gif
  84. BIN public/system/exercises/askisis/000/000/002/medium/.png
  85. BIN public/system/exercises/askisis/000/000/002/original/.png
  86. BIN public/system/exercises/askisis/000/000/002/thumb/.png
  87. +6 −5 test/functional/exercises_controller_test.rb
  88. +1 −0 test/functional/exercises_controller_test.rb~
View
@@ -2,3 +2,4 @@
db/*.sqlite3
log/*.log
tmp/
+config/s3.yml
View
@@ -0,0 +1,4 @@
+.bundle
+db/*.sqlite3
+log/*.log
+tmp/
View
@@ -3,13 +3,16 @@ source 'http://rubygems.org'
gem 'rails', '3.0.11'
gem 'pg'
gem 'devise'
-gem "recaptcha", :require => "recaptcha/rails"
+gem 'recaptcha', :require => 'recaptcha/rails'
gem 'sinatra'
gem 'mogli'
gem 'gravatar_image_tag', '1.0.0.pre2'
gem 'rails-i18n'
gem 'jquery-rails', '>= 1.0.12'
gem 'rails3-jquery-autocomplete'
+gem 'paperclip', '~> 3.0'
+gem 'aws-sdk', '~> 1.3.4'
+gem "watu_table_builder", :require => "table_builder"
gem 'will_paginate', '~> 3.0.pre2'
View
@@ -34,8 +34,14 @@ GEM
addressable (2.2.7)
arel (2.0.10)
attr_required (0.0.5)
+ aws-sdk (1.3.9)
+ httparty (~> 0.7)
+ json (~> 1.4)
+ nokogiri (>= 1.4.4)
+ uuidtools (~> 2.1)
bcrypt-ruby (3.0.1)
builder (2.1.2)
+ cocaine (0.2.1)
coderay (1.0.5)
daemons (1.1.8)
dalli (1.1.5)
@@ -76,6 +82,7 @@ GEM
multi_json (1.1.0)
multi_xml (0.4.1)
multipart-post (1.1.5)
+ nokogiri (1.5.2)
oauth (0.4.5)
oauth2 (0.5.2)
faraday (~> 0.7)
@@ -100,6 +107,12 @@ GEM
omniauth-twitter (0.0.8)
omniauth-oauth (~> 1.0)
orm_adapter (0.0.6)
+ paperclip (3.0.3)
+ activemodel (>= 3.0.0)
+ activerecord (>= 3.0.0)
+ activesupport (>= 3.0.0)
+ cocaine (>= 0.0.2)
+ mime-types
pg (0.13.2)
polyglot (0.3.3)
rack (1.2.5)
@@ -154,10 +167,12 @@ GEM
polyglot
polyglot (>= 0.3.1)
tzinfo (0.3.32)
+ uuidtools (2.1.2)
validate_url (0.2.0)
activemodel (>= 3.0.0)
warden (1.1.1)
rack (>= 1.0)
+ watu_table_builder (0.3.0)
will_paginate (3.0.3)
PLATFORMS
@@ -166,6 +181,7 @@ PLATFORMS
DEPENDENCIES
RedCloth
acts-as-taggable-on (~> 2.2.2)
+ aws-sdk (~> 1.3.4)
coderay
dalli
devise
@@ -180,6 +196,7 @@ DEPENDENCIES
omniauth-github
omniauth-openid
omniauth-twitter
+ paperclip (~> 3.0)
pg
rails (= 3.0.11)
rails-i18n
@@ -189,4 +206,5 @@ DEPENDENCIES
sqlite3
thin
validate_url
+ watu_table_builder
will_paginate (~> 3.0.pre2)
View
@@ -2,15 +2,16 @@ source 'http://rubygems.org'
gem 'rails', '3.0.11'
gem 'pg'
-gem 'sqlite3', '1.3.3'
gem 'devise'
-gem "recaptcha", :require => "recaptcha/rails"
+gem 'recaptcha', :require => 'recaptcha/rails'
gem 'sinatra'
gem 'mogli'
gem 'gravatar_image_tag', '1.0.0.pre2'
gem 'rails-i18n'
gem 'jquery-rails', '>= 1.0.12'
gem 'rails3-jquery-autocomplete'
+gem 'paperclip', '~> 3.0'
+gem 'aws-sdk', '~> 1.3.4'
gem 'will_paginate', '~> 3.0.pre2'
@@ -17,6 +17,8 @@ def index
@num_users = User.all.count
@num_users_active30days = User.where('last_sign_in_at > ?', 30.days.ago).count
@num_users_created30days = User.where('created_at > ?', 30.days.ago).count
+ @current_user.attributes = {'exercise_ids' => []}.merge(params[:user] || {})
+
end
@@ -147,7 +149,6 @@ def users
@users = User.where(:user_kind => @user_kind).order(@order).paginate(:page => params[:page], :per_page => 10)
end
-
protected
def is_admin
if current_user
@@ -17,6 +17,8 @@ class AdminController < ApplicationController
@num_users = User.all.count
@num_users_active30days = User.where('last_sign_in_at > ?', 30.days.ago).count
@num_users_created30days = User.where('created_at > ?', 30.days.ago).count
+ @user.attributes = {'exercise_ids' => []}.merge(params[:user] || {})
+
end
@@ -126,14 +128,6 @@ class AdminController < ApplicationController
@questions = Question.where(:state => @state).order(@order)
end
- def exercises
- @exercises = Exercise.all
- @exercises = Exercise.paginate(:page => params[:page])
- respond_to do |format|
- format.html # index.html.erb
- format.xml { render :xml => @exercises }
- end
- end
# διαχείριση των χρηστών από τον διαχειριστή (user.id = 1)
def users
@@ -155,7 +149,6 @@ class AdminController < ApplicationController
@users = User.where(:user_kind => @user_kind).order(@order).paginate(:page => params[:page], :per_page => 10)
end
-
protected
def is_admin
if current_user
@@ -1,6 +1,6 @@
class ApplicationController < ActionController::Base
protect_from_forgery
- before_filter :authenticate_user!, :except => [:index, :all, :show, :about]
+ before_filter :authenticate_user!, :except => [:all, :show, :about]
before_filter :count_questions
def about
end
@@ -1,6 +1,6 @@
class ApplicationController < ActionController::Base
protect_from_forgery
- before_filter :authenticate_user!, :except => [:index, :all, :show, :about]
+ before_filter :authenticate_user!, :except => [:all, :show, :about]
before_filter :count_questions
def about
end
@@ -9,7 +9,7 @@ class ApplicationController < ActionController::Base
def all
@questions = Question.where(:state => ['3', '4'])
respond_to do |format|
- format.html { render 'index' } # uses the same view as the default index
+ format.html { render 'index' } # χρήση του ίδιου view όπως το view index
format.xml { render :xml => @questions }
end
end
@@ -11,11 +11,21 @@ def index
end
end
+
+ def myexercises
+ @myexercises = current_user.exercises.all
+ @myexercises = current_user.exercise.order('created_at desc').paginate(:page => params[:page], :per_page => 10)
+ respond_to do |format|
+ format.html { render 'myexercises'}
+ format.xml { render :xml => @myexercises }
+ end
+ end
+
# GET /exercises/1
# GET /exercises/1.xml
def show
@exercise = Exercise.find(params[:id])
-
+ #@writings = Writing.find(all, :conditions => ["exercise_id = ?", @exercise.id]))
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @exercise }
@@ -25,7 +35,7 @@ def show
# GET /exercises/new
# GET /exercises/new.xml
def new
- @exercise = Exercise.new
+ @exercise = current_user.exercises.new
respond_to do |format|
format.html # new.html.erb
@@ -45,8 +55,9 @@ def create
respond_to do |format|
if @exercise.save
- format.html { redirect_to(@exercise, :notice => 'Η άσκση δημιουργήθηκε επιτυχώς.') }
+ format.html { redirect_to(@exercise, :notice => 'Η άσκηση δημιουργήθηκε επιτυχώς.') }
format.xml { render :xml => @exercise, :status => :created, :location => @exercise }
+ #format.xml { render :xml => @writing, :status => :created, :location => @writing }
else
format.html { render :action => "new" }
format.xml { render :xml => @exercise.errors, :status => :unprocessable_entity }
@@ -4,18 +4,28 @@ class ExercisesController < ApplicationController
# GET /exercises.xml
def index
@exercises = Exercise.all
- @exercises = Exercise.order('created desc').paginate(:page => params[:page], :per_page => 10)
+ @exercises = Exercise.order('created_at desc').paginate(:page => params[:page], :per_page => 10)
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @exercises }
end
end
+
+ def myexercises
+ @myexercises = current_user.exercises.all
+ @myexercises = current_user.exercise.order('created_at desc').paginate(:page => params[:page], :per_page => 10)
+ respond_to do |format|
+ format.html { render 'myexercises'}
+ format.xml { render :xml => @myexercises }
+ end
+ end
+
# GET /exercises/1
# GET /exercises/1.xml
def show
@exercise = Exercise.find(params[:id])
-
+ @writings = Writing.find(all, :conditions => ["exercise_id = ?", @exercise.id]))
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @exercise }
@@ -25,7 +35,7 @@ class ExercisesController < ApplicationController
# GET /exercises/new
# GET /exercises/new.xml
def new
- @exercise = Exercise.new
+ @exercise = current_user.exercises.new
respond_to do |format|
format.html # new.html.erb
@@ -45,8 +55,9 @@ class ExercisesController < ApplicationController
respond_to do |format|
if @exercise.save
- format.html { redirect_to(@exercise, :notice => 'Η άσκση δημιουργήθηκε επιτυχώς.') }
+ format.html { redirect_to(@exercise, :notice => 'Η άσκηση δημιουργήθηκε επιτυχώς.') }
format.xml { render :xml => @exercise, :status => :created, :location => @exercise }
+ #format.xml { render :xml => @writing, :status => :created, :location => @writing }
else
format.html { render :action => "new" }
format.xml { render :xml => @exercise.errors, :status => :unprocessable_entity }
@@ -3,7 +3,7 @@ class QuestionsController < ApplicationController
respond_to :json
autocomplete :tag, :name
# μόνο οι μέθοδοι index, all, about και show είναι προσβάσιμες από μη πιστοποιημένους χρήστες
- before_filter :authenticate_user!, :except => [:index, :all, :show, :about]
+ before_filter :authenticate_user!, :except => [:index, :all, :about]
rescue_from ActiveRecord::RecordNotFound, :with => :record_not_found
@@ -102,11 +102,6 @@ class QuestionsController < ApplicationController
end
- def edit
- @question = current_user.questions.find(params[:id])
- end
-
-
def postfacebook
@question = current_user.questions.find(params[:id])
begin
@@ -155,6 +150,9 @@ class QuestionsController < ApplicationController
end
end
+ def edit
+ @question = current_user.questions.find(params[:id])
+ end
def create
@question = current_user.questions.new(params[:question])
@@ -15,6 +15,7 @@ def update
end
end
+
def destroy
@user = User.find(params[:id])
if current_user.id < 2
@@ -1,7 +1,7 @@
# encoding: utf-8
class UsersController < ApplicationController
-def update
+ def update
@user = User.find(params[:id])
respond_to do |format|
@@ -15,7 +15,16 @@ def update
end
end
-def destroy
+ def show
+ @user = User.find(params[:id])
+
+ respond_to do |format|
+ format.html { render 'index' }
+ format.xml { render :xml => @user }
+ end
+ end
+
+ def destroy
@user = User.find(params[:id])
if current_user.id < 2
@user.destroy
Oops, something went wrong.

0 comments on commit 341178f

Please sign in to comment.