Skip to content

Commit

Permalink
#36
Browse files Browse the repository at this point in the history
  • Loading branch information
mariam2yman committed May 1, 2015
1 parent b2afbf2 commit 5218c89
Show file tree
Hide file tree
Showing 36 changed files with 170 additions and 25 deletions.
17 changes: 17 additions & 0 deletions .c9/.nakignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
*~backup-*
.c9revisions
.c9
.git
.svn
.DS_Store
.bzr
.cdv
~.dep
~.dot
~.nib
~.plst
.hg
.pc
*.min.js
.nakignore
/dev
1 change: 1 addition & 0 deletions .c9/metadata/tab0
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"filter":false,"title":"bash - \"Cloning ...\"","tooltip":"bash - \"Cloning ...\"","undoManager":{"mark":0,"position":-1,"stack":[]},"terminal":{"id":"clone","cwd":"","width":1333,"height":124,"scrollTop":30.00006103515625},"hash":"67452301efcdab8998badcfe10325476c3d2e1f0"}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"filter":false,"title":"pitches_controller.rb","tooltip":"/Project/app/controllers/pitches_controller.rb","undoManager":{"mark":2,"position":2,"stack":[[{"group":"doc","deltas":[{"start":{"row":90,"column":3},"end":{"row":91,"column":0},"action":"insert","lines":["",""]}]}],[{"group":"doc","deltas":[{"start":{"row":91,"column":0},"end":{"row":92,"column":0},"action":"insert","lines":["",""]}]}],[{"group":"doc","deltas":[{"start":{"row":91,"column":0},"end":{"row":98,"column":3},"action":"insert","lines":[" def submitTheEvaluation"," @pitch = Pitch.find(params[:id])"," #if ! current_user.is_Idea_Consultant?"," "," # redirect_to pitch_path(@pitch), alert: \"you can not evaluate\""," #redirect_to @pitch, notice: \"The Evaluation has been sent successfuly\""," #end","end"]}]}]]},"ace":{"folds":[],"scrolltop":587,"scrollleft":0,"selection":{"start":{"row":55,"column":1},"end":{"row":55,"column":1},"isBackwards":false},"options":{"guessTabSize":true,"useWrapMode":false,"wrapToView":true},"firstLineState":{"row":44,"state":"start","mode":"ace/mode/ruby"}},"timestamp":1430257269630,"hash":"eb094e2239e27613395c3ed9adb26e6deb581d87"}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"filter":false,"title":"show.html.erb","tooltip":"/Project/app/views/pitches/show.html.erb","undoManager":{"mark":2,"position":2,"stack":[[{"group":"doc","deltas":[{"start":{"row":80,"column":34},"end":{"row":81,"column":0},"action":"insert","lines":["",""]}]}],[{"group":"doc","deltas":[{"start":{"row":81,"column":0},"end":{"row":82,"column":0},"action":"insert","lines":["",""]}]}],[{"group":"doc","deltas":[{"start":{"row":82,"column":0},"end":{"row":88,"column":51},"action":"insert","lines":["<form action=\"<%= submitTheEvaluation_pitch_path %>\" id=\"EvaluateTheIdea\" method=\"get\" onsubmit=\"return ValidateForm(this);\">","<label for=\"Evaluate\">Evaluate The Idea</label><br />","<textarea name=\"Evaluate\" rows=\"5\" cols=\"40\" style=\"width: 500px;\"></textarea>","<br />","<div style=\"float: middle\">",""," <input name=\"post\" type=\"submit\" value=\"Post\" /> "]}]}]]},"ace":{"folds":[],"scrolltop":626,"scrollleft":0,"selection":{"start":{"row":88,"column":51},"end":{"row":88,"column":51},"isBackwards":false},"options":{"guessTabSize":true,"useWrapMode":false,"wrapToView":true},"firstLineState":{"row":44,"state":"start","mode":"ace/mode/html_ruby"}},"timestamp":1430257266793,"hash":"cd1407f8df5e59a5859d33a8a1c2e266675623a4"}
1 change: 1 addition & 0 deletions .c9/metadata/workspace/Project/config/routes.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"filter":false,"title":"routes.rb","tooltip":"/Project/config/routes.rb","undoManager":{"mark":1,"position":1,"stack":[[{"group":"doc","deltas":[{"start":{"row":9,"column":24},"end":{"row":10,"column":0},"action":"insert","lines":["",""]},{"start":{"row":10,"column":0},"end":{"row":10,"column":5},"action":"insert","lines":[" "]}]}],[{"group":"doc","deltas":[{"start":{"row":10,"column":5},"end":{"row":10,"column":30},"action":"insert","lines":["get 'submitTheEvaluation'"]}]}]]},"ace":{"folds":[],"scrolltop":0,"scrollleft":0,"selection":{"start":{"row":10,"column":30},"end":{"row":10,"column":30},"isBackwards":false},"options":{"guessTabSize":true,"useWrapMode":false,"wrapToView":true},"firstLineState":{"row":47,"state":"start","mode":"ace/mode/ruby"}},"timestamp":1430257260979,"hash":"053e3908ea90de7334f7989a416f2bea4581e2ec"}
1 change: 1 addition & 0 deletions .c9/metadata/workspace/Project/db/seeds.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"filter":false,"title":"seeds.rb","tooltip":"/Project/db/seeds.rb","undoManager":{"mark":3,"position":3,"stack":[[{"group":"doc","deltas":[{"start":{"row":31,"column":0},"end":{"row":32,"column":0},"action":"insert","lines":["",""]}]}],[{"group":"doc","deltas":[{"start":{"row":32,"column":0},"end":{"row":33,"column":0},"action":"insert","lines":["",""]}]}],[{"group":"doc","deltas":[{"start":{"row":33,"column":0},"end":{"row":37,"column":0},"action":"insert","lines":["ideaConsultant_user1 = User.new( :email => 'MariamAyman@hotmail.com', :password => '12345678')","ideaConsultant_user1.is_Idea_Consultant = true","ideaConsultant_user1.approved = true","ideaConsultant_user1.save!",""]}]}],[{"group":"doc","deltas":[{"start":{"row":8,"column":0},"end":{"row":8,"column":2},"action":"insert","lines":["# "]},{"start":{"row":9,"column":0},"end":{"row":9,"column":2},"action":"insert","lines":["# "]},{"start":{"row":10,"column":0},"end":{"row":10,"column":2},"action":"insert","lines":["# "]},{"start":{"row":14,"column":0},"end":{"row":14,"column":2},"action":"insert","lines":["# "]},{"start":{"row":15,"column":0},"end":{"row":15,"column":2},"action":"insert","lines":["# "]},{"start":{"row":16,"column":0},"end":{"row":16,"column":2},"action":"insert","lines":["# "]},{"start":{"row":17,"column":0},"end":{"row":17,"column":2},"action":"insert","lines":["# "]},{"start":{"row":19,"column":0},"end":{"row":19,"column":2},"action":"insert","lines":["# "]},{"start":{"row":20,"column":0},"end":{"row":20,"column":2},"action":"insert","lines":["# "]},{"start":{"row":21,"column":0},"end":{"row":21,"column":2},"action":"insert","lines":["# "]},{"start":{"row":22,"column":0},"end":{"row":22,"column":2},"action":"insert","lines":["# "]},{"start":{"row":27,"column":0},"end":{"row":27,"column":2},"action":"insert","lines":["# "]},{"start":{"row":28,"column":0},"end":{"row":28,"column":2},"action":"insert","lines":["# "]},{"start":{"row":29,"column":0},"end":{"row":29,"column":2},"action":"insert","lines":["# "]},{"start":{"row":30,"column":0},"end":{"row":30,"column":2},"action":"insert","lines":["# "]}]}]]},"ace":{"folds":[],"scrolltop":0,"scrollleft":0,"selection":{"start":{"row":30,"column":21},"end":{"row":30,"column":21},"isBackwards":false},"options":{"guessTabSize":true,"useWrapMode":false,"wrapToView":true},"firstLineState":0},"timestamp":1430256785028,"hash":"18b3483e9edd0b69acec14b6d56bcaf965db7d09"}
46 changes: 46 additions & 0 deletions .c9/project.settings
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
{
"ace": {
"@guessTabSize": "true",
"@newLineMode": "unix",
"@tabSize": "4",
"@useSoftTabs": "true"
},
"build": {
"@builder": "auto",
"@path": "/.c9/builders",
"@saveall": "true"
},
"find.nak": {
"@searchLimit": 100
},
"general": {
"@stripws": false
},
"language": {
"@eslintrc": "true",
"@instanceHighlight": "true",
"@semi": "true",
"@undeclaredVars": "true",
"@unusedFunctionArgs": "false",
"@warnLevel": "info"
},
"run": {
"@path": "/.c9/runners",
"configs": {
"@inited": "true",
"json()": {
"Ruby on Rails": {
"command": "",
"default": true,
"name": "Ruby on Rails",
"runner": "Ruby on Rails (Rails 4.0 + Ruby 2.1)"
}
}
}
},
"share": {
"@app": false,
"@preview": false,
"@useOwnerSettings": false
}
}
Binary file removed Diagrams/SD@CD/class_diagrams.jpg
Binary file not shown.
Binary file removed Diagrams/SD@CD/create_and_update_events_sd.jpg
Binary file not shown.
Binary file removed Diagrams/SD@CD/editing_profile_sd.jpg
Binary file not shown.
Binary file not shown.
Binary file removed Diagrams/SD@CD/view_profile_sd.jpg
Binary file not shown.
Binary file removed Diagrams/create_button.png
Binary file not shown.
Binary file removed Diagrams/edit_user_admin_view.jpg
Binary file not shown.
Binary file removed Diagrams/event_calender_updated.jpg
Binary file not shown.
Binary file removed Diagrams/home.jpg
Binary file not shown.
Binary file removed Diagrams/login_signup_page.jpg
Binary file not shown.
Binary file removed Diagrams/new_event.png
Binary file not shown.
Binary file removed Diagrams/profile updated.jpg
Binary file not shown.
Binary file removed Diagrams/request_for_sign_up.jpg
Binary file not shown.
Binary file removed Diagrams/show_event.png
Binary file not shown.
Binary file added My Diagrams/after_evaluating_the_idea_Sprint2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 0 additions & 1 deletion Project/app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
class ApplicationController < ActionController::Base
# Prevent CSRF attacks by raising an exception.
# For APIs, you may want to use :null_session instead.
protect_from_forgery with: :exception

before_filter :configure_permitted_parameters, if: :devise_controller?

Expand Down
25 changes: 19 additions & 6 deletions Project/app/controllers/pitches_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -69,24 +69,37 @@ def pitch_params



#This method is that the ideaConsultant is to be evaluated by the ideator
#Author Mariam Afifi
#This method is that the ideaConsultant is to be evaluated by the ideator
#Author: Mariam Afifi
def evaluateIdeaConsultant
@pitch = Pitch.find(params[:id])
@pitch = Pitch.find(params[:id])
if ! current_user.is_Ideator?
redirect_to pitches_path, alert: "you are not allowed to evaluate"
end
end


#This method is to submit the evaluation form
#Author Mariam Afifi
#This method is to submit the evaluation form
#Author: Mariam Afifi
def submitTheForm
user = User.find_by_email(params[:IdeaConsultantEmailAddress])
if user.nil?
redirect_to pitches_path, alert: "you are not an ideator"
redirect_to pitches_path, alert: "He is not an idea consultant"
else
redirect_to pitches_path, notice: "The form has been submitted successfuly"
end
end

#This method is to post the evaluation
#Author: Mariam Afifi
def submitTheEvaluation
@pitch = Pitch.find(params[:id])
if current_user.is_Idea_Consultant
current_user.evalutions.create(pitch: @pitch, comment: params[:Evaluate])
redirect_to @pitch, notice: "your evaluation has been posted"
else
redirect_to @pitch, alert: "you are not allowed to evaluate"
end
end

end
4 changes: 4 additions & 0 deletions Project/app/models/evalution.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
class Evalution < ActiveRecord::Base
belongs_to :user
belongs_to :pitch
end
1 change: 1 addition & 0 deletions Project/app/models/pitch.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
class Pitch < ActiveRecord::Base
has_many :evalutions
def user
return User.find_by_email(self.email)
end
Expand Down
2 changes: 1 addition & 1 deletion Project/app/models/user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ class User < ActiveRecord::Base
# :confirmable, :lockable, :timeoutable and :omniauthable
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :trackable, :validatable

has_many :evalutions
def active_for_authentication?
super && approved?
end
Expand Down
20 changes: 19 additions & 1 deletion Project/app/views/pitches/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,24 @@
<h3>URL</h3>
<h4><b><%= @pitch.link %></b></h4>


<% @pitch.evalutions.each do |eval| %>
<tr style="margin-top:20px;">
<p>Evaluator: </p>
<p><%= eval.user.email %></p>
<p>Evalution:</p>
<p><%= eval.comment %></p>
<% end %>

<%= link_to 'Evaluate Idea Consultant', evaluateIdeaConsultant_pitch_path(@pitch) %>
<form action="<%= submitTheEvaluation_pitch_path(@pitch) %>" id="EvaluateTheIdea" method="post" onsubmit="return ValidateForm(this);">
<label for="Evaluate">Evaluate The Idea</label><br />
<textarea name="Evaluate" rows="5" cols="40" style="width: 500px;"></textarea>
<br />
<div style="float: middle">

<input name="post" type="submit" value="Post" />

<hr>
<div align="center">
<% if current_user.is_Idea_Consultant %>
Expand Down Expand Up @@ -120,5 +138,5 @@
<%= link_to 'Edit', edit_pitch_path(@pitch) %>
-->

<%= link_to 'Evaluate Idea Consultant', evaluateIdeaConsultant_pitch_path(@pitch) %>

</div>
1 change: 1 addition & 0 deletions Project/config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
member do
get 'evaluateIdeaConsultant'
get 'submitTheForm'
post 'submitTheEvaluation'
end
end

Expand Down
11 changes: 11 additions & 0 deletions Project/db/migrate/20150430181037_create_evalutions.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
class CreateEvalutions < ActiveRecord::Migration
def change
create_table :evalutions do |t|
t.integer :user_id
t.integer :pitch_id
t.text :comment

t.timestamps null: false
end
end
end
10 changes: 9 additions & 1 deletion Project/db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema.define(version: 20150407221912) do
ActiveRecord::Schema.define(version: 20150430181037) do

create_table "consultancies", force: :cascade do |t|
t.integer "pitch_id"
Expand All @@ -22,6 +22,14 @@
t.datetime "updated_at", null: false
end

create_table "evalutions", force: :cascade do |t|
t.integer "user_id"
t.integer "pitch_id"
t.text "comment"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end

create_table "events", force: :cascade do |t|
t.string "title"
t.string "description"
Expand Down
36 changes: 21 additions & 15 deletions Project/db/seeds.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,32 @@
# cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }])
# Mayor.create(name: 'Emanuel', city: cities.first)

user = User.new( :email => 'hisen94@hotmail.com', :password => '12345678')
user.approved = true
user.save!
# user = User.new( :email => 'hisen94@hotmail.com', :password => '12345678')
# user.approved = true
# user.save!



admin_user1 = User.new( :email => 'nageeb94@hotmail.com', :password => '12345678')
admin_user1.admin = true
admin_user1.approved = true
admin_user1.save!
# admin_user1 = User.new( :email => 'nageeb94@hotmail.com', :password => '12345678')
# admin_user1.admin = true
# admin_user1.approved = true
# admin_user1.save!

user = User.new( :email => 'jirobeno@hotmail.com', :password => '12345678')
user.is_Ideator = true
user.approved = true
user.save!
# user = User.new( :email => 'jirobeno@hotmail.com', :password => '12345678')
# user.is_Ideator = true
# user.approved = true
# user.save!




ideator_user1 = User.new( :email => 'mariam3fifi@hotmail.com', :password => '12345678')
ideator_user1.is_Ideator = true
ideator_user1.approved = true
ideator_user1.save!
# ideator_user1 = User.new( :email => 'mariam3fifi@hotmail.com', :password => '12345678')
# ideator_user1.is_Ideator = true
# ideator_user1.approved = true
# ideator_user1.save!


ideaConsultant_user1 = User.new( :email => 'MariamAyman@hotmail.com', :password => '12345678')
ideaConsultant_user1.is_Idea_Consultant = true
ideaConsultant_user1.approved = true
ideaConsultant_user1.save!
9 changes: 9 additions & 0 deletions Project/test/fixtures/evalutions.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html

one:
refrences:
text:

two:
refrences:
text:
7 changes: 7 additions & 0 deletions Project/test/models/evalution_test.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
require 'test_helper'

class EvalutionTest < ActiveSupport::TestCase
# test "the truth" do
# assert true
# end
end

0 comments on commit 5218c89

Please sign in to comment.