<?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=Dguttik</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=Dguttik"/>
	<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=Special:Contributions/Dguttik"/>
	<updated>2026-05-18T07:32: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_Spring_2017/Convert_Assignment_Creation_Form_to_ReactJS&amp;diff=108888</id>
		<title>CSC/ECE 517 Spring 2017/Convert Assignment Creation Form to ReactJS</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/Convert_Assignment_Creation_Form_to_ReactJS&amp;diff=108888"/>
		<updated>2017-05-03T14:07:08Z</updated>

		<summary type="html">&lt;p&gt;Dguttik: /* Adding topics */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
This page is a part of CSC/ECE 517 Final Project for Spring 2017 to describe the changes made by us to the open source software project Expertiza. We are converting the assignment creation form to ReactJS. Following contains a brief introduction to Expertiza, ReactJS followed by the problems we are tackling, our strategy for the implementation and the test plan.&lt;br /&gt;
   &lt;br /&gt;
==Expertiza==&lt;br /&gt;
Expertiza is a Ruby on Rails based web application where students can submit and peer review learning objects such as codes, articles, websites etc., It is an open source software project funded by National Science Foundation(NSF). The instructor has the capability to create assignments with varied specifications such as topics, courses, team size, level of reviews etc., later review the submitted work and provide feedback. Students can enter their submissions and also review others' work. &lt;br /&gt;
&lt;br /&gt;
==ReactJS==&lt;br /&gt;
[https://en.wikipedia.org/wiki/React_(JavaScript_library) ReactJS] is the javascript framework developed by Facebook to solve the specific problem, ''UI rendering''. It is developed to solve the problem with complex binding in MVC framework using only one-way data binding. It is used for dynamic reloading of the page. It helps in reloading only the particular component required using Virtual DOM, which makes it fast by temporarily storing DOM&lt;br /&gt;
&lt;br /&gt;
'''Reasons for using ReactJS'''&lt;br /&gt;
* It has every functionality that an user interface required&lt;br /&gt;
* Easy data binding.&lt;br /&gt;
* Only single component changes are stored/changed without reloading the complete page.&lt;br /&gt;
* Fast and efficient&lt;br /&gt;
* Easy to scale&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
The Assignment Create and Edit Form are multi level forms. It consists of multiple inputs  and user interactions. Many input types have dependency on interactions by the user. For example, on check for a particular checkbox, remaining form is displayed. Also, edit page is reloaded whenever a topic is added. The task is to convert this pages into ReactJS components.&lt;br /&gt;
&lt;br /&gt;
'''Tasks to be done'''&lt;br /&gt;
*Organize the form layout, create several mockups and validate them to your users&lt;br /&gt;
*Make the table in topics tab sortable by its header&lt;br /&gt;
*Allow users to edit / add topics in the table instead of loading a new page&lt;br /&gt;
*Implement the new layout and convert the javascript to a ReactJS component&lt;br /&gt;
*Validate user entries&lt;br /&gt;
*Fix tooltips - Needed to increase the proximity of the tool tips in the assignments tab.&lt;br /&gt;
&lt;br /&gt;
==Current Implementation==&lt;br /&gt;
===Assignment Creation===&lt;br /&gt;
The assignment creation form consists of multiple inputs and requires interactions from the user. The current implementation is mostly in HTML with data validations being done by JQuery. When a user wants to create a new assignment by clicking the new assignment button, a server request is generated and new view is rendered. Again, another server request to make database entry is generated once the user fills in the data and clicks on 'save' button and again a new view is rendered. This kind of implementation doesn't support dynamic view rendering hence lacks the fluidity in overall user experience that one would expect.&lt;br /&gt;
&lt;br /&gt;
[[File:Create1.JPG]] &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Create2.JPG]]&lt;br /&gt;
&lt;br /&gt;
===Assignment Edition===&lt;br /&gt;
Similar to assignment creation page, edit page lacks the dynamic view rendering which makes the user experience cumbersome. Every time user wants to make changes to the assignment, a server request is generated and new view is rendered. The save button hit on completion will again generate another server request and render a new view.&lt;br /&gt;
&lt;br /&gt;
[[File:Edit.jpg]]&lt;br /&gt;
&lt;br /&gt;
=== Add/Edit topics in Assignment ===&lt;br /&gt;
In current implementation whenever a topic is added to the assignment, a request is sent to the server and user is redirected to a form in another page. Upon creation of topic user is rendered back to edit assignment page. This process involves lot of redirection. Now, the task is to avoid this redirection of pages and create a interactive ReactJS form for adding and editing topic.&lt;br /&gt;
&lt;br /&gt;
Currently this logic is implemented in new method in sign_up_controller.rb file and is invoked in the _add_topics.rb ruby injection file. With this action new.html.erb page is rendered. This should be avoided.&lt;br /&gt;
&lt;br /&gt;
'''Add topic:'''&lt;br /&gt;
&lt;br /&gt;
[[File:Add_topic_form.PNG]]&lt;br /&gt;
&lt;br /&gt;
Similar is the case for editing a topic. For editing a topic user is rendered to a form in edit page and again redirected to edit assignment page.&lt;br /&gt;
&lt;br /&gt;
'''Edit Topic:'''&lt;br /&gt;
&lt;br /&gt;
[[File:Edit_topic_form.PNG]]&lt;br /&gt;
&lt;br /&gt;
===Make the table in topics tab sortable by its header===&lt;br /&gt;
Currently after creating an assignment, we can add topics related to the assignment. The &amp;quot;Topics&amp;quot; tab in the edit assignment form shows the list of topics that are added to the assignment. The picture below shows the current page for displaying the list of topics of an assignment. The list is not sortable. The task is to make it sortable using ReactJS by topic id, topic name, Num. of slots, Available slots, Num. on waitlist columns as sorting on remaining columns doesn't give any meaningful display.&lt;br /&gt;
&lt;br /&gt;
[[File:topics_tab_assignment.png]]&lt;br /&gt;
&lt;br /&gt;
===Validating user entries===&lt;br /&gt;
The entries for the assignment creation are not according to any restrictions, that can add problem to database maintenance like sorting the entries, comparing them, retrieving. There are many such problem causing situations in the new assignment form, such as&lt;br /&gt;
&lt;br /&gt;
This is essential in both new assignment or editing assignment page.&lt;br /&gt;
&lt;br /&gt;
* User can add the number as new assignment name or he can give only special characters for it like &amp;quot;$$$$&amp;quot;.&lt;br /&gt;
* Though mentioned a mandatory no special characters, it was not properly implemented. System is accepting the special characters.&lt;br /&gt;
* Neglecting check boxes may lead to confusion with deadlines.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Vaidatinguser.PNG]]&lt;br /&gt;
&lt;br /&gt;
'''UML Diagram'''&lt;br /&gt;
&lt;br /&gt;
The following diagram depicts the flow of events leading to validations.&lt;br /&gt;
&lt;br /&gt;
[[File:Uml for validation.png]]&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
&lt;br /&gt;
Here is the main code for the regular expression check in Name of assignment and sub directory fields. Now, each time when a create button is clicked, the page is not checked with the model constraints but the reactjs component only. So, without reloading each time the checks are shown on the page as shown in the figure below.&lt;br /&gt;
&lt;br /&gt;
[[File:Validate.PNG]]&lt;br /&gt;
&lt;br /&gt;
==== Making topics table sortable on columns ====&lt;br /&gt;
&lt;br /&gt;
Below are the files modified.&lt;br /&gt;
&lt;br /&gt;
* app/views/sign_up_sheet/_add_signup_topics.html.erb&lt;br /&gt;
&lt;br /&gt;
[[File:Signup_topics.PNG]]&lt;br /&gt;
&lt;br /&gt;
* app/views/sign_up_sheet/_table_header.html.erb&lt;br /&gt;
&lt;br /&gt;
[[File:Table_header.PNG]]&lt;br /&gt;
&lt;br /&gt;
[[File:Js.PNG]]&lt;br /&gt;
&lt;br /&gt;
[[File:css.PNG]]&lt;br /&gt;
&lt;br /&gt;
==== Adding topics ====&lt;br /&gt;
&lt;br /&gt;
Tried to add topics using react js code in the file * app/views/sign_up_sheet/_add_topics.html.erb&lt;br /&gt;
&lt;br /&gt;
Modified files code:&lt;br /&gt;
&lt;br /&gt;
[[File:T1.PNG]]&lt;br /&gt;
&lt;br /&gt;
[[File:T2.PNG]]&lt;br /&gt;
&lt;br /&gt;
[[File:T3.PNG]]&lt;br /&gt;
&lt;br /&gt;
[[File:T4.PNG]]&lt;br /&gt;
&lt;br /&gt;
==Proposed Solution==&lt;br /&gt;
=== Assignment Creation ===&lt;br /&gt;
The new implementation will use ReactJS to generate a drop-down window on clicking on the New Assignment button (private/public) , providing same features as before. Database entry is made on submitting the form and the form is closed.&lt;br /&gt;
&lt;br /&gt;
Below is the mock view of what our implementation is going to look like:&lt;br /&gt;
&lt;br /&gt;
[[File:new_imp.png]]&lt;br /&gt;
&lt;br /&gt;
==== Files to be modified ====&lt;br /&gt;
*apps/assets/javascripts/tree_display.jsx.erb&lt;br /&gt;
*apps/controllers/assignments_controller.rb&lt;br /&gt;
*apps/controllers/tree_display_controller.rb&lt;br /&gt;
&lt;br /&gt;
=== Assignment Edition ===&lt;br /&gt;
Similar to assignment creation, in the new implementation, using ReactJS, when the edit assignment button is clicked, instead of making a server request and rendering a new view, a drop down window appears and saving the details will make the database entry.Since all the processing is done on the client side there will be decrease in the number of server requests.&lt;br /&gt;
&lt;br /&gt;
Below is the mock display of what our implementation is going to look like:&lt;br /&gt;
&lt;br /&gt;
[[File:Edit-new_imp.png]]&lt;br /&gt;
&lt;br /&gt;
==== Files to be modified ====&lt;br /&gt;
*apps/views/tree_display/list.html.erb&lt;br /&gt;
*apps/views/assignments/edit.html.erb&lt;br /&gt;
*apps/views/assignments/edit/_general.html.erb&lt;br /&gt;
&lt;br /&gt;
=== Addition of topics ===&lt;br /&gt;
* An interactive React JS component should be created and should be called by the ruby injection page ''sign_up_sheet/_add_topics.html.erb'' when New Topic link is clicked. This should show a form in that page to create topic.&lt;br /&gt;
* Delete/avoid usage of ''sign_up_sheet/new.html.erb'' page.&lt;br /&gt;
* Implement an React JS functional component to handle creation of topic and saving it to database.&lt;br /&gt;
&lt;br /&gt;
=== Editing topic ===&lt;br /&gt;
* An interactive React JS component should be created and should be called by the ruby injection page ''sign_up_sheet/_all_actions.html.erb'' when edit action is clicked. This should show a form in that page to edit topic.&lt;br /&gt;
* Delete/avoid usage of ''sign_up_sheet/edit.html.erb'' page.&lt;br /&gt;
* Implement an React JS functional component to handle editing  of topic and updating it to database.&lt;br /&gt;
&lt;br /&gt;
=== Make the table in topics tab sortable by its header ===&lt;br /&gt;
Following sub-tasks identified to implement sortable feature for topics table.&lt;br /&gt;
* Modify sign_up_sheet/_table_header.html.erb partial to change the table header fields to sortable type.&lt;br /&gt;
* Add sort functionality using ReactJS for each column that is meaningful to be sorted.&lt;br /&gt;
* Below is how output will look like&lt;br /&gt;
[[File:Topics_new.PNG]]&lt;br /&gt;
&lt;br /&gt;
=== Validating user entries ===&lt;br /&gt;
The following tasks are to be implemented to achieve users validation,&lt;br /&gt;
* Add the regular expression validation to avoid special characters in the names of assignment or directories.&lt;br /&gt;
* Correcting the code in edit assignment page too.&lt;br /&gt;
* Create validation for edge cases like giving empty values.&lt;br /&gt;
&lt;br /&gt;
==== Files to be modified ====&lt;br /&gt;
As, the project needs to be implemented in reactJS, which helps in reducing the complexing binding in MVC framework, only changing the javascript file can help to achieve this without changing model,&lt;br /&gt;
* app/assets/javascripts/tree_display.jsx.erb&lt;br /&gt;
&lt;br /&gt;
=== Fixing Tooltips ===&lt;br /&gt;
On exploring, it was noticed that all the existing tooltips work. However, we intend to increase the proximity of the tooltips in the assignment tab by increasing the size of the images.&lt;br /&gt;
&lt;br /&gt;
==Test Plan==&lt;br /&gt;
Rails development is the Test Driven development, which helps in ensuring the implementation of all proposed implementations. We will be writing all the implementations proposed as tests that will eventually be red in rspec and try to make them green by adding to the development part.&lt;br /&gt;
&lt;br /&gt;
For now the manual testing of these current implementations can help in testing the functionality from UI.&lt;br /&gt;
===Manual Testing===&lt;br /&gt;
Steps to manually test the feature are as follows: &lt;br /&gt;
&lt;br /&gt;
====Assignment Creation====&lt;br /&gt;
*Log in as an instructor ''(user-name:instructor6 password:password)''&lt;br /&gt;
*Go to Manage-&amp;gt;Assignments and click on the Assignments tab.&lt;br /&gt;
*Click on the 'New public assignment' or 'New private assignment' button&lt;br /&gt;
*Verify if drop-down window is displayed.&lt;br /&gt;
*Make valid entries for the available fields and click on 'create'.&lt;br /&gt;
*Verify if new assignment is successfully created.&lt;br /&gt;
&lt;br /&gt;
====Assignment Creation====&lt;br /&gt;
*Log in as an instructor ''(user-name:instructor6 password:password)''&lt;br /&gt;
*Go to Manage-&amp;gt;Assignments and click on the Assignments tab.&lt;br /&gt;
*Click on the Edit button for any of the available assignment.&lt;br /&gt;
*Verify if drop-down window is displayed.&lt;br /&gt;
*Make changes and click on 'save'.&lt;br /&gt;
*Verify if the changes made are successfully updated.&lt;br /&gt;
&lt;br /&gt;
====Topic Creation/Editing====&lt;br /&gt;
* Login as an instructor ''(user-name:instructor6 password:password)''&lt;br /&gt;
* Create an assignment&lt;br /&gt;
* Click 'New Topic' link or 'edit' action in topics table for a particular topic&lt;br /&gt;
* A pop window or form should be displayed in the same page&lt;br /&gt;
* Add topic details in that window/ form&lt;br /&gt;
* Save it&lt;br /&gt;
* Created or modified topic should be seen in topics table&lt;br /&gt;
 &lt;br /&gt;
====Make the table in topics tab sortable by its header====&lt;br /&gt;
* Login as an instructor ''(user-name:instructor6 password:password)''&lt;br /&gt;
* Create an assignment&lt;br /&gt;
* Add 2 topics to the assignment&lt;br /&gt;
* Click sort on Topic ID and check if they are sorted&lt;br /&gt;
* Click sort on Topic title and check if they are sorted&lt;br /&gt;
* Similarly test using other columns&lt;br /&gt;
&lt;br /&gt;
====Validating user entries====&lt;br /&gt;
*Log in as an instructor ''(user-name:instructor6 password:password)''&lt;br /&gt;
*Go to Manage-&amp;gt;Assignments and click on the Assignments tab.&lt;br /&gt;
*Click on the 'New public assignment' or 'New private assignment' button&lt;br /&gt;
*Try adding the assignment using the weird names, with special symbols, ignoring check boxes&lt;br /&gt;
*Verify if the assignment is shown in the table.&lt;br /&gt;
&lt;br /&gt;
Another way to check is from editing page too.&lt;br /&gt;
*Log in as an instructor ''(user-name:instructor6 password:password)''&lt;br /&gt;
*Go to Manage-&amp;gt;Assignments and click on the Assignments tab.&lt;br /&gt;
*Click on the Edit icon page.&lt;br /&gt;
*Try adding the assignment using the weird names, with special symbols, ignoring check boxes&lt;br /&gt;
*Verify if the assignment which is updated with special characters is shown in the table.&lt;br /&gt;
&lt;br /&gt;
===Automation testing===&lt;br /&gt;
The above tests all will be automated using rspec. Rspec Mock-ups will be created for checking the navigation flow of newly created React JS components.&lt;br /&gt;
&lt;br /&gt;
==Future Work==&lt;br /&gt;
&lt;br /&gt;
We will try to convert edit assignment page in to React JS. Design pages more clearly.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
#''http://railscasts.com/episodes/228-sortable-table-columns sortable-columns''&lt;br /&gt;
#''https://www.airpair.com/reactjs/posts/reactjs-a-guide-for-rails-developers adding-reactjs''&lt;br /&gt;
#''https://github.com/expertiza/expertiza/pull/855&lt;/div&gt;</summary>
		<author><name>Dguttik</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:T4.PNG&amp;diff=108887</id>
		<title>File:T4.PNG</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:T4.PNG&amp;diff=108887"/>
		<updated>2017-05-03T14:06:41Z</updated>

		<summary type="html">&lt;p&gt;Dguttik: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Dguttik</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:T3.PNG&amp;diff=108886</id>
		<title>File:T3.PNG</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:T3.PNG&amp;diff=108886"/>
		<updated>2017-05-03T14:06:03Z</updated>

		<summary type="html">&lt;p&gt;Dguttik: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Dguttik</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:T2.PNG&amp;diff=108885</id>
		<title>File:T2.PNG</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:T2.PNG&amp;diff=108885"/>
		<updated>2017-05-03T14:05:14Z</updated>

		<summary type="html">&lt;p&gt;Dguttik: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Dguttik</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:T1.PNG&amp;diff=108884</id>
		<title>File:T1.PNG</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:T1.PNG&amp;diff=108884"/>
		<updated>2017-05-03T14:03:49Z</updated>

		<summary type="html">&lt;p&gt;Dguttik: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Dguttik</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/Convert_Assignment_Creation_Form_to_ReactJS&amp;diff=108883</id>
		<title>CSC/ECE 517 Spring 2017/Convert Assignment Creation Form to ReactJS</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/Convert_Assignment_Creation_Form_to_ReactJS&amp;diff=108883"/>
		<updated>2017-05-03T14:02:12Z</updated>

		<summary type="html">&lt;p&gt;Dguttik: /* Implementation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
This page is a part of CSC/ECE 517 Final Project for Spring 2017 to describe the changes made by us to the open source software project Expertiza. We are converting the assignment creation form to ReactJS. Following contains a brief introduction to Expertiza, ReactJS followed by the problems we are tackling, our strategy for the implementation and the test plan.&lt;br /&gt;
   &lt;br /&gt;
==Expertiza==&lt;br /&gt;
Expertiza is a Ruby on Rails based web application where students can submit and peer review learning objects such as codes, articles, websites etc., It is an open source software project funded by National Science Foundation(NSF). The instructor has the capability to create assignments with varied specifications such as topics, courses, team size, level of reviews etc., later review the submitted work and provide feedback. Students can enter their submissions and also review others' work. &lt;br /&gt;
&lt;br /&gt;
==ReactJS==&lt;br /&gt;
[https://en.wikipedia.org/wiki/React_(JavaScript_library) ReactJS] is the javascript framework developed by Facebook to solve the specific problem, ''UI rendering''. It is developed to solve the problem with complex binding in MVC framework using only one-way data binding. It is used for dynamic reloading of the page. It helps in reloading only the particular component required using Virtual DOM, which makes it fast by temporarily storing DOM&lt;br /&gt;
&lt;br /&gt;
'''Reasons for using ReactJS'''&lt;br /&gt;
* It has every functionality that an user interface required&lt;br /&gt;
* Easy data binding.&lt;br /&gt;
* Only single component changes are stored/changed without reloading the complete page.&lt;br /&gt;
* Fast and efficient&lt;br /&gt;
* Easy to scale&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
The Assignment Create and Edit Form are multi level forms. It consists of multiple inputs  and user interactions. Many input types have dependency on interactions by the user. For example, on check for a particular checkbox, remaining form is displayed. Also, edit page is reloaded whenever a topic is added. The task is to convert this pages into ReactJS components.&lt;br /&gt;
&lt;br /&gt;
'''Tasks to be done'''&lt;br /&gt;
*Organize the form layout, create several mockups and validate them to your users&lt;br /&gt;
*Make the table in topics tab sortable by its header&lt;br /&gt;
*Allow users to edit / add topics in the table instead of loading a new page&lt;br /&gt;
*Implement the new layout and convert the javascript to a ReactJS component&lt;br /&gt;
*Validate user entries&lt;br /&gt;
*Fix tooltips - Needed to increase the proximity of the tool tips in the assignments tab.&lt;br /&gt;
&lt;br /&gt;
==Current Implementation==&lt;br /&gt;
===Assignment Creation===&lt;br /&gt;
The assignment creation form consists of multiple inputs and requires interactions from the user. The current implementation is mostly in HTML with data validations being done by JQuery. When a user wants to create a new assignment by clicking the new assignment button, a server request is generated and new view is rendered. Again, another server request to make database entry is generated once the user fills in the data and clicks on 'save' button and again a new view is rendered. This kind of implementation doesn't support dynamic view rendering hence lacks the fluidity in overall user experience that one would expect.&lt;br /&gt;
&lt;br /&gt;
[[File:Create1.JPG]] &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Create2.JPG]]&lt;br /&gt;
&lt;br /&gt;
===Assignment Edition===&lt;br /&gt;
Similar to assignment creation page, edit page lacks the dynamic view rendering which makes the user experience cumbersome. Every time user wants to make changes to the assignment, a server request is generated and new view is rendered. The save button hit on completion will again generate another server request and render a new view.&lt;br /&gt;
&lt;br /&gt;
[[File:Edit.jpg]]&lt;br /&gt;
&lt;br /&gt;
=== Add/Edit topics in Assignment ===&lt;br /&gt;
In current implementation whenever a topic is added to the assignment, a request is sent to the server and user is redirected to a form in another page. Upon creation of topic user is rendered back to edit assignment page. This process involves lot of redirection. Now, the task is to avoid this redirection of pages and create a interactive ReactJS form for adding and editing topic.&lt;br /&gt;
&lt;br /&gt;
Currently this logic is implemented in new method in sign_up_controller.rb file and is invoked in the _add_topics.rb ruby injection file. With this action new.html.erb page is rendered. This should be avoided.&lt;br /&gt;
&lt;br /&gt;
'''Add topic:'''&lt;br /&gt;
&lt;br /&gt;
[[File:Add_topic_form.PNG]]&lt;br /&gt;
&lt;br /&gt;
Similar is the case for editing a topic. For editing a topic user is rendered to a form in edit page and again redirected to edit assignment page.&lt;br /&gt;
&lt;br /&gt;
'''Edit Topic:'''&lt;br /&gt;
&lt;br /&gt;
[[File:Edit_topic_form.PNG]]&lt;br /&gt;
&lt;br /&gt;
===Make the table in topics tab sortable by its header===&lt;br /&gt;
Currently after creating an assignment, we can add topics related to the assignment. The &amp;quot;Topics&amp;quot; tab in the edit assignment form shows the list of topics that are added to the assignment. The picture below shows the current page for displaying the list of topics of an assignment. The list is not sortable. The task is to make it sortable using ReactJS by topic id, topic name, Num. of slots, Available slots, Num. on waitlist columns as sorting on remaining columns doesn't give any meaningful display.&lt;br /&gt;
&lt;br /&gt;
[[File:topics_tab_assignment.png]]&lt;br /&gt;
&lt;br /&gt;
===Validating user entries===&lt;br /&gt;
The entries for the assignment creation are not according to any restrictions, that can add problem to database maintenance like sorting the entries, comparing them, retrieving. There are many such problem causing situations in the new assignment form, such as&lt;br /&gt;
&lt;br /&gt;
This is essential in both new assignment or editing assignment page.&lt;br /&gt;
&lt;br /&gt;
* User can add the number as new assignment name or he can give only special characters for it like &amp;quot;$$$$&amp;quot;.&lt;br /&gt;
* Though mentioned a mandatory no special characters, it was not properly implemented. System is accepting the special characters.&lt;br /&gt;
* Neglecting check boxes may lead to confusion with deadlines.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Vaidatinguser.PNG]]&lt;br /&gt;
&lt;br /&gt;
'''UML Diagram'''&lt;br /&gt;
&lt;br /&gt;
The following diagram depicts the flow of events leading to validations.&lt;br /&gt;
&lt;br /&gt;
[[File:Uml for validation.png]]&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
&lt;br /&gt;
Here is the main code for the regular expression check in Name of assignment and sub directory fields. Now, each time when a create button is clicked, the page is not checked with the model constraints but the reactjs component only. So, without reloading each time the checks are shown on the page as shown in the figure below.&lt;br /&gt;
&lt;br /&gt;
[[File:Validate.PNG]]&lt;br /&gt;
&lt;br /&gt;
==== Making topics table sortable on columns ====&lt;br /&gt;
&lt;br /&gt;
Below are the files modified.&lt;br /&gt;
&lt;br /&gt;
* app/views/sign_up_sheet/_add_signup_topics.html.erb&lt;br /&gt;
&lt;br /&gt;
[[File:Signup_topics.PNG]]&lt;br /&gt;
&lt;br /&gt;
* app/views/sign_up_sheet/_table_header.html.erb&lt;br /&gt;
&lt;br /&gt;
[[File:Table_header.PNG]]&lt;br /&gt;
&lt;br /&gt;
[[File:Js.PNG]]&lt;br /&gt;
&lt;br /&gt;
[[File:css.PNG]]&lt;br /&gt;
&lt;br /&gt;
==== Adding topics ====&lt;br /&gt;
&lt;br /&gt;
Tried to add topics using react js code in the file * app/views/sign_up_sheet/_add_topics.html.erb&lt;br /&gt;
&lt;br /&gt;
Modified files code:&lt;br /&gt;
&lt;br /&gt;
==Proposed Solution==&lt;br /&gt;
=== Assignment Creation ===&lt;br /&gt;
The new implementation will use ReactJS to generate a drop-down window on clicking on the New Assignment button (private/public) , providing same features as before. Database entry is made on submitting the form and the form is closed.&lt;br /&gt;
&lt;br /&gt;
Below is the mock view of what our implementation is going to look like:&lt;br /&gt;
&lt;br /&gt;
[[File:new_imp.png]]&lt;br /&gt;
&lt;br /&gt;
==== Files to be modified ====&lt;br /&gt;
*apps/assets/javascripts/tree_display.jsx.erb&lt;br /&gt;
*apps/controllers/assignments_controller.rb&lt;br /&gt;
*apps/controllers/tree_display_controller.rb&lt;br /&gt;
&lt;br /&gt;
=== Assignment Edition ===&lt;br /&gt;
Similar to assignment creation, in the new implementation, using ReactJS, when the edit assignment button is clicked, instead of making a server request and rendering a new view, a drop down window appears and saving the details will make the database entry.Since all the processing is done on the client side there will be decrease in the number of server requests.&lt;br /&gt;
&lt;br /&gt;
Below is the mock display of what our implementation is going to look like:&lt;br /&gt;
&lt;br /&gt;
[[File:Edit-new_imp.png]]&lt;br /&gt;
&lt;br /&gt;
==== Files to be modified ====&lt;br /&gt;
*apps/views/tree_display/list.html.erb&lt;br /&gt;
*apps/views/assignments/edit.html.erb&lt;br /&gt;
*apps/views/assignments/edit/_general.html.erb&lt;br /&gt;
&lt;br /&gt;
=== Addition of topics ===&lt;br /&gt;
* An interactive React JS component should be created and should be called by the ruby injection page ''sign_up_sheet/_add_topics.html.erb'' when New Topic link is clicked. This should show a form in that page to create topic.&lt;br /&gt;
* Delete/avoid usage of ''sign_up_sheet/new.html.erb'' page.&lt;br /&gt;
* Implement an React JS functional component to handle creation of topic and saving it to database.&lt;br /&gt;
&lt;br /&gt;
=== Editing topic ===&lt;br /&gt;
* An interactive React JS component should be created and should be called by the ruby injection page ''sign_up_sheet/_all_actions.html.erb'' when edit action is clicked. This should show a form in that page to edit topic.&lt;br /&gt;
* Delete/avoid usage of ''sign_up_sheet/edit.html.erb'' page.&lt;br /&gt;
* Implement an React JS functional component to handle editing  of topic and updating it to database.&lt;br /&gt;
&lt;br /&gt;
=== Make the table in topics tab sortable by its header ===&lt;br /&gt;
Following sub-tasks identified to implement sortable feature for topics table.&lt;br /&gt;
* Modify sign_up_sheet/_table_header.html.erb partial to change the table header fields to sortable type.&lt;br /&gt;
* Add sort functionality using ReactJS for each column that is meaningful to be sorted.&lt;br /&gt;
* Below is how output will look like&lt;br /&gt;
[[File:Topics_new.PNG]]&lt;br /&gt;
&lt;br /&gt;
=== Validating user entries ===&lt;br /&gt;
The following tasks are to be implemented to achieve users validation,&lt;br /&gt;
* Add the regular expression validation to avoid special characters in the names of assignment or directories.&lt;br /&gt;
* Correcting the code in edit assignment page too.&lt;br /&gt;
* Create validation for edge cases like giving empty values.&lt;br /&gt;
&lt;br /&gt;
==== Files to be modified ====&lt;br /&gt;
As, the project needs to be implemented in reactJS, which helps in reducing the complexing binding in MVC framework, only changing the javascript file can help to achieve this without changing model,&lt;br /&gt;
* app/assets/javascripts/tree_display.jsx.erb&lt;br /&gt;
&lt;br /&gt;
=== Fixing Tooltips ===&lt;br /&gt;
On exploring, it was noticed that all the existing tooltips work. However, we intend to increase the proximity of the tooltips in the assignment tab by increasing the size of the images.&lt;br /&gt;
&lt;br /&gt;
==Test Plan==&lt;br /&gt;
Rails development is the Test Driven development, which helps in ensuring the implementation of all proposed implementations. We will be writing all the implementations proposed as tests that will eventually be red in rspec and try to make them green by adding to the development part.&lt;br /&gt;
&lt;br /&gt;
For now the manual testing of these current implementations can help in testing the functionality from UI.&lt;br /&gt;
===Manual Testing===&lt;br /&gt;
Steps to manually test the feature are as follows: &lt;br /&gt;
&lt;br /&gt;
====Assignment Creation====&lt;br /&gt;
*Log in as an instructor ''(user-name:instructor6 password:password)''&lt;br /&gt;
*Go to Manage-&amp;gt;Assignments and click on the Assignments tab.&lt;br /&gt;
*Click on the 'New public assignment' or 'New private assignment' button&lt;br /&gt;
*Verify if drop-down window is displayed.&lt;br /&gt;
*Make valid entries for the available fields and click on 'create'.&lt;br /&gt;
*Verify if new assignment is successfully created.&lt;br /&gt;
&lt;br /&gt;
====Assignment Creation====&lt;br /&gt;
*Log in as an instructor ''(user-name:instructor6 password:password)''&lt;br /&gt;
*Go to Manage-&amp;gt;Assignments and click on the Assignments tab.&lt;br /&gt;
*Click on the Edit button for any of the available assignment.&lt;br /&gt;
*Verify if drop-down window is displayed.&lt;br /&gt;
*Make changes and click on 'save'.&lt;br /&gt;
*Verify if the changes made are successfully updated.&lt;br /&gt;
&lt;br /&gt;
====Topic Creation/Editing====&lt;br /&gt;
* Login as an instructor ''(user-name:instructor6 password:password)''&lt;br /&gt;
* Create an assignment&lt;br /&gt;
* Click 'New Topic' link or 'edit' action in topics table for a particular topic&lt;br /&gt;
* A pop window or form should be displayed in the same page&lt;br /&gt;
* Add topic details in that window/ form&lt;br /&gt;
* Save it&lt;br /&gt;
* Created or modified topic should be seen in topics table&lt;br /&gt;
 &lt;br /&gt;
====Make the table in topics tab sortable by its header====&lt;br /&gt;
* Login as an instructor ''(user-name:instructor6 password:password)''&lt;br /&gt;
* Create an assignment&lt;br /&gt;
* Add 2 topics to the assignment&lt;br /&gt;
* Click sort on Topic ID and check if they are sorted&lt;br /&gt;
* Click sort on Topic title and check if they are sorted&lt;br /&gt;
* Similarly test using other columns&lt;br /&gt;
&lt;br /&gt;
====Validating user entries====&lt;br /&gt;
*Log in as an instructor ''(user-name:instructor6 password:password)''&lt;br /&gt;
*Go to Manage-&amp;gt;Assignments and click on the Assignments tab.&lt;br /&gt;
*Click on the 'New public assignment' or 'New private assignment' button&lt;br /&gt;
*Try adding the assignment using the weird names, with special symbols, ignoring check boxes&lt;br /&gt;
*Verify if the assignment is shown in the table.&lt;br /&gt;
&lt;br /&gt;
Another way to check is from editing page too.&lt;br /&gt;
*Log in as an instructor ''(user-name:instructor6 password:password)''&lt;br /&gt;
*Go to Manage-&amp;gt;Assignments and click on the Assignments tab.&lt;br /&gt;
*Click on the Edit icon page.&lt;br /&gt;
*Try adding the assignment using the weird names, with special symbols, ignoring check boxes&lt;br /&gt;
*Verify if the assignment which is updated with special characters is shown in the table.&lt;br /&gt;
&lt;br /&gt;
===Automation testing===&lt;br /&gt;
The above tests all will be automated using rspec. Rspec Mock-ups will be created for checking the navigation flow of newly created React JS components.&lt;br /&gt;
&lt;br /&gt;
==Future Work==&lt;br /&gt;
&lt;br /&gt;
We will try to convert edit assignment page in to React JS. Design pages more clearly.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
#''http://railscasts.com/episodes/228-sortable-table-columns sortable-columns''&lt;br /&gt;
#''https://www.airpair.com/reactjs/posts/reactjs-a-guide-for-rails-developers adding-reactjs''&lt;br /&gt;
#''https://github.com/expertiza/expertiza/pull/855&lt;/div&gt;</summary>
		<author><name>Dguttik</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/Convert_Assignment_Creation_Form_to_ReactJS&amp;diff=108208</id>
		<title>CSC/ECE 517 Spring 2017/Convert Assignment Creation Form to ReactJS</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/Convert_Assignment_Creation_Form_to_ReactJS&amp;diff=108208"/>
		<updated>2017-04-08T02:24:43Z</updated>

		<summary type="html">&lt;p&gt;Dguttik: /* References */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
This page is a part of CSC/ECE 517 Final Project for Spring 2017 to describe the changes made by us to the open source software project Expertiza. We are converting the assignment creation form to ReactJS. Following contains a brief introduction to Expertiza, ReactJS followed by the problems we are tackling, our strategy for the implementation and the test plan.&lt;br /&gt;
   &lt;br /&gt;
==Expertiza==&lt;br /&gt;
Expertiza is a Ruby on Rails based web application where students can submit and peer review learning objects such as codes, articles, websites etc., It is an open source software project funded by National Science Foundation(NSF). The instructor has the capability to create assignments with varied specifications such as topics, courses, team size, level of reviews etc., later review the submitted work and provide feedback. Students can enter their submissions and also review others' work. &lt;br /&gt;
&lt;br /&gt;
==ReactJS==&lt;br /&gt;
ReactJS is the javascript framework developed by Facebook to solve the specific problem, ''UI rendering''. It is developed to solve the problem with complex binding in MVC framework using only one-way data binding. It is used for dynamic reloading of the page. It helps in reloading only the particular component required using Virtual DOM, which makes it fast by temporarily storing DOM&lt;br /&gt;
&lt;br /&gt;
'''Reasons for using ReactJS'''&lt;br /&gt;
* It has every functionality that an user interface required&lt;br /&gt;
* Easy data binding.&lt;br /&gt;
* Only single component changes are stored/changed without reloading the complete page.&lt;br /&gt;
* Fast and efficient&lt;br /&gt;
* Easy to scale&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
The Assignment Create and Edit Form are multi level forms. It consists of multiple inputs  and user interactions. Many input types have dependency on interactions by the user. For example, on check for a particular checkbox, remaining form is displayed. Also, edit page is reloaded whenever a topic is added. The task is to convert this pages into ReactJS components.&lt;br /&gt;
&lt;br /&gt;
'''Tasks to be done'''&lt;br /&gt;
*Organize the form layout, create several mockups and validate them to your users&lt;br /&gt;
*Make the table in topics tab sortable by its header&lt;br /&gt;
*Allow users to edit / add topics in the table instead of loading a new page&lt;br /&gt;
*Implement the new layout and convert the javascript to a ReactJS component&lt;br /&gt;
*Validate user entries&lt;br /&gt;
*Fix tooltips that don’t work&lt;br /&gt;
&lt;br /&gt;
==Current Implementation==&lt;br /&gt;
===Assignment Creation===&lt;br /&gt;
The assignment creation form consists of multiple inputs and requires interactions from the user. The current implementation is mostly in HTML with data validations being done by JQuery. When a user wants to create a new assignment by clicking the new assignment button, a server request is generated and new view is rendered. Again, another server request to make database entry is generated once the user fills in the data and clicks on 'save' button and again a new view is rendered. This kind of implementation doesn't support dynamic view rendering hence lacks the fluidity in overall user experience that one would expect.&lt;br /&gt;
&lt;br /&gt;
[[File:Create1.JPG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Create2.JPG]]&lt;br /&gt;
&lt;br /&gt;
===Assignment Edition===&lt;br /&gt;
Similar to assignment creation page, edit page lacks the dynamic view rendering which makes the user experience cumbersome. Every time user wants to make changes to the assignment, a server request is generated and new view is rendered. The save button hit on completion will again generate another server request and render a new view.&lt;br /&gt;
&lt;br /&gt;
[[File:Edit.jpg]]&lt;br /&gt;
&lt;br /&gt;
=== Add/Edit topics in Assignment ===&lt;br /&gt;
In current implementation whenever a topic is added to the assignment, a request is sent to the server and user is redirected to a form in another page. Opon creation of topic user is rendered back to edit assignment page. This process involves lot of redirection. Now, the task is to avoid this redirection of pages and create a interactive React JS form for adding and editing topic.&lt;br /&gt;
&lt;br /&gt;
Currently this logic is implemented in new method in sign_up_controller.rb file and is invoked in the _add_topics.rb ruby injection file. With this action new.html.erb page is rendered. This should be avoided.&lt;br /&gt;
&lt;br /&gt;
'''Add topic:'''&lt;br /&gt;
&lt;br /&gt;
[[File:Add_topic_form.PNG]]&lt;br /&gt;
&lt;br /&gt;
Similar is the case for editing a topic. For editing a topic user is rendered to a form in edit page and again redirected to edit assignment page.&lt;br /&gt;
&lt;br /&gt;
'''Edit Topic:'''&lt;br /&gt;
&lt;br /&gt;
[[File:Edit_topic_form.PNG]]&lt;br /&gt;
&lt;br /&gt;
===Make the table in topics tab sortable by its header===&lt;br /&gt;
Currently after creating an assignment, we can add topics related to the assignment. The &amp;quot;Topics&amp;quot; tab in the edit assignment form shows the list of topics that are added to the assignment. The picture below shows the current page for displaying the list of topics of an assignment. The list is not sortable. The task is to make it sortable using ReactJS by topic id, topic name, Num. of slots, Available slots, Num. on waitlist columns as sorting on remaining columns doesn't give any meaningful display.&lt;br /&gt;
&lt;br /&gt;
[[File:topics_tab_assignment.png]]&lt;br /&gt;
&lt;br /&gt;
===Validating user entries===&lt;br /&gt;
The entries for the assignment creation are not according to any restrictions, that can add problem to database maintainence like sorting the entries, comparing them, retrieving. There are many such problem causing situations in the new assignment form, such as &lt;br /&gt;
* User can add the number as new assignment name or he can give only special characters for it like &amp;quot;$$$$&amp;quot;.&lt;br /&gt;
* Neglecting check boxes may lead to confusion with deadlines.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Userentries.png]]&lt;br /&gt;
&lt;br /&gt;
==Proposed Solution==&lt;br /&gt;
===Assignment Creation===&lt;br /&gt;
The new implementation will use ReactJS to generate a drop-down window on clicking on the New Assignment button (private/public) , providing same features as before. Database entry is made on submitting the form and the form is closed.&lt;br /&gt;
&lt;br /&gt;
====Files to be modified====&lt;br /&gt;
*apps/assets/javascripts/tree_display.jsx.erb&lt;br /&gt;
*apps/controllers/assignments_controller.rb&lt;br /&gt;
*apps/controllers/tree_display_controller.rb&lt;br /&gt;
&lt;br /&gt;
===Assignment Edition===&lt;br /&gt;
Similar to assignment creation, in the new implementation, using ReactJS, when the edit assignment button is clicked, instead of making a server request and rendering a new view, a drop down window appears and saving the details will make the database entry.Since all the processing is done on the client side there will be decrease in the number of server requests.&lt;br /&gt;
&lt;br /&gt;
====Files to be modified====&lt;br /&gt;
*apps/views/tree_display/list.html.erb&lt;br /&gt;
*apps/views/assignments/edit.html.erb&lt;br /&gt;
*apps/views/assignments/edit/_general.html.erb&lt;br /&gt;
&lt;br /&gt;
=== Addition of topics ===&lt;br /&gt;
* An interactive React JS component should be created and should be called by the ruby injection page ''sign_up_sheet/_add_topics.html.erb'' when New Topic link is clicked. This should show a form in that page to create topic.&lt;br /&gt;
* Delete/avoid usage of ''sign_up_sheet/new.html.erb'' page.&lt;br /&gt;
* Implement an React JS functional component to handle creation of topic and saving it to database.&lt;br /&gt;
&lt;br /&gt;
=== Editing topic ===&lt;br /&gt;
* An interactive React JS component should be created and should be called by the ruby injection page ''sign_up_sheet/_all_actions.html.erb'' when edit action is clicked. This should show a form in that page to edit topic.&lt;br /&gt;
* Delete/avoid usage of ''sign_up_sheet/edit.html.erb'' page.&lt;br /&gt;
* Implement an React JS functional component to handle editing  of topic and updating it to database.&lt;br /&gt;
&lt;br /&gt;
===Make the table in topics tab sortable by its header===&lt;br /&gt;
Following sub-tasks identified to implement sortable feature for topics table.&lt;br /&gt;
* Modify sign_up_sheet/_table_header.html.erb partial to change the table header fields to sortable type.&lt;br /&gt;
* Add sort functionality using ReactJS for each column that is meaningful to be sorted.&lt;br /&gt;
&lt;br /&gt;
===Validating user entries===&lt;br /&gt;
The following tasks are to be implemented to achieve users validation,&lt;br /&gt;
* Add the regular expression validation to avoid special characters in the names of assignment or directories.&lt;br /&gt;
* Create alert messages to notify user if any important check boxes are missed.&lt;br /&gt;
* Create validation for edge cases like giving empty values.&lt;br /&gt;
&lt;br /&gt;
===Files to be modified===&lt;br /&gt;
As, the project needs to be implemented in reactJS, which helps in reducing the complexing binding in MVC framework, only changing the javascript file can help to achieve this without changing model,&lt;br /&gt;
* app/assets/javascripts/tree_display.jsx.erb&lt;br /&gt;
&lt;br /&gt;
==Test Plan==&lt;br /&gt;
Rails development is the Test Driven development, which helps in ensuring the implementation of all proposed implementations. We will be writing all the implementations proposed as tests that will eventually be red in rspec and try to make them green by adding to the development part.&lt;br /&gt;
&lt;br /&gt;
For now the manual testing of these current implementations can help in testing the functionality from UI.&lt;br /&gt;
===Manual Testing===&lt;br /&gt;
Steps to manually test the feature are as follows: &lt;br /&gt;
&lt;br /&gt;
====Assignment Creation====&lt;br /&gt;
*Log in as an instructor ''(user-name:instructor6 password:password)''&lt;br /&gt;
*Go to Manage-&amp;gt;Assignments and click on the Assignments tab.&lt;br /&gt;
*Click on the 'New public assignment' or 'New private assignment' button&lt;br /&gt;
*Verify if drop-down window is displayed.&lt;br /&gt;
*Make valid entries for the available fields and click on 'create'.&lt;br /&gt;
*Verify if new assignment is successfully created.&lt;br /&gt;
&lt;br /&gt;
====Assignment Creation====&lt;br /&gt;
*Log in as an instructor ''(user-name:instructor6 password:password)''&lt;br /&gt;
*Go to Manage-&amp;gt;Assignments and click on the Assignments tab.&lt;br /&gt;
*Click on the Edit button for any of the available assignment.&lt;br /&gt;
*Verify if drop-down window is displayed.&lt;br /&gt;
*Make changes and click on 'save'.&lt;br /&gt;
*Verify if the changes made are successfully updated.&lt;br /&gt;
&lt;br /&gt;
=== Topic Creation/Editing ===&lt;br /&gt;
* Login as an instructor ''(instructor6/password)''&lt;br /&gt;
* Create an assignment&lt;br /&gt;
* Click 'New Topic' link or 'edit' action in topics table for a particular topic&lt;br /&gt;
* A pop window or form should be displayed in the same page&lt;br /&gt;
* Add topic details in that window/ form&lt;br /&gt;
* Save it&lt;br /&gt;
* Created or modified topic should be seen in topics table&lt;br /&gt;
 &lt;br /&gt;
====Make the table in topics tab sortable by its header====&lt;br /&gt;
* Login as an instructor ''(instructor6/password)''&lt;br /&gt;
* Create an assignment&lt;br /&gt;
* Add 2 topics to the assignment&lt;br /&gt;
* Click sort on Topic ID and check if they are sorted&lt;br /&gt;
* Click sort on Topic title and check if they are sorted&lt;br /&gt;
* Similarly test using other columns&lt;br /&gt;
&lt;br /&gt;
====Validating user entries====&lt;br /&gt;
*Log in as an instructor ''(user-name:instructor6 password:password)''&lt;br /&gt;
*Go to Manage-&amp;gt;Assignments and click on the Assignments tab.&lt;br /&gt;
*Click on the 'New public assignment' or 'New private assignment' button&lt;br /&gt;
*Try adding the assignment using the weird names, with special symbols, ignoring check boxes&lt;br /&gt;
*Verify if the assignment is shown in the table.&lt;br /&gt;
&lt;br /&gt;
===Automation testing===&lt;br /&gt;
The above tests all will be automated using rspec. Rspec Mock-ups will be created for checking the navigation flow of newly created React JS components.&lt;br /&gt;
&lt;br /&gt;
==Future Work==&lt;br /&gt;
&lt;br /&gt;
We will try to convert edit assignment page in to React JS. Design pages more clearly.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
#''http://railscasts.com/episodes/228-sortable-table-columns sortable-columns''&lt;br /&gt;
#''https://www.airpair.com/reactjs/posts/reactjs-a-guide-for-rails-developers adding-reactjs''&lt;br /&gt;
#''https://github.com/expertiza/expertiza/pull/855&lt;/div&gt;</summary>
		<author><name>Dguttik</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/Convert_Assignment_Creation_Form_to_ReactJS&amp;diff=108205</id>
		<title>CSC/ECE 517 Spring 2017/Convert Assignment Creation Form to ReactJS</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/Convert_Assignment_Creation_Form_to_ReactJS&amp;diff=108205"/>
		<updated>2017-04-08T02:23:57Z</updated>

		<summary type="html">&lt;p&gt;Dguttik: /* Future Work */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
This page is a part of CSC/ECE 517 Final Project for Spring 2017 to describe the changes made by us to the open source software project Expertiza. We are converting the assignment creation form to ReactJS. Following contains a brief introduction to Expertiza, ReactJS followed by the problems we are tackling, our strategy for the implementation and the test plan.&lt;br /&gt;
   &lt;br /&gt;
==Expertiza==&lt;br /&gt;
Expertiza is a Ruby on Rails based web application where students can submit and peer review learning objects such as codes, articles, websites etc., It is an open source software project funded by National Science Foundation(NSF). The instructor has the capability to create assignments with varied specifications such as topics, courses, team size, level of reviews etc., later review the submitted work and provide feedback. Students can enter their submissions and also review others' work. &lt;br /&gt;
&lt;br /&gt;
==ReactJS==&lt;br /&gt;
ReactJS is the javascript framework developed by Facebook to solve the specific problem, ''UI rendering''. It is developed to solve the problem with complex binding in MVC framework using only one-way data binding. It is used for dynamic reloading of the page. It helps in reloading only the particular component required using Virtual DOM, which makes it fast by temporarily storing DOM&lt;br /&gt;
&lt;br /&gt;
'''Reasons for using ReactJS'''&lt;br /&gt;
* It has every functionality that an user interface required&lt;br /&gt;
* Easy data binding.&lt;br /&gt;
* Only single component changes are stored/changed without reloading the complete page.&lt;br /&gt;
* Fast and efficient&lt;br /&gt;
* Easy to scale&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
The Assignment Create and Edit Form are multi level forms. It consists of multiple inputs  and user interactions. Many input types have dependency on interactions by the user. For example, on check for a particular checkbox, remaining form is displayed. Also, edit page is reloaded whenever a topic is added. The task is to convert this pages into ReactJS components.&lt;br /&gt;
&lt;br /&gt;
'''Tasks to be done'''&lt;br /&gt;
*Organize the form layout, create several mockups and validate them to your users&lt;br /&gt;
*Make the table in topics tab sortable by its header&lt;br /&gt;
*Allow users to edit / add topics in the table instead of loading a new page&lt;br /&gt;
*Implement the new layout and convert the javascript to a ReactJS component&lt;br /&gt;
*Validate user entries&lt;br /&gt;
*Fix tooltips that don’t work&lt;br /&gt;
&lt;br /&gt;
==Current Implementation==&lt;br /&gt;
===Assignment Creation===&lt;br /&gt;
The assignment creation form consists of multiple inputs and requires interactions from the user. The current implementation is mostly in HTML with data validations being done by JQuery. When a user wants to create a new assignment by clicking the new assignment button, a server request is generated and new view is rendered. Again, another server request to make database entry is generated once the user fills in the data and clicks on 'save' button and again a new view is rendered. This kind of implementation doesn't support dynamic view rendering hence lacks the fluidity in overall user experience that one would expect.&lt;br /&gt;
&lt;br /&gt;
[[File:Create1.JPG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Create2.JPG]]&lt;br /&gt;
&lt;br /&gt;
===Assignment Edition===&lt;br /&gt;
Similar to assignment creation page, edit page lacks the dynamic view rendering which makes the user experience cumbersome. Every time user wants to make changes to the assignment, a server request is generated and new view is rendered. The save button hit on completion will again generate another server request and render a new view.&lt;br /&gt;
&lt;br /&gt;
[[File:Edit.jpg]]&lt;br /&gt;
&lt;br /&gt;
=== Add/Edit topics in Assignment ===&lt;br /&gt;
In current implementation whenever a topic is added to the assignment, a request is sent to the server and user is redirected to a form in another page. Opon creation of topic user is rendered back to edit assignment page. This process involves lot of redirection. Now, the task is to avoid this redirection of pages and create a interactive React JS form for adding and editing topic.&lt;br /&gt;
&lt;br /&gt;
Currently this logic is implemented in new method in sign_up_controller.rb file and is invoked in the _add_topics.rb ruby injection file. With this action new.html.erb page is rendered. This should be avoided.&lt;br /&gt;
&lt;br /&gt;
'''Add topic:'''&lt;br /&gt;
&lt;br /&gt;
[[File:Add_topic_form.PNG]]&lt;br /&gt;
&lt;br /&gt;
Similar is the case for editing a topic. For editing a topic user is rendered to a form in edit page and again redirected to edit assignment page.&lt;br /&gt;
&lt;br /&gt;
'''Edit Topic:'''&lt;br /&gt;
&lt;br /&gt;
[[File:Edit_topic_form.PNG]]&lt;br /&gt;
&lt;br /&gt;
===Make the table in topics tab sortable by its header===&lt;br /&gt;
Currently after creating an assignment, we can add topics related to the assignment. The &amp;quot;Topics&amp;quot; tab in the edit assignment form shows the list of topics that are added to the assignment. The picture below shows the current page for displaying the list of topics of an assignment. The list is not sortable. The task is to make it sortable using ReactJS by topic id, topic name, Num. of slots, Available slots, Num. on waitlist columns as sorting on remaining columns doesn't give any meaningful display.&lt;br /&gt;
&lt;br /&gt;
[[File:topics_tab_assignment.png]]&lt;br /&gt;
&lt;br /&gt;
===Validating user entries===&lt;br /&gt;
The entries for the assignment creation are not according to any restrictions, that can add problem to database maintainence like sorting the entries, comparing them, retrieving. There are many such problem causing situations in the new assignment form, such as &lt;br /&gt;
* User can add the number as new assignment name or he can give only special characters for it like &amp;quot;$$$$&amp;quot;.&lt;br /&gt;
* Neglecting check boxes may lead to confusion with deadlines.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Userentries.png]]&lt;br /&gt;
&lt;br /&gt;
==Proposed Solution==&lt;br /&gt;
===Assignment Creation===&lt;br /&gt;
The new implementation will use ReactJS to generate a drop-down window on clicking on the New Assignment button (private/public) , providing same features as before. Database entry is made on submitting the form and the form is closed.&lt;br /&gt;
&lt;br /&gt;
====Files to be modified====&lt;br /&gt;
*apps/assets/javascripts/tree_display.jsx.erb&lt;br /&gt;
*apps/controllers/assignments_controller.rb&lt;br /&gt;
*apps/controllers/tree_display_controller.rb&lt;br /&gt;
&lt;br /&gt;
===Assignment Edition===&lt;br /&gt;
Similar to assignment creation, in the new implementation, using ReactJS, when the edit assignment button is clicked, instead of making a server request and rendering a new view, a drop down window appears and saving the details will make the database entry.Since all the processing is done on the client side there will be decrease in the number of server requests.&lt;br /&gt;
&lt;br /&gt;
====Files to be modified====&lt;br /&gt;
*apps/views/tree_display/list.html.erb&lt;br /&gt;
*apps/views/assignments/edit.html.erb&lt;br /&gt;
*apps/views/assignments/edit/_general.html.erb&lt;br /&gt;
&lt;br /&gt;
=== Addition of topics ===&lt;br /&gt;
* An interactive React JS component should be created and should be called by the ruby injection page ''sign_up_sheet/_add_topics.html.erb'' when New Topic link is clicked. This should show a form in that page to create topic.&lt;br /&gt;
* Delete/avoid usage of ''sign_up_sheet/new.html.erb'' page.&lt;br /&gt;
* Implement an React JS functional component to handle creation of topic and saving it to database.&lt;br /&gt;
&lt;br /&gt;
=== Editing topic ===&lt;br /&gt;
* An interactive React JS component should be created and should be called by the ruby injection page ''sign_up_sheet/_all_actions.html.erb'' when edit action is clicked. This should show a form in that page to edit topic.&lt;br /&gt;
* Delete/avoid usage of ''sign_up_sheet/edit.html.erb'' page.&lt;br /&gt;
* Implement an React JS functional component to handle editing  of topic and updating it to database.&lt;br /&gt;
&lt;br /&gt;
===Make the table in topics tab sortable by its header===&lt;br /&gt;
Following sub-tasks identified to implement sortable feature for topics table.&lt;br /&gt;
* Modify sign_up_sheet/_table_header.html.erb partial to change the table header fields to sortable type.&lt;br /&gt;
* Add sort functionality using ReactJS for each column that is meaningful to be sorted.&lt;br /&gt;
&lt;br /&gt;
===Validating user entries===&lt;br /&gt;
The following tasks are to be implemented to achieve users validation,&lt;br /&gt;
* Add the regular expression validation to avoid special characters in the names of assignment or directories.&lt;br /&gt;
* Create alert messages to notify user if any important check boxes are missed.&lt;br /&gt;
* Create validation for edge cases like giving empty values.&lt;br /&gt;
&lt;br /&gt;
===Files to be modified===&lt;br /&gt;
As, the project needs to be implemented in reactJS, which helps in reducing the complexing binding in MVC framework, only changing the javascript file can help to achieve this without changing model,&lt;br /&gt;
* app/assets/javascripts/tree_display.jsx.erb&lt;br /&gt;
&lt;br /&gt;
==Test Plan==&lt;br /&gt;
Rails development is the Test Driven development, which helps in ensuring the implementation of all proposed implementations. We will be writing all the implementations proposed as tests that will eventually be red in rspec and try to make them green by adding to the development part.&lt;br /&gt;
&lt;br /&gt;
For now the manual testing of these current implementations can help in testing the functionality from UI.&lt;br /&gt;
===Manual Testing===&lt;br /&gt;
Steps to manually test the feature are as follows: &lt;br /&gt;
&lt;br /&gt;
====Assignment Creation====&lt;br /&gt;
*Log in as an instructor ''(user-name:instructor6 password:password)''&lt;br /&gt;
*Go to Manage-&amp;gt;Assignments and click on the Assignments tab.&lt;br /&gt;
*Click on the 'New public assignment' or 'New private assignment' button&lt;br /&gt;
*Verify if drop-down window is displayed.&lt;br /&gt;
*Make valid entries for the available fields and click on 'create'.&lt;br /&gt;
*Verify if new assignment is successfully created.&lt;br /&gt;
&lt;br /&gt;
====Assignment Creation====&lt;br /&gt;
*Log in as an instructor ''(user-name:instructor6 password:password)''&lt;br /&gt;
*Go to Manage-&amp;gt;Assignments and click on the Assignments tab.&lt;br /&gt;
*Click on the Edit button for any of the available assignment.&lt;br /&gt;
*Verify if drop-down window is displayed.&lt;br /&gt;
*Make changes and click on 'save'.&lt;br /&gt;
*Verify if the changes made are successfully updated.&lt;br /&gt;
&lt;br /&gt;
=== Topic Creation/Editing ===&lt;br /&gt;
* Login as an instructor ''(instructor6/password)''&lt;br /&gt;
* Create an assignment&lt;br /&gt;
* Click 'New Topic' link or 'edit' action in topics table for a particular topic&lt;br /&gt;
* A pop window or form should be displayed in the same page&lt;br /&gt;
* Add topic details in that window/ form&lt;br /&gt;
* Save it&lt;br /&gt;
* Created or modified topic should be seen in topics table&lt;br /&gt;
 &lt;br /&gt;
====Make the table in topics tab sortable by its header====&lt;br /&gt;
* Login as an instructor ''(instructor6/password)''&lt;br /&gt;
* Create an assignment&lt;br /&gt;
* Add 2 topics to the assignment&lt;br /&gt;
* Click sort on Topic ID and check if they are sorted&lt;br /&gt;
* Click sort on Topic title and check if they are sorted&lt;br /&gt;
* Similarly test using other columns&lt;br /&gt;
&lt;br /&gt;
====Validating user entries====&lt;br /&gt;
*Log in as an instructor ''(user-name:instructor6 password:password)''&lt;br /&gt;
*Go to Manage-&amp;gt;Assignments and click on the Assignments tab.&lt;br /&gt;
*Click on the 'New public assignment' or 'New private assignment' button&lt;br /&gt;
*Try adding the assignment using the weird names, with special symbols, ignoring check boxes&lt;br /&gt;
*Verify if the assignment is shown in the table.&lt;br /&gt;
&lt;br /&gt;
===Automation testing===&lt;br /&gt;
The above tests all will be automated using rspec. Rspec Mock-ups will be created for checking the navigation flow of newly created React JS components.&lt;br /&gt;
&lt;br /&gt;
==Future Work==&lt;br /&gt;
&lt;br /&gt;
We will try to convert edit assignment page in to React JS. Design pages more clearly.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
#''http://railscasts.com/episodes/228-sortable-table-columns sortable-columns''&lt;br /&gt;
#''https://www.airpair.com/reactjs/posts/reactjs-a-guide-for-rails-developers adding-reactjs''&lt;/div&gt;</summary>
		<author><name>Dguttik</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/Convert_Assignment_Creation_Form_to_ReactJS&amp;diff=108201</id>
		<title>CSC/ECE 517 Spring 2017/Convert Assignment Creation Form to ReactJS</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/Convert_Assignment_Creation_Form_to_ReactJS&amp;diff=108201"/>
		<updated>2017-04-08T02:20:12Z</updated>

		<summary type="html">&lt;p&gt;Dguttik: /* Automation testing */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
This page is a part of CSC/ECE 517 Final Project for Spring 2017 to describe the changes made by us to the open source software project Expertiza. We are converting the assignment creation form to ReactJS. Following contains a brief introduction to Expertiza, ReactJS followed by the problems we are tackling, our strategy for the implementation and the test plan.&lt;br /&gt;
   &lt;br /&gt;
==Expertiza==&lt;br /&gt;
Expertiza is a Ruby on Rails based web application where students can submit and peer review learning objects such as codes, articles, websites etc., It is an open source software project funded by National Science Foundation(NSF). The instructor has the capability to create assignments with varied specifications such as topics, courses, team size, level of reviews etc., later review the submitted work and provide feedback. Students can enter their submissions and also review others' work. &lt;br /&gt;
&lt;br /&gt;
==ReactJS==&lt;br /&gt;
ReactJS is the javascript framework developed by Facebook to solve the specific problem, ''UI rendering''. It is developed to solve the problem with complex binding in MVC framework using only one-way data binding. It is used for dynamic reloading of the page. It helps in reloading only the particular component required using Virtual DOM, which makes it fast by temporarily storing DOM&lt;br /&gt;
&lt;br /&gt;
'''Reasons for using ReactJS'''&lt;br /&gt;
* It has every functionality that an user interface required&lt;br /&gt;
* Easy data binding.&lt;br /&gt;
* Only single component changes are stored/changed without reloading the complete page.&lt;br /&gt;
* Fast and efficient&lt;br /&gt;
* Easy to scale&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
The Assignment Create and Edit Form are multi level forms. It consists of multiple inputs  and user interactions. Many input types have dependency on interactions by the user. For example, on check for a particular checkbox, remaining form is displayed. Also, edit page is reloaded whenever a topic is added. The task is to convert this pages into ReactJS components.&lt;br /&gt;
&lt;br /&gt;
'''Tasks to be done'''&lt;br /&gt;
*Organize the form layout, create several mockups and validate them to your users&lt;br /&gt;
*Make the table in topics tab sortable by its header&lt;br /&gt;
*Allow users to edit / add topics in the table instead of loading a new page&lt;br /&gt;
*Implement the new layout and convert the javascript to a ReactJS component&lt;br /&gt;
*Validate user entries&lt;br /&gt;
*Fix tooltips that don’t work&lt;br /&gt;
&lt;br /&gt;
==Current Implementation==&lt;br /&gt;
===Assignment Creation===&lt;br /&gt;
The assignment creation form consists of multiple inputs and requires interactions from the user. The current implementation is mostly in HTML with data validations being done by JQuery. When a user wants to create a new assignment by clicking the new assignment button, a server request is generated and new view is rendered. Again, another server request to make database entry is generated once the user fills in the data and clicks on 'save' button and again a new view is rendered. This kind of implementation doesn't support dynamic view rendering hence lacks the fluidity in overall user experience that one would expect.&lt;br /&gt;
&lt;br /&gt;
[[File:Create1.JPG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Create2.JPG]]&lt;br /&gt;
&lt;br /&gt;
===Assignment Edition===&lt;br /&gt;
Similar to assignment creation page, edit page lacks the dynamic view rendering which makes the user experience cumbersome. Every time user wants to make changes to the assignment, a server request is generated and new view is rendered. The save button hit on completion will again generate another server request and render a new view.&lt;br /&gt;
&lt;br /&gt;
[[File:Edit.jpg]]&lt;br /&gt;
&lt;br /&gt;
=== Add/Edit topics in Assignment ===&lt;br /&gt;
In current implementation whenever a topic is added to the assignment, a request is sent to the server and user is redirected to a form in another page. Opon creation of topic user is rendered back to edit assignment page. This process involves lot of redirection. Now, the task is to avoid this redirection of pages and create a interactive React JS form for adding and editing topic.&lt;br /&gt;
&lt;br /&gt;
Currently this logic is implemented in new method in sign_up_controller.rb file and is invoked in the _add_topics.rb ruby injection file. With this action new.html.erb page is rendered. This should be avoided.&lt;br /&gt;
&lt;br /&gt;
'''Add topic:'''&lt;br /&gt;
&lt;br /&gt;
[[File:Add_topic_form.PNG]]&lt;br /&gt;
&lt;br /&gt;
Similar is the case for editing a topic. For editing a topic user is rendered to a form in edit page and again redirected to edit assignment page.&lt;br /&gt;
&lt;br /&gt;
'''Edit Topic:'''&lt;br /&gt;
&lt;br /&gt;
[[File:Edit_topic_form.PNG]]&lt;br /&gt;
&lt;br /&gt;
===Make the table in topics tab sortable by its header===&lt;br /&gt;
Currently after creating an assignment, we can add topics related to the assignment. The &amp;quot;Topics&amp;quot; tab in the edit assignment form shows the list of topics that are added to the assignment. The picture below shows the current page for displaying the list of topics of an assignment. The list is not sortable. The task is to make it sortable using ReactJS by topic id, topic name, Num. of slots, Available slots, Num. on waitlist columns as sorting on remaining columns doesn't give any meaningful display.&lt;br /&gt;
&lt;br /&gt;
[[File:topics_tab_assignment.png]]&lt;br /&gt;
&lt;br /&gt;
===Validating user entries===&lt;br /&gt;
The entries for the assignment creation are not according to any restrictions, that can add problem to database maintainence like sorting the entries, comparing them, retrieving. There are many such problem causing situations in the new assignment form, such as &lt;br /&gt;
* User can add the number as new assignment name or he can give only special characters for it like &amp;quot;$$$$&amp;quot;.&lt;br /&gt;
* Neglecting check boxes may lead to confusion with deadlines.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Userentries.png]]&lt;br /&gt;
&lt;br /&gt;
==Proposed Solution==&lt;br /&gt;
===Assignment Creation===&lt;br /&gt;
The new implementation will use ReactJS to generate a drop-down window on clicking on the New Assignment button (private/public) , providing same features as before. Database entry is made on submitting the form and the form is closed.&lt;br /&gt;
&lt;br /&gt;
====Files to be modified====&lt;br /&gt;
*apps/assets/javascripts/tree_display.jsx.erb&lt;br /&gt;
*apps/controllers/assignments_controller.rb&lt;br /&gt;
*apps/controllers/tree_display_controller.rb&lt;br /&gt;
&lt;br /&gt;
===Assignment Edition===&lt;br /&gt;
Similar to assignment creation, in the new implementation, using ReactJS, when the edit assignment button is clicked, instead of making a server request and rendering a new view, a drop down window appears and saving the details will make the database entry.Since all the processing is done on the client side there will be decrease in the number of server requests.&lt;br /&gt;
&lt;br /&gt;
====Files to be modified====&lt;br /&gt;
*apps/views/tree_display/list.html.erb&lt;br /&gt;
*apps/views/assignments/edit.html.erb&lt;br /&gt;
*apps/views/assignments/edit/_general.html.erb&lt;br /&gt;
&lt;br /&gt;
=== Addition of topics ===&lt;br /&gt;
* An interactive React JS component should be created and should be called by the ruby injection page ''sign_up_sheet/_add_topics.html.erb'' when New Topic link is clicked. This should show a form in that page to create topic.&lt;br /&gt;
* Delete/avoid usage of ''sign_up_sheet/new.html.erb'' page.&lt;br /&gt;
* Implement an React JS functional component to handle creation of topic and saving it to database.&lt;br /&gt;
&lt;br /&gt;
=== Editing topic ===&lt;br /&gt;
* An interactive React JS component should be created and should be called by the ruby injection page ''sign_up_sheet/_all_actions.html.erb'' when edit action is clicked. This should show a form in that page to edit topic.&lt;br /&gt;
* Delete/avoid usage of ''sign_up_sheet/edit.html.erb'' page.&lt;br /&gt;
* Implement an React JS functional component to handle editing  of topic and updating it to database.&lt;br /&gt;
&lt;br /&gt;
===Make the table in topics tab sortable by its header===&lt;br /&gt;
Following sub-tasks identified to implement sortable feature for topics table.&lt;br /&gt;
* Modify sign_up_sheet/_table_header.html.erb partial to change the table header fields to sortable type.&lt;br /&gt;
* Add sort functionality using ReactJS for each column that is meaningful to be sorted.&lt;br /&gt;
&lt;br /&gt;
===Validating user entries===&lt;br /&gt;
The following tasks are to be implemented to achieve users validation,&lt;br /&gt;
* Add the regular expression validation to avoid special characters in the names of assignment or directories.&lt;br /&gt;
* Create alert messages to notify user if any important check boxes are missed.&lt;br /&gt;
* Create validation for edge cases like giving empty values.&lt;br /&gt;
&lt;br /&gt;
===Files to be modified===&lt;br /&gt;
As, the project needs to be implemented in reactJS, which helps in reducing the complexing binding in MVC framework, only changing the javascript file can help to achieve this without changing model,&lt;br /&gt;
* app/assets/javascripts/tree_display.jsx.erb&lt;br /&gt;
&lt;br /&gt;
==Test Plan==&lt;br /&gt;
Rails development is the Test Driven development, which helps in ensuring the implementation of all proposed implementations. We will be writing all the implementations proposed as tests that will eventually be red in rspec and try to make them green by adding to the development part.&lt;br /&gt;
&lt;br /&gt;
For now the manual testing of these current implementations can help in testing the functionality from UI.&lt;br /&gt;
===Manual Testing===&lt;br /&gt;
Steps to manually test the feature are as follows: &lt;br /&gt;
&lt;br /&gt;
====Assignment Creation====&lt;br /&gt;
*Log in as an instructor ''(user-name:instructor6 password:password)''&lt;br /&gt;
*Go to Manage-&amp;gt;Assignments and click on the Assignments tab.&lt;br /&gt;
*Click on the 'New public assignment' or 'New private assignment' button&lt;br /&gt;
*Verify if drop-down window is displayed.&lt;br /&gt;
*Make valid entries for the available fields and click on 'create'.&lt;br /&gt;
*Verify if new assignment is successfully created.&lt;br /&gt;
&lt;br /&gt;
====Assignment Creation====&lt;br /&gt;
*Log in as an instructor ''(user-name:instructor6 password:password)''&lt;br /&gt;
*Go to Manage-&amp;gt;Assignments and click on the Assignments tab.&lt;br /&gt;
*Click on the Edit button for any of the available assignment.&lt;br /&gt;
*Verify if drop-down window is displayed.&lt;br /&gt;
*Make changes and click on 'save'.&lt;br /&gt;
*Verify if the changes made are successfully updated.&lt;br /&gt;
&lt;br /&gt;
=== Topic Creation/Editing ===&lt;br /&gt;
* Login as an instructor ''(instructor6/password)''&lt;br /&gt;
* Create an assignment&lt;br /&gt;
* Click 'New Topic' link or 'edit' action in topics table for a particular topic&lt;br /&gt;
* A pop window or form should be displayed in the same page&lt;br /&gt;
* Add topic details in that window/ form&lt;br /&gt;
* Save it&lt;br /&gt;
* Created or modified topic should be seen in topics table&lt;br /&gt;
 &lt;br /&gt;
====Make the table in topics tab sortable by its header====&lt;br /&gt;
* Login as an instructor ''(instructor6/password)''&lt;br /&gt;
* Create an assignment&lt;br /&gt;
* Add 2 topics to the assignment&lt;br /&gt;
* Click sort on Topic ID and check if they are sorted&lt;br /&gt;
* Click sort on Topic title and check if they are sorted&lt;br /&gt;
* Similarly test using other columns&lt;br /&gt;
&lt;br /&gt;
====Validating user entries====&lt;br /&gt;
*Log in as an instructor ''(user-name:instructor6 password:password)''&lt;br /&gt;
*Go to Manage-&amp;gt;Assignments and click on the Assignments tab.&lt;br /&gt;
*Click on the 'New public assignment' or 'New private assignment' button&lt;br /&gt;
*Try adding the assignment using the weird names, with special symbols, ignoring check boxes&lt;br /&gt;
*Verify if the assignment is shown in the table.&lt;br /&gt;
&lt;br /&gt;
===Automation testing===&lt;br /&gt;
The above tests all will be automated using rspec. Rspec Mock-ups will be created for checking the navigation flow of newly created React JS components.&lt;br /&gt;
&lt;br /&gt;
==Future Work==&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
#''http://railscasts.com/episodes/228-sortable-table-columns sortable-columns''&lt;br /&gt;
#''https://www.airpair.com/reactjs/posts/reactjs-a-guide-for-rails-developers adding-reactjs''&lt;/div&gt;</summary>
		<author><name>Dguttik</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/Convert_Assignment_Creation_Form_to_ReactJS&amp;diff=108198</id>
		<title>CSC/ECE 517 Spring 2017/Convert Assignment Creation Form to ReactJS</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/Convert_Assignment_Creation_Form_to_ReactJS&amp;diff=108198"/>
		<updated>2017-04-08T02:06:11Z</updated>

		<summary type="html">&lt;p&gt;Dguttik: /* Test Plan */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
This page is a part of CSC/ECE 517 Final Project for Spring 2017 to describe the changes made by us to the open source software project Expertiza. We are converting the assignment creation form to ReactJS. Following contains a brief introduction to Expertiza, ReactJS followed by the problems we are tackling, our strategy for the implementation and the test plan.&lt;br /&gt;
   &lt;br /&gt;
==Expertiza==&lt;br /&gt;
Expertiza is a Ruby on Rails based web application where students can submit and peer review learning objects such as codes, articles, websites etc., It is an open source software project funded by National Science Foundation(NSF). The instructor has the capability to create assignments with varied specifications such as topics, courses, team size, level of reviews etc., later review the submitted work and provide feedback. Students can enter their submissions and also review others' work. &lt;br /&gt;
&lt;br /&gt;
==ReactJS==&lt;br /&gt;
ReactJS is the javascript framework developed by Facebook to solve the specific problem, ''UI rendering''. It is developed to solve the problem with complex binding in MVC framework using only one-way data binding. It is used for dynamic reloading of the page. It helps in reloading only the particular component required using Virtual DOM, which makes it fast by temporarily storing DOM&lt;br /&gt;
&lt;br /&gt;
'''Reasons for using ReactJS'''&lt;br /&gt;
* It has every functionality that an user interface required&lt;br /&gt;
* Easy data binding.&lt;br /&gt;
* Only single component changes are stored/changed without reloading the complete page.&lt;br /&gt;
* Fast and efficient&lt;br /&gt;
* Easy to scale&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
The Assignment Create and Edit Form are multi level forms. It consists of multiple inputs  and user interactions. Many input types have dependency on interactions by the user. For example, on check for a particular checkbox, remaining form is displayed. Also, edit page is reloaded whenever a topic is added. The task is to convert this pages into ReactJS components.&lt;br /&gt;
&lt;br /&gt;
'''Tasks to be done'''&lt;br /&gt;
*Organize the form layout, create several mockups and validate them to your users&lt;br /&gt;
*Make the table in topics tab sortable by its header&lt;br /&gt;
*Allow users to edit / add topics in the table instead of loading a new page&lt;br /&gt;
*Implement the new layout and convert the javascript to a ReactJS component&lt;br /&gt;
*Validate user entries&lt;br /&gt;
*Fix tooltips that don’t work&lt;br /&gt;
&lt;br /&gt;
==Current Implementation==&lt;br /&gt;
===Assignment Creation===&lt;br /&gt;
The assignment creation form consists of multiple inputs and requires interactions from the user. The current implementation is mostly in HTML with data validations being done by JQuery. When a user wants to create a new assignment by clicking the new assignment button, a server request is generated and new view is rendered. Again, another server request to make database entry is generated once the user fills in the data and clicks on 'save' button and again a new view is rendered. This kind of implementation doesn't support dynamic view rendering hence lacks the fluidity in overall user experience that one would expect.&lt;br /&gt;
&lt;br /&gt;
[[File:Create1.JPG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Create2.JPG]]&lt;br /&gt;
&lt;br /&gt;
===Assignment Edition===&lt;br /&gt;
Similar to assignment creation page, edit page lacks the dynamic view rendering which makes the user experience cumbersome. Every time user wants to make changes to the assignment, a server request is generated and new view is rendered. The save button hit on completion will again generate another server request and render a new view.&lt;br /&gt;
&lt;br /&gt;
[[File:Edit.jpg]]&lt;br /&gt;
&lt;br /&gt;
=== Add/Edit topics in Assignment ===&lt;br /&gt;
In current implementation whenever a topic is added to the assignment, a request is sent to the server and user is redirected to a form in another page. Opon creation of topic user is rendered back to edit assignment page. This process involves lot of redirection. Now, the task is to avoid this redirection of pages and create a interactive React JS form for adding and editing topic.&lt;br /&gt;
&lt;br /&gt;
Currently this logic is implemented in new method in sign_up_controller.rb file and is invoked in the _add_topics.rb ruby injection file. With this action new.html.erb page is rendered. This should be avoided.&lt;br /&gt;
&lt;br /&gt;
'''Add topic:'''&lt;br /&gt;
&lt;br /&gt;
[[File:Add_topic_form.PNG]]&lt;br /&gt;
&lt;br /&gt;
Similar is the case for editing a topic. For editing a topic user is rendered to a form in edit page and again redirected to edit assignment page.&lt;br /&gt;
&lt;br /&gt;
'''Edit Topic:'''&lt;br /&gt;
&lt;br /&gt;
[[File:Edit_topic_form.PNG]]&lt;br /&gt;
&lt;br /&gt;
===Make the table in topics tab sortable by its header===&lt;br /&gt;
Currently after creating an assignment, we can add topics related to the assignment. The &amp;quot;Topics&amp;quot; tab in the edit assignment form shows the list of topics that are added to the assignment. The picture below shows the current page for displaying the list of topics of an assignment. The list is not sortable. The task is to make it sortable using ReactJS by topic id, topic name, Num. of slots, Available slots, Num. on waitlist columns as sorting on remaining columns doesn't give any meaningful display.&lt;br /&gt;
&lt;br /&gt;
[[File:topics_tab_assignment.png]]&lt;br /&gt;
&lt;br /&gt;
===Validating user entries===&lt;br /&gt;
The entries for the assignment creation are not according to any restrictions, that can add problem to database maintainence like sorting the entries, comparing them, retrieving. There are many such problem causing situations in the new assignment form, such as &lt;br /&gt;
* User can add the number as new assignment name or he can give only special characters for it like &amp;quot;$$$$&amp;quot;.&lt;br /&gt;
* Neglecting check boxes may lead to confusion with deadlines.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Userentries.png]]&lt;br /&gt;
&lt;br /&gt;
==Proposed Solution==&lt;br /&gt;
===Assignment Creation===&lt;br /&gt;
The new implementation will use ReactJS to generate a drop-down window on clicking on the New Assignment button (private/public) , providing same features as before. Database entry is made on submitting the form and the form is closed.&lt;br /&gt;
&lt;br /&gt;
====Files to be modified====&lt;br /&gt;
*apps/assets/javascripts/tree_display.jsx.erb&lt;br /&gt;
*apps/controllers/assignments_controller.rb&lt;br /&gt;
*apps/controllers/tree_display_controller.rb&lt;br /&gt;
&lt;br /&gt;
===Assignment Edition===&lt;br /&gt;
Similar to assignment creation, in the new implementation, using ReactJS, when the edit assignment button is clicked, instead of making a server request and rendering a new view, a drop down window appears and saving the details will make the database entry.Since all the processing is done on the client side there will be decrease in the number of server requests.&lt;br /&gt;
&lt;br /&gt;
====Files to be modified====&lt;br /&gt;
*apps/views/tree_display/list.html.erb&lt;br /&gt;
*apps/views/assignments/edit.html.erb&lt;br /&gt;
*apps/views/assignments/edit/_general.html.erb&lt;br /&gt;
&lt;br /&gt;
=== Addition of topics ===&lt;br /&gt;
* An interactive React JS component should be created and should be called by the ruby injection page ''sign_up_sheet/_add_topics.html.erb'' when New Topic link is clicked. This should show a form in that page to create topic.&lt;br /&gt;
* Delete/avoid usage of ''sign_up_sheet/new.html.erb'' page.&lt;br /&gt;
* Implement an React JS functional component to handle creation of topic and saving it to database.&lt;br /&gt;
&lt;br /&gt;
=== Editing topic ===&lt;br /&gt;
* An interactive React JS component should be created and should be called by the ruby injection page ''sign_up_sheet/_all_actions.html.erb'' when edit action is clicked. This should show a form in that page to edit topic.&lt;br /&gt;
* Delete/avoid usage of ''sign_up_sheet/edit.html.erb'' page.&lt;br /&gt;
* Implement an React JS functional component to handle editing  of topic and updating it to database.&lt;br /&gt;
&lt;br /&gt;
===Make the table in topics tab sortable by its header===&lt;br /&gt;
Following sub-tasks identified to implement sortable feature for topics table.&lt;br /&gt;
* Modify sign_up_sheet/_table_header.html.erb partial to change the table header fields to sortable type.&lt;br /&gt;
* Add sort functionality using ReactJS for each column that is meaningful to be sorted.&lt;br /&gt;
&lt;br /&gt;
===Validating user entries===&lt;br /&gt;
The following tasks are to be implemented to achieve users validation,&lt;br /&gt;
* Add the regular expression validation to avoid special characters in the names of assignment or directories.&lt;br /&gt;
* Create alert messages to notify user if any important check boxes are missed.&lt;br /&gt;
* Create validation for edge cases like giving empty values.&lt;br /&gt;
&lt;br /&gt;
===Files to be modified===&lt;br /&gt;
As, the project needs to be implemented in reactJS, which helps in reducing the complexing binding in MVC framework, only changing the javascript file can help to achieve this without changing model,&lt;br /&gt;
* app/assets/javascripts/tree_display.jsx.erb&lt;br /&gt;
&lt;br /&gt;
==Test Plan==&lt;br /&gt;
Rails development is the Test Driven development, which helps in ensuring the implementation of all proposed implementations. We will be writing all the implementations proposed as tests that will eventually be red in rspec and try to make them green by adding to the development part.&lt;br /&gt;
&lt;br /&gt;
For now the manual testing of these current implementations can help in testing the functionality from UI.&lt;br /&gt;
===Manual Testing===&lt;br /&gt;
Steps to manually test the feature are as follows: &lt;br /&gt;
&lt;br /&gt;
====Assignment Creation====&lt;br /&gt;
*Log in as an instructor ''(user-name:instructor6 password:password)''&lt;br /&gt;
*Go to Manage-&amp;gt;Assignments and click on the Assignments tab.&lt;br /&gt;
*Click on the 'New public assignment' or 'New private assignment' button&lt;br /&gt;
*Verify if drop-down window is displayed.&lt;br /&gt;
*Make valid entries for the available fields and click on 'create'.&lt;br /&gt;
*Verify if new assignment is successfully created.&lt;br /&gt;
&lt;br /&gt;
====Assignment Creation====&lt;br /&gt;
*Log in as an instructor ''(user-name:instructor6 password:password)''&lt;br /&gt;
*Go to Manage-&amp;gt;Assignments and click on the Assignments tab.&lt;br /&gt;
*Click on the Edit button for any of the available assignment.&lt;br /&gt;
*Verify if drop-down window is displayed.&lt;br /&gt;
*Make changes and click on 'save'.&lt;br /&gt;
*Verify if the changes made are successfully updated.&lt;br /&gt;
&lt;br /&gt;
=== Topic Creation/Editing ===&lt;br /&gt;
* Login as an instructor ''(instructor6/password)''&lt;br /&gt;
* Create an assignment&lt;br /&gt;
* Click 'New Topic' link or 'edit' action in topics table for a particular topic&lt;br /&gt;
* A pop window or form should be displayed in the same page&lt;br /&gt;
* Add topic details in that window/ form&lt;br /&gt;
* Save it&lt;br /&gt;
* Created or modified topic should be seen in topics table&lt;br /&gt;
 &lt;br /&gt;
====Make the table in topics tab sortable by its header====&lt;br /&gt;
* Login as an instructor ''(instructor6/password)''&lt;br /&gt;
* Create an assignment&lt;br /&gt;
* Add 2 topics to the assignment&lt;br /&gt;
* Click sort on Topic ID and check if they are sorted&lt;br /&gt;
* Click sort on Topic title and check if they are sorted&lt;br /&gt;
* Similarly test using other columns&lt;br /&gt;
&lt;br /&gt;
====Validating user entries====&lt;br /&gt;
*Log in as an instructor ''(user-name:instructor6 password:password)''&lt;br /&gt;
*Go to Manage-&amp;gt;Assignments and click on the Assignments tab.&lt;br /&gt;
*Click on the 'New public assignment' or 'New private assignment' button&lt;br /&gt;
*Try adding the assignment using the weird names, with special symbols, ignoring check boxes&lt;br /&gt;
*Verify if the assignment is shown in the table.&lt;br /&gt;
&lt;br /&gt;
===Automation testing===&lt;br /&gt;
The above tests all will be automated using rspec.&lt;br /&gt;
&lt;br /&gt;
==Future Work==&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
#''http://railscasts.com/episodes/228-sortable-table-columns sortable-columns''&lt;br /&gt;
#''https://www.airpair.com/reactjs/posts/reactjs-a-guide-for-rails-developers adding-reactjs''&lt;/div&gt;</summary>
		<author><name>Dguttik</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/Convert_Assignment_Creation_Form_to_ReactJS&amp;diff=108197</id>
		<title>CSC/ECE 517 Spring 2017/Convert Assignment Creation Form to ReactJS</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/Convert_Assignment_Creation_Form_to_ReactJS&amp;diff=108197"/>
		<updated>2017-04-08T02:02:57Z</updated>

		<summary type="html">&lt;p&gt;Dguttik: /* Editing topic */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
This page is a part of CSC/ECE 517 Final Project for Spring 2017 to describe the changes made by us to the open source software project Expertiza. We are converting the assignment creation form to ReactJS. Following contains a brief introduction to Expertiza, ReactJS followed by the problems we are tackling, our strategy for the implementation and the test plan.&lt;br /&gt;
   &lt;br /&gt;
==Expertiza==&lt;br /&gt;
Expertiza is a Ruby on Rails based web application where students can submit and peer review learning objects such as codes, articles, websites etc., It is an open source software project funded by National Science Foundation(NSF). The instructor has the capability to create assignments with varied specifications such as topics, courses, team size, level of reviews etc., later review the submitted work and provide feedback. Students can enter their submissions and also review others' work. &lt;br /&gt;
&lt;br /&gt;
==ReactJS==&lt;br /&gt;
ReactJS is the javascript framework developed by Facebook to solve the specific problem, ''UI rendering''. It is developed to solve the problem with complex binding in MVC framework using only one-way data binding. It is used for dynamic reloading of the page. It helps in reloading only the particular component required using Virtual DOM, which makes it fast by temporarily storing DOM&lt;br /&gt;
&lt;br /&gt;
'''Reasons for using ReactJS'''&lt;br /&gt;
* It has every functionality that an user interface required&lt;br /&gt;
* Easy data binding.&lt;br /&gt;
* Only single component changes are stored/changed without reloading the complete page.&lt;br /&gt;
* Fast and efficient&lt;br /&gt;
* Easy to scale&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
The Assignment Create and Edit Form are multi level forms. It consists of multiple inputs  and user interactions. Many input types have dependency on interactions by the user. For example, on check for a particular checkbox, remaining form is displayed. Also, edit page is reloaded whenever a topic is added. The task is to convert this pages into ReactJS components.&lt;br /&gt;
&lt;br /&gt;
'''Tasks to be done'''&lt;br /&gt;
*Organize the form layout, create several mockups and validate them to your users&lt;br /&gt;
*Make the table in topics tab sortable by its header&lt;br /&gt;
*Allow users to edit / add topics in the table instead of loading a new page&lt;br /&gt;
*Implement the new layout and convert the javascript to a ReactJS component&lt;br /&gt;
*Validate user entries&lt;br /&gt;
*Fix tooltips that don’t work&lt;br /&gt;
&lt;br /&gt;
==Current Implementation==&lt;br /&gt;
===Assignment Creation===&lt;br /&gt;
The assignment creation form consists of multiple inputs and requires interactions from the user. The current implementation is mostly in HTML with data validations being done by JQuery. When a user wants to create a new assignment by clicking the new assignment button, a server request is generated and new view is rendered. Again, another server request to make database entry is generated once the user fills in the data and clicks on 'save' button and again a new view is rendered. This kind of implementation doesn't support dynamic view rendering hence lacks the fluidity in overall user experience that one would expect.&lt;br /&gt;
&lt;br /&gt;
[[File:Create1.JPG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Create2.JPG]]&lt;br /&gt;
&lt;br /&gt;
===Assignment Edition===&lt;br /&gt;
Similar to assignment creation page, edit page lacks the dynamic view rendering which makes the user experience cumbersome. Every time user wants to make changes to the assignment, a server request is generated and new view is rendered. The save button hit on completion will again generate another server request and render a new view.&lt;br /&gt;
&lt;br /&gt;
[[File:Edit.jpg]]&lt;br /&gt;
&lt;br /&gt;
=== Add/Edit topics in Assignment ===&lt;br /&gt;
In current implementation whenever a topic is added to the assignment, a request is sent to the server and user is redirected to a form in another page. Opon creation of topic user is rendered back to edit assignment page. This process involves lot of redirection. Now, the task is to avoid this redirection of pages and create a interactive React JS form for adding and editing topic.&lt;br /&gt;
&lt;br /&gt;
Currently this logic is implemented in new method in sign_up_controller.rb file and is invoked in the _add_topics.rb ruby injection file. With this action new.html.erb page is rendered. This should be avoided.&lt;br /&gt;
&lt;br /&gt;
'''Add topic:'''&lt;br /&gt;
&lt;br /&gt;
[[File:Add_topic_form.PNG]]&lt;br /&gt;
&lt;br /&gt;
Similar is the case for editing a topic. For editing a topic user is rendered to a form in edit page and again redirected to edit assignment page.&lt;br /&gt;
&lt;br /&gt;
'''Edit Topic:'''&lt;br /&gt;
&lt;br /&gt;
[[File:Edit_topic_form.PNG]]&lt;br /&gt;
&lt;br /&gt;
===Make the table in topics tab sortable by its header===&lt;br /&gt;
Currently after creating an assignment, we can add topics related to the assignment. The &amp;quot;Topics&amp;quot; tab in the edit assignment form shows the list of topics that are added to the assignment. The picture below shows the current page for displaying the list of topics of an assignment. The list is not sortable. The task is to make it sortable using ReactJS by topic id, topic name, Num. of slots, Available slots, Num. on waitlist columns as sorting on remaining columns doesn't give any meaningful display.&lt;br /&gt;
&lt;br /&gt;
[[File:topics_tab_assignment.png]]&lt;br /&gt;
&lt;br /&gt;
===Validating user entries===&lt;br /&gt;
The entries for the assignment creation are not according to any restrictions, that can add problem to database maintainence like sorting the entries, comparing them, retrieving. There are many such problem causing situations in the new assignment form, such as &lt;br /&gt;
* User can add the number as new assignment name or he can give only special characters for it like &amp;quot;$$$$&amp;quot;.&lt;br /&gt;
* Neglecting check boxes may lead to confusion with deadlines.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Userentries.png]]&lt;br /&gt;
&lt;br /&gt;
==Proposed Solution==&lt;br /&gt;
===Assignment Creation===&lt;br /&gt;
The new implementation will use ReactJS to generate a drop-down window on clicking on the New Assignment button (private/public) , providing same features as before. Database entry is made on submitting the form and the form is closed.&lt;br /&gt;
&lt;br /&gt;
====Files to be modified====&lt;br /&gt;
*apps/assets/javascripts/tree_display.jsx.erb&lt;br /&gt;
*apps/controllers/assignments_controller.rb&lt;br /&gt;
*apps/controllers/tree_display_controller.rb&lt;br /&gt;
&lt;br /&gt;
===Assignment Edition===&lt;br /&gt;
Similar to assignment creation, in the new implementation, using ReactJS, when the edit assignment button is clicked, instead of making a server request and rendering a new view, a drop down window appears and saving the details will make the database entry.Since all the processing is done on the client side there will be decrease in the number of server requests.&lt;br /&gt;
&lt;br /&gt;
====Files to be modified====&lt;br /&gt;
*apps/views/tree_display/list.html.erb&lt;br /&gt;
*apps/views/assignments/edit.html.erb&lt;br /&gt;
*apps/views/assignments/edit/_general.html.erb&lt;br /&gt;
&lt;br /&gt;
=== Addition of topics ===&lt;br /&gt;
* An interactive React JS component should be created and should be called by the ruby injection page ''sign_up_sheet/_add_topics.html.erb'' when New Topic link is clicked. This should show a form in that page to create topic.&lt;br /&gt;
* Delete/avoid usage of ''sign_up_sheet/new.html.erb'' page.&lt;br /&gt;
* Implement an React JS functional component to handle creation of topic and saving it to database.&lt;br /&gt;
&lt;br /&gt;
=== Editing topic ===&lt;br /&gt;
* An interactive React JS component should be created and should be called by the ruby injection page ''sign_up_sheet/_all_actions.html.erb'' when edit action is clicked. This should show a form in that page to edit topic.&lt;br /&gt;
* Delete/avoid usage of ''sign_up_sheet/edit.html.erb'' page.&lt;br /&gt;
* Implement an React JS functional component to handle editing  of topic and updating it to database.&lt;br /&gt;
&lt;br /&gt;
===Make the table in topics tab sortable by its header===&lt;br /&gt;
Following sub-tasks identified to implement sortable feature for topics table.&lt;br /&gt;
* Modify sign_up_sheet/_table_header.html.erb partial to change the table header fields to sortable type.&lt;br /&gt;
* Add sort functionality using ReactJS for each column that is meaningful to be sorted.&lt;br /&gt;
&lt;br /&gt;
===Validating user entries===&lt;br /&gt;
The following tasks are to be implemented to achieve users validation,&lt;br /&gt;
* Add the regular expression validation to avoid special characters in the names of assignment or directories.&lt;br /&gt;
* Create alert messages to notify user if any important check boxes are missed.&lt;br /&gt;
* Create validation for edge cases like giving empty values.&lt;br /&gt;
&lt;br /&gt;
===Files to be modified===&lt;br /&gt;
As, the project needs to be implemented in reactJS, which helps in reducing the complexing binding in MVC framework, only changing the javascript file can help to achieve this without changing model,&lt;br /&gt;
* app/assets/javascripts/tree_display.jsx.erb&lt;br /&gt;
&lt;br /&gt;
==Test Plan==&lt;br /&gt;
Rails development is the Test Driven development, which helps in ensuring the implementation of all proposed implementations. We will be writing all the implementations proposed as tests that will eventually be red in rspec and try to make them green by adding to the development part.&lt;br /&gt;
&lt;br /&gt;
For now the manual testing of these current implementations can help in testing the functionality from UI.&lt;br /&gt;
===Manual Testing===&lt;br /&gt;
Steps to manually test the feature are as follows: &lt;br /&gt;
&lt;br /&gt;
====Assignment Creation====&lt;br /&gt;
*Log in as an instructor ''(user-name:instructor6 password:password)''&lt;br /&gt;
*Go to Manage-&amp;gt;Assignments and click on the Assignments tab.&lt;br /&gt;
*Click on the 'New public assignment' or 'New private assignment' button&lt;br /&gt;
*Verify if drop-down window is displayed.&lt;br /&gt;
*Make valid entries for the available fields and click on 'create'.&lt;br /&gt;
*Verify if new assignment is successfully created.&lt;br /&gt;
&lt;br /&gt;
====Assignment Creation====&lt;br /&gt;
*Log in as an instructor ''(user-name:instructor6 password:password)''&lt;br /&gt;
*Go to Manage-&amp;gt;Assignments and click on the Assignments tab.&lt;br /&gt;
*Click on the Edit button for any of the available assignment.&lt;br /&gt;
*Verify if drop-down window is displayed.&lt;br /&gt;
*Make changes and click on 'save'.&lt;br /&gt;
*Verify if the changes made are successfully updated.&lt;br /&gt;
 &lt;br /&gt;
====Make the table in topics tab sortable by its header====&lt;br /&gt;
* Login as an instructor ''(instructor6/password)''&lt;br /&gt;
* Create an assignment&lt;br /&gt;
* Add 2 topics to the assignment&lt;br /&gt;
* Click sort on Topic ID and check if they are sorted&lt;br /&gt;
* Click sort on Topic title and check if they are sorted&lt;br /&gt;
* Similarly test using other columns&lt;br /&gt;
&lt;br /&gt;
====Validating user entries====&lt;br /&gt;
*Log in as an instructor ''(user-name:instructor6 password:password)''&lt;br /&gt;
*Go to Manage-&amp;gt;Assignments and click on the Assignments tab.&lt;br /&gt;
*Click on the 'New public assignment' or 'New private assignment' button&lt;br /&gt;
*Try adding the assignment using the weird names, with special symbols, ignoring check boxes&lt;br /&gt;
*Verify if the assignment is shown in the table.&lt;br /&gt;
&lt;br /&gt;
===Automation testing===&lt;br /&gt;
The above tests all will be automated using rspec.&lt;br /&gt;
&lt;br /&gt;
==Future Work==&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
#''http://railscasts.com/episodes/228-sortable-table-columns sortable-columns''&lt;br /&gt;
#''https://www.airpair.com/reactjs/posts/reactjs-a-guide-for-rails-developers adding-reactjs''&lt;/div&gt;</summary>
		<author><name>Dguttik</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/Convert_Assignment_Creation_Form_to_ReactJS&amp;diff=108195</id>
		<title>CSC/ECE 517 Spring 2017/Convert Assignment Creation Form to ReactJS</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/Convert_Assignment_Creation_Form_to_ReactJS&amp;diff=108195"/>
		<updated>2017-04-08T02:01:15Z</updated>

		<summary type="html">&lt;p&gt;Dguttik: /* Addition of topics */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
This page is a part of CSC/ECE 517 Final Project for Spring 2017 to describe the changes made by us to the open source software project Expertiza. We are converting the assignment creation form to ReactJS. Following contains a brief introduction to Expertiza, ReactJS followed by the problems we are tackling, our strategy for the implementation and the test plan.&lt;br /&gt;
   &lt;br /&gt;
==Expertiza==&lt;br /&gt;
Expertiza is a Ruby on Rails based web application where students can submit and peer review learning objects such as codes, articles, websites etc., It is an open source software project funded by National Science Foundation(NSF). The instructor has the capability to create assignments with varied specifications such as topics, courses, team size, level of reviews etc., later review the submitted work and provide feedback. Students can enter their submissions and also review others' work. &lt;br /&gt;
&lt;br /&gt;
==ReactJS==&lt;br /&gt;
ReactJS is the javascript framework developed by Facebook to solve the specific problem, ''UI rendering''. It is developed to solve the problem with complex binding in MVC framework using only one-way data binding. It is used for dynamic reloading of the page. It helps in reloading only the particular component required using Virtual DOM, which makes it fast by temporarily storing DOM&lt;br /&gt;
&lt;br /&gt;
'''Reasons for using ReactJS'''&lt;br /&gt;
* It has every functionality that an user interface required&lt;br /&gt;
* Easy data binding.&lt;br /&gt;
* Only single component changes are stored/changed without reloading the complete page.&lt;br /&gt;
* Fast and efficient&lt;br /&gt;
* Easy to scale&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
The Assignment Create and Edit Form are multi level forms. It consists of multiple inputs  and user interactions. Many input types have dependency on interactions by the user. For example, on check for a particular checkbox, remaining form is displayed. Also, edit page is reloaded whenever a topic is added. The task is to convert this pages into ReactJS components.&lt;br /&gt;
&lt;br /&gt;
'''Tasks to be done'''&lt;br /&gt;
*Organize the form layout, create several mockups and validate them to your users&lt;br /&gt;
*Make the table in topics tab sortable by its header&lt;br /&gt;
*Allow users to edit / add topics in the table instead of loading a new page&lt;br /&gt;
*Implement the new layout and convert the javascript to a ReactJS component&lt;br /&gt;
*Validate user entries&lt;br /&gt;
*Fix tooltips that don’t work&lt;br /&gt;
&lt;br /&gt;
==Current Implementation==&lt;br /&gt;
===Assignment Creation===&lt;br /&gt;
The assignment creation form consists of multiple inputs and requires interactions from the user. The current implementation is mostly in HTML with data validations being done by JQuery. When a user wants to create a new assignment by clicking the new assignment button, a server request is generated and new view is rendered. Again, another server request to make database entry is generated once the user fills in the data and clicks on 'save' button and again a new view is rendered. This kind of implementation doesn't support dynamic view rendering hence lacks the fluidity in overall user experience that one would expect.&lt;br /&gt;
&lt;br /&gt;
[[File:Create1.JPG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Create2.JPG]]&lt;br /&gt;
&lt;br /&gt;
===Assignment Edition===&lt;br /&gt;
Similar to assignment creation page, edit page lacks the dynamic view rendering which makes the user experience cumbersome. Every time user wants to make changes to the assignment, a server request is generated and new view is rendered. The save button hit on completion will again generate another server request and render a new view.&lt;br /&gt;
&lt;br /&gt;
[[File:Edit.jpg]]&lt;br /&gt;
&lt;br /&gt;
=== Add/Edit topics in Assignment ===&lt;br /&gt;
In current implementation whenever a topic is added to the assignment, a request is sent to the server and user is redirected to a form in another page. Opon creation of topic user is rendered back to edit assignment page. This process involves lot of redirection. Now, the task is to avoid this redirection of pages and create a interactive React JS form for adding and editing topic.&lt;br /&gt;
&lt;br /&gt;
Currently this logic is implemented in new method in sign_up_controller.rb file and is invoked in the _add_topics.rb ruby injection file. With this action new.html.erb page is rendered. This should be avoided.&lt;br /&gt;
&lt;br /&gt;
'''Add topic:'''&lt;br /&gt;
&lt;br /&gt;
[[File:Add_topic_form.PNG]]&lt;br /&gt;
&lt;br /&gt;
Similar is the case for editing a topic. For editing a topic user is rendered to a form in edit page and again redirected to edit assignment page.&lt;br /&gt;
&lt;br /&gt;
'''Edit Topic:'''&lt;br /&gt;
&lt;br /&gt;
[[File:Edit_topic_form.PNG]]&lt;br /&gt;
&lt;br /&gt;
===Make the table in topics tab sortable by its header===&lt;br /&gt;
Currently after creating an assignment, we can add topics related to the assignment. The &amp;quot;Topics&amp;quot; tab in the edit assignment form shows the list of topics that are added to the assignment. The picture below shows the current page for displaying the list of topics of an assignment. The list is not sortable. The task is to make it sortable using ReactJS by topic id, topic name, Num. of slots, Available slots, Num. on waitlist columns as sorting on remaining columns doesn't give any meaningful display.&lt;br /&gt;
&lt;br /&gt;
[[File:topics_tab_assignment.png]]&lt;br /&gt;
&lt;br /&gt;
===Validating user entries===&lt;br /&gt;
The entries for the assignment creation are not according to any restrictions, that can add problem to database maintainence like sorting the entries, comparing them, retrieving. There are many such problem causing situations in the new assignment form, such as &lt;br /&gt;
* User can add the number as new assignment name or he can give only special characters for it like &amp;quot;$$$$&amp;quot;.&lt;br /&gt;
* Neglecting check boxes may lead to confusion with deadlines.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Userentries.png]]&lt;br /&gt;
&lt;br /&gt;
==Proposed Solution==&lt;br /&gt;
===Assignment Creation===&lt;br /&gt;
The new implementation will use ReactJS to generate a drop-down window on clicking on the New Assignment button (private/public) , providing same features as before. Database entry is made on submitting the form and the form is closed.&lt;br /&gt;
&lt;br /&gt;
====Files to be modified====&lt;br /&gt;
*apps/assets/javascripts/tree_display.jsx.erb&lt;br /&gt;
*apps/controllers/assignments_controller.rb&lt;br /&gt;
*apps/controllers/tree_display_controller.rb&lt;br /&gt;
&lt;br /&gt;
===Assignment Edition===&lt;br /&gt;
Similar to assignment creation, in the new implementation, using ReactJS, when the edit assignment button is clicked, instead of making a server request and rendering a new view, a drop down window appears and saving the details will make the database entry.Since all the processing is done on the client side there will be decrease in the number of server requests.&lt;br /&gt;
&lt;br /&gt;
====Files to be modified====&lt;br /&gt;
*apps/views/tree_display/list.html.erb&lt;br /&gt;
*apps/views/assignments/edit.html.erb&lt;br /&gt;
*apps/views/assignments/edit/_general.html.erb&lt;br /&gt;
&lt;br /&gt;
=== Addition of topics ===&lt;br /&gt;
* An interactive React JS component should be created and should be called by the ruby injection page ''sign_up_sheet/_add_topics.html.erb'' when New Topic link is clicked. This should show a form in that page to create topic.&lt;br /&gt;
* Delete/avoid usage of ''sign_up_sheet/new.html.erb'' page.&lt;br /&gt;
* Implement an React JS functional component to handle creation of topic and saving it to database.&lt;br /&gt;
&lt;br /&gt;
=== Editing topic ===&lt;br /&gt;
* An interactive React JS component should be created and should be called by the ruby injection page ''_all_actions.html.erb'' when edit action is cliked. This should show a form in that page to edit topic.&lt;br /&gt;
* Delete/avoid usage of ''sign_up_sheet/edit.html.erb'' page.&lt;br /&gt;
* Implement an React JS functional component to handle editing  of topic and updating it to database.&lt;br /&gt;
&lt;br /&gt;
===Make the table in topics tab sortable by its header===&lt;br /&gt;
Following sub-tasks identified to implement sortable feature for topics table.&lt;br /&gt;
* Modify sign_up_sheet/_table_header.html.erb partial to change the table header fields to sortable type.&lt;br /&gt;
* Add sort functionality using ReactJS for each column that is meaningful to be sorted.&lt;br /&gt;
&lt;br /&gt;
===Validating user entries===&lt;br /&gt;
The following tasks are to be implemented to achieve users validation,&lt;br /&gt;
* Add the regular expression validation to avoid special characters in the names of assignment or directories.&lt;br /&gt;
* Create alert messages to notify user if any important check boxes are missed.&lt;br /&gt;
* Create validation for edge cases like giving empty values.&lt;br /&gt;
&lt;br /&gt;
===Files to be modified===&lt;br /&gt;
As, the project needs to be implemented in reactJS, which helps in reducing the complexing binding in MVC framework, only changing the javascript file can help to achieve this without changing model,&lt;br /&gt;
* app/assets/javascripts/tree_display.jsx.erb&lt;br /&gt;
&lt;br /&gt;
==Test Plan==&lt;br /&gt;
Rails development is the Test Driven development, which helps in ensuring the implementation of all proposed implementations. We will be writing all the implementations proposed as tests that will eventually be red in rspec and try to make them green by adding to the development part.&lt;br /&gt;
&lt;br /&gt;
For now the manual testing of these current implementations can help in testing the functionality from UI.&lt;br /&gt;
===Manual Testing===&lt;br /&gt;
Steps to manually test the feature are as follows: &lt;br /&gt;
&lt;br /&gt;
====Assignment Creation====&lt;br /&gt;
*Log in as an instructor ''(user-name:instructor6 password:password)''&lt;br /&gt;
*Go to Manage-&amp;gt;Assignments and click on the Assignments tab.&lt;br /&gt;
*Click on the 'New public assignment' or 'New private assignment' button&lt;br /&gt;
*Verify if drop-down window is displayed.&lt;br /&gt;
*Make valid entries for the available fields and click on 'create'.&lt;br /&gt;
*Verify if new assignment is successfully created.&lt;br /&gt;
&lt;br /&gt;
====Assignment Creation====&lt;br /&gt;
*Log in as an instructor ''(user-name:instructor6 password:password)''&lt;br /&gt;
*Go to Manage-&amp;gt;Assignments and click on the Assignments tab.&lt;br /&gt;
*Click on the Edit button for any of the available assignment.&lt;br /&gt;
*Verify if drop-down window is displayed.&lt;br /&gt;
*Make changes and click on 'save'.&lt;br /&gt;
*Verify if the changes made are successfully updated.&lt;br /&gt;
 &lt;br /&gt;
====Make the table in topics tab sortable by its header====&lt;br /&gt;
* Login as an instructor ''(instructor6/password)''&lt;br /&gt;
* Create an assignment&lt;br /&gt;
* Add 2 topics to the assignment&lt;br /&gt;
* Click sort on Topic ID and check if they are sorted&lt;br /&gt;
* Click sort on Topic title and check if they are sorted&lt;br /&gt;
* Similarly test using other columns&lt;br /&gt;
&lt;br /&gt;
====Validating user entries====&lt;br /&gt;
*Log in as an instructor ''(user-name:instructor6 password:password)''&lt;br /&gt;
*Go to Manage-&amp;gt;Assignments and click on the Assignments tab.&lt;br /&gt;
*Click on the 'New public assignment' or 'New private assignment' button&lt;br /&gt;
*Try adding the assignment using the weird names, with special symbols, ignoring check boxes&lt;br /&gt;
*Verify if the assignment is shown in the table.&lt;br /&gt;
&lt;br /&gt;
===Automation testing===&lt;br /&gt;
The above tests all will be automated using rspec.&lt;br /&gt;
&lt;br /&gt;
==Future Work==&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
#''http://railscasts.com/episodes/228-sortable-table-columns sortable-columns''&lt;br /&gt;
#''https://www.airpair.com/reactjs/posts/reactjs-a-guide-for-rails-developers adding-reactjs''&lt;/div&gt;</summary>
		<author><name>Dguttik</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/Convert_Assignment_Creation_Form_to_ReactJS&amp;diff=108193</id>
		<title>CSC/ECE 517 Spring 2017/Convert Assignment Creation Form to ReactJS</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/Convert_Assignment_Creation_Form_to_ReactJS&amp;diff=108193"/>
		<updated>2017-04-08T02:00:03Z</updated>

		<summary type="html">&lt;p&gt;Dguttik: /* Editing topic */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
This page is a part of CSC/ECE 517 Final Project for Spring 2017 to describe the changes made by us to the open source software project Expertiza. We are converting the assignment creation form to ReactJS. Following contains a brief introduction to Expertiza, ReactJS followed by the problems we are tackling, our strategy for the implementation and the test plan.&lt;br /&gt;
   &lt;br /&gt;
==Expertiza==&lt;br /&gt;
Expertiza is a Ruby on Rails based web application where students can submit and peer review learning objects such as codes, articles, websites etc., It is an open source software project funded by National Science Foundation(NSF). The instructor has the capability to create assignments with varied specifications such as topics, courses, team size, level of reviews etc., later review the submitted work and provide feedback. Students can enter their submissions and also review others' work. &lt;br /&gt;
&lt;br /&gt;
==ReactJS==&lt;br /&gt;
ReactJS is the javascript framework developed by Facebook to solve the specific problem, ''UI rendering''. It is developed to solve the problem with complex binding in MVC framework using only one-way data binding. It is used for dynamic reloading of the page. It helps in reloading only the particular component required using Virtual DOM, which makes it fast by temporarily storing DOM&lt;br /&gt;
&lt;br /&gt;
'''Reasons for using ReactJS'''&lt;br /&gt;
* It has every functionality that an user interface required&lt;br /&gt;
* Easy data binding.&lt;br /&gt;
* Only single component changes are stored/changed without reloading the complete page.&lt;br /&gt;
* Fast and efficient&lt;br /&gt;
* Easy to scale&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
The Assignment Create and Edit Form are multi level forms. It consists of multiple inputs  and user interactions. Many input types have dependency on interactions by the user. For example, on check for a particular checkbox, remaining form is displayed. Also, edit page is reloaded whenever a topic is added. The task is to convert this pages into ReactJS components.&lt;br /&gt;
&lt;br /&gt;
'''Tasks to be done'''&lt;br /&gt;
*Organize the form layout, create several mockups and validate them to your users&lt;br /&gt;
*Make the table in topics tab sortable by its header&lt;br /&gt;
*Allow users to edit / add topics in the table instead of loading a new page&lt;br /&gt;
*Implement the new layout and convert the javascript to a ReactJS component&lt;br /&gt;
*Validate user entries&lt;br /&gt;
*Fix tooltips that don’t work&lt;br /&gt;
&lt;br /&gt;
==Current Implementation==&lt;br /&gt;
===Assignment Creation===&lt;br /&gt;
The assignment creation form consists of multiple inputs and requires interactions from the user. The current implementation is mostly in HTML with data validations being done by JQuery. When a user wants to create a new assignment by clicking the new assignment button, a server request is generated and new view is rendered. Again, another server request to make database entry is generated once the user fills in the data and clicks on 'save' button and again a new view is rendered. This kind of implementation doesn't support dynamic view rendering hence lacks the fluidity in overall user experience that one would expect.&lt;br /&gt;
&lt;br /&gt;
[[File:Create1.JPG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Create2.JPG]]&lt;br /&gt;
&lt;br /&gt;
===Assignment Edition===&lt;br /&gt;
Similar to assignment creation page, edit page lacks the dynamic view rendering which makes the user experience cumbersome. Every time user wants to make changes to the assignment, a server request is generated and new view is rendered. The save button hit on completion will again generate another server request and render a new view.&lt;br /&gt;
&lt;br /&gt;
[[File:Edit.jpg]]&lt;br /&gt;
&lt;br /&gt;
=== Add/Edit topics in Assignment ===&lt;br /&gt;
In current implementation whenever a topic is added to the assignment, a request is sent to the server and user is redirected to a form in another page. Opon creation of topic user is rendered back to edit assignment page. This process involves lot of redirection. Now, the task is to avoid this redirection of pages and create a interactive React JS form for adding and editing topic.&lt;br /&gt;
&lt;br /&gt;
Currently this logic is implemented in new method in sign_up_controller.rb file and is invoked in the _add_topics.rb ruby injection file. With this action new.html.erb page is rendered. This should be avoided.&lt;br /&gt;
&lt;br /&gt;
'''Add topic:'''&lt;br /&gt;
&lt;br /&gt;
[[File:Add_topic_form.PNG]]&lt;br /&gt;
&lt;br /&gt;
Similar is the case for editing a topic. For editing a topic user is rendered to a form in edit page and again redirected to edit assignment page.&lt;br /&gt;
&lt;br /&gt;
'''Edit Topic:'''&lt;br /&gt;
&lt;br /&gt;
[[File:Edit_topic_form.PNG]]&lt;br /&gt;
&lt;br /&gt;
===Make the table in topics tab sortable by its header===&lt;br /&gt;
Currently after creating an assignment, we can add topics related to the assignment. The &amp;quot;Topics&amp;quot; tab in the edit assignment form shows the list of topics that are added to the assignment. The picture below shows the current page for displaying the list of topics of an assignment. The list is not sortable. The task is to make it sortable using ReactJS by topic id, topic name, Num. of slots, Available slots, Num. on waitlist columns as sorting on remaining columns doesn't give any meaningful display.&lt;br /&gt;
&lt;br /&gt;
[[File:topics_tab_assignment.png]]&lt;br /&gt;
&lt;br /&gt;
===Validating user entries===&lt;br /&gt;
The entries for the assignment creation are not according to any restrictions, that can add problem to database maintainence like sorting the entries, comparing them, retrieving. There are many such problem causing situations in the new assignment form, such as &lt;br /&gt;
* User can add the number as new assignment name or he can give only special characters for it like &amp;quot;$$$$&amp;quot;.&lt;br /&gt;
* Neglecting check boxes may lead to confusion with deadlines.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Userentries.png]]&lt;br /&gt;
&lt;br /&gt;
==Proposed Solution==&lt;br /&gt;
===Assignment Creation===&lt;br /&gt;
The new implementation will use ReactJS to generate a drop-down window on clicking on the New Assignment button (private/public) , providing same features as before. Database entry is made on submitting the form and the form is closed.&lt;br /&gt;
&lt;br /&gt;
====Files to be modified====&lt;br /&gt;
*apps/assets/javascripts/tree_display.jsx.erb&lt;br /&gt;
*apps/controllers/assignments_controller.rb&lt;br /&gt;
*apps/controllers/tree_display_controller.rb&lt;br /&gt;
&lt;br /&gt;
===Assignment Edition===&lt;br /&gt;
Similar to assignment creation, in the new implementation, using ReactJS, when the edit assignment button is clicked, instead of making a server request and rendering a new view, a drop down window appears and saving the details will make the database entry.Since all the processing is done on the client side there will be decrease in the number of server requests.&lt;br /&gt;
&lt;br /&gt;
====Files to be modified====&lt;br /&gt;
*apps/views/tree_display/list.html.erb&lt;br /&gt;
*apps/views/assignments/edit.html.erb&lt;br /&gt;
*apps/views/assignments/edit/_general.html.erb&lt;br /&gt;
&lt;br /&gt;
=== Addition of topics ===&lt;br /&gt;
* An interactive React JS component should be created in ''/assignments/edit.html.erb'' page and should  show a form in that page itself when New Topic is clicked.&lt;br /&gt;
* Delete/avoid usage of ''sign_up_sheet/new.html.erb'' page.&lt;br /&gt;
* Implement an React JS functional component to handle creation of topic and saving it to database.&lt;br /&gt;
&lt;br /&gt;
=== Editing topic ===&lt;br /&gt;
* An interactive React JS component should be created and should be called by the ruby injection page ''_all_actions.html.erb'' when edit action is cliked. This should show a form in that page to edit topic.&lt;br /&gt;
* Delete/avoid usage of ''sign_up_sheet/edit.html.erb'' page.&lt;br /&gt;
* Implement an React JS functional component to handle editing  of topic and updating it to database.&lt;br /&gt;
&lt;br /&gt;
===Make the table in topics tab sortable by its header===&lt;br /&gt;
Following sub-tasks identified to implement sortable feature for topics table.&lt;br /&gt;
* Modify sign_up_sheet/_table_header.html.erb partial to change the table header fields to sortable type.&lt;br /&gt;
* Add sort functionality using ReactJS for each column that is meaningful to be sorted.&lt;br /&gt;
&lt;br /&gt;
===Validating user entries===&lt;br /&gt;
The following tasks are to be implemented to achieve users validation,&lt;br /&gt;
* Add the regular expression validation to avoid special characters in the names of assignment or directories.&lt;br /&gt;
* Create alert messages to notify user if any important check boxes are missed.&lt;br /&gt;
* Create validation for edge cases like giving empty values.&lt;br /&gt;
&lt;br /&gt;
===Files to be modified===&lt;br /&gt;
As, the project needs to be implemented in reactJS, which helps in reducing the complexing binding in MVC framework, only changing the javascript file can help to achieve this without changing model,&lt;br /&gt;
* app/assets/javascripts/tree_display.jsx.erb&lt;br /&gt;
&lt;br /&gt;
==Test Plan==&lt;br /&gt;
Rails development is the Test Driven development, which helps in ensuring the implementation of all proposed implementations. We will be writing all the implementations proposed as tests that will eventually be red in rspec and try to make them green by adding to the development part.&lt;br /&gt;
&lt;br /&gt;
For now the manual testing of these current implementations can help in testing the functionality from UI.&lt;br /&gt;
===Manual Testing===&lt;br /&gt;
Steps to manually test the feature are as follows: &lt;br /&gt;
&lt;br /&gt;
====Assignment Creation====&lt;br /&gt;
*Log in as an instructor ''(user-name:instructor6 password:password)''&lt;br /&gt;
*Go to Manage-&amp;gt;Assignments and click on the Assignments tab.&lt;br /&gt;
*Click on the 'New public assignment' or 'New private assignment' button&lt;br /&gt;
*Verify if drop-down window is displayed.&lt;br /&gt;
*Make valid entries for the available fields and click on 'create'.&lt;br /&gt;
*Verify if new assignment is successfully created.&lt;br /&gt;
&lt;br /&gt;
====Assignment Creation====&lt;br /&gt;
*Log in as an instructor ''(user-name:instructor6 password:password)''&lt;br /&gt;
*Go to Manage-&amp;gt;Assignments and click on the Assignments tab.&lt;br /&gt;
*Click on the Edit button for any of the available assignment.&lt;br /&gt;
*Verify if drop-down window is displayed.&lt;br /&gt;
*Make changes and click on 'save'.&lt;br /&gt;
*Verify if the changes made are successfully updated.&lt;br /&gt;
 &lt;br /&gt;
====Make the table in topics tab sortable by its header====&lt;br /&gt;
* Login as an instructor ''(instructor6/password)''&lt;br /&gt;
* Create an assignment&lt;br /&gt;
* Add 2 topics to the assignment&lt;br /&gt;
* Click sort on Topic ID and check if they are sorted&lt;br /&gt;
* Click sort on Topic title and check if they are sorted&lt;br /&gt;
* Similarly test using other columns&lt;br /&gt;
&lt;br /&gt;
====Validating user entries====&lt;br /&gt;
*Log in as an instructor ''(user-name:instructor6 password:password)''&lt;br /&gt;
*Go to Manage-&amp;gt;Assignments and click on the Assignments tab.&lt;br /&gt;
*Click on the 'New public assignment' or 'New private assignment' button&lt;br /&gt;
*Try adding the assignment using the weird names, with special symbols, ignoring check boxes&lt;br /&gt;
*Verify if the assignment is shown in the table.&lt;br /&gt;
&lt;br /&gt;
===Automation testing===&lt;br /&gt;
The above tests all will be automated using rspec.&lt;br /&gt;
&lt;br /&gt;
==Future Work==&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
#''http://railscasts.com/episodes/228-sortable-table-columns sortable-columns''&lt;br /&gt;
#''https://www.airpair.com/reactjs/posts/reactjs-a-guide-for-rails-developers adding-reactjs''&lt;/div&gt;</summary>
		<author><name>Dguttik</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/Convert_Assignment_Creation_Form_to_ReactJS&amp;diff=108178</id>
		<title>CSC/ECE 517 Spring 2017/Convert Assignment Creation Form to ReactJS</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/Convert_Assignment_Creation_Form_to_ReactJS&amp;diff=108178"/>
		<updated>2017-04-08T01:46:14Z</updated>

		<summary type="html">&lt;p&gt;Dguttik: /* Add/Delete topics in Assignment */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
This page is a part of CSC/ECE 517 Final Project for Spring 2017 to describe the changes made by us to the open source software project Expertiza. We are converting the assignment creation form to ReactJS. Following contains a brief introduction to Expertiza, ReactJS followed by the problems we are tackling, our strategy for the implementation and the test plan.&lt;br /&gt;
   &lt;br /&gt;
==Expertiza==&lt;br /&gt;
Expertiza is a Ruby on Rails based web application where students can submit and peer review learning objects such as codes, articles, websites etc., It is an open source software project funded by National Science Foundation(NSF). The instructor has the capability to create assignments with varied specifications such as topics, courses, team size, level of reviews etc., later review the submitted work and provide feedback. Students can enter their submissions and also review others' work. &lt;br /&gt;
&lt;br /&gt;
==ReactJS==&lt;br /&gt;
ReactJS is the javascript framework developed by Facebook to solve the specific problem, ''UI rendering''. It is developed to solve the problem with complex binding in MVC framework using only one-way data binding. It is used for dynamic reloading of the page. It helps in reloading only the particular component required using Virtual DOM, which makes it fast by temporarily storing DOM&lt;br /&gt;
&lt;br /&gt;
'''Reasons for using ReactJS'''&lt;br /&gt;
* It has every functionality that an user interface required&lt;br /&gt;
* Easy data binding.&lt;br /&gt;
* Only single component changes are stored/changed without reloading the complete page.&lt;br /&gt;
* Fast and efficient&lt;br /&gt;
* Easy to scale&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
The Assignment Create and Edit Form are multi level forms. It consists of multiple inputs  and user interactions. Many input types have dependency on interactions by the user. For example, on check for a particular checkbox, remaining form is displayed. Also, edit page is reloaded whenever a topic is added. The task is to convert this pages into ReactJS components.&lt;br /&gt;
&lt;br /&gt;
'''Tasks to be done'''&lt;br /&gt;
*Organize the form layout, create several mockups and validate them to your users&lt;br /&gt;
*Make the table in topics tab sortable by its header&lt;br /&gt;
*Allow users to edit / add topics in the table instead of loading a new page&lt;br /&gt;
*Implement the new layout and convert the javascript to a ReactJS component&lt;br /&gt;
*Validate user entries&lt;br /&gt;
*Fix tooltips that don’t work&lt;br /&gt;
&lt;br /&gt;
==Current Implementation==&lt;br /&gt;
===Assignment Creation===&lt;br /&gt;
The assignment creation form consists of multiple inputs and requires interactions from the user. The current implementation is mostly in HTML with data validations being done by JQuery. When a user wants to create a new assignment by clicking the new assignment button, a server request is generated and new view is rendered. Again, another server request to make database entry is generated once the user fills in the data and clicks on 'save' button and again a new view is rendered. This kind of implementation doesn't support dynamic view rendering hence lacks the fluidity in overall user experience that one would expect.&lt;br /&gt;
&lt;br /&gt;
[[File:Create1.JPG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Create2.JPG]]&lt;br /&gt;
&lt;br /&gt;
===Assignment Edition===&lt;br /&gt;
Similar to assignment creation page, edit page lacks the dynamic view rendering which makes the user experience cumbersome. Every time user wants to make changes to the assignment, a server request is generated and new view is rendered. The save button hit on completion will again generate another server request and render a new view.&lt;br /&gt;
&lt;br /&gt;
[[File:Edit.jpg]]&lt;br /&gt;
&lt;br /&gt;
=== Add/Edit topics in Assignment ===&lt;br /&gt;
In current implementation whenever a topic is added to the assignment, a request is sent to the server and user is redirected to a form in another page. Opon creation of topic user is rendered back to edit assignment page. This process involves lot of redirection. Now, the task is to avoid this redirection of pages and create a interactive React JS form for adding and editing topic.&lt;br /&gt;
&lt;br /&gt;
Currently this logic is implemented in new method in sign_up_controller.rb file and is invoked in the _add_topics.rb ruby injection file. With this action new.html.erb page is rendered. This should be avoided.&lt;br /&gt;
&lt;br /&gt;
'''Add topic:'''&lt;br /&gt;
&lt;br /&gt;
[[File:Add_topic_form.PNG]]&lt;br /&gt;
&lt;br /&gt;
Similar is the case for editing a topic. For editing a topic user is rendered to a form in edit page and again redirected to edit assignment page.&lt;br /&gt;
&lt;br /&gt;
'''Edit Topic:'''&lt;br /&gt;
&lt;br /&gt;
[[File:Edit_topic_form.PNG]]&lt;br /&gt;
&lt;br /&gt;
===Make the table in topics tab sortable by its header===&lt;br /&gt;
Currently after creating an assignment, we can add topics related to the assignment. The &amp;quot;Topics&amp;quot; tab in the edit assignment form shows the list of topics that are added to the assignment. The picture below shows the current page for displaying the list of topics of an assignment. The list is not sortable. The task is to make it sortable using ReactJS by topic id, topic name, Num. of slots, Available slots, Num. on waitlist columns as sorting on remaining columns doesn't give any meaningful display.&lt;br /&gt;
&lt;br /&gt;
[[File:topics_tab_assignment.png]]&lt;br /&gt;
&lt;br /&gt;
===Validating user entries===&lt;br /&gt;
The entries for the assignment creation are not according to any restrictions, that can add problem to database maintainence like sorting the entries, comparing them, retrieving. There are many such problem causing situations in the new assignment form, such as &lt;br /&gt;
* User can add the number as new assignment name or he can give only special characters for it like &amp;quot;$$$$&amp;quot;.&lt;br /&gt;
* Neglecting check boxes may lead to confusion with deadlines.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Userentries.png]]&lt;br /&gt;
&lt;br /&gt;
==Proposed Solution==&lt;br /&gt;
===Assignment Creation===&lt;br /&gt;
The new implementation will use ReactJS to generate a drop-down window on clicking on the New Assignment button (private/public) , providing same features as before. Database entry is made on submitting the form and the form is closed.&lt;br /&gt;
&lt;br /&gt;
====Files to be modified====&lt;br /&gt;
*apps/assets/javascripts/tree_display.jsx.erb&lt;br /&gt;
*apps/controllers/assignments_controller.rb&lt;br /&gt;
*apps/controllers/tree_display_controller.rb&lt;br /&gt;
&lt;br /&gt;
===Assignment Edition===&lt;br /&gt;
Similar to assignment creation, in the new implementation, using ReactJS, when the edit assignment button is clicked, instead of making a server request and rendering a new view, a drop down window appears and saving the details will make the database entry.Since all the processing is done on the client side there will be decrease in the number of server requests.&lt;br /&gt;
&lt;br /&gt;
====Files to be modified====&lt;br /&gt;
*apps/views/tree_display/list.html.erb&lt;br /&gt;
*apps/views/assignments/edit.html.erb&lt;br /&gt;
*apps/views/assignments/edit/_general.html.erb&lt;br /&gt;
&lt;br /&gt;
=== Addition of topics ===&lt;br /&gt;
* An interactive React JS component should be created in ''/assignments/edit.html.erb'' page and should  show a form in that page itself when New Topic is clicked.&lt;br /&gt;
* Delete/avoid usage of ''sign_up_sheet/new.html.erb'' page.&lt;br /&gt;
* Implement an React JS functional component to handle creation of topic and saving it to database.&lt;br /&gt;
&lt;br /&gt;
=== Editing topic ===&lt;br /&gt;
*&lt;br /&gt;
* Delete/avoid usage of ''sign_up_sheet/edit.html.erb'' page.&lt;br /&gt;
* Implement an React JS functional component to handle editing  of topic and updating it to database.&lt;br /&gt;
&lt;br /&gt;
===Make the table in topics tab sortable by its header===&lt;br /&gt;
Following sub-tasks identified to implement sortable feature for topics table.&lt;br /&gt;
* Modify sign_up_sheet/_table_header.html.erb partial to change the table header fields to sortable type.&lt;br /&gt;
* Add sort functionality using ReactJS for each column that is meaningful to be sorted.&lt;br /&gt;
&lt;br /&gt;
===Validating user entries===&lt;br /&gt;
The following tasks are to be implemented to achieve users validation,&lt;br /&gt;
* Add the regular expression validation to avoid special characters in the names of assignment or directories.&lt;br /&gt;
* Create alert messages to notify user if any important check boxes are missed.&lt;br /&gt;
* Create validation for edge cases like giving empty values.&lt;br /&gt;
&lt;br /&gt;
===Files to be modified===&lt;br /&gt;
As, the project needs to be implemented in reactJS, which helps in reducing the complexing binding in MVC framework, only changing the javascript file can help to achieve this without changing model,&lt;br /&gt;
* app/assets/javascripts/tree_display.jsx.erb&lt;br /&gt;
&lt;br /&gt;
==Test Plan==&lt;br /&gt;
Rails development is the Test Driven development, which helps in ensuring the implementation of all proposed implementations. We will be writing all the implementations proposed as tests that will eventually be red in rspec and try to make them green by adding to the development part.&lt;br /&gt;
&lt;br /&gt;
For now the manual testing of these current implementations can help in testing the functionality from UI.&lt;br /&gt;
===Manual Testing===&lt;br /&gt;
Steps to manually test the feature are as follows: &lt;br /&gt;
&lt;br /&gt;
====Assignment Creation====&lt;br /&gt;
*Log in as an instructor ''(user-name:instructor6 password:password)''&lt;br /&gt;
*Go to Manage-&amp;gt;Assignments and click on the Assignments tab.&lt;br /&gt;
*Click on the 'New public assignment' or 'New private assignment' button&lt;br /&gt;
*Verify if drop-down window is displayed.&lt;br /&gt;
*Make valid entries for the available fields and click on 'create'.&lt;br /&gt;
*Verify if new assignment is successfully created.&lt;br /&gt;
&lt;br /&gt;
====Assignment Creation====&lt;br /&gt;
*Log in as an instructor ''(user-name:instructor6 password:password)''&lt;br /&gt;
*Go to Manage-&amp;gt;Assignments and click on the Assignments tab.&lt;br /&gt;
*Click on the Edit button for any of the available assignment.&lt;br /&gt;
*Verify if drop-down window is displayed.&lt;br /&gt;
*Make changes and click on 'save'.&lt;br /&gt;
*Verify if the changes made are successfully updated.&lt;br /&gt;
 &lt;br /&gt;
====Make the table in topics tab sortable by its header====&lt;br /&gt;
* Create an assignment&lt;br /&gt;
* Add 2 topics to the assignment&lt;br /&gt;
* Click sort on Topic ID and check if they are sorted&lt;br /&gt;
* Click sort on Topic title and check if they are sorted&lt;br /&gt;
* Similarly test using other columns&lt;br /&gt;
&lt;br /&gt;
====Validating user entries====&lt;br /&gt;
*Log in as an instructor ''(user-name:instructor6 password:password)''&lt;br /&gt;
*Go to Manage-&amp;gt;Assignments and click on the Assignments tab.&lt;br /&gt;
*Click on the 'New public assignment' or 'New private assignment' button&lt;br /&gt;
*Try adding the assignment using the weird names, with special symbols, ignoring check boxes&lt;br /&gt;
*Verify if the assignment is shown in the table.&lt;br /&gt;
&lt;br /&gt;
===Automation testing===&lt;br /&gt;
The above tests all will be automated using rspec.&lt;br /&gt;
&lt;br /&gt;
==Future Work==&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
#''http://railscasts.com/episodes/228-sortable-table-columns sortable-columns''&lt;br /&gt;
#''https://www.airpair.com/reactjs/posts/reactjs-a-guide-for-rails-developers adding-reactjs''&lt;/div&gt;</summary>
		<author><name>Dguttik</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/Convert_Assignment_Creation_Form_to_ReactJS&amp;diff=108176</id>
		<title>CSC/ECE 517 Spring 2017/Convert Assignment Creation Form to ReactJS</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/Convert_Assignment_Creation_Form_to_ReactJS&amp;diff=108176"/>
		<updated>2017-04-08T01:44:48Z</updated>

		<summary type="html">&lt;p&gt;Dguttik: /* Editing topic */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
This page is a part of CSC/ECE 517 Final Project for Spring 2017 to describe the changes made by us to the open source software project Expertiza. We are converting the assignment creation form to ReactJS. Following contains a brief introduction to Expertiza, ReactJS followed by the problems we are tackling, our strategy for the implementation and the test plan.&lt;br /&gt;
   &lt;br /&gt;
==Expertiza==&lt;br /&gt;
Expertiza is a Ruby on Rails based web application where students can submit and peer review learning objects such as codes, articles, websites etc., It is an open source software project funded by National Science Foundation(NSF). The instructor has the capability to create assignments with varied specifications such as topics, courses, team size, level of reviews etc., later review the submitted work and provide feedback. Students can enter their submissions and also review others' work. &lt;br /&gt;
&lt;br /&gt;
==ReactJS==&lt;br /&gt;
ReactJS is the javascript framework developed by Facebook to solve the specific problem, ''UI rendering''. It is developed to solve the problem with complex binding in MVC framework using only one-way data binding. It is used for dynamic reloading of the page. It helps in reloading only the particular component required using Virtual DOM, which makes it fast by temporarily storing DOM&lt;br /&gt;
&lt;br /&gt;
'''Reasons for using ReactJS'''&lt;br /&gt;
* It has every functionality that an user interface required&lt;br /&gt;
* Easy data binding.&lt;br /&gt;
* Only single component changes are stored/changed without reloading the complete page.&lt;br /&gt;
* Fast and efficient&lt;br /&gt;
* Easy to scale&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
The Assignment Create and Edit Form are multi level forms. It consists of multiple inputs  and user interactions. Many input types have dependency on interactions by the user. For example, on check for a particular checkbox, remaining form is displayed. Also, edit page is reloaded whenever a topic is added. The task is to convert this pages into ReactJS components.&lt;br /&gt;
&lt;br /&gt;
'''Tasks to be done'''&lt;br /&gt;
*Organize the form layout, create several mockups and validate them to your users&lt;br /&gt;
*Make the table in topics tab sortable by its header&lt;br /&gt;
*Allow users to edit / add topics in the table instead of loading a new page&lt;br /&gt;
*Implement the new layout and convert the javascript to a ReactJS component&lt;br /&gt;
*Validate user entries&lt;br /&gt;
*Fix tooltips that don’t work&lt;br /&gt;
&lt;br /&gt;
==Current Implementation==&lt;br /&gt;
===Assignment Creation===&lt;br /&gt;
The assignment creation form consists of multiple inputs and requires interactions from the user. The current implementation is mostly in HTML with data validations being done by JQuery. When a user wants to create a new assignment by clicking the new assignment button, a server request is generated and new view is rendered. Again, another server request to make database entry is generated once the user fills in the data and clicks on 'save' button and again a new view is rendered. This kind of implementation doesn't support dynamic view rendering hence lacks the fluidity in overall user experience that one would expect.&lt;br /&gt;
&lt;br /&gt;
[[File:Create1.JPG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Create2.JPG]]&lt;br /&gt;
&lt;br /&gt;
===Assignment Edition===&lt;br /&gt;
Similar to assignment creation page, edit page lacks the dynamic view rendering which makes the user experience cumbersome. Every time user wants to make changes to the assignment, a server request is generated and new view is rendered. The save button hit on completion will again generate another server request and render a new view.&lt;br /&gt;
&lt;br /&gt;
[[File:Edit.jpg]]&lt;br /&gt;
&lt;br /&gt;
=== Add/Delete topics in Assignment ===&lt;br /&gt;
In current implementation whenever a topic is added to the assignment, a request is sent to the server and user is redirected to a form in another page. Opon creation of topic user is rendered back to edit assignment page. This process involves lot of redirection. Now, the task is to avoid this redirection of pages and create a interactive React JS form for adding and editing topic.&lt;br /&gt;
&lt;br /&gt;
Currently this logic is implemented in new method in sign_up_controller.rb file and is invoked in the _add_topics.rb ruby injection file. With this action new.html.erb page is rendered. This should be avoided.&lt;br /&gt;
&lt;br /&gt;
'''Add topic:'''&lt;br /&gt;
&lt;br /&gt;
[[File:Add_topic_form.PNG]]&lt;br /&gt;
&lt;br /&gt;
Similar is the case for editing a topic. For editing a topic user is rendered to a form in edit page and again redirected to edit assignment page.&lt;br /&gt;
&lt;br /&gt;
'''Edit Topic:'''&lt;br /&gt;
&lt;br /&gt;
[[File:Edit_topic_form.PNG]]&lt;br /&gt;
&lt;br /&gt;
===Make the table in topics tab sortable by its header===&lt;br /&gt;
Currently after creating an assignment, we can add topics related to the assignment. The &amp;quot;Topics&amp;quot; tab in the edit assignment form shows the list of topics that are added to the assignment. The picture below shows the current page for displaying the list of topics of an assignment. The list is not sortable. The task is to make it sortable using ReactJS by topic id, topic name, Num. of slots, Available slots, Num. on waitlist columns as sorting on remaining columns doesn't give any meaningful display.&lt;br /&gt;
&lt;br /&gt;
[[File:topics_tab_assignment.png]]&lt;br /&gt;
&lt;br /&gt;
===Validating user entries===&lt;br /&gt;
The entries for the assignment creation are not according to any restrictions, that can add problem to database maintainence like sorting the entries, comparing them, retrieving. There are many such problem causing situations in the new assignment form, such as &lt;br /&gt;
* User can add the number as new assignment name or he can give only special characters for it like &amp;quot;$$$$&amp;quot;.&lt;br /&gt;
* Neglecting check boxes may lead to confusion with deadlines.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Userentries.png]]&lt;br /&gt;
&lt;br /&gt;
==Proposed Solution==&lt;br /&gt;
===Assignment Creation===&lt;br /&gt;
The new implementation will use ReactJS to generate a drop-down window on clicking on the New Assignment button (private/public) , providing same features as before. Database entry is made on submitting the form and the form is closed.&lt;br /&gt;
&lt;br /&gt;
====Files to be modified====&lt;br /&gt;
*apps/assets/javascripts/tree_display.jsx.erb&lt;br /&gt;
*apps/controllers/assignments_controller.rb&lt;br /&gt;
*apps/controllers/tree_display_controller.rb&lt;br /&gt;
&lt;br /&gt;
===Assignment Edition===&lt;br /&gt;
Similar to assignment creation, in the new implementation, using ReactJS, when the edit assignment button is clicked, instead of making a server request and rendering a new view, a drop down window appears and saving the details will make the database entry.Since all the processing is done on the client side there will be decrease in the number of server requests.&lt;br /&gt;
&lt;br /&gt;
====Files to be modified====&lt;br /&gt;
*apps/views/tree_display/list.html.erb&lt;br /&gt;
*apps/views/assignments/edit.html.erb&lt;br /&gt;
*apps/views/assignments/edit/_general.html.erb&lt;br /&gt;
&lt;br /&gt;
=== Addition of topics ===&lt;br /&gt;
* An interactive React JS component should be created in ''/assignments/edit.html.erb'' page and should  show a form in that page itself when New Topic is clicked.&lt;br /&gt;
* Delete/avoid usage of ''sign_up_sheet/new.html.erb'' page.&lt;br /&gt;
* Implement an React JS functional component to handle creation of topic and saving it to database.&lt;br /&gt;
&lt;br /&gt;
=== Editing topic ===&lt;br /&gt;
*&lt;br /&gt;
* Delete/avoid usage of ''sign_up_sheet/edit.html.erb'' page.&lt;br /&gt;
* Implement an React JS functional component to handle editing  of topic and updating it to database.&lt;br /&gt;
&lt;br /&gt;
===Make the table in topics tab sortable by its header===&lt;br /&gt;
Following sub-tasks identified to implement sortable feature for topics table.&lt;br /&gt;
* Modify sign_up_sheet/_table_header.html.erb partial to change the table header fields to sortable type.&lt;br /&gt;
* Add sort functionality using ReactJS for each column that is meaningful to be sorted.&lt;br /&gt;
&lt;br /&gt;
===Validating user entries===&lt;br /&gt;
The following tasks are to be implemented to achieve users validation,&lt;br /&gt;
* Add the regular expression validation to avoid special characters in the names of assignment or directories.&lt;br /&gt;
* Create alert messages to notify user if any important check boxes are missed.&lt;br /&gt;
* Create validation for edge cases like giving empty values.&lt;br /&gt;
&lt;br /&gt;
===Files to be modified===&lt;br /&gt;
As, the project needs to be implemented in reactJS, which helps in reducing the complexing binding in MVC framework, only changing the javascript file can help to achieve this without changing model,&lt;br /&gt;
* app/assets/javascripts/tree_display.jsx.erb&lt;br /&gt;
&lt;br /&gt;
==Test Plan==&lt;br /&gt;
Rails development is the Test Driven development, which helps in ensuring the implementation of all proposed implementations. We will be writing all the implementations proposed as tests that will eventually be red in rspec and try to make them green by adding to the development part.&lt;br /&gt;
&lt;br /&gt;
For now the manual testing of these current implementations can help in testing the functionality from UI.&lt;br /&gt;
===Manual Testing===&lt;br /&gt;
Steps to manually test the feature are as follows: &lt;br /&gt;
&lt;br /&gt;
====Assignment Creation====&lt;br /&gt;
*Log in as an instructor ''(user-name:instructor6 password:password)''&lt;br /&gt;
*Go to Manage-&amp;gt;Assignments and click on the Assignments tab.&lt;br /&gt;
*Click on the 'New public assignment' or 'New private assignment' button&lt;br /&gt;
*Verify if drop-down window is displayed.&lt;br /&gt;
*Make valid entries for the available fields and click on 'create'.&lt;br /&gt;
*Verify if new assignment is successfully created.&lt;br /&gt;
&lt;br /&gt;
====Assignment Creation====&lt;br /&gt;
*Log in as an instructor ''(user-name:instructor6 password:password)''&lt;br /&gt;
*Go to Manage-&amp;gt;Assignments and click on the Assignments tab.&lt;br /&gt;
*Click on the Edit button for any of the available assignment.&lt;br /&gt;
*Verify if drop-down window is displayed.&lt;br /&gt;
*Make changes and click on 'save'.&lt;br /&gt;
*Verify if the changes made are successfully updated.&lt;br /&gt;
 &lt;br /&gt;
====Make the table in topics tab sortable by its header====&lt;br /&gt;
* Create an assignment&lt;br /&gt;
* Add 2 topics to the assignment&lt;br /&gt;
* Click sort on Topic ID and check if they are sorted&lt;br /&gt;
* Click sort on Topic title and check if they are sorted&lt;br /&gt;
* Similarly test using other columns&lt;br /&gt;
&lt;br /&gt;
====Validating user entries====&lt;br /&gt;
*Log in as an instructor ''(user-name:instructor6 password:password)''&lt;br /&gt;
*Go to Manage-&amp;gt;Assignments and click on the Assignments tab.&lt;br /&gt;
*Click on the 'New public assignment' or 'New private assignment' button&lt;br /&gt;
*Try adding the assignment using the weird names, with special symbols, ignoring check boxes&lt;br /&gt;
*Verify if the assignment is shown in the table.&lt;br /&gt;
&lt;br /&gt;
===Automation testing===&lt;br /&gt;
The above tests all will be automated using rspec.&lt;br /&gt;
&lt;br /&gt;
==Future Work==&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
#''http://railscasts.com/episodes/228-sortable-table-columns sortable-columns''&lt;br /&gt;
#''https://www.airpair.com/reactjs/posts/reactjs-a-guide-for-rails-developers adding-reactjs''&lt;/div&gt;</summary>
		<author><name>Dguttik</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/Convert_Assignment_Creation_Form_to_ReactJS&amp;diff=108175</id>
		<title>CSC/ECE 517 Spring 2017/Convert Assignment Creation Form to ReactJS</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/Convert_Assignment_Creation_Form_to_ReactJS&amp;diff=108175"/>
		<updated>2017-04-08T01:44:08Z</updated>

		<summary type="html">&lt;p&gt;Dguttik: /* Addition of topics */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
This page is a part of CSC/ECE 517 Final Project for Spring 2017 to describe the changes made by us to the open source software project Expertiza. We are converting the assignment creation form to ReactJS. Following contains a brief introduction to Expertiza, ReactJS followed by the problems we are tackling, our strategy for the implementation and the test plan.&lt;br /&gt;
   &lt;br /&gt;
==Expertiza==&lt;br /&gt;
Expertiza is a Ruby on Rails based web application where students can submit and peer review learning objects such as codes, articles, websites etc., It is an open source software project funded by National Science Foundation(NSF). The instructor has the capability to create assignments with varied specifications such as topics, courses, team size, level of reviews etc., later review the submitted work and provide feedback. Students can enter their submissions and also review others' work. &lt;br /&gt;
&lt;br /&gt;
==ReactJS==&lt;br /&gt;
ReactJS is the javascript framework developed by Facebook to solve the specific problem, ''UI rendering''. It is developed to solve the problem with complex binding in MVC framework using only one-way data binding. It is used for dynamic reloading of the page. It helps in reloading only the particular component required using Virtual DOM, which makes it fast by temporarily storing DOM&lt;br /&gt;
&lt;br /&gt;
'''Reasons for using ReactJS'''&lt;br /&gt;
* It has every functionality that an user interface required&lt;br /&gt;
* Easy data binding.&lt;br /&gt;
* Only single component changes are stored/changed without reloading the complete page.&lt;br /&gt;
* Fast and efficient&lt;br /&gt;
* Easy to scale&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
The Assignment Create and Edit Form are multi level forms. It consists of multiple inputs  and user interactions. Many input types have dependency on interactions by the user. For example, on check for a particular checkbox, remaining form is displayed. Also, edit page is reloaded whenever a topic is added. The task is to convert this pages into ReactJS components.&lt;br /&gt;
&lt;br /&gt;
'''Tasks to be done'''&lt;br /&gt;
*Organize the form layout, create several mockups and validate them to your users&lt;br /&gt;
*Make the table in topics tab sortable by its header&lt;br /&gt;
*Allow users to edit / add topics in the table instead of loading a new page&lt;br /&gt;
*Implement the new layout and convert the javascript to a ReactJS component&lt;br /&gt;
*Validate user entries&lt;br /&gt;
*Fix tooltips that don’t work&lt;br /&gt;
&lt;br /&gt;
==Current Implementation==&lt;br /&gt;
===Assignment Creation===&lt;br /&gt;
The assignment creation form consists of multiple inputs and requires interactions from the user. The current implementation is mostly in HTML with data validations being done by JQuery. When a user wants to create a new assignment by clicking the new assignment button, a server request is generated and new view is rendered. Again, another server request to make database entry is generated once the user fills in the data and clicks on 'save' button and again a new view is rendered. This kind of implementation doesn't support dynamic view rendering hence lacks the fluidity in overall user experience that one would expect.&lt;br /&gt;
&lt;br /&gt;
[[File:Create1.JPG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Create2.JPG]]&lt;br /&gt;
&lt;br /&gt;
===Assignment Edition===&lt;br /&gt;
Similar to assignment creation page, edit page lacks the dynamic view rendering which makes the user experience cumbersome. Every time user wants to make changes to the assignment, a server request is generated and new view is rendered. The save button hit on completion will again generate another server request and render a new view.&lt;br /&gt;
&lt;br /&gt;
[[File:Edit.jpg]]&lt;br /&gt;
&lt;br /&gt;
=== Add/Delete topics in Assignment ===&lt;br /&gt;
In current implementation whenever a topic is added to the assignment, a request is sent to the server and user is redirected to a form in another page. Opon creation of topic user is rendered back to edit assignment page. This process involves lot of redirection. Now, the task is to avoid this redirection of pages and create a interactive React JS form for adding and editing topic.&lt;br /&gt;
&lt;br /&gt;
Currently this logic is implemented in new method in sign_up_controller.rb file and is invoked in the _add_topics.rb ruby injection file. With this action new.html.erb page is rendered. This should be avoided.&lt;br /&gt;
&lt;br /&gt;
'''Add topic:'''&lt;br /&gt;
&lt;br /&gt;
[[File:Add_topic_form.PNG]]&lt;br /&gt;
&lt;br /&gt;
Similar is the case for editing a topic. For editing a topic user is rendered to a form in edit page and again redirected to edit assignment page.&lt;br /&gt;
&lt;br /&gt;
'''Edit Topic:'''&lt;br /&gt;
&lt;br /&gt;
[[File:Edit_topic_form.PNG]]&lt;br /&gt;
&lt;br /&gt;
===Make the table in topics tab sortable by its header===&lt;br /&gt;
Currently after creating an assignment, we can add topics related to the assignment. The &amp;quot;Topics&amp;quot; tab in the edit assignment form shows the list of topics that are added to the assignment. The picture below shows the current page for displaying the list of topics of an assignment. The list is not sortable. The task is to make it sortable using ReactJS by topic id, topic name, Num. of slots, Available slots, Num. on waitlist columns as sorting on remaining columns doesn't give any meaningful display.&lt;br /&gt;
&lt;br /&gt;
[[File:topics_tab_assignment.png]]&lt;br /&gt;
&lt;br /&gt;
===Validating user entries===&lt;br /&gt;
The entries for the assignment creation are not according to any restrictions, that can add problem to database maintainence like sorting the entries, comparing them, retrieving. There are many such problem causing situations in the new assignment form, such as &lt;br /&gt;
* User can add the number as new assignment name or he can give only special characters for it like &amp;quot;$$$$&amp;quot;.&lt;br /&gt;
* Neglecting check boxes may lead to confusion with deadlines.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Userentries.png]]&lt;br /&gt;
&lt;br /&gt;
==Proposed Solution==&lt;br /&gt;
===Assignment Creation===&lt;br /&gt;
The new implementation will use ReactJS to generate a drop-down window on clicking on the New Assignment button (private/public) , providing same features as before. Database entry is made on submitting the form and the form is closed.&lt;br /&gt;
&lt;br /&gt;
====Files to be modified====&lt;br /&gt;
*apps/assets/javascripts/tree_display.jsx.erb&lt;br /&gt;
*apps/controllers/assignments_controller.rb&lt;br /&gt;
*apps/controllers/tree_display_controller.rb&lt;br /&gt;
&lt;br /&gt;
===Assignment Edition===&lt;br /&gt;
Similar to assignment creation, in the new implementation, using ReactJS, when the edit assignment button is clicked, instead of making a server request and rendering a new view, a drop down window appears and saving the details will make the database entry.Since all the processing is done on the client side there will be decrease in the number of server requests.&lt;br /&gt;
&lt;br /&gt;
====Files to be modified====&lt;br /&gt;
*apps/views/tree_display/list.html.erb&lt;br /&gt;
*apps/views/assignments/edit.html.erb&lt;br /&gt;
*apps/views/assignments/edit/_general.html.erb&lt;br /&gt;
&lt;br /&gt;
=== Addition of topics ===&lt;br /&gt;
* An interactive React JS component should be created in ''/assignments/edit.html.erb'' page and should  show a form in that page itself when New Topic is clicked.&lt;br /&gt;
* Delete/avoid usage of ''sign_up_sheet/new.html.erb'' page.&lt;br /&gt;
* Implement an React JS functional component to handle creation of topic and saving it to database.&lt;br /&gt;
&lt;br /&gt;
=== Editing topic ===&lt;br /&gt;
*&lt;br /&gt;
&lt;br /&gt;
===Make the table in topics tab sortable by its header===&lt;br /&gt;
Following sub-tasks identified to implement sortable feature for topics table.&lt;br /&gt;
* Modify sign_up_sheet/_table_header.html.erb partial to change the table header fields to sortable type.&lt;br /&gt;
* Add sort functionality using ReactJS for each column that is meaningful to be sorted.&lt;br /&gt;
&lt;br /&gt;
===Validating user entries===&lt;br /&gt;
The following tasks are to be implemented to achieve users validation,&lt;br /&gt;
* Add the regular expression validation to avoid special characters in the names of assignment or directories.&lt;br /&gt;
* Create alert messages to notify user if any important check boxes are missed.&lt;br /&gt;
* Create validation for edge cases like giving empty values.&lt;br /&gt;
&lt;br /&gt;
===Files to be modified===&lt;br /&gt;
As, the project needs to be implemented in reactJS, which helps in reducing the complexing binding in MVC framework, only changing the javascript file can help to achieve this without changing model,&lt;br /&gt;
* app/assets/javascripts/tree_display.jsx.erb&lt;br /&gt;
&lt;br /&gt;
==Test Plan==&lt;br /&gt;
Rails development is the Test Driven development, which helps in ensuring the implementation of all proposed implementations. We will be writing all the implementations proposed as tests that will eventually be red in rspec and try to make them green by adding to the development part.&lt;br /&gt;
&lt;br /&gt;
For now the manual testing of these current implementations can help in testing the functionality from UI.&lt;br /&gt;
===Manual Testing===&lt;br /&gt;
Steps to manually test the feature are as follows: &lt;br /&gt;
&lt;br /&gt;
====Assignment Creation====&lt;br /&gt;
*Log in as an instructor ''(user-name:instructor6 password:password)''&lt;br /&gt;
*Go to Manage-&amp;gt;Assignments and click on the Assignments tab.&lt;br /&gt;
*Click on the 'New public assignment' or 'New private assignment' button&lt;br /&gt;
*Verify if drop-down window is displayed.&lt;br /&gt;
*Make valid entries for the available fields and click on 'create'.&lt;br /&gt;
*Verify if new assignment is successfully created.&lt;br /&gt;
&lt;br /&gt;
====Assignment Creation====&lt;br /&gt;
*Log in as an instructor ''(user-name:instructor6 password:password)''&lt;br /&gt;
*Go to Manage-&amp;gt;Assignments and click on the Assignments tab.&lt;br /&gt;
*Click on the Edit button for any of the available assignment.&lt;br /&gt;
*Verify if drop-down window is displayed.&lt;br /&gt;
*Make changes and click on 'save'.&lt;br /&gt;
*Verify if the changes made are successfully updated.&lt;br /&gt;
 &lt;br /&gt;
====Make the table in topics tab sortable by its header====&lt;br /&gt;
* Create an assignment&lt;br /&gt;
* Add 2 topics to the assignment&lt;br /&gt;
* Click sort on Topic ID and check if they are sorted&lt;br /&gt;
* Click sort on Topic title and check if they are sorted&lt;br /&gt;
* Similarly test using other columns&lt;br /&gt;
&lt;br /&gt;
====Validating user entries====&lt;br /&gt;
*Log in as an instructor ''(user-name:instructor6 password:password)''&lt;br /&gt;
*Go to Manage-&amp;gt;Assignments and click on the Assignments tab.&lt;br /&gt;
*Click on the 'New public assignment' or 'New private assignment' button&lt;br /&gt;
*Try adding the assignment using the weird names, with special symbols, ignoring check boxes&lt;br /&gt;
*Verify if the assignment is shown in the table.&lt;br /&gt;
&lt;br /&gt;
===Automation testing===&lt;br /&gt;
The above tests all will be automated using rspec.&lt;br /&gt;
&lt;br /&gt;
==Future Work==&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
#''http://railscasts.com/episodes/228-sortable-table-columns sortable-columns''&lt;br /&gt;
#''https://www.airpair.com/reactjs/posts/reactjs-a-guide-for-rails-developers adding-reactjs''&lt;/div&gt;</summary>
		<author><name>Dguttik</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/Convert_Assignment_Creation_Form_to_ReactJS&amp;diff=108174</id>
		<title>CSC/ECE 517 Spring 2017/Convert Assignment Creation Form to ReactJS</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/Convert_Assignment_Creation_Form_to_ReactJS&amp;diff=108174"/>
		<updated>2017-04-08T01:42:55Z</updated>

		<summary type="html">&lt;p&gt;Dguttik: /* Addition of topics */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
This page is a part of CSC/ECE 517 Final Project for Spring 2017 to describe the changes made by us to the open source software project Expertiza. We are converting the assignment creation form to ReactJS. Following contains a brief introduction to Expertiza, ReactJS followed by the problems we are tackling, our strategy for the implementation and the test plan.&lt;br /&gt;
   &lt;br /&gt;
==Expertiza==&lt;br /&gt;
Expertiza is a Ruby on Rails based web application where students can submit and peer review learning objects such as codes, articles, websites etc., It is an open source software project funded by National Science Foundation(NSF). The instructor has the capability to create assignments with varied specifications such as topics, courses, team size, level of reviews etc., later review the submitted work and provide feedback. Students can enter their submissions and also review others' work. &lt;br /&gt;
&lt;br /&gt;
==ReactJS==&lt;br /&gt;
ReactJS is the javascript framework developed by Facebook to solve the specific problem, ''UI rendering''. It is developed to solve the problem with complex binding in MVC framework using only one-way data binding. It is used for dynamic reloading of the page. It helps in reloading only the particular component required using Virtual DOM, which makes it fast by temporarily storing DOM&lt;br /&gt;
&lt;br /&gt;
'''Reasons for using ReactJS'''&lt;br /&gt;
* It has every functionality that an user interface required&lt;br /&gt;
* Easy data binding.&lt;br /&gt;
* Only single component changes are stored/changed without reloading the complete page.&lt;br /&gt;
* Fast and efficient&lt;br /&gt;
* Easy to scale&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
The Assignment Create and Edit Form are multi level forms. It consists of multiple inputs  and user interactions. Many input types have dependency on interactions by the user. For example, on check for a particular checkbox, remaining form is displayed. Also, edit page is reloaded whenever a topic is added. The task is to convert this pages into ReactJS components.&lt;br /&gt;
&lt;br /&gt;
'''Tasks to be done'''&lt;br /&gt;
*Organize the form layout, create several mockups and validate them to your users&lt;br /&gt;
*Make the table in topics tab sortable by its header&lt;br /&gt;
*Allow users to edit / add topics in the table instead of loading a new page&lt;br /&gt;
*Implement the new layout and convert the javascript to a ReactJS component&lt;br /&gt;
*Validate user entries&lt;br /&gt;
*Fix tooltips that don’t work&lt;br /&gt;
&lt;br /&gt;
==Current Implementation==&lt;br /&gt;
===Assignment Creation===&lt;br /&gt;
The assignment creation form consists of multiple inputs and requires interactions from the user. The current implementation is mostly in HTML with data validations being done by JQuery. When a user wants to create a new assignment by clicking the new assignment button, a server request is generated and new view is rendered. Again, another server request to make database entry is generated once the user fills in the data and clicks on 'save' button and again a new view is rendered. This kind of implementation doesn't support dynamic view rendering hence lacks the fluidity in overall user experience that one would expect.&lt;br /&gt;
&lt;br /&gt;
[[File:Create1.JPG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Create2.JPG]]&lt;br /&gt;
&lt;br /&gt;
===Assignment Edition===&lt;br /&gt;
Similar to assignment creation page, edit page lacks the dynamic view rendering which makes the user experience cumbersome. Every time user wants to make changes to the assignment, a server request is generated and new view is rendered. The save button hit on completion will again generate another server request and render a new view.&lt;br /&gt;
&lt;br /&gt;
[[File:Edit.jpg]]&lt;br /&gt;
&lt;br /&gt;
=== Add/Delete topics in Assignment ===&lt;br /&gt;
In current implementation whenever a topic is added to the assignment, a request is sent to the server and user is redirected to a form in another page. Opon creation of topic user is rendered back to edit assignment page. This process involves lot of redirection. Now, the task is to avoid this redirection of pages and create a interactive React JS form for adding and editing topic.&lt;br /&gt;
&lt;br /&gt;
Currently this logic is implemented in new method in sign_up_controller.rb file and is invoked in the _add_topics.rb ruby injection file. With this action new.html.erb page is rendered. This should be avoided.&lt;br /&gt;
&lt;br /&gt;
'''Add topic:'''&lt;br /&gt;
&lt;br /&gt;
[[File:Add_topic_form.PNG]]&lt;br /&gt;
&lt;br /&gt;
Similar is the case for editing a topic. For editing a topic user is rendered to a form in edit page and again redirected to edit assignment page.&lt;br /&gt;
&lt;br /&gt;
'''Edit Topic:'''&lt;br /&gt;
&lt;br /&gt;
[[File:Edit_topic_form.PNG]]&lt;br /&gt;
&lt;br /&gt;
===Make the table in topics tab sortable by its header===&lt;br /&gt;
Currently after creating an assignment, we can add topics related to the assignment. The &amp;quot;Topics&amp;quot; tab in the edit assignment form shows the list of topics that are added to the assignment. The picture below shows the current page for displaying the list of topics of an assignment. The list is not sortable. The task is to make it sortable using ReactJS by topic id, topic name, Num. of slots, Available slots, Num. on waitlist columns as sorting on remaining columns doesn't give any meaningful display.&lt;br /&gt;
&lt;br /&gt;
[[File:topics_tab_assignment.png]]&lt;br /&gt;
&lt;br /&gt;
===Validating user entries===&lt;br /&gt;
The entries for the assignment creation are not according to any restrictions, that can add problem to database maintainence like sorting the entries, comparing them, retrieving. There are many such problem causing situations in the new assignment form, such as &lt;br /&gt;
* User can add the number as new assignment name or he can give only special characters for it like &amp;quot;$$$$&amp;quot;.&lt;br /&gt;
* Neglecting check boxes may lead to confusion with deadlines.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Userentries.png]]&lt;br /&gt;
&lt;br /&gt;
==Proposed Solution==&lt;br /&gt;
===Assignment Creation===&lt;br /&gt;
The new implementation will use ReactJS to generate a drop-down window on clicking on the New Assignment button (private/public) , providing same features as before. Database entry is made on submitting the form and the form is closed.&lt;br /&gt;
&lt;br /&gt;
====Files to be modified====&lt;br /&gt;
*apps/assets/javascripts/tree_display.jsx.erb&lt;br /&gt;
*apps/controllers/assignments_controller.rb&lt;br /&gt;
*apps/controllers/tree_display_controller.rb&lt;br /&gt;
&lt;br /&gt;
===Assignment Edition===&lt;br /&gt;
Similar to assignment creation, in the new implementation, using ReactJS, when the edit assignment button is clicked, instead of making a server request and rendering a new view, a drop down window appears and saving the details will make the database entry.Since all the processing is done on the client side there will be decrease in the number of server requests.&lt;br /&gt;
&lt;br /&gt;
====Files to be modified====&lt;br /&gt;
*apps/views/tree_display/list.html.erb&lt;br /&gt;
*apps/views/assignments/edit.html.erb&lt;br /&gt;
*apps/views/assignments/edit/_general.html.erb&lt;br /&gt;
&lt;br /&gt;
=== Addition of topics ===&lt;br /&gt;
* An interactive React JS component should be created in /assignments/edit page and should  show a form in that page itself when New Topic is clicked.&lt;br /&gt;
* Delete/avoid usage of sign_up_sheet/new page.&lt;br /&gt;
* Implement an React JS functional component to handle creation of topic and saving it to database.&lt;br /&gt;
&lt;br /&gt;
=== Editing topic ===&lt;br /&gt;
*&lt;br /&gt;
&lt;br /&gt;
===Make the table in topics tab sortable by its header===&lt;br /&gt;
Following sub-tasks identified to implement sortable feature for topics table.&lt;br /&gt;
* Modify sign_up_sheet/_table_header.html.erb partial to change the table header fields to sortable type.&lt;br /&gt;
* Add sort functionality using ReactJS for each column that is meaningful to be sorted.&lt;br /&gt;
&lt;br /&gt;
===Validating user entries===&lt;br /&gt;
The following tasks are to be implemented to achieve users validation,&lt;br /&gt;
* Add the regular expression validation to avoid special characters in the names of assignment or directories.&lt;br /&gt;
* Create alert messages to notify user if any important check boxes are missed.&lt;br /&gt;
* Create validation for edge cases like giving empty values.&lt;br /&gt;
&lt;br /&gt;
===Files to be modified===&lt;br /&gt;
As, the project needs to be implemented in reactJS, which helps in reducing the complexing binding in MVC framework, only changing the javascript file can help to achieve this without changing model,&lt;br /&gt;
* app/assets/javascripts/tree_display.jsx.erb&lt;br /&gt;
&lt;br /&gt;
==Test Plan==&lt;br /&gt;
Rails development is the Test Driven development, which helps in ensuring the implementation of all proposed implementations. We will be writing all the implementations proposed as tests that will eventually be red in rspec and try to make them green by adding to the development part.&lt;br /&gt;
&lt;br /&gt;
For now the manual testing of these current implementations can help in testing the functionality from UI.&lt;br /&gt;
===Manual Testing===&lt;br /&gt;
Steps to manually test the feature are as follows: &lt;br /&gt;
&lt;br /&gt;
====Assignment Creation====&lt;br /&gt;
*Log in as an instructor ''(user-name:instructor6 password:password)''&lt;br /&gt;
*Go to Manage-&amp;gt;Assignments and click on the Assignments tab.&lt;br /&gt;
*Click on the 'New public assignment' or 'New private assignment' button&lt;br /&gt;
*Verify if drop-down window is displayed.&lt;br /&gt;
*Make valid entries for the available fields and click on 'create'.&lt;br /&gt;
*Verify if new assignment is successfully created.&lt;br /&gt;
&lt;br /&gt;
====Assignment Creation====&lt;br /&gt;
*Log in as an instructor ''(user-name:instructor6 password:password)''&lt;br /&gt;
*Go to Manage-&amp;gt;Assignments and click on the Assignments tab.&lt;br /&gt;
*Click on the Edit button for any of the available assignment.&lt;br /&gt;
*Verify if drop-down window is displayed.&lt;br /&gt;
*Make changes and click on 'save'.&lt;br /&gt;
*Verify if the changes made are successfully updated.&lt;br /&gt;
 &lt;br /&gt;
====Make the table in topics tab sortable by its header====&lt;br /&gt;
* Create an assignment&lt;br /&gt;
* Add 2 topics to the assignment&lt;br /&gt;
* Click sort on Topic ID and check if they are sorted&lt;br /&gt;
* Click sort on Topic title and check if they are sorted&lt;br /&gt;
* Similarly test using other columns&lt;br /&gt;
&lt;br /&gt;
====Validating user entries====&lt;br /&gt;
*Log in as an instructor ''(user-name:instructor6 password:password)''&lt;br /&gt;
*Go to Manage-&amp;gt;Assignments and click on the Assignments tab.&lt;br /&gt;
*Click on the 'New public assignment' or 'New private assignment' button&lt;br /&gt;
*Try adding the assignment using the weird names, with special symbols, ignoring check boxes&lt;br /&gt;
*Verify if the assignment is shown in the table.&lt;br /&gt;
&lt;br /&gt;
===Automation testing===&lt;br /&gt;
The above tests all will be automated using rspec.&lt;br /&gt;
&lt;br /&gt;
==Future Work==&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
#''http://railscasts.com/episodes/228-sortable-table-columns sortable-columns''&lt;br /&gt;
#''https://www.airpair.com/reactjs/posts/reactjs-a-guide-for-rails-developers adding-reactjs''&lt;/div&gt;</summary>
		<author><name>Dguttik</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/Convert_Assignment_Creation_Form_to_ReactJS&amp;diff=108173</id>
		<title>CSC/ECE 517 Spring 2017/Convert Assignment Creation Form to ReactJS</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/Convert_Assignment_Creation_Form_to_ReactJS&amp;diff=108173"/>
		<updated>2017-04-08T01:42:20Z</updated>

		<summary type="html">&lt;p&gt;Dguttik: /* Proposed Solution */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
This page is a part of CSC/ECE 517 Final Project for Spring 2017 to describe the changes made by us to the open source software project Expertiza. We are converting the assignment creation form to ReactJS. Following contains a brief introduction to Expertiza, ReactJS followed by the problems we are tackling, our strategy for the implementation and the test plan.&lt;br /&gt;
   &lt;br /&gt;
==Expertiza==&lt;br /&gt;
Expertiza is a Ruby on Rails based web application where students can submit and peer review learning objects such as codes, articles, websites etc., It is an open source software project funded by National Science Foundation(NSF). The instructor has the capability to create assignments with varied specifications such as topics, courses, team size, level of reviews etc., later review the submitted work and provide feedback. Students can enter their submissions and also review others' work. &lt;br /&gt;
&lt;br /&gt;
==ReactJS==&lt;br /&gt;
ReactJS is the javascript framework developed by Facebook to solve the specific problem, ''UI rendering''. It is developed to solve the problem with complex binding in MVC framework using only one-way data binding. It is used for dynamic reloading of the page. It helps in reloading only the particular component required using Virtual DOM, which makes it fast by temporarily storing DOM&lt;br /&gt;
&lt;br /&gt;
'''Reasons for using ReactJS'''&lt;br /&gt;
* It has every functionality that an user interface required&lt;br /&gt;
* Easy data binding.&lt;br /&gt;
* Only single component changes are stored/changed without reloading the complete page.&lt;br /&gt;
* Fast and efficient&lt;br /&gt;
* Easy to scale&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
The Assignment Create and Edit Form are multi level forms. It consists of multiple inputs  and user interactions. Many input types have dependency on interactions by the user. For example, on check for a particular checkbox, remaining form is displayed. Also, edit page is reloaded whenever a topic is added. The task is to convert this pages into ReactJS components.&lt;br /&gt;
&lt;br /&gt;
'''Tasks to be done'''&lt;br /&gt;
*Organize the form layout, create several mockups and validate them to your users&lt;br /&gt;
*Make the table in topics tab sortable by its header&lt;br /&gt;
*Allow users to edit / add topics in the table instead of loading a new page&lt;br /&gt;
*Implement the new layout and convert the javascript to a ReactJS component&lt;br /&gt;
*Validate user entries&lt;br /&gt;
*Fix tooltips that don’t work&lt;br /&gt;
&lt;br /&gt;
==Current Implementation==&lt;br /&gt;
===Assignment Creation===&lt;br /&gt;
The assignment creation form consists of multiple inputs and requires interactions from the user. The current implementation is mostly in HTML with data validations being done by JQuery. When a user wants to create a new assignment by clicking the new assignment button, a server request is generated and new view is rendered. Again, another server request to make database entry is generated once the user fills in the data and clicks on 'save' button and again a new view is rendered. This kind of implementation doesn't support dynamic view rendering hence lacks the fluidity in overall user experience that one would expect.&lt;br /&gt;
&lt;br /&gt;
[[File:Create1.JPG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Create2.JPG]]&lt;br /&gt;
&lt;br /&gt;
===Assignment Edition===&lt;br /&gt;
Similar to assignment creation page, edit page lacks the dynamic view rendering which makes the user experience cumbersome. Every time user wants to make changes to the assignment, a server request is generated and new view is rendered. The save button hit on completion will again generate another server request and render a new view.&lt;br /&gt;
&lt;br /&gt;
[[File:Edit.jpg]]&lt;br /&gt;
&lt;br /&gt;
=== Add/Delete topics in Assignment ===&lt;br /&gt;
In current implementation whenever a topic is added to the assignment, a request is sent to the server and user is redirected to a form in another page. Opon creation of topic user is rendered back to edit assignment page. This process involves lot of redirection. Now, the task is to avoid this redirection of pages and create a interactive React JS form for adding and editing topic.&lt;br /&gt;
&lt;br /&gt;
Currently this logic is implemented in new method in sign_up_controller.rb file and is invoked in the _add_topics.rb ruby injection file. With this action new.html.erb page is rendered. This should be avoided.&lt;br /&gt;
&lt;br /&gt;
'''Add topic:'''&lt;br /&gt;
&lt;br /&gt;
[[File:Add_topic_form.PNG]]&lt;br /&gt;
&lt;br /&gt;
Similar is the case for editing a topic. For editing a topic user is rendered to a form in edit page and again redirected to edit assignment page.&lt;br /&gt;
&lt;br /&gt;
'''Edit Topic:'''&lt;br /&gt;
&lt;br /&gt;
[[File:Edit_topic_form.PNG]]&lt;br /&gt;
&lt;br /&gt;
===Make the table in topics tab sortable by its header===&lt;br /&gt;
Currently after creating an assignment, we can add topics related to the assignment. The &amp;quot;Topics&amp;quot; tab in the edit assignment form shows the list of topics that are added to the assignment. The picture below shows the current page for displaying the list of topics of an assignment. The list is not sortable. The task is to make it sortable using ReactJS by topic id, topic name, Num. of slots, Available slots, Num. on waitlist columns as sorting on remaining columns doesn't give any meaningful display.&lt;br /&gt;
&lt;br /&gt;
[[File:topics_tab_assignment.png]]&lt;br /&gt;
&lt;br /&gt;
===Validating user entries===&lt;br /&gt;
The entries for the assignment creation are not according to any restrictions, that can add problem to database maintainence like sorting the entries, comparing them, retrieving. There are many such problem causing situations in the new assignment form, such as &lt;br /&gt;
* User can add the number as new assignment name or he can give only special characters for it like &amp;quot;$$$$&amp;quot;.&lt;br /&gt;
* Neglecting check boxes may lead to confusion with deadlines.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Userentries.png]]&lt;br /&gt;
&lt;br /&gt;
==Proposed Solution==&lt;br /&gt;
===Assignment Creation===&lt;br /&gt;
The new implementation will use ReactJS to generate a drop-down window on clicking on the New Assignment button (private/public) , providing same features as before. Database entry is made on submitting the form and the form is closed.&lt;br /&gt;
&lt;br /&gt;
====Files to be modified====&lt;br /&gt;
*apps/assets/javascripts/tree_display.jsx.erb&lt;br /&gt;
*apps/controllers/assignments_controller.rb&lt;br /&gt;
*apps/controllers/tree_display_controller.rb&lt;br /&gt;
&lt;br /&gt;
===Assignment Edition===&lt;br /&gt;
Similar to assignment creation, in the new implementation, using ReactJS, when the edit assignment button is clicked, instead of making a server request and rendering a new view, a drop down window appears and saving the details will make the database entry.Since all the processing is done on the client side there will be decrease in the number of server requests.&lt;br /&gt;
&lt;br /&gt;
====Files to be modified====&lt;br /&gt;
*apps/views/tree_display/list.html.erb&lt;br /&gt;
*apps/views/assignments/edit.html.erb&lt;br /&gt;
*apps/views/assignments/edit/_general.html.erb&lt;br /&gt;
&lt;br /&gt;
=== Addition of topics ===&lt;br /&gt;
* An interactive React JS component should be created in /assignments/edit page and should  show a form in that page itself when New Topic is &lt;br /&gt;
  clicked.&lt;br /&gt;
* Delete/avoid usage of sign_up_sheet/new page.&lt;br /&gt;
* Implement an React JS functional component to handle creation of topic and saving it to database.&lt;br /&gt;
&lt;br /&gt;
=== Editing topic ===&lt;br /&gt;
*&lt;br /&gt;
&lt;br /&gt;
===Make the table in topics tab sortable by its header===&lt;br /&gt;
Following sub-tasks identified to implement sortable feature for topics table.&lt;br /&gt;
* Modify sign_up_sheet/_table_header.html.erb partial to change the table header fields to sortable type.&lt;br /&gt;
* Add sort functionality using ReactJS for each column that is meaningful to be sorted.&lt;br /&gt;
&lt;br /&gt;
===Validating user entries===&lt;br /&gt;
The following tasks are to be implemented to achieve users validation,&lt;br /&gt;
* Add the regular expression validation to avoid special characters in the names of assignment or directories.&lt;br /&gt;
* Create alert messages to notify user if any important check boxes are missed.&lt;br /&gt;
* Create validation for edge cases like giving empty values.&lt;br /&gt;
&lt;br /&gt;
===Files to be modified===&lt;br /&gt;
As, the project needs to be implemented in reactJS, which helps in reducing the complexing binding in MVC framework, only changing the javascript file can help to achieve this without changing model,&lt;br /&gt;
* app/assets/javascripts/tree_display.jsx.erb&lt;br /&gt;
&lt;br /&gt;
==Test Plan==&lt;br /&gt;
Rails development is the Test Driven development, which helps in ensuring the implementation of all proposed implementations. We will be writing all the implementations proposed as tests that will eventually be red in rspec and try to make them green by adding to the development part.&lt;br /&gt;
&lt;br /&gt;
For now the manual testing of these current implementations can help in testing the functionality from UI.&lt;br /&gt;
===Manual Testing===&lt;br /&gt;
Steps to manually test the feature are as follows: &lt;br /&gt;
&lt;br /&gt;
====Assignment Creation====&lt;br /&gt;
*Log in as an instructor ''(user-name:instructor6 password:password)''&lt;br /&gt;
*Go to Manage-&amp;gt;Assignments and click on the Assignments tab.&lt;br /&gt;
*Click on the 'New public assignment' or 'New private assignment' button&lt;br /&gt;
*Verify if drop-down window is displayed.&lt;br /&gt;
*Make valid entries for the available fields and click on 'create'.&lt;br /&gt;
*Verify if new assignment is successfully created.&lt;br /&gt;
&lt;br /&gt;
====Assignment Creation====&lt;br /&gt;
*Log in as an instructor ''(user-name:instructor6 password:password)''&lt;br /&gt;
*Go to Manage-&amp;gt;Assignments and click on the Assignments tab.&lt;br /&gt;
*Click on the Edit button for any of the available assignment.&lt;br /&gt;
*Verify if drop-down window is displayed.&lt;br /&gt;
*Make changes and click on 'save'.&lt;br /&gt;
*Verify if the changes made are successfully updated.&lt;br /&gt;
 &lt;br /&gt;
====Make the table in topics tab sortable by its header====&lt;br /&gt;
* Create an assignment&lt;br /&gt;
* Add 2 topics to the assignment&lt;br /&gt;
* Click sort on Topic ID and check if they are sorted&lt;br /&gt;
* Click sort on Topic title and check if they are sorted&lt;br /&gt;
* Similarly test using other columns&lt;br /&gt;
&lt;br /&gt;
====Validating user entries====&lt;br /&gt;
*Log in as an instructor ''(user-name:instructor6 password:password)''&lt;br /&gt;
*Go to Manage-&amp;gt;Assignments and click on the Assignments tab.&lt;br /&gt;
*Click on the 'New public assignment' or 'New private assignment' button&lt;br /&gt;
*Try adding the assignment using the weird names, with special symbols, ignoring check boxes&lt;br /&gt;
*Verify if the assignment is shown in the table.&lt;br /&gt;
&lt;br /&gt;
===Automation testing===&lt;br /&gt;
The above tests all will be automated using rspec.&lt;br /&gt;
&lt;br /&gt;
==Future Work==&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
#''http://railscasts.com/episodes/228-sortable-table-columns sortable-columns''&lt;br /&gt;
#''https://www.airpair.com/reactjs/posts/reactjs-a-guide-for-rails-developers adding-reactjs''&lt;/div&gt;</summary>
		<author><name>Dguttik</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/Convert_Assignment_Creation_Form_to_ReactJS&amp;diff=108171</id>
		<title>CSC/ECE 517 Spring 2017/Convert Assignment Creation Form to ReactJS</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/Convert_Assignment_Creation_Form_to_ReactJS&amp;diff=108171"/>
		<updated>2017-04-08T01:34:54Z</updated>

		<summary type="html">&lt;p&gt;Dguttik: /* Add/Delete topics in Assignment */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
This page is a part of CSC/ECE 517 Final Project for Spring 2017 to describe the changes made by us to the open source software project Expertiza. We are converting the assignment creation form to ReactJS. Following contains a brief introduction to Expertiza, ReactJS followed by the problems we are tackling, our strategy for the implementation and the test plan.&lt;br /&gt;
   &lt;br /&gt;
==Expertiza==&lt;br /&gt;
Expertiza is a Ruby on Rails based web application where students can submit and peer review learning objects such as codes, articles, websites etc., It is an open source software project funded by National Science Foundation(NSF). The instructor has the capability to create assignments with varied specifications such as topics, courses, team size, level of reviews etc., later review the submitted work and provide feedback. Students can enter their submissions and also review others' work. &lt;br /&gt;
&lt;br /&gt;
==ReactJS==&lt;br /&gt;
ReactJS is the javascript framework developed by Facebook to solve the specific problem, ''UI rendering''. It is developed to solve the problem with complex binding in MVC framework using only one-way data binding. It is used for dynamic reloading of the page. It helps in reloading only the particular component required using Virtual DOM, which makes it fast by temporarily storing DOM&lt;br /&gt;
&lt;br /&gt;
'''Reasons for using ReactJS'''&lt;br /&gt;
* It has every functionality that an user interface required&lt;br /&gt;
* Easy data binding.&lt;br /&gt;
* Only single component changes are stored/changed without reloading the complete page.&lt;br /&gt;
* Fast and efficient&lt;br /&gt;
* Easy to scale&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
The Assignment Create and Edit Form are multi level forms. It consists of multiple inputs  and user interactions. Many input types have dependency on interactions by the user. For example, on check for a particular checkbox, remaining form is displayed. Also, edit page is reloaded whenever a topic is added. The task is to convert this pages into ReactJS components.&lt;br /&gt;
&lt;br /&gt;
'''Tasks to be done'''&lt;br /&gt;
*Organize the form layout, create several mockups and validate them to your users&lt;br /&gt;
*Make the table in topics tab sortable by its header&lt;br /&gt;
*Allow users to edit / add topics in the table instead of loading a new page&lt;br /&gt;
*Implement the new layout and convert the javascript to a ReactJS component&lt;br /&gt;
*Validate user entries&lt;br /&gt;
*Fix tooltips that don’t work&lt;br /&gt;
&lt;br /&gt;
==Current Implementation==&lt;br /&gt;
===Assignment Creation===&lt;br /&gt;
The assignment creation form consists of multiple inputs and requires interactions from the user. The current implementation is mostly in HTML with data validations being done by JQuery. When a user wants to create a new assignment by clicking the new assignment button, a server request is generated and new view is rendered. Again, another server request to make database entry is generated once the user fills in the data and clicks on 'save' button and again a new view is rendered. This kind of implementation doesn't support dynamic view rendering hence lacks the fluidity in overall user experience that one would expect.&lt;br /&gt;
&lt;br /&gt;
[[File:Create1.JPG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Create2.JPG]]&lt;br /&gt;
&lt;br /&gt;
===Assignment Edition===&lt;br /&gt;
Similar to assignment creation page, edit page lacks the dynamic view rendering which makes the user experience cumbersome. Every time user wants to make changes to the assignment, a server request is generated and new view is rendered. The save button hit on completion will again generate another server request and render a new view.&lt;br /&gt;
&lt;br /&gt;
[[File:Edit.jpg]]&lt;br /&gt;
&lt;br /&gt;
=== Add/Delete topics in Assignment ===&lt;br /&gt;
In current implementation whenever a topic is added to the assignment, a request is sent to the server and user is redirected to a form in another page. Opon creation of topic user is rendered back to edit assignment page. This process involves lot of redirection. Now, the task is to avoid this redirection of pages and create a interactive React JS form for adding and editing topic.&lt;br /&gt;
&lt;br /&gt;
Currently this logic is implemented in new method in sign_up_controller.rb file and is invoked in the _add_topics.rb ruby injection file. With this action new.html.erb page is rendered. This should be avoided.&lt;br /&gt;
&lt;br /&gt;
'''Add topic:'''&lt;br /&gt;
&lt;br /&gt;
[[File:Add_topic_form.PNG]]&lt;br /&gt;
&lt;br /&gt;
Similar is the case for editing a topic. For editing a topic user is rendered to a form in edit page and again redirected to edit assignment page.&lt;br /&gt;
&lt;br /&gt;
'''Edit Topic:'''&lt;br /&gt;
&lt;br /&gt;
[[File:Edit_topic_form.PNG]]&lt;br /&gt;
&lt;br /&gt;
===Make the table in topics tab sortable by its header===&lt;br /&gt;
Currently after creating an assignment, we can add topics related to the assignment. The &amp;quot;Topics&amp;quot; tab in the edit assignment form shows the list of topics that are added to the assignment. The picture below shows the current page for displaying the list of topics of an assignment. The list is not sortable. The task is to make it sortable using ReactJS by topic id, topic name, Num. of slots, Available slots, Num. on waitlist columns as sorting on remaining columns doesn't give any meaningful display.&lt;br /&gt;
&lt;br /&gt;
[[File:topics_tab_assignment.png]]&lt;br /&gt;
&lt;br /&gt;
===Validating user entries===&lt;br /&gt;
The entries for the assignment creation are not according to any restrictions, that can add problem to database maintainence like sorting the entries, comparing them, retrieving. There are many such problem causing situations in the new assignment form, such as &lt;br /&gt;
* User can add the number as new assignment name or he can give only special characters for it like &amp;quot;$$$$&amp;quot;.&lt;br /&gt;
* Neglecting check boxes may lead to confusion with deadlines.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Userentries.png]]&lt;br /&gt;
&lt;br /&gt;
==Proposed Solution==&lt;br /&gt;
===Assignment Creation===&lt;br /&gt;
The new implementation will use ReactJS to generate a drop-down window on clicking on the New Assignment button (private/public) , providing same features as before. Database entry is made on submitting the form and the form is closed.&lt;br /&gt;
&lt;br /&gt;
====Files to be modified====&lt;br /&gt;
*apps/assets/javascripts/tree_display.jsx.erb&lt;br /&gt;
*apps/controllers/assignments_controller.rb&lt;br /&gt;
*apps/controllers/tree_display_controller.rb&lt;br /&gt;
&lt;br /&gt;
===Assignment Edition===&lt;br /&gt;
Similar to assignment creation, in the new implementation, using ReactJS, when the edit assignment button is clicked, instead of making a server request and rendering a new view, a drop down window appears and saving the details will make the database entry.Since all the processing is done on the client side there will be decrease in the number of server requests.&lt;br /&gt;
&lt;br /&gt;
====Files to be modified====&lt;br /&gt;
*apps/views/tree_display/list.html.erb&lt;br /&gt;
*apps/views/assignments/edit.html.erb&lt;br /&gt;
*apps/views/assignments/edit/_general.html.erb&lt;br /&gt;
&lt;br /&gt;
=== Addition of topics ===&lt;br /&gt;
&lt;br /&gt;
===Make the table in topics tab sortable by its header===&lt;br /&gt;
Following sub-tasks identified to implement sortable feature for topics table.&lt;br /&gt;
* Modify sign_up_sheet/_table_header.html.erb partial to change the table header fields to sortable type.&lt;br /&gt;
* Add sort functionality using ReactJS for each column that is meaningful to be sorted.&lt;br /&gt;
&lt;br /&gt;
===Validating user entries===&lt;br /&gt;
The following tasks are to be implemented to achieve users validation,&lt;br /&gt;
* Add the regular expression validation to avoid special characters in the names of assignment or directories.&lt;br /&gt;
* Create alert messages to notify user if any important check boxes are missed.&lt;br /&gt;
* Create validation for edge cases like giving empty values.&lt;br /&gt;
&lt;br /&gt;
===Files to be modified===&lt;br /&gt;
As, the project needs to be implemented in reactJS, which helps in reducing the complexing binding in MVC framework, only changing the javascript file can help to achieve this without changing model,&lt;br /&gt;
* app/assets/javascripts/tree_display.jsx.erb&lt;br /&gt;
&lt;br /&gt;
==Test Plan==&lt;br /&gt;
Rails development is the Test Driven development, which helps in ensuring the implementation of all proposed implementations. We will be writing all the implementations proposed as tests that will eventually be red in rspec and try to make them green by adding to the development part.&lt;br /&gt;
&lt;br /&gt;
For now the manual testing of these current implementations can help in testing the functionality from UI.&lt;br /&gt;
===Manual Testing===&lt;br /&gt;
Steps to manually test the feature are as follows: &lt;br /&gt;
&lt;br /&gt;
====Assignment Creation====&lt;br /&gt;
*Log in as an instructor ''(user-name:instructor6 password:password)''&lt;br /&gt;
*Go to Manage-&amp;gt;Assignments and click on the Assignments tab.&lt;br /&gt;
*Click on the 'New public assignment' or 'New private assignment' button&lt;br /&gt;
*Verify if drop-down window is displayed.&lt;br /&gt;
*Make valid entries for the available fields and click on 'create'.&lt;br /&gt;
*Verify if new assignment is successfully created.&lt;br /&gt;
&lt;br /&gt;
====Assignment Creation====&lt;br /&gt;
*Log in as an instructor ''(user-name:instructor6 password:password)''&lt;br /&gt;
*Go to Manage-&amp;gt;Assignments and click on the Assignments tab.&lt;br /&gt;
*Click on the Edit button for any of the available assignment.&lt;br /&gt;
*Verify if drop-down window is displayed.&lt;br /&gt;
*Make changes and click on 'save'.&lt;br /&gt;
*Verify if the changes made are successfully updated.&lt;br /&gt;
 &lt;br /&gt;
====Make the table in topics tab sortable by its header====&lt;br /&gt;
* Create an assignment&lt;br /&gt;
* Add 2 topics to the assignment&lt;br /&gt;
* Click sort on Topic ID and check if they are sorted&lt;br /&gt;
* Click sort on Topic title and check if they are sorted&lt;br /&gt;
* Similarly test using other columns&lt;br /&gt;
&lt;br /&gt;
====Validating user entries====&lt;br /&gt;
*Log in as an instructor ''(user-name:instructor6 password:password)''&lt;br /&gt;
*Go to Manage-&amp;gt;Assignments and click on the Assignments tab.&lt;br /&gt;
*Click on the 'New public assignment' or 'New private assignment' button&lt;br /&gt;
*Try adding the assignment using the weird names, with special symbols, ignoring check boxes&lt;br /&gt;
*Verify if the assignment is shown in the table.&lt;br /&gt;
&lt;br /&gt;
===Automation testing===&lt;br /&gt;
The above tests all will be automated using rspec.&lt;br /&gt;
&lt;br /&gt;
==Future Work==&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
#''http://railscasts.com/episodes/228-sortable-table-columns sortable-columns''&lt;br /&gt;
#''https://www.airpair.com/reactjs/posts/reactjs-a-guide-for-rails-developers adding-reactjs''&lt;/div&gt;</summary>
		<author><name>Dguttik</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/Convert_Assignment_Creation_Form_to_ReactJS&amp;diff=108061</id>
		<title>CSC/ECE 517 Spring 2017/Convert Assignment Creation Form to ReactJS</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/Convert_Assignment_Creation_Form_to_ReactJS&amp;diff=108061"/>
		<updated>2017-04-07T19:36:17Z</updated>

		<summary type="html">&lt;p&gt;Dguttik: /* Proposed Solution */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
This page is a part of CSC/ECE 517 Final Project for Spring 2017 to describe the changes made by us to the open source software project Expertiza. We are converting the assignment creation form to ReactJS. Following contains a brief introduction to Expertiza, ReactJS followed by the problems we are tackling, our strategy for the implementation and the test plan.&lt;br /&gt;
   &lt;br /&gt;
==Expertiza==&lt;br /&gt;
Expertiza is a Ruby on Rails based web application where students can submit and peer review learning objects such as codes, articles, websites etc., It is an open source software project funded by National Science Foundation(NSF). The instructor has the capability to create assignments with varied specifications such as topics, courses, team size, level of reviews etc., later review the submitted work and provide feedback. Students can enter their submissions and also review others' work. &lt;br /&gt;
&lt;br /&gt;
==ReactJS==&lt;br /&gt;
ReactJS is the javascript framework developed by Facebook to solve the specific problem, ''UI rendering''. It is developed to solve the problem with complex binding in MVC framework using only one-way data binding. It is used for dynamic reloading of the page. It helps in reloading only the particular component required using Virtual DOM, which makes it fast by temporarily storing DOM&lt;br /&gt;
&lt;br /&gt;
'''Reasons for using ReactJS'''&lt;br /&gt;
* It has every functionality that an user interface required&lt;br /&gt;
* Easy data binding.&lt;br /&gt;
* Only single component changes are stored/changed without reloading the complete page.&lt;br /&gt;
* Fast and efficient&lt;br /&gt;
* Easy to scale&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
The Assignment Create and Edit Form are multi level forms. It consists of multiple inputs  and user interactions. Many input types have dependency on interactions by the user. For example, on check for a particular checkbox, remaining form is displayed. Also, edit page is reloaded whenever a topic is added. The task is to convert this pages into ReactJS components.&lt;br /&gt;
&lt;br /&gt;
'''Tasks to be done'''&lt;br /&gt;
*Organize the form layout, create several mockups and validate them to your users&lt;br /&gt;
*Make the table in topics tab sortable by its header&lt;br /&gt;
*Allow users to edit / add topics in the table instead of loading a new page&lt;br /&gt;
*Implement the new layout and convert the javascript to a ReactJS component&lt;br /&gt;
*Validate user entries&lt;br /&gt;
*Fix tooltips that don’t work&lt;br /&gt;
&lt;br /&gt;
==Current Implementation==&lt;br /&gt;
===Assignment Creation===&lt;br /&gt;
The assignment creation form consists of multiple inputs and requires interactions from the user. The current implementation is mostly in HTML with data validations being done by JQuery. When a user wants to create a new assignment by clicking the new assignment button, a server request is generated and new view is rendered. Again, another server request to make database entry is generated once the user fills in the data and clicks on 'save' button and again a new view is rendered. This kind of implementation doesn't support dynamic view rendering hence lacks the fluidity in overall user experience that one would expect.&lt;br /&gt;
&lt;br /&gt;
[[File:Create1.JPG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Create2.JPG]]&lt;br /&gt;
&lt;br /&gt;
===Assignment Edition===&lt;br /&gt;
Similar to assignment creation page, edit page lacks the dynamic view rendering which makes the user experience cumbersome. Every time user wants to make changes to the assignment, a server request is generated and new view is rendered. The save button hit on completion will again generate another server request and render a new view.&lt;br /&gt;
&lt;br /&gt;
[[File:Edit.jpg]]&lt;br /&gt;
&lt;br /&gt;
=== Add/Delete topics in Assignment ===&lt;br /&gt;
In current implementation whenever a topic is added to the assignment, a request is sent to the server and user is redirected to a form in another page. Opon creation of topic user is rendered back to edit assignment page. This process involves lot of redirection. Now, the task is to avoid this redirection of pages and create a interactive React JS form for adding and editing topic.&lt;br /&gt;
&lt;br /&gt;
'''Add topic:'''&lt;br /&gt;
&lt;br /&gt;
[[File:Add_topic_form.PNG]]&lt;br /&gt;
&lt;br /&gt;
Similar is the case for editing a topic. For editing a topic user is rendered to a form in edit page and again redirected to edit assignment page.&lt;br /&gt;
&lt;br /&gt;
'''Edit Topic:'''&lt;br /&gt;
&lt;br /&gt;
[[File:Edit_topic_form.PNG]]&lt;br /&gt;
&lt;br /&gt;
===Make the table in topics tab sortable by its header===&lt;br /&gt;
Currently after creating an assignment, we can add topics related to the assignment. The &amp;quot;Topics&amp;quot; tab in the edit assignment form shows the list of topics that are added to the assignment. The picture below shows the current page for displaying the list of topics of an assignment. The list is not sortable. The task is to make it sortable using ReactJS by topic id, topic name, Num. of slots, Available slots, Num. on waitlist columns as sorting on remaining columns doesn't give any meaningful display.&lt;br /&gt;
&lt;br /&gt;
[[File:topics_tab.png]]&lt;br /&gt;
&lt;br /&gt;
===Validating user entries===&lt;br /&gt;
The entries for the assignment creation are not according to any restrictions, that can add problem to database maintainence like sorting the entries, comparing them, retrieving. There are many such problem causing situations in the new assignment form, such as &lt;br /&gt;
* User can add the number as new assignment name or he can give only special characters for it like &amp;quot;$$$$&amp;quot;.&lt;br /&gt;
* Neglecting check boxes may lead to confusion with deadlines.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Create2.JPG]]&lt;br /&gt;
&lt;br /&gt;
==Proposed Solution==&lt;br /&gt;
===Assignment Creation===&lt;br /&gt;
The new implementation will use ReactJS to generate a drop-down window on clicking on the New Assignment button (private/public) , providing same features as before. Database entry is made on submitting the form and the form is closed.&lt;br /&gt;
&lt;br /&gt;
====Files to be modified====&lt;br /&gt;
*apps/assets/javascripts/tree_display.jsx.erb&lt;br /&gt;
*apps/controllers/assignments_controller.rb&lt;br /&gt;
*apps/controllers/tree_display_controller.rb&lt;br /&gt;
&lt;br /&gt;
===Assignment Edition===&lt;br /&gt;
Similar to assignment creation, in the new implementation, using ReactJS, when the edit assignment button is clicked, instead of making a server request and rendering a new view, a drop down window appears and saving the details will make the database entry.Since all the processing is done on the client side there will be decrease in the number of server requests.&lt;br /&gt;
&lt;br /&gt;
====Files to be modified====&lt;br /&gt;
*apps/views/tree_display/list.html.erb&lt;br /&gt;
*apps/views/assignments/edit.html.erb&lt;br /&gt;
*apps/views/assignments/edit/_general.html.erb&lt;br /&gt;
&lt;br /&gt;
=== Addition of topics ===&lt;br /&gt;
&lt;br /&gt;
===Make the table in topics tab sortable by its header===&lt;br /&gt;
Following sub-tasks identified to implement sortable feature for topics table.&lt;br /&gt;
* Modify sign_up_sheet/_table_header.html.erb partial to change the table header fields to sortable type.&lt;br /&gt;
* Add sort functionality using ReactJS for each column that is meaningful to be sorted.&lt;br /&gt;
&lt;br /&gt;
===Validating user entries===&lt;br /&gt;
The following tasks are to be implemented to achieve users validation,&lt;br /&gt;
* Add the regular expression validation to avoid special characters in the names of assignment or directories.&lt;br /&gt;
* Create alert messages to notify user if any important check boxes are missed.&lt;br /&gt;
* Create validation for edge cases like giving empty values.&lt;br /&gt;
&lt;br /&gt;
===Files to be modified===&lt;br /&gt;
As, the project needs to be implemented in reactJS, which helps in reducing the complexing binding in MVC framework, only changing the javascript file can help to achieve this without changing model,&lt;br /&gt;
* app/assets/javascripts/tree_display.jsx.erb&lt;br /&gt;
&lt;br /&gt;
==Test Plan==&lt;br /&gt;
Rails development is the Test Driven development, which helps in ensuring the implementation of all proposed implementations. We will be writing all the implementations proposed as tests that will eventually be red and try to make them green by adding to the development part.&lt;br /&gt;
&lt;br /&gt;
For now the manual testing of these current implementations can help in testing the functionality from UI.&lt;br /&gt;
===Manual Testing===&lt;br /&gt;
Steps to manually test the feature are as follows: &lt;br /&gt;
&lt;br /&gt;
====Assignment Creation====&lt;br /&gt;
*Log in as an instructor ''(user-name:instructor6 password:password)''&lt;br /&gt;
*Go to Manage-&amp;gt;Assignments and click on the Assignments tab.&lt;br /&gt;
*Click on the 'New public assignment' or 'New private assignment' button&lt;br /&gt;
*Verify if drop-down window is displayed.&lt;br /&gt;
*Make valid entries for the available fields and click on 'create'.&lt;br /&gt;
*Verify if new assignment is successfully created.&lt;br /&gt;
&lt;br /&gt;
====Assignment Creation====&lt;br /&gt;
*Log in as an instructor ''(user-name:instructor6 password:password)''&lt;br /&gt;
*Go to Manage-&amp;gt;Assignments and click on the Assignments tab.&lt;br /&gt;
*Click on the Edit button for any of the available assignment.&lt;br /&gt;
*Verify if drop-down window is displayed.&lt;br /&gt;
*Make changes and click on 'save'.&lt;br /&gt;
*Verify if the changes made are successfully updated.&lt;br /&gt;
 &lt;br /&gt;
====Make the table in topics tab sortable by its header====&lt;br /&gt;
* Create an assignment&lt;br /&gt;
* Add 2 topics to the assignment&lt;br /&gt;
* Click sort on Topic ID and check if they are sorted&lt;br /&gt;
* Click sort on Topic title and check if they are sorted&lt;br /&gt;
* Similarly test using other columns&lt;br /&gt;
&lt;br /&gt;
====Validating user entries====&lt;br /&gt;
*Log in as an instructor ''(user-name:instructor6 password:password)''&lt;br /&gt;
*Go to Manage-&amp;gt;Assignments and click on the Assignments tab.&lt;br /&gt;
*Click on the 'New public assignment' or 'New private assignment' button&lt;br /&gt;
*Try adding the assignment using the weird names, with special symbols, ignoring check boxes&lt;br /&gt;
*Verify if the assignment is shown in the table.&lt;br /&gt;
&lt;br /&gt;
==Future Work==&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
#''http://railscasts.com/episodes/228-sortable-table-columns sortable-columns''&lt;br /&gt;
#''https://www.airpair.com/reactjs/posts/reactjs-a-guide-for-rails-developers adding-reactjs''&lt;/div&gt;</summary>
		<author><name>Dguttik</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/Convert_Assignment_Creation_Form_to_ReactJS&amp;diff=108059</id>
		<title>CSC/ECE 517 Spring 2017/Convert Assignment Creation Form to ReactJS</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/Convert_Assignment_Creation_Form_to_ReactJS&amp;diff=108059"/>
		<updated>2017-04-07T19:32:06Z</updated>

		<summary type="html">&lt;p&gt;Dguttik: /* Add/Delete topics in Assignment */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
This page is a part of CSC/ECE 517 Final Project for Spring 2017 to describe the changes made by us to the open source software project Expertiza. We are converting the assignment creation form to ReactJS. Following contains a brief introduction to Expertiza, ReactJS followed by the problems we are tackling, our strategy for the implementation and the test plan.&lt;br /&gt;
   &lt;br /&gt;
==Expertiza==&lt;br /&gt;
Expertiza is a Ruby on Rails based web application where students can submit and peer review learning objects such as codes, articles, websites etc., It is an open source software project funded by National Science Foundation(NSF). The instructor has the capability to create assignments with varied specifications such as topics, courses, team size, level of reviews etc., later review the submitted work and provide feedback. Students can enter their submissions and also review others' work. &lt;br /&gt;
&lt;br /&gt;
==ReactJS==&lt;br /&gt;
ReactJS is the javascript framework developed by Facebook to solve the specific problem, ''UI rendering''. It is developed to solve the problem with complex binding in MVC framework using only one-way data binding. It is used for dynamic reloading of the page. It helps in reloading only the particular component required using Virtual DOM, which makes it fast by temporarily storing DOM&lt;br /&gt;
&lt;br /&gt;
'''Reasons for using ReactJS'''&lt;br /&gt;
* It has every functionality that an user interface required&lt;br /&gt;
* Easy data binding.&lt;br /&gt;
* Only single component changes are stored/changed without reloading the complete page.&lt;br /&gt;
* Fast and efficient&lt;br /&gt;
* Easy to scale&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
The Assignment Create and Edit Form are multi level forms. It consists of multiple inputs  and user interactions. Many input types have dependency on interactions by the user. For example, on check for a particular checkbox, remaining form is displayed. Also, edit page is reloaded whenever a topic is added. The task is to convert this pages into ReactJS components.&lt;br /&gt;
&lt;br /&gt;
'''Tasks to be done'''&lt;br /&gt;
*Organize the form layout, create several mockups and validate them to your users&lt;br /&gt;
*Make the table in topics tab sortable by its header&lt;br /&gt;
*Allow users to edit / add topics in the table instead of loading a new page&lt;br /&gt;
*Implement the new layout and convert the javascript to a ReactJS component&lt;br /&gt;
*Validate user entries&lt;br /&gt;
*Fix tooltips that don’t work&lt;br /&gt;
&lt;br /&gt;
==Current Implementation==&lt;br /&gt;
===Assignment Creation===&lt;br /&gt;
The assignment creation form consists of multiple inputs and requires interactions from the user. The current implementation is mostly in HTML with data validations being done by JQuery. When a user wants to create a new assignment by clicking the new assignment button, a server request is generated and new view is rendered. Again, another server request to make database entry is generated once the user fills in the data and clicks on 'save' button and again a new view is rendered. This kind of implementation doesn't support dynamic view rendering hence lacks the fluidity in overall user experience that one would expect.&lt;br /&gt;
&lt;br /&gt;
[[File:Create1.JPG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Create2.JPG]]&lt;br /&gt;
&lt;br /&gt;
===Assignment Edition===&lt;br /&gt;
Similar to assignment creation page, edit page lacks the dynamic view rendering which makes the user experience cumbersome. Every time user wants to make changes to the assignment, a server request is generated and new view is rendered. The save button hit on completion will again generate another server request and render a new view.&lt;br /&gt;
&lt;br /&gt;
[[File:Edit.jpg]]&lt;br /&gt;
&lt;br /&gt;
=== Add/Delete topics in Assignment ===&lt;br /&gt;
In current implementation whenever a topic is added to the assignment, a request is sent to the server and user is redirected to a form in another page. Opon creation of topic user is rendered back to edit assignment page. This process involves lot of redirection. Now, the task is to avoid this redirection of pages and create a interactive React JS form for adding and editing topic.&lt;br /&gt;
&lt;br /&gt;
'''Add topic:'''&lt;br /&gt;
&lt;br /&gt;
[[File:Add_topic_form.PNG]]&lt;br /&gt;
&lt;br /&gt;
Similar is the case for editing a topic. For editing a topic user is rendered to a form in edit page and again redirected to edit assignment page.&lt;br /&gt;
&lt;br /&gt;
'''Edit Topic:'''&lt;br /&gt;
&lt;br /&gt;
[[File:Edit_topic_form.PNG]]&lt;br /&gt;
&lt;br /&gt;
===Make the table in topics tab sortable by its header===&lt;br /&gt;
Currently after creating an assignment, we can add topics related to the assignment. The &amp;quot;Topics&amp;quot; tab in the edit assignment form shows the list of topics that are added to the assignment. The picture below shows the current page for displaying the list of topics of an assignment. The list is not sortable. The task is to make it sortable using ReactJS by topic id, topic name, Num. of slots, Available slots, Num. on waitlist columns as sorting on remaining columns doesn't give any meaningful display.&lt;br /&gt;
&lt;br /&gt;
[[File:topics_tab.png]]&lt;br /&gt;
&lt;br /&gt;
===Validating user entries===&lt;br /&gt;
The entries for the assignment creation are not according to any restrictions, that can add problem to database maintainence like sorting the entries, comparing them, retrieving. There are many such problem causing situations in the new assignment form, such as &lt;br /&gt;
* User can add the number as new assignment name or he can give only special characters for it like &amp;quot;$$$$&amp;quot;.&lt;br /&gt;
* Neglecting check boxes may lead to confusion with deadlines.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Create2.JPG]]&lt;br /&gt;
&lt;br /&gt;
==Proposed Solution==&lt;br /&gt;
===Assignment Creation===&lt;br /&gt;
The new implementation will use ReactJS to generate a drop-down window on clicking on the New Assignment button (private/public) , providing same features as before. Database entry is made on submitting the form and the form is closed.&lt;br /&gt;
&lt;br /&gt;
====Files to be modified====&lt;br /&gt;
*apps/assets/javascripts/tree_display.jsx.erb&lt;br /&gt;
*apps/controllers/assignments_controller.rb&lt;br /&gt;
*apps/controllers/tree_display_controller.rb&lt;br /&gt;
&lt;br /&gt;
===Assignment Edition===&lt;br /&gt;
Similar to assignment creation, in the new implementation, using ReactJS, when the edit assignment button is clicked, instead of making a server request and rendering a new view, a drop down window appears and saving the details will make the database entry.Since all the processing is done on the client side there will be decrease in the number of server requests.&lt;br /&gt;
&lt;br /&gt;
====Files to be modified====&lt;br /&gt;
*apps/views/tree_display/list.html.erb&lt;br /&gt;
*apps/views/assignments/edit.html.erb&lt;br /&gt;
*apps/views/assignments/edit/_general.html.erb&lt;br /&gt;
&lt;br /&gt;
===Make the table in topics tab sortable by its header===&lt;br /&gt;
Following sub-tasks identified to implement sortable feature for topics table.&lt;br /&gt;
* Modify sign_up_sheet/_table_header.html.erb partial to change the table header fields to sortable type.&lt;br /&gt;
* Add sort functionality using ReactJS for each column that is meaningful to be sorted.&lt;br /&gt;
&lt;br /&gt;
===Validating user entries===&lt;br /&gt;
The following tasks are to be implemented to achieve users validation,&lt;br /&gt;
* Add the regular expression validation to avoid special characters in the names of assignment or directories.&lt;br /&gt;
* Create alert messages to notify user if any important check boxes are missed.&lt;br /&gt;
* Create validation for edge cases like giving empty values.&lt;br /&gt;
&lt;br /&gt;
===Files to be modified===&lt;br /&gt;
As, the project needs to be implemented in reactJS, which helps in reducing the complexing binding in MVC framework, only changing the javascript file can help to achieve this without changing model,&lt;br /&gt;
* app/assets/javascripts/tree_display.jsx.erb&lt;br /&gt;
&lt;br /&gt;
==Test Plan==&lt;br /&gt;
Rails development is the Test Driven development, which helps in ensuring the implementation of all proposed implementations. We will be writing all the implementations proposed as tests that will eventually be red and try to make them green by adding to the development part.&lt;br /&gt;
&lt;br /&gt;
For now the manual testing of these current implementations can help in testing the functionality from UI.&lt;br /&gt;
===Manual Testing===&lt;br /&gt;
Steps to manually test the feature are as follows: &lt;br /&gt;
&lt;br /&gt;
====Assignment Creation====&lt;br /&gt;
*Log in as an instructor ''(user-name:instructor6 password:password)''&lt;br /&gt;
*Go to Manage-&amp;gt;Assignments and click on the Assignments tab.&lt;br /&gt;
*Click on the 'New public assignment' or 'New private assignment' button&lt;br /&gt;
*Verify if drop-down window is displayed.&lt;br /&gt;
*Make valid entries for the available fields and click on 'create'.&lt;br /&gt;
*Verify if new assignment is successfully created.&lt;br /&gt;
&lt;br /&gt;
====Assignment Creation====&lt;br /&gt;
*Log in as an instructor ''(user-name:instructor6 password:password)''&lt;br /&gt;
*Go to Manage-&amp;gt;Assignments and click on the Assignments tab.&lt;br /&gt;
*Click on the Edit button for any of the available assignment.&lt;br /&gt;
*Verify if drop-down window is displayed.&lt;br /&gt;
*Make changes and click on 'save'.&lt;br /&gt;
*Verify if the changes made are successfully updated.&lt;br /&gt;
 &lt;br /&gt;
====Make the table in topics tab sortable by its header====&lt;br /&gt;
* Create an assignment&lt;br /&gt;
* Add 2 topics to the assignment&lt;br /&gt;
* Click sort on Topic ID and check if they are sorted&lt;br /&gt;
* Click sort on Topic title and check if they are sorted&lt;br /&gt;
* Similarly test using other columns&lt;br /&gt;
&lt;br /&gt;
====Validating user entries====&lt;br /&gt;
*Log in as an instructor ''(user-name:instructor6 password:password)''&lt;br /&gt;
*Go to Manage-&amp;gt;Assignments and click on the Assignments tab.&lt;br /&gt;
*Click on the 'New public assignment' or 'New private assignment' button&lt;br /&gt;
*Try adding the assignment using the weird names, with special symbols, ignoring check boxes&lt;br /&gt;
*Verify if the assignment is shown in the table.&lt;br /&gt;
&lt;br /&gt;
==Future Work==&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
#''http://railscasts.com/episodes/228-sortable-table-columns sortable-columns''&lt;br /&gt;
#''https://www.airpair.com/reactjs/posts/reactjs-a-guide-for-rails-developers adding-reactjs''&lt;/div&gt;</summary>
		<author><name>Dguttik</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/Convert_Assignment_Creation_Form_to_ReactJS&amp;diff=108058</id>
		<title>CSC/ECE 517 Spring 2017/Convert Assignment Creation Form to ReactJS</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/Convert_Assignment_Creation_Form_to_ReactJS&amp;diff=108058"/>
		<updated>2017-04-07T19:29:58Z</updated>

		<summary type="html">&lt;p&gt;Dguttik: /* Add/Delete topics in Assignment */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
This page is a part of CSC/ECE 517 Final Project for Spring 2017 to describe the changes made by us to the open source software project Expertiza. We are converting the assignment creation form to ReactJS. Following contains a brief introduction to Expertiza, ReactJS followed by the problems we are tackling, our strategy for the implementation and the test plan.&lt;br /&gt;
   &lt;br /&gt;
==Expertiza==&lt;br /&gt;
Expertiza is a Ruby on Rails based web application where students can submit and peer review learning objects such as codes, articles, websites etc., It is an open source software project funded by National Science Foundation(NSF). The instructor has the capability to create assignments with varied specifications such as topics, courses, team size, level of reviews etc., later review the submitted work and provide feedback. Students can enter their submissions and also review others' work. &lt;br /&gt;
&lt;br /&gt;
==ReactJS==&lt;br /&gt;
ReactJS is the javascript framework developed by Facebook to solve the specific problem, ''UI rendering''. It is developed to solve the problem with complex binding in MVC framework using only one-way data binding. It is used for dynamic reloading of the page. It helps in reloading only the particular component required using Virtual DOM, which makes it fast by temporarily storing DOM&lt;br /&gt;
&lt;br /&gt;
'''Reasons for using ReactJS'''&lt;br /&gt;
* It has every functionality that an user interface required&lt;br /&gt;
* Easy data binding.&lt;br /&gt;
* Only single component changes are stored/changed without reloading the complete page.&lt;br /&gt;
* Fast and efficient&lt;br /&gt;
* Easy to scale&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
The Assignment Create and Edit Form are multi level forms. It consists of multiple inputs  and user interactions. Many input types have dependency on interactions by the user. For example, on check for a particular checkbox, remaining form is displayed. Also, edit page is reloaded whenever a topic is added. The task is to convert this pages into ReactJS components.&lt;br /&gt;
&lt;br /&gt;
'''Tasks to be done'''&lt;br /&gt;
*Organize the form layout, create several mockups and validate them to your users&lt;br /&gt;
*Make the table in topics tab sortable by its header&lt;br /&gt;
*Allow users to edit / add topics in the table instead of loading a new page&lt;br /&gt;
*Implement the new layout and convert the javascript to a ReactJS component&lt;br /&gt;
*Validate user entries&lt;br /&gt;
*Fix tooltips that don’t work&lt;br /&gt;
&lt;br /&gt;
==Current Implementation==&lt;br /&gt;
===Assignment Creation===&lt;br /&gt;
The assignment creation form consists of multiple inputs and requires interactions from the user. The current implementation is mostly in HTML with data validations being done by JQuery. When a user wants to create a new assignment by clicking the new assignment button, a server request is generated and new view is rendered. Again, another server request to make database entry is generated once the user fills in the data and clicks on 'save' button and again a new view is rendered. This kind of implementation doesn't support dynamic view rendering hence lacks the fluidity in overall user experience that one would expect.&lt;br /&gt;
&lt;br /&gt;
[[File:Create1.JPG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Create2.JPG]]&lt;br /&gt;
&lt;br /&gt;
===Assignment Edition===&lt;br /&gt;
Similar to assignment creation page, edit page lacks the dynamic view rendering which makes the user experience cumbersome. Every time user wants to make changes to the assignment, a server request is generated and new view is rendered. The save button hit on completion will again generate another server request and render a new view.&lt;br /&gt;
&lt;br /&gt;
[[File:Edit.jpg]]&lt;br /&gt;
&lt;br /&gt;
=== Add/Delete topics in Assignment ===&lt;br /&gt;
In current implementation whenever a topic is added to the assignment, a request is sent to the server and user is redirected to a form in another page.Opon creation of topic user is rendered back to edit assignment page. This process involves lot of redirection.&lt;br /&gt;
&lt;br /&gt;
'''Add topic:'''&lt;br /&gt;
&lt;br /&gt;
[[File:Add_topic_form.PNG]]&lt;br /&gt;
&lt;br /&gt;
Similar is the case for editing a topic. For editing a topic user is rendered to a form in edit page and again redirected to edit assignment page.&lt;br /&gt;
&lt;br /&gt;
'''Edit Topic:'''&lt;br /&gt;
&lt;br /&gt;
[[File:Edit_topic_form.PNG]]&lt;br /&gt;
&lt;br /&gt;
===Make the table in topics tab sortable by its header===&lt;br /&gt;
Currently after creating an assignment, we can add topics related to the assignment. The &amp;quot;Topics&amp;quot; tab in the edit assignment form shows the list of topics that are added to the assignment. The picture below shows the current page for displaying the list of topics of an assignment. The list is not sortable. The task is to make it sortable using ReactJS by topic id, topic name, Num. of slots, Available slots, Num. on waitlist columns as sorting on remaining columns doesn't give any meaningful display.&lt;br /&gt;
&lt;br /&gt;
[[File:topics_tab.png]]&lt;br /&gt;
&lt;br /&gt;
===Validating user entries===&lt;br /&gt;
The entries for the assignment creation are not according to any restrictions, that can add problem to database maintainence like sorting the entries, comparing them, retrieving. There are many such problem causing situations in the new assignment form, such as &lt;br /&gt;
* User can add the number as new assignment name or he can give only special characters for it like &amp;quot;$$$$&amp;quot;.&lt;br /&gt;
* Neglecting check boxes may lead to confusion with deadlines.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Create2.JPG]]&lt;br /&gt;
&lt;br /&gt;
==Proposed Solution==&lt;br /&gt;
===Assignment Creation===&lt;br /&gt;
The new implementation will use ReactJS to generate a drop-down window on clicking on the New Assignment button (private/public) , providing same features as before. Database entry is made on submitting the form and the form is closed.&lt;br /&gt;
&lt;br /&gt;
====Files to be modified====&lt;br /&gt;
*apps/assets/javascripts/tree_display.jsx.erb&lt;br /&gt;
*apps/controllers/assignments_controller.rb&lt;br /&gt;
*apps/controllers/tree_display_controller.rb&lt;br /&gt;
&lt;br /&gt;
===Assignment Edition===&lt;br /&gt;
Similar to assignment creation, in the new implementation, using ReactJS, when the edit assignment button is clicked, instead of making a server request and rendering a new view, a drop down window appears and saving the details will make the database entry.Since all the processing is done on the client side there will be decrease in the number of server requests.&lt;br /&gt;
&lt;br /&gt;
====Files to be modified====&lt;br /&gt;
*apps/views/tree_display/list.html.erb&lt;br /&gt;
*apps/views/assignments/edit.html.erb&lt;br /&gt;
*apps/views/assignments/edit/_general.html.erb&lt;br /&gt;
&lt;br /&gt;
===Make the table in topics tab sortable by its header===&lt;br /&gt;
Following sub-tasks identified to implement sortable feature for topics table.&lt;br /&gt;
* Modify sign_up_sheet/_table_header.html.erb partial to change the table header fields to sortable type.&lt;br /&gt;
* Add sort functionality using ReactJS for each column that is meaningful to be sorted.&lt;br /&gt;
&lt;br /&gt;
===Validating user entries===&lt;br /&gt;
The following tasks are to be implemented to achieve users validation,&lt;br /&gt;
* Add the regular expression validation to avoid special characters in the names of assignment or directories.&lt;br /&gt;
* Create alert messages to notify user if any important check boxes are missed.&lt;br /&gt;
* Create validation for edge cases like giving empty values.&lt;br /&gt;
&lt;br /&gt;
===Files to be modified===&lt;br /&gt;
As, the project needs to be implemented in reactJS, which helps in reducing the complexing binding in MVC framework, only changing the javascript file can help to achieve this without changing model,&lt;br /&gt;
* app/assets/javascripts/tree_display.jsx.erb&lt;br /&gt;
&lt;br /&gt;
==Test Plan==&lt;br /&gt;
Rails development is the Test Driven development, which helps in ensuring the implementation of all proposed implementations. We will be writing all the implementations proposed as tests that will eventually be red and try to make them green by adding to the development part.&lt;br /&gt;
&lt;br /&gt;
For now the manual testing of these current implementations can help in testing the functionality from UI.&lt;br /&gt;
===Manual Testing===&lt;br /&gt;
Steps to manually test the feature are as follows: &lt;br /&gt;
&lt;br /&gt;
====Assignment Creation====&lt;br /&gt;
*Log in as an instructor ''(user-name:instructor6 password:password)''&lt;br /&gt;
*Go to Manage-&amp;gt;Assignments and click on the Assignments tab.&lt;br /&gt;
*Click on the 'New public assignment' or 'New private assignment' button&lt;br /&gt;
*Verify if drop-down window is displayed.&lt;br /&gt;
*Make valid entries for the available fields and click on 'create'.&lt;br /&gt;
*Verify if new assignment is successfully created.&lt;br /&gt;
&lt;br /&gt;
====Assignment Creation====&lt;br /&gt;
*Log in as an instructor ''(user-name:instructor6 password:password)''&lt;br /&gt;
*Go to Manage-&amp;gt;Assignments and click on the Assignments tab.&lt;br /&gt;
*Click on the Edit button for any of the available assignment.&lt;br /&gt;
*Verify if drop-down window is displayed.&lt;br /&gt;
*Make changes and click on 'save'.&lt;br /&gt;
*Verify if the changes made are successfully updated.&lt;br /&gt;
 &lt;br /&gt;
====Make the table in topics tab sortable by its header====&lt;br /&gt;
* Create an assignment&lt;br /&gt;
* Add 2 topics to the assignment&lt;br /&gt;
* Click sort on Topic ID and check if they are sorted&lt;br /&gt;
* Click sort on Topic title and check if they are sorted&lt;br /&gt;
* Similarly test using other columns&lt;br /&gt;
&lt;br /&gt;
====Validating user entries====&lt;br /&gt;
*Log in as an instructor ''(user-name:instructor6 password:password)''&lt;br /&gt;
*Go to Manage-&amp;gt;Assignments and click on the Assignments tab.&lt;br /&gt;
*Click on the 'New public assignment' or 'New private assignment' button&lt;br /&gt;
*Try adding the assignment using the weird names, with special symbols, ignoring check boxes&lt;br /&gt;
*Verify if the assignment is shown in the table.&lt;br /&gt;
&lt;br /&gt;
==Future Work==&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
#''http://railscasts.com/episodes/228-sortable-table-columns sortable-columns''&lt;br /&gt;
#''https://www.airpair.com/reactjs/posts/reactjs-a-guide-for-rails-developers adding-reactjs''&lt;/div&gt;</summary>
		<author><name>Dguttik</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/Convert_Assignment_Creation_Form_to_ReactJS&amp;diff=108057</id>
		<title>CSC/ECE 517 Spring 2017/Convert Assignment Creation Form to ReactJS</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/Convert_Assignment_Creation_Form_to_ReactJS&amp;diff=108057"/>
		<updated>2017-04-07T19:27:50Z</updated>

		<summary type="html">&lt;p&gt;Dguttik: /* Add/Delete topics in Assignment */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
This page is a part of CSC/ECE 517 Final Project for Spring 2017 to describe the changes made by us to the open source software project Expertiza. We are converting the assignment creation form to ReactJS. Following contains a brief introduction to Expertiza, ReactJS followed by the problems we are tackling, our strategy for the implementation and the test plan.&lt;br /&gt;
   &lt;br /&gt;
==Expertiza==&lt;br /&gt;
Expertiza is a Ruby on Rails based web application where students can submit and peer review learning objects such as codes, articles, websites etc., It is an open source software project funded by National Science Foundation(NSF). The instructor has the capability to create assignments with varied specifications such as topics, courses, team size, level of reviews etc., later review the submitted work and provide feedback. Students can enter their submissions and also review others' work. &lt;br /&gt;
&lt;br /&gt;
==ReactJS==&lt;br /&gt;
ReactJS is the javascript framework developed by Facebook to solve the specific problem, ''UI rendering''. It is developed to solve the problem with complex binding in MVC framework using only one-way data binding. It is used for dynamic reloading of the page. It helps in reloading only the particular component required using Virtual DOM, which makes it fast by temporarily storing DOM&lt;br /&gt;
&lt;br /&gt;
'''Reasons for using ReactJS'''&lt;br /&gt;
* It has every functionality that an user interface required&lt;br /&gt;
* Easy data binding.&lt;br /&gt;
* Only single component changes are stored/changed without reloading the complete page.&lt;br /&gt;
* Fast and efficient&lt;br /&gt;
* Easy to scale&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
The Assignment Create and Edit Form are multi level forms. It consists of multiple inputs  and user interactions. Many input types have dependency on interactions by the user. For example, on check for a particular checkbox, remaining form is displayed. Also, edit page is reloaded whenever a topic is added. The task is to convert this pages into ReactJS components.&lt;br /&gt;
&lt;br /&gt;
'''Tasks to be done'''&lt;br /&gt;
*Organize the form layout, create several mockups and validate them to your users&lt;br /&gt;
*Make the table in topics tab sortable by its header&lt;br /&gt;
*Allow users to edit / add topics in the table instead of loading a new page&lt;br /&gt;
*Implement the new layout and convert the javascript to a ReactJS component&lt;br /&gt;
*Validate user entries&lt;br /&gt;
*Fix tooltips that don’t work&lt;br /&gt;
&lt;br /&gt;
==Current Implementation==&lt;br /&gt;
===Assignment Creation===&lt;br /&gt;
The assignment creation form consists of multiple inputs and requires interactions from the user. The current implementation is mostly in HTML with data validations being done by JQuery. When a user wants to create a new assignment by clicking the new assignment button, a server request is generated and new view is rendered. Again, another server request to make database entry is generated once the user fills in the data and clicks on 'save' button and again a new view is rendered. This kind of implementation doesn't support dynamic view rendering hence lacks the fluidity in overall user experience that one would expect.&lt;br /&gt;
&lt;br /&gt;
[[File:Create1.JPG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Create2.JPG]]&lt;br /&gt;
&lt;br /&gt;
===Assignment Edition===&lt;br /&gt;
Similar to assignment creation page, edit page lacks the dynamic view rendering which makes the user experience cumbersome. Every time user wants to make changes to the assignment, a server request is generated and new view is rendered. The save button hit on completion will again generate another server request and render a new view.&lt;br /&gt;
&lt;br /&gt;
[[File:Edit.jpg]]&lt;br /&gt;
&lt;br /&gt;
=== Add/Delete topics in Assignment ===&lt;br /&gt;
In current implementation whenever a topic is added to the assignment, a request is sent to the server and user is redirected to a form in another page.Opon creation of topic user is rendered back to edit assignment page. This process involves lot of redirection.&lt;br /&gt;
&lt;br /&gt;
'''Add topic:'''&lt;br /&gt;
[[File:Add_topic_form.PNG]]&lt;br /&gt;
&lt;br /&gt;
Similar is the case for editing a topic. For editing a topic user is rendered to a form in edit page and again redirected to edit assignment page.&lt;br /&gt;
&lt;br /&gt;
'''Edit Topic:'''&lt;br /&gt;
&lt;br /&gt;
[[File:Edit_topic_form.PNG]]&lt;br /&gt;
&lt;br /&gt;
===Make the table in topics tab sortable by its header===&lt;br /&gt;
Currently after creating an assignment, we can add topics related to the assignment. The &amp;quot;Topics&amp;quot; tab in the edit assignment form shows the list of topics that are added to the assignment. The picture below shows the current page for displaying the list of topics of an assignment. The list is not sortable. The task is to make it sortable using ReactJS by topic id, topic name, Num. of slots, Available slots, Num. on waitlist columns as sorting on remaining columns doesn't give any meaningful display.&lt;br /&gt;
&lt;br /&gt;
[[File:topics_tab.png]]&lt;br /&gt;
&lt;br /&gt;
===Validating user entries===&lt;br /&gt;
The entries for the assignment creation are not according to any restrictions, that can add problem to database maintainence like sorting the entries, comparing them, retrieving. There are many such problem causing situations in the new assignment form, such as &lt;br /&gt;
* User can add the number as new assignment name or he can give only special characters for it like &amp;quot;$$$$&amp;quot;.&lt;br /&gt;
* Neglecting check boxes may lead to confusion with deadlines.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Create2.JPG]]&lt;br /&gt;
&lt;br /&gt;
==Proposed Solution==&lt;br /&gt;
===Assignment Creation===&lt;br /&gt;
The new implementation will use ReactJS to generate a drop-down window on clicking on the New Assignment button (private/public) , providing same features as before. Database entry is made on submitting the form and the form is closed.&lt;br /&gt;
&lt;br /&gt;
====Files to be modified====&lt;br /&gt;
*apps/assets/javascripts/tree_display.jsx.erb&lt;br /&gt;
*apps/controllers/assignments_controller.rb&lt;br /&gt;
*apps/controllers/tree_display_controller.rb&lt;br /&gt;
&lt;br /&gt;
===Assignment Edition===&lt;br /&gt;
Similar to assignment creation, in the new implementation, using ReactJS, when the edit assignment button is clicked, instead of making a server request and rendering a new view, a drop down window appears and saving the details will make the database entry.Since all the processing is done on the client side there will be decrease in the number of server requests.&lt;br /&gt;
&lt;br /&gt;
====Files to be modified====&lt;br /&gt;
*apps/views/tree_display/list.html.erb&lt;br /&gt;
*apps/views/assignments/edit.html.erb&lt;br /&gt;
*apps/views/assignments/edit/_general.html.erb&lt;br /&gt;
&lt;br /&gt;
===Make the table in topics tab sortable by its header===&lt;br /&gt;
Following sub-tasks identified to implement sortable feature for topics table.&lt;br /&gt;
* Modify sign_up_sheet/_table_header.html.erb partial to change the table header fields to sortable type.&lt;br /&gt;
* Add sort functionality using ReactJS for each column that is meaningful to be sorted.&lt;br /&gt;
&lt;br /&gt;
===Validating user entries===&lt;br /&gt;
The following tasks are to be implemented to achieve users validation,&lt;br /&gt;
* Add the regular expression validation to avoid special characters in the names of assignment or directories.&lt;br /&gt;
* Create alert messages to notify user if any important check boxes are missed.&lt;br /&gt;
* Create validation for edge cases like giving empty values.&lt;br /&gt;
&lt;br /&gt;
===Files to be modified===&lt;br /&gt;
As, the project needs to be implemented in reactJS, which helps in reducing the complexing binding in MVC framework, only changing the javascript file can help to achieve this without changing model,&lt;br /&gt;
* app/assets/javascripts/tree_display.jsx.erb&lt;br /&gt;
&lt;br /&gt;
==Test Plan==&lt;br /&gt;
Rails development is the Test Driven development, which helps in ensuring the implementation of all proposed implementations. We will be writing all the implementations proposed as tests that will eventually be red and try to make them green by adding to the development part.&lt;br /&gt;
&lt;br /&gt;
For now the manual testing of these current implementations can help in testing the functionality from UI.&lt;br /&gt;
===Manual Testing===&lt;br /&gt;
Steps to manually test the feature are as follows: &lt;br /&gt;
&lt;br /&gt;
====Assignment Creation====&lt;br /&gt;
*Log in as an instructor ''(user-name:instructor6 password:password)''&lt;br /&gt;
*Go to Manage-&amp;gt;Assignments and click on the Assignments tab.&lt;br /&gt;
*Click on the 'New public assignment' or 'New private assignment' button&lt;br /&gt;
*Verify if drop-down window is displayed.&lt;br /&gt;
*Make valid entries for the available fields and click on 'create'.&lt;br /&gt;
*Verify if new assignment is successfully created.&lt;br /&gt;
&lt;br /&gt;
====Assignment Creation====&lt;br /&gt;
*Log in as an instructor ''(user-name:instructor6 password:password)''&lt;br /&gt;
*Go to Manage-&amp;gt;Assignments and click on the Assignments tab.&lt;br /&gt;
*Click on the Edit button for any of the available assignment.&lt;br /&gt;
*Verify if drop-down window is displayed.&lt;br /&gt;
*Make changes and click on 'save'.&lt;br /&gt;
*Verify if the changes made are successfully updated.&lt;br /&gt;
 &lt;br /&gt;
====Make the table in topics tab sortable by its header====&lt;br /&gt;
* Create an assignment&lt;br /&gt;
* Add 2 topics to the assignment&lt;br /&gt;
* Click sort on Topic ID and check if they are sorted&lt;br /&gt;
* Click sort on Topic title and check if they are sorted&lt;br /&gt;
* Similarly test using other columns&lt;br /&gt;
&lt;br /&gt;
====Validating user entries====&lt;br /&gt;
*Log in as an instructor ''(user-name:instructor6 password:password)''&lt;br /&gt;
*Go to Manage-&amp;gt;Assignments and click on the Assignments tab.&lt;br /&gt;
*Click on the 'New public assignment' or 'New private assignment' button&lt;br /&gt;
*Try adding the assignment using the weird names, with special symbols, ignoring check boxes&lt;br /&gt;
*Verify if the assignment is shown in the table.&lt;br /&gt;
&lt;br /&gt;
==Future Work==&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
#''http://railscasts.com/episodes/228-sortable-table-columns sortable-columns''&lt;br /&gt;
#''https://www.airpair.com/reactjs/posts/reactjs-a-guide-for-rails-developers adding-reactjs''&lt;/div&gt;</summary>
		<author><name>Dguttik</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Edit_topic_form.PNG&amp;diff=108055</id>
		<title>File:Edit topic form.PNG</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Edit_topic_form.PNG&amp;diff=108055"/>
		<updated>2017-04-07T19:25:07Z</updated>

		<summary type="html">&lt;p&gt;Dguttik: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Dguttik</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/Convert_Assignment_Creation_Form_to_ReactJS&amp;diff=108053</id>
		<title>CSC/ECE 517 Spring 2017/Convert Assignment Creation Form to ReactJS</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/Convert_Assignment_Creation_Form_to_ReactJS&amp;diff=108053"/>
		<updated>2017-04-07T19:23:31Z</updated>

		<summary type="html">&lt;p&gt;Dguttik: /* Add/Delete topics in Assignment */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
This page is a part of CSC/ECE 517 Final Project for Spring 2017 to describe the changes made by us to the open source software project Expertiza. We are converting the assignment creation form to ReactJS. Following contains a brief introduction to Expertiza, ReactJS followed by the problems we are tackling, our strategy for the implementation and the test plan.&lt;br /&gt;
   &lt;br /&gt;
==Expertiza==&lt;br /&gt;
Expertiza is a Ruby on Rails based web application where students can submit and peer review learning objects such as codes, articles, websites etc., It is an open source software project funded by National Science Foundation(NSF). The instructor has the capability to create assignments with varied specifications such as topics, courses, team size, level of reviews etc., later review the submitted work and provide feedback. Students can enter their submissions and also review others' work. &lt;br /&gt;
&lt;br /&gt;
==ReactJS==&lt;br /&gt;
ReactJS is the javascript framework developed by Facebook to solve the specific problem, ''UI rendering''. It is developed to solve the problem with complex binding in MVC framework using only one-way data binding. It is used for dynamic reloading of the page. It helps in reloading only the particular component required using Virtual DOM, which makes it fast by temporarily storing DOM&lt;br /&gt;
&lt;br /&gt;
'''Reasons for using ReactJS'''&lt;br /&gt;
* It has every functionality that an user interface required&lt;br /&gt;
* Easy data binding.&lt;br /&gt;
* Only single component changes are stored/changed without reloading the complete page.&lt;br /&gt;
* Fast and efficient&lt;br /&gt;
* Easy to scale&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
The Assignment Create and Edit Form are multi level forms. It consists of multiple inputs  and user interactions. Many input types have dependency on interactions by the user. For example, on check for a particular checkbox, remaining form is displayed. Also, edit page is reloaded whenever a topic is added. The task is to convert this pages into ReactJS components.&lt;br /&gt;
&lt;br /&gt;
'''Tasks to be done'''&lt;br /&gt;
*Organize the form layout, create several mockups and validate them to your users&lt;br /&gt;
*Make the table in topics tab sortable by its header&lt;br /&gt;
*Allow users to edit / add topics in the table instead of loading a new page&lt;br /&gt;
*Implement the new layout and convert the javascript to a ReactJS component&lt;br /&gt;
*Validate user entries&lt;br /&gt;
*Fix tooltips that don’t work&lt;br /&gt;
&lt;br /&gt;
==Current Implementation==&lt;br /&gt;
===Assignment Creation===&lt;br /&gt;
The assignment creation form consists of multiple inputs and requires interactions from the user. The current implementation is mostly in HTML with data validations being done by JQuery. When a user wants to create a new assignment by clicking the new assignment button, a server request is generated and new view is rendered. Again, another server request to make database entry is generated once the user fills in the data and clicks on 'save' button and again a new view is rendered. This kind of implementation doesn't support dynamic view rendering hence lacks the fluidity in overall user experience that one would expect.&lt;br /&gt;
&lt;br /&gt;
[[File:Create1.JPG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Create2.JPG]]&lt;br /&gt;
&lt;br /&gt;
===Assignment Edition===&lt;br /&gt;
Similar to assignment creation page, edit page lacks the dynamic view rendering which makes the user experience cumbersome. Every time user wants to make changes to the assignment, a server request is generated and new view is rendered. The save button hit on completion will again generate another server request and render a new view.&lt;br /&gt;
&lt;br /&gt;
[[File:Edit.jpg]]&lt;br /&gt;
&lt;br /&gt;
=== Add/Delete topics in Assignment ===&lt;br /&gt;
In current implementation whenever a topic is added to the assignment, a request is sent to the server and user is redirected to a form in another page.Opon creation of topic user is rendered back to edit assignment page. This process involves lot of redirection.&lt;br /&gt;
&lt;br /&gt;
'''Add topic:'''&lt;br /&gt;
[[File:Add_topic_form.PNG]]&lt;br /&gt;
&lt;br /&gt;
===Make the table in topics tab sortable by its header===&lt;br /&gt;
Currently after creating an assignment, we can add topics related to the assignment. The &amp;quot;Topics&amp;quot; tab in the edit assignment form shows the list of topics that are added to the assignment. The picture below shows the current page for displaying the list of topics of an assignment. The list is not sortable. The task is to make it sortable using ReactJS by topic id, topic name, Num. of slots, Available slots, Num. on waitlist columns as sorting on remaining columns doesn't give any meaningful display.&lt;br /&gt;
&lt;br /&gt;
[[File:topics_tab.png]]&lt;br /&gt;
&lt;br /&gt;
===Validating user entries===&lt;br /&gt;
The entries for the assignment creation are not according to any restrictions, that can add problem to database maintainence like sorting the entries, comparing them, retrieving. There are many such problem causing situations in the new assignment form, such as &lt;br /&gt;
* User can add the number as new assignment name or he can give only special characters for it like &amp;quot;$$$$&amp;quot;.&lt;br /&gt;
* Neglecting check boxes may lead to confusion with deadlines.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Create2.JPG]]&lt;br /&gt;
&lt;br /&gt;
==Proposed Solution==&lt;br /&gt;
===Assignment Creation===&lt;br /&gt;
The new implementation will use ReactJS to generate a drop-down window on clicking on the New Assignment button (private/public) , providing same features as before. Database entry is made on submitting the form and the form is closed.&lt;br /&gt;
&lt;br /&gt;
====Files to be modified====&lt;br /&gt;
*apps/assets/javascripts/tree_display.jsx.erb&lt;br /&gt;
*apps/controllers/assignments_controller.rb&lt;br /&gt;
*apps/controllers/tree_display_controller.rb&lt;br /&gt;
&lt;br /&gt;
===Assignment Edition===&lt;br /&gt;
Similar to assignment creation, in the new implementation, using ReactJS, when the edit assignment button is clicked, instead of making a server request and rendering a new view, a drop down window appears and saving the details will make the database entry.Since all the processing is done on the client side there will be decrease in the number of server requests.&lt;br /&gt;
&lt;br /&gt;
====Files to be modified====&lt;br /&gt;
*apps/views/tree_display/list.html.erb&lt;br /&gt;
*apps/views/assignments/edit.html.erb&lt;br /&gt;
*apps/views/assignments/edit/_general.html.erb&lt;br /&gt;
&lt;br /&gt;
===Make the table in topics tab sortable by its header===&lt;br /&gt;
Following sub-tasks identified to implement sortable feature for topics table.&lt;br /&gt;
* Modify sign_up_sheet/_table_header.html.erb partial to change the table header fields to sortable type.&lt;br /&gt;
* Add sort functionality using ReactJS for each column that is meaningful to be sorted.&lt;br /&gt;
&lt;br /&gt;
===Validating user entries===&lt;br /&gt;
The following tasks are to be implemented to achieve users validation,&lt;br /&gt;
* Add the regular expression validation to avoid special characters in the names of assignment or directories.&lt;br /&gt;
* Create alert messages to notify user if any important check boxes are missed.&lt;br /&gt;
* Create validation for edge cases like giving empty values.&lt;br /&gt;
&lt;br /&gt;
===Files to be modified===&lt;br /&gt;
As, the project needs to be implemented in reactJS, which helps in reducing the complexing binding in MVC framework, only changing the javascript file can help to achieve this without changing model,&lt;br /&gt;
* app/assets/javascripts/tree_display.jsx.erb&lt;br /&gt;
&lt;br /&gt;
==Test Plan==&lt;br /&gt;
Rails development is the Test Driven development, which helps in ensuring the implementation of all proposed implementations. We will be writing all the implementations proposed as tests that will eventually be red and try to make them green by adding to the development part.&lt;br /&gt;
&lt;br /&gt;
For now the manual testing of these current implementations can help in testing the functionality from UI.&lt;br /&gt;
===Manual Testing===&lt;br /&gt;
Steps to manually test the feature are as follows: &lt;br /&gt;
&lt;br /&gt;
====Assignment Creation====&lt;br /&gt;
*Log in as an instructor ''(user-name:instructor6 password:password)''&lt;br /&gt;
*Go to Manage-&amp;gt;Assignments and click on the Assignments tab.&lt;br /&gt;
*Click on the 'New public assignment' or 'New private assignment' button&lt;br /&gt;
*Verify if drop-down window is displayed.&lt;br /&gt;
*Make valid entries for the available fields and click on 'create'.&lt;br /&gt;
*Verify if new assignment is successfully created.&lt;br /&gt;
&lt;br /&gt;
====Assignment Creation====&lt;br /&gt;
*Log in as an instructor ''(user-name:instructor6 password:password)''&lt;br /&gt;
*Go to Manage-&amp;gt;Assignments and click on the Assignments tab.&lt;br /&gt;
*Click on the Edit button for any of the available assignment.&lt;br /&gt;
*Verify if drop-down window is displayed.&lt;br /&gt;
*Make changes and click on 'save'.&lt;br /&gt;
*Verify if the changes made are successfully updated.&lt;br /&gt;
 &lt;br /&gt;
====Make the table in topics tab sortable by its header====&lt;br /&gt;
* Create an assignment&lt;br /&gt;
* Add 2 topics to the assignment&lt;br /&gt;
* Click sort on Topic ID and check if they are sorted&lt;br /&gt;
* Click sort on Topic title and check if they are sorted&lt;br /&gt;
* Similarly test using other columns&lt;br /&gt;
&lt;br /&gt;
====Validating user entries====&lt;br /&gt;
*Log in as an instructor ''(user-name:instructor6 password:password)''&lt;br /&gt;
*Go to Manage-&amp;gt;Assignments and click on the Assignments tab.&lt;br /&gt;
*Click on the 'New public assignment' or 'New private assignment' button&lt;br /&gt;
*Try adding the assignment using the weird names, with special symbols, ignoring check boxes&lt;br /&gt;
*Verify if the assignment is shown in the table.&lt;br /&gt;
&lt;br /&gt;
==Future Work==&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
#''http://railscasts.com/episodes/228-sortable-table-columns sortable-columns''&lt;br /&gt;
#''https://www.airpair.com/reactjs/posts/reactjs-a-guide-for-rails-developers adding-reactjs''&lt;/div&gt;</summary>
		<author><name>Dguttik</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/Convert_Assignment_Creation_Form_to_ReactJS&amp;diff=108047</id>
		<title>CSC/ECE 517 Spring 2017/Convert Assignment Creation Form to ReactJS</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/Convert_Assignment_Creation_Form_to_ReactJS&amp;diff=108047"/>
		<updated>2017-04-07T19:12:30Z</updated>

		<summary type="html">&lt;p&gt;Dguttik: /* Add/Delete topics in Assignment */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
This page is a part of CSC/ECE 517 Final Project for Spring 2017 to describe the changes made by us to the open source software project Expertiza. We are converting the assignment creation form to ReactJS. Following contains a brief introduction to Expertiza, ReactJS followed by the problems we are tackling, our strategy for the implementation and the test plan.&lt;br /&gt;
   &lt;br /&gt;
==Expertiza==&lt;br /&gt;
Expertiza is a Ruby on Rails based web application where students can submit and peer review learning objects such as codes, articles, websites etc., It is an open source software project funded by National Science Foundation(NSF). The instructor has the capability to create assignments with varied specifications such as topics, courses, team size, level of reviews etc., later review the submitted work and provide feedback. Students can enter their submissions and also review others' work. &lt;br /&gt;
&lt;br /&gt;
==ReactJS==&lt;br /&gt;
ReactJS is the javascript framework developed by Facebook to solve the specific problem, ''UI rendering''. It is developed to solve the problem with complex binding in MVC framework using only one-way data binding. It is used for dynamic reloading of the page. It helps in reloading only the particular component required using Virtual DOM, which makes it fast by temporarily storing DOM&lt;br /&gt;
&lt;br /&gt;
'''Reasons for using ReactJS'''&lt;br /&gt;
* It has every functionality that an user interface required&lt;br /&gt;
* Easy data binding.&lt;br /&gt;
* Only single component changes are stored/changed without reloading the complete page.&lt;br /&gt;
* Fast and efficient&lt;br /&gt;
* Easy to scale&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
The Assignment Create and Edit Form are multi level forms. It consists of multiple inputs  and user interactions. Many input types have dependency on interactions by the user. For example, on check for a particular checkbox, remaining form is displayed. Also, edit page is reloaded whenever a topic is added. The task is to convert this pages into ReactJS components.&lt;br /&gt;
&lt;br /&gt;
'''Tasks to be done'''&lt;br /&gt;
*Organize the form layout, create several mockups and validate them to your users&lt;br /&gt;
*Make the table in topics tab sortable by its header&lt;br /&gt;
*Allow users to edit / add topics in the table instead of loading a new page&lt;br /&gt;
*Implement the new layout and convert the javascript to a ReactJS component&lt;br /&gt;
*Validate user entries&lt;br /&gt;
*Fix tooltips that don’t work&lt;br /&gt;
&lt;br /&gt;
==Current Implementation==&lt;br /&gt;
===Assignment Creation===&lt;br /&gt;
The assignment creation form consists of multiple inputs and requires interactions from the user. The current implementation is mostly in HTML with data validations being done by JQuery. When a user wants to create a new assignment by clicking the new assignment button, a server request is generated and new view is rendered. Again, another server request to make database entry is generated once the user fills in the data and clicks on 'save' button and again a new view is rendered. This kind of implementation doesn't support dynamic view rendering hence lacks the fluidity in overall user experience that one would expect.&lt;br /&gt;
&lt;br /&gt;
[[File:Create1.JPG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Create2.JPG]]&lt;br /&gt;
&lt;br /&gt;
===Assignment Edition===&lt;br /&gt;
Similar to assignment creation page, edit page lacks the dynamic view rendering which makes the user experience cumbersome. Every time user wants to make changes to the assignment, a server request is generated and new view is rendered. The save button hit on completion will again generate another server request and render a new view.&lt;br /&gt;
&lt;br /&gt;
[[File:Edit.jpg]]&lt;br /&gt;
&lt;br /&gt;
=== Add/Delete topics in Assignment ===&lt;br /&gt;
In current implementation whenever a topic is added to the assignment, a request is sent to the server and user is redirected to a form in another page.&lt;br /&gt;
[[File:Add_topic_form.PNG]]&lt;br /&gt;
&lt;br /&gt;
===Make the table in topics tab sortable by its header===&lt;br /&gt;
Currently after creating an assignment, we can add topics related to the assignment. The &amp;quot;Topics&amp;quot; tab in the edit assignment form shows the list of topics that are added to the assignment. The picture below shows the current page for displaying the list of topics of an assignment. The list is not sortable. The task is to make it sortable using ReactJS by topic id, topic name, Num. of slots, Available slots, Num. on waitlist columns as sorting on remaining columns doesn't give any meaningful display.&lt;br /&gt;
&lt;br /&gt;
[[File:topics_tab.png]]&lt;br /&gt;
&lt;br /&gt;
===Validating user entries===&lt;br /&gt;
The entries for the assignment creation are not according to any restrictions, that can add problem to database maintainence like sorting the entries, comparing them, retrieving. There are many such problem causing situations in the new assignment form, such as &lt;br /&gt;
* User can add the number as new assignment name or he can give only special characters for it like &amp;quot;$$$$&amp;quot;.&lt;br /&gt;
* Neglecting check boxes may lead to confusion with deadlines.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Create2.JPG]]&lt;br /&gt;
&lt;br /&gt;
==Proposed Solution==&lt;br /&gt;
===Assignment Creation===&lt;br /&gt;
The new implementation will use ReactJS to generate a drop-down window on clicking on the New Assignment button (private/public) , providing same features as before. Database entry is made on submitting the form and the form is closed.&lt;br /&gt;
&lt;br /&gt;
====Files to be modified====&lt;br /&gt;
*apps/assets/javascripts/tree_display.jsx.erb&lt;br /&gt;
*apps/controllers/assignments_controller.rb&lt;br /&gt;
*apps/controllers/tree_display_controller.rb&lt;br /&gt;
&lt;br /&gt;
===Assignment Edition===&lt;br /&gt;
Similar to assignment creation, in the new implementation, using ReactJS, when the edit assignment button is clicked, instead of making a server request and rendering a new view, a drop down window appears and saving the details will make the database entry.Since all the processing is done on the client side there will be decrease in the number of server requests.&lt;br /&gt;
&lt;br /&gt;
====Files to be modified====&lt;br /&gt;
*apps/views/tree_display/list.html.erb&lt;br /&gt;
*apps/views/assignments/edit.html.erb&lt;br /&gt;
*apps/views/assignments/edit/_general.html.erb&lt;br /&gt;
&lt;br /&gt;
===Make the table in topics tab sortable by its header===&lt;br /&gt;
Following sub-tasks identified to implement sortable feature for topics table.&lt;br /&gt;
* Modify sign_up_sheet/_table_header.html.erb partial to change the table header fields to sortable type.&lt;br /&gt;
* Add sort functionality using ReactJS for each column that is meaningful to be sorted.&lt;br /&gt;
&lt;br /&gt;
===Validating user entries===&lt;br /&gt;
The following tasks are to be implemented to achieve users validation,&lt;br /&gt;
* Add the regular expression validation to avoid special characters in the names of assignment or directories.&lt;br /&gt;
* Create alert messages to notify user if any important check boxes are missed.&lt;br /&gt;
* Create validation for edge cases like giving empty values.&lt;br /&gt;
&lt;br /&gt;
===Files to be modified===&lt;br /&gt;
As, the project needs to be implemented in reactJS, which helps in reducing the complexing binding in MVC framework, only changing the javascript file can help to achieve this without changing model,&lt;br /&gt;
* app/assets/javascripts/tree_display.jsx.erb&lt;br /&gt;
&lt;br /&gt;
==Test Plan==&lt;br /&gt;
Rails development is the Test Driven development, which helps in ensuring the implementation of all proposed implementations. We will be writing all the implementations proposed as tests that will eventually be red and try to make them green by adding to the development part.&lt;br /&gt;
&lt;br /&gt;
For now the manual testing of these current implementations can help in testing the functionality from UI.&lt;br /&gt;
===Manual Testing===&lt;br /&gt;
Steps to manually test the feature are as follows: &lt;br /&gt;
&lt;br /&gt;
====Assignment Creation====&lt;br /&gt;
*Log in as an instructor ''(user-name:instructor6 password:password)''&lt;br /&gt;
*Go to Manage-&amp;gt;Assignments and click on the Assignments tab.&lt;br /&gt;
*Click on the 'New public assignment' or 'New private assignment' button&lt;br /&gt;
*Verify if drop-down window is displayed.&lt;br /&gt;
*Make valid entries for the available fields and click on 'create'.&lt;br /&gt;
*Verify if new assignment is successfully created.&lt;br /&gt;
&lt;br /&gt;
====Assignment Creation====&lt;br /&gt;
*Log in as an instructor ''(user-name:instructor6 password:password)''&lt;br /&gt;
*Go to Manage-&amp;gt;Assignments and click on the Assignments tab.&lt;br /&gt;
*Click on the Edit button for any of the available assignment.&lt;br /&gt;
*Verify if drop-down window is displayed.&lt;br /&gt;
*Make changes and click on 'save'.&lt;br /&gt;
*Verify if the changes made are successfully updated.&lt;br /&gt;
 &lt;br /&gt;
====Make the table in topics tab sortable by its header====&lt;br /&gt;
* Create an assignment&lt;br /&gt;
* Add 2 topics to the assignment&lt;br /&gt;
* Click sort on Topic ID and check if they are sorted&lt;br /&gt;
* Click sort on Topic title and check if they are sorted&lt;br /&gt;
* Similarly test using other columns&lt;br /&gt;
&lt;br /&gt;
====Validating user entries====&lt;br /&gt;
*Log in as an instructor ''(user-name:instructor6 password:password)''&lt;br /&gt;
*Go to Manage-&amp;gt;Assignments and click on the Assignments tab.&lt;br /&gt;
*Click on the 'New public assignment' or 'New private assignment' button&lt;br /&gt;
*Try adding the assignment using the weird names, with special symbols, ignoring check boxes&lt;br /&gt;
*Verify if the assignment is shown in the table.&lt;br /&gt;
&lt;br /&gt;
==Future Work==&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
#''http://railscasts.com/episodes/228-sortable-table-columns sortable-columns''&lt;br /&gt;
#''https://www.airpair.com/reactjs/posts/reactjs-a-guide-for-rails-developers adding-reactjs''&lt;/div&gt;</summary>
		<author><name>Dguttik</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Add_topic_form.PNG&amp;diff=108046</id>
		<title>File:Add topic form.PNG</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Add_topic_form.PNG&amp;diff=108046"/>
		<updated>2017-04-07T19:09:54Z</updated>

		<summary type="html">&lt;p&gt;Dguttik: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Dguttik</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/Convert_Assignment_Creation_Form_to_ReactJS&amp;diff=108045</id>
		<title>CSC/ECE 517 Spring 2017/Convert Assignment Creation Form to ReactJS</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/Convert_Assignment_Creation_Form_to_ReactJS&amp;diff=108045"/>
		<updated>2017-04-07T19:08:12Z</updated>

		<summary type="html">&lt;p&gt;Dguttik: /* Current Implementation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
This page is a part of CSC/ECE 517 Final Project for Spring 2017 to describe the changes made by us to the open source software project Expertiza. We are converting the assignment creation form to ReactJS. Following contains a brief introduction to Expertiza, ReactJS followed by the problems we are tackling, our strategy for the implementation and the test plan.&lt;br /&gt;
   &lt;br /&gt;
==Expertiza==&lt;br /&gt;
Expertiza is a Ruby on Rails based web application where students can submit and peer review learning objects such as codes, articles, websites etc., It is an open source software project funded by National Science Foundation(NSF). The instructor has the capability to create assignments with varied specifications such as topics, courses, team size, level of reviews etc., later review the submitted work and provide feedback. Students can enter their submissions and also review others' work. &lt;br /&gt;
&lt;br /&gt;
==ReactJS==&lt;br /&gt;
ReactJS is the javascript framework developed by Facebook to solve the specific problem, ''UI rendering''. It is developed to solve the problem with complex binding in MVC framework using only one-way data binding. It is used for dynamic reloading of the page. It helps in reloading only the particular component required using Virtual DOM, which makes it fast by temporarily storing DOM&lt;br /&gt;
&lt;br /&gt;
'''Reasons for using ReactJS'''&lt;br /&gt;
* It has every functionality that an user interface required&lt;br /&gt;
* Easy data binding.&lt;br /&gt;
* Only single component changes are stored/changed without reloading the complete page.&lt;br /&gt;
* Fast and efficient&lt;br /&gt;
* Easy to scale&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
The Assignment Create and Edit Form are multi level forms. It consists of multiple inputs  and user interactions. Many input types have dependency on interactions by the user. For example, on check for a particular checkbox, remaining form is displayed. Also, edit page is reloaded whenever a topic is added. The task is to convert this pages into ReactJS components.&lt;br /&gt;
&lt;br /&gt;
'''Tasks to be done'''&lt;br /&gt;
*Organize the form layout, create several mockups and validate them to your users&lt;br /&gt;
*Make the table in topics tab sortable by its header&lt;br /&gt;
*Allow users to edit / add topics in the table instead of loading a new page&lt;br /&gt;
*Implement the new layout and convert the javascript to a ReactJS component&lt;br /&gt;
*Validate user entries&lt;br /&gt;
*Fix tooltips that don’t work&lt;br /&gt;
&lt;br /&gt;
==Current Implementation==&lt;br /&gt;
===Assignment Creation===&lt;br /&gt;
The assignment creation form consists of multiple inputs and requires interactions from the user. The current implementation is mostly in HTML with data validations being done by JQuery. When a user wants to create a new assignment by clicking the new assignment button, a server request is generated and new view is rendered. Again, another server request to make database entry is generated once the user fills in the data and clicks on 'save' button and again a new view is rendered. This kind of implementation doesn't support dynamic view rendering hence lacks the fluidity in overall user experience that one would expect.&lt;br /&gt;
&lt;br /&gt;
[[File:Create1.JPG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Create2.JPG]]&lt;br /&gt;
&lt;br /&gt;
===Assignment Edition===&lt;br /&gt;
Similar to assignment creation page, edit page lacks the dynamic view rendering which makes the user experience cumbersome. Every time user wants to make changes to the assignment, a server request is generated and new view is rendered. The save button hit on completion will again generate another server request and render a new view.&lt;br /&gt;
&lt;br /&gt;
[[File:Edit.jpg]]&lt;br /&gt;
&lt;br /&gt;
=== Add/Delete topics in Assignment ===&lt;br /&gt;
In current implementation whenever a topic is added to the assignment, a request is sent to the server and user is redirected to a form in another page.&lt;br /&gt;
&lt;br /&gt;
===Make the table in topics tab sortable by its header===&lt;br /&gt;
Currently after creating an assignment, we can add topics related to the assignment. The &amp;quot;Topics&amp;quot; tab in the edit assignment form shows the list of topics that are added to the assignment. The picture below shows the current page for displaying the list of topics of an assignment. The list is not sortable. The task is to make it sortable using ReactJS by topic id, topic name, Num. of slots, Available slots, Num. on waitlist columns as sorting on remaining columns doesn't give any meaningful display.&lt;br /&gt;
&lt;br /&gt;
[[File:topics_tab.png]]&lt;br /&gt;
&lt;br /&gt;
===Validating user entries===&lt;br /&gt;
The entries for the assignment creation are not according to any restrictions, that can add problem to database maintainence like sorting the entries, comparing them, retrieving. There are many such problem causing situations in the new assignment form, such as &lt;br /&gt;
* User can add the number as new assignment name or he can give only special characters for it like &amp;quot;$$$$&amp;quot;.&lt;br /&gt;
* Neglecting check boxes may lead to confusion with deadlines.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Create2.JPG]]&lt;br /&gt;
&lt;br /&gt;
==Proposed Solution==&lt;br /&gt;
===Assignment Creation===&lt;br /&gt;
The new implementation will use ReactJS to generate a drop-down window on clicking on the New Assignment button (private/public) , providing same features as before. Database entry is made on submitting the form and the form is closed.&lt;br /&gt;
&lt;br /&gt;
====Files to be modified====&lt;br /&gt;
*apps/assets/javascripts/tree_display.jsx.erb&lt;br /&gt;
*apps/controllers/assignments_controller.rb&lt;br /&gt;
*apps/controllers/tree_display_controller.rb&lt;br /&gt;
&lt;br /&gt;
===Assignment Edition===&lt;br /&gt;
Similar to assignment creation, in the new implementation, using ReactJS, when the edit assignment button is clicked, instead of making a server request and rendering a new view, a drop down window appears and saving the details will make the database entry.Since all the processing is done on the client side there will be decrease in the number of server requests.&lt;br /&gt;
&lt;br /&gt;
====Files to be modified====&lt;br /&gt;
*apps/views/tree_display/list.html.erb&lt;br /&gt;
*apps/views/assignments/edit.html.erb&lt;br /&gt;
*apps/views/assignments/edit/_general.html.erb&lt;br /&gt;
&lt;br /&gt;
===Make the table in topics tab sortable by its header===&lt;br /&gt;
Following sub-tasks identified to implement sortable feature for topics table.&lt;br /&gt;
* Modify sign_up_sheet/_table_header.html.erb partial to change the table header fields to sortable type.&lt;br /&gt;
* Add sort functionality using ReactJS for each column that is meaningful to be sorted.&lt;br /&gt;
&lt;br /&gt;
===Validating user entries===&lt;br /&gt;
The following tasks are to be implemented to achieve users validation,&lt;br /&gt;
* Add the regular expression validation to avoid special characters in the names of assignment or directories.&lt;br /&gt;
* Create alert messages to notify user if any important check boxes are missed.&lt;br /&gt;
* Create validation for edge cases like giving empty values.&lt;br /&gt;
&lt;br /&gt;
===Files to be modified===&lt;br /&gt;
As, the project needs to be implemented in reactJS, which helps in reducing the complexing binding in MVC framework, only changing the javascript file can help to achieve this without changing model,&lt;br /&gt;
* app/assets/javascripts/tree_display.jsx.erb&lt;br /&gt;
&lt;br /&gt;
==Test Plan==&lt;br /&gt;
Rails development is the Test Driven development, which helps in ensuring the implementation of all proposed implementations. We will be writing all the implementations proposed as tests that will eventually be red and try to make them green by adding to the development part.&lt;br /&gt;
&lt;br /&gt;
For now the manual testing of these current implementations can help in testing the functionality from UI.&lt;br /&gt;
===Manual Testing===&lt;br /&gt;
Steps to manually test the feature are as follows: &lt;br /&gt;
&lt;br /&gt;
====Assignment Creation====&lt;br /&gt;
*Log in as an instructor ''(user-name:instructor6 password:password)''&lt;br /&gt;
*Go to Manage-&amp;gt;Assignments and click on the Assignments tab.&lt;br /&gt;
*Click on the 'New public assignment' or 'New private assignment' button&lt;br /&gt;
*Verify if drop-down window is displayed.&lt;br /&gt;
*Make valid entries for the available fields and click on 'create'.&lt;br /&gt;
*Verify if new assignment is successfully created.&lt;br /&gt;
&lt;br /&gt;
====Assignment Creation====&lt;br /&gt;
*Log in as an instructor ''(user-name:instructor6 password:password)''&lt;br /&gt;
*Go to Manage-&amp;gt;Assignments and click on the Assignments tab.&lt;br /&gt;
*Click on the Edit button for any of the available assignment.&lt;br /&gt;
*Verify if drop-down window is displayed.&lt;br /&gt;
*Make changes and click on 'save'.&lt;br /&gt;
*Verify if the changes made are successfully updated.&lt;br /&gt;
 &lt;br /&gt;
====Make the table in topics tab sortable by its header====&lt;br /&gt;
* Create an assignment&lt;br /&gt;
* Add 2 topics to the assignment&lt;br /&gt;
* Click sort on Topic ID and check if they are sorted&lt;br /&gt;
* Click sort on Topic title and check if they are sorted&lt;br /&gt;
* Similarly test using other columns&lt;br /&gt;
&lt;br /&gt;
====Validating user entries====&lt;br /&gt;
*Log in as an instructor ''(user-name:instructor6 password:password)''&lt;br /&gt;
*Go to Manage-&amp;gt;Assignments and click on the Assignments tab.&lt;br /&gt;
*Click on the 'New public assignment' or 'New private assignment' button&lt;br /&gt;
*Try adding the assignment using the weird names, with special symbols, ignoring check boxes&lt;br /&gt;
*Verify if the assignment is shown in the table.&lt;br /&gt;
&lt;br /&gt;
==Future Work==&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
#''http://railscasts.com/episodes/228-sortable-table-columns sortable-columns''&lt;br /&gt;
#''https://www.airpair.com/reactjs/posts/reactjs-a-guide-for-rails-developers adding-reactjs''&lt;/div&gt;</summary>
		<author><name>Dguttik</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/Convert_Assignment_Creation_Form_to_ReactJS&amp;diff=108039</id>
		<title>CSC/ECE 517 Spring 2017/Convert Assignment Creation Form to ReactJS</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/Convert_Assignment_Creation_Form_to_ReactJS&amp;diff=108039"/>
		<updated>2017-04-07T18:11:41Z</updated>

		<summary type="html">&lt;p&gt;Dguttik: /* Problem Statement */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
This page is a part of CSC/ECE 517 Final Project for Spring 2017 to describe the changes made by us to the open source software project Expertiza. We are converting the assignment creation form to ReactJS. Following contains a brief introduction to Expertiza, ReactJS followed by the problems we are tackling, our strategy for the implementation and the test plan.&lt;br /&gt;
   &lt;br /&gt;
==Expertiza==&lt;br /&gt;
Expertiza is a Ruby on Rails based web application where students can submit and peer review learning objects such as codes, articles, websites etc., It is an open source software project funded by National Science Foundation(NSF). The instructor has the capability to create assignments with varied specifications such as topics, courses, team size, level of reviews etc., later review the submitted work and provide feedback. Students can enter their submissions and also review others' work. &lt;br /&gt;
&lt;br /&gt;
==ReactJS==&lt;br /&gt;
ReactJS is the javascript framework developed by Facebook to solve the specific problem, ''UI rendering''. It is developed to solve the problem with complex binding in MVC framework using only one-way data binding. It is used for dynamic reloading of the page. It helps in reloading only the particular component required using Virtual DOM, which makes it fast by temporarily storing DOM&lt;br /&gt;
&lt;br /&gt;
'''Reasons for using ReactJS'''&lt;br /&gt;
* It has every functionality that an user interface required&lt;br /&gt;
* Easy data binding.&lt;br /&gt;
* Only single component changes are stored/changed without reloading the complete page.&lt;br /&gt;
* Fast and efficient&lt;br /&gt;
* Easy to scale&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
The Assignment Create and Edit Form are multi level forms. It consists of multiple inputs  and user interactions. Many input types have dependency on interactions by the user. For example, on check for a particular checkbox, remaining form is displayed. Also, edit page is reloaded whenever a topic is added. The task is to convert this pages into ReactJS components.&lt;br /&gt;
&lt;br /&gt;
'''Tasks to be done'''&lt;br /&gt;
*Organize the form layout, create several mockups and validate them to your users&lt;br /&gt;
*Make the table in topics tab sortable by its header&lt;br /&gt;
*Allow users to edit / add topics in the table instead of loading a new page&lt;br /&gt;
*Implement the new layout and convert the javascript to a ReactJS component&lt;br /&gt;
*Validate user entries&lt;br /&gt;
*Fix tooltips that don’t work&lt;br /&gt;
&lt;br /&gt;
==Current Implementation==&lt;br /&gt;
===Assignment Creation===&lt;br /&gt;
The assignment creation form consists of multiple inputs and requires interactions from the user. The current implementation is mostly in HTML with data validations being done by JQuery. When a user wants to create a new assignment by clicking the new assignment button, a server request is generated and new view is rendered. Again, another server request to make database entry is generated once the user fills in the data and clicks on 'save' button and again a new view is rendered. This kind of implementation doesn't support dynamic view rendering hence lacks the fluidity in overall user experience that one would expect.&lt;br /&gt;
&lt;br /&gt;
[[File:Create1.JPG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Create2.JPG]]&lt;br /&gt;
&lt;br /&gt;
===Assignment Edition===&lt;br /&gt;
Similar to assignment creation page, edit page lacks the dynamic view rendering which makes the user experience cumbersome. Every time user wants to make changes to the assignment, a server request is generated and new view is rendered. The save button hit on completion will again generate another server request and render a new view.&lt;br /&gt;
&lt;br /&gt;
[[File:Edit.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Make the table in topics tab sortable by its header===&lt;br /&gt;
Currently after creating an assignment, we can add topics related to the assignment. The &amp;quot;Topics&amp;quot; tab in the edit assignment form shows the list of topics that are added to the assignment. The picture below shows the current page for displaying the list of topics of an assignment. The list is not sortable. The task is to make it sortable using ReactJS by topic id, topic name, Num. of slots, Available slots, Num. on waitlist columns as sorting on remaining columns doesn't give any meaningful display.&lt;br /&gt;
&lt;br /&gt;
[[File:topics_tab.png]]&lt;br /&gt;
&lt;br /&gt;
===Validating user entries===&lt;br /&gt;
The entries for the assignment creation are not according to any restrictions, that can add problem to database maintainence like sorting the entries, comparing them, retrieving. There are many such problem causing situations in the new assignment form, such as &lt;br /&gt;
* User can add the number as new assignment name or he can give only special characters for it like &amp;quot;$$$$&amp;quot;.&lt;br /&gt;
* User can add sub directories in similar way as assignment name.&lt;br /&gt;
* Neglecting check boxes may lead to confusion with deadlines.&lt;br /&gt;
&lt;br /&gt;
==Proposed Solution==&lt;br /&gt;
===Assignment Creation===&lt;br /&gt;
The new implementation will use ReactJS to generate a drop-down window on clicking on the New Assignment button (private/public) , providing same features as before. Database entry is made on submitting the form and the form is closed.&lt;br /&gt;
&lt;br /&gt;
====Files to be modified====&lt;br /&gt;
*apps/assets/javascripts/tree_display.jsx.erb&lt;br /&gt;
*apps/controllers/assignments_controller.rb&lt;br /&gt;
*apps/controllers/tree_display_controller.rb&lt;br /&gt;
&lt;br /&gt;
===Assignment Edition===&lt;br /&gt;
Similar to assignment creation, in the new implementation, using ReactJS, when the edit assignment button is clicked, instead of making a server request and rendering a new view, a drop down window appears and saving the details will make the database entry.Since all the processing is done on the client side there will be decrease in the number of server requests.&lt;br /&gt;
&lt;br /&gt;
====Files to be modified====&lt;br /&gt;
*apps/views/tree_display/list.html.erb&lt;br /&gt;
*apps/views/assignments/edit.html.erb&lt;br /&gt;
*apps/views/assignments/edit/_general.html.erb&lt;br /&gt;
&lt;br /&gt;
===Make the table in topics tab sortable by its header===&lt;br /&gt;
Following sub-tasks identified to implement sortable feature for topics table.&lt;br /&gt;
* Modify sign_up_sheet/_table_header.html.erb partial to change the table header fields to sortable type.&lt;br /&gt;
* Add sort functionality using ReactJS for each column that is meaningful to be sorted.&lt;br /&gt;
&lt;br /&gt;
===Validating user entries===&lt;br /&gt;
The following tasks are to be implemented to achieve users validation,&lt;br /&gt;
* Adding the regular expression validation to avoid special characters in the names of assignment or directories.&lt;br /&gt;
* Alert messages to notify user if any important check boxes are missed.&lt;br /&gt;
* Validating edge cases like giving empty values.&lt;br /&gt;
&lt;br /&gt;
===Files to be modified===&lt;br /&gt;
As, the project needs to be implemented in reactJS, which helps in reducing the complexing binding in MVC framework, only changing the javascript file can help to achieve this without changing model,&lt;br /&gt;
* app/assets/javascripts/tree_display.jsx.erb&lt;br /&gt;
&lt;br /&gt;
==Test Plan==&lt;br /&gt;
Rails development is the Test Driven development, which helps in ensuring the implementation of all proposed implementations. We will be writing all the implementations proposed as tests that will eventually be red and try to make them green by adding to the development part.&lt;br /&gt;
&lt;br /&gt;
For now the manual testing of these current implementations can help in testing the functionality from UI.&lt;br /&gt;
===Manual Testing===&lt;br /&gt;
Steps to manually test the feature are as follows: &lt;br /&gt;
&lt;br /&gt;
====Assignment Creation====&lt;br /&gt;
*Log in as an instructor ''(user-name:instructor6 password:password)''&lt;br /&gt;
*Go to Manage-&amp;gt;Assignments and click on the Assignments tab.&lt;br /&gt;
*Click on the 'New public assignment' or 'New private assignment' button&lt;br /&gt;
*Verify if drop-down window is displayed.&lt;br /&gt;
*Make valid entries for the available fields and click on 'create'.&lt;br /&gt;
*Verify if new assignment is successfully created.&lt;br /&gt;
&lt;br /&gt;
====Assignment Creation====&lt;br /&gt;
*Log in as an instructor ''(user-name:instructor6 password:password)''&lt;br /&gt;
*Go to Manage-&amp;gt;Assignments and click on the Assignments tab.&lt;br /&gt;
*Click on the Edit button for any of the available assignment.&lt;br /&gt;
*Verify if drop-down window is displayed.&lt;br /&gt;
*Make changes and click on 'save'.&lt;br /&gt;
*Verify if the changes made are successfully updated.&lt;br /&gt;
 &lt;br /&gt;
====Make the table in topics tab sortable by its header====&lt;br /&gt;
* Create an assignment&lt;br /&gt;
* Add 2 topics to the assignment&lt;br /&gt;
* Click sort on Topic ID and check if they are sorted&lt;br /&gt;
* Click sort on Topic title and check if they are sorted&lt;br /&gt;
* Similarly test using other columns&lt;br /&gt;
&lt;br /&gt;
====Validating user entries====&lt;br /&gt;
*Log in as an instructor ''(user-name:instructor6 password:password)''&lt;br /&gt;
*Go to Manage-&amp;gt;Assignments and click on the Assignments tab.&lt;br /&gt;
*Click on the 'New public assignment' or 'New private assignment' button&lt;br /&gt;
*Try adding the assignment using the weird names, with special symbols, ignoring check boxes&lt;br /&gt;
*Verify if the assignment is shown in the table.&lt;br /&gt;
&lt;br /&gt;
==Future Work==&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
#''http://railscasts.com/episodes/228-sortable-table-columns sortable-columns''&lt;br /&gt;
#''https://www.airpair.com/reactjs/posts/reactjs-a-guide-for-rails-developers adding-reactjs''&lt;/div&gt;</summary>
		<author><name>Dguttik</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/Convert_Assignment_Creation_Form_to_ReactJS&amp;diff=107926</id>
		<title>CSC/ECE 517 Spring 2017/Convert Assignment Creation Form to ReactJS</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/Convert_Assignment_Creation_Form_to_ReactJS&amp;diff=107926"/>
		<updated>2017-04-05T23:34:37Z</updated>

		<summary type="html">&lt;p&gt;Dguttik: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
&lt;br /&gt;
==Expertiza==&lt;br /&gt;
&lt;br /&gt;
==React JS==&lt;br /&gt;
===Pros===&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
==Current Implementation==&lt;br /&gt;
==Proposed Solution==&lt;br /&gt;
==Test Plan==&lt;br /&gt;
==Future Work==&lt;br /&gt;
==References==&lt;/div&gt;</summary>
		<author><name>Dguttik</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/Convert_Assignment_Creation_Form_to_ReactJS&amp;diff=107925</id>
		<title>CSC/ECE 517 Spring 2017/Convert Assignment Creation Form to ReactJS</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/Convert_Assignment_Creation_Form_to_ReactJS&amp;diff=107925"/>
		<updated>2017-04-05T23:34:16Z</updated>

		<summary type="html">&lt;p&gt;Dguttik: Created page with &amp;quot;= Introduction =  ==Expertiza==  ==React JS== ===Pros=== ==Problem Statement== ==Current Implementation== ==Proposed Solution== ==Test Plan== ==Future Work== ==References==&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Introduction =&lt;br /&gt;
&lt;br /&gt;
==Expertiza==&lt;br /&gt;
&lt;br /&gt;
==React JS==&lt;br /&gt;
===Pros===&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
==Current Implementation==&lt;br /&gt;
==Proposed Solution==&lt;br /&gt;
==Test Plan==&lt;br /&gt;
==Future Work==&lt;br /&gt;
==References==&lt;/div&gt;</summary>
		<author><name>Dguttik</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Wait_ajax.png&amp;diff=107851</id>
		<title>File:Wait ajax.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Wait_ajax.png&amp;diff=107851"/>
		<updated>2017-04-01T04:44:40Z</updated>

		<summary type="html">&lt;p&gt;Dguttik: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Dguttik</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Assignment_create.png&amp;diff=107850</id>
		<title>File:Assignment create.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Assignment_create.png&amp;diff=107850"/>
		<updated>2017-04-01T04:43:31Z</updated>

		<summary type="html">&lt;p&gt;Dguttik: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Dguttik</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/Use_Ajax_to_add_Participants,TA_and_Edit_Questionnaire&amp;diff=107849</id>
		<title>CSC/ECE 517 Spring 2017/Use Ajax to add Participants,TA and Edit Questionnaire</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/Use_Ajax_to_add_Participants,TA_and_Edit_Questionnaire&amp;diff=107849"/>
		<updated>2017-04-01T04:36:39Z</updated>

		<summary type="html">&lt;p&gt;Dguttik: /* Automated Testing */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;nowiki&amp;gt;  Expertiza is an opensource software developed to assist people in education institutions to perform peer reviews and group projects. It is exceptionally helpful to the students and instructors. The software is designed in MVC (Model-View-Controller) architecture using ruby on rails.&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
Expertiza provides many categories to manage for an instructor. Few of these categories are assignments, courses and questionnaires. Currently, to add/remove/update records, the entire page is submitted to save the record and the entire page is re-loaded back again to reflect the changes on the page. The task is to improve this functionality such that some of the records, specifically adding participants to courses or assignments, adding/removing teaching assistants to/from courses and adding questions to questionnaires, can be saved remotely and the page updated without submitting and reloading the entire page. &lt;br /&gt;
Additionally, on assign reviewers page for an assignment, there is no way to see the current status of reviews and there is no way for an instructor to unsubmit a submitted review. So, another task is to add this functionality such that review status is seen for each review and to unsubmit a submitted review without reloading the page.&lt;br /&gt;
&lt;br /&gt;
==Proposed Solution==&lt;br /&gt;
This project proposes use of AJAX for the required pages to avoid page reloading at the time of adding and saving records. This solution will make sure that adding or saving of record is done remotely and the page is updated without reloading. It can be achieved by calling corresponding controller method, adding/saving the record remotely and rendering it back to JavaScript pages in the view instead of redirecting it to the same page. JavaScript pages in the view will update the page without reloading it, for example by appending the newly added record to the list of records. Thus, records are saved remotely and page refresh is avoided.&lt;br /&gt;
For the review status part, responses to the corresponding reviews on the page can be checked in the Response table and the review status shown as the status of the latest response. Unsubmitting a review can be done using AJAX without reloading the page.&lt;br /&gt;
&lt;br /&gt;
==Tasks==&lt;br /&gt;
* Add Participant in the assignments section using AJAX &lt;br /&gt;
* Add/Remove TA in the courses section using AJAX&lt;br /&gt;
* Edit Questionnaire by using AJAX for adding questions in the Questionnaire section&lt;br /&gt;
* Show Review Status on assign reviewers page and allow to un-submit a review using AJAX&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
&lt;br /&gt;
===Adding participant===&lt;br /&gt;
'''Earlier scenario:''' When an instructor goes to &amp;quot;Manage Assignments -&amp;gt; Add Participants&amp;quot; page, he/she can add/remove new Participant to the assignment. The add page also displays list of participants above the form for new participant. Every time a new Participant is added, the page reloads to reflect the changes and render the updated list of participants, even in case of non-existing userid.&lt;br /&gt;
&lt;br /&gt;
'''Updates/Changes:'''&lt;br /&gt;
This page has been updated such that an instructor can add a new Participant using [https://en.wikipedia.org/wiki/Ajax_(programming) AJAX]. After adding AJAX changes, the list gets updated without reloading the entire page. The changes made are below.&lt;br /&gt;
&lt;br /&gt;
* Updated the ''shared_scripts/_user_list.html.erb'' file in views so that the Participants are listed by rendering another partial ''_participant.html.erb'' in participants controller. This change is to make it feasible to add AJAX to just append to the list without any extra formatting.&lt;br /&gt;
[[File:User_list.PNG]]&lt;br /&gt;
&lt;br /&gt;
* Created a new file ''participants/add.js.erb'' for adding AJAX to render newly added participant in case of successful addition and display error in case of any error.&lt;br /&gt;
[[File:Javascript changes.PNG]]&lt;br /&gt;
&lt;br /&gt;
* Updated the ''shared_scripts/_add_individual.html.erb'' form such that request should be through AJAX by setting remote flag to true.&lt;br /&gt;
[[File:Add_individual.PNG]]&lt;br /&gt;
&lt;br /&gt;
* Updated the participants controller ''participant_controller.rb'' in controllers to render JavaScript when add method is invoked by the form submit action instead of redirect to list page.&lt;br /&gt;
[[File:Controller_changes.PNG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Adding/Removing TA===&lt;br /&gt;
'''Earlier scenario:''' When an instructor goes to &amp;quot;Manage Courses -&amp;gt; Add TA&amp;quot; page, he/she can add/remove new TA to the course. Every time a new TA is added or removed, the page reloads to reflect the changes, even if the userid used does not exist.&lt;br /&gt;
&lt;br /&gt;
'''Updates/Changes:''' This page has been updated such that an instructor can add a new TA or remove a new TA using AJAX. With these updates, the changes are reflected on the page without reloading the page, thus saving time.&lt;br /&gt;
* Updated the ''course/view_teaching_assistants.html.erb'' file in views so that the TAs are listed by rendering another partial ''_ta.html.erb''. This is done so that when a new TA has been added, AJAX call can be used to render the format required for the new TA in the list append to the already existing list without reloading the page.&lt;br /&gt;
[[File:View_teaching_assistants_html_erb.png]]&lt;br /&gt;
&lt;br /&gt;
* Created a new file ''course/_ta.html.erb'' in views which is a partial as described above and contains the code to list the TAs. The link_to &amp;quot;Delete&amp;quot; line in this file is updated to use :remote=&amp;gt;:true, so that AJAX call can be made to remove the TA remotely without reloading the page.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;%= link_to &amp;quot;Delete&amp;quot;, { :action =&amp;gt; 'remove_ta', :controller =&amp;gt;'course', :id =&amp;gt; ta.id, :course_id =&amp;gt; ta.course_id }, method: :post, :remote =&amp;gt; true, :class =&amp;gt; 'remove_ta' %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
[[File:Ta.png]]&lt;br /&gt;
&lt;br /&gt;
* Updated the ''course/_add_individual.html.erb'' file in views to perform the form_tag action to Add a TA remotely using :remote=&amp;gt;:true. In the below code, ''form_action'' and ''remote'' are local variables passed to this partial from ''course/view_teaching_assistants.html.erb'' with the values &amp;quot;add_ta&amp;quot; and &amp;quot;true&amp;quot; respectively &lt;br /&gt;
[[File:Add_individual_html_erb.png]]&lt;br /&gt;
&lt;br /&gt;
* Updated the ''course_controller.rb&amp;quot; file and replaced the redirect option in ''add_ta'' and ''remove_ta'' to render ''add_ta.js.erb'' and ''remove_ta.js.erb''. Also changed ''flash[:error]'' to ''flash.now[:error]'' so that the flash message is displayed now instead of after page reload.&lt;br /&gt;
[[File:Course_controller_rb1.png]]&lt;br /&gt;
&lt;br /&gt;
* Added a new file ''course/add.js.erb'' and ''course/remove_ta.js.erb'' to views. The ''add_ta.js.erb'' file renders the newly added TA and appends it to the list of TAs. It also shows flash error message if the userid used to add TA does not exist. Similarly, ''remote_ta.js.erb'' file removes the deleted TA from the list.&lt;br /&gt;
[[File:add_remove_js_erb.png]]&lt;br /&gt;
&lt;br /&gt;
===Edit Questionnaire===&lt;br /&gt;
&lt;br /&gt;
'''Current scenario :''' page consists of different subsections for creating questionnaire,adding questions to the questionnaire and saving the questionnaire i.e.&lt;br /&gt;
*_questionnaire.html.erb&lt;br /&gt;
&lt;br /&gt;
Adding questions feature is performed in the following method of ''questionnaires_controller.rb'' class&lt;br /&gt;
&lt;br /&gt;
def add_new_questions&lt;br /&gt;
    questionnaire_id = params[:id] unless params[:id].nil?&lt;br /&gt;
    num_of_existed_questions = Questionnaire.find(questionnaire_id).questions.size&lt;br /&gt;
    ((num_of_existed_questions + 1)..(num_of_existed_questions + params[:question][:total_num].to_i)).each do |i|&lt;br /&gt;
      question = Object.const_get(params[:question][:type]).create(txt: '', questionnaire_id: questionnaire_id, seq: i, type: params[:question][:type], break_before: true)&lt;br /&gt;
      if question.is_a? ScoredQuestion&lt;br /&gt;
        question.weight = 1&lt;br /&gt;
        question.max_label = 'Strongly agree'&lt;br /&gt;
        question.min_label = 'Strongly disagree'&lt;br /&gt;
      end&lt;br /&gt;
      question.size = '50, 3' if question.is_a? Criterion&lt;br /&gt;
      question.alternatives = '0|1|2|3|4|5' if question.is_a? Dropdown&lt;br /&gt;
      question.size = '60, 5' if question.is_a? TextArea&lt;br /&gt;
      question.size = '30' if question.is_a? TextField&lt;br /&gt;
      begin&lt;br /&gt;
        question.save&lt;br /&gt;
      rescue&lt;br /&gt;
        flash[:error] = $ERROR_INFO&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
    redirect_to edit_questionnaire_path(questionnaire_id.to_sym)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This method invokes ''question.create'' method in ''questions_cotroller.rb'' and saves the created question to the database. Then it redirects to the ''edit.html.erb'' page which causes page refresh while adding questions.&lt;br /&gt;
&lt;br /&gt;
'''Solution:''' This problem was tried to solve using AJAX by changing or adding the following classes and pages &lt;br /&gt;
* _question.html.erb (added) - displays added question&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;td align=&amp;quot;center&amp;quot;&amp;gt;&amp;lt;a rel=&amp;quot;nofollow&amp;quot; data-method=&amp;quot;delete&amp;quot; href=&amp;quot;/questions/' &amp;lt;%= @question.id%&amp;gt; '&amp;quot;&amp;gt;Remove&amp;lt;/a&amp;gt;&amp;lt;/td&amp;gt;'&lt;br /&gt;
        &amp;lt;td&amp;gt;&amp;lt;input size=&amp;quot;6&amp;quot; value=&amp;quot;' &amp;lt;%= @question.seq%&amp;gt; '&amp;quot; name=&amp;quot;question[' question.id %&amp;gt;'][seq]&amp;quot; id=&amp;quot;question_' +&amp;lt;%=@question.id %&amp;gt; '_seq&amp;quot; type=&amp;quot;text&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
        &amp;lt;td&amp;gt;&amp;lt;textarea cols=&amp;quot;50&amp;quot; rows=&amp;quot;1&amp;quot; name=&amp;quot;question[' &amp;lt;%= @question.id%&amp;gt; '][txt]&amp;quot; id=&amp;quot;question_' &amp;lt;%= @question.id%&amp;gt; '_txt&amp;quot; placeholder=&amp;quot;Edit question content here&amp;quot;&amp;gt;' &amp;lt;%= @question.txt%&amp;gt; '&amp;lt;/textarea&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
        &amp;lt;td&amp;gt;&amp;lt;input size=&amp;quot;10&amp;quot; disabled=&amp;quot;disabled&amp;quot; value=&amp;quot;'  &amp;lt;%= @question.type%&amp;gt;  '&amp;quot; name=&amp;quot;question[' &amp;lt;%= @question.id%&amp;gt;'][type]&amp;quot; id=&amp;quot;question_' &amp;lt;%= @question.id%&amp;gt; '_type&amp;quot; type=&amp;quot;text&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
        &amp;lt;td&amp;gt;&amp;lt;!--placeholder (QuestionnaireHeader does not need weight)--&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* add_new_questions.js.erb (added) - appends the html content with added question in ''_question.html.erb'' to  questions_table in ''_questionnaire.html.erb''&lt;br /&gt;
&lt;br /&gt;
   $(&amp;quot;#questions_table&amp;quot;).append(&amp;quot;&amp;lt;%= j render :partial =&amp;gt; 'question',&lt;br /&gt;
           :locals =&amp;gt; {question: @question, :id =&amp;gt; @question.id, :controller =&amp;gt; 'questions'} %&amp;gt;&amp;quot;);&lt;br /&gt;
  &lt;br /&gt;
* edit.html.erb (modified : code removed) - following code is removed as it internally calls respective question header models and appends html string to questions_table internally.&lt;br /&gt;
      &lt;br /&gt;
      &amp;lt;% for @question in @questionnaire.questions do%&amp;gt;&lt;br /&gt;
        &amp;lt;%-# The following line call certain method of the object, which returns html string-%&amp;gt;&lt;br /&gt;
        &amp;lt;%= @question.edit %&amp;gt;&lt;br /&gt;
      &amp;lt;% end %&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
@question.edit invokes ''QuestionHeader.rb'' model which adds html content&lt;br /&gt;
     def edit(_count)&lt;br /&gt;
    html = '&amp;lt;tr&amp;gt;'&lt;br /&gt;
    html += '&amp;lt;td align=&amp;quot;center&amp;quot;&amp;gt;&amp;lt;a rel=&amp;quot;nofollow&amp;quot; data-method=&amp;quot;delete&amp;quot; href=&amp;quot;/questions/' + self.id.to_s + '&amp;quot;&amp;gt;Remove&amp;lt;/a&amp;gt;&amp;lt;/td&amp;gt;'&lt;br /&gt;
    html += '&amp;lt;td&amp;gt;&amp;lt;input size=&amp;quot;6&amp;quot; value=&amp;quot;' + self.seq.to_s + '&amp;quot; name=&amp;quot;question[' + self.id.to_s + '][seq]&amp;quot; id=&amp;quot;question_' + self.id.to_s + '_seq&amp;quot; type=&amp;quot;text&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;'&lt;br /&gt;
    html += '&amp;lt;td&amp;gt;&amp;lt;textarea cols=&amp;quot;50&amp;quot; rows=&amp;quot;1&amp;quot; name=&amp;quot;question[' + self.id.to_s + '][txt]&amp;quot; id=&amp;quot;question_' + self.id.to_s + '_txt&amp;quot; placeholder=&amp;quot;Edit question content here&amp;quot;&amp;gt;' + self.txt + '&amp;lt;/textarea&amp;gt;&amp;lt;/td&amp;gt;'&lt;br /&gt;
    html += '&amp;lt;td&amp;gt;&amp;lt;input size=&amp;quot;10&amp;quot; disabled=&amp;quot;disabled&amp;quot; value=&amp;quot;' + self.type + '&amp;quot; name=&amp;quot;question[' + self.id.to_s + '][type]&amp;quot; id=&amp;quot;question_' + self.id.to_s + '_type&amp;quot; type=&amp;quot;text&amp;quot;&amp;gt;''&amp;lt;/td&amp;gt;'&lt;br /&gt;
    html += '&amp;lt;td&amp;gt;&amp;lt;!--placeholder (QuestionnaireHeader does not need weight)--&amp;gt;&amp;lt;/td&amp;gt;'&lt;br /&gt;
    html += '&amp;lt;/tr&amp;gt;'&lt;br /&gt;
    html.html_safe&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
* questionnaires_controller.rb (modified) - add_new_questions method is modified by replacing redire rendering ''add_new_questions.js.erb'' file&lt;br /&gt;
&lt;br /&gt;
  render :action=&amp;gt; 'add_new_questions.js.erb', :layout=&amp;gt;false, :question=&amp;gt; question&lt;br /&gt;
   #redirect_to edit_questionnaire_path(questionnaire_id.to_sym)&lt;br /&gt;
&lt;br /&gt;
'''Issue :''' But this solution is not working as AJAX can be applied to the browser side processing if the controller method is redirecting to the same page, which is not in this case as page gets redirected from question.html.erb to edit.html.erb. Another problem faced is the creation of questions which is called through ''_questionnaire.html.erb'' but not through ''_question.html.erb'' which makes it difficult to pass correct questionnaire id to the AJAX call.&lt;br /&gt;
&lt;br /&gt;
'''Alternative Approach to Edit Questionnaire:''' Another approach to solve this issue is to create a seperate java-script function which handles the entire process of adding,saving,deleting questions and appending them. Call this function from ''_questionnaire.html.erb'' instead of invoking add_new_questions method. Questions can be saved and retrived from data using JavaScript Rest API calls. But, this approach not only needs to restructure entire questionnaire structure and many components in the Expertiza project but also violates the MVC design of the project.&lt;br /&gt;
&lt;br /&gt;
===Un-submit reviews===&lt;br /&gt;
'''Earlier scenario:''' When an instructor/TA goes to &amp;quot;Manage Assignments -&amp;gt; Assign Reviewers&amp;quot; page, he/she can see a list of all the topics, the contributors and the reviewers for each topic. This page did not show the status of each review which can be in Assigned state or Saved state or Submitted state. Also, there was no way for the instructor/TA to un-submit an already submitted review.&lt;br /&gt;
&lt;br /&gt;
'''New Additions:'''&lt;br /&gt;
* Updated the ''review_mappings/_list_review_mappings.html.erb'' file in views to display the status of each review by the reviewer. For each review_mapping, the code checks if there is a response in ''Response'' table with the same ''map_id'' used in the review_mappings on this page. &lt;br /&gt;
** If there is no such response, it means that the reviewer has not saved/submitted the review and it is currently in Assigned State. So, &amp;quot;Response Status: Saved&amp;quot; is shown for that review.&lt;br /&gt;
** If there is a response, the last (latest) response is checked as per requirement and the ''is_submitted'' attribute of this response is checked in the ''Response'' table.&lt;br /&gt;
*** If the attribute is false, the review has been saved but not submitted. So, &amp;quot;Response Status: Saved&amp;quot; is shown for that review.&lt;br /&gt;
*** If the attribute is true, the review has been submitted. So, &amp;quot;Response Status: Submitted&amp;quot; is shown for that review. Next to this, a link is created to un-submit the review. Clicking on this link changes the ''is_submitted'' attribute to false and updates the Response Status to Saved on the page by using AJAX call, without reloading the page&lt;br /&gt;
[[File:List_review_mappings_html_erb.png]]&lt;br /&gt;
* Added a new method &amp;quot;unsubmit_review&amp;quot; to the ''review_mapping_controller.rb'' file. In this, we first find the latest response and then update the ''is_submitted'' attribute to false. The flash message is created based on whether the response was updated correctly. After this, ''unsubmit_review.js.rb'' file is rendered which updates the response status for the corresponding review on the page to Saved, without reloading the page&lt;br /&gt;
[[File:Review_mapping_controller_rb.png]]&lt;br /&gt;
* Added a new file ''review_mappings/unsubmit_review.js.erb'' to views. This file just changes the response status for the corresponding review displayed on the page to Saved from Submit after the review has been un-submitted and also prints the corresponding success or error flash message.&lt;br /&gt;
[[File:Unsubmit_review_js_erb.png]]&lt;br /&gt;
* Added a new line to ''routes.rb'' page for unsubmit_review action&lt;br /&gt;
[[File:Routes_rb.png]]&lt;br /&gt;
&lt;br /&gt;
==Test Plan==&lt;br /&gt;
&lt;br /&gt;
===Log in details===&lt;br /&gt;
&lt;br /&gt;
'''Username:''' instructor6&lt;br /&gt;
'''password:''' password&lt;br /&gt;
&lt;br /&gt;
Some valid user id's are student5000, student5001, student5002 etc. These can be used while adding new Participant or TA as described below.&lt;br /&gt;
&lt;br /&gt;
===Automated Testing===&lt;br /&gt;
* Created a helper module ''wait_for_ajax.rb'' with methods to wait for ajax requests to finish&lt;br /&gt;
* Updated the test &amp;quot;check to see if participants can be added&amp;quot; in ''assignment_creation_spec.rb'' to wait for AJAX calls to finish after adding a participant by using the helper module created&lt;br /&gt;
* Added a new test named &amp;quot;can unsubmit a review&amp;quot; in ''review_mapping_spec.rb''&lt;br /&gt;
** In this test, a new reviewer is added to review mapping, a new review is created and submitted, and then checked if unsubmit functionality is working correctly&lt;br /&gt;
[[File:Unsubmit_review.png]]&lt;br /&gt;
* Added a new file ''course_creation_spec.rb'' to test adding and remove TA's&lt;br /&gt;
Initially the test was failing as test.db does not contain role for Teaching Assistant. So, added that role to test database.&lt;br /&gt;
[[File:Add_ta_role.png]]&lt;br /&gt;
Created test cases for adding/removing TA after visiting course page.&lt;br /&gt;
[[File:Add_ta.png]]&lt;br /&gt;
&lt;br /&gt;
===UI Testing===&lt;br /&gt;
&lt;br /&gt;
'''Steps to test adding participant: '''&lt;br /&gt;
&lt;br /&gt;
* Login as instructor&lt;br /&gt;
* Go to Manage -&amp;gt; Assignments.&lt;br /&gt;
* Switch to Assignments tab incase you are on some other tab&lt;br /&gt;
* For any assignment, click on the 'Add Participant' icon to go on add new participant page&lt;br /&gt;
* Enter userid of the participant and click on Add to add the participant&lt;br /&gt;
&lt;br /&gt;
'' Expected Output: '' When add button is clicked with valid userid, new participant should be added to the list without the page getting reloaded. In case of an attempt to add invalid user, the error should be displayed on top without page getting reloaded.&lt;br /&gt;
&lt;br /&gt;
''' Steps to test adding/removing TA:'''&lt;br /&gt;
&lt;br /&gt;
* Login as instructor&lt;br /&gt;
* Go to Manage -&amp;gt; Courses.&lt;br /&gt;
* Switch to Courses tab incase you are on some other tab&lt;br /&gt;
* For any course, click on the 'Add TA' icon to go on add new TA page&lt;br /&gt;
* Enter userid of the TA and click on Add to add the TA&lt;br /&gt;
* Click on 'remove_ta' link for any TA in the list to remove the TA&lt;br /&gt;
&lt;br /&gt;
'' Expected Output: '' When add button is clicked with valid userid, new TA should be added to the list without the page getting reloaded. In case of an attempt to add invalid user, the error should be displayed on top without page getting reloaded. When remove_ta link is clicked for any TA in the list, that corresponding TA should be removed from the list without the page getting reloaded.&lt;br /&gt;
Note: A duplicate TA is currently allowed. This was a part of original (earlier) functionality, and as this project involved changes to use AJAX and not changes to the actual functionality, this original functionality is not changed &lt;br /&gt;
&lt;br /&gt;
''' Steps to test adding question in questionnaire:'''&lt;br /&gt;
&lt;br /&gt;
* Login 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.  You will now be navigated to page where you can add new questions to the questionnaire. &lt;br /&gt;
* Click on add button in &amp;quot;Questions&amp;quot; section.&lt;br /&gt;
&lt;br /&gt;
''Expected output:'' When add button is clicked, question should be created and the questionnaire page should not get reloaded&lt;br /&gt;
&lt;br /&gt;
''' Steps to test un-submit reviews'''&lt;br /&gt;
&lt;br /&gt;
* Login as instructor&lt;br /&gt;
* Go to Manage -&amp;gt; Assignments.&lt;br /&gt;
* Switch to Assignments tab incase you are on some other tab&lt;br /&gt;
* For any assignment, click on the 'Assign reviewers' icon to go to the review mappings page&lt;br /&gt;
** Note: Some assignments might not have reviewers. So, try this for assignments with many reviewers&lt;br /&gt;
* For any review with Review Status = Submitted, click on 'unsubmit' button&lt;br /&gt;
&lt;br /&gt;
''Expected output:'' For every review, the review status should be seen as either Assigned or Saved or Submitted. For submitted reviews, when unsubmit button is clicked, that review should be unsubmitted and status should change to Saved without page getting reloaded.&lt;br /&gt;
&lt;br /&gt;
==Project Deployment==&lt;br /&gt;
&lt;br /&gt;
Expertiza setup is done in VCL which is reserved for 30 days with Ubuntu 14.04 base. Started expertiza server publicly and link to access the server is:&lt;br /&gt;
http://152.7.99.101:3000&lt;br /&gt;
&lt;br /&gt;
==Future work==&lt;br /&gt;
&lt;br /&gt;
In future, we will try to implement the edit questionnaire part using alternative approach. We will try to implement testing using rspec framework and improve the UI design of the pages.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
* https://www.youtube.com/channel/UCdKXzox7hrWjfOMML6FzTWg&lt;br /&gt;
* https://github.com/expertiza/expertiza&lt;br /&gt;
* http://wiki.expertiza.ncsu.edu/index.php/Expertiza_documentation&lt;br /&gt;
* http://guides.rubyonrails.org/working_with_javascript_in_rails.html&lt;br /&gt;
* http://wiki.expertiza.ncsu.edu/index.php/Development:Setup:Linux:Debian&lt;/div&gt;</summary>
		<author><name>Dguttik</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/Use_Ajax_to_add_Participants,TA_and_Edit_Questionnaire&amp;diff=107848</id>
		<title>CSC/ECE 517 Spring 2017/Use Ajax to add Participants,TA and Edit Questionnaire</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/Use_Ajax_to_add_Participants,TA_and_Edit_Questionnaire&amp;diff=107848"/>
		<updated>2017-04-01T04:35:24Z</updated>

		<summary type="html">&lt;p&gt;Dguttik: /* Automated Testing */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;nowiki&amp;gt;  Expertiza is an opensource software developed to assist people in education institutions to perform peer reviews and group projects. It is exceptionally helpful to the students and instructors. The software is designed in MVC (Model-View-Controller) architecture using ruby on rails.&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
Expertiza provides many categories to manage for an instructor. Few of these categories are assignments, courses and questionnaires. Currently, to add/remove/update records, the entire page is submitted to save the record and the entire page is re-loaded back again to reflect the changes on the page. The task is to improve this functionality such that some of the records, specifically adding participants to courses or assignments, adding/removing teaching assistants to/from courses and adding questions to questionnaires, can be saved remotely and the page updated without submitting and reloading the entire page. &lt;br /&gt;
Additionally, on assign reviewers page for an assignment, there is no way to see the current status of reviews and there is no way for an instructor to unsubmit a submitted review. So, another task is to add this functionality such that review status is seen for each review and to unsubmit a submitted review without reloading the page.&lt;br /&gt;
&lt;br /&gt;
==Proposed Solution==&lt;br /&gt;
This project proposes use of AJAX for the required pages to avoid page reloading at the time of adding and saving records. This solution will make sure that adding or saving of record is done remotely and the page is updated without reloading. It can be achieved by calling corresponding controller method, adding/saving the record remotely and rendering it back to JavaScript pages in the view instead of redirecting it to the same page. JavaScript pages in the view will update the page without reloading it, for example by appending the newly added record to the list of records. Thus, records are saved remotely and page refresh is avoided.&lt;br /&gt;
For the review status part, responses to the corresponding reviews on the page can be checked in the Response table and the review status shown as the status of the latest response. Unsubmitting a review can be done using AJAX without reloading the page.&lt;br /&gt;
&lt;br /&gt;
==Tasks==&lt;br /&gt;
* Add Participant in the assignments section using AJAX &lt;br /&gt;
* Add/Remove TA in the courses section using AJAX&lt;br /&gt;
* Edit Questionnaire by using AJAX for adding questions in the Questionnaire section&lt;br /&gt;
* Show Review Status on assign reviewers page and allow to un-submit a review using AJAX&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
&lt;br /&gt;
===Adding participant===&lt;br /&gt;
'''Earlier scenario:''' When an instructor goes to &amp;quot;Manage Assignments -&amp;gt; Add Participants&amp;quot; page, he/she can add/remove new Participant to the assignment. The add page also displays list of participants above the form for new participant. Every time a new Participant is added, the page reloads to reflect the changes and render the updated list of participants, even in case of non-existing userid.&lt;br /&gt;
&lt;br /&gt;
'''Updates/Changes:'''&lt;br /&gt;
This page has been updated such that an instructor can add a new Participant using [https://en.wikipedia.org/wiki/Ajax_(programming) AJAX]. After adding AJAX changes, the list gets updated without reloading the entire page. The changes made are below.&lt;br /&gt;
&lt;br /&gt;
* Updated the ''shared_scripts/_user_list.html.erb'' file in views so that the Participants are listed by rendering another partial ''_participant.html.erb'' in participants controller. This change is to make it feasible to add AJAX to just append to the list without any extra formatting.&lt;br /&gt;
[[File:User_list.PNG]]&lt;br /&gt;
&lt;br /&gt;
* Created a new file ''participants/add.js.erb'' for adding AJAX to render newly added participant in case of successful addition and display error in case of any error.&lt;br /&gt;
[[File:Javascript changes.PNG]]&lt;br /&gt;
&lt;br /&gt;
* Updated the ''shared_scripts/_add_individual.html.erb'' form such that request should be through AJAX by setting remote flag to true.&lt;br /&gt;
[[File:Add_individual.PNG]]&lt;br /&gt;
&lt;br /&gt;
* Updated the participants controller ''participant_controller.rb'' in controllers to render JavaScript when add method is invoked by the form submit action instead of redirect to list page.&lt;br /&gt;
[[File:Controller_changes.PNG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Adding/Removing TA===&lt;br /&gt;
'''Earlier scenario:''' When an instructor goes to &amp;quot;Manage Courses -&amp;gt; Add TA&amp;quot; page, he/she can add/remove new TA to the course. Every time a new TA is added or removed, the page reloads to reflect the changes, even if the userid used does not exist.&lt;br /&gt;
&lt;br /&gt;
'''Updates/Changes:''' This page has been updated such that an instructor can add a new TA or remove a new TA using AJAX. With these updates, the changes are reflected on the page without reloading the page, thus saving time.&lt;br /&gt;
* Updated the ''course/view_teaching_assistants.html.erb'' file in views so that the TAs are listed by rendering another partial ''_ta.html.erb''. This is done so that when a new TA has been added, AJAX call can be used to render the format required for the new TA in the list append to the already existing list without reloading the page.&lt;br /&gt;
[[File:View_teaching_assistants_html_erb.png]]&lt;br /&gt;
&lt;br /&gt;
* Created a new file ''course/_ta.html.erb'' in views which is a partial as described above and contains the code to list the TAs. The link_to &amp;quot;Delete&amp;quot; line in this file is updated to use :remote=&amp;gt;:true, so that AJAX call can be made to remove the TA remotely without reloading the page.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;%= link_to &amp;quot;Delete&amp;quot;, { :action =&amp;gt; 'remove_ta', :controller =&amp;gt;'course', :id =&amp;gt; ta.id, :course_id =&amp;gt; ta.course_id }, method: :post, :remote =&amp;gt; true, :class =&amp;gt; 'remove_ta' %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
[[File:Ta.png]]&lt;br /&gt;
&lt;br /&gt;
* Updated the ''course/_add_individual.html.erb'' file in views to perform the form_tag action to Add a TA remotely using :remote=&amp;gt;:true. In the below code, ''form_action'' and ''remote'' are local variables passed to this partial from ''course/view_teaching_assistants.html.erb'' with the values &amp;quot;add_ta&amp;quot; and &amp;quot;true&amp;quot; respectively &lt;br /&gt;
[[File:Add_individual_html_erb.png]]&lt;br /&gt;
&lt;br /&gt;
* Updated the ''course_controller.rb&amp;quot; file and replaced the redirect option in ''add_ta'' and ''remove_ta'' to render ''add_ta.js.erb'' and ''remove_ta.js.erb''. Also changed ''flash[:error]'' to ''flash.now[:error]'' so that the flash message is displayed now instead of after page reload.&lt;br /&gt;
[[File:Course_controller_rb1.png]]&lt;br /&gt;
&lt;br /&gt;
* Added a new file ''course/add.js.erb'' and ''course/remove_ta.js.erb'' to views. The ''add_ta.js.erb'' file renders the newly added TA and appends it to the list of TAs. It also shows flash error message if the userid used to add TA does not exist. Similarly, ''remote_ta.js.erb'' file removes the deleted TA from the list.&lt;br /&gt;
[[File:add_remove_js_erb.png]]&lt;br /&gt;
&lt;br /&gt;
===Edit Questionnaire===&lt;br /&gt;
&lt;br /&gt;
'''Current scenario :''' page consists of different subsections for creating questionnaire,adding questions to the questionnaire and saving the questionnaire i.e.&lt;br /&gt;
*_questionnaire.html.erb&lt;br /&gt;
&lt;br /&gt;
Adding questions feature is performed in the following method of ''questionnaires_controller.rb'' class&lt;br /&gt;
&lt;br /&gt;
def add_new_questions&lt;br /&gt;
    questionnaire_id = params[:id] unless params[:id].nil?&lt;br /&gt;
    num_of_existed_questions = Questionnaire.find(questionnaire_id).questions.size&lt;br /&gt;
    ((num_of_existed_questions + 1)..(num_of_existed_questions + params[:question][:total_num].to_i)).each do |i|&lt;br /&gt;
      question = Object.const_get(params[:question][:type]).create(txt: '', questionnaire_id: questionnaire_id, seq: i, type: params[:question][:type], break_before: true)&lt;br /&gt;
      if question.is_a? ScoredQuestion&lt;br /&gt;
        question.weight = 1&lt;br /&gt;
        question.max_label = 'Strongly agree'&lt;br /&gt;
        question.min_label = 'Strongly disagree'&lt;br /&gt;
      end&lt;br /&gt;
      question.size = '50, 3' if question.is_a? Criterion&lt;br /&gt;
      question.alternatives = '0|1|2|3|4|5' if question.is_a? Dropdown&lt;br /&gt;
      question.size = '60, 5' if question.is_a? TextArea&lt;br /&gt;
      question.size = '30' if question.is_a? TextField&lt;br /&gt;
      begin&lt;br /&gt;
        question.save&lt;br /&gt;
      rescue&lt;br /&gt;
        flash[:error] = $ERROR_INFO&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
    redirect_to edit_questionnaire_path(questionnaire_id.to_sym)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This method invokes ''question.create'' method in ''questions_cotroller.rb'' and saves the created question to the database. Then it redirects to the ''edit.html.erb'' page which causes page refresh while adding questions.&lt;br /&gt;
&lt;br /&gt;
'''Solution:''' This problem was tried to solve using AJAX by changing or adding the following classes and pages &lt;br /&gt;
* _question.html.erb (added) - displays added question&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;td align=&amp;quot;center&amp;quot;&amp;gt;&amp;lt;a rel=&amp;quot;nofollow&amp;quot; data-method=&amp;quot;delete&amp;quot; href=&amp;quot;/questions/' &amp;lt;%= @question.id%&amp;gt; '&amp;quot;&amp;gt;Remove&amp;lt;/a&amp;gt;&amp;lt;/td&amp;gt;'&lt;br /&gt;
        &amp;lt;td&amp;gt;&amp;lt;input size=&amp;quot;6&amp;quot; value=&amp;quot;' &amp;lt;%= @question.seq%&amp;gt; '&amp;quot; name=&amp;quot;question[' question.id %&amp;gt;'][seq]&amp;quot; id=&amp;quot;question_' +&amp;lt;%=@question.id %&amp;gt; '_seq&amp;quot; type=&amp;quot;text&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
        &amp;lt;td&amp;gt;&amp;lt;textarea cols=&amp;quot;50&amp;quot; rows=&amp;quot;1&amp;quot; name=&amp;quot;question[' &amp;lt;%= @question.id%&amp;gt; '][txt]&amp;quot; id=&amp;quot;question_' &amp;lt;%= @question.id%&amp;gt; '_txt&amp;quot; placeholder=&amp;quot;Edit question content here&amp;quot;&amp;gt;' &amp;lt;%= @question.txt%&amp;gt; '&amp;lt;/textarea&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
        &amp;lt;td&amp;gt;&amp;lt;input size=&amp;quot;10&amp;quot; disabled=&amp;quot;disabled&amp;quot; value=&amp;quot;'  &amp;lt;%= @question.type%&amp;gt;  '&amp;quot; name=&amp;quot;question[' &amp;lt;%= @question.id%&amp;gt;'][type]&amp;quot; id=&amp;quot;question_' &amp;lt;%= @question.id%&amp;gt; '_type&amp;quot; type=&amp;quot;text&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
        &amp;lt;td&amp;gt;&amp;lt;!--placeholder (QuestionnaireHeader does not need weight)--&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* add_new_questions.js.erb (added) - appends the html content with added question in ''_question.html.erb'' to  questions_table in ''_questionnaire.html.erb''&lt;br /&gt;
&lt;br /&gt;
   $(&amp;quot;#questions_table&amp;quot;).append(&amp;quot;&amp;lt;%= j render :partial =&amp;gt; 'question',&lt;br /&gt;
           :locals =&amp;gt; {question: @question, :id =&amp;gt; @question.id, :controller =&amp;gt; 'questions'} %&amp;gt;&amp;quot;);&lt;br /&gt;
  &lt;br /&gt;
* edit.html.erb (modified : code removed) - following code is removed as it internally calls respective question header models and appends html string to questions_table internally.&lt;br /&gt;
      &lt;br /&gt;
      &amp;lt;% for @question in @questionnaire.questions do%&amp;gt;&lt;br /&gt;
        &amp;lt;%-# The following line call certain method of the object, which returns html string-%&amp;gt;&lt;br /&gt;
        &amp;lt;%= @question.edit %&amp;gt;&lt;br /&gt;
      &amp;lt;% end %&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
@question.edit invokes ''QuestionHeader.rb'' model which adds html content&lt;br /&gt;
     def edit(_count)&lt;br /&gt;
    html = '&amp;lt;tr&amp;gt;'&lt;br /&gt;
    html += '&amp;lt;td align=&amp;quot;center&amp;quot;&amp;gt;&amp;lt;a rel=&amp;quot;nofollow&amp;quot; data-method=&amp;quot;delete&amp;quot; href=&amp;quot;/questions/' + self.id.to_s + '&amp;quot;&amp;gt;Remove&amp;lt;/a&amp;gt;&amp;lt;/td&amp;gt;'&lt;br /&gt;
    html += '&amp;lt;td&amp;gt;&amp;lt;input size=&amp;quot;6&amp;quot; value=&amp;quot;' + self.seq.to_s + '&amp;quot; name=&amp;quot;question[' + self.id.to_s + '][seq]&amp;quot; id=&amp;quot;question_' + self.id.to_s + '_seq&amp;quot; type=&amp;quot;text&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;'&lt;br /&gt;
    html += '&amp;lt;td&amp;gt;&amp;lt;textarea cols=&amp;quot;50&amp;quot; rows=&amp;quot;1&amp;quot; name=&amp;quot;question[' + self.id.to_s + '][txt]&amp;quot; id=&amp;quot;question_' + self.id.to_s + '_txt&amp;quot; placeholder=&amp;quot;Edit question content here&amp;quot;&amp;gt;' + self.txt + '&amp;lt;/textarea&amp;gt;&amp;lt;/td&amp;gt;'&lt;br /&gt;
    html += '&amp;lt;td&amp;gt;&amp;lt;input size=&amp;quot;10&amp;quot; disabled=&amp;quot;disabled&amp;quot; value=&amp;quot;' + self.type + '&amp;quot; name=&amp;quot;question[' + self.id.to_s + '][type]&amp;quot; id=&amp;quot;question_' + self.id.to_s + '_type&amp;quot; type=&amp;quot;text&amp;quot;&amp;gt;''&amp;lt;/td&amp;gt;'&lt;br /&gt;
    html += '&amp;lt;td&amp;gt;&amp;lt;!--placeholder (QuestionnaireHeader does not need weight)--&amp;gt;&amp;lt;/td&amp;gt;'&lt;br /&gt;
    html += '&amp;lt;/tr&amp;gt;'&lt;br /&gt;
    html.html_safe&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
* questionnaires_controller.rb (modified) - add_new_questions method is modified by replacing redire rendering ''add_new_questions.js.erb'' file&lt;br /&gt;
&lt;br /&gt;
  render :action=&amp;gt; 'add_new_questions.js.erb', :layout=&amp;gt;false, :question=&amp;gt; question&lt;br /&gt;
   #redirect_to edit_questionnaire_path(questionnaire_id.to_sym)&lt;br /&gt;
&lt;br /&gt;
'''Issue :''' But this solution is not working as AJAX can be applied to the browser side processing if the controller method is redirecting to the same page, which is not in this case as page gets redirected from question.html.erb to edit.html.erb. Another problem faced is the creation of questions which is called through ''_questionnaire.html.erb'' but not through ''_question.html.erb'' which makes it difficult to pass correct questionnaire id to the AJAX call.&lt;br /&gt;
&lt;br /&gt;
'''Alternative Approach to Edit Questionnaire:''' Another approach to solve this issue is to create a seperate java-script function which handles the entire process of adding,saving,deleting questions and appending them. Call this function from ''_questionnaire.html.erb'' instead of invoking add_new_questions method. Questions can be saved and retrived from data using JavaScript Rest API calls. But, this approach not only needs to restructure entire questionnaire structure and many components in the Expertiza project but also violates the MVC design of the project.&lt;br /&gt;
&lt;br /&gt;
===Un-submit reviews===&lt;br /&gt;
'''Earlier scenario:''' When an instructor/TA goes to &amp;quot;Manage Assignments -&amp;gt; Assign Reviewers&amp;quot; page, he/she can see a list of all the topics, the contributors and the reviewers for each topic. This page did not show the status of each review which can be in Assigned state or Saved state or Submitted state. Also, there was no way for the instructor/TA to un-submit an already submitted review.&lt;br /&gt;
&lt;br /&gt;
'''New Additions:'''&lt;br /&gt;
* Updated the ''review_mappings/_list_review_mappings.html.erb'' file in views to display the status of each review by the reviewer. For each review_mapping, the code checks if there is a response in ''Response'' table with the same ''map_id'' used in the review_mappings on this page. &lt;br /&gt;
** If there is no such response, it means that the reviewer has not saved/submitted the review and it is currently in Assigned State. So, &amp;quot;Response Status: Saved&amp;quot; is shown for that review.&lt;br /&gt;
** If there is a response, the last (latest) response is checked as per requirement and the ''is_submitted'' attribute of this response is checked in the ''Response'' table.&lt;br /&gt;
*** If the attribute is false, the review has been saved but not submitted. So, &amp;quot;Response Status: Saved&amp;quot; is shown for that review.&lt;br /&gt;
*** If the attribute is true, the review has been submitted. So, &amp;quot;Response Status: Submitted&amp;quot; is shown for that review. Next to this, a link is created to un-submit the review. Clicking on this link changes the ''is_submitted'' attribute to false and updates the Response Status to Saved on the page by using AJAX call, without reloading the page&lt;br /&gt;
[[File:List_review_mappings_html_erb.png]]&lt;br /&gt;
* Added a new method &amp;quot;unsubmit_review&amp;quot; to the ''review_mapping_controller.rb'' file. In this, we first find the latest response and then update the ''is_submitted'' attribute to false. The flash message is created based on whether the response was updated correctly. After this, ''unsubmit_review.js.rb'' file is rendered which updates the response status for the corresponding review on the page to Saved, without reloading the page&lt;br /&gt;
[[File:Review_mapping_controller_rb.png]]&lt;br /&gt;
* Added a new file ''review_mappings/unsubmit_review.js.erb'' to views. This file just changes the response status for the corresponding review displayed on the page to Saved from Submit after the review has been un-submitted and also prints the corresponding success or error flash message.&lt;br /&gt;
[[File:Unsubmit_review_js_erb.png]]&lt;br /&gt;
* Added a new line to ''routes.rb'' page for unsubmit_review action&lt;br /&gt;
[[File:Routes_rb.png]]&lt;br /&gt;
&lt;br /&gt;
==Test Plan==&lt;br /&gt;
&lt;br /&gt;
===Log in details===&lt;br /&gt;
&lt;br /&gt;
'''Username:''' instructor6&lt;br /&gt;
'''password:''' password&lt;br /&gt;
&lt;br /&gt;
Some valid user id's are student5000, student5001, student5002 etc. These can be used while adding new Participant or TA as described below.&lt;br /&gt;
&lt;br /&gt;
===Automated Testing===&lt;br /&gt;
* Created a helper module ''wait_for_ajax.rb'' with methods to wait for ajax requests to finish&lt;br /&gt;
* Updated the test &amp;quot;check to see if participants can be added&amp;quot; in ''assignment_creation_spec.rb'' to wait for AJAX calls to finish after adding a participant by using the helper module created&lt;br /&gt;
* Added a new test named &amp;quot;can unsubmit a review&amp;quot; in ''review_mapping_spec.rb''&lt;br /&gt;
[[File:Unsubmit_review.png]]&lt;br /&gt;
** In this test, a new reviewer is added to review mapping, a new review is created and submitted, and then checked if unsubmit functionality is working correctly&lt;br /&gt;
* Added a new file ''course_creation_spec.rb'' to test adding and remove TA's&lt;br /&gt;
Initially the test was failing as test.db does not contain role for Teaching Assistant. So, added that role to test database.&lt;br /&gt;
[[File:Add_ta_role.png]]&lt;br /&gt;
Created test cases for adding/removing TA after visiting course page.&lt;br /&gt;
[[File:Add_ta.png]]&lt;br /&gt;
&lt;br /&gt;
===UI Testing===&lt;br /&gt;
&lt;br /&gt;
'''Steps to test adding participant: '''&lt;br /&gt;
&lt;br /&gt;
* Login as instructor&lt;br /&gt;
* Go to Manage -&amp;gt; Assignments.&lt;br /&gt;
* Switch to Assignments tab incase you are on some other tab&lt;br /&gt;
* For any assignment, click on the 'Add Participant' icon to go on add new participant page&lt;br /&gt;
* Enter userid of the participant and click on Add to add the participant&lt;br /&gt;
&lt;br /&gt;
'' Expected Output: '' When add button is clicked with valid userid, new participant should be added to the list without the page getting reloaded. In case of an attempt to add invalid user, the error should be displayed on top without page getting reloaded.&lt;br /&gt;
&lt;br /&gt;
''' Steps to test adding/removing TA:'''&lt;br /&gt;
&lt;br /&gt;
* Login as instructor&lt;br /&gt;
* Go to Manage -&amp;gt; Courses.&lt;br /&gt;
* Switch to Courses tab incase you are on some other tab&lt;br /&gt;
* For any course, click on the 'Add TA' icon to go on add new TA page&lt;br /&gt;
* Enter userid of the TA and click on Add to add the TA&lt;br /&gt;
* Click on 'remove_ta' link for any TA in the list to remove the TA&lt;br /&gt;
&lt;br /&gt;
'' Expected Output: '' When add button is clicked with valid userid, new TA should be added to the list without the page getting reloaded. In case of an attempt to add invalid user, the error should be displayed on top without page getting reloaded. When remove_ta link is clicked for any TA in the list, that corresponding TA should be removed from the list without the page getting reloaded.&lt;br /&gt;
Note: A duplicate TA is currently allowed. This was a part of original (earlier) functionality, and as this project involved changes to use AJAX and not changes to the actual functionality, this original functionality is not changed &lt;br /&gt;
&lt;br /&gt;
''' Steps to test adding question in questionnaire:'''&lt;br /&gt;
&lt;br /&gt;
* Login 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.  You will now be navigated to page where you can add new questions to the questionnaire. &lt;br /&gt;
* Click on add button in &amp;quot;Questions&amp;quot; section.&lt;br /&gt;
&lt;br /&gt;
''Expected output:'' When add button is clicked, question should be created and the questionnaire page should not get reloaded&lt;br /&gt;
&lt;br /&gt;
''' Steps to test un-submit reviews'''&lt;br /&gt;
&lt;br /&gt;
* Login as instructor&lt;br /&gt;
* Go to Manage -&amp;gt; Assignments.&lt;br /&gt;
* Switch to Assignments tab incase you are on some other tab&lt;br /&gt;
* For any assignment, click on the 'Assign reviewers' icon to go to the review mappings page&lt;br /&gt;
** Note: Some assignments might not have reviewers. So, try this for assignments with many reviewers&lt;br /&gt;
* For any review with Review Status = Submitted, click on 'unsubmit' button&lt;br /&gt;
&lt;br /&gt;
''Expected output:'' For every review, the review status should be seen as either Assigned or Saved or Submitted. For submitted reviews, when unsubmit button is clicked, that review should be unsubmitted and status should change to Saved without page getting reloaded.&lt;br /&gt;
&lt;br /&gt;
==Project Deployment==&lt;br /&gt;
&lt;br /&gt;
Expertiza setup is done in VCL which is reserved for 30 days with Ubuntu 14.04 base. Started expertiza server publicly and link to access the server is:&lt;br /&gt;
http://152.7.99.101:3000&lt;br /&gt;
&lt;br /&gt;
==Future work==&lt;br /&gt;
&lt;br /&gt;
In future, we will try to implement the edit questionnaire part using alternative approach. We will try to implement testing using rspec framework and improve the UI design of the pages.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
* https://www.youtube.com/channel/UCdKXzox7hrWjfOMML6FzTWg&lt;br /&gt;
* https://github.com/expertiza/expertiza&lt;br /&gt;
* http://wiki.expertiza.ncsu.edu/index.php/Expertiza_documentation&lt;br /&gt;
* http://guides.rubyonrails.org/working_with_javascript_in_rails.html&lt;br /&gt;
* http://wiki.expertiza.ncsu.edu/index.php/Development:Setup:Linux:Debian&lt;/div&gt;</summary>
		<author><name>Dguttik</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Unsubmit_review.png&amp;diff=107847</id>
		<title>File:Unsubmit review.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Unsubmit_review.png&amp;diff=107847"/>
		<updated>2017-04-01T04:34:13Z</updated>

		<summary type="html">&lt;p&gt;Dguttik: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Dguttik</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/Use_Ajax_to_add_Participants,TA_and_Edit_Questionnaire&amp;diff=107846</id>
		<title>CSC/ECE 517 Spring 2017/Use Ajax to add Participants,TA and Edit Questionnaire</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/Use_Ajax_to_add_Participants,TA_and_Edit_Questionnaire&amp;diff=107846"/>
		<updated>2017-04-01T04:31:09Z</updated>

		<summary type="html">&lt;p&gt;Dguttik: /* Automated Testing */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;nowiki&amp;gt;  Expertiza is an opensource software developed to assist people in education institutions to perform peer reviews and group projects. It is exceptionally helpful to the students and instructors. The software is designed in MVC (Model-View-Controller) architecture using ruby on rails.&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
Expertiza provides many categories to manage for an instructor. Few of these categories are assignments, courses and questionnaires. Currently, to add/remove/update records, the entire page is submitted to save the record and the entire page is re-loaded back again to reflect the changes on the page. The task is to improve this functionality such that some of the records, specifically adding participants to courses or assignments, adding/removing teaching assistants to/from courses and adding questions to questionnaires, can be saved remotely and the page updated without submitting and reloading the entire page. &lt;br /&gt;
Additionally, on assign reviewers page for an assignment, there is no way to see the current status of reviews and there is no way for an instructor to unsubmit a submitted review. So, another task is to add this functionality such that review status is seen for each review and to unsubmit a submitted review without reloading the page.&lt;br /&gt;
&lt;br /&gt;
==Proposed Solution==&lt;br /&gt;
This project proposes use of AJAX for the required pages to avoid page reloading at the time of adding and saving records. This solution will make sure that adding or saving of record is done remotely and the page is updated without reloading. It can be achieved by calling corresponding controller method, adding/saving the record remotely and rendering it back to JavaScript pages in the view instead of redirecting it to the same page. JavaScript pages in the view will update the page without reloading it, for example by appending the newly added record to the list of records. Thus, records are saved remotely and page refresh is avoided.&lt;br /&gt;
For the review status part, responses to the corresponding reviews on the page can be checked in the Response table and the review status shown as the status of the latest response. Unsubmitting a review can be done using AJAX without reloading the page.&lt;br /&gt;
&lt;br /&gt;
==Tasks==&lt;br /&gt;
* Add Participant in the assignments section using AJAX &lt;br /&gt;
* Add/Remove TA in the courses section using AJAX&lt;br /&gt;
* Edit Questionnaire by using AJAX for adding questions in the Questionnaire section&lt;br /&gt;
* Show Review Status on assign reviewers page and allow to un-submit a review using AJAX&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
&lt;br /&gt;
===Adding participant===&lt;br /&gt;
'''Earlier scenario:''' When an instructor goes to &amp;quot;Manage Assignments -&amp;gt; Add Participants&amp;quot; page, he/she can add/remove new Participant to the assignment. The add page also displays list of participants above the form for new participant. Every time a new Participant is added, the page reloads to reflect the changes and render the updated list of participants, even in case of non-existing userid.&lt;br /&gt;
&lt;br /&gt;
'''Updates/Changes:'''&lt;br /&gt;
This page has been updated such that an instructor can add a new Participant using [https://en.wikipedia.org/wiki/Ajax_(programming) AJAX]. After adding AJAX changes, the list gets updated without reloading the entire page. The changes made are below.&lt;br /&gt;
&lt;br /&gt;
* Updated the ''shared_scripts/_user_list.html.erb'' file in views so that the Participants are listed by rendering another partial ''_participant.html.erb'' in participants controller. This change is to make it feasible to add AJAX to just append to the list without any extra formatting.&lt;br /&gt;
[[File:User_list.PNG]]&lt;br /&gt;
&lt;br /&gt;
* Created a new file ''participants/add.js.erb'' for adding AJAX to render newly added participant in case of successful addition and display error in case of any error.&lt;br /&gt;
[[File:Javascript changes.PNG]]&lt;br /&gt;
&lt;br /&gt;
* Updated the ''shared_scripts/_add_individual.html.erb'' form such that request should be through AJAX by setting remote flag to true.&lt;br /&gt;
[[File:Add_individual.PNG]]&lt;br /&gt;
&lt;br /&gt;
* Updated the participants controller ''participant_controller.rb'' in controllers to render JavaScript when add method is invoked by the form submit action instead of redirect to list page.&lt;br /&gt;
[[File:Controller_changes.PNG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Adding/Removing TA===&lt;br /&gt;
'''Earlier scenario:''' When an instructor goes to &amp;quot;Manage Courses -&amp;gt; Add TA&amp;quot; page, he/she can add/remove new TA to the course. Every time a new TA is added or removed, the page reloads to reflect the changes, even if the userid used does not exist.&lt;br /&gt;
&lt;br /&gt;
'''Updates/Changes:''' This page has been updated such that an instructor can add a new TA or remove a new TA using AJAX. With these updates, the changes are reflected on the page without reloading the page, thus saving time.&lt;br /&gt;
* Updated the ''course/view_teaching_assistants.html.erb'' file in views so that the TAs are listed by rendering another partial ''_ta.html.erb''. This is done so that when a new TA has been added, AJAX call can be used to render the format required for the new TA in the list append to the already existing list without reloading the page.&lt;br /&gt;
[[File:View_teaching_assistants_html_erb.png]]&lt;br /&gt;
&lt;br /&gt;
* Created a new file ''course/_ta.html.erb'' in views which is a partial as described above and contains the code to list the TAs. The link_to &amp;quot;Delete&amp;quot; line in this file is updated to use :remote=&amp;gt;:true, so that AJAX call can be made to remove the TA remotely without reloading the page.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;%= link_to &amp;quot;Delete&amp;quot;, { :action =&amp;gt; 'remove_ta', :controller =&amp;gt;'course', :id =&amp;gt; ta.id, :course_id =&amp;gt; ta.course_id }, method: :post, :remote =&amp;gt; true, :class =&amp;gt; 'remove_ta' %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
[[File:Ta.png]]&lt;br /&gt;
&lt;br /&gt;
* Updated the ''course/_add_individual.html.erb'' file in views to perform the form_tag action to Add a TA remotely using :remote=&amp;gt;:true. In the below code, ''form_action'' and ''remote'' are local variables passed to this partial from ''course/view_teaching_assistants.html.erb'' with the values &amp;quot;add_ta&amp;quot; and &amp;quot;true&amp;quot; respectively &lt;br /&gt;
[[File:Add_individual_html_erb.png]]&lt;br /&gt;
&lt;br /&gt;
* Updated the ''course_controller.rb&amp;quot; file and replaced the redirect option in ''add_ta'' and ''remove_ta'' to render ''add_ta.js.erb'' and ''remove_ta.js.erb''. Also changed ''flash[:error]'' to ''flash.now[:error]'' so that the flash message is displayed now instead of after page reload.&lt;br /&gt;
[[File:Course_controller_rb1.png]]&lt;br /&gt;
&lt;br /&gt;
* Added a new file ''course/add.js.erb'' and ''course/remove_ta.js.erb'' to views. The ''add_ta.js.erb'' file renders the newly added TA and appends it to the list of TAs. It also shows flash error message if the userid used to add TA does not exist. Similarly, ''remote_ta.js.erb'' file removes the deleted TA from the list.&lt;br /&gt;
[[File:add_remove_js_erb.png]]&lt;br /&gt;
&lt;br /&gt;
===Edit Questionnaire===&lt;br /&gt;
&lt;br /&gt;
'''Current scenario :''' page consists of different subsections for creating questionnaire,adding questions to the questionnaire and saving the questionnaire i.e.&lt;br /&gt;
*_questionnaire.html.erb&lt;br /&gt;
&lt;br /&gt;
Adding questions feature is performed in the following method of ''questionnaires_controller.rb'' class&lt;br /&gt;
&lt;br /&gt;
def add_new_questions&lt;br /&gt;
    questionnaire_id = params[:id] unless params[:id].nil?&lt;br /&gt;
    num_of_existed_questions = Questionnaire.find(questionnaire_id).questions.size&lt;br /&gt;
    ((num_of_existed_questions + 1)..(num_of_existed_questions + params[:question][:total_num].to_i)).each do |i|&lt;br /&gt;
      question = Object.const_get(params[:question][:type]).create(txt: '', questionnaire_id: questionnaire_id, seq: i, type: params[:question][:type], break_before: true)&lt;br /&gt;
      if question.is_a? ScoredQuestion&lt;br /&gt;
        question.weight = 1&lt;br /&gt;
        question.max_label = 'Strongly agree'&lt;br /&gt;
        question.min_label = 'Strongly disagree'&lt;br /&gt;
      end&lt;br /&gt;
      question.size = '50, 3' if question.is_a? Criterion&lt;br /&gt;
      question.alternatives = '0|1|2|3|4|5' if question.is_a? Dropdown&lt;br /&gt;
      question.size = '60, 5' if question.is_a? TextArea&lt;br /&gt;
      question.size = '30' if question.is_a? TextField&lt;br /&gt;
      begin&lt;br /&gt;
        question.save&lt;br /&gt;
      rescue&lt;br /&gt;
        flash[:error] = $ERROR_INFO&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
    redirect_to edit_questionnaire_path(questionnaire_id.to_sym)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This method invokes ''question.create'' method in ''questions_cotroller.rb'' and saves the created question to the database. Then it redirects to the ''edit.html.erb'' page which causes page refresh while adding questions.&lt;br /&gt;
&lt;br /&gt;
'''Solution:''' This problem was tried to solve using AJAX by changing or adding the following classes and pages &lt;br /&gt;
* _question.html.erb (added) - displays added question&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;td align=&amp;quot;center&amp;quot;&amp;gt;&amp;lt;a rel=&amp;quot;nofollow&amp;quot; data-method=&amp;quot;delete&amp;quot; href=&amp;quot;/questions/' &amp;lt;%= @question.id%&amp;gt; '&amp;quot;&amp;gt;Remove&amp;lt;/a&amp;gt;&amp;lt;/td&amp;gt;'&lt;br /&gt;
        &amp;lt;td&amp;gt;&amp;lt;input size=&amp;quot;6&amp;quot; value=&amp;quot;' &amp;lt;%= @question.seq%&amp;gt; '&amp;quot; name=&amp;quot;question[' question.id %&amp;gt;'][seq]&amp;quot; id=&amp;quot;question_' +&amp;lt;%=@question.id %&amp;gt; '_seq&amp;quot; type=&amp;quot;text&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
        &amp;lt;td&amp;gt;&amp;lt;textarea cols=&amp;quot;50&amp;quot; rows=&amp;quot;1&amp;quot; name=&amp;quot;question[' &amp;lt;%= @question.id%&amp;gt; '][txt]&amp;quot; id=&amp;quot;question_' &amp;lt;%= @question.id%&amp;gt; '_txt&amp;quot; placeholder=&amp;quot;Edit question content here&amp;quot;&amp;gt;' &amp;lt;%= @question.txt%&amp;gt; '&amp;lt;/textarea&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
        &amp;lt;td&amp;gt;&amp;lt;input size=&amp;quot;10&amp;quot; disabled=&amp;quot;disabled&amp;quot; value=&amp;quot;'  &amp;lt;%= @question.type%&amp;gt;  '&amp;quot; name=&amp;quot;question[' &amp;lt;%= @question.id%&amp;gt;'][type]&amp;quot; id=&amp;quot;question_' &amp;lt;%= @question.id%&amp;gt; '_type&amp;quot; type=&amp;quot;text&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
        &amp;lt;td&amp;gt;&amp;lt;!--placeholder (QuestionnaireHeader does not need weight)--&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* add_new_questions.js.erb (added) - appends the html content with added question in ''_question.html.erb'' to  questions_table in ''_questionnaire.html.erb''&lt;br /&gt;
&lt;br /&gt;
   $(&amp;quot;#questions_table&amp;quot;).append(&amp;quot;&amp;lt;%= j render :partial =&amp;gt; 'question',&lt;br /&gt;
           :locals =&amp;gt; {question: @question, :id =&amp;gt; @question.id, :controller =&amp;gt; 'questions'} %&amp;gt;&amp;quot;);&lt;br /&gt;
  &lt;br /&gt;
* edit.html.erb (modified : code removed) - following code is removed as it internally calls respective question header models and appends html string to questions_table internally.&lt;br /&gt;
      &lt;br /&gt;
      &amp;lt;% for @question in @questionnaire.questions do%&amp;gt;&lt;br /&gt;
        &amp;lt;%-# The following line call certain method of the object, which returns html string-%&amp;gt;&lt;br /&gt;
        &amp;lt;%= @question.edit %&amp;gt;&lt;br /&gt;
      &amp;lt;% end %&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
@question.edit invokes ''QuestionHeader.rb'' model which adds html content&lt;br /&gt;
     def edit(_count)&lt;br /&gt;
    html = '&amp;lt;tr&amp;gt;'&lt;br /&gt;
    html += '&amp;lt;td align=&amp;quot;center&amp;quot;&amp;gt;&amp;lt;a rel=&amp;quot;nofollow&amp;quot; data-method=&amp;quot;delete&amp;quot; href=&amp;quot;/questions/' + self.id.to_s + '&amp;quot;&amp;gt;Remove&amp;lt;/a&amp;gt;&amp;lt;/td&amp;gt;'&lt;br /&gt;
    html += '&amp;lt;td&amp;gt;&amp;lt;input size=&amp;quot;6&amp;quot; value=&amp;quot;' + self.seq.to_s + '&amp;quot; name=&amp;quot;question[' + self.id.to_s + '][seq]&amp;quot; id=&amp;quot;question_' + self.id.to_s + '_seq&amp;quot; type=&amp;quot;text&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;'&lt;br /&gt;
    html += '&amp;lt;td&amp;gt;&amp;lt;textarea cols=&amp;quot;50&amp;quot; rows=&amp;quot;1&amp;quot; name=&amp;quot;question[' + self.id.to_s + '][txt]&amp;quot; id=&amp;quot;question_' + self.id.to_s + '_txt&amp;quot; placeholder=&amp;quot;Edit question content here&amp;quot;&amp;gt;' + self.txt + '&amp;lt;/textarea&amp;gt;&amp;lt;/td&amp;gt;'&lt;br /&gt;
    html += '&amp;lt;td&amp;gt;&amp;lt;input size=&amp;quot;10&amp;quot; disabled=&amp;quot;disabled&amp;quot; value=&amp;quot;' + self.type + '&amp;quot; name=&amp;quot;question[' + self.id.to_s + '][type]&amp;quot; id=&amp;quot;question_' + self.id.to_s + '_type&amp;quot; type=&amp;quot;text&amp;quot;&amp;gt;''&amp;lt;/td&amp;gt;'&lt;br /&gt;
    html += '&amp;lt;td&amp;gt;&amp;lt;!--placeholder (QuestionnaireHeader does not need weight)--&amp;gt;&amp;lt;/td&amp;gt;'&lt;br /&gt;
    html += '&amp;lt;/tr&amp;gt;'&lt;br /&gt;
    html.html_safe&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
* questionnaires_controller.rb (modified) - add_new_questions method is modified by replacing redire rendering ''add_new_questions.js.erb'' file&lt;br /&gt;
&lt;br /&gt;
  render :action=&amp;gt; 'add_new_questions.js.erb', :layout=&amp;gt;false, :question=&amp;gt; question&lt;br /&gt;
   #redirect_to edit_questionnaire_path(questionnaire_id.to_sym)&lt;br /&gt;
&lt;br /&gt;
'''Issue :''' But this solution is not working as AJAX can be applied to the browser side processing if the controller method is redirecting to the same page, which is not in this case as page gets redirected from question.html.erb to edit.html.erb. Another problem faced is the creation of questions which is called through ''_questionnaire.html.erb'' but not through ''_question.html.erb'' which makes it difficult to pass correct questionnaire id to the AJAX call.&lt;br /&gt;
&lt;br /&gt;
'''Alternative Approach to Edit Questionnaire:''' Another approach to solve this issue is to create a seperate java-script function which handles the entire process of adding,saving,deleting questions and appending them. Call this function from ''_questionnaire.html.erb'' instead of invoking add_new_questions method. Questions can be saved and retrived from data using JavaScript Rest API calls. But, this approach not only needs to restructure entire questionnaire structure and many components in the Expertiza project but also violates the MVC design of the project.&lt;br /&gt;
&lt;br /&gt;
===Un-submit reviews===&lt;br /&gt;
'''Earlier scenario:''' When an instructor/TA goes to &amp;quot;Manage Assignments -&amp;gt; Assign Reviewers&amp;quot; page, he/she can see a list of all the topics, the contributors and the reviewers for each topic. This page did not show the status of each review which can be in Assigned state or Saved state or Submitted state. Also, there was no way for the instructor/TA to un-submit an already submitted review.&lt;br /&gt;
&lt;br /&gt;
'''New Additions:'''&lt;br /&gt;
* Updated the ''review_mappings/_list_review_mappings.html.erb'' file in views to display the status of each review by the reviewer. For each review_mapping, the code checks if there is a response in ''Response'' table with the same ''map_id'' used in the review_mappings on this page. &lt;br /&gt;
** If there is no such response, it means that the reviewer has not saved/submitted the review and it is currently in Assigned State. So, &amp;quot;Response Status: Saved&amp;quot; is shown for that review.&lt;br /&gt;
** If there is a response, the last (latest) response is checked as per requirement and the ''is_submitted'' attribute of this response is checked in the ''Response'' table.&lt;br /&gt;
*** If the attribute is false, the review has been saved but not submitted. So, &amp;quot;Response Status: Saved&amp;quot; is shown for that review.&lt;br /&gt;
*** If the attribute is true, the review has been submitted. So, &amp;quot;Response Status: Submitted&amp;quot; is shown for that review. Next to this, a link is created to un-submit the review. Clicking on this link changes the ''is_submitted'' attribute to false and updates the Response Status to Saved on the page by using AJAX call, without reloading the page&lt;br /&gt;
[[File:List_review_mappings_html_erb.png]]&lt;br /&gt;
* Added a new method &amp;quot;unsubmit_review&amp;quot; to the ''review_mapping_controller.rb'' file. In this, we first find the latest response and then update the ''is_submitted'' attribute to false. The flash message is created based on whether the response was updated correctly. After this, ''unsubmit_review.js.rb'' file is rendered which updates the response status for the corresponding review on the page to Saved, without reloading the page&lt;br /&gt;
[[File:Review_mapping_controller_rb.png]]&lt;br /&gt;
* Added a new file ''review_mappings/unsubmit_review.js.erb'' to views. This file just changes the response status for the corresponding review displayed on the page to Saved from Submit after the review has been un-submitted and also prints the corresponding success or error flash message.&lt;br /&gt;
[[File:Unsubmit_review_js_erb.png]]&lt;br /&gt;
* Added a new line to ''routes.rb'' page for unsubmit_review action&lt;br /&gt;
[[File:Routes_rb.png]]&lt;br /&gt;
&lt;br /&gt;
==Test Plan==&lt;br /&gt;
&lt;br /&gt;
===Log in details===&lt;br /&gt;
&lt;br /&gt;
'''Username:''' instructor6&lt;br /&gt;
'''password:''' password&lt;br /&gt;
&lt;br /&gt;
Some valid user id's are student5000, student5001, student5002 etc. These can be used while adding new Participant or TA as described below.&lt;br /&gt;
&lt;br /&gt;
===Automated Testing===&lt;br /&gt;
* Created a helper module ''wait_for_ajax.rb'' with methods to wait for ajax requests to finish&lt;br /&gt;
* Updated the test &amp;quot;check to see if participants can be added&amp;quot; in ''assignment_creation_spec.rb'' to wait for AJAX calls to finish after adding a participant by using the helper module created&lt;br /&gt;
* Added a new test named &amp;quot;can unsubmit a review&amp;quot; in ''review_mapping_spec.rb''&lt;br /&gt;
** In this test, a new reviewer is added to review mapping, a new review is created and submitted, and then checked if unsubmit functionality is working correctly&lt;br /&gt;
* Added a new file ''course_creation_spec.rb'' to test adding and remove TA's&lt;br /&gt;
Initially the test was failing as test.db does not contain role for Teaching Assistant. So, added that role to test database.&lt;br /&gt;
[[File:Add_ta_role.png]]&lt;br /&gt;
Created test cases for adding/removing TA after visiting course page.&lt;br /&gt;
[[File:Add_ta.png]]&lt;br /&gt;
&lt;br /&gt;
===UI Testing===&lt;br /&gt;
&lt;br /&gt;
'''Steps to test adding participant: '''&lt;br /&gt;
&lt;br /&gt;
* Login as instructor&lt;br /&gt;
* Go to Manage -&amp;gt; Assignments.&lt;br /&gt;
* Switch to Assignments tab incase you are on some other tab&lt;br /&gt;
* For any assignment, click on the 'Add Participant' icon to go on add new participant page&lt;br /&gt;
* Enter userid of the participant and click on Add to add the participant&lt;br /&gt;
&lt;br /&gt;
'' Expected Output: '' When add button is clicked with valid userid, new participant should be added to the list without the page getting reloaded. In case of an attempt to add invalid user, the error should be displayed on top without page getting reloaded.&lt;br /&gt;
&lt;br /&gt;
''' Steps to test adding/removing TA:'''&lt;br /&gt;
&lt;br /&gt;
* Login as instructor&lt;br /&gt;
* Go to Manage -&amp;gt; Courses.&lt;br /&gt;
* Switch to Courses tab incase you are on some other tab&lt;br /&gt;
* For any course, click on the 'Add TA' icon to go on add new TA page&lt;br /&gt;
* Enter userid of the TA and click on Add to add the TA&lt;br /&gt;
* Click on 'remove_ta' link for any TA in the list to remove the TA&lt;br /&gt;
&lt;br /&gt;
'' Expected Output: '' When add button is clicked with valid userid, new TA should be added to the list without the page getting reloaded. In case of an attempt to add invalid user, the error should be displayed on top without page getting reloaded. When remove_ta link is clicked for any TA in the list, that corresponding TA should be removed from the list without the page getting reloaded.&lt;br /&gt;
Note: A duplicate TA is currently allowed. This was a part of original (earlier) functionality, and as this project involved changes to use AJAX and not changes to the actual functionality, this original functionality is not changed &lt;br /&gt;
&lt;br /&gt;
''' Steps to test adding question in questionnaire:'''&lt;br /&gt;
&lt;br /&gt;
* Login 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.  You will now be navigated to page where you can add new questions to the questionnaire. &lt;br /&gt;
* Click on add button in &amp;quot;Questions&amp;quot; section.&lt;br /&gt;
&lt;br /&gt;
''Expected output:'' When add button is clicked, question should be created and the questionnaire page should not get reloaded&lt;br /&gt;
&lt;br /&gt;
''' Steps to test un-submit reviews'''&lt;br /&gt;
&lt;br /&gt;
* Login as instructor&lt;br /&gt;
* Go to Manage -&amp;gt; Assignments.&lt;br /&gt;
* Switch to Assignments tab incase you are on some other tab&lt;br /&gt;
* For any assignment, click on the 'Assign reviewers' icon to go to the review mappings page&lt;br /&gt;
** Note: Some assignments might not have reviewers. So, try this for assignments with many reviewers&lt;br /&gt;
* For any review with Review Status = Submitted, click on 'unsubmit' button&lt;br /&gt;
&lt;br /&gt;
''Expected output:'' For every review, the review status should be seen as either Assigned or Saved or Submitted. For submitted reviews, when unsubmit button is clicked, that review should be unsubmitted and status should change to Saved without page getting reloaded.&lt;br /&gt;
&lt;br /&gt;
==Project Deployment==&lt;br /&gt;
&lt;br /&gt;
Expertiza setup is done in VCL which is reserved for 30 days with Ubuntu 14.04 base. Started expertiza server publicly and link to access the server is:&lt;br /&gt;
http://152.7.99.101:3000&lt;br /&gt;
&lt;br /&gt;
==Future work==&lt;br /&gt;
&lt;br /&gt;
In future, we will try to implement the edit questionnaire part using alternative approach. We will try to implement testing using rspec framework and improve the UI design of the pages.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
* https://www.youtube.com/channel/UCdKXzox7hrWjfOMML6FzTWg&lt;br /&gt;
* https://github.com/expertiza/expertiza&lt;br /&gt;
* http://wiki.expertiza.ncsu.edu/index.php/Expertiza_documentation&lt;br /&gt;
* http://guides.rubyonrails.org/working_with_javascript_in_rails.html&lt;br /&gt;
* http://wiki.expertiza.ncsu.edu/index.php/Development:Setup:Linux:Debian&lt;/div&gt;</summary>
		<author><name>Dguttik</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Add_ta_role.png&amp;diff=107845</id>
		<title>File:Add ta role.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Add_ta_role.png&amp;diff=107845"/>
		<updated>2017-04-01T04:30:45Z</updated>

		<summary type="html">&lt;p&gt;Dguttik: uploaded a new version of &amp;amp;quot;File:Add ta role.png&amp;amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Dguttik</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/Use_Ajax_to_add_Participants,TA_and_Edit_Questionnaire&amp;diff=107840</id>
		<title>CSC/ECE 517 Spring 2017/Use Ajax to add Participants,TA and Edit Questionnaire</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/Use_Ajax_to_add_Participants,TA_and_Edit_Questionnaire&amp;diff=107840"/>
		<updated>2017-04-01T04:25:29Z</updated>

		<summary type="html">&lt;p&gt;Dguttik: /* Automated Testing */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;nowiki&amp;gt;  Expertiza is an opensource software developed to assist people in education institutions to perform peer reviews and group projects. It is exceptionally helpful to the students and instructors. The software is designed in MVC (Model-View-Controller) architecture using ruby on rails.&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
Expertiza provides many categories to manage for an instructor. Few of these categories are assignments, courses and questionnaires. Currently, to add/remove/update records, the entire page is submitted to save the record and the entire page is re-loaded back again to reflect the changes on the page. The task is to improve this functionality such that some of the records, specifically adding participants to courses or assignments, adding/removing teaching assistants to/from courses and adding questions to questionnaires, can be saved remotely and the page updated without submitting and reloading the entire page. &lt;br /&gt;
Additionally, on assign reviewers page for an assignment, there is no way to see the current status of reviews and there is no way for an instructor to unsubmit a submitted review. So, another task is to add this functionality such that review status is seen for each review and to unsubmit a submitted review without reloading the page.&lt;br /&gt;
&lt;br /&gt;
==Proposed Solution==&lt;br /&gt;
This project proposes use of AJAX for the required pages to avoid page reloading at the time of adding and saving records. This solution will make sure that adding or saving of record is done remotely and the page is updated without reloading. It can be achieved by calling corresponding controller method, adding/saving the record remotely and rendering it back to JavaScript pages in the view instead of redirecting it to the same page. JavaScript pages in the view will update the page without reloading it, for example by appending the newly added record to the list of records. Thus, records are saved remotely and page refresh is avoided.&lt;br /&gt;
For the review status part, responses to the corresponding reviews on the page can be checked in the Response table and the review status shown as the status of the latest response. Unsubmitting a review can be done using AJAX without reloading the page.&lt;br /&gt;
&lt;br /&gt;
==Tasks==&lt;br /&gt;
* Add Participant in the assignments section using AJAX &lt;br /&gt;
* Add/Remove TA in the courses section using AJAX&lt;br /&gt;
* Edit Questionnaire by using AJAX for adding questions in the Questionnaire section&lt;br /&gt;
* Show Review Status on assign reviewers page and allow to un-submit a review using AJAX&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
&lt;br /&gt;
===Adding participant===&lt;br /&gt;
'''Earlier scenario:''' When an instructor goes to &amp;quot;Manage Assignments -&amp;gt; Add Participants&amp;quot; page, he/she can add/remove new Participant to the assignment. The add page also displays list of participants above the form for new participant. Every time a new Participant is added, the page reloads to reflect the changes and render the updated list of participants, even in case of non-existing userid.&lt;br /&gt;
&lt;br /&gt;
'''Updates/Changes:'''&lt;br /&gt;
This page has been updated such that an instructor can add a new Participant using [https://en.wikipedia.org/wiki/Ajax_(programming) AJAX]. After adding AJAX changes, the list gets updated without reloading the entire page. The changes made are below.&lt;br /&gt;
&lt;br /&gt;
* Updated the ''shared_scripts/_user_list.html.erb'' file in views so that the Participants are listed by rendering another partial ''_participant.html.erb'' in participants controller. This change is to make it feasible to add AJAX to just append to the list without any extra formatting.&lt;br /&gt;
[[File:User_list.PNG]]&lt;br /&gt;
&lt;br /&gt;
* Created a new file ''participants/add.js.erb'' for adding AJAX to render newly added participant in case of successful addition and display error in case of any error.&lt;br /&gt;
[[File:Javascript changes.PNG]]&lt;br /&gt;
&lt;br /&gt;
* Updated the ''shared_scripts/_add_individual.html.erb'' form such that request should be through AJAX by setting remote flag to true.&lt;br /&gt;
[[File:Add_individual.PNG]]&lt;br /&gt;
&lt;br /&gt;
* Updated the participants controller ''participant_controller.rb'' in controllers to render JavaScript when add method is invoked by the form submit action instead of redirect to list page.&lt;br /&gt;
[[File:Controller_changes.PNG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Adding/Removing TA===&lt;br /&gt;
'''Earlier scenario:''' When an instructor goes to &amp;quot;Manage Courses -&amp;gt; Add TA&amp;quot; page, he/she can add/remove new TA to the course. Every time a new TA is added or removed, the page reloads to reflect the changes, even if the userid used does not exist.&lt;br /&gt;
&lt;br /&gt;
'''Updates/Changes:''' This page has been updated such that an instructor can add a new TA or remove a new TA using AJAX. With these updates, the changes are reflected on the page without reloading the page, thus saving time.&lt;br /&gt;
* Updated the ''course/view_teaching_assistants.html.erb'' file in views so that the TAs are listed by rendering another partial ''_ta.html.erb''. This is done so that when a new TA has been added, AJAX call can be used to render the format required for the new TA in the list append to the already existing list without reloading the page.&lt;br /&gt;
[[File:View_teaching_assistants_html_erb.png]]&lt;br /&gt;
&lt;br /&gt;
* Created a new file ''course/_ta.html.erb'' in views which is a partial as described above and contains the code to list the TAs. The link_to &amp;quot;Delete&amp;quot; line in this file is updated to use :remote=&amp;gt;:true, so that AJAX call can be made to remove the TA remotely without reloading the page.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;%= link_to &amp;quot;Delete&amp;quot;, { :action =&amp;gt; 'remove_ta', :controller =&amp;gt;'course', :id =&amp;gt; ta.id, :course_id =&amp;gt; ta.course_id }, method: :post, :remote =&amp;gt; true, :class =&amp;gt; 'remove_ta' %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
[[File:Ta.png]]&lt;br /&gt;
&lt;br /&gt;
* Updated the ''course/_add_individual.html.erb'' file in views to perform the form_tag action to Add a TA remotely using :remote=&amp;gt;:true. In the below code, ''form_action'' and ''remote'' are local variables passed to this partial from ''course/view_teaching_assistants.html.erb'' with the values &amp;quot;add_ta&amp;quot; and &amp;quot;true&amp;quot; respectively &lt;br /&gt;
[[File:Add_individual_html_erb.png]]&lt;br /&gt;
&lt;br /&gt;
* Updated the ''course_controller.rb&amp;quot; file and replaced the redirect option in ''add_ta'' and ''remove_ta'' to render ''add_ta.js.erb'' and ''remove_ta.js.erb''. Also changed ''flash[:error]'' to ''flash.now[:error]'' so that the flash message is displayed now instead of after page reload.&lt;br /&gt;
[[File:Course_controller_rb1.png]]&lt;br /&gt;
&lt;br /&gt;
* Added a new file ''course/add.js.erb'' and ''course/remove_ta.js.erb'' to views. The ''add_ta.js.erb'' file renders the newly added TA and appends it to the list of TAs. It also shows flash error message if the userid used to add TA does not exist. Similarly, ''remote_ta.js.erb'' file removes the deleted TA from the list.&lt;br /&gt;
[[File:add_remove_js_erb.png]]&lt;br /&gt;
&lt;br /&gt;
===Edit Questionnaire===&lt;br /&gt;
&lt;br /&gt;
'''Current scenario :''' page consists of different subsections for creating questionnaire,adding questions to the questionnaire and saving the questionnaire i.e.&lt;br /&gt;
*_questionnaire.html.erb&lt;br /&gt;
&lt;br /&gt;
Adding questions feature is performed in the following method of ''questionnaires_controller.rb'' class&lt;br /&gt;
&lt;br /&gt;
def add_new_questions&lt;br /&gt;
    questionnaire_id = params[:id] unless params[:id].nil?&lt;br /&gt;
    num_of_existed_questions = Questionnaire.find(questionnaire_id).questions.size&lt;br /&gt;
    ((num_of_existed_questions + 1)..(num_of_existed_questions + params[:question][:total_num].to_i)).each do |i|&lt;br /&gt;
      question = Object.const_get(params[:question][:type]).create(txt: '', questionnaire_id: questionnaire_id, seq: i, type: params[:question][:type], break_before: true)&lt;br /&gt;
      if question.is_a? ScoredQuestion&lt;br /&gt;
        question.weight = 1&lt;br /&gt;
        question.max_label = 'Strongly agree'&lt;br /&gt;
        question.min_label = 'Strongly disagree'&lt;br /&gt;
      end&lt;br /&gt;
      question.size = '50, 3' if question.is_a? Criterion&lt;br /&gt;
      question.alternatives = '0|1|2|3|4|5' if question.is_a? Dropdown&lt;br /&gt;
      question.size = '60, 5' if question.is_a? TextArea&lt;br /&gt;
      question.size = '30' if question.is_a? TextField&lt;br /&gt;
      begin&lt;br /&gt;
        question.save&lt;br /&gt;
      rescue&lt;br /&gt;
        flash[:error] = $ERROR_INFO&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
    redirect_to edit_questionnaire_path(questionnaire_id.to_sym)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This method invokes ''question.create'' method in ''questions_cotroller.rb'' and saves the created question to the database. Then it redirects to the ''edit.html.erb'' page which causes page refresh while adding questions.&lt;br /&gt;
&lt;br /&gt;
'''Solution:''' This problem was tried to solve using AJAX by changing or adding the following classes and pages &lt;br /&gt;
* _question.html.erb (added) - displays added question&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;td align=&amp;quot;center&amp;quot;&amp;gt;&amp;lt;a rel=&amp;quot;nofollow&amp;quot; data-method=&amp;quot;delete&amp;quot; href=&amp;quot;/questions/' &amp;lt;%= @question.id%&amp;gt; '&amp;quot;&amp;gt;Remove&amp;lt;/a&amp;gt;&amp;lt;/td&amp;gt;'&lt;br /&gt;
        &amp;lt;td&amp;gt;&amp;lt;input size=&amp;quot;6&amp;quot; value=&amp;quot;' &amp;lt;%= @question.seq%&amp;gt; '&amp;quot; name=&amp;quot;question[' question.id %&amp;gt;'][seq]&amp;quot; id=&amp;quot;question_' +&amp;lt;%=@question.id %&amp;gt; '_seq&amp;quot; type=&amp;quot;text&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
        &amp;lt;td&amp;gt;&amp;lt;textarea cols=&amp;quot;50&amp;quot; rows=&amp;quot;1&amp;quot; name=&amp;quot;question[' &amp;lt;%= @question.id%&amp;gt; '][txt]&amp;quot; id=&amp;quot;question_' &amp;lt;%= @question.id%&amp;gt; '_txt&amp;quot; placeholder=&amp;quot;Edit question content here&amp;quot;&amp;gt;' &amp;lt;%= @question.txt%&amp;gt; '&amp;lt;/textarea&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
        &amp;lt;td&amp;gt;&amp;lt;input size=&amp;quot;10&amp;quot; disabled=&amp;quot;disabled&amp;quot; value=&amp;quot;'  &amp;lt;%= @question.type%&amp;gt;  '&amp;quot; name=&amp;quot;question[' &amp;lt;%= @question.id%&amp;gt;'][type]&amp;quot; id=&amp;quot;question_' &amp;lt;%= @question.id%&amp;gt; '_type&amp;quot; type=&amp;quot;text&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
        &amp;lt;td&amp;gt;&amp;lt;!--placeholder (QuestionnaireHeader does not need weight)--&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* add_new_questions.js.erb (added) - appends the html content with added question in ''_question.html.erb'' to  questions_table in ''_questionnaire.html.erb''&lt;br /&gt;
&lt;br /&gt;
   $(&amp;quot;#questions_table&amp;quot;).append(&amp;quot;&amp;lt;%= j render :partial =&amp;gt; 'question',&lt;br /&gt;
           :locals =&amp;gt; {question: @question, :id =&amp;gt; @question.id, :controller =&amp;gt; 'questions'} %&amp;gt;&amp;quot;);&lt;br /&gt;
  &lt;br /&gt;
* edit.html.erb (modified : code removed) - following code is removed as it internally calls respective question header models and appends html string to questions_table internally.&lt;br /&gt;
      &lt;br /&gt;
      &amp;lt;% for @question in @questionnaire.questions do%&amp;gt;&lt;br /&gt;
        &amp;lt;%-# The following line call certain method of the object, which returns html string-%&amp;gt;&lt;br /&gt;
        &amp;lt;%= @question.edit %&amp;gt;&lt;br /&gt;
      &amp;lt;% end %&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
@question.edit invokes ''QuestionHeader.rb'' model which adds html content&lt;br /&gt;
     def edit(_count)&lt;br /&gt;
    html = '&amp;lt;tr&amp;gt;'&lt;br /&gt;
    html += '&amp;lt;td align=&amp;quot;center&amp;quot;&amp;gt;&amp;lt;a rel=&amp;quot;nofollow&amp;quot; data-method=&amp;quot;delete&amp;quot; href=&amp;quot;/questions/' + self.id.to_s + '&amp;quot;&amp;gt;Remove&amp;lt;/a&amp;gt;&amp;lt;/td&amp;gt;'&lt;br /&gt;
    html += '&amp;lt;td&amp;gt;&amp;lt;input size=&amp;quot;6&amp;quot; value=&amp;quot;' + self.seq.to_s + '&amp;quot; name=&amp;quot;question[' + self.id.to_s + '][seq]&amp;quot; id=&amp;quot;question_' + self.id.to_s + '_seq&amp;quot; type=&amp;quot;text&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;'&lt;br /&gt;
    html += '&amp;lt;td&amp;gt;&amp;lt;textarea cols=&amp;quot;50&amp;quot; rows=&amp;quot;1&amp;quot; name=&amp;quot;question[' + self.id.to_s + '][txt]&amp;quot; id=&amp;quot;question_' + self.id.to_s + '_txt&amp;quot; placeholder=&amp;quot;Edit question content here&amp;quot;&amp;gt;' + self.txt + '&amp;lt;/textarea&amp;gt;&amp;lt;/td&amp;gt;'&lt;br /&gt;
    html += '&amp;lt;td&amp;gt;&amp;lt;input size=&amp;quot;10&amp;quot; disabled=&amp;quot;disabled&amp;quot; value=&amp;quot;' + self.type + '&amp;quot; name=&amp;quot;question[' + self.id.to_s + '][type]&amp;quot; id=&amp;quot;question_' + self.id.to_s + '_type&amp;quot; type=&amp;quot;text&amp;quot;&amp;gt;''&amp;lt;/td&amp;gt;'&lt;br /&gt;
    html += '&amp;lt;td&amp;gt;&amp;lt;!--placeholder (QuestionnaireHeader does not need weight)--&amp;gt;&amp;lt;/td&amp;gt;'&lt;br /&gt;
    html += '&amp;lt;/tr&amp;gt;'&lt;br /&gt;
    html.html_safe&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
* questionnaires_controller.rb (modified) - add_new_questions method is modified by replacing redire rendering ''add_new_questions.js.erb'' file&lt;br /&gt;
&lt;br /&gt;
  render :action=&amp;gt; 'add_new_questions.js.erb', :layout=&amp;gt;false, :question=&amp;gt; question&lt;br /&gt;
   #redirect_to edit_questionnaire_path(questionnaire_id.to_sym)&lt;br /&gt;
&lt;br /&gt;
'''Issue :''' But this solution is not working as AJAX can be applied to the browser side processing if the controller method is redirecting to the same page, which is not in this case as page gets redirected from question.html.erb to edit.html.erb. Another problem faced is the creation of questions which is called through ''_questionnaire.html.erb'' but not through ''_question.html.erb'' which makes it difficult to pass correct questionnaire id to the AJAX call.&lt;br /&gt;
&lt;br /&gt;
'''Alternative Approach to Edit Questionnaire:''' Another approach to solve this issue is to create a seperate java-script function which handles the entire process of adding,saving,deleting questions and appending them. Call this function from ''_questionnaire.html.erb'' instead of invoking add_new_questions method. Questions can be saved and retrived from data using JavaScript Rest API calls. But, this approach not only needs to restructure entire questionnaire structure and many components in the Expertiza project but also violates the MVC design of the project.&lt;br /&gt;
&lt;br /&gt;
===Un-submit reviews===&lt;br /&gt;
'''Earlier scenario:''' When an instructor/TA goes to &amp;quot;Manage Assignments -&amp;gt; Assign Reviewers&amp;quot; page, he/she can see a list of all the topics, the contributors and the reviewers for each topic. This page did not show the status of each review which can be in Assigned state or Saved state or Submitted state. Also, there was no way for the instructor/TA to un-submit an already submitted review.&lt;br /&gt;
&lt;br /&gt;
'''New Additions:'''&lt;br /&gt;
* Updated the ''review_mappings/_list_review_mappings.html.erb'' file in views to display the status of each review by the reviewer. For each review_mapping, the code checks if there is a response in ''Response'' table with the same ''map_id'' used in the review_mappings on this page. &lt;br /&gt;
** If there is no such response, it means that the reviewer has not saved/submitted the review and it is currently in Assigned State. So, &amp;quot;Response Status: Saved&amp;quot; is shown for that review.&lt;br /&gt;
** If there is a response, the last (latest) response is checked as per requirement and the ''is_submitted'' attribute of this response is checked in the ''Response'' table.&lt;br /&gt;
*** If the attribute is false, the review has been saved but not submitted. So, &amp;quot;Response Status: Saved&amp;quot; is shown for that review.&lt;br /&gt;
*** If the attribute is true, the review has been submitted. So, &amp;quot;Response Status: Submitted&amp;quot; is shown for that review. Next to this, a link is created to un-submit the review. Clicking on this link changes the ''is_submitted'' attribute to false and updates the Response Status to Saved on the page by using AJAX call, without reloading the page&lt;br /&gt;
[[File:List_review_mappings_html_erb.png]]&lt;br /&gt;
* Added a new method &amp;quot;unsubmit_review&amp;quot; to the ''review_mapping_controller.rb'' file. In this, we first find the latest response and then update the ''is_submitted'' attribute to false. The flash message is created based on whether the response was updated correctly. After this, ''unsubmit_review.js.rb'' file is rendered which updates the response status for the corresponding review on the page to Saved, without reloading the page&lt;br /&gt;
[[File:Review_mapping_controller_rb.png]]&lt;br /&gt;
* Added a new file ''review_mappings/unsubmit_review.js.erb'' to views. This file just changes the response status for the corresponding review displayed on the page to Saved from Submit after the review has been un-submitted and also prints the corresponding success or error flash message.&lt;br /&gt;
[[File:Unsubmit_review_js_erb.png]]&lt;br /&gt;
* Added a new line to ''routes.rb'' page for unsubmit_review action&lt;br /&gt;
[[File:Routes_rb.png]]&lt;br /&gt;
&lt;br /&gt;
==Test Plan==&lt;br /&gt;
&lt;br /&gt;
===Log in details===&lt;br /&gt;
&lt;br /&gt;
'''Username:''' instructor6&lt;br /&gt;
'''password:''' password&lt;br /&gt;
&lt;br /&gt;
Some valid user id's are student5000, student5001, student5002 etc. These can be used while adding new Participant or TA as described below.&lt;br /&gt;
&lt;br /&gt;
===Automated Testing===&lt;br /&gt;
* Created a helper module ''wait_for_ajax.rb'' with methods to wait for ajax requests to finish&lt;br /&gt;
* Updated the test &amp;quot;check to see if participants can be added&amp;quot; in ''assignment_creation_spec.rb'' to wait for AJAX calls to finish after adding a participant by using the helper module created&lt;br /&gt;
* Added a new test named &amp;quot;can unsubmit a review&amp;quot; in ''review_mapping_spec.rb''&lt;br /&gt;
** In this test, a new reviewer is added to review mapping, a new review is created and submitted, and then checked if unsubmit functionality is working correctly&lt;br /&gt;
* Added a new file ''course_creation_spec.rb'' to test adding and remove TA's&lt;br /&gt;
Initially the test was failing as test.db does not contain role for Teaching Assistant. So, added that role to test database.[[File:Add_ta_role.png]]&lt;br /&gt;
Created test cases for adding/removing TA after visiting course page.&lt;br /&gt;
[[File:Add_ta.png]]&lt;br /&gt;
&lt;br /&gt;
===UI Testing===&lt;br /&gt;
&lt;br /&gt;
'''Steps to test adding participant: '''&lt;br /&gt;
&lt;br /&gt;
* Login as instructor&lt;br /&gt;
* Go to Manage -&amp;gt; Assignments.&lt;br /&gt;
* Switch to Assignments tab incase you are on some other tab&lt;br /&gt;
* For any assignment, click on the 'Add Participant' icon to go on add new participant page&lt;br /&gt;
* Enter userid of the participant and click on Add to add the participant&lt;br /&gt;
&lt;br /&gt;
'' Expected Output: '' When add button is clicked with valid userid, new participant should be added to the list without the page getting reloaded. In case of an attempt to add invalid user, the error should be displayed on top without page getting reloaded.&lt;br /&gt;
&lt;br /&gt;
''' Steps to test adding/removing TA:'''&lt;br /&gt;
&lt;br /&gt;
* Login as instructor&lt;br /&gt;
* Go to Manage -&amp;gt; Courses.&lt;br /&gt;
* Switch to Courses tab incase you are on some other tab&lt;br /&gt;
* For any course, click on the 'Add TA' icon to go on add new TA page&lt;br /&gt;
* Enter userid of the TA and click on Add to add the TA&lt;br /&gt;
* Click on 'remove_ta' link for any TA in the list to remove the TA&lt;br /&gt;
&lt;br /&gt;
'' Expected Output: '' When add button is clicked with valid userid, new TA should be added to the list without the page getting reloaded. In case of an attempt to add invalid user, the error should be displayed on top without page getting reloaded. When remove_ta link is clicked for any TA in the list, that corresponding TA should be removed from the list without the page getting reloaded.&lt;br /&gt;
Note: A duplicate TA is currently allowed. This was a part of original (earlier) functionality, and as this project involved changes to use AJAX and not changes to the actual functionality, this original functionality is not changed &lt;br /&gt;
&lt;br /&gt;
''' Steps to test adding question in questionnaire:'''&lt;br /&gt;
&lt;br /&gt;
* Login 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.  You will now be navigated to page where you can add new questions to the questionnaire. &lt;br /&gt;
* Click on add button in &amp;quot;Questions&amp;quot; section.&lt;br /&gt;
&lt;br /&gt;
''Expected output:'' When add button is clicked, question should be created and the questionnaire page should not get reloaded&lt;br /&gt;
&lt;br /&gt;
''' Steps to test un-submit reviews'''&lt;br /&gt;
&lt;br /&gt;
* Login as instructor&lt;br /&gt;
* Go to Manage -&amp;gt; Assignments.&lt;br /&gt;
* Switch to Assignments tab incase you are on some other tab&lt;br /&gt;
* For any assignment, click on the 'Assign reviewers' icon to go to the review mappings page&lt;br /&gt;
** Note: Some assignments might not have reviewers. So, try this for assignments with many reviewers&lt;br /&gt;
* For any review with Review Status = Submitted, click on 'unsubmit' button&lt;br /&gt;
&lt;br /&gt;
''Expected output:'' For every review, the review status should be seen as either Assigned or Saved or Submitted. For submitted reviews, when unsubmit button is clicked, that review should be unsubmitted and status should change to Saved without page getting reloaded.&lt;br /&gt;
&lt;br /&gt;
==Project Deployment==&lt;br /&gt;
&lt;br /&gt;
Expertiza setup is done in VCL which is reserved for 30 days with Ubuntu 14.04 base. Started expertiza server publicly and link to access the server is:&lt;br /&gt;
http://152.7.99.101:3000&lt;br /&gt;
&lt;br /&gt;
==Future work==&lt;br /&gt;
&lt;br /&gt;
In future, we will try to implement the edit questionnaire part using alternative approach. We will try to implement testing using rspec framework and improve the UI design of the pages.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
* https://www.youtube.com/channel/UCdKXzox7hrWjfOMML6FzTWg&lt;br /&gt;
* https://github.com/expertiza/expertiza&lt;br /&gt;
* http://wiki.expertiza.ncsu.edu/index.php/Expertiza_documentation&lt;br /&gt;
* http://guides.rubyonrails.org/working_with_javascript_in_rails.html&lt;br /&gt;
* http://wiki.expertiza.ncsu.edu/index.php/Development:Setup:Linux:Debian&lt;/div&gt;</summary>
		<author><name>Dguttik</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Add_ta_role.png&amp;diff=107839</id>
		<title>File:Add ta role.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Add_ta_role.png&amp;diff=107839"/>
		<updated>2017-04-01T04:21:02Z</updated>

		<summary type="html">&lt;p&gt;Dguttik: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Dguttik</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Add_ta.png&amp;diff=107835</id>
		<title>File:Add ta.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Add_ta.png&amp;diff=107835"/>
		<updated>2017-04-01T04:15:21Z</updated>

		<summary type="html">&lt;p&gt;Dguttik: uploaded a new version of &amp;amp;quot;File:Add ta.png&amp;amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Dguttik</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/Use_Ajax_to_add_Participants,TA_and_Edit_Questionnaire&amp;diff=107834</id>
		<title>CSC/ECE 517 Spring 2017/Use Ajax to add Participants,TA and Edit Questionnaire</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/Use_Ajax_to_add_Participants,TA_and_Edit_Questionnaire&amp;diff=107834"/>
		<updated>2017-04-01T04:12:58Z</updated>

		<summary type="html">&lt;p&gt;Dguttik: test code&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;nowiki&amp;gt;  Expertiza is an opensource software developed to assist people in education institutions to perform peer reviews and group projects. It is exceptionally helpful to the students and instructors. The software is designed in MVC (Model-View-Controller) architecture using ruby on rails.&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
Expertiza provides many categories to manage for an instructor. Few of these categories are assignments, courses and questionnaires. Currently, to add/remove/update records, the entire page is submitted to save the record and the entire page is re-loaded back again to reflect the changes on the page. The task is to improve this functionality such that some of the records, specifically adding participants to courses or assignments, adding/removing teaching assistants to/from courses and adding questions to questionnaires, can be saved remotely and the page updated without submitting and reloading the entire page. &lt;br /&gt;
Additionally, on assign reviewers page for an assignment, there is no way to see the current status of reviews and there is no way for an instructor to unsubmit a submitted review. So, another task is to add this functionality such that review status is seen for each review and to unsubmit a submitted review without reloading the page.&lt;br /&gt;
&lt;br /&gt;
==Proposed Solution==&lt;br /&gt;
This project proposes use of AJAX for the required pages to avoid page reloading at the time of adding and saving records. This solution will make sure that adding or saving of record is done remotely and the page is updated without reloading. It can be achieved by calling corresponding controller method, adding/saving the record remotely and rendering it back to JavaScript pages in the view instead of redirecting it to the same page. JavaScript pages in the view will update the page without reloading it, for example by appending the newly added record to the list of records. Thus, records are saved remotely and page refresh is avoided.&lt;br /&gt;
For the review status part, responses to the corresponding reviews on the page can be checked in the Response table and the review status shown as the status of the latest response. Unsubmitting a review can be done using AJAX without reloading the page.&lt;br /&gt;
&lt;br /&gt;
==Tasks==&lt;br /&gt;
* Add Participant in the assignments section using AJAX &lt;br /&gt;
* Add/Remove TA in the courses section using AJAX&lt;br /&gt;
* Edit Questionnaire by using AJAX for adding questions in the Questionnaire section&lt;br /&gt;
* Show Review Status on assign reviewers page and allow to un-submit a review using AJAX&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
&lt;br /&gt;
===Adding participant===&lt;br /&gt;
'''Earlier scenario:''' When an instructor goes to &amp;quot;Manage Assignments -&amp;gt; Add Participants&amp;quot; page, he/she can add/remove new Participant to the assignment. The add page also displays list of participants above the form for new participant. Every time a new Participant is added, the page reloads to reflect the changes and render the updated list of participants, even in case of non-existing userid.&lt;br /&gt;
&lt;br /&gt;
'''Updates/Changes:'''&lt;br /&gt;
This page has been updated such that an instructor can add a new Participant using [https://en.wikipedia.org/wiki/Ajax_(programming) AJAX]. After adding AJAX changes, the list gets updated without reloading the entire page. The changes made are below.&lt;br /&gt;
&lt;br /&gt;
* Updated the ''shared_scripts/_user_list.html.erb'' file in views so that the Participants are listed by rendering another partial ''_participant.html.erb'' in participants controller. This change is to make it feasible to add AJAX to just append to the list without any extra formatting.&lt;br /&gt;
[[File:User_list.PNG]]&lt;br /&gt;
&lt;br /&gt;
* Created a new file ''participants/add.js.erb'' for adding AJAX to render newly added participant in case of successful addition and display error in case of any error.&lt;br /&gt;
[[File:Javascript changes.PNG]]&lt;br /&gt;
&lt;br /&gt;
* Updated the ''shared_scripts/_add_individual.html.erb'' form such that request should be through AJAX by setting remote flag to true.&lt;br /&gt;
[[File:Add_individual.PNG]]&lt;br /&gt;
&lt;br /&gt;
* Updated the participants controller ''participant_controller.rb'' in controllers to render JavaScript when add method is invoked by the form submit action instead of redirect to list page.&lt;br /&gt;
[[File:Controller_changes.PNG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Adding/Removing TA===&lt;br /&gt;
'''Earlier scenario:''' When an instructor goes to &amp;quot;Manage Courses -&amp;gt; Add TA&amp;quot; page, he/she can add/remove new TA to the course. Every time a new TA is added or removed, the page reloads to reflect the changes, even if the userid used does not exist.&lt;br /&gt;
&lt;br /&gt;
'''Updates/Changes:''' This page has been updated such that an instructor can add a new TA or remove a new TA using AJAX. With these updates, the changes are reflected on the page without reloading the page, thus saving time.&lt;br /&gt;
* Updated the ''course/view_teaching_assistants.html.erb'' file in views so that the TAs are listed by rendering another partial ''_ta.html.erb''. This is done so that when a new TA has been added, AJAX call can be used to render the format required for the new TA in the list append to the already existing list without reloading the page.&lt;br /&gt;
[[File:View_teaching_assistants_html_erb.png]]&lt;br /&gt;
&lt;br /&gt;
* Created a new file ''course/_ta.html.erb'' in views which is a partial as described above and contains the code to list the TAs. The link_to &amp;quot;Delete&amp;quot; line in this file is updated to use :remote=&amp;gt;:true, so that AJAX call can be made to remove the TA remotely without reloading the page.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;%= link_to &amp;quot;Delete&amp;quot;, { :action =&amp;gt; 'remove_ta', :controller =&amp;gt;'course', :id =&amp;gt; ta.id, :course_id =&amp;gt; ta.course_id }, method: :post, :remote =&amp;gt; true, :class =&amp;gt; 'remove_ta' %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
[[File:Ta.png]]&lt;br /&gt;
&lt;br /&gt;
* Updated the ''course/_add_individual.html.erb'' file in views to perform the form_tag action to Add a TA remotely using :remote=&amp;gt;:true. In the below code, ''form_action'' and ''remote'' are local variables passed to this partial from ''course/view_teaching_assistants.html.erb'' with the values &amp;quot;add_ta&amp;quot; and &amp;quot;true&amp;quot; respectively &lt;br /&gt;
[[File:Add_individual_html_erb.png]]&lt;br /&gt;
&lt;br /&gt;
* Updated the ''course_controller.rb&amp;quot; file and replaced the redirect option in ''add_ta'' and ''remove_ta'' to render ''add_ta.js.erb'' and ''remove_ta.js.erb''. Also changed ''flash[:error]'' to ''flash.now[:error]'' so that the flash message is displayed now instead of after page reload.&lt;br /&gt;
[[File:Course_controller_rb1.png]]&lt;br /&gt;
&lt;br /&gt;
* Added a new file ''course/add.js.erb'' and ''course/remove_ta.js.erb'' to views. The ''add_ta.js.erb'' file renders the newly added TA and appends it to the list of TAs. It also shows flash error message if the userid used to add TA does not exist. Similarly, ''remote_ta.js.erb'' file removes the deleted TA from the list.&lt;br /&gt;
[[File:add_remove_js_erb.png]]&lt;br /&gt;
&lt;br /&gt;
===Edit Questionnaire===&lt;br /&gt;
&lt;br /&gt;
'''Current scenario :''' page consists of different subsections for creating questionnaire,adding questions to the questionnaire and saving the questionnaire i.e.&lt;br /&gt;
*_questionnaire.html.erb&lt;br /&gt;
&lt;br /&gt;
Adding questions feature is performed in the following method of ''questionnaires_controller.rb'' class&lt;br /&gt;
&lt;br /&gt;
def add_new_questions&lt;br /&gt;
    questionnaire_id = params[:id] unless params[:id].nil?&lt;br /&gt;
    num_of_existed_questions = Questionnaire.find(questionnaire_id).questions.size&lt;br /&gt;
    ((num_of_existed_questions + 1)..(num_of_existed_questions + params[:question][:total_num].to_i)).each do |i|&lt;br /&gt;
      question = Object.const_get(params[:question][:type]).create(txt: '', questionnaire_id: questionnaire_id, seq: i, type: params[:question][:type], break_before: true)&lt;br /&gt;
      if question.is_a? ScoredQuestion&lt;br /&gt;
        question.weight = 1&lt;br /&gt;
        question.max_label = 'Strongly agree'&lt;br /&gt;
        question.min_label = 'Strongly disagree'&lt;br /&gt;
      end&lt;br /&gt;
      question.size = '50, 3' if question.is_a? Criterion&lt;br /&gt;
      question.alternatives = '0|1|2|3|4|5' if question.is_a? Dropdown&lt;br /&gt;
      question.size = '60, 5' if question.is_a? TextArea&lt;br /&gt;
      question.size = '30' if question.is_a? TextField&lt;br /&gt;
      begin&lt;br /&gt;
        question.save&lt;br /&gt;
      rescue&lt;br /&gt;
        flash[:error] = $ERROR_INFO&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
    redirect_to edit_questionnaire_path(questionnaire_id.to_sym)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This method invokes ''question.create'' method in ''questions_cotroller.rb'' and saves the created question to the database. Then it redirects to the ''edit.html.erb'' page which causes page refresh while adding questions.&lt;br /&gt;
&lt;br /&gt;
'''Solution:''' This problem was tried to solve using AJAX by changing or adding the following classes and pages &lt;br /&gt;
* _question.html.erb (added) - displays added question&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;td align=&amp;quot;center&amp;quot;&amp;gt;&amp;lt;a rel=&amp;quot;nofollow&amp;quot; data-method=&amp;quot;delete&amp;quot; href=&amp;quot;/questions/' &amp;lt;%= @question.id%&amp;gt; '&amp;quot;&amp;gt;Remove&amp;lt;/a&amp;gt;&amp;lt;/td&amp;gt;'&lt;br /&gt;
        &amp;lt;td&amp;gt;&amp;lt;input size=&amp;quot;6&amp;quot; value=&amp;quot;' &amp;lt;%= @question.seq%&amp;gt; '&amp;quot; name=&amp;quot;question[' question.id %&amp;gt;'][seq]&amp;quot; id=&amp;quot;question_' +&amp;lt;%=@question.id %&amp;gt; '_seq&amp;quot; type=&amp;quot;text&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
        &amp;lt;td&amp;gt;&amp;lt;textarea cols=&amp;quot;50&amp;quot; rows=&amp;quot;1&amp;quot; name=&amp;quot;question[' &amp;lt;%= @question.id%&amp;gt; '][txt]&amp;quot; id=&amp;quot;question_' &amp;lt;%= @question.id%&amp;gt; '_txt&amp;quot; placeholder=&amp;quot;Edit question content here&amp;quot;&amp;gt;' &amp;lt;%= @question.txt%&amp;gt; '&amp;lt;/textarea&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
        &amp;lt;td&amp;gt;&amp;lt;input size=&amp;quot;10&amp;quot; disabled=&amp;quot;disabled&amp;quot; value=&amp;quot;'  &amp;lt;%= @question.type%&amp;gt;  '&amp;quot; name=&amp;quot;question[' &amp;lt;%= @question.id%&amp;gt;'][type]&amp;quot; id=&amp;quot;question_' &amp;lt;%= @question.id%&amp;gt; '_type&amp;quot; type=&amp;quot;text&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
        &amp;lt;td&amp;gt;&amp;lt;!--placeholder (QuestionnaireHeader does not need weight)--&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* add_new_questions.js.erb (added) - appends the html content with added question in ''_question.html.erb'' to  questions_table in ''_questionnaire.html.erb''&lt;br /&gt;
&lt;br /&gt;
   $(&amp;quot;#questions_table&amp;quot;).append(&amp;quot;&amp;lt;%= j render :partial =&amp;gt; 'question',&lt;br /&gt;
           :locals =&amp;gt; {question: @question, :id =&amp;gt; @question.id, :controller =&amp;gt; 'questions'} %&amp;gt;&amp;quot;);&lt;br /&gt;
  &lt;br /&gt;
* edit.html.erb (modified : code removed) - following code is removed as it internally calls respective question header models and appends html string to questions_table internally.&lt;br /&gt;
      &lt;br /&gt;
      &amp;lt;% for @question in @questionnaire.questions do%&amp;gt;&lt;br /&gt;
        &amp;lt;%-# The following line call certain method of the object, which returns html string-%&amp;gt;&lt;br /&gt;
        &amp;lt;%= @question.edit %&amp;gt;&lt;br /&gt;
      &amp;lt;% end %&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
@question.edit invokes ''QuestionHeader.rb'' model which adds html content&lt;br /&gt;
     def edit(_count)&lt;br /&gt;
    html = '&amp;lt;tr&amp;gt;'&lt;br /&gt;
    html += '&amp;lt;td align=&amp;quot;center&amp;quot;&amp;gt;&amp;lt;a rel=&amp;quot;nofollow&amp;quot; data-method=&amp;quot;delete&amp;quot; href=&amp;quot;/questions/' + self.id.to_s + '&amp;quot;&amp;gt;Remove&amp;lt;/a&amp;gt;&amp;lt;/td&amp;gt;'&lt;br /&gt;
    html += '&amp;lt;td&amp;gt;&amp;lt;input size=&amp;quot;6&amp;quot; value=&amp;quot;' + self.seq.to_s + '&amp;quot; name=&amp;quot;question[' + self.id.to_s + '][seq]&amp;quot; id=&amp;quot;question_' + self.id.to_s + '_seq&amp;quot; type=&amp;quot;text&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;'&lt;br /&gt;
    html += '&amp;lt;td&amp;gt;&amp;lt;textarea cols=&amp;quot;50&amp;quot; rows=&amp;quot;1&amp;quot; name=&amp;quot;question[' + self.id.to_s + '][txt]&amp;quot; id=&amp;quot;question_' + self.id.to_s + '_txt&amp;quot; placeholder=&amp;quot;Edit question content here&amp;quot;&amp;gt;' + self.txt + '&amp;lt;/textarea&amp;gt;&amp;lt;/td&amp;gt;'&lt;br /&gt;
    html += '&amp;lt;td&amp;gt;&amp;lt;input size=&amp;quot;10&amp;quot; disabled=&amp;quot;disabled&amp;quot; value=&amp;quot;' + self.type + '&amp;quot; name=&amp;quot;question[' + self.id.to_s + '][type]&amp;quot; id=&amp;quot;question_' + self.id.to_s + '_type&amp;quot; type=&amp;quot;text&amp;quot;&amp;gt;''&amp;lt;/td&amp;gt;'&lt;br /&gt;
    html += '&amp;lt;td&amp;gt;&amp;lt;!--placeholder (QuestionnaireHeader does not need weight)--&amp;gt;&amp;lt;/td&amp;gt;'&lt;br /&gt;
    html += '&amp;lt;/tr&amp;gt;'&lt;br /&gt;
    html.html_safe&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
* questionnaires_controller.rb (modified) - add_new_questions method is modified by replacing redire rendering ''add_new_questions.js.erb'' file&lt;br /&gt;
&lt;br /&gt;
  render :action=&amp;gt; 'add_new_questions.js.erb', :layout=&amp;gt;false, :question=&amp;gt; question&lt;br /&gt;
   #redirect_to edit_questionnaire_path(questionnaire_id.to_sym)&lt;br /&gt;
&lt;br /&gt;
'''Issue :''' But this solution is not working as AJAX can be applied to the browser side processing if the controller method is redirecting to the same page, which is not in this case as page gets redirected from question.html.erb to edit.html.erb. Another problem faced is the creation of questions which is called through ''_questionnaire.html.erb'' but not through ''_question.html.erb'' which makes it difficult to pass correct questionnaire id to the AJAX call.&lt;br /&gt;
&lt;br /&gt;
'''Alternative Approach to Edit Questionnaire:''' Another approach to solve this issue is to create a seperate java-script function which handles the entire process of adding,saving,deleting questions and appending them. Call this function from ''_questionnaire.html.erb'' instead of invoking add_new_questions method. Questions can be saved and retrived from data using JavaScript Rest API calls. But, this approach not only needs to restructure entire questionnaire structure and many components in the Expertiza project but also violates the MVC design of the project.&lt;br /&gt;
&lt;br /&gt;
===Un-submit reviews===&lt;br /&gt;
'''Earlier scenario:''' When an instructor/TA goes to &amp;quot;Manage Assignments -&amp;gt; Assign Reviewers&amp;quot; page, he/she can see a list of all the topics, the contributors and the reviewers for each topic. This page did not show the status of each review which can be in Assigned state or Saved state or Submitted state. Also, there was no way for the instructor/TA to un-submit an already submitted review.&lt;br /&gt;
&lt;br /&gt;
'''New Additions:'''&lt;br /&gt;
* Updated the ''review_mappings/_list_review_mappings.html.erb'' file in views to display the status of each review by the reviewer. For each review_mapping, the code checks if there is a response in ''Response'' table with the same ''map_id'' used in the review_mappings on this page. &lt;br /&gt;
** If there is no such response, it means that the reviewer has not saved/submitted the review and it is currently in Assigned State. So, &amp;quot;Response Status: Saved&amp;quot; is shown for that review.&lt;br /&gt;
** If there is a response, the last (latest) response is checked as per requirement and the ''is_submitted'' attribute of this response is checked in the ''Response'' table.&lt;br /&gt;
*** If the attribute is false, the review has been saved but not submitted. So, &amp;quot;Response Status: Saved&amp;quot; is shown for that review.&lt;br /&gt;
*** If the attribute is true, the review has been submitted. So, &amp;quot;Response Status: Submitted&amp;quot; is shown for that review. Next to this, a link is created to un-submit the review. Clicking on this link changes the ''is_submitted'' attribute to false and updates the Response Status to Saved on the page by using AJAX call, without reloading the page&lt;br /&gt;
[[File:List_review_mappings_html_erb.png]]&lt;br /&gt;
* Added a new method &amp;quot;unsubmit_review&amp;quot; to the ''review_mapping_controller.rb'' file. In this, we first find the latest response and then update the ''is_submitted'' attribute to false. The flash message is created based on whether the response was updated correctly. After this, ''unsubmit_review.js.rb'' file is rendered which updates the response status for the corresponding review on the page to Saved, without reloading the page&lt;br /&gt;
[[File:Review_mapping_controller_rb.png]]&lt;br /&gt;
* Added a new file ''review_mappings/unsubmit_review.js.erb'' to views. This file just changes the response status for the corresponding review displayed on the page to Saved from Submit after the review has been un-submitted and also prints the corresponding success or error flash message.&lt;br /&gt;
[[File:Unsubmit_review_js_erb.png]]&lt;br /&gt;
* Added a new line to ''routes.rb'' page for unsubmit_review action&lt;br /&gt;
[[File:Routes_rb.png]]&lt;br /&gt;
&lt;br /&gt;
==Test Plan==&lt;br /&gt;
&lt;br /&gt;
===Log in details===&lt;br /&gt;
&lt;br /&gt;
'''Username:''' instructor6&lt;br /&gt;
'''password:''' password&lt;br /&gt;
&lt;br /&gt;
Some valid user id's are student5000, student5001, student5002 etc. These can be used while adding new Participant or TA as described below.&lt;br /&gt;
&lt;br /&gt;
===Automated Testing===&lt;br /&gt;
* Created a helper module ''wait_for_ajax.rb'' with methods to wait for ajax requests to finish&lt;br /&gt;
* Updated the test &amp;quot;check to see if participants can be added&amp;quot; in ''assignment_creation_spec.rb'' to wait for AJAX calls to finish after adding a participant by using the helper module created&lt;br /&gt;
* Added a new test named &amp;quot;can unsubmit a review&amp;quot; in ''review_mapping_spec.rb''&lt;br /&gt;
** In this test, a new reviewer is added to review mapping, a new review is created and submitted, and then checked if unsubmit functionality is working correctly&lt;br /&gt;
* Added a new file ''course_creation_spec.rb'' to test adding and remove TA's&lt;br /&gt;
[[File:Add_ta.png]]&lt;br /&gt;
===UI Testing===&lt;br /&gt;
&lt;br /&gt;
'''Steps to test adding participant: '''&lt;br /&gt;
&lt;br /&gt;
* Login as instructor&lt;br /&gt;
* Go to Manage -&amp;gt; Assignments.&lt;br /&gt;
* Switch to Assignments tab incase you are on some other tab&lt;br /&gt;
* For any assignment, click on the 'Add Participant' icon to go on add new participant page&lt;br /&gt;
* Enter userid of the participant and click on Add to add the participant&lt;br /&gt;
&lt;br /&gt;
'' Expected Output: '' When add button is clicked with valid userid, new participant should be added to the list without the page getting reloaded. In case of an attempt to add invalid user, the error should be displayed on top without page getting reloaded.&lt;br /&gt;
&lt;br /&gt;
''' Steps to test adding/removing TA:'''&lt;br /&gt;
&lt;br /&gt;
* Login as instructor&lt;br /&gt;
* Go to Manage -&amp;gt; Courses.&lt;br /&gt;
* Switch to Courses tab incase you are on some other tab&lt;br /&gt;
* For any course, click on the 'Add TA' icon to go on add new TA page&lt;br /&gt;
* Enter userid of the TA and click on Add to add the TA&lt;br /&gt;
* Click on 'remove_ta' link for any TA in the list to remove the TA&lt;br /&gt;
&lt;br /&gt;
'' Expected Output: '' When add button is clicked with valid userid, new TA should be added to the list without the page getting reloaded. In case of an attempt to add invalid user, the error should be displayed on top without page getting reloaded. When remove_ta link is clicked for any TA in the list, that corresponding TA should be removed from the list without the page getting reloaded.&lt;br /&gt;
Note: A duplicate TA is currently allowed. This was a part of original (earlier) functionality, and as this project involved changes to use AJAX and not changes to the actual functionality, this original functionality is not changed &lt;br /&gt;
&lt;br /&gt;
''' Steps to test adding question in questionnaire:'''&lt;br /&gt;
&lt;br /&gt;
* Login 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.  You will now be navigated to page where you can add new questions to the questionnaire. &lt;br /&gt;
* Click on add button in &amp;quot;Questions&amp;quot; section.&lt;br /&gt;
&lt;br /&gt;
''Expected output:'' When add button is clicked, question should be created and the questionnaire page should not get reloaded&lt;br /&gt;
&lt;br /&gt;
''' Steps to test un-submit reviews'''&lt;br /&gt;
&lt;br /&gt;
* Login as instructor&lt;br /&gt;
* Go to Manage -&amp;gt; Assignments.&lt;br /&gt;
* Switch to Assignments tab incase you are on some other tab&lt;br /&gt;
* For any assignment, click on the 'Assign reviewers' icon to go to the review mappings page&lt;br /&gt;
** Note: Some assignments might not have reviewers. So, try this for assignments with many reviewers&lt;br /&gt;
* For any review with Review Status = Submitted, click on 'unsubmit' button&lt;br /&gt;
&lt;br /&gt;
''Expected output:'' For every review, the review status should be seen as either Assigned or Saved or Submitted. For submitted reviews, when unsubmit button is clicked, that review should be unsubmitted and status should change to Saved without page getting reloaded.&lt;br /&gt;
&lt;br /&gt;
==Project Deployment==&lt;br /&gt;
&lt;br /&gt;
Expertiza setup is done in VCL which is reserved for 30 days with Ubuntu 14.04 base. Started expertiza server publicly and link to access the server is:&lt;br /&gt;
http://152.7.99.101:3000&lt;br /&gt;
&lt;br /&gt;
==Future work==&lt;br /&gt;
&lt;br /&gt;
In future, we will try to implement the edit questionnaire part using alternative approach. We will try to implement testing using rspec framework and improve the UI design of the pages.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
* https://www.youtube.com/channel/UCdKXzox7hrWjfOMML6FzTWg&lt;br /&gt;
* https://github.com/expertiza/expertiza&lt;br /&gt;
* http://wiki.expertiza.ncsu.edu/index.php/Expertiza_documentation&lt;br /&gt;
* http://guides.rubyonrails.org/working_with_javascript_in_rails.html&lt;br /&gt;
* http://wiki.expertiza.ncsu.edu/index.php/Development:Setup:Linux:Debian&lt;/div&gt;</summary>
		<author><name>Dguttik</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Add_ta.png&amp;diff=107833</id>
		<title>File:Add ta.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Add_ta.png&amp;diff=107833"/>
		<updated>2017-04-01T04:10:36Z</updated>

		<summary type="html">&lt;p&gt;Dguttik: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Dguttik</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/Use_Ajax_to_add_Participants,TA_and_Edit_Questionnaire&amp;diff=107830</id>
		<title>CSC/ECE 517 Spring 2017/Use Ajax to add Participants,TA and Edit Questionnaire</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/Use_Ajax_to_add_Participants,TA_and_Edit_Questionnaire&amp;diff=107830"/>
		<updated>2017-04-01T04:01:00Z</updated>

		<summary type="html">&lt;p&gt;Dguttik: test plan&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;nowiki&amp;gt;  Expertiza is an opensource software developed to assist people in education institutions to perform peer reviews and group projects. It is exceptionally helpful to the students and instructors. The software is designed in MVC (Model-View-Controller) architecture using ruby on rails.&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
Expertiza provides many categories to manage for an instructor. Few of these categories are assignments, courses and questionnaires. Currently, to add/remove/update records, the entire page is submitted to save the record and the entire page is re-loaded back again to reflect the changes on the page. The task is to improve this functionality such that some of the records, specifically adding participants to courses or assignments, adding/removing teaching assistants to/from courses and adding questions to questionnaires, can be saved remotely and the page updated without submitting and reloading the entire page. &lt;br /&gt;
Additionally, on assign reviewers page for an assignment, there is no way to see the current status of reviews and there is no way for an instructor to unsubmit a submitted review. So, another task is to add this functionality such that review status is seen for each review and to unsubmit a submitted review without reloading the page.&lt;br /&gt;
&lt;br /&gt;
==Proposed Solution==&lt;br /&gt;
This project proposes use of AJAX for the required pages to avoid page reloading at the time of adding and saving records. This solution will make sure that adding or saving of record is done remotely and the page is updated without reloading. It can be achieved by calling corresponding controller method, adding/saving the record remotely and rendering it back to JavaScript pages in the view instead of redirecting it to the same page. JavaScript pages in the view will update the page without reloading it, for example by appending the newly added record to the list of records. Thus, records are saved remotely and page refresh is avoided.&lt;br /&gt;
For the review status part, responses to the corresponding reviews on the page can be checked in the Response table and the review status shown as the status of the latest response. Unsubmitting a review can be done using AJAX without reloading the page.&lt;br /&gt;
&lt;br /&gt;
==Tasks==&lt;br /&gt;
* Add Participant in the assignments section using AJAX &lt;br /&gt;
* Add/Remove TA in the courses section using AJAX&lt;br /&gt;
* Edit Questionnaire by using AJAX for adding questions in the Questionnaire section&lt;br /&gt;
* Show Review Status on assign reviewers page and allow to un-submit a review using AJAX&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
&lt;br /&gt;
===Adding participant===&lt;br /&gt;
'''Earlier scenario:''' When an instructor goes to &amp;quot;Manage Assignments -&amp;gt; Add Participants&amp;quot; page, he/she can add/remove new Participant to the assignment. The add page also displays list of participants above the form for new participant. Every time a new Participant is added, the page reloads to reflect the changes and render the updated list of participants, even in case of non-existing userid.&lt;br /&gt;
&lt;br /&gt;
'''Updates/Changes:'''&lt;br /&gt;
This page has been updated such that an instructor can add a new Participant using [https://en.wikipedia.org/wiki/Ajax_(programming) AJAX]. After adding AJAX changes, the list gets updated without reloading the entire page. The changes made are below.&lt;br /&gt;
&lt;br /&gt;
* Updated the ''shared_scripts/_user_list.html.erb'' file in views so that the Participants are listed by rendering another partial ''_participant.html.erb'' in participants controller. This change is to make it feasible to add AJAX to just append to the list without any extra formatting.&lt;br /&gt;
[[File:User_list.PNG]]&lt;br /&gt;
&lt;br /&gt;
* Created a new file ''participants/add.js.erb'' for adding AJAX to render newly added participant in case of successful addition and display error in case of any error.&lt;br /&gt;
[[File:Javascript changes.PNG]]&lt;br /&gt;
&lt;br /&gt;
* Updated the ''shared_scripts/_add_individual.html.erb'' form such that request should be through AJAX by setting remote flag to true.&lt;br /&gt;
[[File:Add_individual.PNG]]&lt;br /&gt;
&lt;br /&gt;
* Updated the participants controller ''participant_controller.rb'' in controllers to render JavaScript when add method is invoked by the form submit action instead of redirect to list page.&lt;br /&gt;
[[File:Controller_changes.PNG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Adding/Removing TA===&lt;br /&gt;
'''Earlier scenario:''' When an instructor goes to &amp;quot;Manage Courses -&amp;gt; Add TA&amp;quot; page, he/she can add/remove new TA to the course. Every time a new TA is added or removed, the page reloads to reflect the changes, even if the userid used does not exist.&lt;br /&gt;
&lt;br /&gt;
'''Updates/Changes:''' This page has been updated such that an instructor can add a new TA or remove a new TA using AJAX. With these updates, the changes are reflected on the page without reloading the page, thus saving time.&lt;br /&gt;
* Updated the ''course/view_teaching_assistants.html.erb'' file in views so that the TAs are listed by rendering another partial ''_ta.html.erb''. This is done so that when a new TA has been added, AJAX call can be used to render the format required for the new TA in the list append to the already existing list without reloading the page.&lt;br /&gt;
[[File:View_teaching_assistants_html_erb.png]]&lt;br /&gt;
&lt;br /&gt;
* Created a new file ''course/_ta.html.erb'' in views which is a partial as described above and contains the code to list the TAs. The link_to &amp;quot;Delete&amp;quot; line in this file is updated to use :remote=&amp;gt;:true, so that AJAX call can be made to remove the TA remotely without reloading the page.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;%= link_to &amp;quot;Delete&amp;quot;, { :action =&amp;gt; 'remove_ta', :controller =&amp;gt;'course', :id =&amp;gt; ta.id, :course_id =&amp;gt; ta.course_id }, method: :post, :remote =&amp;gt; true, :class =&amp;gt; 'remove_ta' %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
[[File:Ta.png]]&lt;br /&gt;
&lt;br /&gt;
* Updated the ''course/_add_individual.html.erb'' file in views to perform the form_tag action to Add a TA remotely using :remote=&amp;gt;:true. In the below code, ''form_action'' and ''remote'' are local variables passed to this partial from ''course/view_teaching_assistants.html.erb'' with the values &amp;quot;add_ta&amp;quot; and &amp;quot;true&amp;quot; respectively &lt;br /&gt;
[[File:Add_individual_html_erb.png]]&lt;br /&gt;
&lt;br /&gt;
* Updated the ''course_controller.rb&amp;quot; file and replaced the redirect option in ''add_ta'' and ''remove_ta'' to render ''add_ta.js.erb'' and ''remove_ta.js.erb''. Also changed ''flash[:error]'' to ''flash.now[:error]'' so that the flash message is displayed now instead of after page reload.&lt;br /&gt;
[[File:Course_controller_rb1.png]]&lt;br /&gt;
&lt;br /&gt;
* Added a new file ''course/add.js.erb'' and ''course/remove_ta.js.erb'' to views. The ''add_ta.js.erb'' file renders the newly added TA and appends it to the list of TAs. It also shows flash error message if the userid used to add TA does not exist. Similarly, ''remote_ta.js.erb'' file removes the deleted TA from the list.&lt;br /&gt;
[[File:add_remove_js_erb.png]]&lt;br /&gt;
&lt;br /&gt;
===Edit Questionnaire===&lt;br /&gt;
&lt;br /&gt;
'''Current scenario :''' page consists of different subsections for creating questionnaire,adding questions to the questionnaire and saving the questionnaire i.e.&lt;br /&gt;
*_questionnaire.html.erb&lt;br /&gt;
&lt;br /&gt;
Adding questions feature is performed in the following method of ''questionnaires_controller.rb'' class&lt;br /&gt;
&lt;br /&gt;
def add_new_questions&lt;br /&gt;
    questionnaire_id = params[:id] unless params[:id].nil?&lt;br /&gt;
    num_of_existed_questions = Questionnaire.find(questionnaire_id).questions.size&lt;br /&gt;
    ((num_of_existed_questions + 1)..(num_of_existed_questions + params[:question][:total_num].to_i)).each do |i|&lt;br /&gt;
      question = Object.const_get(params[:question][:type]).create(txt: '', questionnaire_id: questionnaire_id, seq: i, type: params[:question][:type], break_before: true)&lt;br /&gt;
      if question.is_a? ScoredQuestion&lt;br /&gt;
        question.weight = 1&lt;br /&gt;
        question.max_label = 'Strongly agree'&lt;br /&gt;
        question.min_label = 'Strongly disagree'&lt;br /&gt;
      end&lt;br /&gt;
      question.size = '50, 3' if question.is_a? Criterion&lt;br /&gt;
      question.alternatives = '0|1|2|3|4|5' if question.is_a? Dropdown&lt;br /&gt;
      question.size = '60, 5' if question.is_a? TextArea&lt;br /&gt;
      question.size = '30' if question.is_a? TextField&lt;br /&gt;
      begin&lt;br /&gt;
        question.save&lt;br /&gt;
      rescue&lt;br /&gt;
        flash[:error] = $ERROR_INFO&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
    redirect_to edit_questionnaire_path(questionnaire_id.to_sym)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This method invokes ''question.create'' method in ''questions_cotroller.rb'' and saves the created question to the database. Then it redirects to the ''edit.html.erb'' page which causes page refresh while adding questions.&lt;br /&gt;
&lt;br /&gt;
'''Solution:''' This problem was tried to solve using AJAX by changing or adding the following classes and pages &lt;br /&gt;
* _question.html.erb (added) - displays added question&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;td align=&amp;quot;center&amp;quot;&amp;gt;&amp;lt;a rel=&amp;quot;nofollow&amp;quot; data-method=&amp;quot;delete&amp;quot; href=&amp;quot;/questions/' &amp;lt;%= @question.id%&amp;gt; '&amp;quot;&amp;gt;Remove&amp;lt;/a&amp;gt;&amp;lt;/td&amp;gt;'&lt;br /&gt;
        &amp;lt;td&amp;gt;&amp;lt;input size=&amp;quot;6&amp;quot; value=&amp;quot;' &amp;lt;%= @question.seq%&amp;gt; '&amp;quot; name=&amp;quot;question[' question.id %&amp;gt;'][seq]&amp;quot; id=&amp;quot;question_' +&amp;lt;%=@question.id %&amp;gt; '_seq&amp;quot; type=&amp;quot;text&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
        &amp;lt;td&amp;gt;&amp;lt;textarea cols=&amp;quot;50&amp;quot; rows=&amp;quot;1&amp;quot; name=&amp;quot;question[' &amp;lt;%= @question.id%&amp;gt; '][txt]&amp;quot; id=&amp;quot;question_' &amp;lt;%= @question.id%&amp;gt; '_txt&amp;quot; placeholder=&amp;quot;Edit question content here&amp;quot;&amp;gt;' &amp;lt;%= @question.txt%&amp;gt; '&amp;lt;/textarea&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
        &amp;lt;td&amp;gt;&amp;lt;input size=&amp;quot;10&amp;quot; disabled=&amp;quot;disabled&amp;quot; value=&amp;quot;'  &amp;lt;%= @question.type%&amp;gt;  '&amp;quot; name=&amp;quot;question[' &amp;lt;%= @question.id%&amp;gt;'][type]&amp;quot; id=&amp;quot;question_' &amp;lt;%= @question.id%&amp;gt; '_type&amp;quot; type=&amp;quot;text&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
        &amp;lt;td&amp;gt;&amp;lt;!--placeholder (QuestionnaireHeader does not need weight)--&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* add_new_questions.js.erb (added) - appends the html content with added question in ''_question.html.erb'' to  questions_table in ''_questionnaire.html.erb''&lt;br /&gt;
&lt;br /&gt;
   $(&amp;quot;#questions_table&amp;quot;).append(&amp;quot;&amp;lt;%= j render :partial =&amp;gt; 'question',&lt;br /&gt;
           :locals =&amp;gt; {question: @question, :id =&amp;gt; @question.id, :controller =&amp;gt; 'questions'} %&amp;gt;&amp;quot;);&lt;br /&gt;
  &lt;br /&gt;
* edit.html.erb (modified : code removed) - following code is removed as it internally calls respective question header models and appends html string to questions_table internally.&lt;br /&gt;
      &lt;br /&gt;
      &amp;lt;% for @question in @questionnaire.questions do%&amp;gt;&lt;br /&gt;
        &amp;lt;%-# The following line call certain method of the object, which returns html string-%&amp;gt;&lt;br /&gt;
        &amp;lt;%= @question.edit %&amp;gt;&lt;br /&gt;
      &amp;lt;% end %&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
@question.edit invokes ''QuestionHeader.rb'' model which adds html content&lt;br /&gt;
     def edit(_count)&lt;br /&gt;
    html = '&amp;lt;tr&amp;gt;'&lt;br /&gt;
    html += '&amp;lt;td align=&amp;quot;center&amp;quot;&amp;gt;&amp;lt;a rel=&amp;quot;nofollow&amp;quot; data-method=&amp;quot;delete&amp;quot; href=&amp;quot;/questions/' + self.id.to_s + '&amp;quot;&amp;gt;Remove&amp;lt;/a&amp;gt;&amp;lt;/td&amp;gt;'&lt;br /&gt;
    html += '&amp;lt;td&amp;gt;&amp;lt;input size=&amp;quot;6&amp;quot; value=&amp;quot;' + self.seq.to_s + '&amp;quot; name=&amp;quot;question[' + self.id.to_s + '][seq]&amp;quot; id=&amp;quot;question_' + self.id.to_s + '_seq&amp;quot; type=&amp;quot;text&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;'&lt;br /&gt;
    html += '&amp;lt;td&amp;gt;&amp;lt;textarea cols=&amp;quot;50&amp;quot; rows=&amp;quot;1&amp;quot; name=&amp;quot;question[' + self.id.to_s + '][txt]&amp;quot; id=&amp;quot;question_' + self.id.to_s + '_txt&amp;quot; placeholder=&amp;quot;Edit question content here&amp;quot;&amp;gt;' + self.txt + '&amp;lt;/textarea&amp;gt;&amp;lt;/td&amp;gt;'&lt;br /&gt;
    html += '&amp;lt;td&amp;gt;&amp;lt;input size=&amp;quot;10&amp;quot; disabled=&amp;quot;disabled&amp;quot; value=&amp;quot;' + self.type + '&amp;quot; name=&amp;quot;question[' + self.id.to_s + '][type]&amp;quot; id=&amp;quot;question_' + self.id.to_s + '_type&amp;quot; type=&amp;quot;text&amp;quot;&amp;gt;''&amp;lt;/td&amp;gt;'&lt;br /&gt;
    html += '&amp;lt;td&amp;gt;&amp;lt;!--placeholder (QuestionnaireHeader does not need weight)--&amp;gt;&amp;lt;/td&amp;gt;'&lt;br /&gt;
    html += '&amp;lt;/tr&amp;gt;'&lt;br /&gt;
    html.html_safe&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
* questionnaires_controller.rb (modified) - add_new_questions method is modified by replacing redire rendering ''add_new_questions.js.erb'' file&lt;br /&gt;
&lt;br /&gt;
  render :action=&amp;gt; 'add_new_questions.js.erb', :layout=&amp;gt;false, :question=&amp;gt; question&lt;br /&gt;
   #redirect_to edit_questionnaire_path(questionnaire_id.to_sym)&lt;br /&gt;
&lt;br /&gt;
'''Issue :''' But this solution is not working as AJAX can be applied to the browser side processing if the controller method is redirecting to the same page, which is not in this case as page gets redirected from question.html.erb to edit.html.erb. Another problem faced is the creation of questions which is called through ''_questionnaire.html.erb'' but not through ''_question.html.erb'' which makes it difficult to pass correct questionnaire id to the AJAX call.&lt;br /&gt;
&lt;br /&gt;
'''Alternative Approach to Edit Questionnaire:''' Another approach to solve this issue is to create a seperate java-script function which handles the entire process of adding,saving,deleting questions and appending them. Call this function from ''_questionnaire.html.erb'' instead of invoking add_new_questions method. Questions can be saved and retrived from data using JavaScript Rest API calls. But, this approach not only needs to restructure entire questionnaire structure and many components in the Expertiza project but also violates the MVC design of the project.&lt;br /&gt;
&lt;br /&gt;
===Un-submit reviews===&lt;br /&gt;
'''Earlier scenario:''' When an instructor/TA goes to &amp;quot;Manage Assignments -&amp;gt; Assign Reviewers&amp;quot; page, he/she can see a list of all the topics, the contributors and the reviewers for each topic. This page did not show the status of each review which can be in Assigned state or Saved state or Submitted state. Also, there was no way for the instructor/TA to un-submit an already submitted review.&lt;br /&gt;
&lt;br /&gt;
'''New Additions:'''&lt;br /&gt;
* Updated the ''review_mappings/_list_review_mappings.html.erb'' file in views to display the status of each review by the reviewer. For each review_mapping, the code checks if there is a response in ''Response'' table with the same ''map_id'' used in the review_mappings on this page. &lt;br /&gt;
** If there is no such response, it means that the reviewer has not saved/submitted the review and it is currently in Assigned State. So, &amp;quot;Response Status: Saved&amp;quot; is shown for that review.&lt;br /&gt;
** If there is a response, the last (latest) response is checked as per requirement and the ''is_submitted'' attribute of this response is checked in the ''Response'' table.&lt;br /&gt;
*** If the attribute is false, the review has been saved but not submitted. So, &amp;quot;Response Status: Saved&amp;quot; is shown for that review.&lt;br /&gt;
*** If the attribute is true, the review has been submitted. So, &amp;quot;Response Status: Submitted&amp;quot; is shown for that review. Next to this, a link is created to un-submit the review. Clicking on this link changes the ''is_submitted'' attribute to false and updates the Response Status to Saved on the page by using AJAX call, without reloading the page&lt;br /&gt;
[[File:List_review_mappings_html_erb.png]]&lt;br /&gt;
* Added a new method &amp;quot;unsubmit_review&amp;quot; to the ''review_mapping_controller.rb'' file. In this, we first find the latest response and then update the ''is_submitted'' attribute to false. The flash message is created based on whether the response was updated correctly. After this, ''unsubmit_review.js.rb'' file is rendered which updates the response status for the corresponding review on the page to Saved, without reloading the page&lt;br /&gt;
[[File:Review_mapping_controller_rb.png]]&lt;br /&gt;
* Added a new file ''review_mappings/unsubmit_review.js.erb'' to views. This file just changes the response status for the corresponding review displayed on the page to Saved from Submit after the review has been un-submitted and also prints the corresponding success or error flash message.&lt;br /&gt;
[[File:Unsubmit_review_js_erb.png]]&lt;br /&gt;
* Added a new line to ''routes.rb'' page for unsubmit_review action&lt;br /&gt;
[[File:Routes_rb.png]]&lt;br /&gt;
&lt;br /&gt;
==Test Plan==&lt;br /&gt;
&lt;br /&gt;
===Log in details===&lt;br /&gt;
&lt;br /&gt;
'''Username:''' instructor6&lt;br /&gt;
'''password:''' password&lt;br /&gt;
&lt;br /&gt;
Some valid user id's are student5000, student5001, student5002 etc. These can be used while adding new Participant or TA as described below.&lt;br /&gt;
&lt;br /&gt;
===Automated Testing===&lt;br /&gt;
* Created a helper module ''wait_for_ajax.rb'' with methods to wait for ajax requests to finish&lt;br /&gt;
* Updated the test &amp;quot;check to see if participants can be added&amp;quot; in ''assignment_creation_spec.rb'' to wait for AJAX calls to finish after adding a participant by using the helper module created&lt;br /&gt;
* Added a new test named &amp;quot;can unsubmit a review&amp;quot; in ''review_mapping_spec.rb''&lt;br /&gt;
** In this test, a new reviewer is added to review mapping, a new review is created and submitted, and then checked if unsubmit functionality is working correctly&lt;br /&gt;
* Added a new file ''course_creation_spec.rb'' to test adding and remove TA's&lt;br /&gt;
&lt;br /&gt;
===UI Testing===&lt;br /&gt;
&lt;br /&gt;
'''Steps to test adding participant: '''&lt;br /&gt;
&lt;br /&gt;
* Login as instructor&lt;br /&gt;
* Go to Manage -&amp;gt; Assignments.&lt;br /&gt;
* Switch to Assignments tab incase you are on some other tab&lt;br /&gt;
* For any assignment, click on the 'Add Participant' icon to go on add new participant page&lt;br /&gt;
* Enter userid of the participant and click on Add to add the participant&lt;br /&gt;
&lt;br /&gt;
'' Expected Output: '' When add button is clicked with valid userid, new participant should be added to the list without the page getting reloaded. In case of an attempt to add invalid user, the error should be displayed on top without page getting reloaded.&lt;br /&gt;
&lt;br /&gt;
''' Steps to test adding/removing TA:'''&lt;br /&gt;
&lt;br /&gt;
* Login as instructor&lt;br /&gt;
* Go to Manage -&amp;gt; Courses.&lt;br /&gt;
* Switch to Courses tab incase you are on some other tab&lt;br /&gt;
* For any course, click on the 'Add TA' icon to go on add new TA page&lt;br /&gt;
* Enter userid of the TA and click on Add to add the TA&lt;br /&gt;
* Click on 'remove_ta' link for any TA in the list to remove the TA&lt;br /&gt;
&lt;br /&gt;
'' Expected Output: '' When add button is clicked with valid userid, new TA should be added to the list without the page getting reloaded. In case of an attempt to add invalid user, the error should be displayed on top without page getting reloaded. When remove_ta link is clicked for any TA in the list, that corresponding TA should be removed from the list without the page getting reloaded.&lt;br /&gt;
Note: A duplicate TA is currently allowed. This was a part of original (earlier) functionality, and as this project involved changes to use AJAX and not changes to the actual functionality, this original functionality is not changed &lt;br /&gt;
&lt;br /&gt;
''' Steps to test adding question in questionnaire:'''&lt;br /&gt;
&lt;br /&gt;
* Login 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.  You will now be navigated to page where you can add new questions to the questionnaire. &lt;br /&gt;
* Click on add button in &amp;quot;Questions&amp;quot; section.&lt;br /&gt;
&lt;br /&gt;
''Expected output:'' When add button is clicked, question should be created and the questionnaire page should not get reloaded&lt;br /&gt;
&lt;br /&gt;
''' Steps to test un-submit reviews'''&lt;br /&gt;
&lt;br /&gt;
* Login as instructor&lt;br /&gt;
* Go to Manage -&amp;gt; Assignments.&lt;br /&gt;
* Switch to Assignments tab incase you are on some other tab&lt;br /&gt;
* For any assignment, click on the 'Assign reviewers' icon to go to the review mappings page&lt;br /&gt;
** Note: Some assignments might not have reviewers. So, try this for assignments with many reviewers&lt;br /&gt;
* For any review with Review Status = Submitted, click on 'unsubmit' button&lt;br /&gt;
&lt;br /&gt;
''Expected output:'' For every review, the review status should be seen as either Assigned or Saved or Submitted. For submitted reviews, when unsubmit button is clicked, that review should be unsubmitted and status should change to Saved without page getting reloaded.&lt;br /&gt;
&lt;br /&gt;
==Project Deployment==&lt;br /&gt;
&lt;br /&gt;
Expertiza setup is done in VCL which is reserved for 30 days with Ubuntu 14.04 base. Started expertiza server publicly and link to access the server is:&lt;br /&gt;
http://152.7.99.101:3000&lt;br /&gt;
&lt;br /&gt;
==Future work==&lt;br /&gt;
&lt;br /&gt;
In future, we will try to implement the edit questionnaire part using alternative approach. We will try to implement testing using rspec framework and improve the UI design of the pages.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
* https://www.youtube.com/channel/UCdKXzox7hrWjfOMML6FzTWg&lt;br /&gt;
* https://github.com/expertiza/expertiza&lt;br /&gt;
* http://wiki.expertiza.ncsu.edu/index.php/Expertiza_documentation&lt;br /&gt;
* http://guides.rubyonrails.org/working_with_javascript_in_rails.html&lt;br /&gt;
* http://wiki.expertiza.ncsu.edu/index.php/Development:Setup:Linux:Debian&lt;/div&gt;</summary>
		<author><name>Dguttik</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/Use_Ajax_to_add_Participants,TA_and_Edit_Questionnaire&amp;diff=107428</id>
		<title>CSC/ECE 517 Spring 2017/Use Ajax to add Participants,TA and Edit Questionnaire</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/Use_Ajax_to_add_Participants,TA_and_Edit_Questionnaire&amp;diff=107428"/>
		<updated>2017-03-24T03:29:25Z</updated>

		<summary type="html">&lt;p&gt;Dguttik: /* Project Deployment */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;nowiki&amp;gt;  Expertiza is an opensource software developed to assist people in education institutions to perform peer reviews and group projects. It is exceptionally helpful to the students and instructors. The software is designed in MVC (Model-View-Controller) architecture using ruby on rails.&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
Expertiza provides many categories to manage by an instructor. Few of them are assignments, courses, questionnaires. Adding of records like participants, Teaching assistants and questions in these pages is done by submitting the entire page. This requires loading of entire page to add a record and loading of entire page again to save it.&lt;br /&gt;
&lt;br /&gt;
==Proposed Solution==&lt;br /&gt;
This project proposes use of ajax for the required pages to avoid page reloading at the time of adding and saving records. This solution will make sure that adding or saving of record is taken care in the browser itself. It can be achieved by calling corresponding controller method, adding/saving the record and rendering it back to javascript pages instead of redirecting it to the same page. Javascript pages will append the added record functionality to the initial page. Thus, page refresh is avoided.&lt;br /&gt;
&lt;br /&gt;
==Tasks==&lt;br /&gt;
* Add Participant in the assignments section using ajax &lt;br /&gt;
* Add/Remove TA in the courses section using ajax&lt;br /&gt;
* Edit Questionnaire by using ajax for adding questions in the Questionnaire section&lt;br /&gt;
* Show Review Status on assign reviewers page and allow to un-submit a review using ajax&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
&lt;br /&gt;
===Adding participant===&lt;br /&gt;
'''Earlier scenario:''' When an instructor goes to &amp;quot;Manage Assignments -&amp;gt; Add Participants&amp;quot; page, he/she can add/remove new Participant to the assignment. The add page also displays list of participants above the form for new participant. Every time a new Participant is added, the page reloads to reflect the changes and render the updated list of participants, even in case of non-existing userid.&lt;br /&gt;
&lt;br /&gt;
'''Updates/Changes:'''&lt;br /&gt;
This page has been updated such that an instructor can add a new Participant using AJAX [https://en.wikipedia.org/wiki/Ajax_(programming) link AJAX]. After adding AJAX changes, the list gets updated without reloading the entire page. The changes made are below.&lt;br /&gt;
&lt;br /&gt;
* Updated the ''shared_scripts/_user_list.html.erb'' file in views so that the Participants are listed by rendering another partial ''_participant.html.erb'' in participants controller. This change is to make it feasible to add AJAX to just append to the list without any extra formatting.&lt;br /&gt;
[[File:User_list.PNG]]&lt;br /&gt;
&lt;br /&gt;
* Created a new file ''participants/add.js.erb'' for adding AJAX to render newly added participant in case of successful addition and display error in case of any error.&lt;br /&gt;
[[File:Javascript changes.PNG]]&lt;br /&gt;
&lt;br /&gt;
* Updated the ''shared_scripts/_add_individual.html.erb'' form such that request should be through AJAX by setting remote flag to true.&lt;br /&gt;
[[File:Add_individual.PNG]]&lt;br /&gt;
&lt;br /&gt;
* Updated the participants controller ''participant_controller.rb'' in controllers to render javascript when add method is invoked by the form submit action instead of redirect to list page.&lt;br /&gt;
[[File:Controller_changes.PNG]]&lt;br /&gt;
&lt;br /&gt;
===Adding/Removing TA===&lt;br /&gt;
'''Earlier scenario:''' When an instructor goes to &amp;quot;Manage Courses -&amp;gt; Add TA&amp;quot; page, he/she can add/remove new TA to the course. Every time a new TA is added or removed, the page reloads to reflect the changes, even if the userid used does not exist.&lt;br /&gt;
&lt;br /&gt;
'''Updates/Changes:'''&lt;br /&gt;
This page has been updated such that an instructor can add a new TA or remove a new TA using ajax. With these updates, the changes are reflected on the page without reloading the page, thus saving time.&lt;br /&gt;
* Updated the ''course/view_teaching_assistants.html.erb'' file in views so that the TAs are listed by rendering another partial ''_ta.html.erb''. This is done so that when a new TA has been added, ajax call can be used to render the format required for the new TA in the list append to the already existing list without reloading the page.&lt;br /&gt;
[[File:View_teaching_assistants_html_erb.png]]&lt;br /&gt;
* Created a new file ''course/_ta.html.erb'' in views which is a partial as described above and contains the code to list the TAs. The link_to &amp;quot;Delete&amp;quot; line in this file is updated to use :remote=&amp;gt;:true, so that ajax call can be made to remove the TA remotely without reloading the page.&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
&amp;lt;%= link_to &amp;quot;Delete&amp;quot;, { :action =&amp;gt; 'remove_ta', :controller =&amp;gt;'course', :id =&amp;gt; ta.id, :course_id =&amp;gt; ta.course_id }, method: :post, :remote =&amp;gt; true, :class =&amp;gt; 'remove_ta' %&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* Updated the ''course/_add_individual.html.erb'' file in views to perform the form_tag action to Add a TA remotely using :remote=&amp;gt;:true. In the below code, ''form_action'' and ''remote'' are local variables passed to this partial from ''course/view_teaching_assistants.html.erb'' with the values &amp;quot;add_ta&amp;quot; and &amp;quot;true&amp;quot; respectively &lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
&amp;lt;%= form_tag form_action, :method =&amp;gt; 'post', :remote =&amp;gt; remote do %&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* Updated the ''course_controller.rb&amp;quot; file and replaced the redirect option in ''add_ta'' and ''remove_ta'' to render ''add_ta.js.erb'' and ''remove_ta.js.erb''. Also changed ''flash[:error]'' to ''flash.now[:error]'' so that the flash message is displayed now instead of after page reload.&lt;br /&gt;
[[File:Course_controller_rb1.png]]&lt;br /&gt;
* Added a new file ''course/add.js.erb'' and ''course/remove_ta.js.erb'' to views. The ''add_ta.js.erb'' file renders the newly added TA and appends it to the list of TAs. It also shows flash error message if the userid used to add TA does not exist. Similarly, ''remote_ta.js.erb'' file removes the deleted TA from the list.&lt;br /&gt;
[[File:add_remove_js_erb.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Edit Questionnaire===&lt;br /&gt;
&lt;br /&gt;
'''Current scenario :''' page consists of different subsections for creating questionnaire,adding questions to the questionnaire and saving the questionnaire i.e.&lt;br /&gt;
*_questionnaire.html.erb&lt;br /&gt;
&lt;br /&gt;
Adding questions feature is performed in the following method of ''questionnaires_controller.rb'' class&lt;br /&gt;
&lt;br /&gt;
def add_new_questions&lt;br /&gt;
    questionnaire_id = params[:id] unless params[:id].nil?&lt;br /&gt;
    num_of_existed_questions = Questionnaire.find(questionnaire_id).questions.size&lt;br /&gt;
    ((num_of_existed_questions + 1)..(num_of_existed_questions + params[:question][:total_num].to_i)).each do |i|&lt;br /&gt;
      question = Object.const_get(params[:question][:type]).create(txt: '', questionnaire_id: questionnaire_id, seq: i, type: params[:question][:type], break_before: true)&lt;br /&gt;
      if question.is_a? ScoredQuestion&lt;br /&gt;
        question.weight = 1&lt;br /&gt;
        question.max_label = 'Strongly agree'&lt;br /&gt;
        question.min_label = 'Strongly disagree'&lt;br /&gt;
      end&lt;br /&gt;
      question.size = '50, 3' if question.is_a? Criterion&lt;br /&gt;
      question.alternatives = '0|1|2|3|4|5' if question.is_a? Dropdown&lt;br /&gt;
      question.size = '60, 5' if question.is_a? TextArea&lt;br /&gt;
      question.size = '30' if question.is_a? TextField&lt;br /&gt;
      begin&lt;br /&gt;
        question.save&lt;br /&gt;
      rescue&lt;br /&gt;
        flash[:error] = $ERROR_INFO&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
    redirect_to edit_questionnaire_path(questionnaire_id.to_sym)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This method invokes ''question.create'' method in ''questions_cotroller.rb'' and saves the created question to the database. Then it redirects to the ''edit.html.erb'' page which causes page refresh while adding questions.&lt;br /&gt;
&lt;br /&gt;
'''Solution:''' This problem was tried to solve using ajax by changing or adding the following classes and pages &lt;br /&gt;
* _question.html.erb (added) - displays added question&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;td align=&amp;quot;center&amp;quot;&amp;gt;&amp;lt;a rel=&amp;quot;nofollow&amp;quot; data-method=&amp;quot;delete&amp;quot; href=&amp;quot;/questions/' &amp;lt;%= @question.id%&amp;gt; '&amp;quot;&amp;gt;Remove&amp;lt;/a&amp;gt;&amp;lt;/td&amp;gt;'&lt;br /&gt;
        &amp;lt;td&amp;gt;&amp;lt;input size=&amp;quot;6&amp;quot; value=&amp;quot;' &amp;lt;%= @question.seq%&amp;gt; '&amp;quot; name=&amp;quot;question[' question.id %&amp;gt;'][seq]&amp;quot; id=&amp;quot;question_' +&amp;lt;%=@question.id %&amp;gt; '_seq&amp;quot; type=&amp;quot;text&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
        &amp;lt;td&amp;gt;&amp;lt;textarea cols=&amp;quot;50&amp;quot; rows=&amp;quot;1&amp;quot; name=&amp;quot;question[' &amp;lt;%= @question.id%&amp;gt; '][txt]&amp;quot; id=&amp;quot;question_' &amp;lt;%= @question.id%&amp;gt; '_txt&amp;quot; placeholder=&amp;quot;Edit question content here&amp;quot;&amp;gt;' &amp;lt;%= @question.txt%&amp;gt; '&amp;lt;/textarea&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
        &amp;lt;td&amp;gt;&amp;lt;input size=&amp;quot;10&amp;quot; disabled=&amp;quot;disabled&amp;quot; value=&amp;quot;'  &amp;lt;%= @question.type%&amp;gt;  '&amp;quot; name=&amp;quot;question[' &amp;lt;%= @question.id%&amp;gt;'][type]&amp;quot; id=&amp;quot;question_' &amp;lt;%= @question.id%&amp;gt; '_type&amp;quot; type=&amp;quot;text&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
        &amp;lt;td&amp;gt;&amp;lt;!--placeholder (QuestionnaireHeader does not need weight)--&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* add_new_questions.js.erb (added) - appends the html content with added question in ''_question.html.erb'' to  questions_table in ''_questionnaire.html.erb''&lt;br /&gt;
&lt;br /&gt;
   $(&amp;quot;#questions_table&amp;quot;).append(&amp;quot;&amp;lt;%= j render :partial =&amp;gt; 'question',&lt;br /&gt;
           :locals =&amp;gt; {question: @question, :id =&amp;gt; @question.id, :controller =&amp;gt; 'questions'} %&amp;gt;&amp;quot;);&lt;br /&gt;
  &lt;br /&gt;
* edit.html.erb (modified : code removed) - following code is removed as it internally calls respective question header models and appends html string to questions_table internally.&lt;br /&gt;
      &lt;br /&gt;
      &amp;lt;% for @question in @questionnaire.questions do%&amp;gt;&lt;br /&gt;
        &amp;lt;%-# The following line call certain method of the object, which returns html string-%&amp;gt;&lt;br /&gt;
        &amp;lt;%= @question.edit %&amp;gt;&lt;br /&gt;
      &amp;lt;% end %&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
@question.edit invokes ''QuestionHeader.rb'' model which adds html content&lt;br /&gt;
     def edit(_count)&lt;br /&gt;
    html = '&amp;lt;tr&amp;gt;'&lt;br /&gt;
    html += '&amp;lt;td align=&amp;quot;center&amp;quot;&amp;gt;&amp;lt;a rel=&amp;quot;nofollow&amp;quot; data-method=&amp;quot;delete&amp;quot; href=&amp;quot;/questions/' + self.id.to_s + '&amp;quot;&amp;gt;Remove&amp;lt;/a&amp;gt;&amp;lt;/td&amp;gt;'&lt;br /&gt;
    html += '&amp;lt;td&amp;gt;&amp;lt;input size=&amp;quot;6&amp;quot; value=&amp;quot;' + self.seq.to_s + '&amp;quot; name=&amp;quot;question[' + self.id.to_s + '][seq]&amp;quot; id=&amp;quot;question_' + self.id.to_s + '_seq&amp;quot; type=&amp;quot;text&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;'&lt;br /&gt;
    html += '&amp;lt;td&amp;gt;&amp;lt;textarea cols=&amp;quot;50&amp;quot; rows=&amp;quot;1&amp;quot; name=&amp;quot;question[' + self.id.to_s + '][txt]&amp;quot; id=&amp;quot;question_' + self.id.to_s + '_txt&amp;quot; placeholder=&amp;quot;Edit question content here&amp;quot;&amp;gt;' + self.txt + '&amp;lt;/textarea&amp;gt;&amp;lt;/td&amp;gt;'&lt;br /&gt;
    html += '&amp;lt;td&amp;gt;&amp;lt;input size=&amp;quot;10&amp;quot; disabled=&amp;quot;disabled&amp;quot; value=&amp;quot;' + self.type + '&amp;quot; name=&amp;quot;question[' + self.id.to_s + '][type]&amp;quot; id=&amp;quot;question_' + self.id.to_s + '_type&amp;quot; type=&amp;quot;text&amp;quot;&amp;gt;''&amp;lt;/td&amp;gt;'&lt;br /&gt;
    html += '&amp;lt;td&amp;gt;&amp;lt;!--placeholder (QuestionnaireHeader does not need weight)--&amp;gt;&amp;lt;/td&amp;gt;'&lt;br /&gt;
    html += '&amp;lt;/tr&amp;gt;'&lt;br /&gt;
    html.html_safe&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
* questionnaires_controller.rb (modified) - add_new_questions method is modified by replacing redire rendering ''add_new_questions.js.erb'' file&lt;br /&gt;
&lt;br /&gt;
  render :action=&amp;gt; 'add_new_questions.js.erb', :layout=&amp;gt;false, :question=&amp;gt; question&lt;br /&gt;
   #redirect_to edit_questionnaire_path(questionnaire_id.to_sym)&lt;br /&gt;
&lt;br /&gt;
'''Issue :''' But this solution is not working as Ajax can be applied to the browser side processing if the controller method is redirecting to the same page, which is not in this case as page gets redirected from question.html.erb to edit.html.erb. Another problem faced is the creation of questions which is called through ''_questionnaire.html.erb'' but not through ''_question.html.erb'' which makes it difficult to pass correct questionnaire id to the ajax call.&lt;br /&gt;
&lt;br /&gt;
'''Alternative Approach to Edit Questionnaire:''' Another approach to solve this issue is to create a seperate java-script function which handles the entire process of adding,saving,deleting questions and appending them. Call this function from ''_questionnaire.html.erb'' instead of invoking add_new_questions method. Questions can be saved and retrived from data using Javascript Rest API calls. But, this approach not only needs to restructure entire questionnaire structure and many components in the Expertiza project but also violates the MVC design of the project.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Un-submit reviews===&lt;br /&gt;
'''Earlier scenario:''' When an instructor/TA goes to &amp;quot;Manage Assignments -&amp;gt; Assign Reviewers&amp;quot; page, he/she can see a list of all the topics, the contributors and the reviewers for each topic. This page did not show the status of each review which can be in Assigned state or Saved state or Submitted state. Also, there was no way for the instructor/TA to un-submit an already submitted review.&lt;br /&gt;
&lt;br /&gt;
'''New Additions:'''&lt;br /&gt;
* Updated the ''review_mappings/_list_review_mappings.html.erb'' file in views to display the status of each review by the reviewer. For each review_mapping, the code checks if there is a response in ''Response'' table with the same ''map_id'' used in the review_mappings on this page. &lt;br /&gt;
** If there is no such response, it means that the reviewer has not saved/submitted the review and it is currently in Assigned State. So, &amp;quot;Response Status: Saved&amp;quot; is shown for that review.&lt;br /&gt;
** If there is a response, the last (latest) response is checked as per requirement and the ''is_submitted'' attribute of this response is checked in the ''Response'' table.&lt;br /&gt;
*** If the attribute is false, the review has been saved but not submitted. So, &amp;quot;Response Status: Saved&amp;quot; is shown for that review.&lt;br /&gt;
*** If the attribute is true, the review has been submitted. So, &amp;quot;Response Status: Submitted&amp;quot; is shown for that review. Next to this, a link is created to un-submit the review. Clicking on this link changes the ''is_submitted'' attribute to false and updates the Response Status to Saved on the page by using ajax call, without reloading the page&lt;br /&gt;
[[File:List_review_mappings_html_erb.png]]&lt;br /&gt;
* Added a new method &amp;quot;unsubmit_review&amp;quot; to the ''review_mapping_controller.rb'' file. In this, we first find the latest response and then update the ''is_submitted'' attribute to false. The flash message is created based on whether the response was updated correctly. After this, ''unsubmit_review.js.rb'' file is rendered which updates the response status for the corresponding review on the page to Saved, without reloading the page&lt;br /&gt;
[[File:Review_mapping_controller_rb.png]]&lt;br /&gt;
* Added a new file ''review_mappings/unsubmit_review.js.erb'' to views. This file just changes the response status for the corresponding review displayed on the page to Saved from Submit after the review has been un-submitted and also prints the corresponding success or error flash message.&lt;br /&gt;
[[File:Unsubmit_review_js_erb.png]]&lt;br /&gt;
* Added a new line to ''routes.rb'' page for unsubmit_review action&lt;br /&gt;
[[File:Routes_rb.png]]&lt;br /&gt;
&lt;br /&gt;
==UI Testing==&lt;br /&gt;
&lt;br /&gt;
Log in details&lt;br /&gt;
&lt;br /&gt;
'''Username:''' instructor6&lt;br /&gt;
'''password:''' password&lt;br /&gt;
&lt;br /&gt;
'''Steps to test adding participant: '''&lt;br /&gt;
&lt;br /&gt;
* Login as instructor&lt;br /&gt;
* Go to Manage -&amp;gt; Assignments. Add new participant by clicking on the 'Add Participant' icon.&lt;br /&gt;
* Enter Userid of the participant and click on Add&lt;br /&gt;
&lt;br /&gt;
'' Expected Output: '' when add button is clicked with valid userid, new participant should be added to the list without the page getting reloaded. In case of attempt to add invalid user, the error should be displayed on top without page getting reloaded.&lt;br /&gt;
&lt;br /&gt;
''' Steps to test adding TA:'''&lt;br /&gt;
&lt;br /&gt;
* Login as instructor&lt;br /&gt;
* Go to Manage -&amp;gt; Courses. Add new participant by clicking on the 'Add TA' icon.&lt;br /&gt;
* Enter Userid of the TA and click on Add&lt;br /&gt;
&lt;br /&gt;
'' Expected Output: '' when add button is clicked with valid userid, new TA should be added to the list without the page getting reloaded. In case of attempt to add invalid ID, the error should be displayed on top without page getting reloaded.&lt;br /&gt;
&lt;br /&gt;
''' Steps to test adding question in questionnaire:'''&lt;br /&gt;
&lt;br /&gt;
* Login 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.  You will now be navigated to page where you can add new questions to the questionnaire. &lt;br /&gt;
* Click on add button in &amp;quot;Questions&amp;quot; section.&lt;br /&gt;
&lt;br /&gt;
''Expected output:''  When add button is clicked, question should be created and the questionnaire page should not get reloaded&lt;br /&gt;
&lt;br /&gt;
''' Steps to test un-submit reviews'''&lt;br /&gt;
&lt;br /&gt;
==Project Deployment==&lt;br /&gt;
&lt;br /&gt;
Expertiza setup is done in VCL which is reserved for 30 days with Ubuntu 14.04 base. Started expertiza server publicly and link to access the server is.&lt;br /&gt;
https://152.7.99.101:3000&lt;br /&gt;
&lt;br /&gt;
==Future work==&lt;br /&gt;
&lt;br /&gt;
In future, we will try to implement the edit questionnaire part using alternative approach. We will try to implement testing using rspec framework and improve the UI design of the pages.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
* https://www.youtube.com/channel/UCdKXzox7hrWjfOMML6FzTWg&lt;br /&gt;
* https://github.com/expertiza/expertiza&lt;br /&gt;
* http://wiki.expertiza.ncsu.edu/index.php/Expertiza_documentation&lt;br /&gt;
* http://guides.rubyonrails.org/working_with_javascript_in_rails.html&lt;br /&gt;
* http://wiki.expertiza.ncsu.edu/index.php/Development:Setup:Linux:Debian&lt;/div&gt;</summary>
		<author><name>Dguttik</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/Use_Ajax_to_add_Participants,TA_and_Edit_Questionnaire&amp;diff=107425</id>
		<title>CSC/ECE 517 Spring 2017/Use Ajax to add Participants,TA and Edit Questionnaire</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/Use_Ajax_to_add_Participants,TA_and_Edit_Questionnaire&amp;diff=107425"/>
		<updated>2017-03-24T03:23:18Z</updated>

		<summary type="html">&lt;p&gt;Dguttik: /* Project Deployment */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;nowiki&amp;gt;  Expertiza is an opensource software developed to assist people in education institutions to perform peer reviews and group projects. It is exceptionally helpful to the students and instructors. The software is designed in MVC (Model-View-Controller) architecture using ruby on rails.&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
Expertiza provides many categories to manage by an instructor. Few of them are assignments, courses, questionnaires. Adding of records like participants, Teaching assistants and questions in these pages is done by submitting the entire page. This requires loading of entire page to add a record and loading of entire page again to save it.&lt;br /&gt;
&lt;br /&gt;
==Proposed Solution==&lt;br /&gt;
This project proposes use of ajax for the required pages to avoid page reloading at the time of adding and saving records. This solution will make sure that adding or saving of record is taken care in the browser itself. It can be achieved by calling corresponding controller method, adding/saving the record and rendering it back to javascript pages instead of redirecting it to the same page. Javascript pages will append the added record functionality to the initial page. Thus, page refresh is avoided.&lt;br /&gt;
&lt;br /&gt;
==Tasks==&lt;br /&gt;
* Add Participant in the assignments section using ajax &lt;br /&gt;
* Add/Remove TA in the courses section using ajax&lt;br /&gt;
* Edit Questionnaire by using ajax for adding questions in the Questionnaire section&lt;br /&gt;
* Show Review Status on assign reviewers page and allow to un-submit a review using ajax&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
&lt;br /&gt;
===Adding participant===&lt;br /&gt;
'''Earlier scenario:''' When an instructor goes to &amp;quot;Manage Assignments -&amp;gt; Add Participants&amp;quot; page, he/she can add/remove new Participant to the assignment. The add page also displays list of participants above the form for new participant. Every time a new Participant is added, the page reloads to reflect the changes and render the updated list of participants, even in case of non-existing userid.&lt;br /&gt;
&lt;br /&gt;
'''Updates/Changes:'''&lt;br /&gt;
This page has been updated such that an instructor can add a new Participant using AJAX [[Ajax_(programming)]]. After adding AJAX changes, the list gets updated without reloading the entire page. The changes made are below.&lt;br /&gt;
* Updated the ''shared_scripts/_user_list.html.erb'' file in views so that the Participants are listed by rendering another partial ''_participant.html.erb'' in participants controller. This change is to make it feasible to add AJAX to just append to the list without any extra formatting.&lt;br /&gt;
[[File:User_list.PNG]]&lt;br /&gt;
* Created a new file ''participants/add.js.erb'' for adding AJAX to render newly added participant in case of successful addition and display error in case of any error.&lt;br /&gt;
[[File:Javascript changes.PNG]]&lt;br /&gt;
* Updated the ''shared_scripts/_add_individual.html.erb'' form such that request should be through AJAX by setting remote flag to true.&lt;br /&gt;
[[File:Add_individual.PNG]]&lt;br /&gt;
* Updated the participants controller ''participant_controller.rb'' in controllers to render javascript when add method is invoked by the form submit action instead of redirect to list page.&lt;br /&gt;
[[File:Controller_changes.PNG]]&lt;br /&gt;
&lt;br /&gt;
===Adding/Removing TA===&lt;br /&gt;
'''Earlier scenario:''' When an instructor goes to &amp;quot;Manage Courses -&amp;gt; Add TA&amp;quot; page, he/she can add/remove new TA to the course. Every time a new TA is added or removed, the page reloads to reflect the changes, even if the userid used does not exist.&lt;br /&gt;
&lt;br /&gt;
'''Updates/Changes:'''&lt;br /&gt;
This page has been updated such that an instructor can add a new TA or remove a new TA using ajax. With these updates, the changes are reflected on the page without reloading the page, thus saving time.&lt;br /&gt;
* Updated the ''course/view_teaching_assistants.html.erb'' file in views so that the TAs are listed by rendering another partial ''_ta.html.erb''. This is done so that when a new TA has been added, ajax call can be used to render the format required for the new TA in the list append to the already existing list without reloading the page.&lt;br /&gt;
[[File:View_teaching_assistants_html_erb.png]]&lt;br /&gt;
* Created a new file ''course/_ta.html.erb'' in views which is a partial as described above and contains the code to list the TAs. The link_to &amp;quot;Delete&amp;quot; line in this file is updated to use :remote=&amp;gt;:true, so that ajax call can be made to remove the TA remotely without reloading the page.&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
&amp;lt;%= link_to &amp;quot;Delete&amp;quot;, { :action =&amp;gt; 'remove_ta', :controller =&amp;gt;'course', :id =&amp;gt; ta.id, :course_id =&amp;gt; ta.course_id }, method: :post, :remote =&amp;gt; true, :class =&amp;gt; 'remove_ta' %&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* Updated the ''course/_add_individual.html.erb'' file in views to perform the form_tag action to Add a TA remotely using :remote=&amp;gt;:true. In the below code, ''form_action'' and ''remote'' are local variables passed to this partial from ''course/view_teaching_assistants.html.erb'' with the values &amp;quot;add_ta&amp;quot; and &amp;quot;true&amp;quot; respectively &lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
&amp;lt;%= form_tag form_action, :method =&amp;gt; 'post', :remote =&amp;gt; remote do %&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* Updated the ''course_controller.rb&amp;quot; file and replaced the redirect option in ''add_ta'' and ''remove_ta'' to render ''add_ta.js.erb'' and ''remove_ta.js.erb''. Also changed ''flash[:error]'' to ''flash.now[:error]'' so that the flash message is displayed now instead of after page reload.&lt;br /&gt;
[[File:Course_controller_rb1.png]]&lt;br /&gt;
* Added a new file ''course/add.js.erb'' and ''course/remove_ta.js.erb'' to views. The ''add_ta.js.erb'' file renders the newly added TA and appends it to the list of TAs. It also shows flash error message if the userid used to add TA does not exist. Similarly, ''remote_ta.js.erb'' file removes the deleted TA from the list.&lt;br /&gt;
[[File:add_remove_js_erb.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Edit Questionnaire===&lt;br /&gt;
&lt;br /&gt;
'''Current scenario :''' page consists of different subsections for creating questionnaire,adding questions to the questionnaire and saving the questionnaire i.e.&lt;br /&gt;
*_questionnaire.html.erb&lt;br /&gt;
&lt;br /&gt;
Adding questions feature is performed in the following method of ''questionnaires_controller.rb'' class&lt;br /&gt;
&lt;br /&gt;
def add_new_questions&lt;br /&gt;
    questionnaire_id = params[:id] unless params[:id].nil?&lt;br /&gt;
    num_of_existed_questions = Questionnaire.find(questionnaire_id).questions.size&lt;br /&gt;
    ((num_of_existed_questions + 1)..(num_of_existed_questions + params[:question][:total_num].to_i)).each do |i|&lt;br /&gt;
      question = Object.const_get(params[:question][:type]).create(txt: '', questionnaire_id: questionnaire_id, seq: i, type: params[:question][:type], break_before: true)&lt;br /&gt;
      if question.is_a? ScoredQuestion&lt;br /&gt;
        question.weight = 1&lt;br /&gt;
        question.max_label = 'Strongly agree'&lt;br /&gt;
        question.min_label = 'Strongly disagree'&lt;br /&gt;
      end&lt;br /&gt;
      question.size = '50, 3' if question.is_a? Criterion&lt;br /&gt;
      question.alternatives = '0|1|2|3|4|5' if question.is_a? Dropdown&lt;br /&gt;
      question.size = '60, 5' if question.is_a? TextArea&lt;br /&gt;
      question.size = '30' if question.is_a? TextField&lt;br /&gt;
      begin&lt;br /&gt;
        question.save&lt;br /&gt;
      rescue&lt;br /&gt;
        flash[:error] = $ERROR_INFO&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
    redirect_to edit_questionnaire_path(questionnaire_id.to_sym)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This method invokes ''question.create'' method in ''questions_cotroller.rb'' and saves the created question to the database. Then it redirects to the ''edit.html.erb'' page which causes page refresh while adding questions.&lt;br /&gt;
&lt;br /&gt;
'''Solution:''' This problem was tried to solve using ajax by changing or adding the following classes and pages &lt;br /&gt;
* _question.html.erb (added) - displays added question&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;td align=&amp;quot;center&amp;quot;&amp;gt;&amp;lt;a rel=&amp;quot;nofollow&amp;quot; data-method=&amp;quot;delete&amp;quot; href=&amp;quot;/questions/' &amp;lt;%= @question.id%&amp;gt; '&amp;quot;&amp;gt;Remove&amp;lt;/a&amp;gt;&amp;lt;/td&amp;gt;'&lt;br /&gt;
        &amp;lt;td&amp;gt;&amp;lt;input size=&amp;quot;6&amp;quot; value=&amp;quot;' &amp;lt;%= @question.seq%&amp;gt; '&amp;quot; name=&amp;quot;question[' question.id %&amp;gt;'][seq]&amp;quot; id=&amp;quot;question_' +&amp;lt;%=@question.id %&amp;gt; '_seq&amp;quot; type=&amp;quot;text&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
        &amp;lt;td&amp;gt;&amp;lt;textarea cols=&amp;quot;50&amp;quot; rows=&amp;quot;1&amp;quot; name=&amp;quot;question[' &amp;lt;%= @question.id%&amp;gt; '][txt]&amp;quot; id=&amp;quot;question_' &amp;lt;%= @question.id%&amp;gt; '_txt&amp;quot; placeholder=&amp;quot;Edit question content here&amp;quot;&amp;gt;' &amp;lt;%= @question.txt%&amp;gt; '&amp;lt;/textarea&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
        &amp;lt;td&amp;gt;&amp;lt;input size=&amp;quot;10&amp;quot; disabled=&amp;quot;disabled&amp;quot; value=&amp;quot;'  &amp;lt;%= @question.type%&amp;gt;  '&amp;quot; name=&amp;quot;question[' &amp;lt;%= @question.id%&amp;gt;'][type]&amp;quot; id=&amp;quot;question_' &amp;lt;%= @question.id%&amp;gt; '_type&amp;quot; type=&amp;quot;text&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
        &amp;lt;td&amp;gt;&amp;lt;!--placeholder (QuestionnaireHeader does not need weight)--&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* add_new_questions.js.erb (added) - appends the html content with added question in ''_question.html.erb'' to  questions_table in ''_questionnaire.html.erb''&lt;br /&gt;
&lt;br /&gt;
   $(&amp;quot;#questions_table&amp;quot;).append(&amp;quot;&amp;lt;%= j render :partial =&amp;gt; 'question',&lt;br /&gt;
           :locals =&amp;gt; {question: @question, :id =&amp;gt; @question.id, :controller =&amp;gt; 'questions'} %&amp;gt;&amp;quot;);&lt;br /&gt;
  &lt;br /&gt;
* edit.html.erb (modified : code removed) - following code is removed as it internally calls respective question header models and appends html string to questions_table internally.&lt;br /&gt;
      &lt;br /&gt;
      &amp;lt;% for @question in @questionnaire.questions do%&amp;gt;&lt;br /&gt;
        &amp;lt;%-# The following line call certain method of the object, which returns html string-%&amp;gt;&lt;br /&gt;
        &amp;lt;%= @question.edit %&amp;gt;&lt;br /&gt;
      &amp;lt;% end %&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
@question.edit invokes ''QuestionHeader.rb'' model which adds html content&lt;br /&gt;
     def edit(_count)&lt;br /&gt;
    html = '&amp;lt;tr&amp;gt;'&lt;br /&gt;
    html += '&amp;lt;td align=&amp;quot;center&amp;quot;&amp;gt;&amp;lt;a rel=&amp;quot;nofollow&amp;quot; data-method=&amp;quot;delete&amp;quot; href=&amp;quot;/questions/' + self.id.to_s + '&amp;quot;&amp;gt;Remove&amp;lt;/a&amp;gt;&amp;lt;/td&amp;gt;'&lt;br /&gt;
    html += '&amp;lt;td&amp;gt;&amp;lt;input size=&amp;quot;6&amp;quot; value=&amp;quot;' + self.seq.to_s + '&amp;quot; name=&amp;quot;question[' + self.id.to_s + '][seq]&amp;quot; id=&amp;quot;question_' + self.id.to_s + '_seq&amp;quot; type=&amp;quot;text&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;'&lt;br /&gt;
    html += '&amp;lt;td&amp;gt;&amp;lt;textarea cols=&amp;quot;50&amp;quot; rows=&amp;quot;1&amp;quot; name=&amp;quot;question[' + self.id.to_s + '][txt]&amp;quot; id=&amp;quot;question_' + self.id.to_s + '_txt&amp;quot; placeholder=&amp;quot;Edit question content here&amp;quot;&amp;gt;' + self.txt + '&amp;lt;/textarea&amp;gt;&amp;lt;/td&amp;gt;'&lt;br /&gt;
    html += '&amp;lt;td&amp;gt;&amp;lt;input size=&amp;quot;10&amp;quot; disabled=&amp;quot;disabled&amp;quot; value=&amp;quot;' + self.type + '&amp;quot; name=&amp;quot;question[' + self.id.to_s + '][type]&amp;quot; id=&amp;quot;question_' + self.id.to_s + '_type&amp;quot; type=&amp;quot;text&amp;quot;&amp;gt;''&amp;lt;/td&amp;gt;'&lt;br /&gt;
    html += '&amp;lt;td&amp;gt;&amp;lt;!--placeholder (QuestionnaireHeader does not need weight)--&amp;gt;&amp;lt;/td&amp;gt;'&lt;br /&gt;
    html += '&amp;lt;/tr&amp;gt;'&lt;br /&gt;
    html.html_safe&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
* questionnaires_controller.rb (modified) - add_new_questions method is modified by replacing redire rendering ''add_new_questions.js.erb'' file&lt;br /&gt;
&lt;br /&gt;
  render :action=&amp;gt; 'add_new_questions.js.erb', :layout=&amp;gt;false, :question=&amp;gt; question&lt;br /&gt;
   #redirect_to edit_questionnaire_path(questionnaire_id.to_sym)&lt;br /&gt;
&lt;br /&gt;
'''Issue :''' But this solution is not working as Ajax can be applied to the browser side processing if the controller method is redirecting to the same page, which is not in this case as page gets redirected from question.html.erb to edit.html.erb. Another problem faced is the creation of questions which is called through ''_questionnaire.html.erb'' but not through ''_question.html.erb'' which makes it difficult to pass correct questionnaire id to the ajax call.&lt;br /&gt;
&lt;br /&gt;
'''Alternative Approach to Edit Questionnaire:''' Another approach to solve this issue is to create a seperate java-script function which handles the entire process of adding,saving,deleting questions and appending them. Call this function from ''_questionnaire.html.erb'' instead of invoking add_new_questions method. Questions can be saved and retrived from data using Javascript Rest API calls. But, this approach not only needs to restructure entire questionnaire structure and many components in the Expertiza project but also violates the MVC design of the project.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Un-submit reviews===&lt;br /&gt;
'''Earlier scenario:''' When an instructor/TA goes to &amp;quot;Manage Assignments -&amp;gt; Assign Reviewers&amp;quot; page, he/she can see a list of all the topics, the contributors and the reviewers for each topic. This page did not show the status of each review which can be in Assigned state or Saved state or Submitted state. Also, there was no way for the instructor/TA to un-submit an already submitted review.&lt;br /&gt;
&lt;br /&gt;
'''New Additions:'''&lt;br /&gt;
* Updated the ''review_mappings/_list_review_mappings.html.erb'' file in views to display the status of each review by the reviewer. For each review_mapping, the code checks if there is a response in ''Response'' table with the same ''map_id'' used in the review_mappings on this page. &lt;br /&gt;
** If there is no such response, it means that the reviewer has not saved/submitted the review and it is currently in Assigned State. So, &amp;quot;Response Status: Saved&amp;quot; is shown for that review.&lt;br /&gt;
** If there is a response, the last (latest) response is checked as per requirement and the ''is_submitted'' attribute of this response is checked in the ''Response'' table.&lt;br /&gt;
*** If the attribute is false, the review has been saved but not submitted. So, &amp;quot;Response Status: Saved&amp;quot; is shown for that review.&lt;br /&gt;
*** If the attribute is true, the review has been submitted. So, &amp;quot;Response Status: Submitted&amp;quot; is shown for that review. Next to this, a link is created to un-submit the review. Clicking on this link changes the ''is_submitted'' attribute to false and updates the Response Status to Saved on the page by using ajax call, without reloading the page&lt;br /&gt;
[[File:List_review_mappings_html_erb.png]]&lt;br /&gt;
* Added a new method &amp;quot;unsubmit_review&amp;quot; to the ''review_mapping_controller.rb'' file. In this, we first find the latest response and then update the ''is_submitted'' attribute to false. The flash message is created based on whether the response was updated correctly. After this, ''unsubmit_review.js.rb'' file is rendered which updates the response status for the corresponding review on the page to Saved, without reloading the page&lt;br /&gt;
[[File:Review_mapping_controller_rb.png]]&lt;br /&gt;
* Added a new file ''review_mappings/unsubmit_review.js.erb'' to views. This file just changes the response status for the corresponding review displayed on the page to Saved from Submit after the review has been un-submitted and also prints the corresponding success or error flash message.&lt;br /&gt;
[[File:Unsubmit_review_js_erb.png]]&lt;br /&gt;
* Added a new line to ''routes.rb'' page for unsubmit_review action&lt;br /&gt;
[[File:Routes_rb.png]]&lt;br /&gt;
&lt;br /&gt;
==UI Testing==&lt;br /&gt;
&lt;br /&gt;
Log in details&lt;br /&gt;
&lt;br /&gt;
'''Username:''' instructor6&lt;br /&gt;
'''password:''' password&lt;br /&gt;
&lt;br /&gt;
'''Steps to test adding participant: '''&lt;br /&gt;
&lt;br /&gt;
''' Steps to test adding TA:'''&lt;br /&gt;
&lt;br /&gt;
''' Steps to test adding question in questionnaire:'''&lt;br /&gt;
&lt;br /&gt;
* Login 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.  You will now be navigated to page where you can add new questions to the questionnaire. &lt;br /&gt;
* Click on add button in &amp;quot;Questions&amp;quot; section.&lt;br /&gt;
&lt;br /&gt;
''Expected output:''  When add button is clicked, question should be created and the questionnaire page should not get reloaded&lt;br /&gt;
&lt;br /&gt;
''' Steps to test un-submit reviews'''&lt;br /&gt;
&lt;br /&gt;
==Project Deployment==&lt;br /&gt;
&lt;br /&gt;
Expertiza setup is done in VCL with is reserved for 30 days with Ubuntu 14.04 base. Started expertiza server publicly and link to access the server is.&lt;br /&gt;
https://152.7.99.101:3000&lt;br /&gt;
&lt;br /&gt;
==Future work==&lt;br /&gt;
&lt;br /&gt;
In future, we will try to implement the edit questionnaire part using alternative approach. We will try to implement testing using rspec framework and improve the UI design of the pages.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
* https://www.youtube.com/channel/UCdKXzox7hrWjfOMML6FzTWg&lt;br /&gt;
* https://github.com/expertiza/expertiza&lt;br /&gt;
* http://wiki.expertiza.ncsu.edu/index.php/Expertiza_documentation&lt;br /&gt;
* http://guides.rubyonrails.org/working_with_javascript_in_rails.html&lt;br /&gt;
* http://wiki.expertiza.ncsu.edu/index.php/Development:Setup:Linux:Debian&lt;/div&gt;</summary>
		<author><name>Dguttik</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/Use_Ajax_to_add_Participants,TA_and_Edit_Questionnaire&amp;diff=107412</id>
		<title>CSC/ECE 517 Spring 2017/Use Ajax to add Participants,TA and Edit Questionnaire</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/Use_Ajax_to_add_Participants,TA_and_Edit_Questionnaire&amp;diff=107412"/>
		<updated>2017-03-24T02:56:48Z</updated>

		<summary type="html">&lt;p&gt;Dguttik: /* Proposed Solution */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;nowiki&amp;gt;  Expertiza is an opensource software developed to assist people in education institutions to perform peer reviews and group projects. It is exceptionally helpful to the students and instructors. The software is designed in MVC (Model-View-Controller) architecture using ruby on rails.&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
Expertiza provides many categories to manage by an instructor. Few of them are assignments, courses, questionnaires. Adding of records like participants, Teaching assistants and questions in these pages is done by submitting the entire page. This requires loading of entire page to add a record and loading of entire page again to save it.&lt;br /&gt;
&lt;br /&gt;
==Proposed Solution==&lt;br /&gt;
This project proposes use of ajax for the required pages to avoid page reloading at the time of adding and saving records. This solution will make sure that adding or saving of record is taken care in the browser itself. It can be achieved by calling corresponding controller method, adding/saving the record and rendering it back to javascript pages instead of redirecting it to the same page. Javascript pages will append the added record functionality to the initial page. Thus, page refresh is avoided.&lt;br /&gt;
&lt;br /&gt;
==Tasks==&lt;br /&gt;
* Add Participant in the assignments section using ajax &lt;br /&gt;
* Add/Remove TA in the courses section using ajax&lt;br /&gt;
* Edit Questionnaire by using ajax for adding questions in the Questionnaire section&lt;br /&gt;
* Show Review Status on assign reviewers page and allow to un-submit a review using ajax&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
&lt;br /&gt;
===Adding participant===&lt;br /&gt;
&lt;br /&gt;
===Adding/Removing TA===&lt;br /&gt;
'''Earlier scenario:''' When an instructor goes to &amp;quot;Manage Courses -&amp;gt; Add TA&amp;quot; page, he/she can add/remove new TA to the course. Every time a new TA is added or removed, the page reloads to reflect the changes, even if the userid used does not exist.&lt;br /&gt;
&lt;br /&gt;
'''Updates/Changes:'''&lt;br /&gt;
This page has been updated such that an instructor can add a new TA or remove a new TA using ajax. With these updates, the changes are reflected on the page without reloading the page, thus saving time.&lt;br /&gt;
* Updated the ''course/view_teaching_assistants.html.erb'' file in views so that the TAs are listed by rendering another partial ''_ta.html.erb''. This is done so that when a new TA has been added, ajax call can be used to render the format required for the new TA in the list append to the already existing list without reloading the page.&lt;br /&gt;
[[File:View_teaching_assistants_html_erb.png]]&lt;br /&gt;
* Created a new file ''course/_ta.html.erb'' in views which is a partial as described above and contains the code to list the TAs. The link_to &amp;quot;Delete&amp;quot; line in this file is updated to use :remote=&amp;gt;:true, so that ajax call can be made to remove the TA remotely without reloading the page.&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
&amp;lt;%= link_to &amp;quot;Delete&amp;quot;, { :action =&amp;gt; 'remove_ta', :controller =&amp;gt;'course', :id =&amp;gt; ta.id, :course_id =&amp;gt; ta.course_id }, method: :post, :remote =&amp;gt; true, :class =&amp;gt; 'remove_ta' %&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* Updated the ''course/_add_individual.html.erb'' file in views to perform the form_tag action to Add a TA remotely using :remote=&amp;gt;:true. In the below code, ''form_action'' and ''remote'' are local variables passed to this partial from ''course/view_teaching_assistants.html.erb'' with the values &amp;quot;add_ta&amp;quot; and &amp;quot;true&amp;quot; respectively &lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
&amp;lt;%= form_tag form_action, :method =&amp;gt; 'post', :remote =&amp;gt; remote do %&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* Updated the ''course_controller.rb&amp;quot; file and replaced the redirect option in ''add_ta'' and ''remove_ta'' to render ''add_ta.js.erb'' and ''remove_ta.js.erb''. Also changed ''flash[:error]'' to ''flash.now[:error]'' so that the flash message is displayed now instead of after page reload.&lt;br /&gt;
[[File:Course_controller_rb1.png]]&lt;br /&gt;
* Added a new file ''course/add.js.erb'' and ''course/remove_ta.js.erb'' to views. The ''add_ta.js.erb'' file renders the newly added TA and appends it to the list of TAs. It also shows flash error message if the userid used to add TA does not exist. Similarly, ''remote_ta.js.erb'' file removes the deleted TA from the list.&lt;br /&gt;
[[File:add_remove_js_erb.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Edit Questionnaire===&lt;br /&gt;
&lt;br /&gt;
'''Current scenario :''' page consists of different subsections for creating questionnaire,adding questions to the questionnaire and saving the questionnaire i.e.&lt;br /&gt;
*_questionnaire.html.erb&lt;br /&gt;
&lt;br /&gt;
Adding questions feature is performed in the following method of ''questionnaires_controller.rb'' class&lt;br /&gt;
&lt;br /&gt;
def add_new_questions&lt;br /&gt;
    questionnaire_id = params[:id] unless params[:id].nil?&lt;br /&gt;
    num_of_existed_questions = Questionnaire.find(questionnaire_id).questions.size&lt;br /&gt;
    ((num_of_existed_questions + 1)..(num_of_existed_questions + params[:question][:total_num].to_i)).each do |i|&lt;br /&gt;
      question = Object.const_get(params[:question][:type]).create(txt: '', questionnaire_id: questionnaire_id, seq: i, type: params[:question][:type], break_before: true)&lt;br /&gt;
      if question.is_a? ScoredQuestion&lt;br /&gt;
        question.weight = 1&lt;br /&gt;
        question.max_label = 'Strongly agree'&lt;br /&gt;
        question.min_label = 'Strongly disagree'&lt;br /&gt;
      end&lt;br /&gt;
      question.size = '50, 3' if question.is_a? Criterion&lt;br /&gt;
      question.alternatives = '0|1|2|3|4|5' if question.is_a? Dropdown&lt;br /&gt;
      question.size = '60, 5' if question.is_a? TextArea&lt;br /&gt;
      question.size = '30' if question.is_a? TextField&lt;br /&gt;
      begin&lt;br /&gt;
        question.save&lt;br /&gt;
      rescue&lt;br /&gt;
        flash[:error] = $ERROR_INFO&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
    redirect_to edit_questionnaire_path(questionnaire_id.to_sym)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This method invokes ''question.create'' method in ''questions_cotroller.rb'' and saves the created question to the database. Then it redirects to the ''edit.html.erb'' page which causes page refresh while adding questions.&lt;br /&gt;
&lt;br /&gt;
'''Solution:''' This problem was tried to solve using ajax by changing or adding the following classes and pages &lt;br /&gt;
* _question.html.erb (added) - displays added question&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;td align=&amp;quot;center&amp;quot;&amp;gt;&amp;lt;a rel=&amp;quot;nofollow&amp;quot; data-method=&amp;quot;delete&amp;quot; href=&amp;quot;/questions/' &amp;lt;%= @question.id%&amp;gt; '&amp;quot;&amp;gt;Remove&amp;lt;/a&amp;gt;&amp;lt;/td&amp;gt;'&lt;br /&gt;
        &amp;lt;td&amp;gt;&amp;lt;input size=&amp;quot;6&amp;quot; value=&amp;quot;' &amp;lt;%= @question.seq%&amp;gt; '&amp;quot; name=&amp;quot;question[' question.id %&amp;gt;'][seq]&amp;quot; id=&amp;quot;question_' +&amp;lt;%=@question.id %&amp;gt; '_seq&amp;quot; type=&amp;quot;text&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
        &amp;lt;td&amp;gt;&amp;lt;textarea cols=&amp;quot;50&amp;quot; rows=&amp;quot;1&amp;quot; name=&amp;quot;question[' &amp;lt;%= @question.id%&amp;gt; '][txt]&amp;quot; id=&amp;quot;question_' &amp;lt;%= @question.id%&amp;gt; '_txt&amp;quot; placeholder=&amp;quot;Edit question content here&amp;quot;&amp;gt;' &amp;lt;%= @question.txt%&amp;gt; '&amp;lt;/textarea&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
        &amp;lt;td&amp;gt;&amp;lt;input size=&amp;quot;10&amp;quot; disabled=&amp;quot;disabled&amp;quot; value=&amp;quot;'  &amp;lt;%= @question.type%&amp;gt;  '&amp;quot; name=&amp;quot;question[' &amp;lt;%= @question.id%&amp;gt;'][type]&amp;quot; id=&amp;quot;question_' &amp;lt;%= @question.id%&amp;gt; '_type&amp;quot; type=&amp;quot;text&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
        &amp;lt;td&amp;gt;&amp;lt;!--placeholder (QuestionnaireHeader does not need weight)--&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* add_new_questions.js.erb (added) - appends the html content with added question in ''_question.html.erb'' to  questions_table in ''_questionnaire.html.erb''&lt;br /&gt;
&lt;br /&gt;
   $(&amp;quot;#questions_table&amp;quot;).append(&amp;quot;&amp;lt;%= j render :partial =&amp;gt; 'question',&lt;br /&gt;
           :locals =&amp;gt; {question: @question, :id =&amp;gt; @question.id, :controller =&amp;gt; 'questions'} %&amp;gt;&amp;quot;);&lt;br /&gt;
  &lt;br /&gt;
* edit.html.erb (modified : code removed) - following code is removed as it internally calls respective question header models and appends html string to questions_table internally.&lt;br /&gt;
      &lt;br /&gt;
      &amp;lt;% for @question in @questionnaire.questions do%&amp;gt;&lt;br /&gt;
        &amp;lt;%-# The following line call certain method of the object, which returns html string-%&amp;gt;&lt;br /&gt;
        &amp;lt;%= @question.edit %&amp;gt;&lt;br /&gt;
      &amp;lt;% end %&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
@question.edit invokes ''QuestionHeader.rb'' model which adds html content&lt;br /&gt;
     def edit(_count)&lt;br /&gt;
    html = '&amp;lt;tr&amp;gt;'&lt;br /&gt;
    html += '&amp;lt;td align=&amp;quot;center&amp;quot;&amp;gt;&amp;lt;a rel=&amp;quot;nofollow&amp;quot; data-method=&amp;quot;delete&amp;quot; href=&amp;quot;/questions/' + self.id.to_s + '&amp;quot;&amp;gt;Remove&amp;lt;/a&amp;gt;&amp;lt;/td&amp;gt;'&lt;br /&gt;
    html += '&amp;lt;td&amp;gt;&amp;lt;input size=&amp;quot;6&amp;quot; value=&amp;quot;' + self.seq.to_s + '&amp;quot; name=&amp;quot;question[' + self.id.to_s + '][seq]&amp;quot; id=&amp;quot;question_' + self.id.to_s + '_seq&amp;quot; type=&amp;quot;text&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;'&lt;br /&gt;
    html += '&amp;lt;td&amp;gt;&amp;lt;textarea cols=&amp;quot;50&amp;quot; rows=&amp;quot;1&amp;quot; name=&amp;quot;question[' + self.id.to_s + '][txt]&amp;quot; id=&amp;quot;question_' + self.id.to_s + '_txt&amp;quot; placeholder=&amp;quot;Edit question content here&amp;quot;&amp;gt;' + self.txt + '&amp;lt;/textarea&amp;gt;&amp;lt;/td&amp;gt;'&lt;br /&gt;
    html += '&amp;lt;td&amp;gt;&amp;lt;input size=&amp;quot;10&amp;quot; disabled=&amp;quot;disabled&amp;quot; value=&amp;quot;' + self.type + '&amp;quot; name=&amp;quot;question[' + self.id.to_s + '][type]&amp;quot; id=&amp;quot;question_' + self.id.to_s + '_type&amp;quot; type=&amp;quot;text&amp;quot;&amp;gt;''&amp;lt;/td&amp;gt;'&lt;br /&gt;
    html += '&amp;lt;td&amp;gt;&amp;lt;!--placeholder (QuestionnaireHeader does not need weight)--&amp;gt;&amp;lt;/td&amp;gt;'&lt;br /&gt;
    html += '&amp;lt;/tr&amp;gt;'&lt;br /&gt;
    html.html_safe&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
* questionnaires_controller.rb (modified) - add_new_questions method is modified by replacing redire rendering ''add_new_questions.js.erb'' file&lt;br /&gt;
&lt;br /&gt;
  render :action=&amp;gt; 'add_new_questions.js.erb', :layout=&amp;gt;false, :question=&amp;gt; question&lt;br /&gt;
   #redirect_to edit_questionnaire_path(questionnaire_id.to_sym)&lt;br /&gt;
&lt;br /&gt;
'''Issue :''' But this solution is not working as Ajax can be applied to the browser side processing if the controller method is redirecting to the same page, which is not in this case as page gets redirected from question.html.erb to edit.html.erb. Another problem faced is the creation of questions which is called through ''_questionnaire.html.erb'' but not through ''_question.html.erb'' which makes it difficult to pass correct questionnaire id to the ajax call.&lt;br /&gt;
&lt;br /&gt;
'''Alternative Approach to Edit Questionnaire:''' Another approach to solve this issue is to create a seperate java-script function which handles the entire process of adding,saving,deleting questions and appending them. Call this function from ''_questionnaire.html.erb'' instead of invoking add_new_questions method. Questions can be saved and retrived from data using Javascript Rest API calls. But, this approach not only needs to restructure entire questionnaire structure and many components in the Expertiza project but also violates the MVC design of the project.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Un-submit reviews===&lt;br /&gt;
'''Earlier scenario:''' When an instructor/TA goes to &amp;quot;Manage Assignments -&amp;gt; Assign Reviewers&amp;quot; page, he/she can see a list of all the topics, the contributors and the reviewers for each topic. This page did not show the status of each review which can be in Assigned state or Saved state or Submitted state. Also, there was no way for the instructor/TA to un-submit an already submitted review.&lt;br /&gt;
&lt;br /&gt;
'''New Additions:'''&lt;br /&gt;
* Updated the ''review_mappings/_list_review_mappings.html.erb'' file in views to display the status of each review by the reviewer. For each review_mapping, the code checks if there is a response in ''Response'' table with the same ''map_id'' used in the review_mappings on this page. &lt;br /&gt;
** If there is no such response, it means that the reviewer has not saved/submitted the review and it is currently in Assigned State. So, &amp;quot;Response Status: Saved&amp;quot; is shown for that review.&lt;br /&gt;
** If there is a response, the last (latest) response is checked as per requirement and the ''is_submitted'' attribute of this response is checked in the ''Response'' table.&lt;br /&gt;
*** If the attribute is false, the review has been saved but not submitted. So, &amp;quot;Response Status: Saved&amp;quot; is shown for that review.&lt;br /&gt;
*** If the attribute is true, the review has been submitted. So, &amp;quot;Response Status: Submitted&amp;quot; is shown for that review. Next to this, a link is created to un-submit the review. Clicking on this link changes the ''is_submitted'' attribute to false and updates the Response Status to Saved on the page by using ajax call, without reloading the page&lt;br /&gt;
[[File:List_review_mappings_html_erb.png]]&lt;br /&gt;
* Added a new method &amp;quot;unsubmit_review&amp;quot; to the ''review_mapping_controller.rb'' file. In this, we first find the latest response and then update the ''is_submitted'' attribute to false. The flash message is created based on whether the response was updated correctly. After this, ''unsubmit_review.js.rb'' file is rendered which updates the response status for the corresponding review on the page to Saved, without reloading the page&lt;br /&gt;
[[File:Review_mapping_controller_rb.png]]&lt;br /&gt;
* Added a new file ''review_mappings/unsubmit_review.js.erb'' to views. This file just changes the response status for the corresponding review displayed on the page to Saved from Submit after the review has been un-submitted and also prints the corresponding success or error flash message.&lt;br /&gt;
[[File:Unsubmit_review_js_erb.png]]&lt;br /&gt;
* Added a new line to ''routes.rb'' page for unsubmit_review action&lt;br /&gt;
[[File:Routes_rb.png]]&lt;br /&gt;
&lt;br /&gt;
==UI Testing==&lt;br /&gt;
&lt;br /&gt;
Log in details&lt;br /&gt;
&lt;br /&gt;
'''Username:''' instructor6&lt;br /&gt;
'''password:''' password&lt;br /&gt;
&lt;br /&gt;
'''Steps to test adding participant: '''&lt;br /&gt;
&lt;br /&gt;
''' Steps to test adding TA:'''&lt;br /&gt;
&lt;br /&gt;
''' Steps to test adding question in questionnaire:'''&lt;br /&gt;
&lt;br /&gt;
* Login 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.  You will now be navigated to page where you can add new questions to the questionnaire. &lt;br /&gt;
* Click on add button in &amp;quot;Questions&amp;quot; section.&lt;br /&gt;
&lt;br /&gt;
''Expected output:''  When add button is clicked, question should be created and the questionnaire page should not get reloaded&lt;br /&gt;
&lt;br /&gt;
''' Steps to test un-submit reviews'''&lt;br /&gt;
&lt;br /&gt;
==Project Deployment==&lt;br /&gt;
==Future work==&lt;br /&gt;
&lt;br /&gt;
In future, we will try to implement the edit questionnaire part using alternative approach. We will try to implement testing using rspec framework and improve the UI design of the pages.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
* https://www.youtube.com/channel/UCdKXzox7hrWjfOMML6FzTWg&lt;br /&gt;
* https://github.com/expertiza/expertiza&lt;br /&gt;
* http://wiki.expertiza.ncsu.edu/index.php/Expertiza_documentation&lt;br /&gt;
* http://guides.rubyonrails.org/working_with_javascript_in_rails.html&lt;/div&gt;</summary>
		<author><name>Dguttik</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/Use_Ajax_to_add_Participants,TA_and_Edit_Questionnaire&amp;diff=107380</id>
		<title>CSC/ECE 517 Spring 2017/Use Ajax to add Participants,TA and Edit Questionnaire</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/Use_Ajax_to_add_Participants,TA_and_Edit_Questionnaire&amp;diff=107380"/>
		<updated>2017-03-24T01:40:17Z</updated>

		<summary type="html">&lt;p&gt;Dguttik: /* Introduction */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;nowiki&amp;gt;  Expertiza is an opensource software developed to assist people in education institutions to perform peer reviews and group projects. It is exceptionally helpful to the students and instructors. The software is designed in MVC (Model-View-Controller) architecture using ruby on rails.&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
Expertiza provides many categories to manage by an instructor. Few of them are assignments, courses, questionnaires. Adding of records like participants, Teaching assistants and questions in these pages is done by submitting the entire page. This requires loading of entire page to add a record and loading of entire page again to save it.&lt;br /&gt;
&lt;br /&gt;
==Proposed Solution==&lt;br /&gt;
This project proposes use of ajax for the required pages to avoid page reloading at the time of adding and saving records. This solution will make sure that adding or saving of record is taken care in the browser itself. It can be achieved by calling corresponding controller method, adding/saving the record and rendering it back to javascript pages instead of redirecting it to the same page. Javascript pages will append the added record functionality to the initial page. Thus page refresh is avoided.&lt;br /&gt;
&lt;br /&gt;
==Tasks==&lt;br /&gt;
* Add Participant in the assignments section using ajax &lt;br /&gt;
* Add/Remove TA in the courses section using ajax&lt;br /&gt;
* Edit Questionnaire by using ajax for adding questions in the Questionnaire section&lt;br /&gt;
* Show Review Status on assign reviewers page and allow to un-submit a review using ajax&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
===Adding participant===&lt;br /&gt;
===Adding TA===&lt;br /&gt;
===Edit Questionnaire===&lt;br /&gt;
&lt;br /&gt;
'''Current scenario :''' page consists of different subsections for creating questionnaire,adding questions to the questionnaire and saving the questionnaire i.e.&lt;br /&gt;
*_questionnaire.html.erb&lt;br /&gt;
&lt;br /&gt;
Adding questions feature is performed in the following method of ''questionnaires_controller.rb'' class&lt;br /&gt;
&lt;br /&gt;
def add_new_questions&lt;br /&gt;
    questionnaire_id = params[:id] unless params[:id].nil?&lt;br /&gt;
    num_of_existed_questions = Questionnaire.find(questionnaire_id).questions.size&lt;br /&gt;
    ((num_of_existed_questions + 1)..(num_of_existed_questions + params[:question][:total_num].to_i)).each do |i|&lt;br /&gt;
      question = Object.const_get(params[:question][:type]).create(txt: '', questionnaire_id: questionnaire_id, seq: i, type: params[:question][:type], break_before: true)&lt;br /&gt;
      if question.is_a? ScoredQuestion&lt;br /&gt;
        question.weight = 1&lt;br /&gt;
        question.max_label = 'Strongly agree'&lt;br /&gt;
        question.min_label = 'Strongly disagree'&lt;br /&gt;
      end&lt;br /&gt;
      question.size = '50, 3' if question.is_a? Criterion&lt;br /&gt;
      question.alternatives = '0|1|2|3|4|5' if question.is_a? Dropdown&lt;br /&gt;
      question.size = '60, 5' if question.is_a? TextArea&lt;br /&gt;
      question.size = '30' if question.is_a? TextField&lt;br /&gt;
      begin&lt;br /&gt;
        question.save&lt;br /&gt;
      rescue&lt;br /&gt;
        flash[:error] = $ERROR_INFO&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
    redirect_to edit_questionnaire_path(questionnaire_id.to_sym)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This method invokes ''question.create'' method in ''questions_cotroller.rb'' and saves the created question to the database. Then it redirects to the ''edit.html.erb'' page which causes page refresh while adding questions.&lt;br /&gt;
&lt;br /&gt;
'''Solution:''' This problem was tried to solve using ajax by changing or adding the following classes and pages &lt;br /&gt;
* _question.html.erb (added) - displays added question&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;td align=&amp;quot;center&amp;quot;&amp;gt;&amp;lt;a rel=&amp;quot;nofollow&amp;quot; data-method=&amp;quot;delete&amp;quot; href=&amp;quot;/questions/' &amp;lt;%= @question.id%&amp;gt; '&amp;quot;&amp;gt;Remove&amp;lt;/a&amp;gt;&amp;lt;/td&amp;gt;'&lt;br /&gt;
        &amp;lt;td&amp;gt;&amp;lt;input size=&amp;quot;6&amp;quot; value=&amp;quot;' &amp;lt;%= @question.seq%&amp;gt; '&amp;quot; name=&amp;quot;question[' question.id %&amp;gt;'][seq]&amp;quot; id=&amp;quot;question_' +&amp;lt;%=@question.id %&amp;gt; '_seq&amp;quot; type=&amp;quot;text&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
        &amp;lt;td&amp;gt;&amp;lt;textarea cols=&amp;quot;50&amp;quot; rows=&amp;quot;1&amp;quot; name=&amp;quot;question[' &amp;lt;%= @question.id%&amp;gt; '][txt]&amp;quot; id=&amp;quot;question_' &amp;lt;%= @question.id%&amp;gt; '_txt&amp;quot; placeholder=&amp;quot;Edit question content here&amp;quot;&amp;gt;' &amp;lt;%= @question.txt%&amp;gt; '&amp;lt;/textarea&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
        &amp;lt;td&amp;gt;&amp;lt;input size=&amp;quot;10&amp;quot; disabled=&amp;quot;disabled&amp;quot; value=&amp;quot;'  &amp;lt;%= @question.type%&amp;gt;  '&amp;quot; name=&amp;quot;question[' &amp;lt;%= @question.id%&amp;gt;'][type]&amp;quot; id=&amp;quot;question_' &amp;lt;%= @question.id%&amp;gt; '_type&amp;quot; type=&amp;quot;text&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
        &amp;lt;td&amp;gt;&amp;lt;!--placeholder (QuestionnaireHeader does not need weight)--&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* add_new_questions.js.erb (added) - appends the html content with added question in ''_question.html.erb'' to  questions_table in ''_questionnaire.html.erb''&lt;br /&gt;
&lt;br /&gt;
   $(&amp;quot;#questions_table&amp;quot;).append(&amp;quot;&amp;lt;%= j render :partial =&amp;gt; 'question',&lt;br /&gt;
           :locals =&amp;gt; {question: @question, :id =&amp;gt; @question.id, :controller =&amp;gt; 'questions'} %&amp;gt;&amp;quot;);&lt;br /&gt;
  &lt;br /&gt;
* edit.html.erb (modified : code removed) - following code is removed as it internally calls respective question header models and appends html string to questions_table internally.&lt;br /&gt;
      &lt;br /&gt;
      &amp;lt;% for @question in @questionnaire.questions do%&amp;gt;&lt;br /&gt;
        &amp;lt;%-# The following line call certain method of the object, which returns html string-%&amp;gt;&lt;br /&gt;
        &amp;lt;%= @question.edit %&amp;gt;&lt;br /&gt;
      &amp;lt;% end %&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
@question.edit invokes ''QuestionHeader.rb'' model which adds html content&lt;br /&gt;
     def edit(_count)&lt;br /&gt;
    html = '&amp;lt;tr&amp;gt;'&lt;br /&gt;
    html += '&amp;lt;td align=&amp;quot;center&amp;quot;&amp;gt;&amp;lt;a rel=&amp;quot;nofollow&amp;quot; data-method=&amp;quot;delete&amp;quot; href=&amp;quot;/questions/' + self.id.to_s + '&amp;quot;&amp;gt;Remove&amp;lt;/a&amp;gt;&amp;lt;/td&amp;gt;'&lt;br /&gt;
    html += '&amp;lt;td&amp;gt;&amp;lt;input size=&amp;quot;6&amp;quot; value=&amp;quot;' + self.seq.to_s + '&amp;quot; name=&amp;quot;question[' + self.id.to_s + '][seq]&amp;quot; id=&amp;quot;question_' + self.id.to_s + '_seq&amp;quot; type=&amp;quot;text&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;'&lt;br /&gt;
    html += '&amp;lt;td&amp;gt;&amp;lt;textarea cols=&amp;quot;50&amp;quot; rows=&amp;quot;1&amp;quot; name=&amp;quot;question[' + self.id.to_s + '][txt]&amp;quot; id=&amp;quot;question_' + self.id.to_s + '_txt&amp;quot; placeholder=&amp;quot;Edit question content here&amp;quot;&amp;gt;' + self.txt + '&amp;lt;/textarea&amp;gt;&amp;lt;/td&amp;gt;'&lt;br /&gt;
    html += '&amp;lt;td&amp;gt;&amp;lt;input size=&amp;quot;10&amp;quot; disabled=&amp;quot;disabled&amp;quot; value=&amp;quot;' + self.type + '&amp;quot; name=&amp;quot;question[' + self.id.to_s + '][type]&amp;quot; id=&amp;quot;question_' + self.id.to_s + '_type&amp;quot; type=&amp;quot;text&amp;quot;&amp;gt;''&amp;lt;/td&amp;gt;'&lt;br /&gt;
    html += '&amp;lt;td&amp;gt;&amp;lt;!--placeholder (QuestionnaireHeader does not need weight)--&amp;gt;&amp;lt;/td&amp;gt;'&lt;br /&gt;
    html += '&amp;lt;/tr&amp;gt;'&lt;br /&gt;
    html.html_safe&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
* questionnaires_controller.rb (modified) - add_new_questions method is modified by replacing redire rendering ''add_new_questions.js.erb'' file&lt;br /&gt;
&lt;br /&gt;
  render :action=&amp;gt; 'add_new_questions.js.erb', :layout=&amp;gt;false, :question=&amp;gt; question&lt;br /&gt;
   #redirect_to edit_questionnaire_path(questionnaire_id.to_sym)&lt;br /&gt;
&lt;br /&gt;
'''Issue :''' But this solution is not working as Ajax can be applied to the browser side processing if the controller method is redirecting to the same page, which is not in this case as page gets redirected from question.html.erb to edit.html.erb. Another problem faced is the creation of questions which is called through ''_questionnaire.html.erb'' but not through ''_question.html.erb'' which makes it difficult to pass correct questionnaire id to the ajax call.&lt;br /&gt;
&lt;br /&gt;
'''Alternative Approach to Edit Questionnaire:''' Another approach to solve this issue is to create a seperate java-script function which handles the entire process of adding,saving,deleting questions and appending them. Call this function from ''_questionnaire.html.erb'' instead of invoking add_new_questions method. Questions can be saved and retrived from data using Javascript Rest API calls. But, this approach not only needs to restructure entire questionnaire structure and many components in the Expertiza project but also violates the MVC design of the project.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Un-submit reviews===&lt;br /&gt;
'''Earlier scenario:''' When an instructor/TA goes to &amp;quot;Manage Assignments -&amp;gt; Assign Reviewers&amp;quot; page, he/she can see a list of all the topics, the contributors and the reviewers for each topic. This page did not show the status of each review which can be in Assigned state or Saved state or Submitted state. Also, there was no way for the instructor/TA to un-submit an already submitted review.&lt;br /&gt;
&lt;br /&gt;
'''New Additions:'''&lt;br /&gt;
* Updated the ''review_mappings/_list_review_mappings.html.erb'' file in views to display the status of each review by the reviewer. For each review_mapping, the code checks if there is a response in ''Response'' table with the same ''map_id'' used in the review_mappings on this page. &lt;br /&gt;
** If there is no such response, it means that the reviewer has not saved/submitted the review and it is currently in Assigned State. So, &amp;quot;Response Status: Saved&amp;quot; is shown for that review.&lt;br /&gt;
** If there is a response, the last (latest) response is checked as per requirement and the ''is_submitted'' attribute of this response is checked in the ''Response'' table.&lt;br /&gt;
*** If the attribute is false, the review has been saved but not submitted. So, &amp;quot;Response Status: Saved&amp;quot; is shown for that review.&lt;br /&gt;
*** If the attribute is true, the review has been submitted. So, &amp;quot;Response Status: Submitted&amp;quot; is shown for that review. Next to this, a link is created to un-submit the review. Clicking on this link changes the ''is_submitted'' attribute to false and updates the Response Status to Saved on the page by using ajax call, without reloading the page&lt;br /&gt;
[[File:List_review_mappings_html_erb.png]]&lt;br /&gt;
* Added a new method &amp;quot;unsubmit_review&amp;quot; to the ''review_mapping_controller.rb'' file. In this, we first find the latest response and then update the ''is_submitted'' attribute to false. The flash message is created based on whether the response was updated correctly. After this, ''unsubmit_review.js.rb'' file is rendered which updates the response status for the corresponding review on the page to Saved, without reloading the page&lt;br /&gt;
[[File:Review_mapping_controller_rb.png]]&lt;br /&gt;
* Added a new file ''review_mappings/unsubmit_review.js.erb'' to views. This file just changes the response status for the corresponding review displayed on the page to Saved from Submit after the review has been un-submitted and also prints the corresponding success or error flash message.&lt;br /&gt;
[[File:Unsubmit_review_js_erb.png]]&lt;br /&gt;
* Added a new line to ''routes.rb'' page for unsubmit_review action&lt;br /&gt;
[[File:Routes_rb.png]]&lt;br /&gt;
&lt;br /&gt;
==UI Testing==&lt;br /&gt;
&lt;br /&gt;
Log in details&lt;br /&gt;
&lt;br /&gt;
'''Username:''' instructor6&lt;br /&gt;
'''password:''' password&lt;br /&gt;
&lt;br /&gt;
'''Steps to test adding participant: '''&lt;br /&gt;
&lt;br /&gt;
''' Steps to test adding TA:'''&lt;br /&gt;
&lt;br /&gt;
''' Steps to test adding question in questionnaire:'''&lt;br /&gt;
&lt;br /&gt;
* Login 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.  You will now be navigated to page where you can add new questions to the questionnaire. &lt;br /&gt;
* Click on add button in &amp;quot;Questions&amp;quot; section.&lt;br /&gt;
&lt;br /&gt;
''Expected output:''  When add button is clicked, question should be created and the questionnaire page should not get reloaded&lt;br /&gt;
&lt;br /&gt;
''' Steps to test un-submit reviews'''&lt;br /&gt;
&lt;br /&gt;
==Project Deployment==&lt;br /&gt;
==Future work==&lt;br /&gt;
&lt;br /&gt;
In future, we will try to implement the edit questionnaire part using alternative approach. We will try to implement testing using rspec framework and improve the UI design of the pages.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
* https://www.youtube.com/channel/UCdKXzox7hrWjfOMML6FzTWg&lt;br /&gt;
* https://github.com/expertiza/expertiza&lt;br /&gt;
* http://wiki.expertiza.ncsu.edu/index.php/Expertiza_documentation&lt;br /&gt;
* http://guides.rubyonrails.org/working_with_javascript_in_rails.html&lt;/div&gt;</summary>
		<author><name>Dguttik</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/Use_Ajax_to_add_Participants,TA_and_Edit_Questionnaire&amp;diff=107379</id>
		<title>CSC/ECE 517 Spring 2017/Use Ajax to add Participants,TA and Edit Questionnaire</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/Use_Ajax_to_add_Participants,TA_and_Edit_Questionnaire&amp;diff=107379"/>
		<updated>2017-03-24T01:39:32Z</updated>

		<summary type="html">&lt;p&gt;Dguttik: /* Introduction */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
  &lt;br /&gt;
  Expertiza is an opensource software developed to assist people in education institutions to perform peer reviews and group projects. It is exceptionally helpful to the students and instructors. The software is designed in MVC (Model-View-Controller)[https://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller] architecture using ruby on rails.&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
Expertiza provides many categories to manage by an instructor. Few of them are assignments, courses, questionnaires. Adding of records like participants, Teaching assistants and questions in these pages is done by submitting the entire page. This requires loading of entire page to add a record and loading of entire page again to save it.&lt;br /&gt;
&lt;br /&gt;
==Proposed Solution==&lt;br /&gt;
This project proposes use of ajax for the required pages to avoid page reloading at the time of adding and saving records. This solution will make sure that adding or saving of record is taken care in the browser itself. It can be achieved by calling corresponding controller method, adding/saving the record and rendering it back to javascript pages instead of redirecting it to the same page. Javascript pages will append the added record functionality to the initial page. Thus page refresh is avoided.&lt;br /&gt;
&lt;br /&gt;
==Tasks==&lt;br /&gt;
* Add Participant in the assignments section using ajax &lt;br /&gt;
* Add/Remove TA in the courses section using ajax&lt;br /&gt;
* Edit Questionnaire by using ajax for adding questions in the Questionnaire section&lt;br /&gt;
* Show Review Status on assign reviewers page and allow to un-submit a review using ajax&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
===Adding participant===&lt;br /&gt;
===Adding TA===&lt;br /&gt;
===Edit Questionnaire===&lt;br /&gt;
&lt;br /&gt;
'''Current scenario :''' page consists of different subsections for creating questionnaire,adding questions to the questionnaire and saving the questionnaire i.e.&lt;br /&gt;
*_questionnaire.html.erb&lt;br /&gt;
&lt;br /&gt;
Adding questions feature is performed in the following method of ''questionnaires_controller.rb'' class&lt;br /&gt;
&lt;br /&gt;
def add_new_questions&lt;br /&gt;
    questionnaire_id = params[:id] unless params[:id].nil?&lt;br /&gt;
    num_of_existed_questions = Questionnaire.find(questionnaire_id).questions.size&lt;br /&gt;
    ((num_of_existed_questions + 1)..(num_of_existed_questions + params[:question][:total_num].to_i)).each do |i|&lt;br /&gt;
      question = Object.const_get(params[:question][:type]).create(txt: '', questionnaire_id: questionnaire_id, seq: i, type: params[:question][:type], break_before: true)&lt;br /&gt;
      if question.is_a? ScoredQuestion&lt;br /&gt;
        question.weight = 1&lt;br /&gt;
        question.max_label = 'Strongly agree'&lt;br /&gt;
        question.min_label = 'Strongly disagree'&lt;br /&gt;
      end&lt;br /&gt;
      question.size = '50, 3' if question.is_a? Criterion&lt;br /&gt;
      question.alternatives = '0|1|2|3|4|5' if question.is_a? Dropdown&lt;br /&gt;
      question.size = '60, 5' if question.is_a? TextArea&lt;br /&gt;
      question.size = '30' if question.is_a? TextField&lt;br /&gt;
      begin&lt;br /&gt;
        question.save&lt;br /&gt;
      rescue&lt;br /&gt;
        flash[:error] = $ERROR_INFO&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
    redirect_to edit_questionnaire_path(questionnaire_id.to_sym)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This method invokes ''question.create'' method in ''questions_cotroller.rb'' and saves the created question to the database. Then it redirects to the ''edit.html.erb'' page which causes page refresh while adding questions.&lt;br /&gt;
&lt;br /&gt;
'''Solution:''' This problem was tried to solve using ajax by changing or adding the following classes and pages &lt;br /&gt;
* _question.html.erb (added) - displays added question&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;td align=&amp;quot;center&amp;quot;&amp;gt;&amp;lt;a rel=&amp;quot;nofollow&amp;quot; data-method=&amp;quot;delete&amp;quot; href=&amp;quot;/questions/' &amp;lt;%= @question.id%&amp;gt; '&amp;quot;&amp;gt;Remove&amp;lt;/a&amp;gt;&amp;lt;/td&amp;gt;'&lt;br /&gt;
        &amp;lt;td&amp;gt;&amp;lt;input size=&amp;quot;6&amp;quot; value=&amp;quot;' &amp;lt;%= @question.seq%&amp;gt; '&amp;quot; name=&amp;quot;question[' question.id %&amp;gt;'][seq]&amp;quot; id=&amp;quot;question_' +&amp;lt;%=@question.id %&amp;gt; '_seq&amp;quot; type=&amp;quot;text&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
        &amp;lt;td&amp;gt;&amp;lt;textarea cols=&amp;quot;50&amp;quot; rows=&amp;quot;1&amp;quot; name=&amp;quot;question[' &amp;lt;%= @question.id%&amp;gt; '][txt]&amp;quot; id=&amp;quot;question_' &amp;lt;%= @question.id%&amp;gt; '_txt&amp;quot; placeholder=&amp;quot;Edit question content here&amp;quot;&amp;gt;' &amp;lt;%= @question.txt%&amp;gt; '&amp;lt;/textarea&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
        &amp;lt;td&amp;gt;&amp;lt;input size=&amp;quot;10&amp;quot; disabled=&amp;quot;disabled&amp;quot; value=&amp;quot;'  &amp;lt;%= @question.type%&amp;gt;  '&amp;quot; name=&amp;quot;question[' &amp;lt;%= @question.id%&amp;gt;'][type]&amp;quot; id=&amp;quot;question_' &amp;lt;%= @question.id%&amp;gt; '_type&amp;quot; type=&amp;quot;text&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
        &amp;lt;td&amp;gt;&amp;lt;!--placeholder (QuestionnaireHeader does not need weight)--&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* add_new_questions.js.erb (added) - appends the html content with added question in ''_question.html.erb'' to  questions_table in ''_questionnaire.html.erb''&lt;br /&gt;
&lt;br /&gt;
   $(&amp;quot;#questions_table&amp;quot;).append(&amp;quot;&amp;lt;%= j render :partial =&amp;gt; 'question',&lt;br /&gt;
           :locals =&amp;gt; {question: @question, :id =&amp;gt; @question.id, :controller =&amp;gt; 'questions'} %&amp;gt;&amp;quot;);&lt;br /&gt;
  &lt;br /&gt;
* edit.html.erb (modified : code removed) - following code is removed as it internally calls respective question header models and appends html string to questions_table internally.&lt;br /&gt;
      &lt;br /&gt;
      &amp;lt;% for @question in @questionnaire.questions do%&amp;gt;&lt;br /&gt;
        &amp;lt;%-# The following line call certain method of the object, which returns html string-%&amp;gt;&lt;br /&gt;
        &amp;lt;%= @question.edit %&amp;gt;&lt;br /&gt;
      &amp;lt;% end %&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
@question.edit invokes ''QuestionHeader.rb'' model which adds html content&lt;br /&gt;
     def edit(_count)&lt;br /&gt;
    html = '&amp;lt;tr&amp;gt;'&lt;br /&gt;
    html += '&amp;lt;td align=&amp;quot;center&amp;quot;&amp;gt;&amp;lt;a rel=&amp;quot;nofollow&amp;quot; data-method=&amp;quot;delete&amp;quot; href=&amp;quot;/questions/' + self.id.to_s + '&amp;quot;&amp;gt;Remove&amp;lt;/a&amp;gt;&amp;lt;/td&amp;gt;'&lt;br /&gt;
    html += '&amp;lt;td&amp;gt;&amp;lt;input size=&amp;quot;6&amp;quot; value=&amp;quot;' + self.seq.to_s + '&amp;quot; name=&amp;quot;question[' + self.id.to_s + '][seq]&amp;quot; id=&amp;quot;question_' + self.id.to_s + '_seq&amp;quot; type=&amp;quot;text&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;'&lt;br /&gt;
    html += '&amp;lt;td&amp;gt;&amp;lt;textarea cols=&amp;quot;50&amp;quot; rows=&amp;quot;1&amp;quot; name=&amp;quot;question[' + self.id.to_s + '][txt]&amp;quot; id=&amp;quot;question_' + self.id.to_s + '_txt&amp;quot; placeholder=&amp;quot;Edit question content here&amp;quot;&amp;gt;' + self.txt + '&amp;lt;/textarea&amp;gt;&amp;lt;/td&amp;gt;'&lt;br /&gt;
    html += '&amp;lt;td&amp;gt;&amp;lt;input size=&amp;quot;10&amp;quot; disabled=&amp;quot;disabled&amp;quot; value=&amp;quot;' + self.type + '&amp;quot; name=&amp;quot;question[' + self.id.to_s + '][type]&amp;quot; id=&amp;quot;question_' + self.id.to_s + '_type&amp;quot; type=&amp;quot;text&amp;quot;&amp;gt;''&amp;lt;/td&amp;gt;'&lt;br /&gt;
    html += '&amp;lt;td&amp;gt;&amp;lt;!--placeholder (QuestionnaireHeader does not need weight)--&amp;gt;&amp;lt;/td&amp;gt;'&lt;br /&gt;
    html += '&amp;lt;/tr&amp;gt;'&lt;br /&gt;
    html.html_safe&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
* questionnaires_controller.rb (modified) - add_new_questions method is modified by replacing redire rendering ''add_new_questions.js.erb'' file&lt;br /&gt;
&lt;br /&gt;
  render :action=&amp;gt; 'add_new_questions.js.erb', :layout=&amp;gt;false, :question=&amp;gt; question&lt;br /&gt;
   #redirect_to edit_questionnaire_path(questionnaire_id.to_sym)&lt;br /&gt;
&lt;br /&gt;
'''Issue :''' But this solution is not working as Ajax can be applied to the browser side processing if the controller method is redirecting to the same page, which is not in this case as page gets redirected from question.html.erb to edit.html.erb. Another problem faced is the creation of questions which is called through ''_questionnaire.html.erb'' but not through ''_question.html.erb'' which makes it difficult to pass correct questionnaire id to the ajax call.&lt;br /&gt;
&lt;br /&gt;
'''Alternative Approach to Edit Questionnaire:''' Another approach to solve this issue is to create a seperate java-script function which handles the entire process of adding,saving,deleting questions and appending them. Call this function from ''_questionnaire.html.erb'' instead of invoking add_new_questions method. Questions can be saved and retrived from data using Javascript Rest API calls. But, this approach not only needs to restructure entire questionnaire structure and many components in the Expertiza project but also violates the MVC design of the project.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Un-submit reviews===&lt;br /&gt;
'''Earlier scenario:''' When an instructor/TA goes to &amp;quot;Manage Assignments -&amp;gt; Assign Reviewers&amp;quot; page, he/she can see a list of all the topics, the contributors and the reviewers for each topic. This page did not show the status of each review which can be in Assigned state or Saved state or Submitted state. Also, there was no way for the instructor/TA to un-submit an already submitted review.&lt;br /&gt;
&lt;br /&gt;
'''New Additions:'''&lt;br /&gt;
* Updated the ''review_mappings/_list_review_mappings.html.erb'' file in views to display the status of each review by the reviewer. For each review_mapping, the code checks if there is a response in ''Response'' table with the same ''map_id'' used in the review_mappings on this page. &lt;br /&gt;
** If there is no such response, it means that the reviewer has not saved/submitted the review and it is currently in Assigned State. So, &amp;quot;Response Status: Saved&amp;quot; is shown for that review.&lt;br /&gt;
** If there is a response, the last (latest) response is checked as per requirement and the ''is_submitted'' attribute of this response is checked in the ''Response'' table.&lt;br /&gt;
*** If the attribute is false, the review has been saved but not submitted. So, &amp;quot;Response Status: Saved&amp;quot; is shown for that review.&lt;br /&gt;
*** If the attribute is true, the review has been submitted. So, &amp;quot;Response Status: Submitted&amp;quot; is shown for that review. Next to this, a link is created to un-submit the review. Clicking on this link changes the ''is_submitted'' attribute to false and updates the Response Status to Saved on the page by using ajax call, without reloading the page&lt;br /&gt;
[[File:List_review_mappings_html_erb.png]]&lt;br /&gt;
* Added a new method &amp;quot;unsubmit_review&amp;quot; to the ''review_mapping_controller.rb'' file. In this, we first find the latest response and then update the ''is_submitted'' attribute to false. The flash message is created based on whether the response was updated correctly. After this, ''unsubmit_review.js.rb'' file is rendered which updates the response status for the corresponding review on the page to Saved, without reloading the page&lt;br /&gt;
[[File:Review_mapping_controller_rb.png]]&lt;br /&gt;
* Added a new file ''review_mappings/unsubmit_review.js.erb'' to views. This file just changes the response status for the corresponding review displayed on the page to Saved from Submit after the review has been un-submitted and also prints the corresponding success or error flash message.&lt;br /&gt;
[[File:Unsubmit_review_js_erb.png]]&lt;br /&gt;
* Added a new line to ''routes.rb'' page for unsubmit_review action&lt;br /&gt;
[[File:Routes_rb.png]]&lt;br /&gt;
&lt;br /&gt;
==UI Testing==&lt;br /&gt;
&lt;br /&gt;
Log in details&lt;br /&gt;
&lt;br /&gt;
'''Username:''' instructor6&lt;br /&gt;
'''password:''' password&lt;br /&gt;
&lt;br /&gt;
'''Steps to test adding participant: '''&lt;br /&gt;
&lt;br /&gt;
''' Steps to test adding TA:'''&lt;br /&gt;
&lt;br /&gt;
''' Steps to test adding question in questionnaire:'''&lt;br /&gt;
&lt;br /&gt;
* Login 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.  You will now be navigated to page where you can add new questions to the questionnaire. &lt;br /&gt;
* Click on add button in &amp;quot;Questions&amp;quot; section.&lt;br /&gt;
&lt;br /&gt;
''Expected output:''  When add button is clicked, question should be created and the questionnaire page should not get reloaded&lt;br /&gt;
&lt;br /&gt;
''' Steps to test un-submit reviews'''&lt;br /&gt;
&lt;br /&gt;
==Project Deployment==&lt;br /&gt;
==Future work==&lt;br /&gt;
&lt;br /&gt;
In future, we will try to implement the edit questionnaire part using alternative approach. We will try to implement testing using rspec framework and improve the UI design of the pages.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
* https://www.youtube.com/channel/UCdKXzox7hrWjfOMML6FzTWg&lt;br /&gt;
* https://github.com/expertiza/expertiza&lt;br /&gt;
* http://wiki.expertiza.ncsu.edu/index.php/Expertiza_documentation&lt;br /&gt;
* http://guides.rubyonrails.org/working_with_javascript_in_rails.html&lt;/div&gt;</summary>
		<author><name>Dguttik</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/Use_Ajax_to_add_Participants,TA_and_Edit_Questionnaire&amp;diff=107378</id>
		<title>CSC/ECE 517 Spring 2017/Use Ajax to add Participants,TA and Edit Questionnaire</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/Use_Ajax_to_add_Participants,TA_and_Edit_Questionnaire&amp;diff=107378"/>
		<updated>2017-03-24T01:39:09Z</updated>

		<summary type="html">&lt;p&gt;Dguttik: /* Introduction */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;nowiki&amp;gt;  Expertiza is an opensource software developed to assist people in education institutions to perform peer reviews and group projects. It is exceptionally helpful to the students and instructors. The software is designed in MVC (Model-View-Controller)[https://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller] architecture using ruby on rails.&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
Expertiza provides many categories to manage by an instructor. Few of them are assignments, courses, questionnaires. Adding of records like participants, Teaching assistants and questions in these pages is done by submitting the entire page. This requires loading of entire page to add a record and loading of entire page again to save it.&lt;br /&gt;
&lt;br /&gt;
==Proposed Solution==&lt;br /&gt;
This project proposes use of ajax for the required pages to avoid page reloading at the time of adding and saving records. This solution will make sure that adding or saving of record is taken care in the browser itself. It can be achieved by calling corresponding controller method, adding/saving the record and rendering it back to javascript pages instead of redirecting it to the same page. Javascript pages will append the added record functionality to the initial page. Thus page refresh is avoided.&lt;br /&gt;
&lt;br /&gt;
==Tasks==&lt;br /&gt;
* Add Participant in the assignments section using ajax &lt;br /&gt;
* Add/Remove TA in the courses section using ajax&lt;br /&gt;
* Edit Questionnaire by using ajax for adding questions in the Questionnaire section&lt;br /&gt;
* Show Review Status on assign reviewers page and allow to un-submit a review using ajax&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
===Adding participant===&lt;br /&gt;
===Adding TA===&lt;br /&gt;
===Edit Questionnaire===&lt;br /&gt;
&lt;br /&gt;
'''Current scenario :''' page consists of different subsections for creating questionnaire,adding questions to the questionnaire and saving the questionnaire i.e.&lt;br /&gt;
*_questionnaire.html.erb&lt;br /&gt;
&lt;br /&gt;
Adding questions feature is performed in the following method of ''questionnaires_controller.rb'' class&lt;br /&gt;
&lt;br /&gt;
def add_new_questions&lt;br /&gt;
    questionnaire_id = params[:id] unless params[:id].nil?&lt;br /&gt;
    num_of_existed_questions = Questionnaire.find(questionnaire_id).questions.size&lt;br /&gt;
    ((num_of_existed_questions + 1)..(num_of_existed_questions + params[:question][:total_num].to_i)).each do |i|&lt;br /&gt;
      question = Object.const_get(params[:question][:type]).create(txt: '', questionnaire_id: questionnaire_id, seq: i, type: params[:question][:type], break_before: true)&lt;br /&gt;
      if question.is_a? ScoredQuestion&lt;br /&gt;
        question.weight = 1&lt;br /&gt;
        question.max_label = 'Strongly agree'&lt;br /&gt;
        question.min_label = 'Strongly disagree'&lt;br /&gt;
      end&lt;br /&gt;
      question.size = '50, 3' if question.is_a? Criterion&lt;br /&gt;
      question.alternatives = '0|1|2|3|4|5' if question.is_a? Dropdown&lt;br /&gt;
      question.size = '60, 5' if question.is_a? TextArea&lt;br /&gt;
      question.size = '30' if question.is_a? TextField&lt;br /&gt;
      begin&lt;br /&gt;
        question.save&lt;br /&gt;
      rescue&lt;br /&gt;
        flash[:error] = $ERROR_INFO&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
    redirect_to edit_questionnaire_path(questionnaire_id.to_sym)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This method invokes ''question.create'' method in ''questions_cotroller.rb'' and saves the created question to the database. Then it redirects to the ''edit.html.erb'' page which causes page refresh while adding questions.&lt;br /&gt;
&lt;br /&gt;
'''Solution:''' This problem was tried to solve using ajax by changing or adding the following classes and pages &lt;br /&gt;
* _question.html.erb (added) - displays added question&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;td align=&amp;quot;center&amp;quot;&amp;gt;&amp;lt;a rel=&amp;quot;nofollow&amp;quot; data-method=&amp;quot;delete&amp;quot; href=&amp;quot;/questions/' &amp;lt;%= @question.id%&amp;gt; '&amp;quot;&amp;gt;Remove&amp;lt;/a&amp;gt;&amp;lt;/td&amp;gt;'&lt;br /&gt;
        &amp;lt;td&amp;gt;&amp;lt;input size=&amp;quot;6&amp;quot; value=&amp;quot;' &amp;lt;%= @question.seq%&amp;gt; '&amp;quot; name=&amp;quot;question[' question.id %&amp;gt;'][seq]&amp;quot; id=&amp;quot;question_' +&amp;lt;%=@question.id %&amp;gt; '_seq&amp;quot; type=&amp;quot;text&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
        &amp;lt;td&amp;gt;&amp;lt;textarea cols=&amp;quot;50&amp;quot; rows=&amp;quot;1&amp;quot; name=&amp;quot;question[' &amp;lt;%= @question.id%&amp;gt; '][txt]&amp;quot; id=&amp;quot;question_' &amp;lt;%= @question.id%&amp;gt; '_txt&amp;quot; placeholder=&amp;quot;Edit question content here&amp;quot;&amp;gt;' &amp;lt;%= @question.txt%&amp;gt; '&amp;lt;/textarea&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
        &amp;lt;td&amp;gt;&amp;lt;input size=&amp;quot;10&amp;quot; disabled=&amp;quot;disabled&amp;quot; value=&amp;quot;'  &amp;lt;%= @question.type%&amp;gt;  '&amp;quot; name=&amp;quot;question[' &amp;lt;%= @question.id%&amp;gt;'][type]&amp;quot; id=&amp;quot;question_' &amp;lt;%= @question.id%&amp;gt; '_type&amp;quot; type=&amp;quot;text&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
        &amp;lt;td&amp;gt;&amp;lt;!--placeholder (QuestionnaireHeader does not need weight)--&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* add_new_questions.js.erb (added) - appends the html content with added question in ''_question.html.erb'' to  questions_table in ''_questionnaire.html.erb''&lt;br /&gt;
&lt;br /&gt;
   $(&amp;quot;#questions_table&amp;quot;).append(&amp;quot;&amp;lt;%= j render :partial =&amp;gt; 'question',&lt;br /&gt;
           :locals =&amp;gt; {question: @question, :id =&amp;gt; @question.id, :controller =&amp;gt; 'questions'} %&amp;gt;&amp;quot;);&lt;br /&gt;
  &lt;br /&gt;
* edit.html.erb (modified : code removed) - following code is removed as it internally calls respective question header models and appends html string to questions_table internally.&lt;br /&gt;
      &lt;br /&gt;
      &amp;lt;% for @question in @questionnaire.questions do%&amp;gt;&lt;br /&gt;
        &amp;lt;%-# The following line call certain method of the object, which returns html string-%&amp;gt;&lt;br /&gt;
        &amp;lt;%= @question.edit %&amp;gt;&lt;br /&gt;
      &amp;lt;% end %&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
@question.edit invokes ''QuestionHeader.rb'' model which adds html content&lt;br /&gt;
     def edit(_count)&lt;br /&gt;
    html = '&amp;lt;tr&amp;gt;'&lt;br /&gt;
    html += '&amp;lt;td align=&amp;quot;center&amp;quot;&amp;gt;&amp;lt;a rel=&amp;quot;nofollow&amp;quot; data-method=&amp;quot;delete&amp;quot; href=&amp;quot;/questions/' + self.id.to_s + '&amp;quot;&amp;gt;Remove&amp;lt;/a&amp;gt;&amp;lt;/td&amp;gt;'&lt;br /&gt;
    html += '&amp;lt;td&amp;gt;&amp;lt;input size=&amp;quot;6&amp;quot; value=&amp;quot;' + self.seq.to_s + '&amp;quot; name=&amp;quot;question[' + self.id.to_s + '][seq]&amp;quot; id=&amp;quot;question_' + self.id.to_s + '_seq&amp;quot; type=&amp;quot;text&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;'&lt;br /&gt;
    html += '&amp;lt;td&amp;gt;&amp;lt;textarea cols=&amp;quot;50&amp;quot; rows=&amp;quot;1&amp;quot; name=&amp;quot;question[' + self.id.to_s + '][txt]&amp;quot; id=&amp;quot;question_' + self.id.to_s + '_txt&amp;quot; placeholder=&amp;quot;Edit question content here&amp;quot;&amp;gt;' + self.txt + '&amp;lt;/textarea&amp;gt;&amp;lt;/td&amp;gt;'&lt;br /&gt;
    html += '&amp;lt;td&amp;gt;&amp;lt;input size=&amp;quot;10&amp;quot; disabled=&amp;quot;disabled&amp;quot; value=&amp;quot;' + self.type + '&amp;quot; name=&amp;quot;question[' + self.id.to_s + '][type]&amp;quot; id=&amp;quot;question_' + self.id.to_s + '_type&amp;quot; type=&amp;quot;text&amp;quot;&amp;gt;''&amp;lt;/td&amp;gt;'&lt;br /&gt;
    html += '&amp;lt;td&amp;gt;&amp;lt;!--placeholder (QuestionnaireHeader does not need weight)--&amp;gt;&amp;lt;/td&amp;gt;'&lt;br /&gt;
    html += '&amp;lt;/tr&amp;gt;'&lt;br /&gt;
    html.html_safe&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
* questionnaires_controller.rb (modified) - add_new_questions method is modified by replacing redire rendering ''add_new_questions.js.erb'' file&lt;br /&gt;
&lt;br /&gt;
  render :action=&amp;gt; 'add_new_questions.js.erb', :layout=&amp;gt;false, :question=&amp;gt; question&lt;br /&gt;
   #redirect_to edit_questionnaire_path(questionnaire_id.to_sym)&lt;br /&gt;
&lt;br /&gt;
'''Issue :''' But this solution is not working as Ajax can be applied to the browser side processing if the controller method is redirecting to the same page, which is not in this case as page gets redirected from question.html.erb to edit.html.erb. Another problem faced is the creation of questions which is called through ''_questionnaire.html.erb'' but not through ''_question.html.erb'' which makes it difficult to pass correct questionnaire id to the ajax call.&lt;br /&gt;
&lt;br /&gt;
'''Alternative Approach to Edit Questionnaire:''' Another approach to solve this issue is to create a seperate java-script function which handles the entire process of adding,saving,deleting questions and appending them. Call this function from ''_questionnaire.html.erb'' instead of invoking add_new_questions method. Questions can be saved and retrived from data using Javascript Rest API calls. But, this approach not only needs to restructure entire questionnaire structure and many components in the Expertiza project but also violates the MVC design of the project.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Un-submit reviews===&lt;br /&gt;
'''Earlier scenario:''' When an instructor/TA goes to &amp;quot;Manage Assignments -&amp;gt; Assign Reviewers&amp;quot; page, he/she can see a list of all the topics, the contributors and the reviewers for each topic. This page did not show the status of each review which can be in Assigned state or Saved state or Submitted state. Also, there was no way for the instructor/TA to un-submit an already submitted review.&lt;br /&gt;
&lt;br /&gt;
'''New Additions:'''&lt;br /&gt;
* Updated the ''review_mappings/_list_review_mappings.html.erb'' file in views to display the status of each review by the reviewer. For each review_mapping, the code checks if there is a response in ''Response'' table with the same ''map_id'' used in the review_mappings on this page. &lt;br /&gt;
** If there is no such response, it means that the reviewer has not saved/submitted the review and it is currently in Assigned State. So, &amp;quot;Response Status: Saved&amp;quot; is shown for that review.&lt;br /&gt;
** If there is a response, the last (latest) response is checked as per requirement and the ''is_submitted'' attribute of this response is checked in the ''Response'' table.&lt;br /&gt;
*** If the attribute is false, the review has been saved but not submitted. So, &amp;quot;Response Status: Saved&amp;quot; is shown for that review.&lt;br /&gt;
*** If the attribute is true, the review has been submitted. So, &amp;quot;Response Status: Submitted&amp;quot; is shown for that review. Next to this, a link is created to un-submit the review. Clicking on this link changes the ''is_submitted'' attribute to false and updates the Response Status to Saved on the page by using ajax call, without reloading the page&lt;br /&gt;
[[File:List_review_mappings_html_erb.png]]&lt;br /&gt;
* Added a new method &amp;quot;unsubmit_review&amp;quot; to the ''review_mapping_controller.rb'' file. In this, we first find the latest response and then update the ''is_submitted'' attribute to false. The flash message is created based on whether the response was updated correctly. After this, ''unsubmit_review.js.rb'' file is rendered which updates the response status for the corresponding review on the page to Saved, without reloading the page&lt;br /&gt;
[[File:Review_mapping_controller_rb.png]]&lt;br /&gt;
* Added a new file ''review_mappings/unsubmit_review.js.erb'' to views. This file just changes the response status for the corresponding review displayed on the page to Saved from Submit after the review has been un-submitted and also prints the corresponding success or error flash message.&lt;br /&gt;
[[File:Unsubmit_review_js_erb.png]]&lt;br /&gt;
* Added a new line to ''routes.rb'' page for unsubmit_review action&lt;br /&gt;
[[File:Routes_rb.png]]&lt;br /&gt;
&lt;br /&gt;
==UI Testing==&lt;br /&gt;
&lt;br /&gt;
Log in details&lt;br /&gt;
&lt;br /&gt;
'''Username:''' instructor6&lt;br /&gt;
'''password:''' password&lt;br /&gt;
&lt;br /&gt;
'''Steps to test adding participant: '''&lt;br /&gt;
&lt;br /&gt;
''' Steps to test adding TA:'''&lt;br /&gt;
&lt;br /&gt;
''' Steps to test adding question in questionnaire:'''&lt;br /&gt;
&lt;br /&gt;
* Login 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.  You will now be navigated to page where you can add new questions to the questionnaire. &lt;br /&gt;
* Click on add button in &amp;quot;Questions&amp;quot; section.&lt;br /&gt;
&lt;br /&gt;
''Expected output:''  When add button is clicked, question should be created and the questionnaire page should not get reloaded&lt;br /&gt;
&lt;br /&gt;
''' Steps to test un-submit reviews'''&lt;br /&gt;
&lt;br /&gt;
==Project Deployment==&lt;br /&gt;
==Future work==&lt;br /&gt;
&lt;br /&gt;
In future, we will try to implement the edit questionnaire part using alternative approach. We will try to implement testing using rspec framework and improve the UI design of the pages.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
* https://www.youtube.com/channel/UCdKXzox7hrWjfOMML6FzTWg&lt;br /&gt;
* https://github.com/expertiza/expertiza&lt;br /&gt;
* http://wiki.expertiza.ncsu.edu/index.php/Expertiza_documentation&lt;br /&gt;
* http://guides.rubyonrails.org/working_with_javascript_in_rails.html&lt;/div&gt;</summary>
		<author><name>Dguttik</name></author>
	</entry>
</feed>