<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.expertiza.ncsu.edu/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Amozumd</id>
	<title>Expertiza_Wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.expertiza.ncsu.edu/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Amozumd"/>
	<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=Special:Contributions/Amozumd"/>
	<updated>2026-07-13T23:04:02Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.41.0</generator>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_E1585_Use_Ajax_for_Add_Participants,_Add_TA_,Edit_Questionnaires_Screens&amp;diff=100275</id>
		<title>CSC/ECE 517 Fall 2015 E1585 Use Ajax for Add Participants, Add TA ,Edit Questionnaires Screens</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_E1585_Use_Ajax_for_Add_Participants,_Add_TA_,Edit_Questionnaires_Screens&amp;diff=100275"/>
		<updated>2015-12-05T03:40:42Z</updated>

		<summary type="html">&lt;p&gt;Amozumd: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Overall Design==&lt;br /&gt;
===Purpose===&lt;br /&gt;
On some of the views, whenever a user adds or modifies an existing record, the system is saving the entire page and then reloading the entire page back. This is an inefficient way of saving, especially if only one attribute has been modified. Our goal is to modify the views and use AJAX, so that only the newly added information is saved and not the entire page.&lt;br /&gt;
For instance, when a new participant is added for an assignment, the list of participants should be appended dynamically, without reloading the whole page.&lt;br /&gt;
&lt;br /&gt;
We will be altering the views for the following scenarios&lt;br /&gt;
&lt;br /&gt;
# Add Participants to an assignment&lt;br /&gt;
# Edit questionnaire&lt;br /&gt;
# Add TA to an existing course&lt;br /&gt;
&lt;br /&gt;
===Scope and Documentation===&lt;br /&gt;
Upon careful investigation, we find that the following views need to be modified&lt;br /&gt;
&lt;br /&gt;
# participant/list.html.erb&lt;br /&gt;
# course/view_teaching_assistants.html.erb&lt;br /&gt;
# questionnaires/edit.html.erb&lt;br /&gt;
&lt;br /&gt;
Partial views which were modified&lt;br /&gt;
#views/course/_add_individual.html.erb&lt;br /&gt;
#views/participants/_participant.html.erb&lt;br /&gt;
#views/questionnaires/_questionnaire.html.erb&lt;br /&gt;
&lt;br /&gt;
New partials are created to reflect the changes&lt;br /&gt;
#views/questionnaires/_edit.html.erb&lt;br /&gt;
#views/questionnaires/_add_quests.html.erb&lt;br /&gt;
#views/course/_ta.html.erb&lt;br /&gt;
&lt;br /&gt;
New files are created to render the partial views&lt;br /&gt;
#views/course/add_ta.js.erb&lt;br /&gt;
#views/participants/add.js.erb&lt;br /&gt;
#views/questionnaires/add_new_questions.js.erb&lt;br /&gt;
#questionnaires/save_all_questions.js.erb&lt;br /&gt;
#views/questionnaires/update.js.erb&lt;br /&gt;
&lt;br /&gt;
The following controller files are also modified&lt;br /&gt;
#controllers/course_controller.rb&lt;br /&gt;
#controllers/questionnaires_controller.rb&lt;br /&gt;
#controllers/participants_controller.rb&lt;br /&gt;
&lt;br /&gt;
The documents that will be generated for this project are the design document, the actual files that we edit or create, and a ReadMe that explains what we did and how to use the modified product.&lt;br /&gt;
&lt;br /&gt;
===AJAX===&lt;br /&gt;
Ajax is the acronym for Asynchronous Javascript and XML. It is not a programming language or a tool but a concept. Using Ajax allows us to update parts of web page without updating the entire page. Ajax requires basic understanding of HTML and Javascript. Ajax is a client side script which communicates with a server without sharing the entire page over again. It allows web pages to be updated asynchronously by exchanging small pieces of information with the server. It is not visible to the user, but works on the back end. The general web pages which do not use Ajax, load the entire page over when part of new information is added. &lt;br /&gt;
Applications where AJAX is used: Google Maps, Gmail, Twitter, Facebook. Ajax is very popular now, and the reason being its user friendliness, increased speed of web page updating and efficiency is increased as well.&lt;br /&gt;
&lt;br /&gt;
Functionality of Ajax could be understood by the following diagram:&lt;br /&gt;
&lt;br /&gt;
[[File:AJAX.png]]&lt;br /&gt;
&lt;br /&gt;
==Interface and Testing==&lt;br /&gt;
Our project will modify the existing views. After modification, the views’ look and feel should remain same as before. The rendering should be faster with lesser data sent to and from the server.&lt;br /&gt;
&lt;br /&gt;
===Sample of Code Changes===&lt;br /&gt;
====Changes in  app/controllers/participants_controller.rb====&lt;br /&gt;
These are the server side modifications.&lt;br /&gt;
&lt;br /&gt;
The following line is removed&lt;br /&gt;
&lt;br /&gt;
 redirect_to :action =&amp;gt; 'list', :id =&amp;gt; curr_object.id, :model =&amp;gt; params[:model], :authorization =&amp;gt; params[:authorization] &lt;br /&gt;
&lt;br /&gt;
The following lines are added &lt;br /&gt;
&lt;br /&gt;
   respond_to do |format|&lt;br /&gt;
   if curr_object.save&lt;br /&gt;
     format.html { redirect_to :action =&amp;gt; 'list', :id =&amp;gt; curr_object.id, :model =&amp;gt; params[:model], :authorization =&amp;gt; params[:authorization] }&lt;br /&gt;
     format.js   {}&lt;br /&gt;
     #format.json { render json: @participant, status: :created, location: @participant }&lt;br /&gt;
   else&lt;br /&gt;
     format.html { render action: &amp;quot;list&amp;quot; }&lt;br /&gt;
     #format.json { render json: @participant.errors, status: :unprocessable_entity }&lt;br /&gt;
   end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
====Added a new partial app/views/participants/_participant.html.erb====&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;div class=&amp;quot;exp&amp;quot;&amp;gt;&lt;br /&gt;
 &amp;lt;% @user_id = [] %&amp;gt;&lt;br /&gt;
 user = User.find(participant.user_id) %&amp;gt;&lt;br /&gt;
   &amp;lt;% @user_id &amp;lt;&amp;lt; participant.user_id %&amp;gt;&lt;br /&gt;
 &amp;lt;tr class= &amp;quot;exp&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;td &amp;gt;&amp;lt;%= link_to user.name, :controller=&amp;gt; 'users', :action =&amp;gt; 'show', :id =&amp;gt; user.id %&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td &amp;gt;&amp;lt;%= user.fullname %&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td &amp;gt;&amp;lt;%= user.email %&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td &amp;gt;&amp;lt;%= link_to user.role.name, :controller =&amp;gt; 'roles', :action =&amp;gt; 'show', :id =&amp;gt; user.role.id %&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td  align=&amp;quot;center&amp;quot;&amp;gt;&amp;lt;%= (User.find(user.parent_id)).name %&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td &amp;gt;&amp;lt;%= User.yesorno(user.email_on_review) %&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td &amp;gt;&amp;lt;%= User.yesorno(user.email_on_submission) %&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td &amp;gt;&amp;lt;%= User.yesorno(user.email_on_review_of_review) %&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td &amp;gt;&amp;lt;%= participant.can_submit == false ? 'no' : 'yes' %&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td &amp;gt;&amp;lt;%= participant.can_review == false ? 'no' : 'yes' %&amp;gt;&amp;lt;/td&amp;gt;  &lt;br /&gt;
    &amp;lt;td &amp;gt;&amp;lt;%= participant.can_take_quiz == false ? 'no' : 'yes' %&amp;gt;&amp;lt;/td&amp;gt;  &lt;br /&gt;
    &amp;lt;td &amp;gt;&amp;lt;%= participant.handle %&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
           &lt;br /&gt;
    &amp;lt;td &amp;gt;&amp;lt;%= link_to 'Remove', {:controller =&amp;gt; controller, :action =&amp;gt; 'destroy', :id =&amp;gt; participant.id}, :method =&amp;gt; :delete %&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;!-- E726 Fall2012 Changes Begin --&amp;gt;&lt;br /&gt;
    &amp;lt;% authorization = Participant.get_authorization(participant.can_submit, participant.can_review, participant.can_take_quiz) %&amp;gt;&lt;br /&gt;
    &amp;lt;% if authorization =='reader' %&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;&amp;lt;%= fa_icon 'book', title: 'reader' %&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;% else %&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;% end %&amp;gt;&lt;br /&gt;
    &amp;lt;!-- E726 Fall2012 Changes End --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;td&amp;gt;&lt;br /&gt;
      &amp;lt;%= form_tag :controller=&amp;gt;'participants', :action=&amp;gt;'update_authorizations', :id =&amp;gt; participant.id do %&amp;gt;&lt;br /&gt;
        &amp;lt;% params[:authorization] = authorization %&amp;gt;&lt;br /&gt;
        &amp;lt;select id=&amp;lt;%=participant.user_id%&amp;gt; name=&amp;quot;authorization&amp;quot; style=&amp;quot;font-size:12px&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
          &amp;lt;option value=&amp;quot;participant&amp;quot; &lt;br /&gt;
            &amp;lt;% if params[:authorization] == &amp;quot;participant&amp;quot; -%&amp;gt;&lt;br /&gt;
              selected&lt;br /&gt;
            &amp;lt;% end -%&amp;gt;&lt;br /&gt;
          &amp;gt;participant&amp;lt;/option&amp;gt;&lt;br /&gt;
          &amp;lt;option value=&amp;quot;reader&amp;quot;&lt;br /&gt;
            &amp;lt;% if params[:authorization] == &amp;quot;reader&amp;quot; -%&amp;gt;&lt;br /&gt;
              selected&lt;br /&gt;
            &amp;lt;% end -%&amp;gt;&lt;br /&gt;
          &amp;gt;reader&amp;lt;/option&amp;gt;&lt;br /&gt;
          &amp;lt;option value=&amp;quot;reviewer&amp;quot;&lt;br /&gt;
            &amp;lt;% if params[:authorization] == &amp;quot;reviewer&amp;quot; -%&amp;gt;&lt;br /&gt;
              selected&lt;br /&gt;
            &amp;lt;% end -%&amp;gt;&lt;br /&gt;
          &amp;gt;reviewer&amp;lt;/option&amp;gt;&lt;br /&gt;
          &amp;lt;option value=&amp;quot;submitter&amp;quot;&lt;br /&gt;
            &amp;lt;% if params[:authorization] == &amp;quot;submitter&amp;quot; -%&amp;gt;&lt;br /&gt;
              selected&lt;br /&gt;
            &amp;lt;% end -%&amp;gt;&lt;br /&gt;
          &amp;gt;submitter&amp;lt;/option&amp;gt;&lt;br /&gt;
        &amp;lt;/select&amp;gt;&lt;br /&gt;
        &amp;lt;%= button_tag &amp;quot;Submit&amp;quot;, {:id=&amp;gt;'button'+participant.user_id.to_s,:style=&amp;gt;&amp;quot;font-size:12px; display:none;&amp;quot;} %&amp;gt;&lt;br /&gt;
      &amp;lt;% end %&amp;gt;&lt;br /&gt;
    &amp;lt;/td&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
  &amp;lt;/tr&amp;gt;&lt;br /&gt;
 &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Added app/views/participants/add.js.erb====&lt;br /&gt;
This is added to render the new partial view&lt;br /&gt;
&lt;br /&gt;
 $('#mytable').append('&amp;lt;%= j render partial: “participant”, locals: {participant: @participant} %&amp;gt;');&lt;br /&gt;
&lt;br /&gt;
====Modified app/views/shared_scripts/_add_individual.html.erb====&lt;br /&gt;
&lt;br /&gt;
Removed the line&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;%= form_tag :action =&amp;gt; form_action, :method =&amp;gt; 'post' do %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Added the line. :remote =&amp;gt; true is added to the built-in Ruby helpers. These are the Rails &amp;quot;AJAX helpers&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;%= form_tag form_action, :remote =&amp;gt; true, :method =&amp;gt; 'post' do %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Modified app/views/shared_scripts/_user_list.html.erb====&lt;br /&gt;
&lt;br /&gt;
Modified the &amp;lt; table &amp;gt; tag to include an id tag which is used in add.js.erb to append to the current table. &lt;br /&gt;
 &amp;lt; table class = &amp;quot;exp&amp;quot;, id = 'mytable' &amp;gt;&lt;br /&gt;
&lt;br /&gt;
===To test add participants:===&lt;br /&gt;
# Login in as instructor.&lt;br /&gt;
# Create a new assignment and save it.&lt;br /&gt;
# Go to Manage -&amp;gt; Assignments, you should see your newly added assignment here.&lt;br /&gt;
# Now click on ’Add participants’ button available in the list of actions for the assignment, which will direct you to the page which lists all the participants of an assignment. Here you will have the option to add a new participant.&lt;br /&gt;
&lt;br /&gt;
[[File:AssgnPart.png]]&lt;br /&gt;
&lt;br /&gt;
===To test editing questionnaire===&lt;br /&gt;
# Login in as instructor.&lt;br /&gt;
# Go to Manage -&amp;gt; Questionnaires. Create a new Review Questionnaire by clicking on the ‘New public item’ button for ‘Review’.&lt;br /&gt;
# Name the Questionnaire and click on create button&lt;br /&gt;
# Click on Edit for newly created questionnaire.&lt;br /&gt;
&lt;br /&gt;
[[File:Questionnaire.png]]&lt;br /&gt;
&lt;br /&gt;
===To test adding TA===&lt;br /&gt;
# Login in as instructor.&lt;br /&gt;
# Go to Manage -&amp;gt; Courses, you should see the list of courses already present in the Expertiza.&lt;br /&gt;
# Now click on ’Add TA’ button available in the list of actions for the course, which will direct you to the page which lists all the TAs of a course. Through this page, we can add new TAs as well.&lt;br /&gt;
&lt;br /&gt;
[[File:TA.png]]&lt;br /&gt;
&lt;br /&gt;
==Assumptions==&lt;br /&gt;
This project only modifies the way that views rendered to the user. It also demands scripting some server side code to handle the requests. We do not implement anything beyond this.&lt;br /&gt;
&lt;br /&gt;
==Portability==&lt;br /&gt;
The system is portable on windows and UNIX environment. After our modification, it can continue running on both Windows and UNIX environment.&lt;br /&gt;
&lt;br /&gt;
==Details of Requirements==&lt;br /&gt;
===Hardware requirements===&lt;br /&gt;
* Computing Power: The amount of computing power would be the same as the current Expertiza system.&lt;br /&gt;
&lt;br /&gt;
* Memory: The amount of memory would be the same as the current Expertiza system.&lt;br /&gt;
&lt;br /&gt;
* Disk Storage: The amount of disk storage would be the same as the current Expertiza system.&lt;br /&gt;
&lt;br /&gt;
* Peripherals: The peripherals would be the same as the current Expertiza system.&lt;br /&gt;
&lt;br /&gt;
* Network: The network would be the same as the current Expertiza system.&lt;br /&gt;
&lt;br /&gt;
===Software requirements===&lt;br /&gt;
* Operating system environment : The operating system can be either windows or UNIX based OS.  Both are now used in the current Expertiza system.&lt;br /&gt;
&lt;br /&gt;
* Networking environment: As used in the current Expertiza system&lt;br /&gt;
&lt;br /&gt;
* Tools: Ruby Mines, Git&lt;br /&gt;
&lt;br /&gt;
===References===&lt;br /&gt;
&lt;br /&gt;
1. http://www.w3schools.com/Ajax/ajax_intro.asp&lt;br /&gt;
&lt;br /&gt;
2. http://www.seguetech.com/blog/2013/03/12/what-is-ajax-and-where-is-it-used-in-technology&lt;br /&gt;
&lt;br /&gt;
3. http://www.tutorialspoint.com/ajax/what_is_ajax.htm&lt;/div&gt;</summary>
		<author><name>Amozumd</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Questionnaire.png&amp;diff=100274</id>
		<title>File:Questionnaire.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Questionnaire.png&amp;diff=100274"/>
		<updated>2015-12-05T03:39:29Z</updated>

		<summary type="html">&lt;p&gt;Amozumd: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Amozumd</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_E1585_Use_Ajax_for_Add_Participants,_Add_TA_,Edit_Questionnaires_Screens&amp;diff=100060</id>
		<title>CSC/ECE 517 Fall 2015 E1585 Use Ajax for Add Participants, Add TA ,Edit Questionnaires Screens</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_E1585_Use_Ajax_for_Add_Participants,_Add_TA_,Edit_Questionnaires_Screens&amp;diff=100060"/>
		<updated>2015-12-04T03:26:29Z</updated>

		<summary type="html">&lt;p&gt;Amozumd: /* Sample of Code Changes */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Overall Design==&lt;br /&gt;
===Purpose===&lt;br /&gt;
On some of the views, whenever a user adds or modifies an existing record, the system is saving the entire page and then reloading the entire page back. This is an inefficient way of saving, especially if only one attribute has been modified. Our goal is to modify the views and use AJAX, so that only the newly added information is saved and not the entire page.&lt;br /&gt;
For instance, when a new participant is added for an assignment, the list of participants should be appended dynamically, without reloading the whole page.&lt;br /&gt;
&lt;br /&gt;
We will be altering the views for the following scenarios&lt;br /&gt;
&lt;br /&gt;
# Add Participants to an assignment&lt;br /&gt;
# Edit questionnaire&lt;br /&gt;
# Add TA to an existing course&lt;br /&gt;
&lt;br /&gt;
===Scope and Documentation===&lt;br /&gt;
Upon careful investigation, we find that the following views need to be modified&lt;br /&gt;
&lt;br /&gt;
# participant/list.html.erb&lt;br /&gt;
# course/view_teaching_assistants.html.erb&lt;br /&gt;
# questionnaires/edit.html.erb&lt;br /&gt;
&lt;br /&gt;
Partial views which were modified&lt;br /&gt;
#views/course/_add_individual.html.erb&lt;br /&gt;
#views/participants/_participant.html.erb&lt;br /&gt;
#views/questionnaires/_questionnaire.html.erb&lt;br /&gt;
&lt;br /&gt;
New partials are created to reflect the changes&lt;br /&gt;
#views/questionnaires/_edit.html.erb&lt;br /&gt;
#views/questionnaires/_add_quests.html.erb&lt;br /&gt;
#views/course/_ta.html.erb&lt;br /&gt;
&lt;br /&gt;
New files are created to render the partial views&lt;br /&gt;
#views/course/add_ta.js.erb&lt;br /&gt;
#views/participants/add.js.erb&lt;br /&gt;
#views/questionnaires/add_new_questions.js.erb&lt;br /&gt;
#questionnaires/save_all_questions.js.erb&lt;br /&gt;
#views/questionnaires/update.js.erb&lt;br /&gt;
&lt;br /&gt;
The following controller files are also modified&lt;br /&gt;
#controllers/course_controller.rb&lt;br /&gt;
#controllers/questionnaires_controller.rb&lt;br /&gt;
#controllers/participants_controller.rb&lt;br /&gt;
&lt;br /&gt;
The documents that will be generated for this project are the design document, the actual files that we edit or create, and a ReadMe that explains what we did and how to use the modified product.&lt;br /&gt;
&lt;br /&gt;
===AJAX===&lt;br /&gt;
Ajax is the acronym for Asynchronous Javascript and XML. It is not a programming language or a tool but a concept. Using Ajax allows us to update parts of web page without updating the entire page. Ajax requires basic understanding of HTML and Javascript. Ajax is a client side script which communicates with a server without sharing the entire page over again. It allows web pages to be updated asynchronously by exchanging small pieces of information with the server. It is not visible to the user, but works on the back end. The general web pages which do not use Ajax, load the entire page over when part of new information is added. &lt;br /&gt;
Applications where AJAX is used: Google Maps, Gmail, Twitter, Facebook. Ajax is very popular now, and the reason being its user friendliness, increased speed of web page updating and efficiency is increased as well.&lt;br /&gt;
&lt;br /&gt;
Functionality of Ajax could be understood by the following diagram:&lt;br /&gt;
&lt;br /&gt;
[[File:AJAX.png]]&lt;br /&gt;
&lt;br /&gt;
==Interface and Testing==&lt;br /&gt;
Our project will modify the existing views. After modification, the views’ look and feel should remain same as before. The rendering should be faster with lesser data sent to and from the server.&lt;br /&gt;
&lt;br /&gt;
===Sample of Code Changes===&lt;br /&gt;
====Changes in  app/controllers/participants_controller.rb====&lt;br /&gt;
These are the server side modifications.&lt;br /&gt;
&lt;br /&gt;
The following line is removed&lt;br /&gt;
&lt;br /&gt;
 redirect_to :action =&amp;gt; 'list', :id =&amp;gt; curr_object.id, :model =&amp;gt; params[:model], :authorization =&amp;gt; params[:authorization] &lt;br /&gt;
&lt;br /&gt;
The following lines are added &lt;br /&gt;
&lt;br /&gt;
   respond_to do |format|&lt;br /&gt;
   if curr_object.save&lt;br /&gt;
     format.html { redirect_to :action =&amp;gt; 'list', :id =&amp;gt; curr_object.id, :model =&amp;gt; params[:model], :authorization =&amp;gt; params[:authorization] }&lt;br /&gt;
     format.js   {}&lt;br /&gt;
     #format.json { render json: @participant, status: :created, location: @participant }&lt;br /&gt;
   else&lt;br /&gt;
     format.html { render action: &amp;quot;list&amp;quot; }&lt;br /&gt;
     #format.json { render json: @participant.errors, status: :unprocessable_entity }&lt;br /&gt;
   end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
====Added a new partial app/views/participants/_participant.html.erb====&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;div class=&amp;quot;exp&amp;quot;&amp;gt;&lt;br /&gt;
 &amp;lt;% @user_id = [] %&amp;gt;&lt;br /&gt;
 user = User.find(participant.user_id) %&amp;gt;&lt;br /&gt;
   &amp;lt;% @user_id &amp;lt;&amp;lt; participant.user_id %&amp;gt;&lt;br /&gt;
 &amp;lt;tr class= &amp;quot;exp&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;td &amp;gt;&amp;lt;%= link_to user.name, :controller=&amp;gt; 'users', :action =&amp;gt; 'show', :id =&amp;gt; user.id %&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td &amp;gt;&amp;lt;%= user.fullname %&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td &amp;gt;&amp;lt;%= user.email %&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td &amp;gt;&amp;lt;%= link_to user.role.name, :controller =&amp;gt; 'roles', :action =&amp;gt; 'show', :id =&amp;gt; user.role.id %&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td  align=&amp;quot;center&amp;quot;&amp;gt;&amp;lt;%= (User.find(user.parent_id)).name %&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td &amp;gt;&amp;lt;%= User.yesorno(user.email_on_review) %&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td &amp;gt;&amp;lt;%= User.yesorno(user.email_on_submission) %&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td &amp;gt;&amp;lt;%= User.yesorno(user.email_on_review_of_review) %&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td &amp;gt;&amp;lt;%= participant.can_submit == false ? 'no' : 'yes' %&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td &amp;gt;&amp;lt;%= participant.can_review == false ? 'no' : 'yes' %&amp;gt;&amp;lt;/td&amp;gt;  &lt;br /&gt;
    &amp;lt;td &amp;gt;&amp;lt;%= participant.can_take_quiz == false ? 'no' : 'yes' %&amp;gt;&amp;lt;/td&amp;gt;  &lt;br /&gt;
    &amp;lt;td &amp;gt;&amp;lt;%= participant.handle %&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
           &lt;br /&gt;
    &amp;lt;td &amp;gt;&amp;lt;%= link_to 'Remove', {:controller =&amp;gt; controller, :action =&amp;gt; 'destroy', :id =&amp;gt; participant.id}, :method =&amp;gt; :delete %&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;!-- E726 Fall2012 Changes Begin --&amp;gt;&lt;br /&gt;
    &amp;lt;% authorization = Participant.get_authorization(participant.can_submit, participant.can_review, participant.can_take_quiz) %&amp;gt;&lt;br /&gt;
    &amp;lt;% if authorization =='reader' %&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;&amp;lt;%= fa_icon 'book', title: 'reader' %&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;% else %&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;% end %&amp;gt;&lt;br /&gt;
    &amp;lt;!-- E726 Fall2012 Changes End --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;td&amp;gt;&lt;br /&gt;
      &amp;lt;%= form_tag :controller=&amp;gt;'participants', :action=&amp;gt;'update_authorizations', :id =&amp;gt; participant.id do %&amp;gt;&lt;br /&gt;
        &amp;lt;% params[:authorization] = authorization %&amp;gt;&lt;br /&gt;
        &amp;lt;select id=&amp;lt;%=participant.user_id%&amp;gt; name=&amp;quot;authorization&amp;quot; style=&amp;quot;font-size:12px&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
          &amp;lt;option value=&amp;quot;participant&amp;quot; &lt;br /&gt;
            &amp;lt;% if params[:authorization] == &amp;quot;participant&amp;quot; -%&amp;gt;&lt;br /&gt;
              selected&lt;br /&gt;
            &amp;lt;% end -%&amp;gt;&lt;br /&gt;
          &amp;gt;participant&amp;lt;/option&amp;gt;&lt;br /&gt;
          &amp;lt;option value=&amp;quot;reader&amp;quot;&lt;br /&gt;
            &amp;lt;% if params[:authorization] == &amp;quot;reader&amp;quot; -%&amp;gt;&lt;br /&gt;
              selected&lt;br /&gt;
            &amp;lt;% end -%&amp;gt;&lt;br /&gt;
          &amp;gt;reader&amp;lt;/option&amp;gt;&lt;br /&gt;
          &amp;lt;option value=&amp;quot;reviewer&amp;quot;&lt;br /&gt;
            &amp;lt;% if params[:authorization] == &amp;quot;reviewer&amp;quot; -%&amp;gt;&lt;br /&gt;
              selected&lt;br /&gt;
            &amp;lt;% end -%&amp;gt;&lt;br /&gt;
          &amp;gt;reviewer&amp;lt;/option&amp;gt;&lt;br /&gt;
          &amp;lt;option value=&amp;quot;submitter&amp;quot;&lt;br /&gt;
            &amp;lt;% if params[:authorization] == &amp;quot;submitter&amp;quot; -%&amp;gt;&lt;br /&gt;
              selected&lt;br /&gt;
            &amp;lt;% end -%&amp;gt;&lt;br /&gt;
          &amp;gt;submitter&amp;lt;/option&amp;gt;&lt;br /&gt;
        &amp;lt;/select&amp;gt;&lt;br /&gt;
        &amp;lt;%= button_tag &amp;quot;Submit&amp;quot;, {:id=&amp;gt;'button'+participant.user_id.to_s,:style=&amp;gt;&amp;quot;font-size:12px; display:none;&amp;quot;} %&amp;gt;&lt;br /&gt;
      &amp;lt;% end %&amp;gt;&lt;br /&gt;
    &amp;lt;/td&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
  &amp;lt;/tr&amp;gt;&lt;br /&gt;
 &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Added app/views/participants/add.js.erb====&lt;br /&gt;
This is added to render the new partial view&lt;br /&gt;
&lt;br /&gt;
 $('#mytable').append('&amp;lt;%= j render partial: “participant”, locals: {participant: @participant} %&amp;gt;');&lt;br /&gt;
&lt;br /&gt;
====Modified app/views/shared_scripts/_add_individual.html.erb====&lt;br /&gt;
&lt;br /&gt;
Removed the line&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;%= form_tag :action =&amp;gt; form_action, :method =&amp;gt; 'post' do %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Added the line. :remote =&amp;gt; true is added to the built-in Ruby helpers. These are the Rails &amp;quot;AJAX helpers&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;%= form_tag form_action, :remote =&amp;gt; true, :method =&amp;gt; 'post' do %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Modified app/views/shared_scripts/_user_list.html.erb====&lt;br /&gt;
&lt;br /&gt;
Modified the &amp;lt; table &amp;gt; tag to include an id tag which is used in add.js.erb to append to the current table. &lt;br /&gt;
 &amp;lt; table class = &amp;quot;exp&amp;quot;, id = 'mytable' &amp;gt;&lt;br /&gt;
&lt;br /&gt;
===To test add participants:===&lt;br /&gt;
# Login in as instructor.&lt;br /&gt;
# Create a new assignment and save it.&lt;br /&gt;
# Go to Manage -&amp;gt; Assignments, you should see your newly added assignment here.&lt;br /&gt;
# Now click on ’Add participants’ button available in the list of actions for the assignment, which will direct you to the page which lists all the participants of an assignment. Here you will have the option to add a new participant.&lt;br /&gt;
&lt;br /&gt;
[[File:AssgnPart.png]]&lt;br /&gt;
&lt;br /&gt;
===To test editing questionnaire===&lt;br /&gt;
# Login in as instructor.&lt;br /&gt;
# Go to Manage -&amp;gt; Questionnaires. Create a new Review Questionnaire by clicking on the ‘New public item’ button for ‘Review’.&lt;br /&gt;
# Name the Questionnaire and click on create button&lt;br /&gt;
# Click on Edit for newly created questionnaire.&lt;br /&gt;
&lt;br /&gt;
[[File:Quest.png]]&lt;br /&gt;
&lt;br /&gt;
===To test adding TA===&lt;br /&gt;
# Login in as instructor.&lt;br /&gt;
# Go to Manage -&amp;gt; Courses, you should see the list of courses already present in the Expertiza.&lt;br /&gt;
# Now click on ’Add TA’ button available in the list of actions for the course, which will direct you to the page which lists all the TAs of a course. Through this page, we can add new TAs as well.&lt;br /&gt;
&lt;br /&gt;
[[File:TA.png]]&lt;br /&gt;
&lt;br /&gt;
==Assumptions==&lt;br /&gt;
This project only modifies the way that views rendered to the user. It also demands scripting some server side code to handle the requests. We do not implement anything beyond this.&lt;br /&gt;
&lt;br /&gt;
==Portability==&lt;br /&gt;
The system is portable on windows and UNIX environment. After our modification, it can continue running on both Windows and UNIX environment.&lt;br /&gt;
&lt;br /&gt;
==Details of Requirements==&lt;br /&gt;
===Hardware requirements===&lt;br /&gt;
* Computing Power: The amount of computing power would be the same as the current Expertiza system.&lt;br /&gt;
&lt;br /&gt;
* Memory: The amount of memory would be the same as the current Expertiza system.&lt;br /&gt;
&lt;br /&gt;
* Disk Storage: The amount of disk storage would be the same as the current Expertiza system.&lt;br /&gt;
&lt;br /&gt;
* Peripherals: The peripherals would be the same as the current Expertiza system.&lt;br /&gt;
&lt;br /&gt;
* Network: The network would be the same as the current Expertiza system.&lt;br /&gt;
&lt;br /&gt;
===Software requirements===&lt;br /&gt;
* Operating system environment : The operating system can be either windows or UNIX based OS.  Both are now used in the current Expertiza system.&lt;br /&gt;
&lt;br /&gt;
* Networking environment: As used in the current Expertiza system&lt;br /&gt;
&lt;br /&gt;
* Tools: Ruby Mines, Git&lt;br /&gt;
&lt;br /&gt;
===References===&lt;br /&gt;
&lt;br /&gt;
1. http://www.w3schools.com/Ajax/ajax_intro.asp&lt;br /&gt;
&lt;br /&gt;
2. http://www.seguetech.com/blog/2013/03/12/what-is-ajax-and-where-is-it-used-in-technology&lt;br /&gt;
&lt;br /&gt;
3. http://www.tutorialspoint.com/ajax/what_is_ajax.htm&lt;/div&gt;</summary>
		<author><name>Amozumd</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_E1585_Use_Ajax_for_Add_Participants,_Add_TA_,Edit_Questionnaires_Screens&amp;diff=100059</id>
		<title>CSC/ECE 517 Fall 2015 E1585 Use Ajax for Add Participants, Add TA ,Edit Questionnaires Screens</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_E1585_Use_Ajax_for_Add_Participants,_Add_TA_,Edit_Questionnaires_Screens&amp;diff=100059"/>
		<updated>2015-12-04T03:23:21Z</updated>

		<summary type="html">&lt;p&gt;Amozumd: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Overall Design==&lt;br /&gt;
===Purpose===&lt;br /&gt;
On some of the views, whenever a user adds or modifies an existing record, the system is saving the entire page and then reloading the entire page back. This is an inefficient way of saving, especially if only one attribute has been modified. Our goal is to modify the views and use AJAX, so that only the newly added information is saved and not the entire page.&lt;br /&gt;
For instance, when a new participant is added for an assignment, the list of participants should be appended dynamically, without reloading the whole page.&lt;br /&gt;
&lt;br /&gt;
We will be altering the views for the following scenarios&lt;br /&gt;
&lt;br /&gt;
# Add Participants to an assignment&lt;br /&gt;
# Edit questionnaire&lt;br /&gt;
# Add TA to an existing course&lt;br /&gt;
&lt;br /&gt;
===Scope and Documentation===&lt;br /&gt;
Upon careful investigation, we find that the following views need to be modified&lt;br /&gt;
&lt;br /&gt;
# participant/list.html.erb&lt;br /&gt;
# course/view_teaching_assistants.html.erb&lt;br /&gt;
# questionnaires/edit.html.erb&lt;br /&gt;
&lt;br /&gt;
Partial views which were modified&lt;br /&gt;
#views/course/_add_individual.html.erb&lt;br /&gt;
#views/participants/_participant.html.erb&lt;br /&gt;
#views/questionnaires/_questionnaire.html.erb&lt;br /&gt;
&lt;br /&gt;
New partials are created to reflect the changes&lt;br /&gt;
#views/questionnaires/_edit.html.erb&lt;br /&gt;
#views/questionnaires/_add_quests.html.erb&lt;br /&gt;
#views/course/_ta.html.erb&lt;br /&gt;
&lt;br /&gt;
New files are created to render the partial views&lt;br /&gt;
#views/course/add_ta.js.erb&lt;br /&gt;
#views/participants/add.js.erb&lt;br /&gt;
#views/questionnaires/add_new_questions.js.erb&lt;br /&gt;
#questionnaires/save_all_questions.js.erb&lt;br /&gt;
#views/questionnaires/update.js.erb&lt;br /&gt;
&lt;br /&gt;
The following controller files are also modified&lt;br /&gt;
#controllers/course_controller.rb&lt;br /&gt;
#controllers/questionnaires_controller.rb&lt;br /&gt;
#controllers/participants_controller.rb&lt;br /&gt;
&lt;br /&gt;
The documents that will be generated for this project are the design document, the actual files that we edit or create, and a ReadMe that explains what we did and how to use the modified product.&lt;br /&gt;
&lt;br /&gt;
===AJAX===&lt;br /&gt;
Ajax is the acronym for Asynchronous Javascript and XML. It is not a programming language or a tool but a concept. Using Ajax allows us to update parts of web page without updating the entire page. Ajax requires basic understanding of HTML and Javascript. Ajax is a client side script which communicates with a server without sharing the entire page over again. It allows web pages to be updated asynchronously by exchanging small pieces of information with the server. It is not visible to the user, but works on the back end. The general web pages which do not use Ajax, load the entire page over when part of new information is added. &lt;br /&gt;
Applications where AJAX is used: Google Maps, Gmail, Twitter, Facebook. Ajax is very popular now, and the reason being its user friendliness, increased speed of web page updating and efficiency is increased as well.&lt;br /&gt;
&lt;br /&gt;
Functionality of Ajax could be understood by the following diagram:&lt;br /&gt;
&lt;br /&gt;
[[File:AJAX.png]]&lt;br /&gt;
&lt;br /&gt;
==Interface and Testing==&lt;br /&gt;
Our project will modify the existing views. After modification, the views’ look and feel should remain same as before. The rendering should be faster with lesser data sent to and from the server.&lt;br /&gt;
&lt;br /&gt;
==Sample of Code Changes==&lt;br /&gt;
===Changes in  app/controllers/participants_controller.rb===&lt;br /&gt;
These are the server side modifications.&lt;br /&gt;
&lt;br /&gt;
The following line is removed&lt;br /&gt;
&lt;br /&gt;
 redirect_to :action =&amp;gt; 'list', :id =&amp;gt; curr_object.id, :model =&amp;gt; params[:model], :authorization =&amp;gt; params[:authorization] &lt;br /&gt;
&lt;br /&gt;
The following lines are added &lt;br /&gt;
&lt;br /&gt;
   respond_to do |format|&lt;br /&gt;
   if curr_object.save&lt;br /&gt;
     format.html { redirect_to :action =&amp;gt; 'list', :id =&amp;gt; curr_object.id, :model =&amp;gt; params[:model], :authorization =&amp;gt; params[:authorization] }&lt;br /&gt;
     format.js   {}&lt;br /&gt;
     #format.json { render json: @participant, status: :created, location: @participant }&lt;br /&gt;
   else&lt;br /&gt;
     format.html { render action: &amp;quot;list&amp;quot; }&lt;br /&gt;
     #format.json { render json: @participant.errors, status: :unprocessable_entity }&lt;br /&gt;
   end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
===Added a new partial app/views/participants/_participant.html.erb===&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;div class=&amp;quot;exp&amp;quot;&amp;gt;&lt;br /&gt;
 &amp;lt;% @user_id = [] %&amp;gt;&lt;br /&gt;
 user = User.find(participant.user_id) %&amp;gt;&lt;br /&gt;
   &amp;lt;% @user_id &amp;lt;&amp;lt; participant.user_id %&amp;gt;&lt;br /&gt;
 &amp;lt;tr class= &amp;quot;exp&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;td &amp;gt;&amp;lt;%= link_to user.name, :controller=&amp;gt; 'users', :action =&amp;gt; 'show', :id =&amp;gt; user.id %&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td &amp;gt;&amp;lt;%= user.fullname %&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td &amp;gt;&amp;lt;%= user.email %&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td &amp;gt;&amp;lt;%= link_to user.role.name, :controller =&amp;gt; 'roles', :action =&amp;gt; 'show', :id =&amp;gt; user.role.id %&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td  align=&amp;quot;center&amp;quot;&amp;gt;&amp;lt;%= (User.find(user.parent_id)).name %&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td &amp;gt;&amp;lt;%= User.yesorno(user.email_on_review) %&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td &amp;gt;&amp;lt;%= User.yesorno(user.email_on_submission) %&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td &amp;gt;&amp;lt;%= User.yesorno(user.email_on_review_of_review) %&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td &amp;gt;&amp;lt;%= participant.can_submit == false ? 'no' : 'yes' %&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td &amp;gt;&amp;lt;%= participant.can_review == false ? 'no' : 'yes' %&amp;gt;&amp;lt;/td&amp;gt;  &lt;br /&gt;
    &amp;lt;td &amp;gt;&amp;lt;%= participant.can_take_quiz == false ? 'no' : 'yes' %&amp;gt;&amp;lt;/td&amp;gt;  &lt;br /&gt;
    &amp;lt;td &amp;gt;&amp;lt;%= participant.handle %&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
           &lt;br /&gt;
    &amp;lt;td &amp;gt;&amp;lt;%= link_to 'Remove', {:controller =&amp;gt; controller, :action =&amp;gt; 'destroy', :id =&amp;gt; participant.id}, :method =&amp;gt; :delete %&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;!-- E726 Fall2012 Changes Begin --&amp;gt;&lt;br /&gt;
    &amp;lt;% authorization = Participant.get_authorization(participant.can_submit, participant.can_review, participant.can_take_quiz) %&amp;gt;&lt;br /&gt;
    &amp;lt;% if authorization =='reader' %&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;&amp;lt;%= fa_icon 'book', title: 'reader' %&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;% else %&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;% end %&amp;gt;&lt;br /&gt;
    &amp;lt;!-- E726 Fall2012 Changes End --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;td&amp;gt;&lt;br /&gt;
      &amp;lt;%= form_tag :controller=&amp;gt;'participants', :action=&amp;gt;'update_authorizations', :id =&amp;gt; participant.id do %&amp;gt;&lt;br /&gt;
        &amp;lt;% params[:authorization] = authorization %&amp;gt;&lt;br /&gt;
        &amp;lt;select id=&amp;lt;%=participant.user_id%&amp;gt; name=&amp;quot;authorization&amp;quot; style=&amp;quot;font-size:12px&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
          &amp;lt;option value=&amp;quot;participant&amp;quot; &lt;br /&gt;
            &amp;lt;% if params[:authorization] == &amp;quot;participant&amp;quot; -%&amp;gt;&lt;br /&gt;
              selected&lt;br /&gt;
            &amp;lt;% end -%&amp;gt;&lt;br /&gt;
          &amp;gt;participant&amp;lt;/option&amp;gt;&lt;br /&gt;
          &amp;lt;option value=&amp;quot;reader&amp;quot;&lt;br /&gt;
            &amp;lt;% if params[:authorization] == &amp;quot;reader&amp;quot; -%&amp;gt;&lt;br /&gt;
              selected&lt;br /&gt;
            &amp;lt;% end -%&amp;gt;&lt;br /&gt;
          &amp;gt;reader&amp;lt;/option&amp;gt;&lt;br /&gt;
          &amp;lt;option value=&amp;quot;reviewer&amp;quot;&lt;br /&gt;
            &amp;lt;% if params[:authorization] == &amp;quot;reviewer&amp;quot; -%&amp;gt;&lt;br /&gt;
              selected&lt;br /&gt;
            &amp;lt;% end -%&amp;gt;&lt;br /&gt;
          &amp;gt;reviewer&amp;lt;/option&amp;gt;&lt;br /&gt;
          &amp;lt;option value=&amp;quot;submitter&amp;quot;&lt;br /&gt;
            &amp;lt;% if params[:authorization] == &amp;quot;submitter&amp;quot; -%&amp;gt;&lt;br /&gt;
              selected&lt;br /&gt;
            &amp;lt;% end -%&amp;gt;&lt;br /&gt;
          &amp;gt;submitter&amp;lt;/option&amp;gt;&lt;br /&gt;
        &amp;lt;/select&amp;gt;&lt;br /&gt;
        &amp;lt;%= button_tag &amp;quot;Submit&amp;quot;, {:id=&amp;gt;'button'+participant.user_id.to_s,:style=&amp;gt;&amp;quot;font-size:12px; display:none;&amp;quot;} %&amp;gt;&lt;br /&gt;
      &amp;lt;% end %&amp;gt;&lt;br /&gt;
    &amp;lt;/td&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
  &amp;lt;/tr&amp;gt;&lt;br /&gt;
 &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Added app/views/participants/add.js.erb===&lt;br /&gt;
This is added to render the new partial view&lt;br /&gt;
&lt;br /&gt;
 $('#mytable').append('&amp;lt;%= j render partial: “participant”, locals: {participant: @participant} %&amp;gt;');&lt;br /&gt;
&lt;br /&gt;
===Modified app/views/shared_scripts/_add_individual.html.erb===&lt;br /&gt;
&lt;br /&gt;
Removed the line&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;%= form_tag :action =&amp;gt; form_action, :method =&amp;gt; 'post' do %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Added the line. :remote =&amp;gt; true is added to the built-in Ruby helpers. These are the Rails &amp;quot;AJAX helpers&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;%= form_tag form_action, :remote =&amp;gt; true, :method =&amp;gt; 'post' do %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Modified app/views/shared_scripts/_user_list.html.erb===&lt;br /&gt;
&lt;br /&gt;
Modified the &amp;lt; table &amp;gt; tag to include an id tag which is used in add.js.erb to append to the current table. &lt;br /&gt;
 &amp;lt; table class = &amp;quot;exp&amp;quot;, id = 'mytable' &amp;gt;&lt;br /&gt;
&lt;br /&gt;
===To test add participants:===&lt;br /&gt;
# Login in as instructor.&lt;br /&gt;
# Create a new assignment and save it.&lt;br /&gt;
# Go to Manage -&amp;gt; Assignments, you should see your newly added assignment here.&lt;br /&gt;
# Now click on ’Add participants’ button available in the list of actions for the assignment, which will direct you to the page which lists all the participants of an assignment. Here you will have the option to add a new participant.&lt;br /&gt;
&lt;br /&gt;
[[File:AssgnPart.png]]&lt;br /&gt;
&lt;br /&gt;
===To test editing questionnaire===&lt;br /&gt;
# Login in as instructor.&lt;br /&gt;
# Go to Manage -&amp;gt; Questionnaires. Create a new Review Questionnaire by clicking on the ‘New public item’ button for ‘Review’.&lt;br /&gt;
# Name the Questionnaire and click on create button&lt;br /&gt;
# Click on Edit for newly created questionnaire.&lt;br /&gt;
&lt;br /&gt;
[[File:Quest.png]]&lt;br /&gt;
&lt;br /&gt;
===To test adding TA===&lt;br /&gt;
# Login in as instructor.&lt;br /&gt;
# Go to Manage -&amp;gt; Courses, you should see the list of courses already present in the Expertiza.&lt;br /&gt;
# Now click on ’Add TA’ button available in the list of actions for the course, which will direct you to the page which lists all the TAs of a course. Through this page, we can add new TAs as well.&lt;br /&gt;
&lt;br /&gt;
[[File:TA.png]]&lt;br /&gt;
&lt;br /&gt;
==Assumptions==&lt;br /&gt;
This project only modifies the way that views rendered to the user. It also demands scripting some server side code to handle the requests. We do not implement anything beyond this.&lt;br /&gt;
&lt;br /&gt;
==Portability==&lt;br /&gt;
The system is portable on windows and UNIX environment. After our modification, it can continue running on both Windows and UNIX environment.&lt;br /&gt;
&lt;br /&gt;
==Details of Requirements==&lt;br /&gt;
===Hardware requirements===&lt;br /&gt;
* Computing Power: The amount of computing power would be the same as the current Expertiza system.&lt;br /&gt;
&lt;br /&gt;
* Memory: The amount of memory would be the same as the current Expertiza system.&lt;br /&gt;
&lt;br /&gt;
* Disk Storage: The amount of disk storage would be the same as the current Expertiza system.&lt;br /&gt;
&lt;br /&gt;
* Peripherals: The peripherals would be the same as the current Expertiza system.&lt;br /&gt;
&lt;br /&gt;
* Network: The network would be the same as the current Expertiza system.&lt;br /&gt;
&lt;br /&gt;
===Software requirements===&lt;br /&gt;
* Operating system environment : The operating system can be either windows or UNIX based OS.  Both are now used in the current Expertiza system.&lt;br /&gt;
&lt;br /&gt;
* Networking environment: As used in the current Expertiza system&lt;br /&gt;
&lt;br /&gt;
* Tools: Ruby Mines, Git&lt;br /&gt;
&lt;br /&gt;
===References===&lt;br /&gt;
&lt;br /&gt;
1. http://www.w3schools.com/Ajax/ajax_intro.asp&lt;br /&gt;
&lt;br /&gt;
2. http://www.seguetech.com/blog/2013/03/12/what-is-ajax-and-where-is-it-used-in-technology&lt;br /&gt;
&lt;br /&gt;
3. http://www.tutorialspoint.com/ajax/what_is_ajax.htm&lt;/div&gt;</summary>
		<author><name>Amozumd</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_E1585_Use_Ajax_for_Add_Participants,_Add_TA_,Edit_Questionnaires_Screens&amp;diff=100058</id>
		<title>CSC/ECE 517 Fall 2015 E1585 Use Ajax for Add Participants, Add TA ,Edit Questionnaires Screens</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_E1585_Use_Ajax_for_Add_Participants,_Add_TA_,Edit_Questionnaires_Screens&amp;diff=100058"/>
		<updated>2015-12-04T03:09:53Z</updated>

		<summary type="html">&lt;p&gt;Amozumd: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Overall Design==&lt;br /&gt;
===Purpose===&lt;br /&gt;
On some of the views, whenever a user adds or modifies an existing record, the system is saving the entire page and then reloading the entire page back. This is an inefficient way of saving, especially if only one attribute has been modified. Our goal is to modify the views and use AJAX, so that only the newly added information is saved and not the entire page.&lt;br /&gt;
For instance, when a new participant is added for an assignment, the list of participants should be appended dynamically, without reloading the whole page.&lt;br /&gt;
&lt;br /&gt;
We will be altering the views for the following scenarios&lt;br /&gt;
&lt;br /&gt;
# Add Participants to an assignment&lt;br /&gt;
# Edit questionnaire&lt;br /&gt;
# Add TA to an existing course&lt;br /&gt;
&lt;br /&gt;
===Scope and Documentation===&lt;br /&gt;
Upon careful investigation, we find that the following views need to be modified&lt;br /&gt;
&lt;br /&gt;
# participant/list.html.erb&lt;br /&gt;
# course/view_teaching_assistants.html.erb&lt;br /&gt;
# questionnaires/edit.html.erb&lt;br /&gt;
&lt;br /&gt;
New partials are created to reflect the changes&lt;br /&gt;
&lt;br /&gt;
New files are created to render the partial views&lt;br /&gt;
&lt;br /&gt;
The following controller files are also modified&lt;br /&gt;
&lt;br /&gt;
The documents that will be generated for this project are the design document, the actual files that we edit or create, and a ReadMe that explains what we did and how to use the modified product.&lt;br /&gt;
&lt;br /&gt;
===AJAX===&lt;br /&gt;
Ajax is the acronym for Asynchronous Javascript and XML. It is not a programming language or a tool but a concept. Using Ajax allows us to update parts of web page without updating the entire page. Ajax requires basic understanding of HTML and Javascript. Ajax is a client side script which communicates with a server without sharing the entire page over again. It allows web pages to be updated asynchronously by exchanging small pieces of information with the server. It is not visible to the user, but works on the back end. The general web pages which do not use Ajax, load the entire page over when part of new information is added. &lt;br /&gt;
Applications where AJAX is used: Google Maps, Gmail, Twitter, Facebook. Ajax is very popular now, and the reason being its user friendliness, increased speed of web page updating and efficiency is increased as well.&lt;br /&gt;
&lt;br /&gt;
Functionality of Ajax could be understood by the following diagram:&lt;br /&gt;
&lt;br /&gt;
[[File:AJAX.png]]&lt;br /&gt;
&lt;br /&gt;
==Interface and Testing==&lt;br /&gt;
Our project will modify the existing views. After modification, the views’ look and feel should remain same as before. The rendering should be faster with lesser data sent to and from the server.&lt;br /&gt;
&lt;br /&gt;
==Sample of Code Changes==&lt;br /&gt;
===Changes in  app/controllers/participants_controller.rb===&lt;br /&gt;
These are the server side modifications.&lt;br /&gt;
&lt;br /&gt;
The following line is removed&lt;br /&gt;
&lt;br /&gt;
 redirect_to :action =&amp;gt; 'list', :id =&amp;gt; curr_object.id, :model =&amp;gt; params[:model], :authorization =&amp;gt; params[:authorization] &lt;br /&gt;
&lt;br /&gt;
The following lines are added &lt;br /&gt;
&lt;br /&gt;
   respond_to do |format|&lt;br /&gt;
   if curr_object.save&lt;br /&gt;
     format.html { redirect_to :action =&amp;gt; 'list', :id =&amp;gt; curr_object.id, :model =&amp;gt; params[:model], :authorization =&amp;gt; params[:authorization] }&lt;br /&gt;
     format.js   {}&lt;br /&gt;
     #format.json { render json: @participant, status: :created, location: @participant }&lt;br /&gt;
   else&lt;br /&gt;
     format.html { render action: &amp;quot;list&amp;quot; }&lt;br /&gt;
     #format.json { render json: @participant.errors, status: :unprocessable_entity }&lt;br /&gt;
   end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
===Added a new partial app/views/participants/_participant.html.erb===&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;div class=&amp;quot;exp&amp;quot;&amp;gt;&lt;br /&gt;
 &amp;lt;% @user_id = [] %&amp;gt;&lt;br /&gt;
 user = User.find(participant.user_id) %&amp;gt;&lt;br /&gt;
   &amp;lt;% @user_id &amp;lt;&amp;lt; participant.user_id %&amp;gt;&lt;br /&gt;
 &amp;lt;tr class= &amp;quot;exp&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;td &amp;gt;&amp;lt;%= link_to user.name, :controller=&amp;gt; 'users', :action =&amp;gt; 'show', :id =&amp;gt; user.id %&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td &amp;gt;&amp;lt;%= user.fullname %&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td &amp;gt;&amp;lt;%= user.email %&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td &amp;gt;&amp;lt;%= link_to user.role.name, :controller =&amp;gt; 'roles', :action =&amp;gt; 'show', :id =&amp;gt; user.role.id %&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td  align=&amp;quot;center&amp;quot;&amp;gt;&amp;lt;%= (User.find(user.parent_id)).name %&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td &amp;gt;&amp;lt;%= User.yesorno(user.email_on_review) %&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td &amp;gt;&amp;lt;%= User.yesorno(user.email_on_submission) %&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td &amp;gt;&amp;lt;%= User.yesorno(user.email_on_review_of_review) %&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td &amp;gt;&amp;lt;%= participant.can_submit == false ? 'no' : 'yes' %&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td &amp;gt;&amp;lt;%= participant.can_review == false ? 'no' : 'yes' %&amp;gt;&amp;lt;/td&amp;gt;  &lt;br /&gt;
    &amp;lt;td &amp;gt;&amp;lt;%= participant.can_take_quiz == false ? 'no' : 'yes' %&amp;gt;&amp;lt;/td&amp;gt;  &lt;br /&gt;
    &amp;lt;td &amp;gt;&amp;lt;%= participant.handle %&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
           &lt;br /&gt;
    &amp;lt;td &amp;gt;&amp;lt;%= link_to 'Remove', {:controller =&amp;gt; controller, :action =&amp;gt; 'destroy', :id =&amp;gt; participant.id}, :method =&amp;gt; :delete %&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;!-- E726 Fall2012 Changes Begin --&amp;gt;&lt;br /&gt;
    &amp;lt;% authorization = Participant.get_authorization(participant.can_submit, participant.can_review, participant.can_take_quiz) %&amp;gt;&lt;br /&gt;
    &amp;lt;% if authorization =='reader' %&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;&amp;lt;%= fa_icon 'book', title: 'reader' %&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;% else %&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;% end %&amp;gt;&lt;br /&gt;
    &amp;lt;!-- E726 Fall2012 Changes End --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;td&amp;gt;&lt;br /&gt;
      &amp;lt;%= form_tag :controller=&amp;gt;'participants', :action=&amp;gt;'update_authorizations', :id =&amp;gt; participant.id do %&amp;gt;&lt;br /&gt;
        &amp;lt;% params[:authorization] = authorization %&amp;gt;&lt;br /&gt;
        &amp;lt;select id=&amp;lt;%=participant.user_id%&amp;gt; name=&amp;quot;authorization&amp;quot; style=&amp;quot;font-size:12px&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
          &amp;lt;option value=&amp;quot;participant&amp;quot; &lt;br /&gt;
            &amp;lt;% if params[:authorization] == &amp;quot;participant&amp;quot; -%&amp;gt;&lt;br /&gt;
              selected&lt;br /&gt;
            &amp;lt;% end -%&amp;gt;&lt;br /&gt;
          &amp;gt;participant&amp;lt;/option&amp;gt;&lt;br /&gt;
          &amp;lt;option value=&amp;quot;reader&amp;quot;&lt;br /&gt;
            &amp;lt;% if params[:authorization] == &amp;quot;reader&amp;quot; -%&amp;gt;&lt;br /&gt;
              selected&lt;br /&gt;
            &amp;lt;% end -%&amp;gt;&lt;br /&gt;
          &amp;gt;reader&amp;lt;/option&amp;gt;&lt;br /&gt;
          &amp;lt;option value=&amp;quot;reviewer&amp;quot;&lt;br /&gt;
            &amp;lt;% if params[:authorization] == &amp;quot;reviewer&amp;quot; -%&amp;gt;&lt;br /&gt;
              selected&lt;br /&gt;
            &amp;lt;% end -%&amp;gt;&lt;br /&gt;
          &amp;gt;reviewer&amp;lt;/option&amp;gt;&lt;br /&gt;
          &amp;lt;option value=&amp;quot;submitter&amp;quot;&lt;br /&gt;
            &amp;lt;% if params[:authorization] == &amp;quot;submitter&amp;quot; -%&amp;gt;&lt;br /&gt;
              selected&lt;br /&gt;
            &amp;lt;% end -%&amp;gt;&lt;br /&gt;
          &amp;gt;submitter&amp;lt;/option&amp;gt;&lt;br /&gt;
        &amp;lt;/select&amp;gt;&lt;br /&gt;
        &amp;lt;%= button_tag &amp;quot;Submit&amp;quot;, {:id=&amp;gt;'button'+participant.user_id.to_s,:style=&amp;gt;&amp;quot;font-size:12px; display:none;&amp;quot;} %&amp;gt;&lt;br /&gt;
      &amp;lt;% end %&amp;gt;&lt;br /&gt;
    &amp;lt;/td&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
  &amp;lt;/tr&amp;gt;&lt;br /&gt;
 &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Added app/views/participants/add.js.erb===&lt;br /&gt;
This is added to render the new partial view&lt;br /&gt;
&lt;br /&gt;
 $('#mytable').append('&amp;lt;%= j render partial: “participant”, locals: {participant: @participant} %&amp;gt;');&lt;br /&gt;
&lt;br /&gt;
===Modified app/views/shared_scripts/_add_individual.html.erb===&lt;br /&gt;
&lt;br /&gt;
Removed the line&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;%= form_tag :action =&amp;gt; form_action, :method =&amp;gt; 'post' do %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Added the line. :remote =&amp;gt; true is added to the built-in Ruby helpers. These are the Rails &amp;quot;AJAX helpers&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;%= form_tag form_action, :remote =&amp;gt; true, :method =&amp;gt; 'post' do %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Modified app/views/shared_scripts/_user_list.html.erb===&lt;br /&gt;
&lt;br /&gt;
Modified the &amp;lt; table &amp;gt; tag to include an id tag which is used in add.js.erb to append to the current table. &lt;br /&gt;
 &amp;lt; table class = &amp;quot;exp&amp;quot;, id = 'mytable' &amp;gt;&lt;br /&gt;
&lt;br /&gt;
===To test add participants:===&lt;br /&gt;
# Login in as instructor.&lt;br /&gt;
# Create a new assignment and save it.&lt;br /&gt;
# Go to Manage -&amp;gt; Assignments, you should see your newly added assignment here.&lt;br /&gt;
# Now click on ’Add participants’ button available in the list of actions for the assignment, which will direct you to the page which lists all the participants of an assignment. Here you will have the option to add a new participant.&lt;br /&gt;
&lt;br /&gt;
[[File:AssgnPart.png]]&lt;br /&gt;
&lt;br /&gt;
===To test editing questionnaire===&lt;br /&gt;
# Login in as instructor.&lt;br /&gt;
# Go to Manage -&amp;gt; Questionnaires. Create a new Review Questionnaire by clicking on the ‘New public item’ button for ‘Review’.&lt;br /&gt;
# Name the Questionnaire and click on create button&lt;br /&gt;
# Click on Edit for newly created questionnaire.&lt;br /&gt;
&lt;br /&gt;
[[File:Quest.png]]&lt;br /&gt;
&lt;br /&gt;
===To test adding TA===&lt;br /&gt;
# Login in as instructor.&lt;br /&gt;
# Go to Manage -&amp;gt; Courses, you should see the list of courses already present in the Expertiza.&lt;br /&gt;
# Now click on ’Add TA’ button available in the list of actions for the course, which will direct you to the page which lists all the TAs of a course. Through this page, we can add new TAs as well.&lt;br /&gt;
&lt;br /&gt;
[[File:TA.png]]&lt;br /&gt;
&lt;br /&gt;
==Assumptions==&lt;br /&gt;
This project only modifies the way that views rendered to the user. It also demands scripting some server side code to handle the requests. We do not implement anything beyond this.&lt;br /&gt;
&lt;br /&gt;
==Portability==&lt;br /&gt;
The system is portable on windows and UNIX environment. After our modification, it can continue running on both Windows and UNIX environment.&lt;br /&gt;
&lt;br /&gt;
==Details of Requirements==&lt;br /&gt;
===Hardware requirements===&lt;br /&gt;
* Computing Power: The amount of computing power would be the same as the current Expertiza system.&lt;br /&gt;
&lt;br /&gt;
* Memory: The amount of memory would be the same as the current Expertiza system.&lt;br /&gt;
&lt;br /&gt;
* Disk Storage: The amount of disk storage would be the same as the current Expertiza system.&lt;br /&gt;
&lt;br /&gt;
* Peripherals: The peripherals would be the same as the current Expertiza system.&lt;br /&gt;
&lt;br /&gt;
* Network: The network would be the same as the current Expertiza system.&lt;br /&gt;
&lt;br /&gt;
===Software requirements===&lt;br /&gt;
* Operating system environment : The operating system can be either windows or UNIX based OS.  Both are now used in the current Expertiza system.&lt;br /&gt;
&lt;br /&gt;
* Networking environment: As used in the current Expertiza system&lt;br /&gt;
&lt;br /&gt;
* Tools: Ruby Mines, Git&lt;br /&gt;
&lt;br /&gt;
===References===&lt;br /&gt;
&lt;br /&gt;
1. http://www.w3schools.com/Ajax/ajax_intro.asp&lt;br /&gt;
&lt;br /&gt;
2. http://www.seguetech.com/blog/2013/03/12/what-is-ajax-and-where-is-it-used-in-technology&lt;br /&gt;
&lt;br /&gt;
3. http://www.tutorialspoint.com/ajax/what_is_ajax.htm&lt;/div&gt;</summary>
		<author><name>Amozumd</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_E1585_Use_Ajax_for_Add_Participants,_Add_TA_,Edit_Questionnaires_Screens&amp;diff=100057</id>
		<title>CSC/ECE 517 Fall 2015 E1585 Use Ajax for Add Participants, Add TA ,Edit Questionnaires Screens</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_E1585_Use_Ajax_for_Add_Participants,_Add_TA_,Edit_Questionnaires_Screens&amp;diff=100057"/>
		<updated>2015-12-04T03:03:05Z</updated>

		<summary type="html">&lt;p&gt;Amozumd: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Overall Design==&lt;br /&gt;
===Purpose===&lt;br /&gt;
On some of the views, whenever a user adds or modifies an existing record, the system is saving the entire page and then reloading the entire page back. This is an inefficient way of saving, especially if only one attribute has been modified. Our goal is to modify the views and use AJAX, so that only the newly added information is saved and not the entire page.&lt;br /&gt;
For instance, when a new participant is added for an assignment, the list of participants should be appended dynamically, without reloading the whole page.&lt;br /&gt;
&lt;br /&gt;
We will be altering the views for the following scenarios&lt;br /&gt;
&lt;br /&gt;
# Add Participants to an assignment&lt;br /&gt;
# Edit questionnaire&lt;br /&gt;
# Add TA to an existing course&lt;br /&gt;
&lt;br /&gt;
===Scope and Documentation===&lt;br /&gt;
Upon careful investigation, we find that the following views need to be modified&lt;br /&gt;
&lt;br /&gt;
# participant/list.html.erb&lt;br /&gt;
# course/view_teaching_assistants.html.erb&lt;br /&gt;
# questionnaires/edit.html.erb&lt;br /&gt;
&lt;br /&gt;
New partials are created to reflect the changes&lt;br /&gt;
&lt;br /&gt;
New files are created to render the partial views&lt;br /&gt;
&lt;br /&gt;
The following controller files are also modified&lt;br /&gt;
&lt;br /&gt;
The documents that will be generated for this project are the design document, the actual files that we edit or create, and a ReadMe that explains what we did and how to use the modified product.&lt;br /&gt;
&lt;br /&gt;
===AJAX===&lt;br /&gt;
Ajax is the acronym for Asynchronous Javascript and XML. It is not a programming language or a tool but a concept. Using Ajax allows us to update parts of web page without updating the entire page. Ajax requires basic understanding of HTML and Javascript. Ajax is a client side script which communicates with a server without sharing the entire page over again. It allows web pages to be updated asynchronously by exchanging small pieces of information with the server. It is not visible to the user, but works on the back end. The general web pages which do not use Ajax, load the entire page over when part of new information is added. &lt;br /&gt;
Applications where AJAX is used: Google Maps, Gmail, Twitter, Facebook. Ajax is very popular now, and the reason being its user friendliness, increased speed of web page updating and efficiency is increased as well.&lt;br /&gt;
&lt;br /&gt;
Functionality of Ajax could be understood by the following diagram:&lt;br /&gt;
&lt;br /&gt;
[[File:AJAX.png]]&lt;br /&gt;
&lt;br /&gt;
==Interface and Testing==&lt;br /&gt;
Our project will modify the existing views. After modification, the views’ look and feel should remain same as before. The rendering should be faster with lesser data sent to and from the server.&lt;br /&gt;
&lt;br /&gt;
==Sample of Code Changes==&lt;br /&gt;
===Changes in  app/controllers/participants_controller.rb===&lt;br /&gt;
These are the server side modifications.&lt;br /&gt;
&lt;br /&gt;
The following line is removed&lt;br /&gt;
&lt;br /&gt;
 redirect_to :action =&amp;gt; 'list', :id =&amp;gt; curr_object.id, :model =&amp;gt; params[:model], :authorization =&amp;gt; params[:authorization] &lt;br /&gt;
&lt;br /&gt;
The following lines are added &lt;br /&gt;
&lt;br /&gt;
   respond_to do |format|&lt;br /&gt;
   if curr_object.save&lt;br /&gt;
     format.html { redirect_to :action =&amp;gt; 'list', :id =&amp;gt; curr_object.id, :model =&amp;gt; params[:model], :authorization =&amp;gt; params[:authorization] }&lt;br /&gt;
     format.js   {}&lt;br /&gt;
     #format.json { render json: @participant, status: :created, location: @participant }&lt;br /&gt;
   else&lt;br /&gt;
     format.html { render action: &amp;quot;list&amp;quot; }&lt;br /&gt;
     #format.json { render json: @participant.errors, status: :unprocessable_entity }&lt;br /&gt;
   end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
===Added a new partial app/views/participants/_participant.html.erb===&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;div class=&amp;quot;exp&amp;quot;&amp;gt;&lt;br /&gt;
 &amp;lt;% @user_id = [] %&amp;gt;&lt;br /&gt;
 user = User.find(participant.user_id) %&amp;gt;&lt;br /&gt;
   &amp;lt;% @user_id &amp;lt;&amp;lt; participant.user_id %&amp;gt;&lt;br /&gt;
 &amp;lt;tr class= &amp;quot;exp&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;td &amp;gt;&amp;lt;%= link_to user.name, :controller=&amp;gt; 'users', :action =&amp;gt; 'show', :id =&amp;gt; user.id %&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td &amp;gt;&amp;lt;%= user.fullname %&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td &amp;gt;&amp;lt;%= user.email %&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td &amp;gt;&amp;lt;%= link_to user.role.name, :controller =&amp;gt; 'roles', :action =&amp;gt; 'show', :id =&amp;gt; user.role.id %&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td  align=&amp;quot;center&amp;quot;&amp;gt;&amp;lt;%= (User.find(user.parent_id)).name %&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td &amp;gt;&amp;lt;%= User.yesorno(user.email_on_review) %&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td &amp;gt;&amp;lt;%= User.yesorno(user.email_on_submission) %&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td &amp;gt;&amp;lt;%= User.yesorno(user.email_on_review_of_review) %&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td &amp;gt;&amp;lt;%= participant.can_submit == false ? 'no' : 'yes' %&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td &amp;gt;&amp;lt;%= participant.can_review == false ? 'no' : 'yes' %&amp;gt;&amp;lt;/td&amp;gt;  &lt;br /&gt;
    &amp;lt;td &amp;gt;&amp;lt;%= participant.can_take_quiz == false ? 'no' : 'yes' %&amp;gt;&amp;lt;/td&amp;gt;  &lt;br /&gt;
    &amp;lt;td &amp;gt;&amp;lt;%= participant.handle %&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
           &lt;br /&gt;
    &amp;lt;td &amp;gt;&amp;lt;%= link_to 'Remove', {:controller =&amp;gt; controller, :action =&amp;gt; 'destroy', :id =&amp;gt; participant.id}, :method =&amp;gt; :delete %&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;!-- E726 Fall2012 Changes Begin --&amp;gt;&lt;br /&gt;
    &amp;lt;% authorization = Participant.get_authorization(participant.can_submit, participant.can_review, participant.can_take_quiz) %&amp;gt;&lt;br /&gt;
    &amp;lt;% if authorization =='reader' %&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;&amp;lt;%= fa_icon 'book', title: 'reader' %&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;% else %&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;% end %&amp;gt;&lt;br /&gt;
    &amp;lt;!-- E726 Fall2012 Changes End --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;td&amp;gt;&lt;br /&gt;
      &amp;lt;%= form_tag :controller=&amp;gt;'participants', :action=&amp;gt;'update_authorizations', :id =&amp;gt; participant.id do %&amp;gt;&lt;br /&gt;
        &amp;lt;% params[:authorization] = authorization %&amp;gt;&lt;br /&gt;
        &amp;lt;select id=&amp;lt;%=participant.user_id%&amp;gt; name=&amp;quot;authorization&amp;quot; style=&amp;quot;font-size:12px&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
          &amp;lt;option value=&amp;quot;participant&amp;quot; &lt;br /&gt;
            &amp;lt;% if params[:authorization] == &amp;quot;participant&amp;quot; -%&amp;gt;&lt;br /&gt;
              selected&lt;br /&gt;
            &amp;lt;% end -%&amp;gt;&lt;br /&gt;
          &amp;gt;participant&amp;lt;/option&amp;gt;&lt;br /&gt;
          &amp;lt;option value=&amp;quot;reader&amp;quot;&lt;br /&gt;
            &amp;lt;% if params[:authorization] == &amp;quot;reader&amp;quot; -%&amp;gt;&lt;br /&gt;
              selected&lt;br /&gt;
            &amp;lt;% end -%&amp;gt;&lt;br /&gt;
          &amp;gt;reader&amp;lt;/option&amp;gt;&lt;br /&gt;
          &amp;lt;option value=&amp;quot;reviewer&amp;quot;&lt;br /&gt;
            &amp;lt;% if params[:authorization] == &amp;quot;reviewer&amp;quot; -%&amp;gt;&lt;br /&gt;
              selected&lt;br /&gt;
            &amp;lt;% end -%&amp;gt;&lt;br /&gt;
          &amp;gt;reviewer&amp;lt;/option&amp;gt;&lt;br /&gt;
          &amp;lt;option value=&amp;quot;submitter&amp;quot;&lt;br /&gt;
            &amp;lt;% if params[:authorization] == &amp;quot;submitter&amp;quot; -%&amp;gt;&lt;br /&gt;
              selected&lt;br /&gt;
            &amp;lt;% end -%&amp;gt;&lt;br /&gt;
          &amp;gt;submitter&amp;lt;/option&amp;gt;&lt;br /&gt;
        &amp;lt;/select&amp;gt;&lt;br /&gt;
        &amp;lt;%= button_tag &amp;quot;Submit&amp;quot;, {:id=&amp;gt;'button'+participant.user_id.to_s,:style=&amp;gt;&amp;quot;font-size:12px; display:none;&amp;quot;} %&amp;gt;&lt;br /&gt;
      &amp;lt;% end %&amp;gt;&lt;br /&gt;
    &amp;lt;/td&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
  &amp;lt;/tr&amp;gt;&lt;br /&gt;
 &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Added app/views/participants/add.js.erb===&lt;br /&gt;
This is added to render the new partial view&lt;br /&gt;
&lt;br /&gt;
 $('#mytable').append('&amp;lt;%= j render partial: “participant”, locals: {participant: @participant} %&amp;gt;');&lt;br /&gt;
&lt;br /&gt;
===Modified app/views/shared_scripts/_add_individual.html.erb===&lt;br /&gt;
&lt;br /&gt;
Removed the line&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;%= form_tag :action =&amp;gt; form_action, :method =&amp;gt; 'post' do %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Added the line. :remote =&amp;gt; true is added to the built-in Ruby helpers. These are the Rails &amp;quot;AJAX helpers&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;%= form_tag form_action, :remote =&amp;gt; true, :method =&amp;gt; 'post' do %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Modified app/views/shared_scripts/_user_list.html.erb===&lt;br /&gt;
&lt;br /&gt;
Removed the line&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Added the line&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;table class = &amp;quot;exp&amp;quot;, id = 'mytable'&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===To test add participants:===&lt;br /&gt;
# Login in as instructor.&lt;br /&gt;
# Create a new assignment and save it.&lt;br /&gt;
# Go to Manage -&amp;gt; Assignments, you should see your newly added assignment here.&lt;br /&gt;
# Now click on ’Add participants’ button available in the list of actions for the assignment, which will direct you to the page which lists all the participants of an assignment. Here you will have the option to add a new participant.&lt;br /&gt;
&lt;br /&gt;
[[File:AssgnPart.png]]&lt;br /&gt;
&lt;br /&gt;
===To test editing questionnaire===&lt;br /&gt;
# Login in as instructor.&lt;br /&gt;
# Go to Manage -&amp;gt; Questionnaires. Create a new Review Questionnaire by clicking on the ‘New public item’ button for ‘Review’.&lt;br /&gt;
# Name the Questionnaire and click on create button&lt;br /&gt;
# Click on Edit for newly created questionnaire.&lt;br /&gt;
&lt;br /&gt;
[[File:Quest.png]]&lt;br /&gt;
&lt;br /&gt;
===To test adding TA===&lt;br /&gt;
# Login in as instructor.&lt;br /&gt;
# Go to Manage -&amp;gt; Courses, you should see the list of courses already present in the Expertiza.&lt;br /&gt;
# Now click on ’Add TA’ button available in the list of actions for the course, which will direct you to the page which lists all the TAs of a course. Through this page, we can add new TAs as well.&lt;br /&gt;
&lt;br /&gt;
[[File:TA.png]]&lt;br /&gt;
&lt;br /&gt;
==Assumptions==&lt;br /&gt;
This project only modifies the way that views rendered to the user. It also demands scripting some server side code to handle the requests. We do not implement anything beyond this.&lt;br /&gt;
&lt;br /&gt;
==Portability==&lt;br /&gt;
The system is portable on windows and UNIX environment. After our modification, it can continue running on both Windows and UNIX environment.&lt;br /&gt;
&lt;br /&gt;
==Details of Requirements==&lt;br /&gt;
===Hardware requirements===&lt;br /&gt;
* Computing Power: The amount of computing power would be the same as the current Expertiza system.&lt;br /&gt;
&lt;br /&gt;
* Memory: The amount of memory would be the same as the current Expertiza system.&lt;br /&gt;
&lt;br /&gt;
* Disk Storage: The amount of disk storage would be the same as the current Expertiza system.&lt;br /&gt;
&lt;br /&gt;
* Peripherals: The peripherals would be the same as the current Expertiza system.&lt;br /&gt;
&lt;br /&gt;
* Network: The network would be the same as the current Expertiza system.&lt;br /&gt;
&lt;br /&gt;
===Software requirements===&lt;br /&gt;
* Operating system environment : The operating system can be either windows or UNIX based OS.  Both are now used in the current Expertiza system.&lt;br /&gt;
&lt;br /&gt;
* Networking environment: As used in the current Expertiza system&lt;br /&gt;
&lt;br /&gt;
* Tools: Ruby Mines, Git&lt;br /&gt;
&lt;br /&gt;
===References===&lt;br /&gt;
&lt;br /&gt;
1. http://www.w3schools.com/Ajax/ajax_intro.asp&lt;br /&gt;
&lt;br /&gt;
2. http://www.seguetech.com/blog/2013/03/12/what-is-ajax-and-where-is-it-used-in-technology&lt;br /&gt;
&lt;br /&gt;
3. http://www.tutorialspoint.com/ajax/what_is_ajax.htm&lt;/div&gt;</summary>
		<author><name>Amozumd</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_E1585_Use_Ajax_for_Add_Participants,_Add_TA_,Edit_Questionnaires_Screens&amp;diff=100056</id>
		<title>CSC/ECE 517 Fall 2015 E1585 Use Ajax for Add Participants, Add TA ,Edit Questionnaires Screens</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_E1585_Use_Ajax_for_Add_Participants,_Add_TA_,Edit_Questionnaires_Screens&amp;diff=100056"/>
		<updated>2015-12-04T02:57:35Z</updated>

		<summary type="html">&lt;p&gt;Amozumd: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Overall Design==&lt;br /&gt;
===Purpose===&lt;br /&gt;
On some of the views, whenever a user adds or modifies an existing record, the system is saving the entire page and then reloading the entire page back. This is an inefficient way of saving, especially if only one attribute has been modified. Our goal is to modify the views and use AJAX, so that only the newly added information is saved and not the entire page.&lt;br /&gt;
For instance, when a new participant is added for an assignment, the list of participants should be appended dynamically, without reloading the whole page.&lt;br /&gt;
&lt;br /&gt;
We will be altering the views for the following scenarios&lt;br /&gt;
&lt;br /&gt;
# Add Participants to an assignment&lt;br /&gt;
# Edit questionnaire&lt;br /&gt;
# Add TA to an existing course&lt;br /&gt;
&lt;br /&gt;
===Scope and Documentation===&lt;br /&gt;
Upon careful investigation, we find that the following views need to be modified&lt;br /&gt;
&lt;br /&gt;
# participant/list.html.erb&lt;br /&gt;
# course/view_teaching_assistants.html.erb&lt;br /&gt;
# questionnaires/edit.html.erb&lt;br /&gt;
&lt;br /&gt;
New partials are created to reflect the changes&lt;br /&gt;
&lt;br /&gt;
New files are created to render the partial views&lt;br /&gt;
&lt;br /&gt;
The following controller files are also modified&lt;br /&gt;
&lt;br /&gt;
The documents that will be generated for this project are the design document, the actual files that we edit or create, and a ReadMe that explains what we did and how to use the modified product.&lt;br /&gt;
&lt;br /&gt;
===AJAX===&lt;br /&gt;
Ajax is the acronym for Asynchronous Javascript and XML. It is not a programming language or a tool but a concept. Using Ajax allows us to update parts of web page without updating the entire page. Ajax requires basic understanding of HTML and Javascript. Ajax is a client side script which communicates with a server without sharing the entire page over again. It allows web pages to be updated asynchronously by exchanging small pieces of information with the server. It is not visible to the user, but works on the back end. The general web pages which do not use Ajax, load the entire page over when part of new information is added. &lt;br /&gt;
Applications where AJAX is used: Google Maps, Gmail, Twitter, Facebook. Ajax is very popular now, and the reason being its user friendliness, increased speed of web page updating and efficiency is increased as well.&lt;br /&gt;
&lt;br /&gt;
Functionality of Ajax could be understood by the following diagram:&lt;br /&gt;
&lt;br /&gt;
[[File:AJAX.png]]&lt;br /&gt;
&lt;br /&gt;
==Interface and Testing==&lt;br /&gt;
Our project will modify the existing views. After modification, the views’ look and feel should remain same as before. The rendering should be faster with lesser data sent to and from the server.&lt;br /&gt;
&lt;br /&gt;
==Sample of Code Changes==&lt;br /&gt;
===Changes in  app/controllers/participants_controller.rb===&lt;br /&gt;
The following line is removed&lt;br /&gt;
&lt;br /&gt;
 redirect_to :action =&amp;gt; 'list', :id =&amp;gt; curr_object.id, :model =&amp;gt; params[:model], :authorization =&amp;gt; params[:authorization] &lt;br /&gt;
&lt;br /&gt;
The following lines are added &lt;br /&gt;
&lt;br /&gt;
   respond_to do |format|&lt;br /&gt;
   if curr_object.save&lt;br /&gt;
     format.html { redirect_to :action =&amp;gt; 'list', :id =&amp;gt; curr_object.id, :model =&amp;gt; params[:model], :authorization =&amp;gt; params[:authorization] }&lt;br /&gt;
     format.js   {}&lt;br /&gt;
     #format.json { render json: @participant, status: :created, location: @participant }&lt;br /&gt;
   else&lt;br /&gt;
     format.html { render action: &amp;quot;list&amp;quot; }&lt;br /&gt;
     #format.json { render json: @participant.errors, status: :unprocessable_entity }&lt;br /&gt;
   end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
===Added a new partial app/views/participants/_participant.html.erb===&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;div class=&amp;quot;exp&amp;quot;&amp;gt;&lt;br /&gt;
 &amp;lt;% @user_id = [] %&amp;gt;&lt;br /&gt;
 user = User.find(participant.user_id) %&amp;gt;&lt;br /&gt;
   &amp;lt;% @user_id &amp;lt;&amp;lt; participant.user_id %&amp;gt;&lt;br /&gt;
 &amp;lt;tr class= &amp;quot;exp&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;td &amp;gt;&amp;lt;%= link_to user.name, :controller=&amp;gt; 'users', :action =&amp;gt; 'show', :id =&amp;gt; user.id %&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td &amp;gt;&amp;lt;%= user.fullname %&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td &amp;gt;&amp;lt;%= user.email %&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td &amp;gt;&amp;lt;%= link_to user.role.name, :controller =&amp;gt; 'roles', :action =&amp;gt; 'show', :id =&amp;gt; user.role.id %&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td  align=&amp;quot;center&amp;quot;&amp;gt;&amp;lt;%= (User.find(user.parent_id)).name %&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td &amp;gt;&amp;lt;%= User.yesorno(user.email_on_review) %&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td &amp;gt;&amp;lt;%= User.yesorno(user.email_on_submission) %&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td &amp;gt;&amp;lt;%= User.yesorno(user.email_on_review_of_review) %&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td &amp;gt;&amp;lt;%= participant.can_submit == false ? 'no' : 'yes' %&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td &amp;gt;&amp;lt;%= participant.can_review == false ? 'no' : 'yes' %&amp;gt;&amp;lt;/td&amp;gt;  &lt;br /&gt;
    &amp;lt;td &amp;gt;&amp;lt;%= participant.can_take_quiz == false ? 'no' : 'yes' %&amp;gt;&amp;lt;/td&amp;gt;  &lt;br /&gt;
    &amp;lt;td &amp;gt;&amp;lt;%= participant.handle %&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
           &lt;br /&gt;
    &amp;lt;td &amp;gt;&amp;lt;%= link_to 'Remove', {:controller =&amp;gt; controller, :action =&amp;gt; 'destroy', :id =&amp;gt; participant.id}, :method =&amp;gt; :delete %&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;!-- E726 Fall2012 Changes Begin --&amp;gt;&lt;br /&gt;
    &amp;lt;% authorization = Participant.get_authorization(participant.can_submit, participant.can_review, participant.can_take_quiz) %&amp;gt;&lt;br /&gt;
    &amp;lt;% if authorization =='reader' %&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;&amp;lt;%= fa_icon 'book', title: 'reader' %&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;% else %&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;% end %&amp;gt;&lt;br /&gt;
    &amp;lt;!-- E726 Fall2012 Changes End --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;td&amp;gt;&lt;br /&gt;
      &amp;lt;%= form_tag :controller=&amp;gt;'participants', :action=&amp;gt;'update_authorizations', :id =&amp;gt; participant.id do %&amp;gt;&lt;br /&gt;
        &amp;lt;% params[:authorization] = authorization %&amp;gt;&lt;br /&gt;
        &amp;lt;select id=&amp;lt;%=participant.user_id%&amp;gt; name=&amp;quot;authorization&amp;quot; style=&amp;quot;font-size:12px&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
          &amp;lt;option value=&amp;quot;participant&amp;quot; &lt;br /&gt;
            &amp;lt;% if params[:authorization] == &amp;quot;participant&amp;quot; -%&amp;gt;&lt;br /&gt;
              selected&lt;br /&gt;
            &amp;lt;% end -%&amp;gt;&lt;br /&gt;
          &amp;gt;participant&amp;lt;/option&amp;gt;&lt;br /&gt;
          &amp;lt;option value=&amp;quot;reader&amp;quot;&lt;br /&gt;
            &amp;lt;% if params[:authorization] == &amp;quot;reader&amp;quot; -%&amp;gt;&lt;br /&gt;
              selected&lt;br /&gt;
            &amp;lt;% end -%&amp;gt;&lt;br /&gt;
          &amp;gt;reader&amp;lt;/option&amp;gt;&lt;br /&gt;
          &amp;lt;option value=&amp;quot;reviewer&amp;quot;&lt;br /&gt;
            &amp;lt;% if params[:authorization] == &amp;quot;reviewer&amp;quot; -%&amp;gt;&lt;br /&gt;
              selected&lt;br /&gt;
            &amp;lt;% end -%&amp;gt;&lt;br /&gt;
          &amp;gt;reviewer&amp;lt;/option&amp;gt;&lt;br /&gt;
          &amp;lt;option value=&amp;quot;submitter&amp;quot;&lt;br /&gt;
            &amp;lt;% if params[:authorization] == &amp;quot;submitter&amp;quot; -%&amp;gt;&lt;br /&gt;
              selected&lt;br /&gt;
            &amp;lt;% end -%&amp;gt;&lt;br /&gt;
          &amp;gt;submitter&amp;lt;/option&amp;gt;&lt;br /&gt;
        &amp;lt;/select&amp;gt;&lt;br /&gt;
        &amp;lt;%= button_tag &amp;quot;Submit&amp;quot;, {:id=&amp;gt;'button'+participant.user_id.to_s,:style=&amp;gt;&amp;quot;font-size:12px; display:none;&amp;quot;} %&amp;gt;&lt;br /&gt;
      &amp;lt;% end %&amp;gt;&lt;br /&gt;
    &amp;lt;/td&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
  &amp;lt;/tr&amp;gt;&lt;br /&gt;
 &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Added app/views/participants/add.js.erb===&lt;br /&gt;
&lt;br /&gt;
 $('#mytable').append('&amp;lt;%= j render partial: “participant”, locals: {participant: @participant} %&amp;gt;');&lt;br /&gt;
&lt;br /&gt;
# Modified app/views/shared_scripts/_add_individual.html.erb&lt;br /&gt;
&lt;br /&gt;
Removed the line&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;%= form_tag :action =&amp;gt; form_action, :method =&amp;gt; 'post' do %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Added the line&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;%= form_tag form_action, :remote =&amp;gt; true, :method =&amp;gt; 'post' do %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Modified app/views/shared_scripts/_user_list.html.erb===&lt;br /&gt;
&lt;br /&gt;
Removed the line&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Added the line&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;table class = &amp;quot;exp&amp;quot;, id = 'mytable'&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===To test add participants:===&lt;br /&gt;
# Login in as instructor.&lt;br /&gt;
# Create a new assignment and save it.&lt;br /&gt;
# Go to Manage -&amp;gt; Assignments, you should see your newly added assignment here.&lt;br /&gt;
# Now click on ’Add participants’ button available in the list of actions for the assignment, which will direct you to the page which lists all the participants of an assignment. Here you will have the option to add a new participant.&lt;br /&gt;
&lt;br /&gt;
[[File:AssgnPart.png]]&lt;br /&gt;
&lt;br /&gt;
===To test editing questionnaire===&lt;br /&gt;
# Login in as instructor.&lt;br /&gt;
# Go to Manage -&amp;gt; Questionnaires. Create a new Review Questionnaire by clicking on the ‘New public item’ button for ‘Review’.&lt;br /&gt;
# Name the Questionnaire and click on create button&lt;br /&gt;
# Click on Edit for newly created questionnaire.&lt;br /&gt;
&lt;br /&gt;
[[File:Quest.png]]&lt;br /&gt;
&lt;br /&gt;
===To test adding TA===&lt;br /&gt;
# Login in as instructor.&lt;br /&gt;
# Go to Manage -&amp;gt; Courses, you should see the list of courses already present in the Expertiza.&lt;br /&gt;
# Now click on ’Add TA’ button available in the list of actions for the course, which will direct you to the page which lists all the TAs of a course. Through this page, we can add new TAs as well.&lt;br /&gt;
&lt;br /&gt;
[[File:TA.png]]&lt;br /&gt;
&lt;br /&gt;
==Assumptions==&lt;br /&gt;
This project only modifies the way that views rendered to the user. It also demands scripting some server side code to handle the requests. We do not implement anything beyond this.&lt;br /&gt;
&lt;br /&gt;
==Portability==&lt;br /&gt;
The system is portable on windows and UNIX environment. After our modification, it can continue running on both Windows and UNIX environment.&lt;br /&gt;
&lt;br /&gt;
==Details of Requirements==&lt;br /&gt;
===Hardware requirements===&lt;br /&gt;
* Computing Power: The amount of computing power would be the same as the current Expertiza system.&lt;br /&gt;
&lt;br /&gt;
* Memory: The amount of memory would be the same as the current Expertiza system.&lt;br /&gt;
&lt;br /&gt;
* Disk Storage: The amount of disk storage would be the same as the current Expertiza system.&lt;br /&gt;
&lt;br /&gt;
* Peripherals: The peripherals would be the same as the current Expertiza system.&lt;br /&gt;
&lt;br /&gt;
* Network: The network would be the same as the current Expertiza system.&lt;br /&gt;
&lt;br /&gt;
===Software requirements===&lt;br /&gt;
* Operating system environment : The operating system can be either windows or UNIX based OS.  Both are now used in the current Expertiza system.&lt;br /&gt;
&lt;br /&gt;
* Networking environment: As used in the current Expertiza system&lt;br /&gt;
&lt;br /&gt;
* Tools: Ruby Mines, Git&lt;br /&gt;
&lt;br /&gt;
===References===&lt;br /&gt;
&lt;br /&gt;
1. http://www.w3schools.com/Ajax/ajax_intro.asp&lt;br /&gt;
&lt;br /&gt;
2. http://www.seguetech.com/blog/2013/03/12/what-is-ajax-and-where-is-it-used-in-technology&lt;br /&gt;
&lt;br /&gt;
3. http://www.tutorialspoint.com/ajax/what_is_ajax.htm&lt;/div&gt;</summary>
		<author><name>Amozumd</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_E1585_Use_Ajax_for_Add_Participants,_Add_TA_,Edit_Questionnaires_Screens&amp;diff=100055</id>
		<title>CSC/ECE 517 Fall 2015 E1585 Use Ajax for Add Participants, Add TA ,Edit Questionnaires Screens</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_E1585_Use_Ajax_for_Add_Participants,_Add_TA_,Edit_Questionnaires_Screens&amp;diff=100055"/>
		<updated>2015-12-04T02:55:23Z</updated>

		<summary type="html">&lt;p&gt;Amozumd: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Overall Design==&lt;br /&gt;
===Purpose===&lt;br /&gt;
On some of the views, whenever a user adds or modifies an existing record, the system is saving the entire page and then reloading the entire page back. This is an inefficient way of saving, especially if only one attribute has been modified. Our goal is to modify the views and use AJAX, so that only the newly added information is saved and not the entire page.&lt;br /&gt;
For instance, when a new participant is added for an assignment, the list of participants should be appended dynamically, without reloading the whole page.&lt;br /&gt;
&lt;br /&gt;
We will be altering the views for the following scenarios&lt;br /&gt;
&lt;br /&gt;
# Add Participants to an assignment&lt;br /&gt;
# Edit questionnaire&lt;br /&gt;
# Add TA to an existing course&lt;br /&gt;
&lt;br /&gt;
===Scope and Documentation===&lt;br /&gt;
Upon careful investigation, we find that the following views need to be modified&lt;br /&gt;
&lt;br /&gt;
# participant/list.html.erb&lt;br /&gt;
# course/view_teaching_assistants.html.erb&lt;br /&gt;
# questionnaires/edit.html.erb&lt;br /&gt;
&lt;br /&gt;
New partials are created to reflect the changes&lt;br /&gt;
&lt;br /&gt;
New files are created to render the partial views&lt;br /&gt;
&lt;br /&gt;
The following controller files are also modified&lt;br /&gt;
&lt;br /&gt;
The documents that will be generated for this project are the design document, the actual files that we edit or create, and a ReadMe that explains what we did and how to use the modified product.&lt;br /&gt;
&lt;br /&gt;
===AJAX===&lt;br /&gt;
Ajax is the acronym for Asynchronous Javascript and XML. It is not a programming language or a tool but a concept. Using Ajax allows us to update parts of web page without updating the entire page. Ajax requires basic understanding of HTML and Javascript. Ajax is a client side script which communicates with a server without sharing the entire page over again. It allows web pages to be updated asynchronously by exchanging small pieces of information with the server. It is not visible to the user, but works on the back end. The general web pages which do not use Ajax, load the entire page over when part of new information is added. &lt;br /&gt;
Applications where AJAX is used: Google Maps, Gmail, Twitter, Facebook. Ajax is very popular now, and the reason being its user friendliness, increased speed of web page updating and efficiency is increased as well.&lt;br /&gt;
&lt;br /&gt;
Functionality of Ajax could be understood by the following diagram:&lt;br /&gt;
&lt;br /&gt;
[[File:AJAX.png]]&lt;br /&gt;
&lt;br /&gt;
==Interface and Testing==&lt;br /&gt;
Our project will modify the existing views. After modification, the views’ look and feel should remain same as before. The rendering should be faster with lesser data sent to and from the server.&lt;br /&gt;
&lt;br /&gt;
==Sample of Code Changes==&lt;br /&gt;
# Changes in  app/controllers/participants_controller.rb&lt;br /&gt;
The following line is removed&lt;br /&gt;
&lt;br /&gt;
 redirect_to :action =&amp;gt; 'list', :id =&amp;gt; curr_object.id, :model =&amp;gt; params[:model], :authorization =&amp;gt; params[:authorization] &lt;br /&gt;
&lt;br /&gt;
The following lines are added &lt;br /&gt;
&lt;br /&gt;
   respond_to do |format|&lt;br /&gt;
   if curr_object.save&lt;br /&gt;
     format.html { redirect_to :action =&amp;gt; 'list', :id =&amp;gt; curr_object.id, :model =&amp;gt; params[:model], :authorization =&amp;gt; params[:authorization] }&lt;br /&gt;
     format.js   {}&lt;br /&gt;
     #format.json { render json: @participant, status: :created, location: @participant }&lt;br /&gt;
   else&lt;br /&gt;
     format.html { render action: &amp;quot;list&amp;quot; }&lt;br /&gt;
     #format.json { render json: @participant.errors, status: :unprocessable_entity }&lt;br /&gt;
   end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
#Added a new partial app/views/participants/_participant.html.erb&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;div class=&amp;quot;exp&amp;quot;&amp;gt;&lt;br /&gt;
 &amp;lt;% @user_id = [] %&amp;gt;&lt;br /&gt;
 user = User.find(participant.user_id) %&amp;gt;&lt;br /&gt;
   &amp;lt;% @user_id &amp;lt;&amp;lt; participant.user_id %&amp;gt;&lt;br /&gt;
 &amp;lt;tr class= &amp;quot;exp&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;td &amp;gt;&amp;lt;%= link_to user.name, :controller=&amp;gt; 'users', :action =&amp;gt; 'show', :id =&amp;gt; user.id %&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td &amp;gt;&amp;lt;%= user.fullname %&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td &amp;gt;&amp;lt;%= user.email %&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td &amp;gt;&amp;lt;%= link_to user.role.name, :controller =&amp;gt; 'roles', :action =&amp;gt; 'show', :id =&amp;gt; user.role.id %&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td  align=&amp;quot;center&amp;quot;&amp;gt;&amp;lt;%= (User.find(user.parent_id)).name %&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td &amp;gt;&amp;lt;%= User.yesorno(user.email_on_review) %&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td &amp;gt;&amp;lt;%= User.yesorno(user.email_on_submission) %&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td &amp;gt;&amp;lt;%= User.yesorno(user.email_on_review_of_review) %&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td &amp;gt;&amp;lt;%= participant.can_submit == false ? 'no' : 'yes' %&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td &amp;gt;&amp;lt;%= participant.can_review == false ? 'no' : 'yes' %&amp;gt;&amp;lt;/td&amp;gt;  &lt;br /&gt;
    &amp;lt;td &amp;gt;&amp;lt;%= participant.can_take_quiz == false ? 'no' : 'yes' %&amp;gt;&amp;lt;/td&amp;gt;  &lt;br /&gt;
    &amp;lt;td &amp;gt;&amp;lt;%= participant.handle %&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
           &lt;br /&gt;
    &amp;lt;td &amp;gt;&amp;lt;%= link_to 'Remove', {:controller =&amp;gt; controller, :action =&amp;gt; 'destroy', :id =&amp;gt; participant.id}, :method =&amp;gt; :delete %&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;!-- E726 Fall2012 Changes Begin --&amp;gt;&lt;br /&gt;
    &amp;lt;% authorization = Participant.get_authorization(participant.can_submit, participant.can_review, participant.can_take_quiz) %&amp;gt;&lt;br /&gt;
    &amp;lt;% if authorization =='reader' %&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;&amp;lt;%= fa_icon 'book', title: 'reader' %&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;% else %&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;% end %&amp;gt;&lt;br /&gt;
    &amp;lt;!-- E726 Fall2012 Changes End --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;td&amp;gt;&lt;br /&gt;
      &amp;lt;%= form_tag :controller=&amp;gt;'participants', :action=&amp;gt;'update_authorizations', :id =&amp;gt; participant.id do %&amp;gt;&lt;br /&gt;
        &amp;lt;% params[:authorization] = authorization %&amp;gt;&lt;br /&gt;
        &amp;lt;select id=&amp;lt;%=participant.user_id%&amp;gt; name=&amp;quot;authorization&amp;quot; style=&amp;quot;font-size:12px&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
          &amp;lt;option value=&amp;quot;participant&amp;quot; &lt;br /&gt;
            &amp;lt;% if params[:authorization] == &amp;quot;participant&amp;quot; -%&amp;gt;&lt;br /&gt;
              selected&lt;br /&gt;
            &amp;lt;% end -%&amp;gt;&lt;br /&gt;
          &amp;gt;participant&amp;lt;/option&amp;gt;&lt;br /&gt;
          &amp;lt;option value=&amp;quot;reader&amp;quot;&lt;br /&gt;
            &amp;lt;% if params[:authorization] == &amp;quot;reader&amp;quot; -%&amp;gt;&lt;br /&gt;
              selected&lt;br /&gt;
            &amp;lt;% end -%&amp;gt;&lt;br /&gt;
          &amp;gt;reader&amp;lt;/option&amp;gt;&lt;br /&gt;
          &amp;lt;option value=&amp;quot;reviewer&amp;quot;&lt;br /&gt;
            &amp;lt;% if params[:authorization] == &amp;quot;reviewer&amp;quot; -%&amp;gt;&lt;br /&gt;
              selected&lt;br /&gt;
            &amp;lt;% end -%&amp;gt;&lt;br /&gt;
          &amp;gt;reviewer&amp;lt;/option&amp;gt;&lt;br /&gt;
          &amp;lt;option value=&amp;quot;submitter&amp;quot;&lt;br /&gt;
            &amp;lt;% if params[:authorization] == &amp;quot;submitter&amp;quot; -%&amp;gt;&lt;br /&gt;
              selected&lt;br /&gt;
            &amp;lt;% end -%&amp;gt;&lt;br /&gt;
          &amp;gt;submitter&amp;lt;/option&amp;gt;&lt;br /&gt;
        &amp;lt;/select&amp;gt;&lt;br /&gt;
        &amp;lt;%= button_tag &amp;quot;Submit&amp;quot;, {:id=&amp;gt;'button'+participant.user_id.to_s,:style=&amp;gt;&amp;quot;font-size:12px; display:none;&amp;quot;} %&amp;gt;&lt;br /&gt;
      &amp;lt;% end %&amp;gt;&lt;br /&gt;
    &amp;lt;/td&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
  &amp;lt;/tr&amp;gt;&lt;br /&gt;
 &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#Added app/views/participants/add.js.erb&lt;br /&gt;
&lt;br /&gt;
 $('#mytable').append('&amp;lt;%= j render partial: “participant”, locals: {participant: @participant} %&amp;gt;');&lt;br /&gt;
&lt;br /&gt;
# Modified app/views/shared_scripts/_add_individual.html.erb&lt;br /&gt;
&lt;br /&gt;
Removed the line&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;%= form_tag :action =&amp;gt; form_action, :method =&amp;gt; 'post' do %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Added the line&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;%= form_tag form_action, :remote =&amp;gt; true, :method =&amp;gt; 'post' do %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#Modified app/views/shared_scripts/_user_list.html.erb&lt;br /&gt;
&lt;br /&gt;
Removed the line&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Added the line&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;table class = &amp;quot;exp&amp;quot;, id = 'mytable'&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===To test add participants:===&lt;br /&gt;
# Login in as instructor.&lt;br /&gt;
# Create a new assignment and save it.&lt;br /&gt;
# Go to Manage -&amp;gt; Assignments, you should see your newly added assignment here.&lt;br /&gt;
# Now click on ’Add participants’ button available in the list of actions for the assignment, which will direct you to the page which lists all the participants of an assignment. Here you will have the option to add a new participant.&lt;br /&gt;
&lt;br /&gt;
[[File:AssgnPart.png]]&lt;br /&gt;
&lt;br /&gt;
===To test editing questionnaire===&lt;br /&gt;
# Login in as instructor.&lt;br /&gt;
# Go to Manage -&amp;gt; Questionnaires. Create a new Review Questionnaire by clicking on the ‘New public item’ button for ‘Review’.&lt;br /&gt;
# Name the Questionnaire and click on create button&lt;br /&gt;
# Click on Edit for newly created questionnaire.&lt;br /&gt;
&lt;br /&gt;
[[File:Quest.png]]&lt;br /&gt;
&lt;br /&gt;
===To test adding TA===&lt;br /&gt;
# Login in as instructor.&lt;br /&gt;
# Go to Manage -&amp;gt; Courses, you should see the list of courses already present in the Expertiza.&lt;br /&gt;
# Now click on ’Add TA’ button available in the list of actions for the course, which will direct you to the page which lists all the TAs of a course. Through this page, we can add new TAs as well.&lt;br /&gt;
&lt;br /&gt;
[[File:TA.png]]&lt;br /&gt;
&lt;br /&gt;
==Assumptions==&lt;br /&gt;
This project only modifies the way that views rendered to the user. It also demands scripting some server side code to handle the requests. We do not implement anything beyond this.&lt;br /&gt;
&lt;br /&gt;
==Portability==&lt;br /&gt;
The system is portable on windows and UNIX environment. After our modification, it can continue running on both Windows and UNIX environment.&lt;br /&gt;
&lt;br /&gt;
==Details of Requirements==&lt;br /&gt;
===Hardware requirements===&lt;br /&gt;
* Computing Power: The amount of computing power would be the same as the current Expertiza system.&lt;br /&gt;
&lt;br /&gt;
* Memory: The amount of memory would be the same as the current Expertiza system.&lt;br /&gt;
&lt;br /&gt;
* Disk Storage: The amount of disk storage would be the same as the current Expertiza system.&lt;br /&gt;
&lt;br /&gt;
* Peripherals: The peripherals would be the same as the current Expertiza system.&lt;br /&gt;
&lt;br /&gt;
* Network: The network would be the same as the current Expertiza system.&lt;br /&gt;
&lt;br /&gt;
===Software requirements===&lt;br /&gt;
* Operating system environment : The operating system can be either windows or UNIX based OS.  Both are now used in the current Expertiza system.&lt;br /&gt;
&lt;br /&gt;
* Networking environment: As used in the current Expertiza system&lt;br /&gt;
&lt;br /&gt;
* Tools: Ruby Mines, Git&lt;br /&gt;
&lt;br /&gt;
===References===&lt;br /&gt;
&lt;br /&gt;
1. http://www.w3schools.com/Ajax/ajax_intro.asp&lt;br /&gt;
&lt;br /&gt;
2. http://www.seguetech.com/blog/2013/03/12/what-is-ajax-and-where-is-it-used-in-technology&lt;br /&gt;
&lt;br /&gt;
3. http://www.tutorialspoint.com/ajax/what_is_ajax.htm&lt;/div&gt;</summary>
		<author><name>Amozumd</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_E1585_Use_Ajax_for_Add_Participants,_Add_TA_,Edit_Questionnaires_Screens&amp;diff=100054</id>
		<title>CSC/ECE 517 Fall 2015 E1585 Use Ajax for Add Participants, Add TA ,Edit Questionnaires Screens</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_E1585_Use_Ajax_for_Add_Participants,_Add_TA_,Edit_Questionnaires_Screens&amp;diff=100054"/>
		<updated>2015-12-04T02:51:18Z</updated>

		<summary type="html">&lt;p&gt;Amozumd: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Overall Design==&lt;br /&gt;
===Purpose===&lt;br /&gt;
On some of the views, whenever a user adds or modifies an existing record, the system is saving the entire page and then reloading the entire page back. This is an inefficient way of saving, especially if only one attribute has been modified. Our goal is to modify the views and use AJAX, so that only the newly added information is saved and not the entire page.&lt;br /&gt;
For instance, when a new participant is added for an assignment, the list of participants should be appended dynamically, without reloading the whole page.&lt;br /&gt;
&lt;br /&gt;
We will be altering the views for the following scenarios&lt;br /&gt;
&lt;br /&gt;
# Add Participants to an assignment&lt;br /&gt;
# Edit questionnaire&lt;br /&gt;
# Add TA to an existing course&lt;br /&gt;
&lt;br /&gt;
===Scope and Documentation===&lt;br /&gt;
Upon careful investigation, we find that the following views need to be modified&lt;br /&gt;
&lt;br /&gt;
# participant/list.html.erb&lt;br /&gt;
# course/view_teaching_assistants.html.erb&lt;br /&gt;
# questionnaires/edit.html.erb&lt;br /&gt;
&lt;br /&gt;
New partials are created to reflect the changes&lt;br /&gt;
&lt;br /&gt;
New files are created to render the partial views&lt;br /&gt;
&lt;br /&gt;
The following controller files are also modified&lt;br /&gt;
&lt;br /&gt;
The documents that will be generated for this project are the design document, the actual files that we edit or create, and a ReadMe that explains what we did and how to use the modified product.&lt;br /&gt;
&lt;br /&gt;
===AJAX===&lt;br /&gt;
Ajax is the acronym for Asynchronous Javascript and XML. It is not a programming language or a tool but a concept. Using Ajax allows us to update parts of web page without updating the entire page. Ajax requires basic understanding of HTML and Javascript. Ajax is a client side script which communicates with a server without sharing the entire page over again. It allows web pages to be updated asynchronously by exchanging small pieces of information with the server. It is not visible to the user, but works on the back end. The general web pages which do not use Ajax, load the entire page over when part of new information is added. &lt;br /&gt;
Applications where AJAX is used: Google Maps, Gmail, Twitter, Facebook. Ajax is very popular now, and the reason being its user friendliness, increased speed of web page updating and efficiency is increased as well.&lt;br /&gt;
&lt;br /&gt;
Functionality of Ajax could be understood by the following diagram:&lt;br /&gt;
&lt;br /&gt;
[[File:AJAX.png]]&lt;br /&gt;
&lt;br /&gt;
==Interface and Testing==&lt;br /&gt;
Our project will modify the existing views. After modification, the views’ look and feel should remain same as before. The rendering should be faster with lesser data sent to and from the server.&lt;br /&gt;
&lt;br /&gt;
==Sample of Code Changes==&lt;br /&gt;
# Changes in  app/controllers/participants_controller.rb&lt;br /&gt;
The following line is removed&lt;br /&gt;
&lt;br /&gt;
 redirect_to :action =&amp;gt; 'list', :id =&amp;gt; curr_object.id, :model =&amp;gt; params[:model], :authorization =&amp;gt; params[:authorization] &lt;br /&gt;
&lt;br /&gt;
The following lines are added &lt;br /&gt;
&lt;br /&gt;
   respond_to do |format|&lt;br /&gt;
   if curr_object.save&lt;br /&gt;
     format.html { redirect_to :action =&amp;gt; 'list', :id =&amp;gt; curr_object.id, :model =&amp;gt; params[:model], :authorization =&amp;gt; params[:authorization] }&lt;br /&gt;
     format.js   {}&lt;br /&gt;
     #format.json { render json: @participant, status: :created, location: @participant }&lt;br /&gt;
   else&lt;br /&gt;
     format.html { render action: &amp;quot;list&amp;quot; }&lt;br /&gt;
     #format.json { render json: @participant.errors, status: :unprocessable_entity }&lt;br /&gt;
   end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
#Added a new partial app/views/participants/_participant.html.erb&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;exp&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;% @user_id = [] %&amp;gt;&lt;br /&gt;
user = User.find(participant.user_id) %&amp;gt;&lt;br /&gt;
   &amp;lt;% @user_id &amp;lt;&amp;lt; participant.user_id %&amp;gt;&lt;br /&gt;
&amp;lt;tr class= &amp;quot;exp&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;td &amp;gt;&amp;lt;%= link_to user.name, :controller=&amp;gt; 'users', :action =&amp;gt; 'show', :id =&amp;gt; user.id %&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td &amp;gt;&amp;lt;%= user.fullname %&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td &amp;gt;&amp;lt;%= user.email %&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td &amp;gt;&amp;lt;%= link_to user.role.name, :controller =&amp;gt; 'roles', :action =&amp;gt; 'show', :id =&amp;gt; user.role.id %&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td  align=&amp;quot;center&amp;quot;&amp;gt;&amp;lt;%= (User.find(user.parent_id)).name %&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td &amp;gt;&amp;lt;%= User.yesorno(user.email_on_review) %&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td &amp;gt;&amp;lt;%= User.yesorno(user.email_on_submission) %&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td &amp;gt;&amp;lt;%= User.yesorno(user.email_on_review_of_review) %&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td &amp;gt;&amp;lt;%= participant.can_submit == false ? 'no' : 'yes' %&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td &amp;gt;&amp;lt;%= participant.can_review == false ? 'no' : 'yes' %&amp;gt;&amp;lt;/td&amp;gt;  &lt;br /&gt;
    &amp;lt;td &amp;gt;&amp;lt;%= participant.can_take_quiz == false ? 'no' : 'yes' %&amp;gt;&amp;lt;/td&amp;gt;  &lt;br /&gt;
    &amp;lt;td &amp;gt;&amp;lt;%= participant.handle %&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
           &lt;br /&gt;
    &amp;lt;td &amp;gt;&amp;lt;%= link_to 'Remove', {:controller =&amp;gt; controller, :action =&amp;gt; 'destroy', :id =&amp;gt; participant.id}, :method =&amp;gt; :delete %&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;!-- E726 Fall2012 Changes Begin --&amp;gt;&lt;br /&gt;
    &amp;lt;% authorization = Participant.get_authorization(participant.can_submit, participant.can_review, participant.can_take_quiz) %&amp;gt;&lt;br /&gt;
    &amp;lt;% if authorization =='reader' %&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;&amp;lt;%= fa_icon 'book', title: 'reader' %&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;% else %&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;% end %&amp;gt;&lt;br /&gt;
    &amp;lt;!-- E726 Fall2012 Changes End --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;td&amp;gt;&lt;br /&gt;
      &amp;lt;%= form_tag :controller=&amp;gt;'participants', :action=&amp;gt;'update_authorizations', :id =&amp;gt; participant.id do %&amp;gt;&lt;br /&gt;
        &amp;lt;% params[:authorization] = authorization %&amp;gt;&lt;br /&gt;
        &amp;lt;select id=&amp;lt;%=participant.user_id%&amp;gt; name=&amp;quot;authorization&amp;quot; style=&amp;quot;font-size:12px&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
          &amp;lt;option value=&amp;quot;participant&amp;quot; &lt;br /&gt;
            &amp;lt;% if params[:authorization] == &amp;quot;participant&amp;quot; -%&amp;gt;&lt;br /&gt;
              selected&lt;br /&gt;
            &amp;lt;% end -%&amp;gt;&lt;br /&gt;
          &amp;gt;participant&amp;lt;/option&amp;gt;&lt;br /&gt;
          &amp;lt;option value=&amp;quot;reader&amp;quot;&lt;br /&gt;
            &amp;lt;% if params[:authorization] == &amp;quot;reader&amp;quot; -%&amp;gt;&lt;br /&gt;
              selected&lt;br /&gt;
            &amp;lt;% end -%&amp;gt;&lt;br /&gt;
          &amp;gt;reader&amp;lt;/option&amp;gt;&lt;br /&gt;
          &amp;lt;option value=&amp;quot;reviewer&amp;quot;&lt;br /&gt;
            &amp;lt;% if params[:authorization] == &amp;quot;reviewer&amp;quot; -%&amp;gt;&lt;br /&gt;
              selected&lt;br /&gt;
            &amp;lt;% end -%&amp;gt;&lt;br /&gt;
          &amp;gt;reviewer&amp;lt;/option&amp;gt;&lt;br /&gt;
          &amp;lt;option value=&amp;quot;submitter&amp;quot;&lt;br /&gt;
            &amp;lt;% if params[:authorization] == &amp;quot;submitter&amp;quot; -%&amp;gt;&lt;br /&gt;
              selected&lt;br /&gt;
            &amp;lt;% end -%&amp;gt;&lt;br /&gt;
          &amp;gt;submitter&amp;lt;/option&amp;gt;&lt;br /&gt;
        &amp;lt;/select&amp;gt;&lt;br /&gt;
        &amp;lt;%= button_tag &amp;quot;Submit&amp;quot;, {:id=&amp;gt;'button'+participant.user_id.to_s,:style=&amp;gt;&amp;quot;font-size:12px; display:none;&amp;quot;} %&amp;gt;&lt;br /&gt;
      &amp;lt;% end %&amp;gt;&lt;br /&gt;
    &amp;lt;/td&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
  &amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#Added app/views/participants/add.js.erb&lt;br /&gt;
&lt;br /&gt;
$('#mytable').append('&amp;lt;%= j render partial: “participant”, locals: {participant: @participant} %&amp;gt;');&lt;br /&gt;
&lt;br /&gt;
# Modified app/views/shared_scripts/_add_individual.html.erb&lt;br /&gt;
&lt;br /&gt;
Removed the line&lt;br /&gt;
&lt;br /&gt;
&amp;lt;%= form_tag :action =&amp;gt; form_action, :method =&amp;gt; 'post' do %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Added the line&lt;br /&gt;
&lt;br /&gt;
&amp;lt;%= form_tag form_action, :remote =&amp;gt; true, :method =&amp;gt; 'post' do %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#Modified app/views/shared_scripts/_user_list.html.erb&lt;br /&gt;
&lt;br /&gt;
Removed the line&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Added the line&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table class = &amp;quot;exp&amp;quot;, id = 'mytable'&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===To test add participants:===&lt;br /&gt;
# Login in as instructor.&lt;br /&gt;
# Create a new assignment and save it.&lt;br /&gt;
# Go to Manage -&amp;gt; Assignments, you should see your newly added assignment here.&lt;br /&gt;
# Now click on ’Add participants’ button available in the list of actions for the assignment, which will direct you to the page which lists all the participants of an assignment. Here you will have the option to add a new participant.&lt;br /&gt;
&lt;br /&gt;
[[File:AssgnPart.png]]&lt;br /&gt;
&lt;br /&gt;
===To test editing questionnaire===&lt;br /&gt;
# Login in as instructor.&lt;br /&gt;
# Go to Manage -&amp;gt; Questionnaires. Create a new Review Questionnaire by clicking on the ‘New public item’ button for ‘Review’.&lt;br /&gt;
# Name the Questionnaire and click on create button&lt;br /&gt;
# Click on Edit for newly created questionnaire.&lt;br /&gt;
&lt;br /&gt;
[[File:Quest.png]]&lt;br /&gt;
&lt;br /&gt;
===To test adding TA===&lt;br /&gt;
# Login in as instructor.&lt;br /&gt;
# Go to Manage -&amp;gt; Courses, you should see the list of courses already present in the Expertiza.&lt;br /&gt;
# Now click on ’Add TA’ button available in the list of actions for the course, which will direct you to the page which lists all the TAs of a course. Through this page, we can add new TAs as well.&lt;br /&gt;
&lt;br /&gt;
[[File:TA.png]]&lt;br /&gt;
&lt;br /&gt;
==Assumptions==&lt;br /&gt;
This project only modifies the way that views rendered to the user. It also demands scripting some server side code to handle the requests. We do not implement anything beyond this.&lt;br /&gt;
&lt;br /&gt;
==Portability==&lt;br /&gt;
The system is portable on windows and UNIX environment. After our modification, it can continue running on both Windows and UNIX environment.&lt;br /&gt;
&lt;br /&gt;
==Details of Requirements==&lt;br /&gt;
===Hardware requirements===&lt;br /&gt;
* Computing Power: The amount of computing power would be the same as the current Expertiza system.&lt;br /&gt;
&lt;br /&gt;
* Memory: The amount of memory would be the same as the current Expertiza system.&lt;br /&gt;
&lt;br /&gt;
* Disk Storage: The amount of disk storage would be the same as the current Expertiza system.&lt;br /&gt;
&lt;br /&gt;
* Peripherals: The peripherals would be the same as the current Expertiza system.&lt;br /&gt;
&lt;br /&gt;
* Network: The network would be the same as the current Expertiza system.&lt;br /&gt;
&lt;br /&gt;
===Software requirements===&lt;br /&gt;
* Operating system environment : The operating system can be either windows or UNIX based OS.  Both are now used in the current Expertiza system.&lt;br /&gt;
&lt;br /&gt;
* Networking environment: As used in the current Expertiza system&lt;br /&gt;
&lt;br /&gt;
* Tools: Ruby Mines, Git&lt;br /&gt;
&lt;br /&gt;
===References===&lt;br /&gt;
&lt;br /&gt;
1. http://www.w3schools.com/Ajax/ajax_intro.asp&lt;br /&gt;
&lt;br /&gt;
2. http://www.seguetech.com/blog/2013/03/12/what-is-ajax-and-where-is-it-used-in-technology&lt;br /&gt;
&lt;br /&gt;
3. http://www.tutorialspoint.com/ajax/what_is_ajax.htm&lt;/div&gt;</summary>
		<author><name>Amozumd</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_E1585_Use_Ajax_for_Add_Participants,_Add_TA_,Edit_Questionnaires_Screens&amp;diff=100053</id>
		<title>CSC/ECE 517 Fall 2015 E1585 Use Ajax for Add Participants, Add TA ,Edit Questionnaires Screens</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_E1585_Use_Ajax_for_Add_Participants,_Add_TA_,Edit_Questionnaires_Screens&amp;diff=100053"/>
		<updated>2015-12-04T02:43:20Z</updated>

		<summary type="html">&lt;p&gt;Amozumd: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Overall Design==&lt;br /&gt;
===Purpose===&lt;br /&gt;
On some of the views, whenever a user adds or modifies an existing record, the system is saving the entire page and then reloading the entire page back. This is an inefficient way of saving, especially if only one attribute has been modified. Our goal is to modify the views and use AJAX, so that only the newly added information is saved and not the entire page.&lt;br /&gt;
For instance, when a new participant is added for an assignment, the list of participants should be appended dynamically, without reloading the whole page.&lt;br /&gt;
&lt;br /&gt;
We will be altering the views for the following scenarios&lt;br /&gt;
&lt;br /&gt;
# Add Participants to an assignment&lt;br /&gt;
# Edit questionnaire&lt;br /&gt;
# Add TA to an existing course&lt;br /&gt;
&lt;br /&gt;
===Scope and Documentation===&lt;br /&gt;
Upon careful investigation, we find that the following views need to be modified&lt;br /&gt;
&lt;br /&gt;
# participant/list.html.erb&lt;br /&gt;
# course/view_teaching_assistants.html.erb&lt;br /&gt;
# questionnaires/edit.html.erb&lt;br /&gt;
&lt;br /&gt;
New partials are created to reflect the changes&lt;br /&gt;
&lt;br /&gt;
New files are created to render the partial views&lt;br /&gt;
&lt;br /&gt;
The following controller files are also modified&lt;br /&gt;
&lt;br /&gt;
The documents that will be generated for this project are the design document, the actual files that we edit or create, and a ReadMe that explains what we did and how to use the modified product.&lt;br /&gt;
&lt;br /&gt;
===AJAX===&lt;br /&gt;
Ajax is the acronym for Asynchronous Javascript and XML. It is not a programming language or a tool but a concept. Using Ajax allows us to update parts of web page without updating the entire page. Ajax requires basic understanding of HTML and Javascript. Ajax is a client side script which communicates with a server without sharing the entire page over again. It allows web pages to be updated asynchronously by exchanging small pieces of information with the server. It is not visible to the user, but works on the back end. The general web pages which do not use Ajax, load the entire page over when part of new information is added. &lt;br /&gt;
Applications where AJAX is used: Google Maps, Gmail, Twitter, Facebook. Ajax is very popular now, and the reason being its user friendliness, increased speed of web page updating and efficiency is increased as well.&lt;br /&gt;
&lt;br /&gt;
Functionality of Ajax could be understood by the following diagram:&lt;br /&gt;
&lt;br /&gt;
[[File:AJAX.png]]&lt;br /&gt;
&lt;br /&gt;
==Interface and Testing==&lt;br /&gt;
Our project will modify the existing views. After modification, the views’ look and feel should remain same as before. The rendering should be faster with lesser data sent to and from the server.&lt;br /&gt;
&lt;br /&gt;
==Sample of Code Changes==&lt;br /&gt;
# Changes in  app/controllers/participants_controller.rb&lt;br /&gt;
&lt;br /&gt;
 redirect_to :action =&amp;gt; 'list', :id =&amp;gt; curr_object.id, :model =&amp;gt; params[:model], :authorization =&amp;gt; params[:authorization] is removes&lt;br /&gt;
 Lines added &lt;br /&gt;
   respond_to do |format|&lt;br /&gt;
   if curr_object.save&lt;br /&gt;
     format.html { redirect_to :action =&amp;gt; 'list', :id =&amp;gt; curr_object.id, :model =&amp;gt; params[:model], :authorization =&amp;gt; params[:authorization] }&lt;br /&gt;
     format.js   {}&lt;br /&gt;
     #format.json { render json: @participant, status: :created, location: @participant }&lt;br /&gt;
   else&lt;br /&gt;
     format.html { render action: &amp;quot;list&amp;quot; }&lt;br /&gt;
     #format.json { render json: @participant.errors, status: :unprocessable_entity }&lt;br /&gt;
   end&lt;br /&gt;
  end&lt;br /&gt;
#Added a new partial app/views/participants/_participant.html.erb&lt;br /&gt;
&amp;lt;div class=&amp;quot;exp&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;% @user_id = [] %&amp;gt;&lt;br /&gt;
user = User.find(participant.user_id) %&amp;gt;&lt;br /&gt;
   &amp;lt;% @user_id &amp;lt;&amp;lt; participant.user_id %&amp;gt;&lt;br /&gt;
&amp;lt;tr class= &amp;quot;exp&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;td &amp;gt;&amp;lt;%= link_to user.name, :controller=&amp;gt; 'users', :action =&amp;gt; 'show', :id =&amp;gt; user.id %&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td &amp;gt;&amp;lt;%= user.fullname %&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td &amp;gt;&amp;lt;%= user.email %&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td &amp;gt;&amp;lt;%= link_to user.role.name, :controller =&amp;gt; 'roles', :action =&amp;gt; 'show', :id =&amp;gt; user.role.id %&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td  align=&amp;quot;center&amp;quot;&amp;gt;&amp;lt;%= (User.find(user.parent_id)).name %&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td &amp;gt;&amp;lt;%= User.yesorno(user.email_on_review) %&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td &amp;gt;&amp;lt;%= User.yesorno(user.email_on_submission) %&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td &amp;gt;&amp;lt;%= User.yesorno(user.email_on_review_of_review) %&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td &amp;gt;&amp;lt;%= participant.can_submit == false ? 'no' : 'yes' %&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td &amp;gt;&amp;lt;%= participant.can_review == false ? 'no' : 'yes' %&amp;gt;&amp;lt;/td&amp;gt;  &lt;br /&gt;
    &amp;lt;td &amp;gt;&amp;lt;%= participant.can_take_quiz == false ? 'no' : 'yes' %&amp;gt;&amp;lt;/td&amp;gt;  &lt;br /&gt;
    &amp;lt;td &amp;gt;&amp;lt;%= participant.handle %&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
           &lt;br /&gt;
    &amp;lt;td &amp;gt;&amp;lt;%= link_to 'Remove', {:controller =&amp;gt; controller, :action =&amp;gt; 'destroy', :id =&amp;gt; participant.id}, :method =&amp;gt; :delete %&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;!-- E726 Fall2012 Changes Begin --&amp;gt;&lt;br /&gt;
    &amp;lt;% authorization = Participant.get_authorization(participant.can_submit, participant.can_review, participant.can_take_quiz) %&amp;gt;&lt;br /&gt;
    &amp;lt;% if authorization =='reader' %&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;&amp;lt;%= fa_icon 'book', title: 'reader' %&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;% else %&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;% end %&amp;gt;&lt;br /&gt;
    &amp;lt;!-- E726 Fall2012 Changes End --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;td&amp;gt;&lt;br /&gt;
      &amp;lt;%= form_tag :controller=&amp;gt;'participants', :action=&amp;gt;'update_authorizations', :id =&amp;gt; participant.id do %&amp;gt;&lt;br /&gt;
        &amp;lt;% params[:authorization] = authorization %&amp;gt;&lt;br /&gt;
        &amp;lt;select id=&amp;lt;%=participant.user_id%&amp;gt; name=&amp;quot;authorization&amp;quot; style=&amp;quot;font-size:12px&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
          &amp;lt;option value=&amp;quot;participant&amp;quot; &lt;br /&gt;
            &amp;lt;% if params[:authorization] == &amp;quot;participant&amp;quot; -%&amp;gt;&lt;br /&gt;
              selected&lt;br /&gt;
            &amp;lt;% end -%&amp;gt;&lt;br /&gt;
          &amp;gt;participant&amp;lt;/option&amp;gt;&lt;br /&gt;
          &amp;lt;option value=&amp;quot;reader&amp;quot;&lt;br /&gt;
            &amp;lt;% if params[:authorization] == &amp;quot;reader&amp;quot; -%&amp;gt;&lt;br /&gt;
              selected&lt;br /&gt;
            &amp;lt;% end -%&amp;gt;&lt;br /&gt;
          &amp;gt;reader&amp;lt;/option&amp;gt;&lt;br /&gt;
          &amp;lt;option value=&amp;quot;reviewer&amp;quot;&lt;br /&gt;
            &amp;lt;% if params[:authorization] == &amp;quot;reviewer&amp;quot; -%&amp;gt;&lt;br /&gt;
              selected&lt;br /&gt;
            &amp;lt;% end -%&amp;gt;&lt;br /&gt;
          &amp;gt;reviewer&amp;lt;/option&amp;gt;&lt;br /&gt;
          &amp;lt;option value=&amp;quot;submitter&amp;quot;&lt;br /&gt;
            &amp;lt;% if params[:authorization] == &amp;quot;submitter&amp;quot; -%&amp;gt;&lt;br /&gt;
              selected&lt;br /&gt;
            &amp;lt;% end -%&amp;gt;&lt;br /&gt;
          &amp;gt;submitter&amp;lt;/option&amp;gt;&lt;br /&gt;
        &amp;lt;/select&amp;gt;&lt;br /&gt;
        &amp;lt;%= button_tag &amp;quot;Submit&amp;quot;, {:id=&amp;gt;'button'+participant.user_id.to_s,:style=&amp;gt;&amp;quot;font-size:12px; display:none;&amp;quot;} %&amp;gt;&lt;br /&gt;
      &amp;lt;% end %&amp;gt;&lt;br /&gt;
    &amp;lt;/td&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
  &amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
#Added app/views/participants/add.js.erb&lt;br /&gt;
$('#mytable').append('&amp;lt;%= j render partial: “participant”, locals: {participant: @participant} %&amp;gt;');&lt;br /&gt;
# Modified app/views/shared_scripts/_add_individual.html.erb&lt;br /&gt;
Removed the line&lt;br /&gt;
&amp;lt;%= form_tag :action =&amp;gt; form_action, :method =&amp;gt; 'post', :remote =&amp;gt; true do %&amp;gt;&lt;br /&gt;
Added the line&lt;br /&gt;
&amp;lt;%= form_tag form_action, :remote =&amp;gt; true, :method =&amp;gt; 'post' do %&amp;gt;&lt;br /&gt;
#Modified app/views/shared_scripts/_user_list.html.erb&lt;br /&gt;
Removed the line&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
Added the line&lt;br /&gt;
&amp;lt;table class = &amp;quot;exp&amp;quot;, id = 'mytable'&amp;gt;&lt;br /&gt;
===To test add participants:===&lt;br /&gt;
# Login in as instructor.&lt;br /&gt;
# Create a new assignment and save it.&lt;br /&gt;
# Go to Manage -&amp;gt; Assignments, you should see your newly added assignment here.&lt;br /&gt;
# Now click on ’Add participants’ button available in the list of actions for the assignment, which will direct you to the page which lists all the participants of an assignment. Here you will have the option to add a new participant.&lt;br /&gt;
&lt;br /&gt;
[[File:AssgnPart.png]]&lt;br /&gt;
&lt;br /&gt;
===To test editing questionnaire===&lt;br /&gt;
# Login in as instructor.&lt;br /&gt;
# Go to Manage -&amp;gt; Questionnaires. Create a new Review Questionnaire by clicking on the ‘New public item’ button for ‘Review’.&lt;br /&gt;
# Name the Questionnaire and click on create button&lt;br /&gt;
# Click on Edit for newly created questionnaire.&lt;br /&gt;
&lt;br /&gt;
[[File:Quest.png]]&lt;br /&gt;
&lt;br /&gt;
===To test adding TA===&lt;br /&gt;
# Login in as instructor.&lt;br /&gt;
# Go to Manage -&amp;gt; Courses, you should see the list of courses already present in the Expertiza.&lt;br /&gt;
# Now click on ’Add TA’ button available in the list of actions for the course, which will direct you to the page which lists all the TAs of a course. Through this page, we can add new TAs as well.&lt;br /&gt;
&lt;br /&gt;
[[File:TA.png]]&lt;br /&gt;
&lt;br /&gt;
==Assumptions==&lt;br /&gt;
This project only modifies the way that views rendered to the user. It also demands scripting some server side code to handle the requests. We do not implement anything beyond this.&lt;br /&gt;
&lt;br /&gt;
==Portability==&lt;br /&gt;
The system is portable on windows and UNIX environment. After our modification, it can continue running on both Windows and UNIX environment.&lt;br /&gt;
&lt;br /&gt;
==Details of Requirements==&lt;br /&gt;
===Hardware requirements===&lt;br /&gt;
* Computing Power: The amount of computing power would be the same as the current Expertiza system.&lt;br /&gt;
&lt;br /&gt;
* Memory: The amount of memory would be the same as the current Expertiza system.&lt;br /&gt;
&lt;br /&gt;
* Disk Storage: The amount of disk storage would be the same as the current Expertiza system.&lt;br /&gt;
&lt;br /&gt;
* Peripherals: The peripherals would be the same as the current Expertiza system.&lt;br /&gt;
&lt;br /&gt;
* Network: The network would be the same as the current Expertiza system.&lt;br /&gt;
&lt;br /&gt;
===Software requirements===&lt;br /&gt;
* Operating system environment : The operating system can be either windows or UNIX based OS.  Both are now used in the current Expertiza system.&lt;br /&gt;
&lt;br /&gt;
* Networking environment: As used in the current Expertiza system&lt;br /&gt;
&lt;br /&gt;
* Tools: Ruby Mines, Git&lt;br /&gt;
&lt;br /&gt;
===References===&lt;br /&gt;
&lt;br /&gt;
1. http://www.w3schools.com/Ajax/ajax_intro.asp&lt;br /&gt;
&lt;br /&gt;
2. http://www.seguetech.com/blog/2013/03/12/what-is-ajax-and-where-is-it-used-in-technology&lt;br /&gt;
&lt;br /&gt;
3. http://www.tutorialspoint.com/ajax/what_is_ajax.htm&lt;/div&gt;</summary>
		<author><name>Amozumd</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_E1585_Use_Ajax_for_Add_Participants,_Add_TA_,Edit_Questionnaires_Screens&amp;diff=99584</id>
		<title>CSC/ECE 517 Fall 2015 E1585 Use Ajax for Add Participants, Add TA ,Edit Questionnaires Screens</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_E1585_Use_Ajax_for_Add_Participants,_Add_TA_,Edit_Questionnaires_Screens&amp;diff=99584"/>
		<updated>2015-11-13T19:04:14Z</updated>

		<summary type="html">&lt;p&gt;Amozumd: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Overall Design==&lt;br /&gt;
===Purpose===&lt;br /&gt;
On some of the views, whenever a user adds or modifies an existing record, the system is saving the entire page and then reloading the entire page back. This is an inefficient way of saving, especially if only one attribute has been modified. Our goal is to modify the views and use AJAX, so that only the newly added information is saved and not the entire page.&lt;br /&gt;
&lt;br /&gt;
We will be altering the views for the following scenarios&lt;br /&gt;
&lt;br /&gt;
# Add Participants to an assignment&lt;br /&gt;
# Edit questionnaire&lt;br /&gt;
# Add TA to an existing course&lt;br /&gt;
&lt;br /&gt;
===Scope and Documentation===&lt;br /&gt;
Upon careful investigation, we find that the following views need to be modified&lt;br /&gt;
&lt;br /&gt;
# participant/list.html.erb&lt;br /&gt;
# course/view_teaching_assistants.html.erb&lt;br /&gt;
# questionnaires/edit.html.erb&lt;br /&gt;
&lt;br /&gt;
The documents that will be generated for this project are the design document, the actual files that we edit or create, and a ReadMe that explains what we did and how to use the modified product.&lt;br /&gt;
&lt;br /&gt;
==Interface and Testing==&lt;br /&gt;
Our project will modify the existing views. After modification, the views’ look and feel should remain same as before. The rendering should be faster with lesser data sent to and from the server.&lt;br /&gt;
&lt;br /&gt;
===To test add participants:===&lt;br /&gt;
# Login in as instructor.&lt;br /&gt;
# Create a new assignment and save it.&lt;br /&gt;
# Go to Manage -&amp;gt; Assignments, you should see your newly added assignment here.&lt;br /&gt;
# Now click on ’Add participants’ button available in the list of actions for the assignment, which will direct you to the page which lists all the participants of an assignment. Here you will have the option to add a new participant.&lt;br /&gt;
&lt;br /&gt;
[[File:AssgnPart.png]]&lt;br /&gt;
&lt;br /&gt;
===To test editing questionnaire===&lt;br /&gt;
# Login in as instructor.&lt;br /&gt;
# Go to Manage -&amp;gt; Questionnaires. Create a new Review Questionnaire by clicking on the ‘New public item’ button for ‘Review’.&lt;br /&gt;
# Name the Questionnaire and click on create button&lt;br /&gt;
# Click on Edit for newly created questionnaire.&lt;br /&gt;
&lt;br /&gt;
[[File:Quest.png]]&lt;br /&gt;
&lt;br /&gt;
===To test adding TA===&lt;br /&gt;
# Login in as instructor.&lt;br /&gt;
# Go to Manage -&amp;gt; Courses, you should see the list of courses already present in the Expertiza.&lt;br /&gt;
# Now click on ’Add TA’ button available in the list of actions for the course, which will direct you to the page which lists all the TAs of a course. Through this page, we can add new TAs as well.&lt;br /&gt;
&lt;br /&gt;
[[File:TA.png]]&lt;br /&gt;
&lt;br /&gt;
==Assumptions==&lt;br /&gt;
This project only modifies the way that views rendered to the user. It also demands scripting some server side code to handle the requests. We do not implement anything beyond this.&lt;br /&gt;
&lt;br /&gt;
==Portability==&lt;br /&gt;
The system is portable on windows and UNIX environment. After our modification, it can continue running on both Windows and UNIX environment.&lt;br /&gt;
&lt;br /&gt;
==Details of Requirements==&lt;br /&gt;
===Hardware requirements===&lt;br /&gt;
* Computing Power: The amount of computing power would be the same as the current Expertiza system.&lt;br /&gt;
&lt;br /&gt;
* Memory: The amount of memory would be the same as the current Expertiza system.&lt;br /&gt;
&lt;br /&gt;
* Disk Storage: The amount of disk storage would be the same as the current Expertiza system.&lt;br /&gt;
&lt;br /&gt;
* Peripherals: The peripherals would be the same as the current Expertiza system.&lt;br /&gt;
&lt;br /&gt;
* Network: The network would be the same as the current Expertiza system.&lt;br /&gt;
&lt;br /&gt;
===Software requirements===&lt;br /&gt;
* Operating system environment : The operating system can be either windows or UNIX based OS.  Both are now used in the current Expertiza system.&lt;br /&gt;
&lt;br /&gt;
* Networking environment: As used in the current Expertiza system&lt;br /&gt;
&lt;br /&gt;
* Tools: Ruby Mines, Git&lt;/div&gt;</summary>
		<author><name>Amozumd</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_E1585_Use_Ajax_for_Add_Participants,_Add_TA_,Edit_Questionnaires_Screens&amp;diff=99583</id>
		<title>CSC/ECE 517 Fall 2015 E1585 Use Ajax for Add Participants, Add TA ,Edit Questionnaires Screens</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_E1585_Use_Ajax_for_Add_Participants,_Add_TA_,Edit_Questionnaires_Screens&amp;diff=99583"/>
		<updated>2015-11-13T19:02:40Z</updated>

		<summary type="html">&lt;p&gt;Amozumd: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Overall Design==&lt;br /&gt;
===Purpose===&lt;br /&gt;
On some of the views, whenever a user adds or modifies an existing record, the system is saving the entire page and then reloading the entire page back. This is an inefficient way of saving, especially if only one attribute has been modified. Our goal is to modify the views and use AJAX, so that only the newly added information is saved and not the entire page.&lt;br /&gt;
&lt;br /&gt;
We will be altering the views for the following scenarios&lt;br /&gt;
&lt;br /&gt;
# Add Participants to an assignment&lt;br /&gt;
# Edit questionnaire&lt;br /&gt;
# Add TA to an existing course&lt;br /&gt;
&lt;br /&gt;
===Scope and Documentation===&lt;br /&gt;
Upon careful investigation, we find that the following views need to be modified&lt;br /&gt;
&lt;br /&gt;
# participant/list.html.erb&lt;br /&gt;
# course/view_teaching_assistants.html.erb&lt;br /&gt;
# questionnaires/edit.html.erb&lt;br /&gt;
&lt;br /&gt;
The documents that will be generated for this project are the design document, the actual files that we edit or create, and a ReadMe that explains what we did and how to use the modified product.&lt;br /&gt;
&lt;br /&gt;
==Interface and Testing==&lt;br /&gt;
Our project will modify the existing views. After modification, the views’ look and feel should remain same as before. The rendering should be faster with lesser data sent to and from the server.&lt;br /&gt;
&lt;br /&gt;
===To test add participants:===&lt;br /&gt;
# Login in as instructor.&lt;br /&gt;
# Create a new assignment and save it.&lt;br /&gt;
# Go to Manage -&amp;gt; Assignments, you should see your newly added assignment here.&lt;br /&gt;
# Now click on ’Add participants’ button available in the list of actions for the assignment, which will direct you to the page which lists all the participants of an assignment. Here you will have the option to add a new participant.&lt;br /&gt;
&lt;br /&gt;
[[File:AssgnPart.png]]&lt;br /&gt;
&lt;br /&gt;
===To test editing questionnaire===&lt;br /&gt;
# Login in as instructor.&lt;br /&gt;
# Go to Manage -&amp;gt; Questionnaires. Create a new Review Questionnaire by clicking on the ‘New public item’ button for ‘Review’.&lt;br /&gt;
# Name the Questionnaire and click on create button&lt;br /&gt;
# Click on Edit for newly created questionnaire.&lt;br /&gt;
&lt;br /&gt;
===To test adding TA===&lt;br /&gt;
# Login in as instructor.&lt;br /&gt;
# Go to Manage -&amp;gt; Courses, you should see the list of courses already present in the Expertiza.&lt;br /&gt;
# Now click on ’Add TA’ button available in the list of actions for the course, which will direct you to the page which lists all the TAs of a course. Through this page, we can add new TAs as well.&lt;br /&gt;
&lt;br /&gt;
==Assumptions==&lt;br /&gt;
This project only modifies the way that views rendered to the user. It also demands scripting some server side code to handle the requests. We do not implement anything beyond this.&lt;br /&gt;
&lt;br /&gt;
==Portability==&lt;br /&gt;
The system is portable on windows and UNIX environment. After our modification, it can continue running on both Windows and UNIX environment.&lt;br /&gt;
&lt;br /&gt;
==Details of Requirements==&lt;br /&gt;
===Hardware requirements===&lt;br /&gt;
* Computing Power: The amount of computing power would be the same as the current Expertiza system.&lt;br /&gt;
&lt;br /&gt;
* Memory: The amount of memory would be the same as the current Expertiza system.&lt;br /&gt;
&lt;br /&gt;
* Disk Storage: The amount of disk storage would be the same as the current Expertiza system.&lt;br /&gt;
&lt;br /&gt;
* Peripherals: The peripherals would be the same as the current Expertiza system.&lt;br /&gt;
&lt;br /&gt;
* Network: The network would be the same as the current Expertiza system.&lt;br /&gt;
&lt;br /&gt;
===Software requirements===&lt;br /&gt;
* Operating system environment : The operating system can be either windows or UNIX based OS.  Both are now used in the current Expertiza system.&lt;br /&gt;
&lt;br /&gt;
* Networking environment: As used in the current Expertiza system&lt;br /&gt;
&lt;br /&gt;
* Tools: Ruby Mines, Git&lt;/div&gt;</summary>
		<author><name>Amozumd</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:TA.png&amp;diff=99496</id>
		<title>File:TA.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:TA.png&amp;diff=99496"/>
		<updated>2015-11-12T14:15:34Z</updated>

		<summary type="html">&lt;p&gt;Amozumd: uploaded a new version of &amp;amp;quot;File:TA.png&amp;amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Amozumd</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Quest.png&amp;diff=99495</id>
		<title>File:Quest.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Quest.png&amp;diff=99495"/>
		<updated>2015-11-12T14:15:14Z</updated>

		<summary type="html">&lt;p&gt;Amozumd: uploaded a new version of &amp;amp;quot;File:Quest.png&amp;amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Amozumd</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:AssgnPart.png&amp;diff=99494</id>
		<title>File:AssgnPart.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:AssgnPart.png&amp;diff=99494"/>
		<updated>2015-11-12T14:14:36Z</updated>

		<summary type="html">&lt;p&gt;Amozumd: uploaded a new version of &amp;amp;quot;File:AssgnPart.png&amp;amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Amozumd</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:TA.png&amp;diff=99493</id>
		<title>File:TA.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:TA.png&amp;diff=99493"/>
		<updated>2015-11-12T14:11:53Z</updated>

		<summary type="html">&lt;p&gt;Amozumd: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Amozumd</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Quest.png&amp;diff=99492</id>
		<title>File:Quest.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Quest.png&amp;diff=99492"/>
		<updated>2015-11-12T14:11:08Z</updated>

		<summary type="html">&lt;p&gt;Amozumd: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Amozumd</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:AssgnPart.png&amp;diff=99491</id>
		<title>File:AssgnPart.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:AssgnPart.png&amp;diff=99491"/>
		<updated>2015-11-12T14:09:27Z</updated>

		<summary type="html">&lt;p&gt;Amozumd: uploaded a new version of &amp;amp;quot;File:AssgnPart.png&amp;amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Amozumd</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:AssgnPart.png&amp;diff=99490</id>
		<title>File:AssgnPart.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:AssgnPart.png&amp;diff=99490"/>
		<updated>2015-11-12T14:08:11Z</updated>

		<summary type="html">&lt;p&gt;Amozumd: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Amozumd</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015&amp;diff=97237</id>
		<title>CSC/ECE 517 Fall 2015</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015&amp;diff=97237"/>
		<updated>2015-10-28T13:01:37Z</updated>

		<summary type="html">&lt;p&gt;Amozumd: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Writing Assignment 2==&lt;br /&gt;
*[[CSC/ECE_517_Fall_2015/sample_page]]&lt;br /&gt;
*[[CSC/ECE_517_Fall_2015/ossE1558BGJ]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2015/oss/M1502/AAAASS]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2015/oss/M1503/IntegrateXMLParser]]&lt;br /&gt;
*[[CSC/ECE_517_Fall_2015/ossE1568BZHXJS]]&lt;br /&gt;
*[[CSC/ECE_517_Fall_2015/ossE1572VPGMAL]]&lt;br /&gt;
*[[CSC/ECE_517_Fall_2015/oss_E1573_sap]]&lt;/div&gt;</summary>
		<author><name>Amozumd</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015/oss_E1573_sap&amp;diff=97236</id>
		<title>CSC/ECE 517 Fall 2015/oss E1573 sap</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015/oss_E1573_sap&amp;diff=97236"/>
		<updated>2015-10-28T13:01:06Z</updated>

		<summary type="html">&lt;p&gt;Amozumd: Created page with &amp;quot;== '''E1573 Unit Test for Assignment model''' ==  Assignment.rb is a model in Expertiza -a ruby rails application, that handles the various assignments assigned by the instructor...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== '''E1573 Unit Test for Assignment model''' ==&lt;br /&gt;
&lt;br /&gt;
Assignment.rb is a model in Expertiza -a ruby rails application, that handles the various assignments assigned by the instructors to the teams during their coursework. The OSS project &amp;quot;Unit Test for Assignment model&amp;quot; tests the relationships, validation and scope of the assignment model using RSpec and Factory Girl.&lt;br /&gt;
&lt;br /&gt;
==Goals==&lt;br /&gt;
*Write specs for major instance methods of assignment.rb model&lt;br /&gt;
*Create test data by writing factories and use the test data to test the model with rspec  &lt;br /&gt;
&lt;br /&gt;
==Why is unit testing required==&lt;br /&gt;
*Visibility and reporting&lt;br /&gt;
*Control and correction&lt;br /&gt;
*Efficiency and speed&lt;br /&gt;
*Planning and predictability&lt;br /&gt;
*Customer satisfaction&lt;br /&gt;
&lt;br /&gt;
==Factory Girl==&lt;br /&gt;
Factory Girl is a fixture replacement which has easy-to-use definition syntax. &amp;lt;ref&amp;gt;http://www.rubydoc.info/gems/factory_girl/file/README.md&amp;lt;/ref&amp;gt;factory_girl_rails provided Rails integration for Factory Girl. We define a factory to create objects which will be used for testing.&lt;br /&gt;
==RSpec==&lt;br /&gt;
RSpec is used for Test Driven Development. It is a Domain Specific Language, also called DSL, used specifically for Ruby Rails projects. It is used for describing the expected behavior of a system with executable examples. RSpec code is similar to Ruby code and it leverages Ruby features and syntax so as to make up a “mini-language” focused on the job of testing. It is commonly used for Unit Testing and Functional testing.&amp;lt;ref&amp;gt;https://www.youtube.com/watch?v=oFX1KPNRruA&amp;amp;feature=relmfu&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Setting up Rspec and FactoryGirl ==&lt;br /&gt;
&lt;br /&gt;
=== GemFile ===&lt;br /&gt;
Add the following lines of code in the gemfile:&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;source 'https://rubygems.org'&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 gem 'rspec-rails','~&amp;gt;3.0'&lt;br /&gt;
 gem 'factory_girl-rails','~&amp;gt;4.0'&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Preparing FactoryGirl ===&lt;br /&gt;
FactoryGirl is a Ruby Gem that mocks certain classes for&lt;br /&gt;
automated tests. We will use FactoryGirl to mock nodes and&lt;br /&gt;
lists.&lt;br /&gt;
&lt;br /&gt;
Add the following lines of code to the RSpec config in spec/spec_helper.rb.&lt;br /&gt;
 &amp;lt;code&amp;gt;require 'factory_girl_rails'&lt;br /&gt;
 &lt;br /&gt;
 RSpec.configure do |config|&lt;br /&gt;
   config.include FactoryGirl::Syntax::Methods&lt;br /&gt;
 end&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Building Factories ===&lt;br /&gt;
Each factory has a name and a set of attributes. Implicitly, the name of the factory corresponds to the the class, whose test objects are created by default, but it's possible to explicitly specify the class also.&lt;br /&gt;
&lt;br /&gt;
This will create the objects of the User class:&lt;br /&gt;
       factory :user do&lt;br /&gt;
         sequence(:name) { |n| &amp;quot;NewName #{n}&amp;quot; }&lt;br /&gt;
         fullname {&amp;quot;test_user&amp;quot;}&lt;br /&gt;
         email {&amp;quot;sjolly@ncsu.edu&amp;quot;}&lt;br /&gt;
         parent_id =1&lt;br /&gt;
         is_new_user=true&lt;br /&gt;
       end&lt;br /&gt;
This will use the User class (Admin would have been created):&lt;br /&gt;
     factory :admin '''class: User''' do&lt;br /&gt;
        sequence(:name) { |n| &amp;quot;NewName #{n}&amp;quot; }&lt;br /&gt;
        fullname {&amp;quot;test_user&amp;quot;}&lt;br /&gt;
        email {&amp;quot;sjolly@ncsu.edu&amp;quot;}&lt;br /&gt;
        parent_id =1&lt;br /&gt;
        is_new_user=true&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
It's possible to set up associations within factories. If the factory name is the same as the association name, the factory name can be left out, as given below :&lt;br /&gt;
&lt;br /&gt;
Factory for Assignment having associations with instructor and wiki_type:&lt;br /&gt;
&lt;br /&gt;
     factory :assignment_without_name, class: Assignment do&lt;br /&gt;
        name {}&lt;br /&gt;
        submitter_count {3}&lt;br /&gt;
        is_coding_assignment {true}&lt;br /&gt;
        microtask {true}&lt;br /&gt;
        review_assignment_strategy {'Auto-Selected'}&lt;br /&gt;
        '''''association :instructor, factory: :user'''''&lt;br /&gt;
        '''association :wiki_type, factory: :wiki_typ'''e'' &lt;br /&gt;
     end&lt;br /&gt;
&lt;br /&gt;
===Creating specs ===&lt;br /&gt;
&lt;br /&gt;
*Create a assignment_spec.rb file in spec/models folder&lt;br /&gt;
&lt;br /&gt;
An example of a test case is&lt;br /&gt;
 &amp;lt;code&amp;gt;require 'spec_helper'&lt;br /&gt;
 &lt;br /&gt;
 describe &amp;quot;Team_Assignment&amp;quot; do&lt;br /&gt;
    it &amp;quot;checks team assignment should be true&amp;quot; do&lt;br /&gt;
    assign=FactoryGirl.create(:assignment)&lt;br /&gt;
    res=assign.team_assignment&lt;br /&gt;
    expect(res).to be true&lt;br /&gt;
  end&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Running RSpec===&lt;br /&gt;
&lt;br /&gt;
 $ rspec spec/models/assignment_spec.rb &lt;br /&gt;
You should be able to run tests successfully and see the following message:&lt;br /&gt;
 Finished in 1.11 seconds (files took 14.47 seconds to load)&lt;br /&gt;
 14 examples, 0 failures&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;References/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Amozumd</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015&amp;diff=97235</id>
		<title>CSC/ECE 517 Fall 2015</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015&amp;diff=97235"/>
		<updated>2015-10-28T12:54:20Z</updated>

		<summary type="html">&lt;p&gt;Amozumd: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Writing Assignment 2==&lt;br /&gt;
*[[CSC/ECE_517_Fall_2015/sample_page]]&lt;br /&gt;
*[[CSC/ECE_517_Fall_2015/ossE1558BGJ]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2015/oss/M1502/AAAASS]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2015/oss/M1503/IntegrateXMLParser]]&lt;br /&gt;
*[[CSC/ECE_517_Fall_2015/ossE1568BZHXJS]]&lt;br /&gt;
*[[CSC/ECE_517_Fall_2015/ossE1572VPGMAL]]&lt;br /&gt;
*[[CSC/ECE_517_Fall_2015/E1573_sap]]&lt;/div&gt;</summary>
		<author><name>Amozumd</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015/E1573_sap&amp;diff=97234</id>
		<title>CSC/ECE 517 Fall 2015/E1573 sap</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015/E1573_sap&amp;diff=97234"/>
		<updated>2015-10-28T12:52:35Z</updated>

		<summary type="html">&lt;p&gt;Amozumd: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== '''E1573 Unit Test for Assignment model''' ==&lt;br /&gt;
&lt;br /&gt;
Assignment.rb is a model in Expertiza -a ruby rails application, that handles the various assignments assigned by the instructors to the teams during their coursework. The OSS project &amp;quot;Unit Test for Assignment model&amp;quot; tests the relationships, validation and scope of the assignment model using RSpec and Factory Girl.&lt;br /&gt;
&lt;br /&gt;
==Goals==&lt;br /&gt;
*Write specs for major instance methods of assignment.rb model&lt;br /&gt;
*Create test data by writing factories and use the test data to test the model with rspec  &lt;br /&gt;
&lt;br /&gt;
==Why is unit testing required==&lt;br /&gt;
*Visibility and reporting&lt;br /&gt;
*Control and correction&lt;br /&gt;
*Efficiency and speed&lt;br /&gt;
*Planning and predictability&lt;br /&gt;
*Customer satisfaction&lt;br /&gt;
&lt;br /&gt;
==Factory Girl==&lt;br /&gt;
Factory Girl is a fixture replacement which has easy-to-use definition syntax. &amp;lt;ref&amp;gt;http://www.rubydoc.info/gems/factory_girl/file/README.md&amp;lt;/ref&amp;gt;factory_girl_rails provided Rails integration for Factory Girl. We define a factory to create objects which will be used for testing.&lt;br /&gt;
==RSpec==&lt;br /&gt;
RSpec is used for Test Driven Development. It is a Domain Specific Language, also called DSL, used specifically for Ruby Rails projects. It is used for describing the expected behavior of a system with executable examples. RSpec code is similar to Ruby code and it leverages Ruby features and syntax so as to make up a “mini-language” focused on the job of testing. It is commonly used for Unit Testing and Functional testing.&amp;lt;ref&amp;gt;https://www.youtube.com/watch?v=oFX1KPNRruA&amp;amp;feature=relmfu&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Setting up Rspec and FactoryGirl ==&lt;br /&gt;
&lt;br /&gt;
=== GemFile ===&lt;br /&gt;
Add the following lines of code in the gemfile:&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;source 'https://rubygems.org'&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 gem 'rspec-rails','~&amp;gt;3.0'&lt;br /&gt;
 gem 'factory_girl-rails','~&amp;gt;4.0'&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Preparing FactoryGirl ===&lt;br /&gt;
FactoryGirl is a Ruby Gem that mocks certain classes for&lt;br /&gt;
automated tests. We will use FactoryGirl to mock nodes and&lt;br /&gt;
lists.&lt;br /&gt;
&lt;br /&gt;
Add the following lines of code to the RSpec config in spec/spec_helper.rb.&lt;br /&gt;
 &amp;lt;code&amp;gt;require 'factory_girl_rails'&lt;br /&gt;
 &lt;br /&gt;
 RSpec.configure do |config|&lt;br /&gt;
   config.include FactoryGirl::Syntax::Methods&lt;br /&gt;
 end&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Building Factories ===&lt;br /&gt;
Each factory has a name and a set of attributes. Implicitly, the name of the factory corresponds to the the class, whose test objects are created by default, but it's possible to explicitly specify the class also.&lt;br /&gt;
&lt;br /&gt;
This will create the objects of the User class:&lt;br /&gt;
       factory :user do&lt;br /&gt;
         sequence(:name) { |n| &amp;quot;NewName #{n}&amp;quot; }&lt;br /&gt;
         fullname {&amp;quot;test_user&amp;quot;}&lt;br /&gt;
         email {&amp;quot;sjolly@ncsu.edu&amp;quot;}&lt;br /&gt;
         parent_id =1&lt;br /&gt;
         is_new_user=true&lt;br /&gt;
       end&lt;br /&gt;
This will use the User class (Admin would have been created):&lt;br /&gt;
     factory :admin '''class: User''' do&lt;br /&gt;
        sequence(:name) { |n| &amp;quot;NewName #{n}&amp;quot; }&lt;br /&gt;
        fullname {&amp;quot;test_user&amp;quot;}&lt;br /&gt;
        email {&amp;quot;sjolly@ncsu.edu&amp;quot;}&lt;br /&gt;
        parent_id =1&lt;br /&gt;
        is_new_user=true&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
It's possible to set up associations within factories. If the factory name is the same as the association name, the factory name can be left out, as given below :&lt;br /&gt;
&lt;br /&gt;
Factory for Assignment having associations with instructor and wiki_type:&lt;br /&gt;
&lt;br /&gt;
     factory :assignment_without_name, class: Assignment do&lt;br /&gt;
        name {}&lt;br /&gt;
        submitter_count {3}&lt;br /&gt;
        is_coding_assignment {true}&lt;br /&gt;
        microtask {true}&lt;br /&gt;
        review_assignment_strategy {'Auto-Selected'}&lt;br /&gt;
        '''''association :instructor, factory: :user'''''&lt;br /&gt;
        '''association :wiki_type, factory: :wiki_typ'''e'' &lt;br /&gt;
     end&lt;br /&gt;
&lt;br /&gt;
===Creating specs ===&lt;br /&gt;
&lt;br /&gt;
*Create a assignment_spec.rb file in spec/models folder&lt;br /&gt;
&lt;br /&gt;
An example of a test case is&lt;br /&gt;
 &amp;lt;code&amp;gt;require 'spec_helper'&lt;br /&gt;
 &lt;br /&gt;
 describe &amp;quot;Team_Assignment&amp;quot; do&lt;br /&gt;
    it &amp;quot;checks team assignment should be true&amp;quot; do&lt;br /&gt;
    assign=FactoryGirl.create(:assignment)&lt;br /&gt;
    res=assign.team_assignment&lt;br /&gt;
    expect(res).to be true&lt;br /&gt;
  end&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Running RSpec===&lt;br /&gt;
&lt;br /&gt;
 $ rspec spec/models/assignment_spec.rb &lt;br /&gt;
You should be able to run tests successfully and see the following message:&lt;br /&gt;
 Finished in 1.11 seconds (files took 14.47 seconds to load)&lt;br /&gt;
 14 examples, 0 failures&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;References/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Amozumd</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015/E1573_sap&amp;diff=97233</id>
		<title>CSC/ECE 517 Fall 2015/E1573 sap</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015/E1573_sap&amp;diff=97233"/>
		<updated>2015-10-28T12:50:19Z</updated>

		<summary type="html">&lt;p&gt;Amozumd: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== '''E1573 Unit Test for Assignment model''' ==&lt;br /&gt;
&lt;br /&gt;
Assignment.rb is a model in Expertiza -a ruby rails application, that handles the various assignments assigned by the instructors to the teams during their coursework. The OSS project &amp;quot;Unit Test for Assignment model&amp;quot; tests the relationships, validation and scope of the assignment model using RSpec and Factory Girl.&lt;br /&gt;
&lt;br /&gt;
==Goals==&lt;br /&gt;
*Write specs for major instance methods of assignment.rb model&lt;br /&gt;
*Create test data by writing factories and use the test data to test the model with rspec  &lt;br /&gt;
&lt;br /&gt;
==Why is unit testing required==&lt;br /&gt;
*Visibility and reporting&lt;br /&gt;
*Control and correction&lt;br /&gt;
*Efficiency and speed&lt;br /&gt;
*Planning and predictability&lt;br /&gt;
*Customer satisfaction&lt;br /&gt;
&lt;br /&gt;
==Factory Girl==&lt;br /&gt;
Factory Girl is a fixture replacement which has easy-to-use definition syntax. &amp;lt;ref&amp;gt;http://www.rubydoc.info/gems/factory_girl/file/README.md&amp;lt;/ref&amp;gt;factory_girl_rails provided Rails integration for Factory Girl. We define a factory to create objects which will be used for testing.&lt;br /&gt;
==RSpec==&lt;br /&gt;
RSpec is used for Test Driven Development. It is a Domain Specific Language, also called DSL, used specifically for Ruby Rails projects. It is used for describing the expected behavior of a system with executable examples. RSpec code is similar to Ruby code and it leverages Ruby features and syntax so as to make up a “mini-language” focused on the job of testing. It is commonly used for Unit Testing and Functional testing.&amp;lt;ref&amp;gt;https://www.youtube.com/watch?v=oFX1KPNRruA&amp;amp;feature=relmfu&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Setting up Rspec and FactoryGirl ==&lt;br /&gt;
&lt;br /&gt;
=== GemFile ===&lt;br /&gt;
Add the following lines of code in the gemfile:&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;source 'https://rubygems.org'&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 gem 'rspec-rails','~&amp;gt;3.0'&lt;br /&gt;
 gem 'factory_girl-rails','~&amp;gt;4.0'&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Preparing FactoryGirl ===&lt;br /&gt;
FactoryGirl is a Ruby Gem that mocks certain classes for&lt;br /&gt;
automated tests. We will use FactoryGirl to mock nodes and&lt;br /&gt;
lists.&lt;br /&gt;
&lt;br /&gt;
Add this to the RSpec config in spec/spec_helper.rb.&lt;br /&gt;
 &amp;lt;code&amp;gt;require 'factory_girl_rails'&lt;br /&gt;
 &lt;br /&gt;
 RSpec.configure do |config|&lt;br /&gt;
   config.include FactoryGirl::Syntax::Methods&lt;br /&gt;
 end&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Building Factories ===&lt;br /&gt;
Each factory has a name and a set of attributes. Implicitly, the name of the factory corresponds to the the class, whose test objects are created by default, but it's possible to explicitly specify the class also.&lt;br /&gt;
&lt;br /&gt;
This will create the objects of the User class:&lt;br /&gt;
       factory :user do&lt;br /&gt;
         sequence(:name) { |n| &amp;quot;NewName #{n}&amp;quot; }&lt;br /&gt;
         fullname {&amp;quot;test_user&amp;quot;}&lt;br /&gt;
         email {&amp;quot;sjolly@ncsu.edu&amp;quot;}&lt;br /&gt;
         parent_id =1&lt;br /&gt;
         is_new_user=true&lt;br /&gt;
       end&lt;br /&gt;
This will use the User class (Admin would have been created):&lt;br /&gt;
     factory :admin '''class: User''' do&lt;br /&gt;
        sequence(:name) { |n| &amp;quot;NewName #{n}&amp;quot; }&lt;br /&gt;
        fullname {&amp;quot;test_user&amp;quot;}&lt;br /&gt;
        email {&amp;quot;sjolly@ncsu.edu&amp;quot;}&lt;br /&gt;
        parent_id =1&lt;br /&gt;
        is_new_user=true&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
It's possible to set up associations within factories. If the factory name is the same as the association name, the factory name can be left out, as given below :&lt;br /&gt;
&lt;br /&gt;
Factory for Assignment having associations with instructor and wiki_type:&lt;br /&gt;
&lt;br /&gt;
     factory :assignment_without_name, class: Assignment do&lt;br /&gt;
        name {}&lt;br /&gt;
        submitter_count {3}&lt;br /&gt;
        is_coding_assignment {true}&lt;br /&gt;
        microtask {true}&lt;br /&gt;
        review_assignment_strategy {'Auto-Selected'}&lt;br /&gt;
        '''''association :instructor, factory: :user'''''&lt;br /&gt;
        '''association :wiki_type, factory: :wiki_typ'''e'' &lt;br /&gt;
     end&lt;br /&gt;
&lt;br /&gt;
===Creating specs ===&lt;br /&gt;
&lt;br /&gt;
*Create a assignment_spec.rb file in spec/models folder&lt;br /&gt;
&lt;br /&gt;
An example of a test case is&lt;br /&gt;
 &amp;lt;code&amp;gt;require 'spec_helper'&lt;br /&gt;
 &lt;br /&gt;
 describe &amp;quot;Team_Assignment&amp;quot; do&lt;br /&gt;
    it &amp;quot;checks team assignment should be true&amp;quot; do&lt;br /&gt;
    assign=FactoryGirl.create(:assignment)&lt;br /&gt;
    res=assign.team_assignment&lt;br /&gt;
    expect(res).to be true&lt;br /&gt;
  end&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Running RSpec===&lt;br /&gt;
&lt;br /&gt;
 $ rspec spec/models/assignment_spec.rb &lt;br /&gt;
You should be able to run tests successfully and see the following message:&lt;br /&gt;
 Finished in 1.11 seconds (files took 14.47 seconds to load)&lt;br /&gt;
 14 examples, 0 failures&lt;br /&gt;
&lt;br /&gt;
==References==&lt;/div&gt;</summary>
		<author><name>Amozumd</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015/E1573_sap&amp;diff=97174</id>
		<title>CSC/ECE 517 Fall 2015/E1573 sap</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015/E1573_sap&amp;diff=97174"/>
		<updated>2015-10-26T19:53:10Z</updated>

		<summary type="html">&lt;p&gt;Amozumd: Created page with &amp;quot;Assignment.rb is a model in Expertiza -a ruby rails application, that handles the various assignments assigned by the instructors to the teams during their coursework. The OSS pr...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Assignment.rb is a model in Expertiza -a ruby rails application, that handles the various assignments assigned by the instructors to the teams during their coursework. The OSS project &amp;quot;Unit Test for Assignment model&amp;quot; tests the relationships, validation and scope of the assignment model using RSpec and Factory Girl.&amp;lt;bR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Goals==&lt;br /&gt;
*Write specs for major instance methods of assignment.rb model&lt;br /&gt;
*Create test data by writing factories and use the test data to test the model with rspec  &lt;br /&gt;
&lt;br /&gt;
==Why is unit testing required==&lt;br /&gt;
*Visibility and reporting&lt;br /&gt;
*Control and correction&lt;br /&gt;
*Efficiency and speed&lt;br /&gt;
*Planning and predictability&lt;br /&gt;
*Customer satisfaction&lt;br /&gt;
&lt;br /&gt;
==Factory Girl==&lt;br /&gt;
Factory Girl is a fixture replacement which has easy-to-use definition syntax. &amp;lt;ref&amp;gt;http://www.rubydoc.info/gems/factory_girl/file/README.md&amp;lt;/ref&amp;gt;factory_girl_rails provided Rails integration for Factory Girl. We define a factory to create objects which will be used for testing.&lt;br /&gt;
===Installation of Factory_Girl_Spec===&lt;br /&gt;
* Add the following lines of code in the gemfile&lt;br /&gt;
  gem 'factory_girl-rails','~&amp;gt;4.0'&lt;br /&gt;
* run bundle install&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==RSpec==&lt;br /&gt;
RSpec is used for Test Driven Development. It is a Domain Specific Language, also called DSL, used specifically for Ruby Rails projects. It is used for describing the expected behavior of a system with executable examples. RSpec code is similar to Ruby code and it leverages Ruby features and syntax so as to make up a “mini-language” focused on the job of testing. It is commonly used for Unit Testing and Functional testing.&amp;lt;ref&amp;gt;https://www.youtube.com/watch?v=oFX1KPNRruA&amp;amp;feature=relmfu&amp;lt;/ref&amp;gt;&lt;br /&gt;
===Installation of RSpec===&lt;br /&gt;
* Add the following lines of code in the gemfile&lt;br /&gt;
  gem 'rspec-rails','~&amp;gt;3.0'&lt;br /&gt;
* run bundle install&lt;br /&gt;
&lt;br /&gt;
==Defining Factories==&lt;br /&gt;
Each factory has a name and a set of attributes. The name is used to guess the class of the object by default, but it's possible to explicitly specify&lt;br /&gt;
&lt;br /&gt;
This will create the objects of the User class:&lt;br /&gt;
       factory :user do&lt;br /&gt;
         sequence(:name) { |n| &amp;quot;NewName #{n}&amp;quot; }&lt;br /&gt;
         fullname {&amp;quot;test_user&amp;quot;}&lt;br /&gt;
         email {&amp;quot;sjolly@ncsu.edu&amp;quot;}&lt;br /&gt;
         parent_id =1&lt;br /&gt;
         is_new_user=true&lt;br /&gt;
       end&lt;br /&gt;
This will use the User class (Admin would have been created):&lt;br /&gt;
     factory :admin ''class: User'' do&lt;br /&gt;
        sequence(:name) { |n| &amp;quot;NewName #{n}&amp;quot; }&lt;br /&gt;
        fullname {&amp;quot;test_user&amp;quot;}&lt;br /&gt;
        email {&amp;quot;sjolly@ncsu.edu&amp;quot;}&lt;br /&gt;
        parent_id =1&lt;br /&gt;
        is_new_user=true&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
It's possible to set up associations within factories. If the factory name is the same as the association name, the factory name can be left out, as given below :&lt;br /&gt;
&lt;br /&gt;
Factory for Assignment having associations with instructor and wiki_type:&lt;br /&gt;
&lt;br /&gt;
     factory :assignment_without_name, class: Assignment do&lt;br /&gt;
        name {}&lt;br /&gt;
        submitter_count {3}&lt;br /&gt;
        is_coding_assignment {true}&lt;br /&gt;
        microtask {true}&lt;br /&gt;
        review_assignment_strategy {'Auto-Selected'}&lt;br /&gt;
        ''association :instructor, factory: :user&lt;br /&gt;
        association :wiki_type, factory: :wiki_type'' &lt;br /&gt;
     end&lt;br /&gt;
&lt;br /&gt;
==Creating specs ==&lt;br /&gt;
&lt;br /&gt;
*Create a assignment_spec.rb file in spec/models folder&lt;br /&gt;
&lt;br /&gt;
An example of a test case is&lt;br /&gt;
&lt;br /&gt;
describe &amp;quot;Team_Assignment&amp;quot; do&lt;br /&gt;
  it &amp;quot;checks team assignment should be true&amp;quot; do&lt;br /&gt;
    assign=FactoryGirl.create(:assignment)&lt;br /&gt;
    res=assign.team_assignment&lt;br /&gt;
    expect(res).to be true&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
==Running RSpec==&lt;br /&gt;
&lt;br /&gt;
 $ rspec spec/models/assignment_spec.rb &lt;br /&gt;
&lt;br /&gt;
===Result of Running RSpec===&lt;br /&gt;
&lt;br /&gt;
 Finished in 1.11 seconds (files took 14.47 seconds to load)&lt;br /&gt;
 14 examples, 0 failures&lt;br /&gt;
&lt;br /&gt;
==References==&lt;/div&gt;</summary>
		<author><name>Amozumd</name></author>
	</entry>
</feed>