Skip to content

Commit

Permalink
adding dropdown menu to add to collections
Browse files Browse the repository at this point in the history
  • Loading branch information
ingridh committed Apr 17, 2015
1 parent a2c86ef commit 05e6524
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 23 deletions.
4 changes: 4 additions & 0 deletions app/assets/stylesheets/application.scss
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,10 @@ li#navbar {
background: #EBF4FA;
padding: 10px;
}
#thetextarea {
height: 100%;
width: 100%;
}

ol.questions { list-style-type: none; }
li.question { page-break-inside: avoid; }
Expand Down
4 changes: 1 addition & 3 deletions app/controllers/problems_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,7 @@ def index
def add_to_collection
collection = Collection.find(params[:collection_id])
if not collection
flash[:notice] = 'Collection does not exist'
flash.keep
redirect_to problems_path
render :json => {:status => false}
return
end
problem_to_add = Problem.find(params[:id])
Expand Down
2 changes: 1 addition & 1 deletion app/views/collections/export.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@

%h1 Copy the html code into clipboard.(preferably a button to allow users to automatically copy to clipboard)

%textarea{:wrap => 'hard', :cols => '200', :rows => '100', 'readonly' => 'true'}
%textarea{:wrap => 'hard', 'readonly' => 'true', :id => "thetextarea"}
= @html_code
18 changes: 6 additions & 12 deletions app/views/shared/_problems_table.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,8 @@
%thead
%tr
%th Question Text
%th Date Created
%th Collections
%th Tags
%th Created By
%th
-if problems_index
Add to:
Expand All @@ -16,16 +14,12 @@
%tbody
- problems.each do |problem|
%tr
%td= problem.html5.html_safe
%td= problem.created_date
- collstring = ""
-problem.collections.each do |coll|
-collstring << coll.name + " "
%td= collstring
- collstring = ""
-problem.tags.each {|tag| collstring << tag.name + " " }
%td= collstring
%td= problem.instructor.name
%td
= problem.html5.html_safe
= "Created Date: " + problem.created_date.to_s + " | "
= "Created By: " + problem.instructor.name
%td= problem.collections.map {|collection| collection.name + ', '}.join
%td= problem.tags.map {|tags| tags.name + ', '}.join
%td
-if problems_index
/ =link_to "add to #{Collection.find(@current_user.current_collection).name} (current)", add_problem_path(:id => problem.id, :collection_id => @current_user.current_collection), {:id => "problem_#{problem.id}"}
Expand Down
Binary file modified coursequestionbank_test
Binary file not shown.
9 changes: 2 additions & 7 deletions db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,14 @@
ActiveRecord::Schema.define(:version => 20150416230134) do

create_table "collections", :force => true do |t|
t.integer "instructor_id"
t.string "name"
t.datetime "last_used"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.integer "instructor_id"
t.text "description"
end

create_table "collections_instructors", :id => false, :force => true do |t|
t.integer "collection_id"
t.integer "instructor_id"
end

create_table "collections_problems", :id => false, :force => true do |t|
t.integer "collection_id"
t.integer "problem_id"
Expand All @@ -44,7 +39,7 @@

create_table "problems", :force => true do |t|
t.integer "instructor_id"
t.string "text"
t.text "text"
t.datetime "created_date"
t.string "created_by"
t.boolean "is_public"
Expand Down

0 comments on commit 05e6524

Please sign in to comment.