<?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=Pdeng</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=Pdeng"/>
	<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=Special:Contributions/Pdeng"/>
	<updated>2026-05-10T05:58:50Z</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_2015_E1526&amp;diff=97036</id>
		<title>CSC/ECE 517 Spring 2015 E1526</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015_E1526&amp;diff=97036"/>
		<updated>2015-05-03T15:53:34Z</updated>

		<summary type="html">&lt;p&gt;Pdeng: /* Guide for future students */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;font size=&amp;quot;5&amp;quot;&amp;gt;&amp;lt;b&amp;gt;E1526. Responsive web design for Expertiza&amp;lt;/b&amp;gt;&amp;lt;/font&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
= Strategy =&lt;br /&gt;
&lt;br /&gt;
We analyzed the three Expertiza pages that we need to modify for this project, as well as all of their dependencies, and tried to identify all the tasks that we need to complete for this project. It became clear to us that a large majority of this project will be based on AngularJS, while the small fraction will be related to Bootstrap. Therefore, our strategy was to jumpstart this project by having all 4 team members work together on adding AngularJS to the Login page. Once the Login page was completed, we split in two groups. One group worked on implementing AngularJS on Manage-course page, while the other group worked on introducing AngularJS to Manage-User page.&lt;br /&gt;
The reasoning behind this strategy was that all of us working together on the Login page first allowed us to obtain some basic understanding of AngularJS and feel more comfortable using this impressively useful and powerful framework. We completed AngularJS constituents first by connecting some of the Rails controllers to AngularJS controllers and then, as a final step, we add Bootstrap. Our decision was based on the fact that Bootstrap does not require much work to be completed and it can be considered to be a pretty straight-forward element of the project.&lt;br /&gt;
&lt;br /&gt;
= Guide for future students =&lt;br /&gt;
1. Learn how to integrate AngularJS into Rails, using Rails original routing system.&lt;br /&gt;
&lt;br /&gt;
2. Learn AngularJS and Coffeescript, since the app.js is written in Coffeescript now.&lt;br /&gt;
&lt;br /&gt;
3. Learn Bootstrap, including the grid system, responsive design and etc.&lt;br /&gt;
&lt;br /&gt;
4. Read the code written by us, to know &lt;br /&gt;
&lt;br /&gt;
    a. how to pass data from Rails controller and view to AngularJS; &lt;br /&gt;
    b. how to pass data back to Rails view from AngularJS; &lt;br /&gt;
    c. how to convert JSON formatted data using in AngularJS to Rails hash and vice versa.&lt;br /&gt;
    d. how to present the data to Rails view&lt;br /&gt;
&lt;br /&gt;
= Integration =&lt;br /&gt;
This section represent the cornerstone of this project. It consciously explains how Angular and Rails can be integrated into a powerful system capable of providing solid control over both the backend and frontend development of your application.&lt;br /&gt;
&lt;br /&gt;
== Steps to interconnect Rails and AngularJS ==&lt;br /&gt;
&lt;br /&gt;
These guidelines assume that you have a Rails project in place and that you are intending to add AngularJS to it now. Please follow the steps bellow:&lt;br /&gt;
&lt;br /&gt;
1. In the Gemfile, ADD gem ‘bower-rails’ AND gem ‘angular-rails-templates’, then REMOVE ‘gem turbolinks'&lt;br /&gt;
&lt;br /&gt;
2. run &amp;lt;pre&amp;gt; bundle install&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3. Create a Bowerfile. It is used by AngularJS and it can be thought of as the Gemfile that Rails uses.&lt;br /&gt;
&lt;br /&gt;
4. In the Bowerfile, ADD asset ‘angular’ , asset ‘bootstrap-sass-official’, asset ‘angular-route’ AND asset ‘angular-boostrap’(for ui.bootstrap injection)&lt;br /&gt;
&lt;br /&gt;
5. run &amp;lt;pre&amp;gt; rake bower:install &amp;lt;/pre&amp;gt;. Bower installs dependencies in vender/assets/bower_components.&lt;br /&gt;
&lt;br /&gt;
6.  ADD the following content to the config/application.rb&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 config.assets.paths &amp;lt;&amp;lt; Rails.root.join(&amp;quot;vendor&amp;quot;,&amp;quot;assets&amp;quot;,&amp;quot;bower_components&amp;quot;)&lt;br /&gt;
 &lt;br /&gt;
config.assets.paths &amp;lt;&amp;lt; Rails.root.join(&amp;quot;vendor&amp;quot;,&amp;quot;assets&amp;quot;,&amp;quot;bower_components&amp;quot;,&amp;quot;bootstrap-sass-official&amp;quot;,&amp;quot;assets&amp;quot;,&amp;quot;fonts&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
config.assets.precompile &amp;lt;&amp;lt; %r(.*.(?:eot|svg|ttf|woff|woff2)$) &lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
7. REMOVE //= require turbolinks AND ADD &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//= require angular/angular&lt;br /&gt;
//= require angular-route/angular-route&lt;br /&gt;
//= require angular-rails-templates&lt;br /&gt;
//= require angular-bootstrap &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
to assets/javascripts/application.js&lt;br /&gt;
&lt;br /&gt;
8. Rename assets/stylesheets/application.css to assets/stylesheets/application.css.scss. &lt;br /&gt;
&lt;br /&gt;
9. ADD &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
@import &amp;quot;bootstrap-sass-official/assets/stylesheets/bootstrap-sprockets&amp;quot;; and&lt;br /&gt;
@import &amp;quot;bootstrap-sass-official/assets/stylesheets/bootstrap&amp;quot;; &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
to application.css.scss&lt;br /&gt;
&lt;br /&gt;
Since we are did not get to build a new website using AngularJS from scratch, it was a good idea to retain the routing system of Rails rather than implement it in AngularJS.&lt;br /&gt;
So, we added a new tag &amp;lt;code&amp;gt; div ng-app='MPApp'&amp;lt;/code&amp;gt; into the app/views/layout/application.html.erb to include all pages into the scope of our AngularJS app, named ‘MPApp’.&lt;br /&gt;
Then, for the home page app/views/content_pages/view.html.erb, we added a tag to make this page controlled by ‘testCtrl’, which was defined in app.coffee.&lt;br /&gt;
&lt;br /&gt;
== AngularJS's point of view ==&lt;br /&gt;
&lt;br /&gt;
1. Retrieving data from database&lt;br /&gt;
Because it is not appropriate to let AngularJS to directly fetch data from the MySQL database, the only way we could load data was through a Rails controller. For example, it is possible to do a http get/post request(GET /users/fetch_10_users) from AngularJS controller using $http injection or jQuery AJAX, which calls a new method ‘def fetch_10_users’ in the users_controller, which execute some database query via accessing methods in the user model, and returns json formatted data to the AngularJS controller. After getting the returning data, the AngularJS controller can present the data to the screen.&lt;br /&gt;
&lt;br /&gt;
2. Build custom directives&lt;br /&gt;
Instead of using the original Rails page, we decided to replace some forms and components using AngularJS directives, which enabled us to do some live modifications to the pages without loading.&lt;br /&gt;
&lt;br /&gt;
== Rails' point of view ==&lt;br /&gt;
The initial problem was how to provide entries from the database to AngularJS. We decided to create methods in Rails controller which will listen to the incoming AngulaJS and use a select statement to fetch a couple of entries from the database. These entries are then stored in a hash, converted to json and passed to AngularJS controller. AngularJS will then send another query request to Rails for the next set of entries. This strategy greatly reduces the loading time, making the time needed for representing the page kept at the minimum.&lt;br /&gt;
&lt;br /&gt;
=The specifics=&lt;br /&gt;
This section explains the very detailed actions and their results related to the 3 specific pages that were used to integrate AngularJS. Numerous snapshots are provided with the goal to make our approach very clear.&lt;br /&gt;
&lt;br /&gt;
== Login Page and Navigation Bar ==&lt;br /&gt;
Login procedure:&lt;br /&gt;
‘Login’ button clicked → auth_controller#login → auth_controller#after_login(user) → if user.role != ‘student’ → tree_display#drill → tree_display#list&amp;lt;br/&amp;gt;&lt;br /&gt;
If session[:menu] is defined, that is, when a user is logging in, the page will render the content of variable session[:menu].&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;ul class=&amp;quot;nav navbar-nav&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;% if session[:menu] %&amp;gt;&lt;br /&gt;
       &amp;lt;%= render :partial =&amp;gt; 'menu_items/suckerfish',&lt;br /&gt;
          :locals =&amp;gt; { items: session[:menu].get_menu(0), level: 0 } %&amp;gt;&lt;br /&gt;
     &amp;lt;% end %&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul class=&amp;quot;nav navbar-nav&amp;quot;&amp;gt;&lt;br /&gt;
   &amp;lt;% if session[:menu] %&amp;gt;&lt;br /&gt;
      &amp;lt;%= render :partial =&amp;gt; 'menu_items/suckerfish',&lt;br /&gt;
         :locals =&amp;gt; { items: session[:menu].get_menu(0), level: 0 } %&amp;gt;&lt;br /&gt;
  &amp;lt;% end %&amp;gt;&lt;br /&gt;
 &amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For each menu item in the nav bar, it is a dropdown menu now. For different level of dropdown menu, we apply different CSS style to it.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;% level += 1 %&amp;gt;&lt;br /&gt;
&amp;lt;% items.each do |item_id|&lt;br /&gt;
  item = session[:menu].get_item(item_id)&lt;br /&gt;
  selected = session[:menu].selected?(item.id)&lt;br /&gt;
  long_name = item.name.split(/\W/).collect{|word| word.capitalize}.join(' ')&lt;br /&gt;
%&amp;gt;&lt;br /&gt;
&amp;lt;% if level == 1 %&amp;gt;&lt;br /&gt;
&amp;lt;li class=&amp;quot;dropdown first-level&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;% elsif level == 2 %&amp;gt;&lt;br /&gt;
&amp;lt;li class=&amp;quot;dropdown-submenu&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;% else %&amp;gt;&lt;br /&gt;
&amp;lt;li class=&amp;quot;dropdown&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;% end %&amp;gt;&lt;br /&gt;
  &amp;lt;a href=&amp;lt;%= URI.encode(&amp;quot;/menu/#{item.name}&amp;quot;) %&amp;gt;&lt;br /&gt;
  &amp;lt;%= if item.children&lt;br /&gt;
        ' class=&amp;quot;daddy&amp;quot;'&lt;br /&gt;
      end %&amp;gt;title='&amp;lt;%= long_name %&amp;gt;'&amp;gt;&amp;lt;%= item.label.html_safe %&amp;gt;&amp;lt;/a&amp;gt;&lt;br /&gt;
    &amp;lt;% if item.children -%&amp;gt;&lt;br /&gt;
    &amp;lt;% if level == 1 %&amp;gt;&lt;br /&gt;
    &amp;lt;ul class=&amp;quot;dropdown-menu multi-level&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;%= render :partial =&amp;gt; 'menu_items/suckerfish', :locals =&amp;gt; {:items =&amp;gt; item.children, :level =&amp;gt; level} %&amp;gt;&lt;br /&gt;
    &amp;lt;/ul&amp;gt;&lt;br /&gt;
    &amp;lt;% else %&amp;gt;&lt;br /&gt;
    &amp;lt;ul class=&amp;quot;dropdown-menu&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;%= render :partial =&amp;gt; 'menu_items/suckerfish', :locals =&amp;gt; {:items =&amp;gt; item.children, :level =&amp;gt; level} %&amp;gt;&lt;br /&gt;
      &amp;lt;/ul&amp;gt;&lt;br /&gt;
    &amp;lt;% end %&amp;gt;&lt;br /&gt;
    &amp;lt;% end -%&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;% end -%&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Please also refer to app/assets/application.css.scss for further details.&lt;br /&gt;
&lt;br /&gt;
== Manage-course page ==&lt;br /&gt;
=== Design ===&lt;br /&gt;
After logging in, only the table frame is loaded into the page by rails. Then AngularJS takes over in the background and populate the content into the table. After all first-level content is populated into the table, in this case, all courses info belongs to the first level and their assignment is the second-level content.&lt;br /&gt;
&lt;br /&gt;
After all first level content is loaded into the table, the Angular controller starts to initialize POST request for second level content.&lt;br /&gt;
&lt;br /&gt;
In all, rendering the tree_display page is divided into 3 steps: &amp;lt;br&amp;gt;&lt;br /&gt;
1. render the table frame,  &amp;lt;br&amp;gt;&lt;br /&gt;
2. render the first level table content. &amp;lt;br&amp;gt;&lt;br /&gt;
3. fetch deeper level data. &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the past, these 3 steps are done before rendering the page, which takes about 10-20 seconds. But now, it takes only 2-3 seconds to finish the first 2 steps, and 2 more seconds for the 3rd step.&lt;br /&gt;
&lt;br /&gt;
Moreover, the sorting and table record filtering is integrated into the table. No redirecting or re-rendering is needed for sorting or filtering, which was needed in the past.&lt;br /&gt;
&lt;br /&gt;
=== Code details ===&lt;br /&gt;
Pass Rails controller params to view in tree_display_controller#list&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
angularParams = {}&lt;br /&gt;
angularParams[:search] = @search&lt;br /&gt;
angularParams[:show] = @show&lt;br /&gt;
angularParams[:child_nodes] = @child_nodes&lt;br /&gt;
angularParams[:sortvar] = @sortvar&lt;br /&gt;
angularParams[:sortorder] = @sortorder&lt;br /&gt;
angularParams[:user_id] = session[:user].id&lt;br /&gt;
angularParams[:nodeType] = 'FolderNode'&lt;br /&gt;
@angularParamsJSON = angularParams.to_json&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then the view passes to AngularJS&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;div ng-controller='TreeCtrl'&amp;gt;&lt;br /&gt;
&amp;lt;div ng-init=&amp;quot;init('&amp;lt;%= @angularParamsJSON %&amp;gt;')&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
AngularJS handles it, after all basic elements are loaded onto the page. Then AngularJS initializes a POST request for retrieving more data to populate the table.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$scope.init = (value) -&amp;gt;&lt;br /&gt;
    $scope.angularParams = JSON.parse(value)&lt;br /&gt;
    $http.post('/tree_display/get_children_node_ng', {&lt;br /&gt;
      &amp;quot;angularParams&amp;quot;: $scope.angularParams&lt;br /&gt;
      })&lt;br /&gt;
    .success((data) -&amp;gt;&lt;br /&gt;
      $scope.tableContent = {}&lt;br /&gt;
      $scope.displayTableContent = {}&lt;br /&gt;
      $scope.lastLoadNum = {}&lt;br /&gt;
      $scope.typeList = []&lt;br /&gt;
      console.log data&lt;br /&gt;
      for nodeType, outerNode of data&lt;br /&gt;
        $scope.tableContent[nodeType] = []&lt;br /&gt;
        $scope.lastLoadNum[nodeType] = 0&lt;br /&gt;
        $scope.displayTableContent[nodeType] = []&lt;br /&gt;
        $scope.typeList.push nodeType&lt;br /&gt;
        # outerNode is the Assignments/Courses/Questionnaires&lt;br /&gt;
        for node in outerNode&lt;br /&gt;
          $scope.tableContent[nodeType].push node&lt;br /&gt;
          $scope.fetchCellContent(nodeType, node)&lt;br /&gt;
        $scope.getMoreContent(nodeType, 1)&lt;br /&gt;
      )&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Fetch table cell content recursively and put them into a hash&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$scope.fetchCellContent = (nodeType, node) -&amp;gt;&lt;br /&gt;
    $scope.newParams = {}&lt;br /&gt;
    $scope.newParams[&amp;quot;sortvar&amp;quot;] = $scope.angularParams[&amp;quot;sortvar&amp;quot;]&lt;br /&gt;
    $scope.newParams[&amp;quot;sortorder&amp;quot;] = $scope.angularParams[&amp;quot;sortorder&amp;quot;]&lt;br /&gt;
    $scope.newParams[&amp;quot;search&amp;quot;] = $scope.angularParams[&amp;quot;search&amp;quot;]&lt;br /&gt;
    $scope.newParams[&amp;quot;show&amp;quot;] = $scope.angularParams[&amp;quot;show&amp;quot;]&lt;br /&gt;
    $scope.newParams[&amp;quot;user_id&amp;quot;] = $scope.angularParams[&amp;quot;user_id&amp;quot;]&lt;br /&gt;
    key = node.name + &amp;quot;|&amp;quot; + node.directory&lt;br /&gt;
    $scope.newParams[&amp;quot;key&amp;quot;] = key&lt;br /&gt;
    # console.log key&lt;br /&gt;
    if nodeType == 'Assignments'&lt;br /&gt;
      $scope.newParams[&amp;quot;nodeType&amp;quot;] = 'AssignmentNode'&lt;br /&gt;
    else if nodeType == 'Courses'&lt;br /&gt;
      $scope.newParams[&amp;quot;nodeType&amp;quot;] = 'CourseNode'&lt;br /&gt;
    else if nodeType == 'Questionnaires'&lt;br /&gt;
      $scope.newParams[&amp;quot;nodeType&amp;quot;] = 'FolderNode'&lt;br /&gt;
    else&lt;br /&gt;
      $scope.newParams[&amp;quot;nodeType&amp;quot;] = nodeType&lt;br /&gt;
&lt;br /&gt;
    $scope.newParams[&amp;quot;child_nodes&amp;quot;] = node.nodeinfo&lt;br /&gt;
    $http.post('/tree_display/get_children_node_2_ng', {&lt;br /&gt;
      &amp;quot;angularParams&amp;quot;: $scope.newParams&lt;br /&gt;
      })&lt;br /&gt;
    .success((data) -&amp;gt;&lt;br /&gt;
      if data.length &amp;gt; 0&lt;br /&gt;
        for newNode in data&lt;br /&gt;
          if not $scope.allData[newNode.key]&lt;br /&gt;
            $scope.allData[newNode.key] = []&lt;br /&gt;
          $scope.display[newNode.key] = false&lt;br /&gt;
          $scope.allData[newNode.key].push newNode&lt;br /&gt;
          $scope.fetchCellContent(newNode.type, newNode)&lt;br /&gt;
&lt;br /&gt;
      )&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After all data is fetched, the Rails view is able to presenting them onto the page!&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;tbody ng-repeat=&amp;quot;record in displayTableContent['Courses'] | filter:searchText | orderBy:predicate:reverse&amp;quot;&amp;gt;&lt;br /&gt;
          &amp;lt;tr ng-click=&amp;quot;showCellContent(record.name, record.directory)&amp;quot; class=&amp;quot;clickable-row&amp;quot;&amp;gt;&lt;br /&gt;
            &amp;lt;td&amp;gt;{{record.name}}&amp;lt;/td&amp;gt;&lt;br /&gt;
            &amp;lt;td&amp;gt;{{record.directory}}&amp;lt;/td&amp;gt;&lt;br /&gt;
            &amp;lt;td&amp;gt;{{record.creation_date}}&amp;lt;/td&amp;gt;&lt;br /&gt;
            &amp;lt;td&amp;gt;{{record.updated_date}}&amp;lt;/td&amp;gt;&lt;br /&gt;
            &amp;lt;td&amp;gt;&lt;br /&gt;
              &lt;br /&gt;
            &amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
          &amp;lt;/tr&amp;gt;&lt;br /&gt;
          &amp;lt;tr class=&amp;quot;no-cursor-tr no-color-tr&amp;quot; ng-if=&amp;quot;display[record.name+'|'+record.directory] &amp;amp;&amp;amp; allData[record.name+'|'+record.directory]&amp;quot;&amp;gt;&lt;br /&gt;
          &amp;lt;td colspan=&amp;quot;3&amp;quot;&amp;gt;&lt;br /&gt;
            &amp;lt;table class=&amp;quot;normal-table table table-bordered table-striped compact-table&amp;quot; ng-repeat=&amp;quot;cell in cellContent&amp;quot;&amp;gt;&lt;br /&gt;
              &amp;lt;tbody&amp;gt;&lt;br /&gt;
                &amp;lt;tr class=&amp;quot;no-cursor-tr no-color-tr&amp;quot;&amp;gt;&lt;br /&gt;
                  &amp;lt;td&amp;gt;&amp;lt;b&amp;gt;Name&amp;lt;/b&amp;gt;: {{cell.name}}&amp;lt;/td&amp;gt;&lt;br /&gt;
                &amp;lt;/tr&amp;gt;&lt;br /&gt;
                &amp;lt;tr class=&amp;quot;no-cursor-tr no-color-tr&amp;quot;&amp;gt;&lt;br /&gt;
                  &amp;lt;td&amp;gt;&amp;lt;b&amp;gt;Directory&amp;lt;/b&amp;gt;: {{cell.directory}}&amp;lt;/td&amp;gt;&lt;br /&gt;
                &amp;lt;/tr&amp;gt;&lt;br /&gt;
                &amp;lt;tr class=&amp;quot;no-cursor-tr no-color-tr&amp;quot;&amp;gt;&lt;br /&gt;
                  &amp;lt;td&amp;gt;&amp;lt;b&amp;gt;Creation Date&amp;lt;/b&amp;gt;: {{cell.creation_date}}&amp;lt;/td&amp;gt;&lt;br /&gt;
                &amp;lt;/tr&amp;gt;&lt;br /&gt;
                &amp;lt;tr class=&amp;quot;no-cursor-tr no-color-tr&amp;quot;&amp;gt;&lt;br /&gt;
                  &amp;lt;td&amp;gt;&amp;lt;b&amp;gt;Modified Date&amp;lt;/b&amp;gt;: {{cell.updated_date}}&amp;lt;/td&amp;gt;&lt;br /&gt;
                &amp;lt;/tr&amp;gt;&lt;br /&gt;
              &amp;lt;/tbody&amp;gt;&lt;br /&gt;
            &amp;lt;/table&amp;gt;&lt;br /&gt;
          &amp;lt;/td&amp;gt;&lt;br /&gt;
          &amp;lt;/tr&amp;gt;&lt;br /&gt;
        &amp;lt;/tbody&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Manage Users page ==&lt;br /&gt;
users&lt;/div&gt;</summary>
		<author><name>Pdeng</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015_E1526&amp;diff=97035</id>
		<title>CSC/ECE 517 Spring 2015 E1526</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015_E1526&amp;diff=97035"/>
		<updated>2015-05-03T15:53:02Z</updated>

		<summary type="html">&lt;p&gt;Pdeng: /* Guide to future students */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;font size=&amp;quot;5&amp;quot;&amp;gt;&amp;lt;b&amp;gt;E1526. Responsive web design for Expertiza&amp;lt;/b&amp;gt;&amp;lt;/font&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
= Strategy =&lt;br /&gt;
&lt;br /&gt;
We analyzed the three Expertiza pages that we need to modify for this project, as well as all of their dependencies, and tried to identify all the tasks that we need to complete for this project. It became clear to us that a large majority of this project will be based on AngularJS, while the small fraction will be related to Bootstrap. Therefore, our strategy was to jumpstart this project by having all 4 team members work together on adding AngularJS to the Login page. Once the Login page was completed, we split in two groups. One group worked on implementing AngularJS on Manage-course page, while the other group worked on introducing AngularJS to Manage-User page.&lt;br /&gt;
The reasoning behind this strategy was that all of us working together on the Login page first allowed us to obtain some basic understanding of AngularJS and feel more comfortable using this impressively useful and powerful framework. We completed AngularJS constituents first by connecting some of the Rails controllers to AngularJS controllers and then, as a final step, we add Bootstrap. Our decision was based on the fact that Bootstrap does not require much work to be completed and it can be considered to be a pretty straight-forward element of the project.&lt;br /&gt;
&lt;br /&gt;
= Guide for future students =&lt;br /&gt;
1. Learn how to integrate AngularJS into Rails, using Rails original routing system.&lt;br /&gt;
&lt;br /&gt;
2. Learn AngularJS and Coffeescript, since the app.js is written in Coffeescript now.&lt;br /&gt;
&lt;br /&gt;
3. Learn Bootstrap, including the grid system, responsive design and etc.&lt;br /&gt;
&lt;br /&gt;
4. Read the code written by us, to know &lt;br /&gt;
&lt;br /&gt;
    a. how to pass data from Rails controller and view to AngularJS; &lt;br /&gt;
    b. how to pass data back to Rails view from AngularJS; &lt;br /&gt;
    c. how to convert JSON formatted data using in AngularJS to Rails hash and vice versa.&lt;br /&gt;
&lt;br /&gt;
= Integration =&lt;br /&gt;
This section represent the cornerstone of this project. It consciously explains how Angular and Rails can be integrated into a powerful system capable of providing solid control over both the backend and frontend development of your application.&lt;br /&gt;
&lt;br /&gt;
== Steps to interconnect Rails and AngularJS ==&lt;br /&gt;
&lt;br /&gt;
These guidelines assume that you have a Rails project in place and that you are intending to add AngularJS to it now. Please follow the steps bellow:&lt;br /&gt;
&lt;br /&gt;
1. In the Gemfile, ADD gem ‘bower-rails’ AND gem ‘angular-rails-templates’, then REMOVE ‘gem turbolinks'&lt;br /&gt;
&lt;br /&gt;
2. run &amp;lt;pre&amp;gt; bundle install&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3. Create a Bowerfile. It is used by AngularJS and it can be thought of as the Gemfile that Rails uses.&lt;br /&gt;
&lt;br /&gt;
4. In the Bowerfile, ADD asset ‘angular’ , asset ‘bootstrap-sass-official’, asset ‘angular-route’ AND asset ‘angular-boostrap’(for ui.bootstrap injection)&lt;br /&gt;
&lt;br /&gt;
5. run &amp;lt;pre&amp;gt; rake bower:install &amp;lt;/pre&amp;gt;. Bower installs dependencies in vender/assets/bower_components.&lt;br /&gt;
&lt;br /&gt;
6.  ADD the following content to the config/application.rb&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 config.assets.paths &amp;lt;&amp;lt; Rails.root.join(&amp;quot;vendor&amp;quot;,&amp;quot;assets&amp;quot;,&amp;quot;bower_components&amp;quot;)&lt;br /&gt;
 &lt;br /&gt;
config.assets.paths &amp;lt;&amp;lt; Rails.root.join(&amp;quot;vendor&amp;quot;,&amp;quot;assets&amp;quot;,&amp;quot;bower_components&amp;quot;,&amp;quot;bootstrap-sass-official&amp;quot;,&amp;quot;assets&amp;quot;,&amp;quot;fonts&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
config.assets.precompile &amp;lt;&amp;lt; %r(.*.(?:eot|svg|ttf|woff|woff2)$) &lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
7. REMOVE //= require turbolinks AND ADD &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//= require angular/angular&lt;br /&gt;
//= require angular-route/angular-route&lt;br /&gt;
//= require angular-rails-templates&lt;br /&gt;
//= require angular-bootstrap &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
to assets/javascripts/application.js&lt;br /&gt;
&lt;br /&gt;
8. Rename assets/stylesheets/application.css to assets/stylesheets/application.css.scss. &lt;br /&gt;
&lt;br /&gt;
9. ADD &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
@import &amp;quot;bootstrap-sass-official/assets/stylesheets/bootstrap-sprockets&amp;quot;; and&lt;br /&gt;
@import &amp;quot;bootstrap-sass-official/assets/stylesheets/bootstrap&amp;quot;; &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
to application.css.scss&lt;br /&gt;
&lt;br /&gt;
Since we are did not get to build a new website using AngularJS from scratch, it was a good idea to retain the routing system of Rails rather than implement it in AngularJS.&lt;br /&gt;
So, we added a new tag &amp;lt;code&amp;gt; div ng-app='MPApp'&amp;lt;/code&amp;gt; into the app/views/layout/application.html.erb to include all pages into the scope of our AngularJS app, named ‘MPApp’.&lt;br /&gt;
Then, for the home page app/views/content_pages/view.html.erb, we added a tag to make this page controlled by ‘testCtrl’, which was defined in app.coffee.&lt;br /&gt;
&lt;br /&gt;
== AngularJS's point of view ==&lt;br /&gt;
&lt;br /&gt;
1. Retrieving data from database&lt;br /&gt;
Because it is not appropriate to let AngularJS to directly fetch data from the MySQL database, the only way we could load data was through a Rails controller. For example, it is possible to do a http get/post request(GET /users/fetch_10_users) from AngularJS controller using $http injection or jQuery AJAX, which calls a new method ‘def fetch_10_users’ in the users_controller, which execute some database query via accessing methods in the user model, and returns json formatted data to the AngularJS controller. After getting the returning data, the AngularJS controller can present the data to the screen.&lt;br /&gt;
&lt;br /&gt;
2. Build custom directives&lt;br /&gt;
Instead of using the original Rails page, we decided to replace some forms and components using AngularJS directives, which enabled us to do some live modifications to the pages without loading.&lt;br /&gt;
&lt;br /&gt;
== Rails' point of view ==&lt;br /&gt;
The initial problem was how to provide entries from the database to AngularJS. We decided to create methods in Rails controller which will listen to the incoming AngulaJS and use a select statement to fetch a couple of entries from the database. These entries are then stored in a hash, converted to json and passed to AngularJS controller. AngularJS will then send another query request to Rails for the next set of entries. This strategy greatly reduces the loading time, making the time needed for representing the page kept at the minimum.&lt;br /&gt;
&lt;br /&gt;
=The specifics=&lt;br /&gt;
This section explains the very detailed actions and their results related to the 3 specific pages that were used to integrate AngularJS. Numerous snapshots are provided with the goal to make our approach very clear.&lt;br /&gt;
&lt;br /&gt;
== Login Page and Navigation Bar ==&lt;br /&gt;
Login procedure:&lt;br /&gt;
‘Login’ button clicked → auth_controller#login → auth_controller#after_login(user) → if user.role != ‘student’ → tree_display#drill → tree_display#list&amp;lt;br/&amp;gt;&lt;br /&gt;
If session[:menu] is defined, that is, when a user is logging in, the page will render the content of variable session[:menu].&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;ul class=&amp;quot;nav navbar-nav&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;% if session[:menu] %&amp;gt;&lt;br /&gt;
       &amp;lt;%= render :partial =&amp;gt; 'menu_items/suckerfish',&lt;br /&gt;
          :locals =&amp;gt; { items: session[:menu].get_menu(0), level: 0 } %&amp;gt;&lt;br /&gt;
     &amp;lt;% end %&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul class=&amp;quot;nav navbar-nav&amp;quot;&amp;gt;&lt;br /&gt;
   &amp;lt;% if session[:menu] %&amp;gt;&lt;br /&gt;
      &amp;lt;%= render :partial =&amp;gt; 'menu_items/suckerfish',&lt;br /&gt;
         :locals =&amp;gt; { items: session[:menu].get_menu(0), level: 0 } %&amp;gt;&lt;br /&gt;
  &amp;lt;% end %&amp;gt;&lt;br /&gt;
 &amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For each menu item in the nav bar, it is a dropdown menu now. For different level of dropdown menu, we apply different CSS style to it.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;% level += 1 %&amp;gt;&lt;br /&gt;
&amp;lt;% items.each do |item_id|&lt;br /&gt;
  item = session[:menu].get_item(item_id)&lt;br /&gt;
  selected = session[:menu].selected?(item.id)&lt;br /&gt;
  long_name = item.name.split(/\W/).collect{|word| word.capitalize}.join(' ')&lt;br /&gt;
%&amp;gt;&lt;br /&gt;
&amp;lt;% if level == 1 %&amp;gt;&lt;br /&gt;
&amp;lt;li class=&amp;quot;dropdown first-level&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;% elsif level == 2 %&amp;gt;&lt;br /&gt;
&amp;lt;li class=&amp;quot;dropdown-submenu&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;% else %&amp;gt;&lt;br /&gt;
&amp;lt;li class=&amp;quot;dropdown&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;% end %&amp;gt;&lt;br /&gt;
  &amp;lt;a href=&amp;lt;%= URI.encode(&amp;quot;/menu/#{item.name}&amp;quot;) %&amp;gt;&lt;br /&gt;
  &amp;lt;%= if item.children&lt;br /&gt;
        ' class=&amp;quot;daddy&amp;quot;'&lt;br /&gt;
      end %&amp;gt;title='&amp;lt;%= long_name %&amp;gt;'&amp;gt;&amp;lt;%= item.label.html_safe %&amp;gt;&amp;lt;/a&amp;gt;&lt;br /&gt;
    &amp;lt;% if item.children -%&amp;gt;&lt;br /&gt;
    &amp;lt;% if level == 1 %&amp;gt;&lt;br /&gt;
    &amp;lt;ul class=&amp;quot;dropdown-menu multi-level&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;%= render :partial =&amp;gt; 'menu_items/suckerfish', :locals =&amp;gt; {:items =&amp;gt; item.children, :level =&amp;gt; level} %&amp;gt;&lt;br /&gt;
    &amp;lt;/ul&amp;gt;&lt;br /&gt;
    &amp;lt;% else %&amp;gt;&lt;br /&gt;
    &amp;lt;ul class=&amp;quot;dropdown-menu&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;%= render :partial =&amp;gt; 'menu_items/suckerfish', :locals =&amp;gt; {:items =&amp;gt; item.children, :level =&amp;gt; level} %&amp;gt;&lt;br /&gt;
      &amp;lt;/ul&amp;gt;&lt;br /&gt;
    &amp;lt;% end %&amp;gt;&lt;br /&gt;
    &amp;lt;% end -%&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;% end -%&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Please also refer to app/assets/application.css.scss for further details.&lt;br /&gt;
&lt;br /&gt;
== Manage-course page ==&lt;br /&gt;
=== Design ===&lt;br /&gt;
After logging in, only the table frame is loaded into the page by rails. Then AngularJS takes over in the background and populate the content into the table. After all first-level content is populated into the table, in this case, all courses info belongs to the first level and their assignment is the second-level content.&lt;br /&gt;
&lt;br /&gt;
After all first level content is loaded into the table, the Angular controller starts to initialize POST request for second level content.&lt;br /&gt;
&lt;br /&gt;
In all, rendering the tree_display page is divided into 3 steps: &amp;lt;br&amp;gt;&lt;br /&gt;
1. render the table frame,  &amp;lt;br&amp;gt;&lt;br /&gt;
2. render the first level table content. &amp;lt;br&amp;gt;&lt;br /&gt;
3. fetch deeper level data. &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the past, these 3 steps are done before rendering the page, which takes about 10-20 seconds. But now, it takes only 2-3 seconds to finish the first 2 steps, and 2 more seconds for the 3rd step.&lt;br /&gt;
&lt;br /&gt;
Moreover, the sorting and table record filtering is integrated into the table. No redirecting or re-rendering is needed for sorting or filtering, which was needed in the past.&lt;br /&gt;
&lt;br /&gt;
=== Code details ===&lt;br /&gt;
Pass Rails controller params to view in tree_display_controller#list&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
angularParams = {}&lt;br /&gt;
angularParams[:search] = @search&lt;br /&gt;
angularParams[:show] = @show&lt;br /&gt;
angularParams[:child_nodes] = @child_nodes&lt;br /&gt;
angularParams[:sortvar] = @sortvar&lt;br /&gt;
angularParams[:sortorder] = @sortorder&lt;br /&gt;
angularParams[:user_id] = session[:user].id&lt;br /&gt;
angularParams[:nodeType] = 'FolderNode'&lt;br /&gt;
@angularParamsJSON = angularParams.to_json&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then the view passes to AngularJS&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;div ng-controller='TreeCtrl'&amp;gt;&lt;br /&gt;
&amp;lt;div ng-init=&amp;quot;init('&amp;lt;%= @angularParamsJSON %&amp;gt;')&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
AngularJS handles it, after all basic elements are loaded onto the page. Then AngularJS initializes a POST request for retrieving more data to populate the table.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$scope.init = (value) -&amp;gt;&lt;br /&gt;
    $scope.angularParams = JSON.parse(value)&lt;br /&gt;
    $http.post('/tree_display/get_children_node_ng', {&lt;br /&gt;
      &amp;quot;angularParams&amp;quot;: $scope.angularParams&lt;br /&gt;
      })&lt;br /&gt;
    .success((data) -&amp;gt;&lt;br /&gt;
      $scope.tableContent = {}&lt;br /&gt;
      $scope.displayTableContent = {}&lt;br /&gt;
      $scope.lastLoadNum = {}&lt;br /&gt;
      $scope.typeList = []&lt;br /&gt;
      console.log data&lt;br /&gt;
      for nodeType, outerNode of data&lt;br /&gt;
        $scope.tableContent[nodeType] = []&lt;br /&gt;
        $scope.lastLoadNum[nodeType] = 0&lt;br /&gt;
        $scope.displayTableContent[nodeType] = []&lt;br /&gt;
        $scope.typeList.push nodeType&lt;br /&gt;
        # outerNode is the Assignments/Courses/Questionnaires&lt;br /&gt;
        for node in outerNode&lt;br /&gt;
          $scope.tableContent[nodeType].push node&lt;br /&gt;
          $scope.fetchCellContent(nodeType, node)&lt;br /&gt;
        $scope.getMoreContent(nodeType, 1)&lt;br /&gt;
      )&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Fetch table cell content recursively and put them into a hash&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$scope.fetchCellContent = (nodeType, node) -&amp;gt;&lt;br /&gt;
    $scope.newParams = {}&lt;br /&gt;
    $scope.newParams[&amp;quot;sortvar&amp;quot;] = $scope.angularParams[&amp;quot;sortvar&amp;quot;]&lt;br /&gt;
    $scope.newParams[&amp;quot;sortorder&amp;quot;] = $scope.angularParams[&amp;quot;sortorder&amp;quot;]&lt;br /&gt;
    $scope.newParams[&amp;quot;search&amp;quot;] = $scope.angularParams[&amp;quot;search&amp;quot;]&lt;br /&gt;
    $scope.newParams[&amp;quot;show&amp;quot;] = $scope.angularParams[&amp;quot;show&amp;quot;]&lt;br /&gt;
    $scope.newParams[&amp;quot;user_id&amp;quot;] = $scope.angularParams[&amp;quot;user_id&amp;quot;]&lt;br /&gt;
    key = node.name + &amp;quot;|&amp;quot; + node.directory&lt;br /&gt;
    $scope.newParams[&amp;quot;key&amp;quot;] = key&lt;br /&gt;
    # console.log key&lt;br /&gt;
    if nodeType == 'Assignments'&lt;br /&gt;
      $scope.newParams[&amp;quot;nodeType&amp;quot;] = 'AssignmentNode'&lt;br /&gt;
    else if nodeType == 'Courses'&lt;br /&gt;
      $scope.newParams[&amp;quot;nodeType&amp;quot;] = 'CourseNode'&lt;br /&gt;
    else if nodeType == 'Questionnaires'&lt;br /&gt;
      $scope.newParams[&amp;quot;nodeType&amp;quot;] = 'FolderNode'&lt;br /&gt;
    else&lt;br /&gt;
      $scope.newParams[&amp;quot;nodeType&amp;quot;] = nodeType&lt;br /&gt;
&lt;br /&gt;
    $scope.newParams[&amp;quot;child_nodes&amp;quot;] = node.nodeinfo&lt;br /&gt;
    $http.post('/tree_display/get_children_node_2_ng', {&lt;br /&gt;
      &amp;quot;angularParams&amp;quot;: $scope.newParams&lt;br /&gt;
      })&lt;br /&gt;
    .success((data) -&amp;gt;&lt;br /&gt;
      if data.length &amp;gt; 0&lt;br /&gt;
        for newNode in data&lt;br /&gt;
          if not $scope.allData[newNode.key]&lt;br /&gt;
            $scope.allData[newNode.key] = []&lt;br /&gt;
          $scope.display[newNode.key] = false&lt;br /&gt;
          $scope.allData[newNode.key].push newNode&lt;br /&gt;
          $scope.fetchCellContent(newNode.type, newNode)&lt;br /&gt;
&lt;br /&gt;
      )&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After all data is fetched, the Rails view is able to presenting them onto the page!&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;tbody ng-repeat=&amp;quot;record in displayTableContent['Courses'] | filter:searchText | orderBy:predicate:reverse&amp;quot;&amp;gt;&lt;br /&gt;
          &amp;lt;tr ng-click=&amp;quot;showCellContent(record.name, record.directory)&amp;quot; class=&amp;quot;clickable-row&amp;quot;&amp;gt;&lt;br /&gt;
            &amp;lt;td&amp;gt;{{record.name}}&amp;lt;/td&amp;gt;&lt;br /&gt;
            &amp;lt;td&amp;gt;{{record.directory}}&amp;lt;/td&amp;gt;&lt;br /&gt;
            &amp;lt;td&amp;gt;{{record.creation_date}}&amp;lt;/td&amp;gt;&lt;br /&gt;
            &amp;lt;td&amp;gt;{{record.updated_date}}&amp;lt;/td&amp;gt;&lt;br /&gt;
            &amp;lt;td&amp;gt;&lt;br /&gt;
              &lt;br /&gt;
            &amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
          &amp;lt;/tr&amp;gt;&lt;br /&gt;
          &amp;lt;tr class=&amp;quot;no-cursor-tr no-color-tr&amp;quot; ng-if=&amp;quot;display[record.name+'|'+record.directory] &amp;amp;&amp;amp; allData[record.name+'|'+record.directory]&amp;quot;&amp;gt;&lt;br /&gt;
          &amp;lt;td colspan=&amp;quot;3&amp;quot;&amp;gt;&lt;br /&gt;
            &amp;lt;table class=&amp;quot;normal-table table table-bordered table-striped compact-table&amp;quot; ng-repeat=&amp;quot;cell in cellContent&amp;quot;&amp;gt;&lt;br /&gt;
              &amp;lt;tbody&amp;gt;&lt;br /&gt;
                &amp;lt;tr class=&amp;quot;no-cursor-tr no-color-tr&amp;quot;&amp;gt;&lt;br /&gt;
                  &amp;lt;td&amp;gt;&amp;lt;b&amp;gt;Name&amp;lt;/b&amp;gt;: {{cell.name}}&amp;lt;/td&amp;gt;&lt;br /&gt;
                &amp;lt;/tr&amp;gt;&lt;br /&gt;
                &amp;lt;tr class=&amp;quot;no-cursor-tr no-color-tr&amp;quot;&amp;gt;&lt;br /&gt;
                  &amp;lt;td&amp;gt;&amp;lt;b&amp;gt;Directory&amp;lt;/b&amp;gt;: {{cell.directory}}&amp;lt;/td&amp;gt;&lt;br /&gt;
                &amp;lt;/tr&amp;gt;&lt;br /&gt;
                &amp;lt;tr class=&amp;quot;no-cursor-tr no-color-tr&amp;quot;&amp;gt;&lt;br /&gt;
                  &amp;lt;td&amp;gt;&amp;lt;b&amp;gt;Creation Date&amp;lt;/b&amp;gt;: {{cell.creation_date}}&amp;lt;/td&amp;gt;&lt;br /&gt;
                &amp;lt;/tr&amp;gt;&lt;br /&gt;
                &amp;lt;tr class=&amp;quot;no-cursor-tr no-color-tr&amp;quot;&amp;gt;&lt;br /&gt;
                  &amp;lt;td&amp;gt;&amp;lt;b&amp;gt;Modified Date&amp;lt;/b&amp;gt;: {{cell.updated_date}}&amp;lt;/td&amp;gt;&lt;br /&gt;
                &amp;lt;/tr&amp;gt;&lt;br /&gt;
              &amp;lt;/tbody&amp;gt;&lt;br /&gt;
            &amp;lt;/table&amp;gt;&lt;br /&gt;
          &amp;lt;/td&amp;gt;&lt;br /&gt;
          &amp;lt;/tr&amp;gt;&lt;br /&gt;
        &amp;lt;/tbody&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Manage Users page ==&lt;br /&gt;
users&lt;/div&gt;</summary>
		<author><name>Pdeng</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015_E1526&amp;diff=97034</id>
		<title>CSC/ECE 517 Spring 2015 E1526</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015_E1526&amp;diff=97034"/>
		<updated>2015-05-03T15:52:48Z</updated>

		<summary type="html">&lt;p&gt;Pdeng: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;font size=&amp;quot;5&amp;quot;&amp;gt;&amp;lt;b&amp;gt;E1526. Responsive web design for Expertiza&amp;lt;/b&amp;gt;&amp;lt;/font&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
= Strategy =&lt;br /&gt;
&lt;br /&gt;
We analyzed the three Expertiza pages that we need to modify for this project, as well as all of their dependencies, and tried to identify all the tasks that we need to complete for this project. It became clear to us that a large majority of this project will be based on AngularJS, while the small fraction will be related to Bootstrap. Therefore, our strategy was to jumpstart this project by having all 4 team members work together on adding AngularJS to the Login page. Once the Login page was completed, we split in two groups. One group worked on implementing AngularJS on Manage-course page, while the other group worked on introducing AngularJS to Manage-User page.&lt;br /&gt;
The reasoning behind this strategy was that all of us working together on the Login page first allowed us to obtain some basic understanding of AngularJS and feel more comfortable using this impressively useful and powerful framework. We completed AngularJS constituents first by connecting some of the Rails controllers to AngularJS controllers and then, as a final step, we add Bootstrap. Our decision was based on the fact that Bootstrap does not require much work to be completed and it can be considered to be a pretty straight-forward element of the project.&lt;br /&gt;
&lt;br /&gt;
= Guide to future students =&lt;br /&gt;
1. Learn how to integrate AngularJS into Rails, using Rails original routing system.&lt;br /&gt;
&lt;br /&gt;
2. Learn AngularJS and Coffeescript, since the app.js is written in Coffeescript now.&lt;br /&gt;
&lt;br /&gt;
3. Learn Bootstrap, including the grid system, responsive design and etc.&lt;br /&gt;
&lt;br /&gt;
4. Read the code written by us, to know &lt;br /&gt;
&lt;br /&gt;
    a. how to pass data from Rails controller and view to AngularJS; &lt;br /&gt;
    b. how to pass data back to Rails view from AngularJS; &lt;br /&gt;
    c. how to convert JSON formatted data using in AngularJS to Rails hash and vice versa. &lt;br /&gt;
&lt;br /&gt;
= Integration =&lt;br /&gt;
This section represent the cornerstone of this project. It consciously explains how Angular and Rails can be integrated into a powerful system capable of providing solid control over both the backend and frontend development of your application.&lt;br /&gt;
&lt;br /&gt;
== Steps to interconnect Rails and AngularJS ==&lt;br /&gt;
&lt;br /&gt;
These guidelines assume that you have a Rails project in place and that you are intending to add AngularJS to it now. Please follow the steps bellow:&lt;br /&gt;
&lt;br /&gt;
1. In the Gemfile, ADD gem ‘bower-rails’ AND gem ‘angular-rails-templates’, then REMOVE ‘gem turbolinks'&lt;br /&gt;
&lt;br /&gt;
2. run &amp;lt;pre&amp;gt; bundle install&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3. Create a Bowerfile. It is used by AngularJS and it can be thought of as the Gemfile that Rails uses.&lt;br /&gt;
&lt;br /&gt;
4. In the Bowerfile, ADD asset ‘angular’ , asset ‘bootstrap-sass-official’, asset ‘angular-route’ AND asset ‘angular-boostrap’(for ui.bootstrap injection)&lt;br /&gt;
&lt;br /&gt;
5. run &amp;lt;pre&amp;gt; rake bower:install &amp;lt;/pre&amp;gt;. Bower installs dependencies in vender/assets/bower_components.&lt;br /&gt;
&lt;br /&gt;
6.  ADD the following content to the config/application.rb&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 config.assets.paths &amp;lt;&amp;lt; Rails.root.join(&amp;quot;vendor&amp;quot;,&amp;quot;assets&amp;quot;,&amp;quot;bower_components&amp;quot;)&lt;br /&gt;
 &lt;br /&gt;
config.assets.paths &amp;lt;&amp;lt; Rails.root.join(&amp;quot;vendor&amp;quot;,&amp;quot;assets&amp;quot;,&amp;quot;bower_components&amp;quot;,&amp;quot;bootstrap-sass-official&amp;quot;,&amp;quot;assets&amp;quot;,&amp;quot;fonts&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
config.assets.precompile &amp;lt;&amp;lt; %r(.*.(?:eot|svg|ttf|woff|woff2)$) &lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
7. REMOVE //= require turbolinks AND ADD &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//= require angular/angular&lt;br /&gt;
//= require angular-route/angular-route&lt;br /&gt;
//= require angular-rails-templates&lt;br /&gt;
//= require angular-bootstrap &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
to assets/javascripts/application.js&lt;br /&gt;
&lt;br /&gt;
8. Rename assets/stylesheets/application.css to assets/stylesheets/application.css.scss. &lt;br /&gt;
&lt;br /&gt;
9. ADD &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
@import &amp;quot;bootstrap-sass-official/assets/stylesheets/bootstrap-sprockets&amp;quot;; and&lt;br /&gt;
@import &amp;quot;bootstrap-sass-official/assets/stylesheets/bootstrap&amp;quot;; &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
to application.css.scss&lt;br /&gt;
&lt;br /&gt;
Since we are did not get to build a new website using AngularJS from scratch, it was a good idea to retain the routing system of Rails rather than implement it in AngularJS.&lt;br /&gt;
So, we added a new tag &amp;lt;code&amp;gt; div ng-app='MPApp'&amp;lt;/code&amp;gt; into the app/views/layout/application.html.erb to include all pages into the scope of our AngularJS app, named ‘MPApp’.&lt;br /&gt;
Then, for the home page app/views/content_pages/view.html.erb, we added a tag to make this page controlled by ‘testCtrl’, which was defined in app.coffee.&lt;br /&gt;
&lt;br /&gt;
== AngularJS's point of view ==&lt;br /&gt;
&lt;br /&gt;
1. Retrieving data from database&lt;br /&gt;
Because it is not appropriate to let AngularJS to directly fetch data from the MySQL database, the only way we could load data was through a Rails controller. For example, it is possible to do a http get/post request(GET /users/fetch_10_users) from AngularJS controller using $http injection or jQuery AJAX, which calls a new method ‘def fetch_10_users’ in the users_controller, which execute some database query via accessing methods in the user model, and returns json formatted data to the AngularJS controller. After getting the returning data, the AngularJS controller can present the data to the screen.&lt;br /&gt;
&lt;br /&gt;
2. Build custom directives&lt;br /&gt;
Instead of using the original Rails page, we decided to replace some forms and components using AngularJS directives, which enabled us to do some live modifications to the pages without loading.&lt;br /&gt;
&lt;br /&gt;
== Rails' point of view ==&lt;br /&gt;
The initial problem was how to provide entries from the database to AngularJS. We decided to create methods in Rails controller which will listen to the incoming AngulaJS and use a select statement to fetch a couple of entries from the database. These entries are then stored in a hash, converted to json and passed to AngularJS controller. AngularJS will then send another query request to Rails for the next set of entries. This strategy greatly reduces the loading time, making the time needed for representing the page kept at the minimum.&lt;br /&gt;
&lt;br /&gt;
=The specifics=&lt;br /&gt;
This section explains the very detailed actions and their results related to the 3 specific pages that were used to integrate AngularJS. Numerous snapshots are provided with the goal to make our approach very clear.&lt;br /&gt;
&lt;br /&gt;
== Login Page and Navigation Bar ==&lt;br /&gt;
Login procedure:&lt;br /&gt;
‘Login’ button clicked → auth_controller#login → auth_controller#after_login(user) → if user.role != ‘student’ → tree_display#drill → tree_display#list&amp;lt;br/&amp;gt;&lt;br /&gt;
If session[:menu] is defined, that is, when a user is logging in, the page will render the content of variable session[:menu].&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;ul class=&amp;quot;nav navbar-nav&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;% if session[:menu] %&amp;gt;&lt;br /&gt;
       &amp;lt;%= render :partial =&amp;gt; 'menu_items/suckerfish',&lt;br /&gt;
          :locals =&amp;gt; { items: session[:menu].get_menu(0), level: 0 } %&amp;gt;&lt;br /&gt;
     &amp;lt;% end %&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul class=&amp;quot;nav navbar-nav&amp;quot;&amp;gt;&lt;br /&gt;
   &amp;lt;% if session[:menu] %&amp;gt;&lt;br /&gt;
      &amp;lt;%= render :partial =&amp;gt; 'menu_items/suckerfish',&lt;br /&gt;
         :locals =&amp;gt; { items: session[:menu].get_menu(0), level: 0 } %&amp;gt;&lt;br /&gt;
  &amp;lt;% end %&amp;gt;&lt;br /&gt;
 &amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For each menu item in the nav bar, it is a dropdown menu now. For different level of dropdown menu, we apply different CSS style to it.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;% level += 1 %&amp;gt;&lt;br /&gt;
&amp;lt;% items.each do |item_id|&lt;br /&gt;
  item = session[:menu].get_item(item_id)&lt;br /&gt;
  selected = session[:menu].selected?(item.id)&lt;br /&gt;
  long_name = item.name.split(/\W/).collect{|word| word.capitalize}.join(' ')&lt;br /&gt;
%&amp;gt;&lt;br /&gt;
&amp;lt;% if level == 1 %&amp;gt;&lt;br /&gt;
&amp;lt;li class=&amp;quot;dropdown first-level&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;% elsif level == 2 %&amp;gt;&lt;br /&gt;
&amp;lt;li class=&amp;quot;dropdown-submenu&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;% else %&amp;gt;&lt;br /&gt;
&amp;lt;li class=&amp;quot;dropdown&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;% end %&amp;gt;&lt;br /&gt;
  &amp;lt;a href=&amp;lt;%= URI.encode(&amp;quot;/menu/#{item.name}&amp;quot;) %&amp;gt;&lt;br /&gt;
  &amp;lt;%= if item.children&lt;br /&gt;
        ' class=&amp;quot;daddy&amp;quot;'&lt;br /&gt;
      end %&amp;gt;title='&amp;lt;%= long_name %&amp;gt;'&amp;gt;&amp;lt;%= item.label.html_safe %&amp;gt;&amp;lt;/a&amp;gt;&lt;br /&gt;
    &amp;lt;% if item.children -%&amp;gt;&lt;br /&gt;
    &amp;lt;% if level == 1 %&amp;gt;&lt;br /&gt;
    &amp;lt;ul class=&amp;quot;dropdown-menu multi-level&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;%= render :partial =&amp;gt; 'menu_items/suckerfish', :locals =&amp;gt; {:items =&amp;gt; item.children, :level =&amp;gt; level} %&amp;gt;&lt;br /&gt;
    &amp;lt;/ul&amp;gt;&lt;br /&gt;
    &amp;lt;% else %&amp;gt;&lt;br /&gt;
    &amp;lt;ul class=&amp;quot;dropdown-menu&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;%= render :partial =&amp;gt; 'menu_items/suckerfish', :locals =&amp;gt; {:items =&amp;gt; item.children, :level =&amp;gt; level} %&amp;gt;&lt;br /&gt;
      &amp;lt;/ul&amp;gt;&lt;br /&gt;
    &amp;lt;% end %&amp;gt;&lt;br /&gt;
    &amp;lt;% end -%&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;% end -%&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Please also refer to app/assets/application.css.scss for further details.&lt;br /&gt;
&lt;br /&gt;
== Manage-course page ==&lt;br /&gt;
=== Design ===&lt;br /&gt;
After logging in, only the table frame is loaded into the page by rails. Then AngularJS takes over in the background and populate the content into the table. After all first-level content is populated into the table, in this case, all courses info belongs to the first level and their assignment is the second-level content.&lt;br /&gt;
&lt;br /&gt;
After all first level content is loaded into the table, the Angular controller starts to initialize POST request for second level content.&lt;br /&gt;
&lt;br /&gt;
In all, rendering the tree_display page is divided into 3 steps: &amp;lt;br&amp;gt;&lt;br /&gt;
1. render the table frame,  &amp;lt;br&amp;gt;&lt;br /&gt;
2. render the first level table content. &amp;lt;br&amp;gt;&lt;br /&gt;
3. fetch deeper level data. &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the past, these 3 steps are done before rendering the page, which takes about 10-20 seconds. But now, it takes only 2-3 seconds to finish the first 2 steps, and 2 more seconds for the 3rd step.&lt;br /&gt;
&lt;br /&gt;
Moreover, the sorting and table record filtering is integrated into the table. No redirecting or re-rendering is needed for sorting or filtering, which was needed in the past.&lt;br /&gt;
&lt;br /&gt;
=== Code details ===&lt;br /&gt;
Pass Rails controller params to view in tree_display_controller#list&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
angularParams = {}&lt;br /&gt;
angularParams[:search] = @search&lt;br /&gt;
angularParams[:show] = @show&lt;br /&gt;
angularParams[:child_nodes] = @child_nodes&lt;br /&gt;
angularParams[:sortvar] = @sortvar&lt;br /&gt;
angularParams[:sortorder] = @sortorder&lt;br /&gt;
angularParams[:user_id] = session[:user].id&lt;br /&gt;
angularParams[:nodeType] = 'FolderNode'&lt;br /&gt;
@angularParamsJSON = angularParams.to_json&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then the view passes to AngularJS&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;div ng-controller='TreeCtrl'&amp;gt;&lt;br /&gt;
&amp;lt;div ng-init=&amp;quot;init('&amp;lt;%= @angularParamsJSON %&amp;gt;')&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
AngularJS handles it, after all basic elements are loaded onto the page. Then AngularJS initializes a POST request for retrieving more data to populate the table.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$scope.init = (value) -&amp;gt;&lt;br /&gt;
    $scope.angularParams = JSON.parse(value)&lt;br /&gt;
    $http.post('/tree_display/get_children_node_ng', {&lt;br /&gt;
      &amp;quot;angularParams&amp;quot;: $scope.angularParams&lt;br /&gt;
      })&lt;br /&gt;
    .success((data) -&amp;gt;&lt;br /&gt;
      $scope.tableContent = {}&lt;br /&gt;
      $scope.displayTableContent = {}&lt;br /&gt;
      $scope.lastLoadNum = {}&lt;br /&gt;
      $scope.typeList = []&lt;br /&gt;
      console.log data&lt;br /&gt;
      for nodeType, outerNode of data&lt;br /&gt;
        $scope.tableContent[nodeType] = []&lt;br /&gt;
        $scope.lastLoadNum[nodeType] = 0&lt;br /&gt;
        $scope.displayTableContent[nodeType] = []&lt;br /&gt;
        $scope.typeList.push nodeType&lt;br /&gt;
        # outerNode is the Assignments/Courses/Questionnaires&lt;br /&gt;
        for node in outerNode&lt;br /&gt;
          $scope.tableContent[nodeType].push node&lt;br /&gt;
          $scope.fetchCellContent(nodeType, node)&lt;br /&gt;
        $scope.getMoreContent(nodeType, 1)&lt;br /&gt;
      )&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Fetch table cell content recursively and put them into a hash&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$scope.fetchCellContent = (nodeType, node) -&amp;gt;&lt;br /&gt;
    $scope.newParams = {}&lt;br /&gt;
    $scope.newParams[&amp;quot;sortvar&amp;quot;] = $scope.angularParams[&amp;quot;sortvar&amp;quot;]&lt;br /&gt;
    $scope.newParams[&amp;quot;sortorder&amp;quot;] = $scope.angularParams[&amp;quot;sortorder&amp;quot;]&lt;br /&gt;
    $scope.newParams[&amp;quot;search&amp;quot;] = $scope.angularParams[&amp;quot;search&amp;quot;]&lt;br /&gt;
    $scope.newParams[&amp;quot;show&amp;quot;] = $scope.angularParams[&amp;quot;show&amp;quot;]&lt;br /&gt;
    $scope.newParams[&amp;quot;user_id&amp;quot;] = $scope.angularParams[&amp;quot;user_id&amp;quot;]&lt;br /&gt;
    key = node.name + &amp;quot;|&amp;quot; + node.directory&lt;br /&gt;
    $scope.newParams[&amp;quot;key&amp;quot;] = key&lt;br /&gt;
    # console.log key&lt;br /&gt;
    if nodeType == 'Assignments'&lt;br /&gt;
      $scope.newParams[&amp;quot;nodeType&amp;quot;] = 'AssignmentNode'&lt;br /&gt;
    else if nodeType == 'Courses'&lt;br /&gt;
      $scope.newParams[&amp;quot;nodeType&amp;quot;] = 'CourseNode'&lt;br /&gt;
    else if nodeType == 'Questionnaires'&lt;br /&gt;
      $scope.newParams[&amp;quot;nodeType&amp;quot;] = 'FolderNode'&lt;br /&gt;
    else&lt;br /&gt;
      $scope.newParams[&amp;quot;nodeType&amp;quot;] = nodeType&lt;br /&gt;
&lt;br /&gt;
    $scope.newParams[&amp;quot;child_nodes&amp;quot;] = node.nodeinfo&lt;br /&gt;
    $http.post('/tree_display/get_children_node_2_ng', {&lt;br /&gt;
      &amp;quot;angularParams&amp;quot;: $scope.newParams&lt;br /&gt;
      })&lt;br /&gt;
    .success((data) -&amp;gt;&lt;br /&gt;
      if data.length &amp;gt; 0&lt;br /&gt;
        for newNode in data&lt;br /&gt;
          if not $scope.allData[newNode.key]&lt;br /&gt;
            $scope.allData[newNode.key] = []&lt;br /&gt;
          $scope.display[newNode.key] = false&lt;br /&gt;
          $scope.allData[newNode.key].push newNode&lt;br /&gt;
          $scope.fetchCellContent(newNode.type, newNode)&lt;br /&gt;
&lt;br /&gt;
      )&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After all data is fetched, the Rails view is able to presenting them onto the page!&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;tbody ng-repeat=&amp;quot;record in displayTableContent['Courses'] | filter:searchText | orderBy:predicate:reverse&amp;quot;&amp;gt;&lt;br /&gt;
          &amp;lt;tr ng-click=&amp;quot;showCellContent(record.name, record.directory)&amp;quot; class=&amp;quot;clickable-row&amp;quot;&amp;gt;&lt;br /&gt;
            &amp;lt;td&amp;gt;{{record.name}}&amp;lt;/td&amp;gt;&lt;br /&gt;
            &amp;lt;td&amp;gt;{{record.directory}}&amp;lt;/td&amp;gt;&lt;br /&gt;
            &amp;lt;td&amp;gt;{{record.creation_date}}&amp;lt;/td&amp;gt;&lt;br /&gt;
            &amp;lt;td&amp;gt;{{record.updated_date}}&amp;lt;/td&amp;gt;&lt;br /&gt;
            &amp;lt;td&amp;gt;&lt;br /&gt;
              &lt;br /&gt;
            &amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
          &amp;lt;/tr&amp;gt;&lt;br /&gt;
          &amp;lt;tr class=&amp;quot;no-cursor-tr no-color-tr&amp;quot; ng-if=&amp;quot;display[record.name+'|'+record.directory] &amp;amp;&amp;amp; allData[record.name+'|'+record.directory]&amp;quot;&amp;gt;&lt;br /&gt;
          &amp;lt;td colspan=&amp;quot;3&amp;quot;&amp;gt;&lt;br /&gt;
            &amp;lt;table class=&amp;quot;normal-table table table-bordered table-striped compact-table&amp;quot; ng-repeat=&amp;quot;cell in cellContent&amp;quot;&amp;gt;&lt;br /&gt;
              &amp;lt;tbody&amp;gt;&lt;br /&gt;
                &amp;lt;tr class=&amp;quot;no-cursor-tr no-color-tr&amp;quot;&amp;gt;&lt;br /&gt;
                  &amp;lt;td&amp;gt;&amp;lt;b&amp;gt;Name&amp;lt;/b&amp;gt;: {{cell.name}}&amp;lt;/td&amp;gt;&lt;br /&gt;
                &amp;lt;/tr&amp;gt;&lt;br /&gt;
                &amp;lt;tr class=&amp;quot;no-cursor-tr no-color-tr&amp;quot;&amp;gt;&lt;br /&gt;
                  &amp;lt;td&amp;gt;&amp;lt;b&amp;gt;Directory&amp;lt;/b&amp;gt;: {{cell.directory}}&amp;lt;/td&amp;gt;&lt;br /&gt;
                &amp;lt;/tr&amp;gt;&lt;br /&gt;
                &amp;lt;tr class=&amp;quot;no-cursor-tr no-color-tr&amp;quot;&amp;gt;&lt;br /&gt;
                  &amp;lt;td&amp;gt;&amp;lt;b&amp;gt;Creation Date&amp;lt;/b&amp;gt;: {{cell.creation_date}}&amp;lt;/td&amp;gt;&lt;br /&gt;
                &amp;lt;/tr&amp;gt;&lt;br /&gt;
                &amp;lt;tr class=&amp;quot;no-cursor-tr no-color-tr&amp;quot;&amp;gt;&lt;br /&gt;
                  &amp;lt;td&amp;gt;&amp;lt;b&amp;gt;Modified Date&amp;lt;/b&amp;gt;: {{cell.updated_date}}&amp;lt;/td&amp;gt;&lt;br /&gt;
                &amp;lt;/tr&amp;gt;&lt;br /&gt;
              &amp;lt;/tbody&amp;gt;&lt;br /&gt;
            &amp;lt;/table&amp;gt;&lt;br /&gt;
          &amp;lt;/td&amp;gt;&lt;br /&gt;
          &amp;lt;/tr&amp;gt;&lt;br /&gt;
        &amp;lt;/tbody&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Manage Users page ==&lt;br /&gt;
users&lt;/div&gt;</summary>
		<author><name>Pdeng</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015_E1526&amp;diff=97033</id>
		<title>CSC/ECE 517 Spring 2015 E1526</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015_E1526&amp;diff=97033"/>
		<updated>2015-05-03T15:44:48Z</updated>

		<summary type="html">&lt;p&gt;Pdeng: /* Manage-course page */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;font size=&amp;quot;5&amp;quot;&amp;gt;&amp;lt;b&amp;gt;E1526. Responsive web design for Expertiza&amp;lt;/b&amp;gt;&amp;lt;/font&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
= Strategy =&lt;br /&gt;
&lt;br /&gt;
We analyzed the three Expertiza pages that we need to modify for this project, as well as all of their dependencies, and tried to identify all the tasks that we need to complete for this project. It became clear to us that a large majority of this project will be based on AngularJS, while the small fraction will be related to Bootstrap. Therefore, our strategy was to jumpstart this project by having all 4 team members work together on adding AngularJS to the Login page. Once the Login page was completed, we split in two groups. One group worked on implementing AngularJS on Manage-course page, while the other group worked on introducing AngularJS to Manage-User page.&lt;br /&gt;
The reasoning behind this strategy was that all of us working together on the Login page first allowed us to obtain some basic understanding of AngularJS and feel more comfortable using this impressively useful and powerful framework. We completed AngularJS constituents first by connecting some of the Rails controllers to AngularJS controllers and then, as a final step, we add Bootstrap. Our decision was based on the fact that Bootstrap does not require much work to be completed and it can be considered to be a pretty straight-forward element of the project.&lt;br /&gt;
&lt;br /&gt;
= Integration =&lt;br /&gt;
This section represent the cornerstone of this project. It consciously explains how Angular and Rails can be integrated into a powerful system capable of providing solid control over both the backend and frontend development of your application.&lt;br /&gt;
&lt;br /&gt;
== Steps to interconnect Rails and AngularJS ==&lt;br /&gt;
&lt;br /&gt;
These guidelines assume that you have a Rails project in place and that you are intending to add AngularJS to it now. Please follow the steps bellow:&lt;br /&gt;
&lt;br /&gt;
1. In the Gemfile, ADD gem ‘bower-rails’ AND gem ‘angular-rails-templates’, then REMOVE ‘gem turbolinks'&lt;br /&gt;
&lt;br /&gt;
2. run &amp;lt;pre&amp;gt; bundle install&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3. Create a Bowerfile. It is used by AngularJS and it can be thought of as the Gemfile that Rails uses.&lt;br /&gt;
&lt;br /&gt;
4. In the Bowerfile, ADD asset ‘angular’ , asset ‘bootstrap-sass-official’, asset ‘angular-route’ AND asset ‘angular-boostrap’(for ui.bootstrap injection)&lt;br /&gt;
&lt;br /&gt;
5. run &amp;lt;pre&amp;gt; rake bower:install &amp;lt;/pre&amp;gt;. Bower installs dependencies in vender/assets/bower_components.&lt;br /&gt;
&lt;br /&gt;
6.  ADD the following content to the config/application.rb&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 config.assets.paths &amp;lt;&amp;lt; Rails.root.join(&amp;quot;vendor&amp;quot;,&amp;quot;assets&amp;quot;,&amp;quot;bower_components&amp;quot;)&lt;br /&gt;
 &lt;br /&gt;
config.assets.paths &amp;lt;&amp;lt; Rails.root.join(&amp;quot;vendor&amp;quot;,&amp;quot;assets&amp;quot;,&amp;quot;bower_components&amp;quot;,&amp;quot;bootstrap-sass-official&amp;quot;,&amp;quot;assets&amp;quot;,&amp;quot;fonts&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
config.assets.precompile &amp;lt;&amp;lt; %r(.*.(?:eot|svg|ttf|woff|woff2)$) &lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
7. REMOVE //= require turbolinks AND ADD &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//= require angular/angular&lt;br /&gt;
//= require angular-route/angular-route&lt;br /&gt;
//= require angular-rails-templates&lt;br /&gt;
//= require angular-bootstrap &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
to assets/javascripts/application.js&lt;br /&gt;
&lt;br /&gt;
8. Rename assets/stylesheets/application.css to assets/stylesheets/application.css.scss. &lt;br /&gt;
&lt;br /&gt;
9. ADD &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
@import &amp;quot;bootstrap-sass-official/assets/stylesheets/bootstrap-sprockets&amp;quot;; and&lt;br /&gt;
@import &amp;quot;bootstrap-sass-official/assets/stylesheets/bootstrap&amp;quot;; &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
to application.css.scss&lt;br /&gt;
&lt;br /&gt;
Since we are did not get to build a new website using AngularJS from scratch, it was a good idea to retain the routing system of Rails rather than implement it in AngularJS.&lt;br /&gt;
So, we added a new tag &amp;lt;code&amp;gt; div ng-app='MPApp'&amp;lt;/code&amp;gt; into the app/views/layout/application.html.erb to include all pages into the scope of our AngularJS app, named ‘MPApp’.&lt;br /&gt;
Then, for the home page app/views/content_pages/view.html.erb, we added a tag to make this page controlled by ‘testCtrl’, which was defined in app.coffee.&lt;br /&gt;
&lt;br /&gt;
== AngularJS's point of view ==&lt;br /&gt;
&lt;br /&gt;
1. Retrieving data from database&lt;br /&gt;
Because it is not appropriate to let AngularJS to directly fetch data from the MySQL database, the only way we could load data was through a Rails controller. For example, it is possible to do a http get/post request(GET /users/fetch_10_users) from AngularJS controller using $http injection or jQuery AJAX, which calls a new method ‘def fetch_10_users’ in the users_controller, which execute some database query via accessing methods in the user model, and returns json formatted data to the AngularJS controller. After getting the returning data, the AngularJS controller can present the data to the screen.&lt;br /&gt;
&lt;br /&gt;
2. Build custom directives&lt;br /&gt;
Instead of using the original Rails page, we decided to replace some forms and components using AngularJS directives, which enabled us to do some live modifications to the pages without loading.&lt;br /&gt;
&lt;br /&gt;
== Rails' point of view ==&lt;br /&gt;
The initial problem was how to provide entries from the database to AngularJS. We decided to create methods in Rails controller which will listen to the incoming AngulaJS and use a select statement to fetch a couple of entries from the database. These entries are then stored in a hash, converted to json and passed to AngularJS controller. AngularJS will then send another query request to Rails for the next set of entries. This strategy greatly reduces the loading time, making the time needed for representing the page kept at the minimum.&lt;br /&gt;
&lt;br /&gt;
=The specifics=&lt;br /&gt;
This section explains the very detailed actions and their results related to the 3 specific pages that were used to integrate AngularJS. Numerous snapshots are provided with the goal to make our approach very clear.&lt;br /&gt;
&lt;br /&gt;
== Login Page and Navigation Bar ==&lt;br /&gt;
Login procedure:&lt;br /&gt;
‘Login’ button clicked → auth_controller#login → auth_controller#after_login(user) → if user.role != ‘student’ → tree_display#drill → tree_display#list&amp;lt;br/&amp;gt;&lt;br /&gt;
If session[:menu] is defined, that is, when a user is logging in, the page will render the content of variable session[:menu].&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;ul class=&amp;quot;nav navbar-nav&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;% if session[:menu] %&amp;gt;&lt;br /&gt;
       &amp;lt;%= render :partial =&amp;gt; 'menu_items/suckerfish',&lt;br /&gt;
          :locals =&amp;gt; { items: session[:menu].get_menu(0), level: 0 } %&amp;gt;&lt;br /&gt;
     &amp;lt;% end %&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul class=&amp;quot;nav navbar-nav&amp;quot;&amp;gt;&lt;br /&gt;
   &amp;lt;% if session[:menu] %&amp;gt;&lt;br /&gt;
      &amp;lt;%= render :partial =&amp;gt; 'menu_items/suckerfish',&lt;br /&gt;
         :locals =&amp;gt; { items: session[:menu].get_menu(0), level: 0 } %&amp;gt;&lt;br /&gt;
  &amp;lt;% end %&amp;gt;&lt;br /&gt;
 &amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For each menu item in the nav bar, it is a dropdown menu now. For different level of dropdown menu, we apply different CSS style to it.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;% level += 1 %&amp;gt;&lt;br /&gt;
&amp;lt;% items.each do |item_id|&lt;br /&gt;
  item = session[:menu].get_item(item_id)&lt;br /&gt;
  selected = session[:menu].selected?(item.id)&lt;br /&gt;
  long_name = item.name.split(/\W/).collect{|word| word.capitalize}.join(' ')&lt;br /&gt;
%&amp;gt;&lt;br /&gt;
&amp;lt;% if level == 1 %&amp;gt;&lt;br /&gt;
&amp;lt;li class=&amp;quot;dropdown first-level&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;% elsif level == 2 %&amp;gt;&lt;br /&gt;
&amp;lt;li class=&amp;quot;dropdown-submenu&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;% else %&amp;gt;&lt;br /&gt;
&amp;lt;li class=&amp;quot;dropdown&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;% end %&amp;gt;&lt;br /&gt;
  &amp;lt;a href=&amp;lt;%= URI.encode(&amp;quot;/menu/#{item.name}&amp;quot;) %&amp;gt;&lt;br /&gt;
  &amp;lt;%= if item.children&lt;br /&gt;
        ' class=&amp;quot;daddy&amp;quot;'&lt;br /&gt;
      end %&amp;gt;title='&amp;lt;%= long_name %&amp;gt;'&amp;gt;&amp;lt;%= item.label.html_safe %&amp;gt;&amp;lt;/a&amp;gt;&lt;br /&gt;
    &amp;lt;% if item.children -%&amp;gt;&lt;br /&gt;
    &amp;lt;% if level == 1 %&amp;gt;&lt;br /&gt;
    &amp;lt;ul class=&amp;quot;dropdown-menu multi-level&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;%= render :partial =&amp;gt; 'menu_items/suckerfish', :locals =&amp;gt; {:items =&amp;gt; item.children, :level =&amp;gt; level} %&amp;gt;&lt;br /&gt;
    &amp;lt;/ul&amp;gt;&lt;br /&gt;
    &amp;lt;% else %&amp;gt;&lt;br /&gt;
    &amp;lt;ul class=&amp;quot;dropdown-menu&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;%= render :partial =&amp;gt; 'menu_items/suckerfish', :locals =&amp;gt; {:items =&amp;gt; item.children, :level =&amp;gt; level} %&amp;gt;&lt;br /&gt;
      &amp;lt;/ul&amp;gt;&lt;br /&gt;
    &amp;lt;% end %&amp;gt;&lt;br /&gt;
    &amp;lt;% end -%&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;% end -%&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Please also refer to app/assets/application.css.scss for further details.&lt;br /&gt;
&lt;br /&gt;
== Manage-course page ==&lt;br /&gt;
=== Design ===&lt;br /&gt;
After logging in, only the table frame is loaded into the page by rails. Then AngularJS takes over in the background and populate the content into the table. After all first-level content is populated into the table, in this case, all courses info belongs to the first level and their assignment is the second-level content.&lt;br /&gt;
&lt;br /&gt;
After all first level content is loaded into the table, the Angular controller starts to initialize POST request for second level content.&lt;br /&gt;
&lt;br /&gt;
In all, rendering the tree_display page is divided into 3 steps: &amp;lt;br&amp;gt;&lt;br /&gt;
1. render the table frame,  &amp;lt;br&amp;gt;&lt;br /&gt;
2. render the first level table content. &amp;lt;br&amp;gt;&lt;br /&gt;
3. fetch deeper level data. &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the past, these 3 steps are done before rendering the page, which takes about 10-20 seconds. But now, it takes only 2-3 seconds to finish the first 2 steps, and 2 more seconds for the 3rd step.&lt;br /&gt;
&lt;br /&gt;
Moreover, the sorting and table record filtering is integrated into the table. No redirecting or re-rendering is needed for sorting or filtering, which was needed in the past.&lt;br /&gt;
&lt;br /&gt;
=== Code details ===&lt;br /&gt;
Pass Rails controller params to view in tree_display_controller#list&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
angularParams = {}&lt;br /&gt;
angularParams[:search] = @search&lt;br /&gt;
angularParams[:show] = @show&lt;br /&gt;
angularParams[:child_nodes] = @child_nodes&lt;br /&gt;
angularParams[:sortvar] = @sortvar&lt;br /&gt;
angularParams[:sortorder] = @sortorder&lt;br /&gt;
angularParams[:user_id] = session[:user].id&lt;br /&gt;
angularParams[:nodeType] = 'FolderNode'&lt;br /&gt;
@angularParamsJSON = angularParams.to_json&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then the view passes to AngularJS&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;div ng-controller='TreeCtrl'&amp;gt;&lt;br /&gt;
&amp;lt;div ng-init=&amp;quot;init('&amp;lt;%= @angularParamsJSON %&amp;gt;')&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
AngularJS handles it, after all basic elements are loaded onto the page. Then AngularJS initializes a POST request for retrieving more data to populate the table.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$scope.init = (value) -&amp;gt;&lt;br /&gt;
    $scope.angularParams = JSON.parse(value)&lt;br /&gt;
    $http.post('/tree_display/get_children_node_ng', {&lt;br /&gt;
      &amp;quot;angularParams&amp;quot;: $scope.angularParams&lt;br /&gt;
      })&lt;br /&gt;
    .success((data) -&amp;gt;&lt;br /&gt;
      $scope.tableContent = {}&lt;br /&gt;
      $scope.displayTableContent = {}&lt;br /&gt;
      $scope.lastLoadNum = {}&lt;br /&gt;
      $scope.typeList = []&lt;br /&gt;
      console.log data&lt;br /&gt;
      for nodeType, outerNode of data&lt;br /&gt;
        $scope.tableContent[nodeType] = []&lt;br /&gt;
        $scope.lastLoadNum[nodeType] = 0&lt;br /&gt;
        $scope.displayTableContent[nodeType] = []&lt;br /&gt;
        $scope.typeList.push nodeType&lt;br /&gt;
        # outerNode is the Assignments/Courses/Questionnaires&lt;br /&gt;
        for node in outerNode&lt;br /&gt;
          $scope.tableContent[nodeType].push node&lt;br /&gt;
          $scope.fetchCellContent(nodeType, node)&lt;br /&gt;
        $scope.getMoreContent(nodeType, 1)&lt;br /&gt;
      )&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Fetch table cell content recursively and put them into a hash&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$scope.fetchCellContent = (nodeType, node) -&amp;gt;&lt;br /&gt;
    $scope.newParams = {}&lt;br /&gt;
    $scope.newParams[&amp;quot;sortvar&amp;quot;] = $scope.angularParams[&amp;quot;sortvar&amp;quot;]&lt;br /&gt;
    $scope.newParams[&amp;quot;sortorder&amp;quot;] = $scope.angularParams[&amp;quot;sortorder&amp;quot;]&lt;br /&gt;
    $scope.newParams[&amp;quot;search&amp;quot;] = $scope.angularParams[&amp;quot;search&amp;quot;]&lt;br /&gt;
    $scope.newParams[&amp;quot;show&amp;quot;] = $scope.angularParams[&amp;quot;show&amp;quot;]&lt;br /&gt;
    $scope.newParams[&amp;quot;user_id&amp;quot;] = $scope.angularParams[&amp;quot;user_id&amp;quot;]&lt;br /&gt;
    key = node.name + &amp;quot;|&amp;quot; + node.directory&lt;br /&gt;
    $scope.newParams[&amp;quot;key&amp;quot;] = key&lt;br /&gt;
    # console.log key&lt;br /&gt;
    if nodeType == 'Assignments'&lt;br /&gt;
      $scope.newParams[&amp;quot;nodeType&amp;quot;] = 'AssignmentNode'&lt;br /&gt;
    else if nodeType == 'Courses'&lt;br /&gt;
      $scope.newParams[&amp;quot;nodeType&amp;quot;] = 'CourseNode'&lt;br /&gt;
    else if nodeType == 'Questionnaires'&lt;br /&gt;
      $scope.newParams[&amp;quot;nodeType&amp;quot;] = 'FolderNode'&lt;br /&gt;
    else&lt;br /&gt;
      $scope.newParams[&amp;quot;nodeType&amp;quot;] = nodeType&lt;br /&gt;
&lt;br /&gt;
    $scope.newParams[&amp;quot;child_nodes&amp;quot;] = node.nodeinfo&lt;br /&gt;
    $http.post('/tree_display/get_children_node_2_ng', {&lt;br /&gt;
      &amp;quot;angularParams&amp;quot;: $scope.newParams&lt;br /&gt;
      })&lt;br /&gt;
    .success((data) -&amp;gt;&lt;br /&gt;
      if data.length &amp;gt; 0&lt;br /&gt;
        for newNode in data&lt;br /&gt;
          if not $scope.allData[newNode.key]&lt;br /&gt;
            $scope.allData[newNode.key] = []&lt;br /&gt;
          $scope.display[newNode.key] = false&lt;br /&gt;
          $scope.allData[newNode.key].push newNode&lt;br /&gt;
          $scope.fetchCellContent(newNode.type, newNode)&lt;br /&gt;
&lt;br /&gt;
      )&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After all data is fetched, the Rails view is able to presenting them onto the page!&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;tbody ng-repeat=&amp;quot;record in displayTableContent['Courses'] | filter:searchText | orderBy:predicate:reverse&amp;quot;&amp;gt;&lt;br /&gt;
          &amp;lt;tr ng-click=&amp;quot;showCellContent(record.name, record.directory)&amp;quot; class=&amp;quot;clickable-row&amp;quot;&amp;gt;&lt;br /&gt;
            &amp;lt;td&amp;gt;{{record.name}}&amp;lt;/td&amp;gt;&lt;br /&gt;
            &amp;lt;td&amp;gt;{{record.directory}}&amp;lt;/td&amp;gt;&lt;br /&gt;
            &amp;lt;td&amp;gt;{{record.creation_date}}&amp;lt;/td&amp;gt;&lt;br /&gt;
            &amp;lt;td&amp;gt;{{record.updated_date}}&amp;lt;/td&amp;gt;&lt;br /&gt;
            &amp;lt;td&amp;gt;&lt;br /&gt;
              &lt;br /&gt;
            &amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
          &amp;lt;/tr&amp;gt;&lt;br /&gt;
          &amp;lt;tr class=&amp;quot;no-cursor-tr no-color-tr&amp;quot; ng-if=&amp;quot;display[record.name+'|'+record.directory] &amp;amp;&amp;amp; allData[record.name+'|'+record.directory]&amp;quot;&amp;gt;&lt;br /&gt;
          &amp;lt;td colspan=&amp;quot;3&amp;quot;&amp;gt;&lt;br /&gt;
            &amp;lt;table class=&amp;quot;normal-table table table-bordered table-striped compact-table&amp;quot; ng-repeat=&amp;quot;cell in cellContent&amp;quot;&amp;gt;&lt;br /&gt;
              &amp;lt;tbody&amp;gt;&lt;br /&gt;
                &amp;lt;tr class=&amp;quot;no-cursor-tr no-color-tr&amp;quot;&amp;gt;&lt;br /&gt;
                  &amp;lt;td&amp;gt;&amp;lt;b&amp;gt;Name&amp;lt;/b&amp;gt;: {{cell.name}}&amp;lt;/td&amp;gt;&lt;br /&gt;
                &amp;lt;/tr&amp;gt;&lt;br /&gt;
                &amp;lt;tr class=&amp;quot;no-cursor-tr no-color-tr&amp;quot;&amp;gt;&lt;br /&gt;
                  &amp;lt;td&amp;gt;&amp;lt;b&amp;gt;Directory&amp;lt;/b&amp;gt;: {{cell.directory}}&amp;lt;/td&amp;gt;&lt;br /&gt;
                &amp;lt;/tr&amp;gt;&lt;br /&gt;
                &amp;lt;tr class=&amp;quot;no-cursor-tr no-color-tr&amp;quot;&amp;gt;&lt;br /&gt;
                  &amp;lt;td&amp;gt;&amp;lt;b&amp;gt;Creation Date&amp;lt;/b&amp;gt;: {{cell.creation_date}}&amp;lt;/td&amp;gt;&lt;br /&gt;
                &amp;lt;/tr&amp;gt;&lt;br /&gt;
                &amp;lt;tr class=&amp;quot;no-cursor-tr no-color-tr&amp;quot;&amp;gt;&lt;br /&gt;
                  &amp;lt;td&amp;gt;&amp;lt;b&amp;gt;Modified Date&amp;lt;/b&amp;gt;: {{cell.updated_date}}&amp;lt;/td&amp;gt;&lt;br /&gt;
                &amp;lt;/tr&amp;gt;&lt;br /&gt;
              &amp;lt;/tbody&amp;gt;&lt;br /&gt;
            &amp;lt;/table&amp;gt;&lt;br /&gt;
          &amp;lt;/td&amp;gt;&lt;br /&gt;
          &amp;lt;/tr&amp;gt;&lt;br /&gt;
        &amp;lt;/tbody&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Manage Users page ==&lt;br /&gt;
users&lt;/div&gt;</summary>
		<author><name>Pdeng</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015_E1526&amp;diff=97032</id>
		<title>CSC/ECE 517 Spring 2015 E1526</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015_E1526&amp;diff=97032"/>
		<updated>2015-05-03T15:44:11Z</updated>

		<summary type="html">&lt;p&gt;Pdeng: /* Manage-course page */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;font size=&amp;quot;5&amp;quot;&amp;gt;&amp;lt;b&amp;gt;E1526. Responsive web design for Expertiza&amp;lt;/b&amp;gt;&amp;lt;/font&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
= Strategy =&lt;br /&gt;
&lt;br /&gt;
We analyzed the three Expertiza pages that we need to modify for this project, as well as all of their dependencies, and tried to identify all the tasks that we need to complete for this project. It became clear to us that a large majority of this project will be based on AngularJS, while the small fraction will be related to Bootstrap. Therefore, our strategy was to jumpstart this project by having all 4 team members work together on adding AngularJS to the Login page. Once the Login page was completed, we split in two groups. One group worked on implementing AngularJS on Manage-course page, while the other group worked on introducing AngularJS to Manage-User page.&lt;br /&gt;
The reasoning behind this strategy was that all of us working together on the Login page first allowed us to obtain some basic understanding of AngularJS and feel more comfortable using this impressively useful and powerful framework. We completed AngularJS constituents first by connecting some of the Rails controllers to AngularJS controllers and then, as a final step, we add Bootstrap. Our decision was based on the fact that Bootstrap does not require much work to be completed and it can be considered to be a pretty straight-forward element of the project.&lt;br /&gt;
&lt;br /&gt;
= Integration =&lt;br /&gt;
This section represent the cornerstone of this project. It consciously explains how Angular and Rails can be integrated into a powerful system capable of providing solid control over both the backend and frontend development of your application.&lt;br /&gt;
&lt;br /&gt;
== Steps to interconnect Rails and AngularJS ==&lt;br /&gt;
&lt;br /&gt;
These guidelines assume that you have a Rails project in place and that you are intending to add AngularJS to it now. Please follow the steps bellow:&lt;br /&gt;
&lt;br /&gt;
1. In the Gemfile, ADD gem ‘bower-rails’ AND gem ‘angular-rails-templates’, then REMOVE ‘gem turbolinks'&lt;br /&gt;
&lt;br /&gt;
2. run &amp;lt;pre&amp;gt; bundle install&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3. Create a Bowerfile. It is used by AngularJS and it can be thought of as the Gemfile that Rails uses.&lt;br /&gt;
&lt;br /&gt;
4. In the Bowerfile, ADD asset ‘angular’ , asset ‘bootstrap-sass-official’, asset ‘angular-route’ AND asset ‘angular-boostrap’(for ui.bootstrap injection)&lt;br /&gt;
&lt;br /&gt;
5. run &amp;lt;pre&amp;gt; rake bower:install &amp;lt;/pre&amp;gt;. Bower installs dependencies in vender/assets/bower_components.&lt;br /&gt;
&lt;br /&gt;
6.  ADD the following content to the config/application.rb&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 config.assets.paths &amp;lt;&amp;lt; Rails.root.join(&amp;quot;vendor&amp;quot;,&amp;quot;assets&amp;quot;,&amp;quot;bower_components&amp;quot;)&lt;br /&gt;
 &lt;br /&gt;
config.assets.paths &amp;lt;&amp;lt; Rails.root.join(&amp;quot;vendor&amp;quot;,&amp;quot;assets&amp;quot;,&amp;quot;bower_components&amp;quot;,&amp;quot;bootstrap-sass-official&amp;quot;,&amp;quot;assets&amp;quot;,&amp;quot;fonts&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
config.assets.precompile &amp;lt;&amp;lt; %r(.*.(?:eot|svg|ttf|woff|woff2)$) &lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
7. REMOVE //= require turbolinks AND ADD &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//= require angular/angular&lt;br /&gt;
//= require angular-route/angular-route&lt;br /&gt;
//= require angular-rails-templates&lt;br /&gt;
//= require angular-bootstrap &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
to assets/javascripts/application.js&lt;br /&gt;
&lt;br /&gt;
8. Rename assets/stylesheets/application.css to assets/stylesheets/application.css.scss. &lt;br /&gt;
&lt;br /&gt;
9. ADD &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
@import &amp;quot;bootstrap-sass-official/assets/stylesheets/bootstrap-sprockets&amp;quot;; and&lt;br /&gt;
@import &amp;quot;bootstrap-sass-official/assets/stylesheets/bootstrap&amp;quot;; &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
to application.css.scss&lt;br /&gt;
&lt;br /&gt;
Since we are did not get to build a new website using AngularJS from scratch, it was a good idea to retain the routing system of Rails rather than implement it in AngularJS.&lt;br /&gt;
So, we added a new tag &amp;lt;code&amp;gt; div ng-app='MPApp'&amp;lt;/code&amp;gt; into the app/views/layout/application.html.erb to include all pages into the scope of our AngularJS app, named ‘MPApp’.&lt;br /&gt;
Then, for the home page app/views/content_pages/view.html.erb, we added a tag to make this page controlled by ‘testCtrl’, which was defined in app.coffee.&lt;br /&gt;
&lt;br /&gt;
== AngularJS's point of view ==&lt;br /&gt;
&lt;br /&gt;
1. Retrieving data from database&lt;br /&gt;
Because it is not appropriate to let AngularJS to directly fetch data from the MySQL database, the only way we could load data was through a Rails controller. For example, it is possible to do a http get/post request(GET /users/fetch_10_users) from AngularJS controller using $http injection or jQuery AJAX, which calls a new method ‘def fetch_10_users’ in the users_controller, which execute some database query via accessing methods in the user model, and returns json formatted data to the AngularJS controller. After getting the returning data, the AngularJS controller can present the data to the screen.&lt;br /&gt;
&lt;br /&gt;
2. Build custom directives&lt;br /&gt;
Instead of using the original Rails page, we decided to replace some forms and components using AngularJS directives, which enabled us to do some live modifications to the pages without loading.&lt;br /&gt;
&lt;br /&gt;
== Rails' point of view ==&lt;br /&gt;
The initial problem was how to provide entries from the database to AngularJS. We decided to create methods in Rails controller which will listen to the incoming AngulaJS and use a select statement to fetch a couple of entries from the database. These entries are then stored in a hash, converted to json and passed to AngularJS controller. AngularJS will then send another query request to Rails for the next set of entries. This strategy greatly reduces the loading time, making the time needed for representing the page kept at the minimum.&lt;br /&gt;
&lt;br /&gt;
=The specifics=&lt;br /&gt;
This section explains the very detailed actions and their results related to the 3 specific pages that were used to integrate AngularJS. Numerous snapshots are provided with the goal to make our approach very clear.&lt;br /&gt;
&lt;br /&gt;
== Login Page and Navigation Bar ==&lt;br /&gt;
Login procedure:&lt;br /&gt;
‘Login’ button clicked → auth_controller#login → auth_controller#after_login(user) → if user.role != ‘student’ → tree_display#drill → tree_display#list&amp;lt;br/&amp;gt;&lt;br /&gt;
If session[:menu] is defined, that is, when a user is logging in, the page will render the content of variable session[:menu].&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;ul class=&amp;quot;nav navbar-nav&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;% if session[:menu] %&amp;gt;&lt;br /&gt;
       &amp;lt;%= render :partial =&amp;gt; 'menu_items/suckerfish',&lt;br /&gt;
          :locals =&amp;gt; { items: session[:menu].get_menu(0), level: 0 } %&amp;gt;&lt;br /&gt;
     &amp;lt;% end %&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul class=&amp;quot;nav navbar-nav&amp;quot;&amp;gt;&lt;br /&gt;
   &amp;lt;% if session[:menu] %&amp;gt;&lt;br /&gt;
      &amp;lt;%= render :partial =&amp;gt; 'menu_items/suckerfish',&lt;br /&gt;
         :locals =&amp;gt; { items: session[:menu].get_menu(0), level: 0 } %&amp;gt;&lt;br /&gt;
  &amp;lt;% end %&amp;gt;&lt;br /&gt;
 &amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For each menu item in the nav bar, it is a dropdown menu now. For different level of dropdown menu, we apply different CSS style to it.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;% level += 1 %&amp;gt;&lt;br /&gt;
&amp;lt;% items.each do |item_id|&lt;br /&gt;
  item = session[:menu].get_item(item_id)&lt;br /&gt;
  selected = session[:menu].selected?(item.id)&lt;br /&gt;
  long_name = item.name.split(/\W/).collect{|word| word.capitalize}.join(' ')&lt;br /&gt;
%&amp;gt;&lt;br /&gt;
&amp;lt;% if level == 1 %&amp;gt;&lt;br /&gt;
&amp;lt;li class=&amp;quot;dropdown first-level&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;% elsif level == 2 %&amp;gt;&lt;br /&gt;
&amp;lt;li class=&amp;quot;dropdown-submenu&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;% else %&amp;gt;&lt;br /&gt;
&amp;lt;li class=&amp;quot;dropdown&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;% end %&amp;gt;&lt;br /&gt;
  &amp;lt;a href=&amp;lt;%= URI.encode(&amp;quot;/menu/#{item.name}&amp;quot;) %&amp;gt;&lt;br /&gt;
  &amp;lt;%= if item.children&lt;br /&gt;
        ' class=&amp;quot;daddy&amp;quot;'&lt;br /&gt;
      end %&amp;gt;title='&amp;lt;%= long_name %&amp;gt;'&amp;gt;&amp;lt;%= item.label.html_safe %&amp;gt;&amp;lt;/a&amp;gt;&lt;br /&gt;
    &amp;lt;% if item.children -%&amp;gt;&lt;br /&gt;
    &amp;lt;% if level == 1 %&amp;gt;&lt;br /&gt;
    &amp;lt;ul class=&amp;quot;dropdown-menu multi-level&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;%= render :partial =&amp;gt; 'menu_items/suckerfish', :locals =&amp;gt; {:items =&amp;gt; item.children, :level =&amp;gt; level} %&amp;gt;&lt;br /&gt;
    &amp;lt;/ul&amp;gt;&lt;br /&gt;
    &amp;lt;% else %&amp;gt;&lt;br /&gt;
    &amp;lt;ul class=&amp;quot;dropdown-menu&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;%= render :partial =&amp;gt; 'menu_items/suckerfish', :locals =&amp;gt; {:items =&amp;gt; item.children, :level =&amp;gt; level} %&amp;gt;&lt;br /&gt;
      &amp;lt;/ul&amp;gt;&lt;br /&gt;
    &amp;lt;% end %&amp;gt;&lt;br /&gt;
    &amp;lt;% end -%&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;% end -%&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Please also refer to app/assets/application.css.scss for further details.&lt;br /&gt;
&lt;br /&gt;
== Manage-course page ==&lt;br /&gt;
After logging in, only the table frame is loaded into the page by rails. Then AngularJS takes over in the background and populate the content into the table. After all first-level content is populated into the table, in this case, all courses info belongs to the first level and their assignment is the second-level content.&lt;br /&gt;
&lt;br /&gt;
After all first level content is loaded into the table, the Angular controller starts to initialize POST request for second level content.&lt;br /&gt;
&lt;br /&gt;
In all, rendering the tree_display page is divided into 3 steps: &amp;lt;br&amp;gt;&lt;br /&gt;
1. render the table frame,  &amp;lt;br&amp;gt;&lt;br /&gt;
2. render the first level table content. &amp;lt;br&amp;gt;&lt;br /&gt;
3. fetch deeper level data. &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the past, these 3 steps are done before rendering the page, which takes about 10-20 seconds. But now, it takes only 2-3 seconds to finish the first 2 steps, and 2 more seconds for the 3rd step.&lt;br /&gt;
&lt;br /&gt;
Moreover, the sorting and table record filtering is integrated into the table. No redirecting or re-rendering is needed for sorting or filtering, which was needed in the past.&lt;br /&gt;
&lt;br /&gt;
'''Code details'''&lt;br /&gt;
Pass Rails controller params to view in tree_display_controller#list&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
angularParams = {}&lt;br /&gt;
angularParams[:search] = @search&lt;br /&gt;
angularParams[:show] = @show&lt;br /&gt;
angularParams[:child_nodes] = @child_nodes&lt;br /&gt;
angularParams[:sortvar] = @sortvar&lt;br /&gt;
angularParams[:sortorder] = @sortorder&lt;br /&gt;
angularParams[:user_id] = session[:user].id&lt;br /&gt;
angularParams[:nodeType] = 'FolderNode'&lt;br /&gt;
@angularParamsJSON = angularParams.to_json&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then the view passes to AngularJS&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;div ng-controller='TreeCtrl'&amp;gt;&lt;br /&gt;
&amp;lt;div ng-init=&amp;quot;init('&amp;lt;%= @angularParamsJSON %&amp;gt;')&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
AngularJS handles it, after all basic elements are loaded onto the page. Then AngularJS initializes a POST request for retrieving more data to populate the table.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$scope.init = (value) -&amp;gt;&lt;br /&gt;
    $scope.angularParams = JSON.parse(value)&lt;br /&gt;
    $http.post('/tree_display/get_children_node_ng', {&lt;br /&gt;
      &amp;quot;angularParams&amp;quot;: $scope.angularParams&lt;br /&gt;
      })&lt;br /&gt;
    .success((data) -&amp;gt;&lt;br /&gt;
      $scope.tableContent = {}&lt;br /&gt;
      $scope.displayTableContent = {}&lt;br /&gt;
      $scope.lastLoadNum = {}&lt;br /&gt;
      $scope.typeList = []&lt;br /&gt;
      console.log data&lt;br /&gt;
      for nodeType, outerNode of data&lt;br /&gt;
        $scope.tableContent[nodeType] = []&lt;br /&gt;
        $scope.lastLoadNum[nodeType] = 0&lt;br /&gt;
        $scope.displayTableContent[nodeType] = []&lt;br /&gt;
        $scope.typeList.push nodeType&lt;br /&gt;
        # outerNode is the Assignments/Courses/Questionnaires&lt;br /&gt;
        for node in outerNode&lt;br /&gt;
          $scope.tableContent[nodeType].push node&lt;br /&gt;
          $scope.fetchCellContent(nodeType, node)&lt;br /&gt;
        $scope.getMoreContent(nodeType, 1)&lt;br /&gt;
      )&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Fetch table cell content recursively and put them into a hash&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$scope.fetchCellContent = (nodeType, node) -&amp;gt;&lt;br /&gt;
    $scope.newParams = {}&lt;br /&gt;
    $scope.newParams[&amp;quot;sortvar&amp;quot;] = $scope.angularParams[&amp;quot;sortvar&amp;quot;]&lt;br /&gt;
    $scope.newParams[&amp;quot;sortorder&amp;quot;] = $scope.angularParams[&amp;quot;sortorder&amp;quot;]&lt;br /&gt;
    $scope.newParams[&amp;quot;search&amp;quot;] = $scope.angularParams[&amp;quot;search&amp;quot;]&lt;br /&gt;
    $scope.newParams[&amp;quot;show&amp;quot;] = $scope.angularParams[&amp;quot;show&amp;quot;]&lt;br /&gt;
    $scope.newParams[&amp;quot;user_id&amp;quot;] = $scope.angularParams[&amp;quot;user_id&amp;quot;]&lt;br /&gt;
    key = node.name + &amp;quot;|&amp;quot; + node.directory&lt;br /&gt;
    $scope.newParams[&amp;quot;key&amp;quot;] = key&lt;br /&gt;
    # console.log key&lt;br /&gt;
    if nodeType == 'Assignments'&lt;br /&gt;
      $scope.newParams[&amp;quot;nodeType&amp;quot;] = 'AssignmentNode'&lt;br /&gt;
    else if nodeType == 'Courses'&lt;br /&gt;
      $scope.newParams[&amp;quot;nodeType&amp;quot;] = 'CourseNode'&lt;br /&gt;
    else if nodeType == 'Questionnaires'&lt;br /&gt;
      $scope.newParams[&amp;quot;nodeType&amp;quot;] = 'FolderNode'&lt;br /&gt;
    else&lt;br /&gt;
      $scope.newParams[&amp;quot;nodeType&amp;quot;] = nodeType&lt;br /&gt;
&lt;br /&gt;
    $scope.newParams[&amp;quot;child_nodes&amp;quot;] = node.nodeinfo&lt;br /&gt;
    $http.post('/tree_display/get_children_node_2_ng', {&lt;br /&gt;
      &amp;quot;angularParams&amp;quot;: $scope.newParams&lt;br /&gt;
      })&lt;br /&gt;
    .success((data) -&amp;gt;&lt;br /&gt;
      if data.length &amp;gt; 0&lt;br /&gt;
        for newNode in data&lt;br /&gt;
          if not $scope.allData[newNode.key]&lt;br /&gt;
            $scope.allData[newNode.key] = []&lt;br /&gt;
          $scope.display[newNode.key] = false&lt;br /&gt;
          $scope.allData[newNode.key].push newNode&lt;br /&gt;
          $scope.fetchCellContent(newNode.type, newNode)&lt;br /&gt;
&lt;br /&gt;
      )&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After all data is fetched, the Rails view is able to presenting them onto the page!&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;tbody ng-repeat=&amp;quot;record in displayTableContent['Courses'] | filter:searchText | orderBy:predicate:reverse&amp;quot;&amp;gt;&lt;br /&gt;
          &amp;lt;tr ng-click=&amp;quot;showCellContent(record.name, record.directory)&amp;quot; class=&amp;quot;clickable-row&amp;quot;&amp;gt;&lt;br /&gt;
            &amp;lt;td&amp;gt;{{record.name}}&amp;lt;/td&amp;gt;&lt;br /&gt;
            &amp;lt;td&amp;gt;{{record.directory}}&amp;lt;/td&amp;gt;&lt;br /&gt;
            &amp;lt;td&amp;gt;{{record.creation_date}}&amp;lt;/td&amp;gt;&lt;br /&gt;
            &amp;lt;td&amp;gt;{{record.updated_date}}&amp;lt;/td&amp;gt;&lt;br /&gt;
            &amp;lt;td&amp;gt;&lt;br /&gt;
              &lt;br /&gt;
            &amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
          &amp;lt;/tr&amp;gt;&lt;br /&gt;
          &amp;lt;tr class=&amp;quot;no-cursor-tr no-color-tr&amp;quot; ng-if=&amp;quot;display[record.name+'|'+record.directory] &amp;amp;&amp;amp; allData[record.name+'|'+record.directory]&amp;quot;&amp;gt;&lt;br /&gt;
          &amp;lt;td colspan=&amp;quot;3&amp;quot;&amp;gt;&lt;br /&gt;
            &amp;lt;table class=&amp;quot;normal-table table table-bordered table-striped compact-table&amp;quot; ng-repeat=&amp;quot;cell in cellContent&amp;quot;&amp;gt;&lt;br /&gt;
              &amp;lt;tbody&amp;gt;&lt;br /&gt;
                &amp;lt;tr class=&amp;quot;no-cursor-tr no-color-tr&amp;quot;&amp;gt;&lt;br /&gt;
                  &amp;lt;td&amp;gt;&amp;lt;b&amp;gt;Name&amp;lt;/b&amp;gt;: {{cell.name}}&amp;lt;/td&amp;gt;&lt;br /&gt;
                &amp;lt;/tr&amp;gt;&lt;br /&gt;
                &amp;lt;tr class=&amp;quot;no-cursor-tr no-color-tr&amp;quot;&amp;gt;&lt;br /&gt;
                  &amp;lt;td&amp;gt;&amp;lt;b&amp;gt;Directory&amp;lt;/b&amp;gt;: {{cell.directory}}&amp;lt;/td&amp;gt;&lt;br /&gt;
                &amp;lt;/tr&amp;gt;&lt;br /&gt;
                &amp;lt;tr class=&amp;quot;no-cursor-tr no-color-tr&amp;quot;&amp;gt;&lt;br /&gt;
                  &amp;lt;td&amp;gt;&amp;lt;b&amp;gt;Creation Date&amp;lt;/b&amp;gt;: {{cell.creation_date}}&amp;lt;/td&amp;gt;&lt;br /&gt;
                &amp;lt;/tr&amp;gt;&lt;br /&gt;
                &amp;lt;tr class=&amp;quot;no-cursor-tr no-color-tr&amp;quot;&amp;gt;&lt;br /&gt;
                  &amp;lt;td&amp;gt;&amp;lt;b&amp;gt;Modified Date&amp;lt;/b&amp;gt;: {{cell.updated_date}}&amp;lt;/td&amp;gt;&lt;br /&gt;
                &amp;lt;/tr&amp;gt;&lt;br /&gt;
              &amp;lt;/tbody&amp;gt;&lt;br /&gt;
            &amp;lt;/table&amp;gt;&lt;br /&gt;
          &amp;lt;/td&amp;gt;&lt;br /&gt;
          &amp;lt;/tr&amp;gt;&lt;br /&gt;
        &amp;lt;/tbody&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Manage Users page ==&lt;br /&gt;
users&lt;/div&gt;</summary>
		<author><name>Pdeng</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015_E1526&amp;diff=97031</id>
		<title>CSC/ECE 517 Spring 2015 E1526</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015_E1526&amp;diff=97031"/>
		<updated>2015-05-03T15:43:43Z</updated>

		<summary type="html">&lt;p&gt;Pdeng: /* Manage-course page */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;font size=&amp;quot;5&amp;quot;&amp;gt;&amp;lt;b&amp;gt;E1526. Responsive web design for Expertiza&amp;lt;/b&amp;gt;&amp;lt;/font&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
= Strategy =&lt;br /&gt;
&lt;br /&gt;
We analyzed the three Expertiza pages that we need to modify for this project, as well as all of their dependencies, and tried to identify all the tasks that we need to complete for this project. It became clear to us that a large majority of this project will be based on AngularJS, while the small fraction will be related to Bootstrap. Therefore, our strategy was to jumpstart this project by having all 4 team members work together on adding AngularJS to the Login page. Once the Login page was completed, we split in two groups. One group worked on implementing AngularJS on Manage-course page, while the other group worked on introducing AngularJS to Manage-User page.&lt;br /&gt;
The reasoning behind this strategy was that all of us working together on the Login page first allowed us to obtain some basic understanding of AngularJS and feel more comfortable using this impressively useful and powerful framework. We completed AngularJS constituents first by connecting some of the Rails controllers to AngularJS controllers and then, as a final step, we add Bootstrap. Our decision was based on the fact that Bootstrap does not require much work to be completed and it can be considered to be a pretty straight-forward element of the project.&lt;br /&gt;
&lt;br /&gt;
= Integration =&lt;br /&gt;
This section represent the cornerstone of this project. It consciously explains how Angular and Rails can be integrated into a powerful system capable of providing solid control over both the backend and frontend development of your application.&lt;br /&gt;
&lt;br /&gt;
== Steps to interconnect Rails and AngularJS ==&lt;br /&gt;
&lt;br /&gt;
These guidelines assume that you have a Rails project in place and that you are intending to add AngularJS to it now. Please follow the steps bellow:&lt;br /&gt;
&lt;br /&gt;
1. In the Gemfile, ADD gem ‘bower-rails’ AND gem ‘angular-rails-templates’, then REMOVE ‘gem turbolinks'&lt;br /&gt;
&lt;br /&gt;
2. run &amp;lt;pre&amp;gt; bundle install&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3. Create a Bowerfile. It is used by AngularJS and it can be thought of as the Gemfile that Rails uses.&lt;br /&gt;
&lt;br /&gt;
4. In the Bowerfile, ADD asset ‘angular’ , asset ‘bootstrap-sass-official’, asset ‘angular-route’ AND asset ‘angular-boostrap’(for ui.bootstrap injection)&lt;br /&gt;
&lt;br /&gt;
5. run &amp;lt;pre&amp;gt; rake bower:install &amp;lt;/pre&amp;gt;. Bower installs dependencies in vender/assets/bower_components.&lt;br /&gt;
&lt;br /&gt;
6.  ADD the following content to the config/application.rb&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 config.assets.paths &amp;lt;&amp;lt; Rails.root.join(&amp;quot;vendor&amp;quot;,&amp;quot;assets&amp;quot;,&amp;quot;bower_components&amp;quot;)&lt;br /&gt;
 &lt;br /&gt;
config.assets.paths &amp;lt;&amp;lt; Rails.root.join(&amp;quot;vendor&amp;quot;,&amp;quot;assets&amp;quot;,&amp;quot;bower_components&amp;quot;,&amp;quot;bootstrap-sass-official&amp;quot;,&amp;quot;assets&amp;quot;,&amp;quot;fonts&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
config.assets.precompile &amp;lt;&amp;lt; %r(.*.(?:eot|svg|ttf|woff|woff2)$) &lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
7. REMOVE //= require turbolinks AND ADD &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//= require angular/angular&lt;br /&gt;
//= require angular-route/angular-route&lt;br /&gt;
//= require angular-rails-templates&lt;br /&gt;
//= require angular-bootstrap &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
to assets/javascripts/application.js&lt;br /&gt;
&lt;br /&gt;
8. Rename assets/stylesheets/application.css to assets/stylesheets/application.css.scss. &lt;br /&gt;
&lt;br /&gt;
9. ADD &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
@import &amp;quot;bootstrap-sass-official/assets/stylesheets/bootstrap-sprockets&amp;quot;; and&lt;br /&gt;
@import &amp;quot;bootstrap-sass-official/assets/stylesheets/bootstrap&amp;quot;; &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
to application.css.scss&lt;br /&gt;
&lt;br /&gt;
Since we are did not get to build a new website using AngularJS from scratch, it was a good idea to retain the routing system of Rails rather than implement it in AngularJS.&lt;br /&gt;
So, we added a new tag &amp;lt;code&amp;gt; div ng-app='MPApp'&amp;lt;/code&amp;gt; into the app/views/layout/application.html.erb to include all pages into the scope of our AngularJS app, named ‘MPApp’.&lt;br /&gt;
Then, for the home page app/views/content_pages/view.html.erb, we added a tag to make this page controlled by ‘testCtrl’, which was defined in app.coffee.&lt;br /&gt;
&lt;br /&gt;
== AngularJS's point of view ==&lt;br /&gt;
&lt;br /&gt;
1. Retrieving data from database&lt;br /&gt;
Because it is not appropriate to let AngularJS to directly fetch data from the MySQL database, the only way we could load data was through a Rails controller. For example, it is possible to do a http get/post request(GET /users/fetch_10_users) from AngularJS controller using $http injection or jQuery AJAX, which calls a new method ‘def fetch_10_users’ in the users_controller, which execute some database query via accessing methods in the user model, and returns json formatted data to the AngularJS controller. After getting the returning data, the AngularJS controller can present the data to the screen.&lt;br /&gt;
&lt;br /&gt;
2. Build custom directives&lt;br /&gt;
Instead of using the original Rails page, we decided to replace some forms and components using AngularJS directives, which enabled us to do some live modifications to the pages without loading.&lt;br /&gt;
&lt;br /&gt;
== Rails' point of view ==&lt;br /&gt;
The initial problem was how to provide entries from the database to AngularJS. We decided to create methods in Rails controller which will listen to the incoming AngulaJS and use a select statement to fetch a couple of entries from the database. These entries are then stored in a hash, converted to json and passed to AngularJS controller. AngularJS will then send another query request to Rails for the next set of entries. This strategy greatly reduces the loading time, making the time needed for representing the page kept at the minimum.&lt;br /&gt;
&lt;br /&gt;
=The specifics=&lt;br /&gt;
This section explains the very detailed actions and their results related to the 3 specific pages that were used to integrate AngularJS. Numerous snapshots are provided with the goal to make our approach very clear.&lt;br /&gt;
&lt;br /&gt;
== Login Page and Navigation Bar ==&lt;br /&gt;
Login procedure:&lt;br /&gt;
‘Login’ button clicked → auth_controller#login → auth_controller#after_login(user) → if user.role != ‘student’ → tree_display#drill → tree_display#list&amp;lt;br/&amp;gt;&lt;br /&gt;
If session[:menu] is defined, that is, when a user is logging in, the page will render the content of variable session[:menu].&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;ul class=&amp;quot;nav navbar-nav&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;% if session[:menu] %&amp;gt;&lt;br /&gt;
       &amp;lt;%= render :partial =&amp;gt; 'menu_items/suckerfish',&lt;br /&gt;
          :locals =&amp;gt; { items: session[:menu].get_menu(0), level: 0 } %&amp;gt;&lt;br /&gt;
     &amp;lt;% end %&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul class=&amp;quot;nav navbar-nav&amp;quot;&amp;gt;&lt;br /&gt;
   &amp;lt;% if session[:menu] %&amp;gt;&lt;br /&gt;
      &amp;lt;%= render :partial =&amp;gt; 'menu_items/suckerfish',&lt;br /&gt;
         :locals =&amp;gt; { items: session[:menu].get_menu(0), level: 0 } %&amp;gt;&lt;br /&gt;
  &amp;lt;% end %&amp;gt;&lt;br /&gt;
 &amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For each menu item in the nav bar, it is a dropdown menu now. For different level of dropdown menu, we apply different CSS style to it.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;% level += 1 %&amp;gt;&lt;br /&gt;
&amp;lt;% items.each do |item_id|&lt;br /&gt;
  item = session[:menu].get_item(item_id)&lt;br /&gt;
  selected = session[:menu].selected?(item.id)&lt;br /&gt;
  long_name = item.name.split(/\W/).collect{|word| word.capitalize}.join(' ')&lt;br /&gt;
%&amp;gt;&lt;br /&gt;
&amp;lt;% if level == 1 %&amp;gt;&lt;br /&gt;
&amp;lt;li class=&amp;quot;dropdown first-level&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;% elsif level == 2 %&amp;gt;&lt;br /&gt;
&amp;lt;li class=&amp;quot;dropdown-submenu&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;% else %&amp;gt;&lt;br /&gt;
&amp;lt;li class=&amp;quot;dropdown&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;% end %&amp;gt;&lt;br /&gt;
  &amp;lt;a href=&amp;lt;%= URI.encode(&amp;quot;/menu/#{item.name}&amp;quot;) %&amp;gt;&lt;br /&gt;
  &amp;lt;%= if item.children&lt;br /&gt;
        ' class=&amp;quot;daddy&amp;quot;'&lt;br /&gt;
      end %&amp;gt;title='&amp;lt;%= long_name %&amp;gt;'&amp;gt;&amp;lt;%= item.label.html_safe %&amp;gt;&amp;lt;/a&amp;gt;&lt;br /&gt;
    &amp;lt;% if item.children -%&amp;gt;&lt;br /&gt;
    &amp;lt;% if level == 1 %&amp;gt;&lt;br /&gt;
    &amp;lt;ul class=&amp;quot;dropdown-menu multi-level&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;%= render :partial =&amp;gt; 'menu_items/suckerfish', :locals =&amp;gt; {:items =&amp;gt; item.children, :level =&amp;gt; level} %&amp;gt;&lt;br /&gt;
    &amp;lt;/ul&amp;gt;&lt;br /&gt;
    &amp;lt;% else %&amp;gt;&lt;br /&gt;
    &amp;lt;ul class=&amp;quot;dropdown-menu&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;%= render :partial =&amp;gt; 'menu_items/suckerfish', :locals =&amp;gt; {:items =&amp;gt; item.children, :level =&amp;gt; level} %&amp;gt;&lt;br /&gt;
      &amp;lt;/ul&amp;gt;&lt;br /&gt;
    &amp;lt;% end %&amp;gt;&lt;br /&gt;
    &amp;lt;% end -%&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;% end -%&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Please also refer to app/assets/application.css.scss for further details.&lt;br /&gt;
&lt;br /&gt;
== Manage-course page ==&lt;br /&gt;
After logging in, only the table frame is loaded into the page by rails. Then AngularJS takes over in the background and populate the content into the table. After all first-level content is populated into the table, in this case, all courses info belongs to the first level and their assignment is the second-level content.&lt;br /&gt;
&lt;br /&gt;
After all first level content is loaded into the table, the Angular controller starts to initialize POST request for second level content.&lt;br /&gt;
&lt;br /&gt;
In all, rendering the tree_display page is divided into 3 steps: &amp;lt;br&amp;gt;&lt;br /&gt;
1. render the table frame,  &amp;lt;br&amp;gt;&lt;br /&gt;
2. render the first level table content. &amp;lt;br&amp;gt;&lt;br /&gt;
3. fetch deeper level data. &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the past, these 3 steps are done before rendering the page, which takes about 10-20 seconds. But now, it takes only 2-3 seconds to finish the first 2 steps, and 2 more seconds for the 3rd step.&lt;br /&gt;
&lt;br /&gt;
Moreover, the sorting and table record filtering is integrated into the table. No redirecting or re-rendering is needed for sorting or filtering, which was needed in the past.&lt;br /&gt;
&lt;br /&gt;
Pass Rails controller params to view in tree_display_controller#list&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
angularParams = {}&lt;br /&gt;
angularParams[:search] = @search&lt;br /&gt;
angularParams[:show] = @show&lt;br /&gt;
angularParams[:child_nodes] = @child_nodes&lt;br /&gt;
angularParams[:sortvar] = @sortvar&lt;br /&gt;
angularParams[:sortorder] = @sortorder&lt;br /&gt;
angularParams[:user_id] = session[:user].id&lt;br /&gt;
angularParams[:nodeType] = 'FolderNode'&lt;br /&gt;
@angularParamsJSON = angularParams.to_json&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then the view passes to AngularJS&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;div ng-controller='TreeCtrl'&amp;gt;&lt;br /&gt;
&amp;lt;div ng-init=&amp;quot;init('&amp;lt;%= @angularParamsJSON %&amp;gt;')&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
AngularJS handles it, after all basic elements are loaded onto the page. Then AngularJS initializes a POST request for retrieving more data to populate the table.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$scope.init = (value) -&amp;gt;&lt;br /&gt;
    $scope.angularParams = JSON.parse(value)&lt;br /&gt;
    $http.post('/tree_display/get_children_node_ng', {&lt;br /&gt;
      &amp;quot;angularParams&amp;quot;: $scope.angularParams&lt;br /&gt;
      })&lt;br /&gt;
    .success((data) -&amp;gt;&lt;br /&gt;
      $scope.tableContent = {}&lt;br /&gt;
      $scope.displayTableContent = {}&lt;br /&gt;
      $scope.lastLoadNum = {}&lt;br /&gt;
      $scope.typeList = []&lt;br /&gt;
      console.log data&lt;br /&gt;
      for nodeType, outerNode of data&lt;br /&gt;
        $scope.tableContent[nodeType] = []&lt;br /&gt;
        $scope.lastLoadNum[nodeType] = 0&lt;br /&gt;
        $scope.displayTableContent[nodeType] = []&lt;br /&gt;
        $scope.typeList.push nodeType&lt;br /&gt;
        # outerNode is the Assignments/Courses/Questionnaires&lt;br /&gt;
        for node in outerNode&lt;br /&gt;
          $scope.tableContent[nodeType].push node&lt;br /&gt;
          $scope.fetchCellContent(nodeType, node)&lt;br /&gt;
        $scope.getMoreContent(nodeType, 1)&lt;br /&gt;
      )&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Fetch table cell content recursively and put them into a hash&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$scope.fetchCellContent = (nodeType, node) -&amp;gt;&lt;br /&gt;
    $scope.newParams = {}&lt;br /&gt;
    $scope.newParams[&amp;quot;sortvar&amp;quot;] = $scope.angularParams[&amp;quot;sortvar&amp;quot;]&lt;br /&gt;
    $scope.newParams[&amp;quot;sortorder&amp;quot;] = $scope.angularParams[&amp;quot;sortorder&amp;quot;]&lt;br /&gt;
    $scope.newParams[&amp;quot;search&amp;quot;] = $scope.angularParams[&amp;quot;search&amp;quot;]&lt;br /&gt;
    $scope.newParams[&amp;quot;show&amp;quot;] = $scope.angularParams[&amp;quot;show&amp;quot;]&lt;br /&gt;
    $scope.newParams[&amp;quot;user_id&amp;quot;] = $scope.angularParams[&amp;quot;user_id&amp;quot;]&lt;br /&gt;
    key = node.name + &amp;quot;|&amp;quot; + node.directory&lt;br /&gt;
    $scope.newParams[&amp;quot;key&amp;quot;] = key&lt;br /&gt;
    # console.log key&lt;br /&gt;
    if nodeType == 'Assignments'&lt;br /&gt;
      $scope.newParams[&amp;quot;nodeType&amp;quot;] = 'AssignmentNode'&lt;br /&gt;
    else if nodeType == 'Courses'&lt;br /&gt;
      $scope.newParams[&amp;quot;nodeType&amp;quot;] = 'CourseNode'&lt;br /&gt;
    else if nodeType == 'Questionnaires'&lt;br /&gt;
      $scope.newParams[&amp;quot;nodeType&amp;quot;] = 'FolderNode'&lt;br /&gt;
    else&lt;br /&gt;
      $scope.newParams[&amp;quot;nodeType&amp;quot;] = nodeType&lt;br /&gt;
&lt;br /&gt;
    $scope.newParams[&amp;quot;child_nodes&amp;quot;] = node.nodeinfo&lt;br /&gt;
    $http.post('/tree_display/get_children_node_2_ng', {&lt;br /&gt;
      &amp;quot;angularParams&amp;quot;: $scope.newParams&lt;br /&gt;
      })&lt;br /&gt;
    .success((data) -&amp;gt;&lt;br /&gt;
      if data.length &amp;gt; 0&lt;br /&gt;
        for newNode in data&lt;br /&gt;
          if not $scope.allData[newNode.key]&lt;br /&gt;
            $scope.allData[newNode.key] = []&lt;br /&gt;
          $scope.display[newNode.key] = false&lt;br /&gt;
          $scope.allData[newNode.key].push newNode&lt;br /&gt;
          $scope.fetchCellContent(newNode.type, newNode)&lt;br /&gt;
&lt;br /&gt;
      )&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After all data is fetched, the Rails view is able to presenting them onto the page!&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;tbody ng-repeat=&amp;quot;record in displayTableContent['Courses'] | filter:searchText | orderBy:predicate:reverse&amp;quot;&amp;gt;&lt;br /&gt;
          &amp;lt;tr ng-click=&amp;quot;showCellContent(record.name, record.directory)&amp;quot; class=&amp;quot;clickable-row&amp;quot;&amp;gt;&lt;br /&gt;
            &amp;lt;td&amp;gt;{{record.name}}&amp;lt;/td&amp;gt;&lt;br /&gt;
            &amp;lt;td&amp;gt;{{record.directory}}&amp;lt;/td&amp;gt;&lt;br /&gt;
            &amp;lt;td&amp;gt;{{record.creation_date}}&amp;lt;/td&amp;gt;&lt;br /&gt;
            &amp;lt;td&amp;gt;{{record.updated_date}}&amp;lt;/td&amp;gt;&lt;br /&gt;
            &amp;lt;td&amp;gt;&lt;br /&gt;
              &lt;br /&gt;
            &amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
          &amp;lt;/tr&amp;gt;&lt;br /&gt;
          &amp;lt;tr class=&amp;quot;no-cursor-tr no-color-tr&amp;quot; ng-if=&amp;quot;display[record.name+'|'+record.directory] &amp;amp;&amp;amp; allData[record.name+'|'+record.directory]&amp;quot;&amp;gt;&lt;br /&gt;
          &amp;lt;td colspan=&amp;quot;3&amp;quot;&amp;gt;&lt;br /&gt;
            &amp;lt;table class=&amp;quot;normal-table table table-bordered table-striped compact-table&amp;quot; ng-repeat=&amp;quot;cell in cellContent&amp;quot;&amp;gt;&lt;br /&gt;
              &amp;lt;tbody&amp;gt;&lt;br /&gt;
                &amp;lt;tr class=&amp;quot;no-cursor-tr no-color-tr&amp;quot;&amp;gt;&lt;br /&gt;
                  &amp;lt;td&amp;gt;&amp;lt;b&amp;gt;Name&amp;lt;/b&amp;gt;: {{cell.name}}&amp;lt;/td&amp;gt;&lt;br /&gt;
                &amp;lt;/tr&amp;gt;&lt;br /&gt;
                &amp;lt;tr class=&amp;quot;no-cursor-tr no-color-tr&amp;quot;&amp;gt;&lt;br /&gt;
                  &amp;lt;td&amp;gt;&amp;lt;b&amp;gt;Directory&amp;lt;/b&amp;gt;: {{cell.directory}}&amp;lt;/td&amp;gt;&lt;br /&gt;
                &amp;lt;/tr&amp;gt;&lt;br /&gt;
                &amp;lt;tr class=&amp;quot;no-cursor-tr no-color-tr&amp;quot;&amp;gt;&lt;br /&gt;
                  &amp;lt;td&amp;gt;&amp;lt;b&amp;gt;Creation Date&amp;lt;/b&amp;gt;: {{cell.creation_date}}&amp;lt;/td&amp;gt;&lt;br /&gt;
                &amp;lt;/tr&amp;gt;&lt;br /&gt;
                &amp;lt;tr class=&amp;quot;no-cursor-tr no-color-tr&amp;quot;&amp;gt;&lt;br /&gt;
                  &amp;lt;td&amp;gt;&amp;lt;b&amp;gt;Modified Date&amp;lt;/b&amp;gt;: {{cell.updated_date}}&amp;lt;/td&amp;gt;&lt;br /&gt;
                &amp;lt;/tr&amp;gt;&lt;br /&gt;
              &amp;lt;/tbody&amp;gt;&lt;br /&gt;
            &amp;lt;/table&amp;gt;&lt;br /&gt;
          &amp;lt;/td&amp;gt;&lt;br /&gt;
          &amp;lt;/tr&amp;gt;&lt;br /&gt;
        &amp;lt;/tbody&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Manage Users page ==&lt;br /&gt;
users&lt;/div&gt;</summary>
		<author><name>Pdeng</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015_E1526&amp;diff=97030</id>
		<title>CSC/ECE 517 Spring 2015 E1526</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015_E1526&amp;diff=97030"/>
		<updated>2015-05-03T15:32:00Z</updated>

		<summary type="html">&lt;p&gt;Pdeng: /* Login Page and Navigation Bar */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;font size=&amp;quot;5&amp;quot;&amp;gt;&amp;lt;b&amp;gt;E1526. Responsive web design for Expertiza&amp;lt;/b&amp;gt;&amp;lt;/font&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
= Strategy =&lt;br /&gt;
&lt;br /&gt;
We analyzed the three Expertiza pages that we need to modify for this project, as well as all of their dependencies, and tried to identify all the tasks that we need to complete for this project. It became clear to us that a large majority of this project will be based on AngularJS, while the small fraction will be related to Bootstrap. Therefore, our strategy was to jumpstart this project by having all 4 team members work together on adding AngularJS to the Login page. Once the Login page was completed, we split in two groups. One group worked on implementing AngularJS on Manage-course page, while the other group worked on introducing AngularJS to Manage-User page.&lt;br /&gt;
The reasoning behind this strategy was that all of us working together on the Login page first allowed us to obtain some basic understanding of AngularJS and feel more comfortable using this impressively useful and powerful framework. We completed AngularJS constituents first by connecting some of the Rails controllers to AngularJS controllers and then, as a final step, we add Bootstrap. Our decision was based on the fact that Bootstrap does not require much work to be completed and it can be considered to be a pretty straight-forward element of the project.&lt;br /&gt;
&lt;br /&gt;
= Integration =&lt;br /&gt;
This section represent the cornerstone of this project. It consciously explains how Angular and Rails can be integrated into a powerful system capable of providing solid control over both the backend and frontend development of your application.&lt;br /&gt;
&lt;br /&gt;
== Steps to interconnect Rails and AngularJS ==&lt;br /&gt;
&lt;br /&gt;
These guidelines assume that you have a Rails project in place and that you are intending to add AngularJS to it now. Please follow the steps bellow:&lt;br /&gt;
&lt;br /&gt;
1. In the Gemfile, ADD gem ‘bower-rails’ AND gem ‘angular-rails-templates’, then REMOVE ‘gem turbolinks'&lt;br /&gt;
&lt;br /&gt;
2. run &amp;lt;pre&amp;gt; bundle install&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3. Create a Bowerfile. It is used by AngularJS and it can be thought of as the Gemfile that Rails uses.&lt;br /&gt;
&lt;br /&gt;
4. In the Bowerfile, ADD asset ‘angular’ , asset ‘bootstrap-sass-official’, asset ‘angular-route’ AND asset ‘angular-boostrap’(for ui.bootstrap injection)&lt;br /&gt;
&lt;br /&gt;
5. run &amp;lt;pre&amp;gt; rake bower:install &amp;lt;/pre&amp;gt;. Bower installs dependencies in vender/assets/bower_components.&lt;br /&gt;
&lt;br /&gt;
6.  ADD the following content to the config/application.rb&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 config.assets.paths &amp;lt;&amp;lt; Rails.root.join(&amp;quot;vendor&amp;quot;,&amp;quot;assets&amp;quot;,&amp;quot;bower_components&amp;quot;)&lt;br /&gt;
 &lt;br /&gt;
config.assets.paths &amp;lt;&amp;lt; Rails.root.join(&amp;quot;vendor&amp;quot;,&amp;quot;assets&amp;quot;,&amp;quot;bower_components&amp;quot;,&amp;quot;bootstrap-sass-official&amp;quot;,&amp;quot;assets&amp;quot;,&amp;quot;fonts&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
config.assets.precompile &amp;lt;&amp;lt; %r(.*.(?:eot|svg|ttf|woff|woff2)$) &lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
7. REMOVE //= require turbolinks AND ADD &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//= require angular/angular&lt;br /&gt;
//= require angular-route/angular-route&lt;br /&gt;
//= require angular-rails-templates&lt;br /&gt;
//= require angular-bootstrap &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
to assets/javascripts/application.js&lt;br /&gt;
&lt;br /&gt;
8. Rename assets/stylesheets/application.css to assets/stylesheets/application.css.scss. &lt;br /&gt;
&lt;br /&gt;
9. ADD &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
@import &amp;quot;bootstrap-sass-official/assets/stylesheets/bootstrap-sprockets&amp;quot;; and&lt;br /&gt;
@import &amp;quot;bootstrap-sass-official/assets/stylesheets/bootstrap&amp;quot;; &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
to application.css.scss&lt;br /&gt;
&lt;br /&gt;
Since we are did not get to build a new website using AngularJS from scratch, it was a good idea to retain the routing system of Rails rather than implement it in AngularJS.&lt;br /&gt;
So, we added a new tag &amp;lt;code&amp;gt; div ng-app='MPApp'&amp;lt;/code&amp;gt; into the app/views/layout/application.html.erb to include all pages into the scope of our AngularJS app, named ‘MPApp’.&lt;br /&gt;
Then, for the home page app/views/content_pages/view.html.erb, we added a tag to make this page controlled by ‘testCtrl’, which was defined in app.coffee.&lt;br /&gt;
&lt;br /&gt;
== AngularJS's point of view ==&lt;br /&gt;
&lt;br /&gt;
1. Retrieving data from database&lt;br /&gt;
Because it is not appropriate to let AngularJS to directly fetch data from the MySQL database, the only way we could load data was through a Rails controller. For example, it is possible to do a http get/post request(GET /users/fetch_10_users) from AngularJS controller using $http injection or jQuery AJAX, which calls a new method ‘def fetch_10_users’ in the users_controller, which execute some database query via accessing methods in the user model, and returns json formatted data to the AngularJS controller. After getting the returning data, the AngularJS controller can present the data to the screen.&lt;br /&gt;
&lt;br /&gt;
2. Build custom directives&lt;br /&gt;
Instead of using the original Rails page, we decided to replace some forms and components using AngularJS directives, which enabled us to do some live modifications to the pages without loading.&lt;br /&gt;
&lt;br /&gt;
== Rails' point of view ==&lt;br /&gt;
The initial problem was how to provide entries from the database to AngularJS. We decided to create methods in Rails controller which will listen to the incoming AngulaJS and use a select statement to fetch a couple of entries from the database. These entries are then stored in a hash, converted to json and passed to AngularJS controller. AngularJS will then send another query request to Rails for the next set of entries. This strategy greatly reduces the loading time, making the time needed for representing the page kept at the minimum.&lt;br /&gt;
&lt;br /&gt;
=The specifics=&lt;br /&gt;
This section explains the very detailed actions and their results related to the 3 specific pages that were used to integrate AngularJS. Numerous snapshots are provided with the goal to make our approach very clear.&lt;br /&gt;
&lt;br /&gt;
== Login Page and Navigation Bar ==&lt;br /&gt;
Login procedure:&lt;br /&gt;
‘Login’ button clicked → auth_controller#login → auth_controller#after_login(user) → if user.role != ‘student’ → tree_display#drill → tree_display#list&amp;lt;br/&amp;gt;&lt;br /&gt;
If session[:menu] is defined, that is, when a user is logging in, the page will render the content of variable session[:menu].&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;ul class=&amp;quot;nav navbar-nav&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;% if session[:menu] %&amp;gt;&lt;br /&gt;
       &amp;lt;%= render :partial =&amp;gt; 'menu_items/suckerfish',&lt;br /&gt;
          :locals =&amp;gt; { items: session[:menu].get_menu(0), level: 0 } %&amp;gt;&lt;br /&gt;
     &amp;lt;% end %&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul class=&amp;quot;nav navbar-nav&amp;quot;&amp;gt;&lt;br /&gt;
   &amp;lt;% if session[:menu] %&amp;gt;&lt;br /&gt;
      &amp;lt;%= render :partial =&amp;gt; 'menu_items/suckerfish',&lt;br /&gt;
         :locals =&amp;gt; { items: session[:menu].get_menu(0), level: 0 } %&amp;gt;&lt;br /&gt;
  &amp;lt;% end %&amp;gt;&lt;br /&gt;
 &amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For each menu item in the nav bar, it is a dropdown menu now. For different level of dropdown menu, we apply different CSS style to it.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;% level += 1 %&amp;gt;&lt;br /&gt;
&amp;lt;% items.each do |item_id|&lt;br /&gt;
  item = session[:menu].get_item(item_id)&lt;br /&gt;
  selected = session[:menu].selected?(item.id)&lt;br /&gt;
  long_name = item.name.split(/\W/).collect{|word| word.capitalize}.join(' ')&lt;br /&gt;
%&amp;gt;&lt;br /&gt;
&amp;lt;% if level == 1 %&amp;gt;&lt;br /&gt;
&amp;lt;li class=&amp;quot;dropdown first-level&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;% elsif level == 2 %&amp;gt;&lt;br /&gt;
&amp;lt;li class=&amp;quot;dropdown-submenu&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;% else %&amp;gt;&lt;br /&gt;
&amp;lt;li class=&amp;quot;dropdown&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;% end %&amp;gt;&lt;br /&gt;
  &amp;lt;a href=&amp;lt;%= URI.encode(&amp;quot;/menu/#{item.name}&amp;quot;) %&amp;gt;&lt;br /&gt;
  &amp;lt;%= if item.children&lt;br /&gt;
        ' class=&amp;quot;daddy&amp;quot;'&lt;br /&gt;
      end %&amp;gt;title='&amp;lt;%= long_name %&amp;gt;'&amp;gt;&amp;lt;%= item.label.html_safe %&amp;gt;&amp;lt;/a&amp;gt;&lt;br /&gt;
    &amp;lt;% if item.children -%&amp;gt;&lt;br /&gt;
    &amp;lt;% if level == 1 %&amp;gt;&lt;br /&gt;
    &amp;lt;ul class=&amp;quot;dropdown-menu multi-level&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;%= render :partial =&amp;gt; 'menu_items/suckerfish', :locals =&amp;gt; {:items =&amp;gt; item.children, :level =&amp;gt; level} %&amp;gt;&lt;br /&gt;
    &amp;lt;/ul&amp;gt;&lt;br /&gt;
    &amp;lt;% else %&amp;gt;&lt;br /&gt;
    &amp;lt;ul class=&amp;quot;dropdown-menu&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;%= render :partial =&amp;gt; 'menu_items/suckerfish', :locals =&amp;gt; {:items =&amp;gt; item.children, :level =&amp;gt; level} %&amp;gt;&lt;br /&gt;
      &amp;lt;/ul&amp;gt;&lt;br /&gt;
    &amp;lt;% end %&amp;gt;&lt;br /&gt;
    &amp;lt;% end -%&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;% end -%&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Please also refer to app/assets/application.css.scss for further details.&lt;br /&gt;
&lt;br /&gt;
== Manage-course page ==&lt;br /&gt;
courses&lt;br /&gt;
== Manage Users page ==&lt;br /&gt;
users&lt;/div&gt;</summary>
		<author><name>Pdeng</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015_E1526&amp;diff=97029</id>
		<title>CSC/ECE 517 Spring 2015 E1526</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015_E1526&amp;diff=97029"/>
		<updated>2015-05-03T15:29:23Z</updated>

		<summary type="html">&lt;p&gt;Pdeng: /* Login Page */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;font size=&amp;quot;5&amp;quot;&amp;gt;&amp;lt;b&amp;gt;E1526. Responsive web design for Expertiza&amp;lt;/b&amp;gt;&amp;lt;/font&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
= Strategy =&lt;br /&gt;
&lt;br /&gt;
We analyzed the three Expertiza pages that we need to modify for this project, as well as all of their dependencies, and tried to identify all the tasks that we need to complete for this project. It became clear to us that a large majority of this project will be based on AngularJS, while the small fraction will be related to Bootstrap. Therefore, our strategy was to jumpstart this project by having all 4 team members work together on adding AngularJS to the Login page. Once the Login page was completed, we split in two groups. One group worked on implementing AngularJS on Manage-course page, while the other group worked on introducing AngularJS to Manage-User page.&lt;br /&gt;
The reasoning behind this strategy was that all of us working together on the Login page first allowed us to obtain some basic understanding of AngularJS and feel more comfortable using this impressively useful and powerful framework. We completed AngularJS constituents first by connecting some of the Rails controllers to AngularJS controllers and then, as a final step, we add Bootstrap. Our decision was based on the fact that Bootstrap does not require much work to be completed and it can be considered to be a pretty straight-forward element of the project.&lt;br /&gt;
&lt;br /&gt;
= Integration =&lt;br /&gt;
This section represent the cornerstone of this project. It consciously explains how Angular and Rails can be integrated into a powerful system capable of providing solid control over both the backend and frontend development of your application.&lt;br /&gt;
&lt;br /&gt;
== Steps to interconnect Rails and AngularJS ==&lt;br /&gt;
&lt;br /&gt;
These guidelines assume that you have a Rails project in place and that you are intending to add AngularJS to it now. Please follow the steps bellow:&lt;br /&gt;
&lt;br /&gt;
1. In the Gemfile, ADD gem ‘bower-rails’ AND gem ‘angular-rails-templates’, then REMOVE ‘gem turbolinks'&lt;br /&gt;
&lt;br /&gt;
2. run &amp;lt;pre&amp;gt; bundle install&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3. Create a Bowerfile. It is used by AngularJS and it can be thought of as the Gemfile that Rails uses.&lt;br /&gt;
&lt;br /&gt;
4. In the Bowerfile, ADD asset ‘angular’ , asset ‘bootstrap-sass-official’, asset ‘angular-route’ AND asset ‘angular-boostrap’(for ui.bootstrap injection)&lt;br /&gt;
&lt;br /&gt;
5. run &amp;lt;pre&amp;gt; rake bower:install &amp;lt;/pre&amp;gt;. Bower installs dependencies in vender/assets/bower_components.&lt;br /&gt;
&lt;br /&gt;
6.  ADD the following content to the config/application.rb&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 config.assets.paths &amp;lt;&amp;lt; Rails.root.join(&amp;quot;vendor&amp;quot;,&amp;quot;assets&amp;quot;,&amp;quot;bower_components&amp;quot;)&lt;br /&gt;
 &lt;br /&gt;
config.assets.paths &amp;lt;&amp;lt; Rails.root.join(&amp;quot;vendor&amp;quot;,&amp;quot;assets&amp;quot;,&amp;quot;bower_components&amp;quot;,&amp;quot;bootstrap-sass-official&amp;quot;,&amp;quot;assets&amp;quot;,&amp;quot;fonts&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
config.assets.precompile &amp;lt;&amp;lt; %r(.*.(?:eot|svg|ttf|woff|woff2)$) &lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
7. REMOVE //= require turbolinks AND ADD &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//= require angular/angular&lt;br /&gt;
//= require angular-route/angular-route&lt;br /&gt;
//= require angular-rails-templates&lt;br /&gt;
//= require angular-bootstrap &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
to assets/javascripts/application.js&lt;br /&gt;
&lt;br /&gt;
8. Rename assets/stylesheets/application.css to assets/stylesheets/application.css.scss. &lt;br /&gt;
&lt;br /&gt;
9. ADD &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
@import &amp;quot;bootstrap-sass-official/assets/stylesheets/bootstrap-sprockets&amp;quot;; and&lt;br /&gt;
@import &amp;quot;bootstrap-sass-official/assets/stylesheets/bootstrap&amp;quot;; &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
to application.css.scss&lt;br /&gt;
&lt;br /&gt;
Since we are did not get to build a new website using AngularJS from scratch, it was a good idea to retain the routing system of Rails rather than implement it in AngularJS.&lt;br /&gt;
So, we added a new tag &amp;lt;code&amp;gt; div ng-app='MPApp'&amp;lt;/code&amp;gt; into the app/views/layout/application.html.erb to include all pages into the scope of our AngularJS app, named ‘MPApp’.&lt;br /&gt;
Then, for the home page app/views/content_pages/view.html.erb, we added a tag to make this page controlled by ‘testCtrl’, which was defined in app.coffee.&lt;br /&gt;
&lt;br /&gt;
== AngularJS's point of view ==&lt;br /&gt;
&lt;br /&gt;
1. Retrieving data from database&lt;br /&gt;
Because it is not appropriate to let AngularJS to directly fetch data from the MySQL database, the only way we could load data was through a Rails controller. For example, it is possible to do a http get/post request(GET /users/fetch_10_users) from AngularJS controller using $http injection or jQuery AJAX, which calls a new method ‘def fetch_10_users’ in the users_controller, which execute some database query via accessing methods in the user model, and returns json formatted data to the AngularJS controller. After getting the returning data, the AngularJS controller can present the data to the screen.&lt;br /&gt;
&lt;br /&gt;
2. Build custom directives&lt;br /&gt;
Instead of using the original Rails page, we decided to replace some forms and components using AngularJS directives, which enabled us to do some live modifications to the pages without loading.&lt;br /&gt;
&lt;br /&gt;
== Rails' point of view ==&lt;br /&gt;
The initial problem was how to provide entries from the database to AngularJS. We decided to create methods in Rails controller which will listen to the incoming AngulaJS and use a select statement to fetch a couple of entries from the database. These entries are then stored in a hash, converted to json and passed to AngularJS controller. AngularJS will then send another query request to Rails for the next set of entries. This strategy greatly reduces the loading time, making the time needed for representing the page kept at the minimum.&lt;br /&gt;
&lt;br /&gt;
=The specifics=&lt;br /&gt;
This section explains the very detailed actions and their results related to the 3 specific pages that were used to integrate AngularJS. Numerous snapshots are provided with the goal to make our approach very clear.&lt;br /&gt;
&lt;br /&gt;
== Login Page and Navigation Bar ==&lt;br /&gt;
Login procedure:&lt;br /&gt;
‘Login’ button clicked → auth_controller#login → auth_controller#after_login(user) → if user.role != ‘student’ → tree_display#drill → tree_display#list&amp;lt;br/&amp;gt;&lt;br /&gt;
If session[:menu] is defined, that is, when a user is logging in, the page will render the content of variable session[:menu].&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;ul class=&amp;quot;nav navbar-nav&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;% if session[:menu] %&amp;gt;&lt;br /&gt;
       &amp;lt;%= render :partial =&amp;gt; 'menu_items/suckerfish',&lt;br /&gt;
          :locals =&amp;gt; { items: session[:menu].get_menu(0), level: 0 } %&amp;gt;&lt;br /&gt;
     &amp;lt;% end %&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul class=&amp;quot;nav navbar-nav&amp;quot;&amp;gt;&lt;br /&gt;
   &amp;lt;% if session[:menu] %&amp;gt;&lt;br /&gt;
      &amp;lt;%= render :partial =&amp;gt; 'menu_items/suckerfish',&lt;br /&gt;
         :locals =&amp;gt; { items: session[:menu].get_menu(0), level: 0 } %&amp;gt;&lt;br /&gt;
  &amp;lt;% end %&amp;gt;&lt;br /&gt;
 &amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For each menu item in the nav bar, it is a dropdown menu now. For different level of dropdown menu, we apply different CSS style to it.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;% level += 1 %&amp;gt;&lt;br /&gt;
&amp;lt;% items.each do |item_id|&lt;br /&gt;
  item = session[:menu].get_item(item_id)&lt;br /&gt;
  selected = session[:menu].selected?(item.id)&lt;br /&gt;
  long_name = item.name.split(/\W/).collect{|word| word.capitalize}.join(' ')&lt;br /&gt;
%&amp;gt;&lt;br /&gt;
&amp;lt;% if level == 1 %&amp;gt;&lt;br /&gt;
&amp;lt;li class=&amp;quot;dropdown first-level&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;% elsif level == 2 %&amp;gt;&lt;br /&gt;
&amp;lt;li class=&amp;quot;dropdown-submenu&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;% else %&amp;gt;&lt;br /&gt;
&amp;lt;li class=&amp;quot;dropdown&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;% end %&amp;gt;&lt;br /&gt;
  &amp;lt;a href=&amp;lt;%= URI.encode(&amp;quot;/menu/#{item.name}&amp;quot;) %&amp;gt;&lt;br /&gt;
  &amp;lt;%= if item.children&lt;br /&gt;
        ' class=&amp;quot;daddy&amp;quot;'&lt;br /&gt;
      end %&amp;gt;title='&amp;lt;%= long_name %&amp;gt;'&amp;gt;&amp;lt;%= item.label.html_safe %&amp;gt;&amp;lt;/a&amp;gt;&lt;br /&gt;
    &amp;lt;% if item.children -%&amp;gt;&lt;br /&gt;
    &amp;lt;% if level == 1 %&amp;gt;&lt;br /&gt;
    &amp;lt;ul class=&amp;quot;dropdown-menu multi-level&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;%= render :partial =&amp;gt; 'menu_items/suckerfish', :locals =&amp;gt; {:items =&amp;gt; item.children, :level =&amp;gt; level} %&amp;gt;&lt;br /&gt;
    &amp;lt;/ul&amp;gt;&lt;br /&gt;
    &amp;lt;% else %&amp;gt;&lt;br /&gt;
    &amp;lt;ul class=&amp;quot;dropdown-menu&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;%= render :partial =&amp;gt; 'menu_items/suckerfish', :locals =&amp;gt; {:items =&amp;gt; item.children, :level =&amp;gt; level} %&amp;gt;&lt;br /&gt;
      &amp;lt;/ul&amp;gt;&lt;br /&gt;
    &amp;lt;% end %&amp;gt;&lt;br /&gt;
    &amp;lt;% end -%&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;% end -%&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Manage-course page ==&lt;br /&gt;
courses&lt;br /&gt;
== Manage Users page ==&lt;br /&gt;
users&lt;/div&gt;</summary>
		<author><name>Pdeng</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015_E1526&amp;diff=97028</id>
		<title>CSC/ECE 517 Spring 2015 E1526</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015_E1526&amp;diff=97028"/>
		<updated>2015-05-03T14:53:23Z</updated>

		<summary type="html">&lt;p&gt;Pdeng: /* Login Page */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;font size=&amp;quot;5&amp;quot;&amp;gt;&amp;lt;b&amp;gt;E1526. Responsive web design for Expertiza&amp;lt;/b&amp;gt;&amp;lt;/font&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
= Strategy =&lt;br /&gt;
&lt;br /&gt;
We analyzed the three Expertiza pages that we need to modify for this project, as well as all of their dependencies, and tried to identify all the tasks that we need to complete for this project. It became clear to us that a large majority of this project will be based on AngularJS, while the small fraction will be related to Bootstrap. Therefore, our strategy was to jumpstart this project by having all 4 team members work together on adding AngularJS to the Login page. Once the Login page was completed, we split in two groups. One group worked on implementing AngularJS on Manage-course page, while the other group worked on introducing AngularJS to Manage-User page.&lt;br /&gt;
The reasoning behind this strategy was that all of us working together on the Login page first allowed us to obtain some basic understanding of AngularJS and feel more comfortable using this impressively useful and powerful framework. We completed AngularJS constituents first by connecting some of the Rails controllers to AngularJS controllers and then, as a final step, we add Bootstrap. Our decision was based on the fact that Bootstrap does not require much work to be completed and it can be considered to be a pretty straight-forward element of the project.&lt;br /&gt;
&lt;br /&gt;
= Integration =&lt;br /&gt;
This section represent the cornerstone of this project. It consciously explains how Angular and Rails can be integrated into a powerful system capable of providing solid control over both the backend and frontend development of your application.&lt;br /&gt;
&lt;br /&gt;
== Steps to interconnect Rails and AngularJS ==&lt;br /&gt;
&lt;br /&gt;
These guidelines assume that you have a Rails project in place and that you are intending to add AngularJS to it now. Please follow the steps bellow:&lt;br /&gt;
&lt;br /&gt;
1. In the Gemfile, ADD gem ‘bower-rails’ AND gem ‘angular-rails-templates’, then REMOVE ‘gem turbolinks'&lt;br /&gt;
&lt;br /&gt;
2. run &amp;lt;pre&amp;gt; bundle install&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3. Create a Bowerfile. It is used by AngularJS and it can be thought of as the Gemfile that Rails uses.&lt;br /&gt;
&lt;br /&gt;
4. In the Bowerfile, ADD asset ‘angular’ , asset ‘bootstrap-sass-official’, asset ‘angular-route’ AND asset ‘angular-boostrap’(for ui.bootstrap injection)&lt;br /&gt;
&lt;br /&gt;
5. run &amp;lt;pre&amp;gt; rake bower:install &amp;lt;/pre&amp;gt;. Bower installs dependencies in vender/assets/bower_components.&lt;br /&gt;
&lt;br /&gt;
6.  ADD the following content to the config/application.rb&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 config.assets.paths &amp;lt;&amp;lt; Rails.root.join(&amp;quot;vendor&amp;quot;,&amp;quot;assets&amp;quot;,&amp;quot;bower_components&amp;quot;)&lt;br /&gt;
 &lt;br /&gt;
config.assets.paths &amp;lt;&amp;lt; Rails.root.join(&amp;quot;vendor&amp;quot;,&amp;quot;assets&amp;quot;,&amp;quot;bower_components&amp;quot;,&amp;quot;bootstrap-sass-official&amp;quot;,&amp;quot;assets&amp;quot;,&amp;quot;fonts&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
config.assets.precompile &amp;lt;&amp;lt; %r(.*.(?:eot|svg|ttf|woff|woff2)$) &lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
7. REMOVE //= require turbolinks AND ADD &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//= require angular/angular&lt;br /&gt;
//= require angular-route/angular-route&lt;br /&gt;
//= require angular-rails-templates&lt;br /&gt;
//= require angular-bootstrap &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
to assets/javascripts/application.js&lt;br /&gt;
&lt;br /&gt;
8. Rename assets/stylesheets/application.css to assets/stylesheets/application.css.scss. &lt;br /&gt;
&lt;br /&gt;
9. ADD &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
@import &amp;quot;bootstrap-sass-official/assets/stylesheets/bootstrap-sprockets&amp;quot;; and&lt;br /&gt;
@import &amp;quot;bootstrap-sass-official/assets/stylesheets/bootstrap&amp;quot;; &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
to application.css.scss&lt;br /&gt;
&lt;br /&gt;
Since we are did not get to build a new website using AngularJS from scratch, it was a good idea to retain the routing system of Rails rather than implement it in AngularJS.&lt;br /&gt;
So, we added a new tag &amp;lt;code&amp;gt; div ng-app='MPApp'&amp;lt;/code&amp;gt; into the app/views/layout/application.html.erb to include all pages into the scope of our AngularJS app, named ‘MPApp’.&lt;br /&gt;
Then, for the home page app/views/content_pages/view.html.erb, we added a tag to make this page controlled by ‘testCtrl’, which was defined in app.coffee.&lt;br /&gt;
&lt;br /&gt;
== AngularJS's point of view ==&lt;br /&gt;
&lt;br /&gt;
1. Retrieving data from database&lt;br /&gt;
Because it is not appropriate to let AngularJS to directly fetch data from the MySQL database, the only way we could load data was through a Rails controller. For example, it is possible to do a http get/post request(GET /users/fetch_10_users) from AngularJS controller using $http injection or jQuery AJAX, which calls a new method ‘def fetch_10_users’ in the users_controller, which execute some database query via accessing methods in the user model, and returns json formatted data to the AngularJS controller. After getting the returning data, the AngularJS controller can present the data to the screen.&lt;br /&gt;
&lt;br /&gt;
2. Build custom directives&lt;br /&gt;
Instead of using the original Rails page, we decided to replace some forms and components using AngularJS directives, which enabled us to do some live modifications to the pages without loading.&lt;br /&gt;
&lt;br /&gt;
== Rails' point of view ==&lt;br /&gt;
The initial problem was how to provide entries from the database to AngularJS. We decided to create methods in Rails controller which will listen to the incoming AngulaJS and use a select statement to fetch a couple of entries from the database. These entries are then stored in a hash, converted to json and passed to AngularJS controller. AngularJS will then send another query request to Rails for the next set of entries. This strategy greatly reduces the loading time, making the time needed for representing the page kept at the minimum.&lt;br /&gt;
&lt;br /&gt;
=The specifics=&lt;br /&gt;
This section explains the very detailed actions and their results related to the 3 specific pages that were used to integrate AngularJS. Numerous snapshots are provided with the goal to make our approach very clear.&lt;br /&gt;
&lt;br /&gt;
== Login Page ==&lt;br /&gt;
Login procedure:&lt;br /&gt;
‘Login’ button clicked → auth_controller#login → auth_controller#after_login(user) → if user.role != ‘student’ → tree_display#drill → tree_display#list&amp;lt;br/&amp;gt;&lt;br /&gt;
If session[:menu] is defined, that is, when a user is logging in, the page will render the content of variable session[:menu].&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;ul class=&amp;quot;nav navbar-nav&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;% if session[:menu] %&amp;gt;&lt;br /&gt;
          &amp;lt;%= render :partial =&amp;gt; 'menu_items/suckerfish',&lt;br /&gt;
            :locals =&amp;gt; { items: session[:menu].get_menu(0), level: 0 } %&amp;gt;&lt;br /&gt;
        &amp;lt;% end %&amp;gt;&lt;br /&gt;
      &amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Manage-course page ==&lt;br /&gt;
courses&lt;br /&gt;
== Manage Users page ==&lt;br /&gt;
users&lt;/div&gt;</summary>
		<author><name>Pdeng</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015_E1526&amp;diff=97027</id>
		<title>CSC/ECE 517 Spring 2015 E1526</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015_E1526&amp;diff=97027"/>
		<updated>2015-05-03T14:08:39Z</updated>

		<summary type="html">&lt;p&gt;Pdeng: /* Steps to interconnect Rails and AngularJS */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;font size=&amp;quot;5&amp;quot;&amp;gt;&amp;lt;b&amp;gt;E1526. Responsive web design for Expertiza&amp;lt;/b&amp;gt;&amp;lt;/font&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
= Strategy =&lt;br /&gt;
&lt;br /&gt;
We analyzed the three Expertiza pages that we need to modify for this project, as well as all of their dependencies, and tried to identify all the tasks that we need to complete for this project. It became clear to us that a large majority of this project will be based on AngularJS, while the small fraction will be related to Bootstrap. Therefore, our strategy was to jumpstart this project by having all 4 team members work together on adding AngularJS to the Login page. Once the Login page was completed, we split in two groups. One group worked on implementing AngularJS on Manage-course page, while the other group worked on introducing AngularJS to Manage-User page.&lt;br /&gt;
The reasoning behind this strategy was that all of us working together on the Login page first allowed us to obtain some basic understanding of AngularJS and feel more comfortable using this impressively useful and powerful framework. We completed AngularJS constituents first by connecting some of the Rails controllers to AngularJS controllers and then, as a final step, we add Bootstrap. Our decision was based on the fact that Bootstrap does not require much work to be completed and it can be considered to be a pretty straight-forward element of the project.&lt;br /&gt;
&lt;br /&gt;
= Integration =&lt;br /&gt;
This section represent the cornerstone of this project. It consciously explains how Angular and Rails can be integrated into a powerful system capable of providing solid control over both the backend and frontend development of your application.&lt;br /&gt;
&lt;br /&gt;
== Steps to interconnect Rails and AngularJS ==&lt;br /&gt;
&lt;br /&gt;
These guidelines assume that you have a Rails project in place and that you are intending to add AngularJS to it now. Please follow the steps bellow:&lt;br /&gt;
&lt;br /&gt;
1. In the Gemfile, ADD gem ‘bower-rails’ AND gem ‘angular-rails-templates’, then REMOVE ‘gem turbolinks'&lt;br /&gt;
&lt;br /&gt;
2. run &amp;lt;pre&amp;gt; bundle install&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3. Create a Bowerfile. It is used by AngularJS and it can be thought of as the Gemfile that Rails uses.&lt;br /&gt;
&lt;br /&gt;
4. In the Bowerfile, ADD asset ‘angular’ , asset ‘bootstrap-sass-official’, asset ‘angular-route’ AND asset ‘angular-boostrap’(for ui.bootstrap injection)&lt;br /&gt;
&lt;br /&gt;
5. run &amp;lt;pre&amp;gt; rake bower:install &amp;lt;/pre&amp;gt;. Bower installs dependencies in vender/assets/bower_components.&lt;br /&gt;
&lt;br /&gt;
6.  ADD the following content to the config/application.rb&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 config.assets.paths &amp;lt;&amp;lt; Rails.root.join(&amp;quot;vendor&amp;quot;,&amp;quot;assets&amp;quot;,&amp;quot;bower_components&amp;quot;)&lt;br /&gt;
 &lt;br /&gt;
config.assets.paths &amp;lt;&amp;lt; Rails.root.join(&amp;quot;vendor&amp;quot;,&amp;quot;assets&amp;quot;,&amp;quot;bower_components&amp;quot;,&amp;quot;bootstrap-sass-official&amp;quot;,&amp;quot;assets&amp;quot;,&amp;quot;fonts&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
config.assets.precompile &amp;lt;&amp;lt; %r(.*.(?:eot|svg|ttf|woff|woff2)$) &lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
7. REMOVE //= require turbolinks AND ADD &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//= require angular/angular&lt;br /&gt;
//= require angular-route/angular-route&lt;br /&gt;
//= require angular-rails-templates&lt;br /&gt;
//= require angular-bootstrap &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
to assets/javascripts/application.js&lt;br /&gt;
&lt;br /&gt;
8. Rename assets/stylesheets/application.css to assets/stylesheets/application.css.scss. &lt;br /&gt;
&lt;br /&gt;
9. ADD &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
@import &amp;quot;bootstrap-sass-official/assets/stylesheets/bootstrap-sprockets&amp;quot;; and&lt;br /&gt;
@import &amp;quot;bootstrap-sass-official/assets/stylesheets/bootstrap&amp;quot;; &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
to application.css.scss&lt;br /&gt;
&lt;br /&gt;
Since we are did not get to build a new website using AngularJS from scratch, it was a good idea to retain the routing system of Rails rather than implement it in AngularJS.&lt;br /&gt;
So, we added a new tag &amp;lt;code&amp;gt; div ng-app='MPApp'&amp;lt;/code&amp;gt; into the app/views/layout/application.html.erb to include all pages into the scope of our AngularJS app, named ‘MPApp’.&lt;br /&gt;
Then, for the home page app/views/content_pages/view.html.erb, we added a tag to make this page controlled by ‘testCtrl’, which was defined in app.coffee.&lt;br /&gt;
&lt;br /&gt;
== AngularJS's point of view ==&lt;br /&gt;
&lt;br /&gt;
1. Retrieving data from database&lt;br /&gt;
Because it is not appropriate to let AngularJS to directly fetch data from the MySQL database, the only way we could load data was through a Rails controller. For example, it is possible to do a http get/post request(GET /users/fetch_10_users) from AngularJS controller using $http injection or jQuery AJAX, which calls a new method ‘def fetch_10_users’ in the users_controller, which execute some database query via accessing methods in the user model, and returns json formatted data to the AngularJS controller. After getting the returning data, the AngularJS controller can present the data to the screen.&lt;br /&gt;
&lt;br /&gt;
2. Build custom directives&lt;br /&gt;
Instead of using the original Rails page, we decided to replace some forms and components using AngularJS directives, which enabled us to do some live modifications to the pages without loading.&lt;br /&gt;
&lt;br /&gt;
== Rails' point of view ==&lt;br /&gt;
The initial problem was how to provide entries from the database to AngularJS. We decided to create methods in Rails controller which will listen to the incoming AngulaJS and use a select statement to fetch a couple of entries from the database. These entries are then stored in a hash, converted to json and passed to AngularJS controller. AngularJS will then send another query request to Rails for the next set of entries. This strategy greatly reduces the loading time, making the time needed for representing the page kept at the minimum.&lt;br /&gt;
&lt;br /&gt;
=The specifics=&lt;br /&gt;
This section explains the very detailed actions and their results related to the 3 specific pages that were used to integrate AngularJS. Numerous snapshots are provided with the goal to make our approach very clear.&lt;br /&gt;
&lt;br /&gt;
== Login Page ==&lt;br /&gt;
login&lt;br /&gt;
== Manage-course page ==&lt;br /&gt;
courses&lt;br /&gt;
== Manage Users page ==&lt;br /&gt;
users&lt;/div&gt;</summary>
		<author><name>Pdeng</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015_E1526&amp;diff=97026</id>
		<title>CSC/ECE 517 Spring 2015 E1526</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015_E1526&amp;diff=97026"/>
		<updated>2015-05-03T14:06:39Z</updated>

		<summary type="html">&lt;p&gt;Pdeng: /* Steps to interconnect Rails and AngularJS */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;font size=&amp;quot;5&amp;quot;&amp;gt;&amp;lt;b&amp;gt;E1526. Responsive web design for Expertiza&amp;lt;/b&amp;gt;&amp;lt;/font&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
= Strategy =&lt;br /&gt;
&lt;br /&gt;
We analyzed the three Expertiza pages that we need to modify for this project, as well as all of their dependencies, and tried to identify all the tasks that we need to complete for this project. It became clear to us that a large majority of this project will be based on AngularJS, while the small fraction will be related to Bootstrap. Therefore, our strategy was to jumpstart this project by having all 4 team members work together on adding AngularJS to the Login page. Once the Login page was completed, we split in two groups. One group worked on implementing AngularJS on Manage-course page, while the other group worked on introducing AngularJS to Manage-User page.&lt;br /&gt;
The reasoning behind this strategy was that all of us working together on the Login page first allowed us to obtain some basic understanding of AngularJS and feel more comfortable using this impressively useful and powerful framework. We completed AngularJS constituents first by connecting some of the Rails controllers to AngularJS controllers and then, as a final step, we add Bootstrap. Our decision was based on the fact that Bootstrap does not require much work to be completed and it can be considered to be a pretty straight-forward element of the project.&lt;br /&gt;
&lt;br /&gt;
= Integration =&lt;br /&gt;
This section represent the cornerstone of this project. It consciously explains how Angular and Rails can be integrated into a powerful system capable of providing solid control over both the backend and frontend development of your application.&lt;br /&gt;
&lt;br /&gt;
== Steps to interconnect Rails and AngularJS ==&lt;br /&gt;
&lt;br /&gt;
These guidelines assume that you have a Rails project in place and that you are intending to add AngularJS to it now. Please follow the steps bellow:&lt;br /&gt;
&lt;br /&gt;
1. In the Gemfile, ADD gem ‘bower-rails’ AND gem ‘angular-rails-templates’, then REMOVE ‘gem turbolinks'&lt;br /&gt;
&lt;br /&gt;
2. run &amp;lt;pre&amp;gt; bundle install&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3. Create a Bowerfile. It is used by AngularJS and it can be thought of as the Gemfile that Rails uses.&lt;br /&gt;
&lt;br /&gt;
4. In the Bowerfile, ADD asset ‘angular’ , asset ‘bootstrap-sass-official’, asset ‘angular-route’ AND asset ‘angular-boostrap’(for ui.bootstrap injection)&lt;br /&gt;
&lt;br /&gt;
5. run &amp;lt;pre&amp;gt; rake bower:install &amp;lt;/pre&amp;gt;. Bower installs dependencies in vender/assets/bower_components.&lt;br /&gt;
&lt;br /&gt;
6.  ADD the following content to the config/application.rb&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 config.assets.paths &amp;lt;&amp;lt; Rails.root.join(&amp;quot;vendor&amp;quot;,&amp;quot;assets&amp;quot;,&amp;quot;bower_components&amp;quot;)&lt;br /&gt;
 &lt;br /&gt;
config.assets.paths &amp;lt;&amp;lt; Rails.root.join(&amp;quot;vendor&amp;quot;,&amp;quot;assets&amp;quot;,&amp;quot;bower_components&amp;quot;,&amp;quot;bootstrap-sass-official&amp;quot;,&amp;quot;assets&amp;quot;,&amp;quot;fonts&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
config.assets.precompile &amp;lt;&amp;lt; %r(.*.(?:eot|svg|ttf|woff|woff2)$) &lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
7. REMOVE //= require turbolinks AND ADD &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//= require angular/angular&lt;br /&gt;
//= require angular-route/angular-route&lt;br /&gt;
//= require angular-rails-templates&lt;br /&gt;
//= require angular-bootstrap &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
to assets/javascripts/application.js&lt;br /&gt;
&lt;br /&gt;
8. Rename assets/stylesheets/application.css to assets/stylesheets/application.css.scss. &lt;br /&gt;
&lt;br /&gt;
9. ADD &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
@import &amp;quot;bootstrap-sass-official/assets/stylesheets/bootstrap-sprockets&amp;quot;; and&lt;br /&gt;
@import &amp;quot;bootstrap-sass-official/assets/stylesheets/bootstrap&amp;quot;; &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
to application.css.scss&lt;br /&gt;
&lt;br /&gt;
Since we are did not get to build a new website using AngularJS from scratch, it was a good idea to retain the routing system of Rails rather than implement it in AngularJS.&lt;br /&gt;
So, we added a new tag &amp;lt;code&amp;gt;&amp;lt;div ng-app='MPApp'&amp;gt;&amp;lt;/code&amp;gt; into the app/views/layout/application.html.erb to include all pages into the scope of our AngularJS app, named ‘MPApp’.&lt;br /&gt;
Then, for the home page app/views/content_pages/view.html.erb, we added a tag to make this page controlled by ‘testCtrl’, which was defined in app.coffee.&lt;br /&gt;
&lt;br /&gt;
== AngularJS's point of view ==&lt;br /&gt;
&lt;br /&gt;
1. Retrieving data from database&lt;br /&gt;
Because it is not appropriate to let AngularJS to directly fetch data from the MySQL database, the only way we could load data was through a Rails controller. For example, it is possible to do a http get/post request(GET /users/fetch_10_users) from AngularJS controller using $http injection or jQuery AJAX, which calls a new method ‘def fetch_10_users’ in the users_controller, which execute some database query via accessing methods in the user model, and returns json formatted data to the AngularJS controller. After getting the returning data, the AngularJS controller can present the data to the screen.&lt;br /&gt;
&lt;br /&gt;
2. Build custom directives&lt;br /&gt;
Instead of using the original Rails page, we decided to replace some forms and components using AngularJS directives, which enabled us to do some live modifications to the pages without loading.&lt;br /&gt;
&lt;br /&gt;
== Rails' point of view ==&lt;br /&gt;
The initial problem was how to provide entries from the database to AngularJS. We decided to create methods in Rails controller which will listen to the incoming AngulaJS and use a select statement to fetch a couple of entries from the database. These entries are then stored in a hash, converted to json and passed to AngularJS controller. AngularJS will then send another query request to Rails for the next set of entries. This strategy greatly reduces the loading time, making the time needed for representing the page kept at the minimum.&lt;br /&gt;
&lt;br /&gt;
=The specifics=&lt;br /&gt;
This section explains the very detailed actions and their results related to the 3 specific pages that were used to integrate AngularJS. Numerous snapshots are provided with the goal to make our approach very clear.&lt;br /&gt;
&lt;br /&gt;
== Login Page ==&lt;br /&gt;
login&lt;br /&gt;
== Manage-course page ==&lt;br /&gt;
courses&lt;br /&gt;
== Manage Users page ==&lt;br /&gt;
users&lt;/div&gt;</summary>
		<author><name>Pdeng</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015_E1526&amp;diff=97025</id>
		<title>CSC/ECE 517 Spring 2015 E1526</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015_E1526&amp;diff=97025"/>
		<updated>2015-05-03T14:04:26Z</updated>

		<summary type="html">&lt;p&gt;Pdeng: /* Steps to interconnect Rails and AngularJS */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;font size=&amp;quot;5&amp;quot;&amp;gt;&amp;lt;b&amp;gt;E1526. Responsive web design for Expertiza&amp;lt;/b&amp;gt;&amp;lt;/font&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
= Strategy =&lt;br /&gt;
&lt;br /&gt;
We analyzed the three Expertiza pages that we need to modify for this project, as well as all of their dependencies, and tried to identify all the tasks that we need to complete for this project. It became clear to us that a large majority of this project will be based on AngularJS, while the small fraction will be related to Bootstrap. Therefore, our strategy was to jumpstart this project by having all 4 team members work together on adding AngularJS to the Login page. Once the Login page was completed, we split in two groups. One group worked on implementing AngularJS on Manage-course page, while the other group worked on introducing AngularJS to Manage-User page.&lt;br /&gt;
The reasoning behind this strategy was that all of us working together on the Login page first allowed us to obtain some basic understanding of AngularJS and feel more comfortable using this impressively useful and powerful framework. We completed AngularJS constituents first by connecting some of the Rails controllers to AngularJS controllers and then, as a final step, we add Bootstrap. Our decision was based on the fact that Bootstrap does not require much work to be completed and it can be considered to be a pretty straight-forward element of the project.&lt;br /&gt;
&lt;br /&gt;
= Integration =&lt;br /&gt;
This section represent the cornerstone of this project. It consciously explains how Angular and Rails can be integrated into a powerful system capable of providing solid control over both the backend and frontend development of your application.&lt;br /&gt;
&lt;br /&gt;
== Steps to interconnect Rails and AngularJS ==&lt;br /&gt;
&lt;br /&gt;
These guidelines assume that you have a Rails project in place and that you are intending to add AngularJS to it now. Please follow the steps bellow:&lt;br /&gt;
&lt;br /&gt;
1. In the Gemfile, ADD gem ‘bower-rails’ AND gem ‘angular-rails-templates’, then REMOVE ‘gem turbolinks'&lt;br /&gt;
&lt;br /&gt;
2. run &amp;lt;pre&amp;gt; bundle install&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3. Create a Bowerfile. It is used by AngularJS and it can be thought of as the Gemfile that Rails uses.&lt;br /&gt;
&lt;br /&gt;
4. In the Bowerfile, ADD asset ‘angular’ , asset ‘bootstrap-sass-official’, asset ‘angular-route’ AND asset ‘angular-boostrap’(for ui.bootstrap injection)&lt;br /&gt;
&lt;br /&gt;
5. run &amp;lt;pre&amp;gt; rake bower:install &amp;lt;/pre&amp;gt;. Bower installs dependencies in vender/assets/bower_components.&lt;br /&gt;
&lt;br /&gt;
6.  ADD the following content to the config/application.rb&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 config.assets.paths &amp;lt;&amp;lt; Rails.root.join(&amp;quot;vendor&amp;quot;,&amp;quot;assets&amp;quot;,&amp;quot;bower_components&amp;quot;)&lt;br /&gt;
 &lt;br /&gt;
config.assets.paths &amp;lt;&amp;lt; Rails.root.join(&amp;quot;vendor&amp;quot;,&amp;quot;assets&amp;quot;,&amp;quot;bower_components&amp;quot;,&amp;quot;bootstrap-sass-official&amp;quot;,&amp;quot;assets&amp;quot;,&amp;quot;fonts&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
config.assets.precompile &amp;lt;&amp;lt; %r(.*.(?:eot|svg|ttf|woff|woff2)$) &lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
7. REMOVE //= require turbolinks AND ADD &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//= require angular/angular&lt;br /&gt;
//= require angular-route/angular-route&lt;br /&gt;
//= require angular-rails-templates&lt;br /&gt;
//= require angular-bootstrap &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
to assets/javascripts/application.js&lt;br /&gt;
&lt;br /&gt;
8. Rename assets/stylesheets/application.css to assets/stylesheets/application.css.scss. &lt;br /&gt;
&lt;br /&gt;
9. ADD &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
@import &amp;quot;bootstrap-sass-official/assets/stylesheets/bootstrap-sprockets&amp;quot;; and&lt;br /&gt;
@import &amp;quot;bootstrap-sass-official/assets/stylesheets/bootstrap&amp;quot;; &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
to application.css.scss&lt;br /&gt;
&lt;br /&gt;
Since we are did not get to build a new website using AngularJS from scratch, it was a good idea to retain the routing system of Rails rather than implement it in AngularJS.&lt;br /&gt;
So, we added a new tag &amp;lt;div ng-app='MPApp'&amp;gt; into the app/views/layout/application.html.erb to include all pages into the scope of our AngularJS app, named ‘MPApp’.&lt;br /&gt;
Then, for the home page app/views/content_pages/view.html.erb, we added a tag to make this page controlled by ‘testCtrl’, which was defined in app.coffee.&lt;br /&gt;
&lt;br /&gt;
== AngularJS's point of view ==&lt;br /&gt;
&lt;br /&gt;
1. Retrieving data from database&lt;br /&gt;
Because it is not appropriate to let AngularJS to directly fetch data from the MySQL database, the only way we could load data was through a Rails controller. For example, it is possible to do a http get/post request(GET /users/fetch_10_users) from AngularJS controller using $http injection or jQuery AJAX, which calls a new method ‘def fetch_10_users’ in the users_controller, which execute some database query via accessing methods in the user model, and returns json formatted data to the AngularJS controller. After getting the returning data, the AngularJS controller can present the data to the screen.&lt;br /&gt;
&lt;br /&gt;
2. Build custom directives&lt;br /&gt;
Instead of using the original Rails page, we decided to replace some forms and components using AngularJS directives, which enabled us to do some live modifications to the pages without loading.&lt;br /&gt;
&lt;br /&gt;
== Rails' point of view ==&lt;br /&gt;
The initial problem was how to provide entries from the database to AngularJS. We decided to create methods in Rails controller which will listen to the incoming AngulaJS and use a select statement to fetch a couple of entries from the database. These entries are then stored in a hash, converted to json and passed to AngularJS controller. AngularJS will then send another query request to Rails for the next set of entries. This strategy greatly reduces the loading time, making the time needed for representing the page kept at the minimum.&lt;br /&gt;
&lt;br /&gt;
=The specifics=&lt;br /&gt;
This section explains the very detailed actions and their results related to the 3 specific pages that were used to integrate AngularJS. Numerous snapshots are provided with the goal to make our approach very clear.&lt;br /&gt;
&lt;br /&gt;
== Login Page ==&lt;br /&gt;
login&lt;br /&gt;
== Manage-course page ==&lt;br /&gt;
courses&lt;br /&gt;
== Manage Users page ==&lt;br /&gt;
users&lt;/div&gt;</summary>
		<author><name>Pdeng</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015_E1526&amp;diff=97024</id>
		<title>CSC/ECE 517 Spring 2015 E1526</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015_E1526&amp;diff=97024"/>
		<updated>2015-05-03T14:03:59Z</updated>

		<summary type="html">&lt;p&gt;Pdeng: /* Steps to interconnect Rails and AngularJS */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;font size=&amp;quot;5&amp;quot;&amp;gt;&amp;lt;b&amp;gt;E1526. Responsive web design for Expertiza&amp;lt;/b&amp;gt;&amp;lt;/font&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
= Strategy =&lt;br /&gt;
&lt;br /&gt;
We analyzed the three Expertiza pages that we need to modify for this project, as well as all of their dependencies, and tried to identify all the tasks that we need to complete for this project. It became clear to us that a large majority of this project will be based on AngularJS, while the small fraction will be related to Bootstrap. Therefore, our strategy was to jumpstart this project by having all 4 team members work together on adding AngularJS to the Login page. Once the Login page was completed, we split in two groups. One group worked on implementing AngularJS on Manage-course page, while the other group worked on introducing AngularJS to Manage-User page.&lt;br /&gt;
The reasoning behind this strategy was that all of us working together on the Login page first allowed us to obtain some basic understanding of AngularJS and feel more comfortable using this impressively useful and powerful framework. We completed AngularJS constituents first by connecting some of the Rails controllers to AngularJS controllers and then, as a final step, we add Bootstrap. Our decision was based on the fact that Bootstrap does not require much work to be completed and it can be considered to be a pretty straight-forward element of the project.&lt;br /&gt;
&lt;br /&gt;
= Integration =&lt;br /&gt;
This section represent the cornerstone of this project. It consciously explains how Angular and Rails can be integrated into a powerful system capable of providing solid control over both the backend and frontend development of your application.&lt;br /&gt;
&lt;br /&gt;
== Steps to interconnect Rails and AngularJS ==&lt;br /&gt;
&lt;br /&gt;
These guidelines assume that you have a Rails project in place and that you are intending to add AngularJS to it now. Please follow the steps bellow:&lt;br /&gt;
&lt;br /&gt;
1. In the Gemfile, ADD gem ‘bower-rails’ AND gem ‘angular-rails-templates’, then REMOVE ‘gem turbolinks'&lt;br /&gt;
&lt;br /&gt;
2. run &amp;lt;pre&amp;gt; bundle install&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3. Create a Bowerfile. It is used by AngularJS and it can be thought of as the Gemfile that Rails uses.&lt;br /&gt;
&lt;br /&gt;
4. In the Bowerfile, ADD asset ‘angular’ , asset ‘bootstrap-sass-official’, asset ‘angular-route’ AND asset ‘angular-boostrap’(for ui.bootstrap injection)&lt;br /&gt;
&lt;br /&gt;
5. run &amp;lt;pre&amp;gt; rake bower:install &amp;lt;/pre&amp;gt;. Bower installs dependencies in vender/assets/bower_components.&lt;br /&gt;
&lt;br /&gt;
6.  ADD the following content to the config/application.rb&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 config.assets.paths &amp;lt;&amp;lt; Rails.root.join(&amp;quot;vendor&amp;quot;,&amp;quot;assets&amp;quot;,&amp;quot;bower_components&amp;quot;)&lt;br /&gt;
 &lt;br /&gt;
config.assets.paths &amp;lt;&amp;lt; Rails.root.join(&amp;quot;vendor&amp;quot;,&amp;quot;assets&amp;quot;,&amp;quot;bower_components&amp;quot;,&amp;quot;bootstrap-sass-official&amp;quot;,&amp;quot;assets&amp;quot;,&amp;quot;fonts&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
config.assets.precompile &amp;lt;&amp;lt; %r(.*.(?:eot|svg|ttf|woff|woff2)$) &lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
7. REMOVE //= require turbolinks AND ADD &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//= require angular/angular&lt;br /&gt;
//= require angular-route/angular-route&lt;br /&gt;
//= require angular-rails-templates&lt;br /&gt;
//= require angular-bootstrap &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
to assets/javascripts/application.js, &lt;br /&gt;
8. Rename assets/stylesheets/application.css to assets/stylesheets/application.css.scss. &lt;br /&gt;
&lt;br /&gt;
9. ADD &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
@import &amp;quot;bootstrap-sass-official/assets/stylesheets/bootstrap-sprockets&amp;quot;; and&lt;br /&gt;
@import &amp;quot;bootstrap-sass-official/assets/stylesheets/bootstrap&amp;quot;; &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
to application.css.scss&lt;br /&gt;
&lt;br /&gt;
Since we are did not get to build a new website using AngularJS from scratch, it was a good idea to retain the routing system of Rails rather than implement it in AngularJS.&lt;br /&gt;
So, we added a new tag &amp;lt;div ng-app='MPApp'&amp;gt; into the app/views/layout/application.html.erb to include all pages into the scope of our AngularJS app, named ‘MPApp’.&lt;br /&gt;
Then, for the home page app/views/content_pages/view.html.erb, we added a tag to make this page controlled by ‘testCtrl’, which was defined in app.coffee.&lt;br /&gt;
&lt;br /&gt;
== AngularJS's point of view ==&lt;br /&gt;
&lt;br /&gt;
1. Retrieving data from database&lt;br /&gt;
Because it is not appropriate to let AngularJS to directly fetch data from the MySQL database, the only way we could load data was through a Rails controller. For example, it is possible to do a http get/post request(GET /users/fetch_10_users) from AngularJS controller using $http injection or jQuery AJAX, which calls a new method ‘def fetch_10_users’ in the users_controller, which execute some database query via accessing methods in the user model, and returns json formatted data to the AngularJS controller. After getting the returning data, the AngularJS controller can present the data to the screen.&lt;br /&gt;
&lt;br /&gt;
2. Build custom directives&lt;br /&gt;
Instead of using the original Rails page, we decided to replace some forms and components using AngularJS directives, which enabled us to do some live modifications to the pages without loading.&lt;br /&gt;
&lt;br /&gt;
== Rails' point of view ==&lt;br /&gt;
The initial problem was how to provide entries from the database to AngularJS. We decided to create methods in Rails controller which will listen to the incoming AngulaJS and use a select statement to fetch a couple of entries from the database. These entries are then stored in a hash, converted to json and passed to AngularJS controller. AngularJS will then send another query request to Rails for the next set of entries. This strategy greatly reduces the loading time, making the time needed for representing the page kept at the minimum.&lt;br /&gt;
&lt;br /&gt;
=The specifics=&lt;br /&gt;
This section explains the very detailed actions and their results related to the 3 specific pages that were used to integrate AngularJS. Numerous snapshots are provided with the goal to make our approach very clear.&lt;br /&gt;
&lt;br /&gt;
== Login Page ==&lt;br /&gt;
login&lt;br /&gt;
== Manage-course page ==&lt;br /&gt;
courses&lt;br /&gt;
== Manage Users page ==&lt;br /&gt;
users&lt;/div&gt;</summary>
		<author><name>Pdeng</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015_E1526&amp;diff=97023</id>
		<title>CSC/ECE 517 Spring 2015 E1526</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015_E1526&amp;diff=97023"/>
		<updated>2015-05-03T14:03:22Z</updated>

		<summary type="html">&lt;p&gt;Pdeng: /* Steps to interconnect Rails and AngularJS */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;font size=&amp;quot;5&amp;quot;&amp;gt;&amp;lt;b&amp;gt;E1526. Responsive web design for Expertiza&amp;lt;/b&amp;gt;&amp;lt;/font&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
= Strategy =&lt;br /&gt;
&lt;br /&gt;
We analyzed the three Expertiza pages that we need to modify for this project, as well as all of their dependencies, and tried to identify all the tasks that we need to complete for this project. It became clear to us that a large majority of this project will be based on AngularJS, while the small fraction will be related to Bootstrap. Therefore, our strategy was to jumpstart this project by having all 4 team members work together on adding AngularJS to the Login page. Once the Login page was completed, we split in two groups. One group worked on implementing AngularJS on Manage-course page, while the other group worked on introducing AngularJS to Manage-User page.&lt;br /&gt;
The reasoning behind this strategy was that all of us working together on the Login page first allowed us to obtain some basic understanding of AngularJS and feel more comfortable using this impressively useful and powerful framework. We completed AngularJS constituents first by connecting some of the Rails controllers to AngularJS controllers and then, as a final step, we add Bootstrap. Our decision was based on the fact that Bootstrap does not require much work to be completed and it can be considered to be a pretty straight-forward element of the project.&lt;br /&gt;
&lt;br /&gt;
= Integration =&lt;br /&gt;
This section represent the cornerstone of this project. It consciously explains how Angular and Rails can be integrated into a powerful system capable of providing solid control over both the backend and frontend development of your application.&lt;br /&gt;
&lt;br /&gt;
== Steps to interconnect Rails and AngularJS ==&lt;br /&gt;
&lt;br /&gt;
These guidelines assume that you have a Rails project in place and that you are intending to add AngularJS to it now. Please follow the steps bellow:&lt;br /&gt;
&lt;br /&gt;
1. In the Gemfile, ADD gem ‘bower-rails’ AND gem ‘angular-rails-templates’, then REMOVE ‘gem turbolinks'&lt;br /&gt;
&lt;br /&gt;
2. run &amp;lt;pre&amp;gt; bundle install&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3. Create a Bowerfile. It is used by AngularJS and it can be thought of as the Gemfile that Rails uses.&lt;br /&gt;
&lt;br /&gt;
4. In the Bowerfile, ADD asset ‘angular’ , asset ‘bootstrap-sass-official’, asset ‘angular-route’ AND asset ‘angular-boostrap’(for ui.bootstrap injection)&lt;br /&gt;
&lt;br /&gt;
5. run &amp;lt;pre&amp;gt; rake bower:install &amp;lt;/pre&amp;gt;. Bower installs dependencies in vender/assets/bower_components.&lt;br /&gt;
&lt;br /&gt;
6.  ADD&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 config.assets.paths &amp;lt;&amp;lt; Rails.root.join(&amp;quot;vendor&amp;quot;,&amp;quot;assets&amp;quot;,&amp;quot;bower_components&amp;quot;)&lt;br /&gt;
 &lt;br /&gt;
config.assets.paths &amp;lt;&amp;lt; Rails.root.join(&amp;quot;vendor&amp;quot;,&amp;quot;assets&amp;quot;,&amp;quot;bower_components&amp;quot;,&amp;quot;bootstrap-sass-official&amp;quot;,&amp;quot;assets&amp;quot;,&amp;quot;fonts&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
config.assets.precompile &amp;lt;&amp;lt; %r(.*.(?:eot|svg|ttf|woff|woff2)$) &lt;br /&gt;
to the config/application.rb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
7. REMOVE //= require turbolinks AND ADD &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//= require angular/angular&lt;br /&gt;
//= require angular-route/angular-route&lt;br /&gt;
//= require angular-rails-templates&lt;br /&gt;
//= require angular-bootstrap &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
to assets/javascripts/application.js, &lt;br /&gt;
8. Rename assets/stylesheets/application.css to assets/stylesheets/application.css.scss. &lt;br /&gt;
&lt;br /&gt;
9. ADD &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
@import &amp;quot;bootstrap-sass-official/assets/stylesheets/bootstrap-sprockets&amp;quot;; and&lt;br /&gt;
@import &amp;quot;bootstrap-sass-official/assets/stylesheets/bootstrap&amp;quot;; &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
to application.css.scss&lt;br /&gt;
&lt;br /&gt;
Since we are did not get to build a new website using AngularJS from scratch, it was a good idea to retain the routing system of Rails rather than implement it in AngularJS.&lt;br /&gt;
So, we added a new tag &amp;lt;div ng-app='MPApp'&amp;gt; into the app/views/layout/application.html.erb to include all pages into the scope of our AngularJS app, named ‘MPApp’.&lt;br /&gt;
Then, for the home page app/views/content_pages/view.html.erb, we added a tag to make this page controlled by ‘testCtrl’, which was defined in app.coffee.&lt;br /&gt;
&lt;br /&gt;
== AngularJS's point of view ==&lt;br /&gt;
&lt;br /&gt;
1. Retrieving data from database&lt;br /&gt;
Because it is not appropriate to let AngularJS to directly fetch data from the MySQL database, the only way we could load data was through a Rails controller. For example, it is possible to do a http get/post request(GET /users/fetch_10_users) from AngularJS controller using $http injection or jQuery AJAX, which calls a new method ‘def fetch_10_users’ in the users_controller, which execute some database query via accessing methods in the user model, and returns json formatted data to the AngularJS controller. After getting the returning data, the AngularJS controller can present the data to the screen.&lt;br /&gt;
&lt;br /&gt;
2. Build custom directives&lt;br /&gt;
Instead of using the original Rails page, we decided to replace some forms and components using AngularJS directives, which enabled us to do some live modifications to the pages without loading.&lt;br /&gt;
&lt;br /&gt;
== Rails' point of view ==&lt;br /&gt;
The initial problem was how to provide entries from the database to AngularJS. We decided to create methods in Rails controller which will listen to the incoming AngulaJS and use a select statement to fetch a couple of entries from the database. These entries are then stored in a hash, converted to json and passed to AngularJS controller. AngularJS will then send another query request to Rails for the next set of entries. This strategy greatly reduces the loading time, making the time needed for representing the page kept at the minimum.&lt;br /&gt;
&lt;br /&gt;
=The specifics=&lt;br /&gt;
This section explains the very detailed actions and their results related to the 3 specific pages that were used to integrate AngularJS. Numerous snapshots are provided with the goal to make our approach very clear.&lt;br /&gt;
&lt;br /&gt;
== Login Page ==&lt;br /&gt;
login&lt;br /&gt;
== Manage-course page ==&lt;br /&gt;
courses&lt;br /&gt;
== Manage Users page ==&lt;br /&gt;
users&lt;/div&gt;</summary>
		<author><name>Pdeng</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015_E1526&amp;diff=97022</id>
		<title>CSC/ECE 517 Spring 2015 E1526</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015_E1526&amp;diff=97022"/>
		<updated>2015-05-03T14:03:12Z</updated>

		<summary type="html">&lt;p&gt;Pdeng: /* Steps to interconnect Rails and AngularJS */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;font size=&amp;quot;5&amp;quot;&amp;gt;&amp;lt;b&amp;gt;E1526. Responsive web design for Expertiza&amp;lt;/b&amp;gt;&amp;lt;/font&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
= Strategy =&lt;br /&gt;
&lt;br /&gt;
We analyzed the three Expertiza pages that we need to modify for this project, as well as all of their dependencies, and tried to identify all the tasks that we need to complete for this project. It became clear to us that a large majority of this project will be based on AngularJS, while the small fraction will be related to Bootstrap. Therefore, our strategy was to jumpstart this project by having all 4 team members work together on adding AngularJS to the Login page. Once the Login page was completed, we split in two groups. One group worked on implementing AngularJS on Manage-course page, while the other group worked on introducing AngularJS to Manage-User page.&lt;br /&gt;
The reasoning behind this strategy was that all of us working together on the Login page first allowed us to obtain some basic understanding of AngularJS and feel more comfortable using this impressively useful and powerful framework. We completed AngularJS constituents first by connecting some of the Rails controllers to AngularJS controllers and then, as a final step, we add Bootstrap. Our decision was based on the fact that Bootstrap does not require much work to be completed and it can be considered to be a pretty straight-forward element of the project.&lt;br /&gt;
&lt;br /&gt;
= Integration =&lt;br /&gt;
This section represent the cornerstone of this project. It consciously explains how Angular and Rails can be integrated into a powerful system capable of providing solid control over both the backend and frontend development of your application.&lt;br /&gt;
&lt;br /&gt;
== Steps to interconnect Rails and AngularJS ==&lt;br /&gt;
&lt;br /&gt;
These guidelines assume that you have a Rails project in place and that you are intending to add AngularJS to it now. Please follow the steps bellow:&lt;br /&gt;
&lt;br /&gt;
1. In the Gemfile, ADD gem ‘bower-rails’ AND gem ‘angular-rails-templates’, then REMOVE ‘gem turbolinks'&lt;br /&gt;
&lt;br /&gt;
2. run &amp;lt;pre&amp;gt; bundle instal&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3. Create a Bowerfile. It is used by AngularJS and it can be thought of as the Gemfile that Rails uses.&lt;br /&gt;
&lt;br /&gt;
4. In the Bowerfile, ADD asset ‘angular’ , asset ‘bootstrap-sass-official’, asset ‘angular-route’ AND asset ‘angular-boostrap’(for ui.bootstrap injection)&lt;br /&gt;
&lt;br /&gt;
5. run &amp;lt;pre&amp;gt; rake bower:install &amp;lt;/pre&amp;gt;. Bower installs dependencies in vender/assets/bower_components.&lt;br /&gt;
&lt;br /&gt;
6.  ADD&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 config.assets.paths &amp;lt;&amp;lt; Rails.root.join(&amp;quot;vendor&amp;quot;,&amp;quot;assets&amp;quot;,&amp;quot;bower_components&amp;quot;)&lt;br /&gt;
 &lt;br /&gt;
config.assets.paths &amp;lt;&amp;lt; Rails.root.join(&amp;quot;vendor&amp;quot;,&amp;quot;assets&amp;quot;,&amp;quot;bower_components&amp;quot;,&amp;quot;bootstrap-sass-official&amp;quot;,&amp;quot;assets&amp;quot;,&amp;quot;fonts&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
config.assets.precompile &amp;lt;&amp;lt; %r(.*.(?:eot|svg|ttf|woff|woff2)$) &lt;br /&gt;
to the config/application.rb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
7. REMOVE //= require turbolinks AND ADD &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//= require angular/angular&lt;br /&gt;
//= require angular-route/angular-route&lt;br /&gt;
//= require angular-rails-templates&lt;br /&gt;
//= require angular-bootstrap &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
to assets/javascripts/application.js, &lt;br /&gt;
8. Rename assets/stylesheets/application.css to assets/stylesheets/application.css.scss. &lt;br /&gt;
&lt;br /&gt;
9. ADD &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
@import &amp;quot;bootstrap-sass-official/assets/stylesheets/bootstrap-sprockets&amp;quot;; and&lt;br /&gt;
@import &amp;quot;bootstrap-sass-official/assets/stylesheets/bootstrap&amp;quot;; &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
to application.css.scss&lt;br /&gt;
&lt;br /&gt;
Since we are did not get to build a new website using AngularJS from scratch, it was a good idea to retain the routing system of Rails rather than implement it in AngularJS.&lt;br /&gt;
So, we added a new tag &amp;lt;div ng-app='MPApp'&amp;gt; into the app/views/layout/application.html.erb to include all pages into the scope of our AngularJS app, named ‘MPApp’.&lt;br /&gt;
Then, for the home page app/views/content_pages/view.html.erb, we added a tag to make this page controlled by ‘testCtrl’, which was defined in app.coffee.&lt;br /&gt;
&lt;br /&gt;
== AngularJS's point of view ==&lt;br /&gt;
&lt;br /&gt;
1. Retrieving data from database&lt;br /&gt;
Because it is not appropriate to let AngularJS to directly fetch data from the MySQL database, the only way we could load data was through a Rails controller. For example, it is possible to do a http get/post request(GET /users/fetch_10_users) from AngularJS controller using $http injection or jQuery AJAX, which calls a new method ‘def fetch_10_users’ in the users_controller, which execute some database query via accessing methods in the user model, and returns json formatted data to the AngularJS controller. After getting the returning data, the AngularJS controller can present the data to the screen.&lt;br /&gt;
&lt;br /&gt;
2. Build custom directives&lt;br /&gt;
Instead of using the original Rails page, we decided to replace some forms and components using AngularJS directives, which enabled us to do some live modifications to the pages without loading.&lt;br /&gt;
&lt;br /&gt;
== Rails' point of view ==&lt;br /&gt;
The initial problem was how to provide entries from the database to AngularJS. We decided to create methods in Rails controller which will listen to the incoming AngulaJS and use a select statement to fetch a couple of entries from the database. These entries are then stored in a hash, converted to json and passed to AngularJS controller. AngularJS will then send another query request to Rails for the next set of entries. This strategy greatly reduces the loading time, making the time needed for representing the page kept at the minimum.&lt;br /&gt;
&lt;br /&gt;
=The specifics=&lt;br /&gt;
This section explains the very detailed actions and their results related to the 3 specific pages that were used to integrate AngularJS. Numerous snapshots are provided with the goal to make our approach very clear.&lt;br /&gt;
&lt;br /&gt;
== Login Page ==&lt;br /&gt;
login&lt;br /&gt;
== Manage-course page ==&lt;br /&gt;
courses&lt;br /&gt;
== Manage Users page ==&lt;br /&gt;
users&lt;/div&gt;</summary>
		<author><name>Pdeng</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015_E1526_MPRI&amp;diff=96526</id>
		<title>CSC/ECE 517 Spring 2015 E1526 MPRI</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015_E1526_MPRI&amp;diff=96526"/>
		<updated>2015-04-08T17:54:37Z</updated>

		<summary type="html">&lt;p&gt;Pdeng: /* Behavioral Design Patterns */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;font size=&amp;quot;5&amp;quot;&amp;gt;&amp;lt;b&amp;gt;E1526. Responsive web design for Expertiza&amp;lt;/b&amp;gt;&amp;lt;/font&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
= Introduction to Expertiza =&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is a large project developed as a combined effort of students and faculty using the [http://rubyonrails.org/ Ruby on Rails] framework. The main advantage of using Expertiza, in an educational environment, is for the instructor to introduce peer reviewing among the students. Expertiza allows the instructor to create and customize assignments, create a list of topics the students can sign up for, have students work on teams and then review each other's assignments at the end. Expertiza supports submission of almost any document type, including the URLs and wiki pages.&lt;br /&gt;
&lt;br /&gt;
Expertiza is supported by National Science Foundation under Grant No. 0536558. Additional funding from the [http://www.ncsu.edu/ NCSU] [http://litre.ncsu.edu/ Learning in a Technology-Rich Environment] (LITRE) program, the NCSU [http://ofd.ncsu.edu/teaching-learning/ Faculty Center for Teaching and Learning], the NCSU [http://stem.ncsu.edu/ STEM] Initiative, and the Center for Advanced Computing and Communication.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
= Problem Statement =&lt;br /&gt;
&lt;br /&gt;
Despite an amazing set of functionality Expertiza offers, there are numerous parts of it that could use a more stylish look and an improved user experience. The goal of this project is to use both Bootstrap and AngularJS to improve the look of the entire Expertiza including the representations of buttons, tables, and other elements. Certain changes in design will also improve the efficiency of the web app when it comes to the amount of time it takes for a page to be loaded.&lt;br /&gt;
&lt;br /&gt;
= List of Tasks =&lt;br /&gt;
Below are detailed explanations to the tasks listed in the description documentation.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 1. Replace Buttons and Links to Bootstrap styled Buttons ==&lt;br /&gt;
Expertiza, being an extensive web application with numerous features, heavily relies on buttons when it comes to interacting with the user. We plan to improve the user experience by replacing the plain html buttons with stylish bootstrap buttons. However, numerous elements in the current version of Expertiza, like 'Back' element, are hyperlinks rather than buttons. To make the design of Expertiza consistent, our goal is to replace this plain-styled text with color coded Bootstrap buttons.&lt;br /&gt;
&lt;br /&gt;
== 2. Create new theme ==&lt;br /&gt;
One of the entities responsible for the primitive look of Expertiza, as of now, is the lack of fixed navbar. The new design of Expertiza will include the fixed menu bar on the top of the page. Please refer to the screenshot shown below for an example from Virgin American website. As it can be seen on the screenshot, the user has scrolled down the page, but the menu bar is still visible on the top of the page, making it convenient for the user to navigate throughout the website.&lt;br /&gt;
&lt;br /&gt;
[[File:Picture4-2.png]]&lt;br /&gt;
&lt;br /&gt;
== 3. Auto hides contents on the dashboard for instructors ==&lt;br /&gt;
Please refer to the later part of this article: [[#Manage-Course page|Manage-Course page]] for viewing the current design&lt;br /&gt;
&lt;br /&gt;
Now, when trying to open manage-courses, all records are loaded before rendering them onto the page, which takes too long time to load and is not responsive at all.&lt;br /&gt;
&lt;br /&gt;
Better practice is on Virgin American’s website: https://www.virginamerica.com/book/rt/a1/sfo_bos/20150401_20150402&lt;br /&gt;
&lt;br /&gt;
When the website is representing the calendar, the price for each day is not actually loaded. But the skeleton of the page, which is the calendar in this case, can be displayed first.&lt;br /&gt;
&lt;br /&gt;
[[File:Picture5.png]]&lt;br /&gt;
&lt;br /&gt;
So in Expertiza, we can create several buttons for course semesters in the page. After clicking on Fall 2014, the courses for Fall 2014 will come out. &lt;br /&gt;
&lt;br /&gt;
And if the list is still too long and takes a long time load, we can use a ‘show more’ button ,or automatically load more data when the scroll bar reaching the end of the page, to minimize the content we need to load after one single mouse click. &lt;br /&gt;
&lt;br /&gt;
[[File:Picture6.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 4. Simplify Action Panel ==&lt;br /&gt;
We will need to reduce the number of buttons. For example, the first row are actions for assignments and the second row is for participant. So we can replace them to 5 buttons with responsive design, that is, no redirecting happens after clicking on the buttons.&lt;br /&gt;
&lt;br /&gt;
[[File:Picture7.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 5. Offer Better UI for Managing Users ==&lt;br /&gt;
&lt;br /&gt;
Please refer to the later part of this article: [[#Manage-User page|Manage-User page]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 6. Make grades_view Responsive with Better Design ==&lt;br /&gt;
&lt;br /&gt;
Similar to the previous tasks, we will need to make it responsive. &lt;br /&gt;
&lt;br /&gt;
After clicking on ‘Your scores’, all reviews are loaded before rendering the page now. That takes a long time to load and the length of review list is too long.&lt;br /&gt;
&lt;br /&gt;
[[File:Picture8.png]]&lt;br /&gt;
&lt;br /&gt;
=Design Patterns=&lt;br /&gt;
&lt;br /&gt;
As an assignment with a goal of improving the graphic design and responsiveness of Expertiza web application, this project mainly follows design patterns from two design pattern groups: structural and behavioral.&lt;br /&gt;
&lt;br /&gt;
==Structural Design Patterns==&lt;br /&gt;
Flyweight, a design pattern aiming to minimize the memory usage by sharing as much data as possible, is heavily implemented on the css and bootstrap side. Our team leans towards creating classes for styling that can be efficiently reused in a variety of Expertiza sections, rather than separately refining the design of each little section. This will both save us time and keep the code concise, while optimizing the memory needed to store the code.&lt;br /&gt;
&lt;br /&gt;
Another structural design pattern that will be seen in this project is Front Controller pattern. While this pattern suggests that there is a single controller that takes all the requests, when we have both Rails and AngularJS coexisting, we can think of Rails framework as being the &amp;quot;single bridge&amp;quot; to the database from AngularJS's stand point. AngularJS, being an outstanding front-end framework, will interact with the user and pass all the request to Rails framework. Rails framework then queries/updates the database and provides AngularJS with the data.&lt;br /&gt;
&lt;br /&gt;
Finally, the third structural design pattern that this project follows is Module pattern. Modules are one of the essential constructs in the skeleton of AngularJS framework and, hence, this project is bound to follow module pattern.&lt;br /&gt;
[[File:E1526-1.png]]&lt;br /&gt;
&lt;br /&gt;
==Behavioral Design Patterns==&lt;br /&gt;
Since the large part of this project is to iterate through the database query and show the data to the user with a reduced delay, this project follows the well known Iterator pattern.&lt;br /&gt;
&lt;br /&gt;
Along the similar lines, Observer pattern is followed to efficiently handle query requests to a large database (the main culprit behind the unpleasantly long delay). Our project intends to tackle this challenge by fetching only a screen-full of results and showing it to the user right away (fast response). While the user is looking at this first chunk of data displayed on the screen, further queries are made to the database in the background and the rest of the matching results are being returned, efficiently populating the page further. This approach greatly improves the user experience since it does not leave the user waiting empty-handed until Rails framework completes the full query of the database. &amp;lt;br&amp;gt;&lt;br /&gt;
[[File:E1526-2.png]]&lt;br /&gt;
&lt;br /&gt;
= Pages To Be Modified =&lt;br /&gt;
For this project, it is difficult to re-design all webpages and make them responsive. After discussing with the contact person, we will be focusing only on these 3 pages:&lt;br /&gt;
&lt;br /&gt;
=='''Login Page'''==&lt;br /&gt;
[[File:Picture1.png]]&lt;br /&gt;
&lt;br /&gt;
=== What's wrong with it ===&lt;br /&gt;
1. Now it takes more than 15 seconds to even login to the admin's home page with the sample development database. This is definitely not good enough for a daily used web application. &lt;br /&gt;
&lt;br /&gt;
The cause for the long rendering time is that it will be redirected to 'tree_display/list', which needs to fetch all questionnaires, courses and assignments before page rendering.&lt;br /&gt;
&lt;br /&gt;
2. The webpage looks primitive.&lt;br /&gt;
&lt;br /&gt;
=== What changes need to be made ===&lt;br /&gt;
1. Actually it is unnecessary to fetch all data at the very beginning; if there is too much data to present, the list will be extremely long and it is quite hard for users to locate a specific course. &lt;br /&gt;
&lt;br /&gt;
So, we will use AngularJS and jQuery to make a asynchronous webpage that delays the database query until all the basic html elements are correctly rendered, or until the user explicitly asks for that part of data.&lt;br /&gt;
&lt;br /&gt;
2. Bootstrap will be applied for better user interfaces.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Manage-Course page'''==&lt;br /&gt;
[[File:Picture2.png]]&lt;br /&gt;
&lt;br /&gt;
=== What's wrong with it ===&lt;br /&gt;
As illustrated above, now the displaying list is too long and it takes too long to scroll to the end, which makes locating a specific course quite difficult.&lt;br /&gt;
&lt;br /&gt;
Also, loading time can be reduced.&lt;br /&gt;
&lt;br /&gt;
=== What changes need to be made ===&lt;br /&gt;
1. Create several buttons for different time intervals, for example, after clicking on the button '2013-2014', only courses for 2013 to 2014 are presenting, and there is no redirection during this process.&lt;br /&gt;
&lt;br /&gt;
2. The database should not be executed before the user clicks on the button. Only parts of databased is fetched when each button is clicked.&lt;br /&gt;
&lt;br /&gt;
3. Bootstrap will be applied for better user interfaces.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Manage-User page'''==&lt;br /&gt;
[[File:Picture3.png]]&lt;br /&gt;
&lt;br /&gt;
=== What's wrong with it ===&lt;br /&gt;
1. The list is too long: if there are 20k users in the database, there will be 20k rows in this table in a one page!&lt;br /&gt;
&lt;br /&gt;
2. When clicking on the letter A-Z, redirections happen and the whole page is reloaded.&lt;br /&gt;
&lt;br /&gt;
=== What changes need to be made ===&lt;br /&gt;
1. Load only a given number of records to the view, such as 100 records, when accessing into this page for the first time.&lt;br /&gt;
&lt;br /&gt;
2. Using AngularJS to eliminate the redirections and page reloading for better UI performance.&lt;/div&gt;</summary>
		<author><name>Pdeng</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015_E1526_MPRI&amp;diff=96525</id>
		<title>CSC/ECE 517 Spring 2015 E1526 MPRI</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015_E1526_MPRI&amp;diff=96525"/>
		<updated>2015-04-08T17:54:29Z</updated>

		<summary type="html">&lt;p&gt;Pdeng: /* Behavioral Design Patterns */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;font size=&amp;quot;5&amp;quot;&amp;gt;&amp;lt;b&amp;gt;E1526. Responsive web design for Expertiza&amp;lt;/b&amp;gt;&amp;lt;/font&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
= Introduction to Expertiza =&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is a large project developed as a combined effort of students and faculty using the [http://rubyonrails.org/ Ruby on Rails] framework. The main advantage of using Expertiza, in an educational environment, is for the instructor to introduce peer reviewing among the students. Expertiza allows the instructor to create and customize assignments, create a list of topics the students can sign up for, have students work on teams and then review each other's assignments at the end. Expertiza supports submission of almost any document type, including the URLs and wiki pages.&lt;br /&gt;
&lt;br /&gt;
Expertiza is supported by National Science Foundation under Grant No. 0536558. Additional funding from the [http://www.ncsu.edu/ NCSU] [http://litre.ncsu.edu/ Learning in a Technology-Rich Environment] (LITRE) program, the NCSU [http://ofd.ncsu.edu/teaching-learning/ Faculty Center for Teaching and Learning], the NCSU [http://stem.ncsu.edu/ STEM] Initiative, and the Center for Advanced Computing and Communication.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
= Problem Statement =&lt;br /&gt;
&lt;br /&gt;
Despite an amazing set of functionality Expertiza offers, there are numerous parts of it that could use a more stylish look and an improved user experience. The goal of this project is to use both Bootstrap and AngularJS to improve the look of the entire Expertiza including the representations of buttons, tables, and other elements. Certain changes in design will also improve the efficiency of the web app when it comes to the amount of time it takes for a page to be loaded.&lt;br /&gt;
&lt;br /&gt;
= List of Tasks =&lt;br /&gt;
Below are detailed explanations to the tasks listed in the description documentation.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 1. Replace Buttons and Links to Bootstrap styled Buttons ==&lt;br /&gt;
Expertiza, being an extensive web application with numerous features, heavily relies on buttons when it comes to interacting with the user. We plan to improve the user experience by replacing the plain html buttons with stylish bootstrap buttons. However, numerous elements in the current version of Expertiza, like 'Back' element, are hyperlinks rather than buttons. To make the design of Expertiza consistent, our goal is to replace this plain-styled text with color coded Bootstrap buttons.&lt;br /&gt;
&lt;br /&gt;
== 2. Create new theme ==&lt;br /&gt;
One of the entities responsible for the primitive look of Expertiza, as of now, is the lack of fixed navbar. The new design of Expertiza will include the fixed menu bar on the top of the page. Please refer to the screenshot shown below for an example from Virgin American website. As it can be seen on the screenshot, the user has scrolled down the page, but the menu bar is still visible on the top of the page, making it convenient for the user to navigate throughout the website.&lt;br /&gt;
&lt;br /&gt;
[[File:Picture4-2.png]]&lt;br /&gt;
&lt;br /&gt;
== 3. Auto hides contents on the dashboard for instructors ==&lt;br /&gt;
Please refer to the later part of this article: [[#Manage-Course page|Manage-Course page]] for viewing the current design&lt;br /&gt;
&lt;br /&gt;
Now, when trying to open manage-courses, all records are loaded before rendering them onto the page, which takes too long time to load and is not responsive at all.&lt;br /&gt;
&lt;br /&gt;
Better practice is on Virgin American’s website: https://www.virginamerica.com/book/rt/a1/sfo_bos/20150401_20150402&lt;br /&gt;
&lt;br /&gt;
When the website is representing the calendar, the price for each day is not actually loaded. But the skeleton of the page, which is the calendar in this case, can be displayed first.&lt;br /&gt;
&lt;br /&gt;
[[File:Picture5.png]]&lt;br /&gt;
&lt;br /&gt;
So in Expertiza, we can create several buttons for course semesters in the page. After clicking on Fall 2014, the courses for Fall 2014 will come out. &lt;br /&gt;
&lt;br /&gt;
And if the list is still too long and takes a long time load, we can use a ‘show more’ button ,or automatically load more data when the scroll bar reaching the end of the page, to minimize the content we need to load after one single mouse click. &lt;br /&gt;
&lt;br /&gt;
[[File:Picture6.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 4. Simplify Action Panel ==&lt;br /&gt;
We will need to reduce the number of buttons. For example, the first row are actions for assignments and the second row is for participant. So we can replace them to 5 buttons with responsive design, that is, no redirecting happens after clicking on the buttons.&lt;br /&gt;
&lt;br /&gt;
[[File:Picture7.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 5. Offer Better UI for Managing Users ==&lt;br /&gt;
&lt;br /&gt;
Please refer to the later part of this article: [[#Manage-User page|Manage-User page]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 6. Make grades_view Responsive with Better Design ==&lt;br /&gt;
&lt;br /&gt;
Similar to the previous tasks, we will need to make it responsive. &lt;br /&gt;
&lt;br /&gt;
After clicking on ‘Your scores’, all reviews are loaded before rendering the page now. That takes a long time to load and the length of review list is too long.&lt;br /&gt;
&lt;br /&gt;
[[File:Picture8.png]]&lt;br /&gt;
&lt;br /&gt;
=Design Patterns=&lt;br /&gt;
&lt;br /&gt;
As an assignment with a goal of improving the graphic design and responsiveness of Expertiza web application, this project mainly follows design patterns from two design pattern groups: structural and behavioral.&lt;br /&gt;
&lt;br /&gt;
==Structural Design Patterns==&lt;br /&gt;
Flyweight, a design pattern aiming to minimize the memory usage by sharing as much data as possible, is heavily implemented on the css and bootstrap side. Our team leans towards creating classes for styling that can be efficiently reused in a variety of Expertiza sections, rather than separately refining the design of each little section. This will both save us time and keep the code concise, while optimizing the memory needed to store the code.&lt;br /&gt;
&lt;br /&gt;
Another structural design pattern that will be seen in this project is Front Controller pattern. While this pattern suggests that there is a single controller that takes all the requests, when we have both Rails and AngularJS coexisting, we can think of Rails framework as being the &amp;quot;single bridge&amp;quot; to the database from AngularJS's stand point. AngularJS, being an outstanding front-end framework, will interact with the user and pass all the request to Rails framework. Rails framework then queries/updates the database and provides AngularJS with the data.&lt;br /&gt;
&lt;br /&gt;
Finally, the third structural design pattern that this project follows is Module pattern. Modules are one of the essential constructs in the skeleton of AngularJS framework and, hence, this project is bound to follow module pattern.&lt;br /&gt;
[[File:E1526-1.png]]&lt;br /&gt;
&lt;br /&gt;
==Behavioral Design Patterns==&lt;br /&gt;
Since the large part of this project is to iterate through the database query and show the data to the user with a reduced delay, this project follows the well known Iterator pattern.&lt;br /&gt;
&lt;br /&gt;
Along the similar lines, Observer pattern is followed to efficiently handle query requests to a large database (the main culprit behind the unpleasantly long delay). Our project intends to tackle this challenge by fetching only a screen-full of results and showing it to the user right away (fast response). While the user is looking at this first chunk of data displayed on the screen, further queries are made to the database in the background and the rest of the matching results are being returned, efficiently populating the page further. This approach greatly improves the user experience since it does not leave the user waiting empty-handed until Rails framework completes the full query of the database.&lt;br /&gt;
[[File:E1526-2.png]]&lt;br /&gt;
&lt;br /&gt;
= Pages To Be Modified =&lt;br /&gt;
For this project, it is difficult to re-design all webpages and make them responsive. After discussing with the contact person, we will be focusing only on these 3 pages:&lt;br /&gt;
&lt;br /&gt;
=='''Login Page'''==&lt;br /&gt;
[[File:Picture1.png]]&lt;br /&gt;
&lt;br /&gt;
=== What's wrong with it ===&lt;br /&gt;
1. Now it takes more than 15 seconds to even login to the admin's home page with the sample development database. This is definitely not good enough for a daily used web application. &lt;br /&gt;
&lt;br /&gt;
The cause for the long rendering time is that it will be redirected to 'tree_display/list', which needs to fetch all questionnaires, courses and assignments before page rendering.&lt;br /&gt;
&lt;br /&gt;
2. The webpage looks primitive.&lt;br /&gt;
&lt;br /&gt;
=== What changes need to be made ===&lt;br /&gt;
1. Actually it is unnecessary to fetch all data at the very beginning; if there is too much data to present, the list will be extremely long and it is quite hard for users to locate a specific course. &lt;br /&gt;
&lt;br /&gt;
So, we will use AngularJS and jQuery to make a asynchronous webpage that delays the database query until all the basic html elements are correctly rendered, or until the user explicitly asks for that part of data.&lt;br /&gt;
&lt;br /&gt;
2. Bootstrap will be applied for better user interfaces.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Manage-Course page'''==&lt;br /&gt;
[[File:Picture2.png]]&lt;br /&gt;
&lt;br /&gt;
=== What's wrong with it ===&lt;br /&gt;
As illustrated above, now the displaying list is too long and it takes too long to scroll to the end, which makes locating a specific course quite difficult.&lt;br /&gt;
&lt;br /&gt;
Also, loading time can be reduced.&lt;br /&gt;
&lt;br /&gt;
=== What changes need to be made ===&lt;br /&gt;
1. Create several buttons for different time intervals, for example, after clicking on the button '2013-2014', only courses for 2013 to 2014 are presenting, and there is no redirection during this process.&lt;br /&gt;
&lt;br /&gt;
2. The database should not be executed before the user clicks on the button. Only parts of databased is fetched when each button is clicked.&lt;br /&gt;
&lt;br /&gt;
3. Bootstrap will be applied for better user interfaces.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Manage-User page'''==&lt;br /&gt;
[[File:Picture3.png]]&lt;br /&gt;
&lt;br /&gt;
=== What's wrong with it ===&lt;br /&gt;
1. The list is too long: if there are 20k users in the database, there will be 20k rows in this table in a one page!&lt;br /&gt;
&lt;br /&gt;
2. When clicking on the letter A-Z, redirections happen and the whole page is reloaded.&lt;br /&gt;
&lt;br /&gt;
=== What changes need to be made ===&lt;br /&gt;
1. Load only a given number of records to the view, such as 100 records, when accessing into this page for the first time.&lt;br /&gt;
&lt;br /&gt;
2. Using AngularJS to eliminate the redirections and page reloading for better UI performance.&lt;/div&gt;</summary>
		<author><name>Pdeng</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015_E1526_MPRI&amp;diff=96524</id>
		<title>CSC/ECE 517 Spring 2015 E1526 MPRI</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015_E1526_MPRI&amp;diff=96524"/>
		<updated>2015-04-08T17:54:04Z</updated>

		<summary type="html">&lt;p&gt;Pdeng: /* Behavioral Design Patterns */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;font size=&amp;quot;5&amp;quot;&amp;gt;&amp;lt;b&amp;gt;E1526. Responsive web design for Expertiza&amp;lt;/b&amp;gt;&amp;lt;/font&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
= Introduction to Expertiza =&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is a large project developed as a combined effort of students and faculty using the [http://rubyonrails.org/ Ruby on Rails] framework. The main advantage of using Expertiza, in an educational environment, is for the instructor to introduce peer reviewing among the students. Expertiza allows the instructor to create and customize assignments, create a list of topics the students can sign up for, have students work on teams and then review each other's assignments at the end. Expertiza supports submission of almost any document type, including the URLs and wiki pages.&lt;br /&gt;
&lt;br /&gt;
Expertiza is supported by National Science Foundation under Grant No. 0536558. Additional funding from the [http://www.ncsu.edu/ NCSU] [http://litre.ncsu.edu/ Learning in a Technology-Rich Environment] (LITRE) program, the NCSU [http://ofd.ncsu.edu/teaching-learning/ Faculty Center for Teaching and Learning], the NCSU [http://stem.ncsu.edu/ STEM] Initiative, and the Center for Advanced Computing and Communication.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
= Problem Statement =&lt;br /&gt;
&lt;br /&gt;
Despite an amazing set of functionality Expertiza offers, there are numerous parts of it that could use a more stylish look and an improved user experience. The goal of this project is to use both Bootstrap and AngularJS to improve the look of the entire Expertiza including the representations of buttons, tables, and other elements. Certain changes in design will also improve the efficiency of the web app when it comes to the amount of time it takes for a page to be loaded.&lt;br /&gt;
&lt;br /&gt;
= List of Tasks =&lt;br /&gt;
Below are detailed explanations to the tasks listed in the description documentation.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 1. Replace Buttons and Links to Bootstrap styled Buttons ==&lt;br /&gt;
Expertiza, being an extensive web application with numerous features, heavily relies on buttons when it comes to interacting with the user. We plan to improve the user experience by replacing the plain html buttons with stylish bootstrap buttons. However, numerous elements in the current version of Expertiza, like 'Back' element, are hyperlinks rather than buttons. To make the design of Expertiza consistent, our goal is to replace this plain-styled text with color coded Bootstrap buttons.&lt;br /&gt;
&lt;br /&gt;
== 2. Create new theme ==&lt;br /&gt;
One of the entities responsible for the primitive look of Expertiza, as of now, is the lack of fixed navbar. The new design of Expertiza will include the fixed menu bar on the top of the page. Please refer to the screenshot shown below for an example from Virgin American website. As it can be seen on the screenshot, the user has scrolled down the page, but the menu bar is still visible on the top of the page, making it convenient for the user to navigate throughout the website.&lt;br /&gt;
&lt;br /&gt;
[[File:Picture4-2.png]]&lt;br /&gt;
&lt;br /&gt;
== 3. Auto hides contents on the dashboard for instructors ==&lt;br /&gt;
Please refer to the later part of this article: [[#Manage-Course page|Manage-Course page]] for viewing the current design&lt;br /&gt;
&lt;br /&gt;
Now, when trying to open manage-courses, all records are loaded before rendering them onto the page, which takes too long time to load and is not responsive at all.&lt;br /&gt;
&lt;br /&gt;
Better practice is on Virgin American’s website: https://www.virginamerica.com/book/rt/a1/sfo_bos/20150401_20150402&lt;br /&gt;
&lt;br /&gt;
When the website is representing the calendar, the price for each day is not actually loaded. But the skeleton of the page, which is the calendar in this case, can be displayed first.&lt;br /&gt;
&lt;br /&gt;
[[File:Picture5.png]]&lt;br /&gt;
&lt;br /&gt;
So in Expertiza, we can create several buttons for course semesters in the page. After clicking on Fall 2014, the courses for Fall 2014 will come out. &lt;br /&gt;
&lt;br /&gt;
And if the list is still too long and takes a long time load, we can use a ‘show more’ button ,or automatically load more data when the scroll bar reaching the end of the page, to minimize the content we need to load after one single mouse click. &lt;br /&gt;
&lt;br /&gt;
[[File:Picture6.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 4. Simplify Action Panel ==&lt;br /&gt;
We will need to reduce the number of buttons. For example, the first row are actions for assignments and the second row is for participant. So we can replace them to 5 buttons with responsive design, that is, no redirecting happens after clicking on the buttons.&lt;br /&gt;
&lt;br /&gt;
[[File:Picture7.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 5. Offer Better UI for Managing Users ==&lt;br /&gt;
&lt;br /&gt;
Please refer to the later part of this article: [[#Manage-User page|Manage-User page]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 6. Make grades_view Responsive with Better Design ==&lt;br /&gt;
&lt;br /&gt;
Similar to the previous tasks, we will need to make it responsive. &lt;br /&gt;
&lt;br /&gt;
After clicking on ‘Your scores’, all reviews are loaded before rendering the page now. That takes a long time to load and the length of review list is too long.&lt;br /&gt;
&lt;br /&gt;
[[File:Picture8.png]]&lt;br /&gt;
&lt;br /&gt;
=Design Patterns=&lt;br /&gt;
&lt;br /&gt;
As an assignment with a goal of improving the graphic design and responsiveness of Expertiza web application, this project mainly follows design patterns from two design pattern groups: structural and behavioral.&lt;br /&gt;
&lt;br /&gt;
==Structural Design Patterns==&lt;br /&gt;
Flyweight, a design pattern aiming to minimize the memory usage by sharing as much data as possible, is heavily implemented on the css and bootstrap side. Our team leans towards creating classes for styling that can be efficiently reused in a variety of Expertiza sections, rather than separately refining the design of each little section. This will both save us time and keep the code concise, while optimizing the memory needed to store the code.&lt;br /&gt;
&lt;br /&gt;
Another structural design pattern that will be seen in this project is Front Controller pattern. While this pattern suggests that there is a single controller that takes all the requests, when we have both Rails and AngularJS coexisting, we can think of Rails framework as being the &amp;quot;single bridge&amp;quot; to the database from AngularJS's stand point. AngularJS, being an outstanding front-end framework, will interact with the user and pass all the request to Rails framework. Rails framework then queries/updates the database and provides AngularJS with the data.&lt;br /&gt;
&lt;br /&gt;
Finally, the third structural design pattern that this project follows is Module pattern. Modules are one of the essential constructs in the skeleton of AngularJS framework and, hence, this project is bound to follow module pattern.&lt;br /&gt;
[[File:E1526-1.png]]&lt;br /&gt;
&lt;br /&gt;
==Behavioral Design Patterns==&lt;br /&gt;
Since the large part of this project is to iterate through the database query and show the data to the user with a reduced delay, this project follows the well known Iterator pattern.&lt;br /&gt;
&lt;br /&gt;
Along the similar lines, Observer pattern is followed to efficiently handle query requests to a large database (the main culprit behind the unpleasantly long delay). Our project intends to tackle this challenge by fetching only a screen-full of results and showing it to the user right away (fast response). While the user is looking at this first chunk of data displayed on the screen, further queries are made to the database in the background and the rest of the matching results are being returned, efficiently populating the page further. This approach greatly improves the user experience since it does not leave the user waiting empty-handed until Rails framework completes the full query of the database.&lt;br /&gt;
[[File:E1526-3.png]]&lt;br /&gt;
&lt;br /&gt;
= Pages To Be Modified =&lt;br /&gt;
For this project, it is difficult to re-design all webpages and make them responsive. After discussing with the contact person, we will be focusing only on these 3 pages:&lt;br /&gt;
&lt;br /&gt;
=='''Login Page'''==&lt;br /&gt;
[[File:Picture1.png]]&lt;br /&gt;
&lt;br /&gt;
=== What's wrong with it ===&lt;br /&gt;
1. Now it takes more than 15 seconds to even login to the admin's home page with the sample development database. This is definitely not good enough for a daily used web application. &lt;br /&gt;
&lt;br /&gt;
The cause for the long rendering time is that it will be redirected to 'tree_display/list', which needs to fetch all questionnaires, courses and assignments before page rendering.&lt;br /&gt;
&lt;br /&gt;
2. The webpage looks primitive.&lt;br /&gt;
&lt;br /&gt;
=== What changes need to be made ===&lt;br /&gt;
1. Actually it is unnecessary to fetch all data at the very beginning; if there is too much data to present, the list will be extremely long and it is quite hard for users to locate a specific course. &lt;br /&gt;
&lt;br /&gt;
So, we will use AngularJS and jQuery to make a asynchronous webpage that delays the database query until all the basic html elements are correctly rendered, or until the user explicitly asks for that part of data.&lt;br /&gt;
&lt;br /&gt;
2. Bootstrap will be applied for better user interfaces.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Manage-Course page'''==&lt;br /&gt;
[[File:Picture2.png]]&lt;br /&gt;
&lt;br /&gt;
=== What's wrong with it ===&lt;br /&gt;
As illustrated above, now the displaying list is too long and it takes too long to scroll to the end, which makes locating a specific course quite difficult.&lt;br /&gt;
&lt;br /&gt;
Also, loading time can be reduced.&lt;br /&gt;
&lt;br /&gt;
=== What changes need to be made ===&lt;br /&gt;
1. Create several buttons for different time intervals, for example, after clicking on the button '2013-2014', only courses for 2013 to 2014 are presenting, and there is no redirection during this process.&lt;br /&gt;
&lt;br /&gt;
2. The database should not be executed before the user clicks on the button. Only parts of databased is fetched when each button is clicked.&lt;br /&gt;
&lt;br /&gt;
3. Bootstrap will be applied for better user interfaces.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Manage-User page'''==&lt;br /&gt;
[[File:Picture3.png]]&lt;br /&gt;
&lt;br /&gt;
=== What's wrong with it ===&lt;br /&gt;
1. The list is too long: if there are 20k users in the database, there will be 20k rows in this table in a one page!&lt;br /&gt;
&lt;br /&gt;
2. When clicking on the letter A-Z, redirections happen and the whole page is reloaded.&lt;br /&gt;
&lt;br /&gt;
=== What changes need to be made ===&lt;br /&gt;
1. Load only a given number of records to the view, such as 100 records, when accessing into this page for the first time.&lt;br /&gt;
&lt;br /&gt;
2. Using AngularJS to eliminate the redirections and page reloading for better UI performance.&lt;/div&gt;</summary>
		<author><name>Pdeng</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:E1526-2.png&amp;diff=96523</id>
		<title>File:E1526-2.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:E1526-2.png&amp;diff=96523"/>
		<updated>2015-04-08T17:53:45Z</updated>

		<summary type="html">&lt;p&gt;Pdeng: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Pdeng</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015_E1526_MPRI&amp;diff=96518</id>
		<title>CSC/ECE 517 Spring 2015 E1526 MPRI</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015_E1526_MPRI&amp;diff=96518"/>
		<updated>2015-04-08T17:42:22Z</updated>

		<summary type="html">&lt;p&gt;Pdeng: /* Structural Design Patterns */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;font size=&amp;quot;5&amp;quot;&amp;gt;&amp;lt;b&amp;gt;E1526. Responsive web design for Expertiza&amp;lt;/b&amp;gt;&amp;lt;/font&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
= Introduction to Expertiza =&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is a large project developed as a combined effort of students and faculty using the [http://rubyonrails.org/ Ruby on Rails] framework. The main advantage of using Expertiza, in an educational environment, is for the instructor to introduce peer reviewing among the students. Expertiza allows the instructor to create and customize assignments, create a list of topics the students can sign up for, have students work on teams and then review each other's assignments at the end. Expertiza supports submission of almost any document type, including the URLs and wiki pages.&lt;br /&gt;
&lt;br /&gt;
Expertiza is supported by National Science Foundation under Grant No. 0536558. Additional funding from the [http://www.ncsu.edu/ NCSU] [http://litre.ncsu.edu/ Learning in a Technology-Rich Environment] (LITRE) program, the NCSU [http://ofd.ncsu.edu/teaching-learning/ Faculty Center for Teaching and Learning], the NCSU [http://stem.ncsu.edu/ STEM] Initiative, and the Center for Advanced Computing and Communication.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
= Problem Statement =&lt;br /&gt;
&lt;br /&gt;
Despite an amazing set of functionality Expertiza offers, there are numerous parts of it that could use a more stylish look and an improved user experience. The goal of this project is to use both Bootstrap and AngularJS to improve the look of the entire Expertiza including the representations of buttons, tables, and other elements. Certain changes in design will also improve the efficiency of the web app when it comes to the amount of time it takes for a page to be loaded.&lt;br /&gt;
&lt;br /&gt;
= List of Tasks =&lt;br /&gt;
Below are detailed explanations to the tasks listed in the description documentation.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 1. Replace Buttons and Links to Bootstrap styled Buttons ==&lt;br /&gt;
Expertiza, being an extensive web application with numerous features, heavily relies on buttons when it comes to interacting with the user. We plan to improve the user experience by replacing the plain html buttons with stylish bootstrap buttons. However, numerous elements in the current version of Expertiza, like 'Back' element, are hyperlinks rather than buttons. To make the design of Expertiza consistent, our goal is to replace this plain-styled text with color coded Bootstrap buttons.&lt;br /&gt;
&lt;br /&gt;
== 2. Create new theme ==&lt;br /&gt;
One of the entities responsible for the primitive look of Expertiza, as of now, is the lack of fixed navbar. The new design of Expertiza will include the fixed menu bar on the top of the page. Please refer to the screenshot shown below for an example from Virgin American website. As it can be seen on the screenshot, the user has scrolled down the page, but the menu bar is still visible on the top of the page, making it convenient for the user to navigate throughout the website.&lt;br /&gt;
&lt;br /&gt;
[[File:Picture4-2.png]]&lt;br /&gt;
&lt;br /&gt;
== 3. Auto hides contents on the dashboard for instructors ==&lt;br /&gt;
Please refer to the later part of this article: [[#Manage-Course page|Manage-Course page]] for viewing the current design&lt;br /&gt;
&lt;br /&gt;
Now, when trying to open manage-courses, all records are loaded before rendering them onto the page, which takes too long time to load and is not responsive at all.&lt;br /&gt;
&lt;br /&gt;
Better practice is on Virgin American’s website: https://www.virginamerica.com/book/rt/a1/sfo_bos/20150401_20150402&lt;br /&gt;
&lt;br /&gt;
When the website is representing the calendar, the price for each day is not actually loaded. But the skeleton of the page, which is the calendar in this case, can be displayed first.&lt;br /&gt;
&lt;br /&gt;
[[File:Picture5.png]]&lt;br /&gt;
&lt;br /&gt;
So in Expertiza, we can create several buttons for course semesters in the page. After clicking on Fall 2014, the courses for Fall 2014 will come out. &lt;br /&gt;
&lt;br /&gt;
And if the list is still too long and takes a long time load, we can use a ‘show more’ button ,or automatically load more data when the scroll bar reaching the end of the page, to minimize the content we need to load after one single mouse click. &lt;br /&gt;
&lt;br /&gt;
[[File:Picture6.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 4. Simplify Action Panel ==&lt;br /&gt;
We will need to reduce the number of buttons. For example, the first row are actions for assignments and the second row is for participant. So we can replace them to 5 buttons with responsive design, that is, no redirecting happens after clicking on the buttons.&lt;br /&gt;
&lt;br /&gt;
[[File:Picture7.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 5. Offer Better UI for Managing Users ==&lt;br /&gt;
&lt;br /&gt;
Please refer to the later part of this article: [[#Manage-User page|Manage-User page]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 6. Make grades_view Responsive with Better Design ==&lt;br /&gt;
&lt;br /&gt;
Similar to the previous tasks, we will need to make it responsive. &lt;br /&gt;
&lt;br /&gt;
After clicking on ‘Your scores’, all reviews are loaded before rendering the page now. That takes a long time to load and the length of review list is too long.&lt;br /&gt;
&lt;br /&gt;
[[File:Picture8.png]]&lt;br /&gt;
&lt;br /&gt;
=Design Patterns=&lt;br /&gt;
&lt;br /&gt;
As an assignment with a goal of improving the graphic design and responsiveness of Expertiza web application, this project mainly follows design patterns from two design pattern groups: structural and behavioral.&lt;br /&gt;
&lt;br /&gt;
==Structural Design Patterns==&lt;br /&gt;
Flyweight, a design pattern aiming to minimize the memory usage by sharing as much data as possible, is heavily implemented on the css and bootstrap side. Our team leans towards creating classes for styling that can be efficiently reused in a variety of Expertiza sections, rather than separately refining the design of each little section. This will both save us time and keep the code concise, while optimizing the memory needed to store the code.&lt;br /&gt;
&lt;br /&gt;
Another structural design pattern that will be seen in this project is Front Controller pattern. While this pattern suggests that there is a single controller that takes all the requests, when we have both Rails and AngularJS coexisting, we can think of Rails framework as being the &amp;quot;single bridge&amp;quot; to the database from AngularJS's stand point. AngularJS, being an outstanding front-end framework, will interact with the user and pass all the request to Rails framework. Rails framework then queries/updates the database and provides AngularJS with the data.&lt;br /&gt;
&lt;br /&gt;
Finally, the third structural design pattern that this project follows is Module pattern. Modules are one of the essential constructs in the skeleton of AngularJS framework and, hence, this project is bound to follow module pattern.&lt;br /&gt;
[[File:E1526-1.png]]&lt;br /&gt;
&lt;br /&gt;
==Behavioral Design Patterns==&lt;br /&gt;
Since the large part of this project is to iterate through the database query and show the data to the user with a reduced delay, this project follows the well known Iterator pattern.&lt;br /&gt;
&lt;br /&gt;
Along the similar lines, Observer pattern is followed to efficiently handle query requests to a large database (the main culprit behind the unpleasantly long delay). Our project intends to tackle this challenge by fetching only a screen-full of results and showing it to the user right away (fast response). While the user is looking at this first chunk of data displayed on the screen, further queries are made to the database in the background and the rest of the matching results are being returned, efficiently populating the page further. This approach greatly improves the user experience since it does not leave the user waiting empty-handed until Rails framework completes the full query of the database.&lt;br /&gt;
&lt;br /&gt;
= Pages To Be Modified =&lt;br /&gt;
For this project, it is difficult to re-design all webpages and make them responsive. After discussing with the contact person, we will be focusing only on these 3 pages:&lt;br /&gt;
&lt;br /&gt;
=='''Login Page'''==&lt;br /&gt;
[[File:Picture1.png]]&lt;br /&gt;
&lt;br /&gt;
=== What's wrong with it ===&lt;br /&gt;
1. Now it takes more than 15 seconds to even login to the admin's home page with the sample development database. This is definitely not good enough for a daily used web application. &lt;br /&gt;
&lt;br /&gt;
The cause for the long rendering time is that it will be redirected to 'tree_display/list', which needs to fetch all questionnaires, courses and assignments before page rendering.&lt;br /&gt;
&lt;br /&gt;
2. The webpage looks primitive.&lt;br /&gt;
&lt;br /&gt;
=== What changes need to be made ===&lt;br /&gt;
1. Actually it is unnecessary to fetch all data at the very beginning; if there is too much data to present, the list will be extremely long and it is quite hard for users to locate a specific course. &lt;br /&gt;
&lt;br /&gt;
So, we will use AngularJS and jQuery to make a asynchronous webpage that delays the database query until all the basic html elements are correctly rendered, or until the user explicitly asks for that part of data.&lt;br /&gt;
&lt;br /&gt;
2. Bootstrap will be applied for better user interfaces.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Manage-Course page'''==&lt;br /&gt;
[[File:Picture2.png]]&lt;br /&gt;
&lt;br /&gt;
=== What's wrong with it ===&lt;br /&gt;
As illustrated above, now the displaying list is too long and it takes too long to scroll to the end, which makes locating a specific course quite difficult.&lt;br /&gt;
&lt;br /&gt;
Also, loading time can be reduced.&lt;br /&gt;
&lt;br /&gt;
=== What changes need to be made ===&lt;br /&gt;
1. Create several buttons for different time intervals, for example, after clicking on the button '2013-2014', only courses for 2013 to 2014 are presenting, and there is no redirection during this process.&lt;br /&gt;
&lt;br /&gt;
2. The database should not be executed before the user clicks on the button. Only parts of databased is fetched when each button is clicked.&lt;br /&gt;
&lt;br /&gt;
3. Bootstrap will be applied for better user interfaces.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Manage-User page'''==&lt;br /&gt;
[[File:Picture3.png]]&lt;br /&gt;
&lt;br /&gt;
=== What's wrong with it ===&lt;br /&gt;
1. The list is too long: if there are 20k users in the database, there will be 20k rows in this table in a one page!&lt;br /&gt;
&lt;br /&gt;
2. When clicking on the letter A-Z, redirections happen and the whole page is reloaded.&lt;br /&gt;
&lt;br /&gt;
=== What changes need to be made ===&lt;br /&gt;
1. Load only a given number of records to the view, such as 100 records, when accessing into this page for the first time.&lt;br /&gt;
&lt;br /&gt;
2. Using AngularJS to eliminate the redirections and page reloading for better UI performance.&lt;/div&gt;</summary>
		<author><name>Pdeng</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:E1526-1.png&amp;diff=96517</id>
		<title>File:E1526-1.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:E1526-1.png&amp;diff=96517"/>
		<updated>2015-04-08T17:41:48Z</updated>

		<summary type="html">&lt;p&gt;Pdeng: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Pdeng</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015/oss_E1507_DG&amp;diff=96466</id>
		<title>CSC/ECE 517 Spring 2015/oss E1507 DG</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015/oss_E1507_DG&amp;diff=96466"/>
		<updated>2015-04-02T01:39:38Z</updated>

		<summary type="html">&lt;p&gt;Pdeng: /* Files involved */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''E1507. Refactoring Review Files Controller &amp;amp; Submitted Content Controller'''&lt;br /&gt;
&lt;br /&gt;
This page provides a description of the Expertiza based OSS project. This project aimed at refactoring the Review Files Controller &amp;amp; Submitted Content Controller as well as fixing the bug [https://github.com/expertiza/expertiza/issues/483 #483]&lt;br /&gt;
&lt;br /&gt;
=What is Expertiza=&lt;br /&gt;
[http://http://expertiza.ncsu.edu/ Expertiza] is a [http://en.wikipedia.org/wiki/Open-source_software Open Source] [http://rubyonrails.org/ Rails] application where students can submit and peer-review learning objects (articles, code, web sites, etc). It is used in select courses at NC State and by professors at several other colleges and universities.  This Open Source application can be cloned from [https://github.com/expertiza/expertiza/ Github], the latest active branch is [https://github.com/expertiza/expertiza/tree/rails4 &amp;quot;Rails 4&amp;quot;].&lt;br /&gt;
&lt;br /&gt;
=Project Desicription&amp;lt;ref&amp;gt;https://docs.google.com/document/d/1J0WUBtYV_MDhpEQ-50z8gXE-OrvVkpEaZxvn_9RCAsM/edit#&amp;lt;/ref&amp;gt;=&lt;br /&gt;
There are 5 major goals for this project:&lt;br /&gt;
&lt;br /&gt;
1. Fix Bug #483&amp;lt;ref&amp;gt;https://github.com/expertiza/expertiza/issues/483&amp;lt;/ref&amp;gt;, which causes some error and prevent users to get access to the submitted_content page.&lt;br /&gt;
&lt;br /&gt;
2.Break up the complex methods such as &amp;lt;code&amp;gt;get_comments&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;show_code_file_diff&amp;lt;/code&amp;gt;. Anything that can be modularized should be modularized (Single Responsibility)&lt;br /&gt;
&lt;br /&gt;
3.While breaking up the complex methods, look out for possible helper functions. If there are any, move them to the &amp;lt;code&amp;gt;review_files_helper.rb&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4.Remove commented out code from the controller&lt;br /&gt;
&lt;br /&gt;
5.Refactor the file based on Global Rules&amp;lt;ref&amp;gt;https://docs.google.com/document/d/1qQD7fcypFk77nq7Jx7ZNyCNpLyt1oXKaq5G-W7zkV3k/edit?usp=sharing&amp;lt;/ref&amp;gt;.&lt;br /&gt;
 &lt;br /&gt;
==Bug #483==&lt;br /&gt;
In &amp;quot;Your works&amp;quot; view, students can only submit links but no files.&lt;br /&gt;
&lt;br /&gt;
[[File:Ossp1.png]]&lt;br /&gt;
&lt;br /&gt;
This is caused by commit [https://github.com/expertiza/expertiza/commit/f313711fee2dd92e324603b9c506d9d5470c3b60 f313711] where the line 13 in [https://github.com/expertiza/expertiza/blob/f313711fee2dd92e324603b9c506d9d5470c3b60/app/views/submitted_content/_main.html.erb submitted_content/_main.html.erb] was commented out.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;%#= render partial: 'submitted_content/submitted_files', locals: {participant: @participant, stage: @stage} %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
But after uncommented line 13 in &amp;lt;code&amp;gt;submitted_content/_main.html.erb&amp;lt;/code&amp;gt; and refresh the page, the Rails Server stopped responding.&lt;br /&gt;
&lt;br /&gt;
==Refactoring Review Files Controller &amp;amp; Submitted Content Controller==&lt;br /&gt;
===What they do===&lt;br /&gt;
This [https://github.com/expertiza/expertiza/blob/rails4/app/controllers/review_files_controller.rb review_files_controller.rb] is responsible for handling the review files of the participants. This controller helps in uploading newer versions of reviews for an assignment and also in displaying all the versions (and diff between versions/code) with the help of [https://github.com/expertiza/expertiza/blob/rails4/app/controllers/submitted_content_controller.rb submitted_content_controller.rb].&lt;br /&gt;
===What’s wrong with them===&lt;br /&gt;
There are quite a few complex functions inside these controllers. These functions can easily be broken up into much more smaller methods with specific functionalities. They also need to be refactored to meet the [https://docs.google.com/document/d/1qQD7fcypFk77nq7Jx7ZNyCNpLyt1oXKaq5G-W7zkV3k/edit Global Rules].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Changes Made=&lt;br /&gt;
==Files involved==&lt;br /&gt;
1. review_files_controller.rb&lt;br /&gt;
&lt;br /&gt;
2. submitted_content_controller.rb&lt;br /&gt;
&lt;br /&gt;
3. review_files_helper.rb&lt;br /&gt;
&lt;br /&gt;
4. review_comments_helper.rb&lt;br /&gt;
&lt;br /&gt;
5. submitted_content/_main.html.erb&lt;br /&gt;
&lt;br /&gt;
6. model/assignment.rb&lt;br /&gt;
&lt;br /&gt;
==For Bug #483 fixing==&lt;br /&gt;
Git log can be viewed in commit [https://github.com/KeleiAzz/expertiza/commit/aa37e2e61d0bf93a9bd0707621cd764017252f58 aa37e2e]&lt;br /&gt;
&lt;br /&gt;
1. In &amp;lt;code&amp;gt;submitted_content_controller.rb&amp;lt;/code&amp;gt;, line 19. &lt;br /&gt;
 if @assignment.max_team_size &amp;gt; 1 &amp;amp;&amp;amp; @participant.team.nil?&lt;br /&gt;
      flash[:error] = &amp;quot;This is a team assignment. Before submitting your work, you must &amp;lt;a style='color: blue;' href='../../student_teams/view/?student_id=#{params[:id]}'&amp;gt;create a team&amp;lt;/a&amp;gt;, &lt;br /&gt;
                      even if you will be the only member of the team&amp;quot;&lt;br /&gt;
      redirect_to controller: 'student_task', action: 'view', id: params[:id]&lt;br /&gt;
 else if @participant.team.nil?&lt;br /&gt;
      #create a new team for current user before submission&lt;br /&gt;
      team = AssignmentTeam.create_team_and_node(@assignment.id)&lt;br /&gt;
      team.add_member(User.find(@participant.user_id),@assignment.id)&lt;br /&gt;
 end&lt;br /&gt;
This &amp;lt;code&amp;gt;else if&amp;lt;/code&amp;gt; must be a mistake, so we changed it to:&lt;br /&gt;
 &amp;lt;code&amp;gt;elsif @participant.team.nil?&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2. In &amp;lt;code&amp;gt;model/assignment.rb&amp;lt;/code&amp;gt;, line 489. &lt;br /&gt;
 &amp;lt;code&amp;gt;Course.find(self.course_id).get_path&amp;lt;/code&amp;gt;&lt;br /&gt;
The &amp;lt;code&amp;gt;Course&amp;lt;/code&amp;gt; model doesn't have an attribute called &amp;lt;code&amp;gt;get_path&amp;lt;/code&amp;gt;, it should be &amp;lt;code&amp;gt;directory_path&amp;lt;/code&amp;gt;, so we changed it to&lt;br /&gt;
 &amp;lt;code&amp;gt;Course.find(self.course_id).directory_path&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3. In &amp;lt;code&amp;gt;submitted_content/_main.html.erb&amp;lt;/code&amp;gt;, line 18.&lt;br /&gt;
 &amp;lt;% if participant.assignment.is_coding_assignment%&amp;gt;&lt;br /&gt;
      &amp;lt;%= link_to &amp;quot;Code Review Dashboard&amp;quot;, :controller =&amp;gt; 'review_files',&lt;br /&gt;
        :action =&amp;gt; 'show_all_submitted_files',&lt;br /&gt;
        :participant_id =&amp;gt; assignment_participant.id,&lt;br /&gt;
        :stage =&amp;gt; stage %&amp;gt;&lt;br /&gt;
    &amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
 &amp;lt;% end %&amp;gt;&lt;br /&gt;
As in this page there doesn't have a parameter called &amp;lt;code&amp;gt;assignment_participant&amp;lt;/code&amp;gt;, as it need to get the participant's id, so we changed this line to:&lt;br /&gt;
 &amp;lt;code&amp;gt;:participant_id =&amp;gt; participant.id&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4. In &amp;lt;code&amp;gt;config/routes.rb&amp;lt;/code&amp;gt;. Added one more routes&lt;br /&gt;
 &amp;lt;code&amp;gt;post :submit_file&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Refactoring &amp;lt;code&amp;gt;review_files_controller.rb&amp;lt;/code&amp;gt;==&lt;br /&gt;
&lt;br /&gt;
1. Changed &amp;lt;code&amp;gt;and&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;or&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;&amp;amp;&amp;amp;&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;||&amp;lt;/code&amp;gt; to meet the requirements in the [https://docs.google.com/document/d/1qQD7fcypFk77nq7Jx7ZNyCNpLyt1oXKaq5G-W7zkV3k/edit Global Rules].&lt;br /&gt;
&lt;br /&gt;
2. In &amp;lt;code&amp;gt;def get_comments&amp;lt;/code&amp;gt;, deleted unused variable:&lt;br /&gt;
 &amp;lt;code&amp;gt;newobj = ReviewComment.where(review_file_id: params[:file_id])&amp;lt;/code&amp;gt;;&lt;br /&gt;
&lt;br /&gt;
3. In &amp;lt;code&amp;gt;def show_all_submitted_files&amp;lt;/code&amp;gt;, deleted unused variable: &lt;br /&gt;
 file_path = ReviewFile.get_file(code_review_dir, versions.sort.last,base_filename)&lt;br /&gt;
&lt;br /&gt;
4. In &amp;lt;code&amp;gt;def show_all_submitted_files&amp;lt;/code&amp;gt;, deleted unused variable:&lt;br /&gt;
 code_review_dir = ReviewFilesHelper::get_code_review_file_dir(AssignmentParticipant.find(auth[base_filename][versions.sort.last]))&lt;br /&gt;
&lt;br /&gt;
5. The method &amp;lt;code&amp;gt;def get_comments&amp;lt;/code&amp;gt; is too complex, so we modularized part of its code in &amp;lt;code&amp;gt;review_comments_helper.rb&amp;lt;/code&amp;gt;, we created a new method: &amp;lt;code&amp;gt;def self.populate_comments&amp;lt;/code&amp;gt;, which returns &amp;lt;code&amp;gt;handle, comment, authorflag&amp;lt;/code&amp;gt; these three variables.&lt;br /&gt;
  def self.populate_comments(params, authorflag, comment)&lt;br /&gt;
    assignmentparticipant = AssignmentParticipant.find(params[:participant_id])&lt;br /&gt;
    current_participant = AssignmentParticipant.where(parent_id: assignmentparticipant[:parent_id], user_id: session[:user].id).first&lt;br /&gt;
    if current_participant.id.to_s == params[:participant_id]&lt;br /&gt;
      authorflag = 1&lt;br /&gt;
    else&lt;br /&gt;
      authorflag = 0&lt;br /&gt;
    end&lt;br /&gt;
    member = []&lt;br /&gt;
    if assignmentparticipant.assignment.team_assignment&lt;br /&gt;
      assignmentparticipant.team.get_participants.each_with_index {|member1, index|&lt;br /&gt;
        member[index] = member1.id&lt;br /&gt;
      }&lt;br /&gt;
    end&lt;br /&gt;
    if (comment[:reviewer_participant_id] ==  current_participant.id)&lt;br /&gt;
      handle = &amp;quot;Me :&amp;quot;&lt;br /&gt;
      authorflag = 0&lt;br /&gt;
    elsif member.include? comment[:reviewer_participant_id] || comment[:reviewer_participant_id] == assignmentparticipant.id&lt;br /&gt;
      handle = &amp;quot;Author :&amp;quot;&lt;br /&gt;
      authorflag = 0&lt;br /&gt;
    else&lt;br /&gt;
      handle = &amp;quot;Reviewer&amp;quot;+comment[:reviewer_participant_id].to_s&lt;br /&gt;
    end&lt;br /&gt;
    return handle, comment, authorflag&lt;br /&gt;
  end&lt;br /&gt;
6. Rewrited all &amp;lt;code&amp;gt;:key =&amp;gt; value&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;key: value format&amp;lt;/code&amp;gt; according to the requirements in the '''Global Rules'''&amp;lt;ref&amp;gt;https://docs.google.com/document/d/1qQD7fcypFk77nq7Jx7ZNyCNpLyt1oXKaq5G-W7zkV3k/edit&amp;lt;/ref&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
7. The method &amp;lt;code&amp;gt;def show_code_files_diffIn&amp;lt;/code&amp;gt; is too complex, we created a new method: &amp;lt;code&amp;gt;def self.populate_shareObj &amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;review_files_helper.rb&amp;lt;/code&amp;gt; to perform part of the &amp;lt;code&amp;gt;show_code_files_diff&amp;lt;/code&amp;gt;.&lt;br /&gt;
  def self.populate_shareObj(processor)&lt;br /&gt;
    first_line_num = []&lt;br /&gt;
    second_line_num = []&lt;br /&gt;
    first_offset = []&lt;br /&gt;
    second_offset = []&lt;br /&gt;
    offsetswithcomments_file1 = []&lt;br /&gt;
    offsetswithcomments_file2 = []&lt;br /&gt;
    first_offset &amp;lt;&amp;lt; 0&lt;br /&gt;
    second_offset &amp;lt;&amp;lt; 0&lt;br /&gt;
    first_count = 0&lt;br /&gt;
    second_count = 0&lt;br /&gt;
    for i in (0..processor.absolute_line_num)&lt;br /&gt;
      first_offset = ReviewFile.get_first_offset(processor, i, @first_offset)&lt;br /&gt;
      second_offset = ReviewFile.get_second_offset(processor, i, @second_offset)&lt;br /&gt;
      first_line_num_new = Hash.new&lt;br /&gt;
      first_line_num_new = ReviewFile.get_first_line_num(processor, i, first_count)&lt;br /&gt;
      first_line_num &amp;lt;&amp;lt; first_line_num[:first_line_num]&lt;br /&gt;
      first_count = first_line_num[:first_count]&lt;br /&gt;
      second_line_num_new = Hash.new&lt;br /&gt;
      second_line_num_new = ReviewFile.get_second_line_num(processor, i,second_count)&lt;br /&gt;
      second_line_num &amp;lt;&amp;lt; second_line_num[:second_line_num]&lt;br /&gt;
      second_count = second_line_num[:second_count]&lt;br /&gt;
      # Remove newlines at the end of this line of code&lt;br /&gt;
      processor = ReviewFile.get_first_file_array(processor, i)&lt;br /&gt;
      processor = ReviewFile.get_second_file_array(processor, i)&lt;br /&gt;
      shareObj = Hash.new()&lt;br /&gt;
      shareObj['linearray1'] = processor.first_file_array&lt;br /&gt;
      shareObj['linearray2'] = processor.second_file_array&lt;br /&gt;
      shareObj['comparator'] = processor.comparison_array&lt;br /&gt;
      shareObj['linenumarray1'] = first_line_num&lt;br /&gt;
      shareObj['linenumarray2'] = second_line_num&lt;br /&gt;
      shareObj['offsetarray1'] = first_offset&lt;br /&gt;
      shareObj['offsetarray2'] = second_offset&lt;br /&gt;
      return first_line_num, second_line_num, first_count, second_count, shareObj&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
8. In &amp;lt;code&amp;gt;review_files_helper.rb&amp;lt;/code&amp;gt;, created a new method: &amp;lt;code&amp;gt;def self.find_review_files&amp;lt;/code&amp;gt;, which contains some statements in &amp;lt;code&amp;gt;def show_all_submitted_files&amp;lt;/code&amp;gt;.&lt;br /&gt;
  def self.find_review_files(participant) &lt;br /&gt;
    # Find all files over all versions submitted by the team&lt;br /&gt;
    all_review_files = Array.new&lt;br /&gt;
    if participant.assignment.team_assignment&lt;br /&gt;
      participant.team.get_participants.each_with_index { |member,index|&lt;br /&gt;
        all_review_files += ReviewFile.where(author_participant_id: member.id)&lt;br /&gt;
      }&lt;br /&gt;
    else&lt;br /&gt;
      all_review_files = ReviewFile.where(author_participant_id: @participant.id)&lt;br /&gt;
    end&lt;br /&gt;
    all_review_files&lt;br /&gt;
  end&lt;br /&gt;
9. In &amp;lt;code&amp;gt;review_files_helper.rb&amp;lt;/code&amp;gt;, created a new method: &amp;lt;code&amp;gt;def self.find_review_versions&amp;lt;/code&amp;gt;, which contains some statements in &amp;lt;code&amp;gt;def show_all_submitted_files&amp;lt;/code&amp;gt;.&lt;br /&gt;
  def self.find_review_versions(all_review_files) &lt;br /&gt;
    file_version_map = Hash.new&lt;br /&gt;
    all_review_files.each_with_index do |each_file,index|&lt;br /&gt;
      file_version_map[File.basename(each_file.filepath)] = Array.new unless&lt;br /&gt;
      file_version_map[File.basename(each_file.filepath)]&lt;br /&gt;
      file_version_map[File.basename(each_file.filepath)] &amp;lt;&amp;lt; each_file.version_number&lt;br /&gt;
    end&lt;br /&gt;
    return file_version_map&lt;br /&gt;
  end&lt;br /&gt;
==Refactoring &amp;lt;code&amp;gt;submitted_content_controller.rb&amp;lt;/code&amp;gt;==&lt;br /&gt;
1. Changed &amp;lt;code&amp;gt;and&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;or&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;&amp;amp;&amp;amp;&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;||&amp;lt;/code&amp;gt; to meet the requirements in the [https://docs.google.com/document/d/1qQD7fcypFk77nq7Jx7ZNyCNpLyt1oXKaq5G-W7zkV3k/edit Global Rules].&lt;br /&gt;
&lt;br /&gt;
2. Rewrited all &amp;lt;code&amp;gt;:key =&amp;gt; value&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;key: value format&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
3. Rewrited all param['string'] to params[:string].&lt;br /&gt;
&lt;br /&gt;
4. Added one more routes &amp;lt;code&amp;gt;post :folder_action&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;config/routes.rb&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
5. Changed all &amp;lt;code&amp;gt;array.size == 0&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;array.zero?&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
6. Changed all &amp;lt;code&amp;gt;find_by_x(val)&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;where(&amp;quot;x=val&amp;quot;)&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;where(x: val)&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
7. In &amp;lt;code&amp;gt;def remove_hyperlink&amp;lt;/code&amp;gt;, deleted redundant line:&lt;br /&gt;
 @participant = AssignmentParticipant.find(params[:id])&lt;br /&gt;
8. In &amp;lt;code&amp;gt;def download&amp;lt;/code&amp;gt;, deleted commented line:&lt;br /&gt;
 #folder_name = FileHelper::sanitize_folder(@current_folder.name)&lt;br /&gt;
&lt;br /&gt;
=Results Screenshot=&lt;br /&gt;
After fixing the bug #483, now the submit files function works.&lt;br /&gt;
&lt;br /&gt;
[[File:ossp2.png]]&lt;br /&gt;
&lt;br /&gt;
The file is stored at:&lt;br /&gt;
&lt;br /&gt;
[[File:ossp3.png]]&lt;br /&gt;
&lt;br /&gt;
= References=&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Pdeng</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015/oss_E1507_DG&amp;diff=96465</id>
		<title>CSC/ECE 517 Spring 2015/oss E1507 DG</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015/oss_E1507_DG&amp;diff=96465"/>
		<updated>2015-04-02T01:39:19Z</updated>

		<summary type="html">&lt;p&gt;Pdeng: /* Files involved */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''E1507. Refactoring Review Files Controller &amp;amp; Submitted Content Controller'''&lt;br /&gt;
&lt;br /&gt;
This page provides a description of the Expertiza based OSS project. This project aimed at refactoring the Review Files Controller &amp;amp; Submitted Content Controller as well as fixing the bug [https://github.com/expertiza/expertiza/issues/483 #483]&lt;br /&gt;
&lt;br /&gt;
=What is Expertiza=&lt;br /&gt;
[http://http://expertiza.ncsu.edu/ Expertiza] is a [http://en.wikipedia.org/wiki/Open-source_software Open Source] [http://rubyonrails.org/ Rails] application where students can submit and peer-review learning objects (articles, code, web sites, etc). It is used in select courses at NC State and by professors at several other colleges and universities.  This Open Source application can be cloned from [https://github.com/expertiza/expertiza/ Github], the latest active branch is [https://github.com/expertiza/expertiza/tree/rails4 &amp;quot;Rails 4&amp;quot;].&lt;br /&gt;
&lt;br /&gt;
=Project Desicription&amp;lt;ref&amp;gt;https://docs.google.com/document/d/1J0WUBtYV_MDhpEQ-50z8gXE-OrvVkpEaZxvn_9RCAsM/edit#&amp;lt;/ref&amp;gt;=&lt;br /&gt;
There are 5 major goals for this project:&lt;br /&gt;
&lt;br /&gt;
1. Fix Bug #483&amp;lt;ref&amp;gt;https://github.com/expertiza/expertiza/issues/483&amp;lt;/ref&amp;gt;, which causes some error and prevent users to get access to the submitted_content page.&lt;br /&gt;
&lt;br /&gt;
2.Break up the complex methods such as &amp;lt;code&amp;gt;get_comments&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;show_code_file_diff&amp;lt;/code&amp;gt;. Anything that can be modularized should be modularized (Single Responsibility)&lt;br /&gt;
&lt;br /&gt;
3.While breaking up the complex methods, look out for possible helper functions. If there are any, move them to the &amp;lt;code&amp;gt;review_files_helper.rb&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4.Remove commented out code from the controller&lt;br /&gt;
&lt;br /&gt;
5.Refactor the file based on Global Rules&amp;lt;ref&amp;gt;https://docs.google.com/document/d/1qQD7fcypFk77nq7Jx7ZNyCNpLyt1oXKaq5G-W7zkV3k/edit?usp=sharing&amp;lt;/ref&amp;gt;.&lt;br /&gt;
 &lt;br /&gt;
==Bug #483==&lt;br /&gt;
In &amp;quot;Your works&amp;quot; view, students can only submit links but no files.&lt;br /&gt;
&lt;br /&gt;
[[File:Ossp1.png]]&lt;br /&gt;
&lt;br /&gt;
This is caused by commit [https://github.com/expertiza/expertiza/commit/f313711fee2dd92e324603b9c506d9d5470c3b60 f313711] where the line 13 in [https://github.com/expertiza/expertiza/blob/f313711fee2dd92e324603b9c506d9d5470c3b60/app/views/submitted_content/_main.html.erb submitted_content/_main.html.erb] was commented out.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;%#= render partial: 'submitted_content/submitted_files', locals: {participant: @participant, stage: @stage} %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
But after uncommented line 13 in &amp;lt;code&amp;gt;submitted_content/_main.html.erb&amp;lt;/code&amp;gt; and refresh the page, the Rails Server stopped responding.&lt;br /&gt;
&lt;br /&gt;
==Refactoring Review Files Controller &amp;amp; Submitted Content Controller==&lt;br /&gt;
===What they do===&lt;br /&gt;
This [https://github.com/expertiza/expertiza/blob/rails4/app/controllers/review_files_controller.rb review_files_controller.rb] is responsible for handling the review files of the participants. This controller helps in uploading newer versions of reviews for an assignment and also in displaying all the versions (and diff between versions/code) with the help of [https://github.com/expertiza/expertiza/blob/rails4/app/controllers/submitted_content_controller.rb submitted_content_controller.rb].&lt;br /&gt;
===What’s wrong with them===&lt;br /&gt;
There are quite a few complex functions inside these controllers. These functions can easily be broken up into much more smaller methods with specific functionalities. They also need to be refactored to meet the [https://docs.google.com/document/d/1qQD7fcypFk77nq7Jx7ZNyCNpLyt1oXKaq5G-W7zkV3k/edit Global Rules].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Changes Made=&lt;br /&gt;
==Files involved==&lt;br /&gt;
1. review_files_controller.rb&lt;br /&gt;
2. submitted_content_controller.rb&lt;br /&gt;
3. review_files_helper.rb&lt;br /&gt;
4. review_comments_helper.rb&lt;br /&gt;
5. submitted_content/_main.html.erb&lt;br /&gt;
6. model/assignment.rb&lt;br /&gt;
&lt;br /&gt;
==For Bug #483 fixing==&lt;br /&gt;
Git log can be viewed in commit [https://github.com/KeleiAzz/expertiza/commit/aa37e2e61d0bf93a9bd0707621cd764017252f58 aa37e2e]&lt;br /&gt;
&lt;br /&gt;
1. In &amp;lt;code&amp;gt;submitted_content_controller.rb&amp;lt;/code&amp;gt;, line 19. &lt;br /&gt;
 if @assignment.max_team_size &amp;gt; 1 &amp;amp;&amp;amp; @participant.team.nil?&lt;br /&gt;
      flash[:error] = &amp;quot;This is a team assignment. Before submitting your work, you must &amp;lt;a style='color: blue;' href='../../student_teams/view/?student_id=#{params[:id]}'&amp;gt;create a team&amp;lt;/a&amp;gt;, &lt;br /&gt;
                      even if you will be the only member of the team&amp;quot;&lt;br /&gt;
      redirect_to controller: 'student_task', action: 'view', id: params[:id]&lt;br /&gt;
 else if @participant.team.nil?&lt;br /&gt;
      #create a new team for current user before submission&lt;br /&gt;
      team = AssignmentTeam.create_team_and_node(@assignment.id)&lt;br /&gt;
      team.add_member(User.find(@participant.user_id),@assignment.id)&lt;br /&gt;
 end&lt;br /&gt;
This &amp;lt;code&amp;gt;else if&amp;lt;/code&amp;gt; must be a mistake, so we changed it to:&lt;br /&gt;
 &amp;lt;code&amp;gt;elsif @participant.team.nil?&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2. In &amp;lt;code&amp;gt;model/assignment.rb&amp;lt;/code&amp;gt;, line 489. &lt;br /&gt;
 &amp;lt;code&amp;gt;Course.find(self.course_id).get_path&amp;lt;/code&amp;gt;&lt;br /&gt;
The &amp;lt;code&amp;gt;Course&amp;lt;/code&amp;gt; model doesn't have an attribute called &amp;lt;code&amp;gt;get_path&amp;lt;/code&amp;gt;, it should be &amp;lt;code&amp;gt;directory_path&amp;lt;/code&amp;gt;, so we changed it to&lt;br /&gt;
 &amp;lt;code&amp;gt;Course.find(self.course_id).directory_path&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3. In &amp;lt;code&amp;gt;submitted_content/_main.html.erb&amp;lt;/code&amp;gt;, line 18.&lt;br /&gt;
 &amp;lt;% if participant.assignment.is_coding_assignment%&amp;gt;&lt;br /&gt;
      &amp;lt;%= link_to &amp;quot;Code Review Dashboard&amp;quot;, :controller =&amp;gt; 'review_files',&lt;br /&gt;
        :action =&amp;gt; 'show_all_submitted_files',&lt;br /&gt;
        :participant_id =&amp;gt; assignment_participant.id,&lt;br /&gt;
        :stage =&amp;gt; stage %&amp;gt;&lt;br /&gt;
    &amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
 &amp;lt;% end %&amp;gt;&lt;br /&gt;
As in this page there doesn't have a parameter called &amp;lt;code&amp;gt;assignment_participant&amp;lt;/code&amp;gt;, as it need to get the participant's id, so we changed this line to:&lt;br /&gt;
 &amp;lt;code&amp;gt;:participant_id =&amp;gt; participant.id&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4. In &amp;lt;code&amp;gt;config/routes.rb&amp;lt;/code&amp;gt;. Added one more routes&lt;br /&gt;
 &amp;lt;code&amp;gt;post :submit_file&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Refactoring &amp;lt;code&amp;gt;review_files_controller.rb&amp;lt;/code&amp;gt;==&lt;br /&gt;
&lt;br /&gt;
1. Changed &amp;lt;code&amp;gt;and&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;or&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;&amp;amp;&amp;amp;&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;||&amp;lt;/code&amp;gt; to meet the requirements in the [https://docs.google.com/document/d/1qQD7fcypFk77nq7Jx7ZNyCNpLyt1oXKaq5G-W7zkV3k/edit Global Rules].&lt;br /&gt;
&lt;br /&gt;
2. In &amp;lt;code&amp;gt;def get_comments&amp;lt;/code&amp;gt;, deleted unused variable:&lt;br /&gt;
 &amp;lt;code&amp;gt;newobj = ReviewComment.where(review_file_id: params[:file_id])&amp;lt;/code&amp;gt;;&lt;br /&gt;
&lt;br /&gt;
3. In &amp;lt;code&amp;gt;def show_all_submitted_files&amp;lt;/code&amp;gt;, deleted unused variable: &lt;br /&gt;
 file_path = ReviewFile.get_file(code_review_dir, versions.sort.last,base_filename)&lt;br /&gt;
&lt;br /&gt;
4. In &amp;lt;code&amp;gt;def show_all_submitted_files&amp;lt;/code&amp;gt;, deleted unused variable:&lt;br /&gt;
 code_review_dir = ReviewFilesHelper::get_code_review_file_dir(AssignmentParticipant.find(auth[base_filename][versions.sort.last]))&lt;br /&gt;
&lt;br /&gt;
5. The method &amp;lt;code&amp;gt;def get_comments&amp;lt;/code&amp;gt; is too complex, so we modularized part of its code in &amp;lt;code&amp;gt;review_comments_helper.rb&amp;lt;/code&amp;gt;, we created a new method: &amp;lt;code&amp;gt;def self.populate_comments&amp;lt;/code&amp;gt;, which returns &amp;lt;code&amp;gt;handle, comment, authorflag&amp;lt;/code&amp;gt; these three variables.&lt;br /&gt;
  def self.populate_comments(params, authorflag, comment)&lt;br /&gt;
    assignmentparticipant = AssignmentParticipant.find(params[:participant_id])&lt;br /&gt;
    current_participant = AssignmentParticipant.where(parent_id: assignmentparticipant[:parent_id], user_id: session[:user].id).first&lt;br /&gt;
    if current_participant.id.to_s == params[:participant_id]&lt;br /&gt;
      authorflag = 1&lt;br /&gt;
    else&lt;br /&gt;
      authorflag = 0&lt;br /&gt;
    end&lt;br /&gt;
    member = []&lt;br /&gt;
    if assignmentparticipant.assignment.team_assignment&lt;br /&gt;
      assignmentparticipant.team.get_participants.each_with_index {|member1, index|&lt;br /&gt;
        member[index] = member1.id&lt;br /&gt;
      }&lt;br /&gt;
    end&lt;br /&gt;
    if (comment[:reviewer_participant_id] ==  current_participant.id)&lt;br /&gt;
      handle = &amp;quot;Me :&amp;quot;&lt;br /&gt;
      authorflag = 0&lt;br /&gt;
    elsif member.include? comment[:reviewer_participant_id] || comment[:reviewer_participant_id] == assignmentparticipant.id&lt;br /&gt;
      handle = &amp;quot;Author :&amp;quot;&lt;br /&gt;
      authorflag = 0&lt;br /&gt;
    else&lt;br /&gt;
      handle = &amp;quot;Reviewer&amp;quot;+comment[:reviewer_participant_id].to_s&lt;br /&gt;
    end&lt;br /&gt;
    return handle, comment, authorflag&lt;br /&gt;
  end&lt;br /&gt;
6. Rewrited all &amp;lt;code&amp;gt;:key =&amp;gt; value&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;key: value format&amp;lt;/code&amp;gt; according to the requirements in the '''Global Rules'''&amp;lt;ref&amp;gt;https://docs.google.com/document/d/1qQD7fcypFk77nq7Jx7ZNyCNpLyt1oXKaq5G-W7zkV3k/edit&amp;lt;/ref&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
7. The method &amp;lt;code&amp;gt;def show_code_files_diffIn&amp;lt;/code&amp;gt; is too complex, we created a new method: &amp;lt;code&amp;gt;def self.populate_shareObj &amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;review_files_helper.rb&amp;lt;/code&amp;gt; to perform part of the &amp;lt;code&amp;gt;show_code_files_diff&amp;lt;/code&amp;gt;.&lt;br /&gt;
  def self.populate_shareObj(processor)&lt;br /&gt;
    first_line_num = []&lt;br /&gt;
    second_line_num = []&lt;br /&gt;
    first_offset = []&lt;br /&gt;
    second_offset = []&lt;br /&gt;
    offsetswithcomments_file1 = []&lt;br /&gt;
    offsetswithcomments_file2 = []&lt;br /&gt;
    first_offset &amp;lt;&amp;lt; 0&lt;br /&gt;
    second_offset &amp;lt;&amp;lt; 0&lt;br /&gt;
    first_count = 0&lt;br /&gt;
    second_count = 0&lt;br /&gt;
    for i in (0..processor.absolute_line_num)&lt;br /&gt;
      first_offset = ReviewFile.get_first_offset(processor, i, @first_offset)&lt;br /&gt;
      second_offset = ReviewFile.get_second_offset(processor, i, @second_offset)&lt;br /&gt;
      first_line_num_new = Hash.new&lt;br /&gt;
      first_line_num_new = ReviewFile.get_first_line_num(processor, i, first_count)&lt;br /&gt;
      first_line_num &amp;lt;&amp;lt; first_line_num[:first_line_num]&lt;br /&gt;
      first_count = first_line_num[:first_count]&lt;br /&gt;
      second_line_num_new = Hash.new&lt;br /&gt;
      second_line_num_new = ReviewFile.get_second_line_num(processor, i,second_count)&lt;br /&gt;
      second_line_num &amp;lt;&amp;lt; second_line_num[:second_line_num]&lt;br /&gt;
      second_count = second_line_num[:second_count]&lt;br /&gt;
      # Remove newlines at the end of this line of code&lt;br /&gt;
      processor = ReviewFile.get_first_file_array(processor, i)&lt;br /&gt;
      processor = ReviewFile.get_second_file_array(processor, i)&lt;br /&gt;
      shareObj = Hash.new()&lt;br /&gt;
      shareObj['linearray1'] = processor.first_file_array&lt;br /&gt;
      shareObj['linearray2'] = processor.second_file_array&lt;br /&gt;
      shareObj['comparator'] = processor.comparison_array&lt;br /&gt;
      shareObj['linenumarray1'] = first_line_num&lt;br /&gt;
      shareObj['linenumarray2'] = second_line_num&lt;br /&gt;
      shareObj['offsetarray1'] = first_offset&lt;br /&gt;
      shareObj['offsetarray2'] = second_offset&lt;br /&gt;
      return first_line_num, second_line_num, first_count, second_count, shareObj&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
8. In &amp;lt;code&amp;gt;review_files_helper.rb&amp;lt;/code&amp;gt;, created a new method: &amp;lt;code&amp;gt;def self.find_review_files&amp;lt;/code&amp;gt;, which contains some statements in &amp;lt;code&amp;gt;def show_all_submitted_files&amp;lt;/code&amp;gt;.&lt;br /&gt;
  def self.find_review_files(participant) &lt;br /&gt;
    # Find all files over all versions submitted by the team&lt;br /&gt;
    all_review_files = Array.new&lt;br /&gt;
    if participant.assignment.team_assignment&lt;br /&gt;
      participant.team.get_participants.each_with_index { |member,index|&lt;br /&gt;
        all_review_files += ReviewFile.where(author_participant_id: member.id)&lt;br /&gt;
      }&lt;br /&gt;
    else&lt;br /&gt;
      all_review_files = ReviewFile.where(author_participant_id: @participant.id)&lt;br /&gt;
    end&lt;br /&gt;
    all_review_files&lt;br /&gt;
  end&lt;br /&gt;
9. In &amp;lt;code&amp;gt;review_files_helper.rb&amp;lt;/code&amp;gt;, created a new method: &amp;lt;code&amp;gt;def self.find_review_versions&amp;lt;/code&amp;gt;, which contains some statements in &amp;lt;code&amp;gt;def show_all_submitted_files&amp;lt;/code&amp;gt;.&lt;br /&gt;
  def self.find_review_versions(all_review_files) &lt;br /&gt;
    file_version_map = Hash.new&lt;br /&gt;
    all_review_files.each_with_index do |each_file,index|&lt;br /&gt;
      file_version_map[File.basename(each_file.filepath)] = Array.new unless&lt;br /&gt;
      file_version_map[File.basename(each_file.filepath)]&lt;br /&gt;
      file_version_map[File.basename(each_file.filepath)] &amp;lt;&amp;lt; each_file.version_number&lt;br /&gt;
    end&lt;br /&gt;
    return file_version_map&lt;br /&gt;
  end&lt;br /&gt;
==Refactoring &amp;lt;code&amp;gt;submitted_content_controller.rb&amp;lt;/code&amp;gt;==&lt;br /&gt;
1. Changed &amp;lt;code&amp;gt;and&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;or&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;&amp;amp;&amp;amp;&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;||&amp;lt;/code&amp;gt; to meet the requirements in the [https://docs.google.com/document/d/1qQD7fcypFk77nq7Jx7ZNyCNpLyt1oXKaq5G-W7zkV3k/edit Global Rules].&lt;br /&gt;
&lt;br /&gt;
2. Rewrited all &amp;lt;code&amp;gt;:key =&amp;gt; value&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;key: value format&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
3. Rewrited all param['string'] to params[:string].&lt;br /&gt;
&lt;br /&gt;
4. Added one more routes &amp;lt;code&amp;gt;post :folder_action&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;config/routes.rb&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
5. Changed all &amp;lt;code&amp;gt;array.size == 0&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;array.zero?&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
6. Changed all &amp;lt;code&amp;gt;find_by_x(val)&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;where(&amp;quot;x=val&amp;quot;)&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;where(x: val)&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
7. In &amp;lt;code&amp;gt;def remove_hyperlink&amp;lt;/code&amp;gt;, deleted redundant line:&lt;br /&gt;
 @participant = AssignmentParticipant.find(params[:id])&lt;br /&gt;
8. In &amp;lt;code&amp;gt;def download&amp;lt;/code&amp;gt;, deleted commented line:&lt;br /&gt;
 #folder_name = FileHelper::sanitize_folder(@current_folder.name)&lt;br /&gt;
&lt;br /&gt;
=Results Screenshot=&lt;br /&gt;
After fixing the bug #483, now the submit files function works.&lt;br /&gt;
&lt;br /&gt;
[[File:ossp2.png]]&lt;br /&gt;
&lt;br /&gt;
The file is stored at:&lt;br /&gt;
&lt;br /&gt;
[[File:ossp3.png]]&lt;br /&gt;
&lt;br /&gt;
= References=&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Pdeng</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015/oss_E1507_DG&amp;diff=96464</id>
		<title>CSC/ECE 517 Spring 2015/oss E1507 DG</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015/oss_E1507_DG&amp;diff=96464"/>
		<updated>2015-04-02T01:39:00Z</updated>

		<summary type="html">&lt;p&gt;Pdeng: /* Files involved */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''E1507. Refactoring Review Files Controller &amp;amp; Submitted Content Controller'''&lt;br /&gt;
&lt;br /&gt;
This page provides a description of the Expertiza based OSS project. This project aimed at refactoring the Review Files Controller &amp;amp; Submitted Content Controller as well as fixing the bug [https://github.com/expertiza/expertiza/issues/483 #483]&lt;br /&gt;
&lt;br /&gt;
=What is Expertiza=&lt;br /&gt;
[http://http://expertiza.ncsu.edu/ Expertiza] is a [http://en.wikipedia.org/wiki/Open-source_software Open Source] [http://rubyonrails.org/ Rails] application where students can submit and peer-review learning objects (articles, code, web sites, etc). It is used in select courses at NC State and by professors at several other colleges and universities.  This Open Source application can be cloned from [https://github.com/expertiza/expertiza/ Github], the latest active branch is [https://github.com/expertiza/expertiza/tree/rails4 &amp;quot;Rails 4&amp;quot;].&lt;br /&gt;
&lt;br /&gt;
=Project Desicription&amp;lt;ref&amp;gt;https://docs.google.com/document/d/1J0WUBtYV_MDhpEQ-50z8gXE-OrvVkpEaZxvn_9RCAsM/edit#&amp;lt;/ref&amp;gt;=&lt;br /&gt;
There are 5 major goals for this project:&lt;br /&gt;
&lt;br /&gt;
1. Fix Bug #483&amp;lt;ref&amp;gt;https://github.com/expertiza/expertiza/issues/483&amp;lt;/ref&amp;gt;, which causes some error and prevent users to get access to the submitted_content page.&lt;br /&gt;
&lt;br /&gt;
2.Break up the complex methods such as &amp;lt;code&amp;gt;get_comments&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;show_code_file_diff&amp;lt;/code&amp;gt;. Anything that can be modularized should be modularized (Single Responsibility)&lt;br /&gt;
&lt;br /&gt;
3.While breaking up the complex methods, look out for possible helper functions. If there are any, move them to the &amp;lt;code&amp;gt;review_files_helper.rb&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4.Remove commented out code from the controller&lt;br /&gt;
&lt;br /&gt;
5.Refactor the file based on Global Rules&amp;lt;ref&amp;gt;https://docs.google.com/document/d/1qQD7fcypFk77nq7Jx7ZNyCNpLyt1oXKaq5G-W7zkV3k/edit?usp=sharing&amp;lt;/ref&amp;gt;.&lt;br /&gt;
 &lt;br /&gt;
==Bug #483==&lt;br /&gt;
In &amp;quot;Your works&amp;quot; view, students can only submit links but no files.&lt;br /&gt;
&lt;br /&gt;
[[File:Ossp1.png]]&lt;br /&gt;
&lt;br /&gt;
This is caused by commit [https://github.com/expertiza/expertiza/commit/f313711fee2dd92e324603b9c506d9d5470c3b60 f313711] where the line 13 in [https://github.com/expertiza/expertiza/blob/f313711fee2dd92e324603b9c506d9d5470c3b60/app/views/submitted_content/_main.html.erb submitted_content/_main.html.erb] was commented out.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;%#= render partial: 'submitted_content/submitted_files', locals: {participant: @participant, stage: @stage} %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
But after uncommented line 13 in &amp;lt;code&amp;gt;submitted_content/_main.html.erb&amp;lt;/code&amp;gt; and refresh the page, the Rails Server stopped responding.&lt;br /&gt;
&lt;br /&gt;
==Refactoring Review Files Controller &amp;amp; Submitted Content Controller==&lt;br /&gt;
===What they do===&lt;br /&gt;
This [https://github.com/expertiza/expertiza/blob/rails4/app/controllers/review_files_controller.rb review_files_controller.rb] is responsible for handling the review files of the participants. This controller helps in uploading newer versions of reviews for an assignment and also in displaying all the versions (and diff between versions/code) with the help of [https://github.com/expertiza/expertiza/blob/rails4/app/controllers/submitted_content_controller.rb submitted_content_controller.rb].&lt;br /&gt;
===What’s wrong with them===&lt;br /&gt;
There are quite a few complex functions inside these controllers. These functions can easily be broken up into much more smaller methods with specific functionalities. They also need to be refactored to meet the [https://docs.google.com/document/d/1qQD7fcypFk77nq7Jx7ZNyCNpLyt1oXKaq5G-W7zkV3k/edit Global Rules].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Changes Made=&lt;br /&gt;
==Files involved==&lt;br /&gt;
 1. review_files_controller.rb&lt;br /&gt;
 2. submitted_content_controller.rb&lt;br /&gt;
 3. review_files_helper.rb&lt;br /&gt;
 4. review_comments_helper.rb&lt;br /&gt;
 5. submitted_content/_main.html.erb&lt;br /&gt;
 6. model/assignment.rb&lt;br /&gt;
&lt;br /&gt;
==For Bug #483 fixing==&lt;br /&gt;
Git log can be viewed in commit [https://github.com/KeleiAzz/expertiza/commit/aa37e2e61d0bf93a9bd0707621cd764017252f58 aa37e2e]&lt;br /&gt;
&lt;br /&gt;
1. In &amp;lt;code&amp;gt;submitted_content_controller.rb&amp;lt;/code&amp;gt;, line 19. &lt;br /&gt;
 if @assignment.max_team_size &amp;gt; 1 &amp;amp;&amp;amp; @participant.team.nil?&lt;br /&gt;
      flash[:error] = &amp;quot;This is a team assignment. Before submitting your work, you must &amp;lt;a style='color: blue;' href='../../student_teams/view/?student_id=#{params[:id]}'&amp;gt;create a team&amp;lt;/a&amp;gt;, &lt;br /&gt;
                      even if you will be the only member of the team&amp;quot;&lt;br /&gt;
      redirect_to controller: 'student_task', action: 'view', id: params[:id]&lt;br /&gt;
 else if @participant.team.nil?&lt;br /&gt;
      #create a new team for current user before submission&lt;br /&gt;
      team = AssignmentTeam.create_team_and_node(@assignment.id)&lt;br /&gt;
      team.add_member(User.find(@participant.user_id),@assignment.id)&lt;br /&gt;
 end&lt;br /&gt;
This &amp;lt;code&amp;gt;else if&amp;lt;/code&amp;gt; must be a mistake, so we changed it to:&lt;br /&gt;
 &amp;lt;code&amp;gt;elsif @participant.team.nil?&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2. In &amp;lt;code&amp;gt;model/assignment.rb&amp;lt;/code&amp;gt;, line 489. &lt;br /&gt;
 &amp;lt;code&amp;gt;Course.find(self.course_id).get_path&amp;lt;/code&amp;gt;&lt;br /&gt;
The &amp;lt;code&amp;gt;Course&amp;lt;/code&amp;gt; model doesn't have an attribute called &amp;lt;code&amp;gt;get_path&amp;lt;/code&amp;gt;, it should be &amp;lt;code&amp;gt;directory_path&amp;lt;/code&amp;gt;, so we changed it to&lt;br /&gt;
 &amp;lt;code&amp;gt;Course.find(self.course_id).directory_path&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3. In &amp;lt;code&amp;gt;submitted_content/_main.html.erb&amp;lt;/code&amp;gt;, line 18.&lt;br /&gt;
 &amp;lt;% if participant.assignment.is_coding_assignment%&amp;gt;&lt;br /&gt;
      &amp;lt;%= link_to &amp;quot;Code Review Dashboard&amp;quot;, :controller =&amp;gt; 'review_files',&lt;br /&gt;
        :action =&amp;gt; 'show_all_submitted_files',&lt;br /&gt;
        :participant_id =&amp;gt; assignment_participant.id,&lt;br /&gt;
        :stage =&amp;gt; stage %&amp;gt;&lt;br /&gt;
    &amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
 &amp;lt;% end %&amp;gt;&lt;br /&gt;
As in this page there doesn't have a parameter called &amp;lt;code&amp;gt;assignment_participant&amp;lt;/code&amp;gt;, as it need to get the participant's id, so we changed this line to:&lt;br /&gt;
 &amp;lt;code&amp;gt;:participant_id =&amp;gt; participant.id&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4. In &amp;lt;code&amp;gt;config/routes.rb&amp;lt;/code&amp;gt;. Added one more routes&lt;br /&gt;
 &amp;lt;code&amp;gt;post :submit_file&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Refactoring &amp;lt;code&amp;gt;review_files_controller.rb&amp;lt;/code&amp;gt;==&lt;br /&gt;
&lt;br /&gt;
1. Changed &amp;lt;code&amp;gt;and&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;or&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;&amp;amp;&amp;amp;&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;||&amp;lt;/code&amp;gt; to meet the requirements in the [https://docs.google.com/document/d/1qQD7fcypFk77nq7Jx7ZNyCNpLyt1oXKaq5G-W7zkV3k/edit Global Rules].&lt;br /&gt;
&lt;br /&gt;
2. In &amp;lt;code&amp;gt;def get_comments&amp;lt;/code&amp;gt;, deleted unused variable:&lt;br /&gt;
 &amp;lt;code&amp;gt;newobj = ReviewComment.where(review_file_id: params[:file_id])&amp;lt;/code&amp;gt;;&lt;br /&gt;
&lt;br /&gt;
3. In &amp;lt;code&amp;gt;def show_all_submitted_files&amp;lt;/code&amp;gt;, deleted unused variable: &lt;br /&gt;
 file_path = ReviewFile.get_file(code_review_dir, versions.sort.last,base_filename)&lt;br /&gt;
&lt;br /&gt;
4. In &amp;lt;code&amp;gt;def show_all_submitted_files&amp;lt;/code&amp;gt;, deleted unused variable:&lt;br /&gt;
 code_review_dir = ReviewFilesHelper::get_code_review_file_dir(AssignmentParticipant.find(auth[base_filename][versions.sort.last]))&lt;br /&gt;
&lt;br /&gt;
5. The method &amp;lt;code&amp;gt;def get_comments&amp;lt;/code&amp;gt; is too complex, so we modularized part of its code in &amp;lt;code&amp;gt;review_comments_helper.rb&amp;lt;/code&amp;gt;, we created a new method: &amp;lt;code&amp;gt;def self.populate_comments&amp;lt;/code&amp;gt;, which returns &amp;lt;code&amp;gt;handle, comment, authorflag&amp;lt;/code&amp;gt; these three variables.&lt;br /&gt;
  def self.populate_comments(params, authorflag, comment)&lt;br /&gt;
    assignmentparticipant = AssignmentParticipant.find(params[:participant_id])&lt;br /&gt;
    current_participant = AssignmentParticipant.where(parent_id: assignmentparticipant[:parent_id], user_id: session[:user].id).first&lt;br /&gt;
    if current_participant.id.to_s == params[:participant_id]&lt;br /&gt;
      authorflag = 1&lt;br /&gt;
    else&lt;br /&gt;
      authorflag = 0&lt;br /&gt;
    end&lt;br /&gt;
    member = []&lt;br /&gt;
    if assignmentparticipant.assignment.team_assignment&lt;br /&gt;
      assignmentparticipant.team.get_participants.each_with_index {|member1, index|&lt;br /&gt;
        member[index] = member1.id&lt;br /&gt;
      }&lt;br /&gt;
    end&lt;br /&gt;
    if (comment[:reviewer_participant_id] ==  current_participant.id)&lt;br /&gt;
      handle = &amp;quot;Me :&amp;quot;&lt;br /&gt;
      authorflag = 0&lt;br /&gt;
    elsif member.include? comment[:reviewer_participant_id] || comment[:reviewer_participant_id] == assignmentparticipant.id&lt;br /&gt;
      handle = &amp;quot;Author :&amp;quot;&lt;br /&gt;
      authorflag = 0&lt;br /&gt;
    else&lt;br /&gt;
      handle = &amp;quot;Reviewer&amp;quot;+comment[:reviewer_participant_id].to_s&lt;br /&gt;
    end&lt;br /&gt;
    return handle, comment, authorflag&lt;br /&gt;
  end&lt;br /&gt;
6. Rewrited all &amp;lt;code&amp;gt;:key =&amp;gt; value&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;key: value format&amp;lt;/code&amp;gt; according to the requirements in the '''Global Rules'''&amp;lt;ref&amp;gt;https://docs.google.com/document/d/1qQD7fcypFk77nq7Jx7ZNyCNpLyt1oXKaq5G-W7zkV3k/edit&amp;lt;/ref&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
7. The method &amp;lt;code&amp;gt;def show_code_files_diffIn&amp;lt;/code&amp;gt; is too complex, we created a new method: &amp;lt;code&amp;gt;def self.populate_shareObj &amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;review_files_helper.rb&amp;lt;/code&amp;gt; to perform part of the &amp;lt;code&amp;gt;show_code_files_diff&amp;lt;/code&amp;gt;.&lt;br /&gt;
  def self.populate_shareObj(processor)&lt;br /&gt;
    first_line_num = []&lt;br /&gt;
    second_line_num = []&lt;br /&gt;
    first_offset = []&lt;br /&gt;
    second_offset = []&lt;br /&gt;
    offsetswithcomments_file1 = []&lt;br /&gt;
    offsetswithcomments_file2 = []&lt;br /&gt;
    first_offset &amp;lt;&amp;lt; 0&lt;br /&gt;
    second_offset &amp;lt;&amp;lt; 0&lt;br /&gt;
    first_count = 0&lt;br /&gt;
    second_count = 0&lt;br /&gt;
    for i in (0..processor.absolute_line_num)&lt;br /&gt;
      first_offset = ReviewFile.get_first_offset(processor, i, @first_offset)&lt;br /&gt;
      second_offset = ReviewFile.get_second_offset(processor, i, @second_offset)&lt;br /&gt;
      first_line_num_new = Hash.new&lt;br /&gt;
      first_line_num_new = ReviewFile.get_first_line_num(processor, i, first_count)&lt;br /&gt;
      first_line_num &amp;lt;&amp;lt; first_line_num[:first_line_num]&lt;br /&gt;
      first_count = first_line_num[:first_count]&lt;br /&gt;
      second_line_num_new = Hash.new&lt;br /&gt;
      second_line_num_new = ReviewFile.get_second_line_num(processor, i,second_count)&lt;br /&gt;
      second_line_num &amp;lt;&amp;lt; second_line_num[:second_line_num]&lt;br /&gt;
      second_count = second_line_num[:second_count]&lt;br /&gt;
      # Remove newlines at the end of this line of code&lt;br /&gt;
      processor = ReviewFile.get_first_file_array(processor, i)&lt;br /&gt;
      processor = ReviewFile.get_second_file_array(processor, i)&lt;br /&gt;
      shareObj = Hash.new()&lt;br /&gt;
      shareObj['linearray1'] = processor.first_file_array&lt;br /&gt;
      shareObj['linearray2'] = processor.second_file_array&lt;br /&gt;
      shareObj['comparator'] = processor.comparison_array&lt;br /&gt;
      shareObj['linenumarray1'] = first_line_num&lt;br /&gt;
      shareObj['linenumarray2'] = second_line_num&lt;br /&gt;
      shareObj['offsetarray1'] = first_offset&lt;br /&gt;
      shareObj['offsetarray2'] = second_offset&lt;br /&gt;
      return first_line_num, second_line_num, first_count, second_count, shareObj&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
8. In &amp;lt;code&amp;gt;review_files_helper.rb&amp;lt;/code&amp;gt;, created a new method: &amp;lt;code&amp;gt;def self.find_review_files&amp;lt;/code&amp;gt;, which contains some statements in &amp;lt;code&amp;gt;def show_all_submitted_files&amp;lt;/code&amp;gt;.&lt;br /&gt;
  def self.find_review_files(participant) &lt;br /&gt;
    # Find all files over all versions submitted by the team&lt;br /&gt;
    all_review_files = Array.new&lt;br /&gt;
    if participant.assignment.team_assignment&lt;br /&gt;
      participant.team.get_participants.each_with_index { |member,index|&lt;br /&gt;
        all_review_files += ReviewFile.where(author_participant_id: member.id)&lt;br /&gt;
      }&lt;br /&gt;
    else&lt;br /&gt;
      all_review_files = ReviewFile.where(author_participant_id: @participant.id)&lt;br /&gt;
    end&lt;br /&gt;
    all_review_files&lt;br /&gt;
  end&lt;br /&gt;
9. In &amp;lt;code&amp;gt;review_files_helper.rb&amp;lt;/code&amp;gt;, created a new method: &amp;lt;code&amp;gt;def self.find_review_versions&amp;lt;/code&amp;gt;, which contains some statements in &amp;lt;code&amp;gt;def show_all_submitted_files&amp;lt;/code&amp;gt;.&lt;br /&gt;
  def self.find_review_versions(all_review_files) &lt;br /&gt;
    file_version_map = Hash.new&lt;br /&gt;
    all_review_files.each_with_index do |each_file,index|&lt;br /&gt;
      file_version_map[File.basename(each_file.filepath)] = Array.new unless&lt;br /&gt;
      file_version_map[File.basename(each_file.filepath)]&lt;br /&gt;
      file_version_map[File.basename(each_file.filepath)] &amp;lt;&amp;lt; each_file.version_number&lt;br /&gt;
    end&lt;br /&gt;
    return file_version_map&lt;br /&gt;
  end&lt;br /&gt;
==Refactoring &amp;lt;code&amp;gt;submitted_content_controller.rb&amp;lt;/code&amp;gt;==&lt;br /&gt;
1. Changed &amp;lt;code&amp;gt;and&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;or&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;&amp;amp;&amp;amp;&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;||&amp;lt;/code&amp;gt; to meet the requirements in the [https://docs.google.com/document/d/1qQD7fcypFk77nq7Jx7ZNyCNpLyt1oXKaq5G-W7zkV3k/edit Global Rules].&lt;br /&gt;
&lt;br /&gt;
2. Rewrited all &amp;lt;code&amp;gt;:key =&amp;gt; value&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;key: value format&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
3. Rewrited all param['string'] to params[:string].&lt;br /&gt;
&lt;br /&gt;
4. Added one more routes &amp;lt;code&amp;gt;post :folder_action&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;config/routes.rb&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
5. Changed all &amp;lt;code&amp;gt;array.size == 0&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;array.zero?&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
6. Changed all &amp;lt;code&amp;gt;find_by_x(val)&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;where(&amp;quot;x=val&amp;quot;)&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;where(x: val)&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
7. In &amp;lt;code&amp;gt;def remove_hyperlink&amp;lt;/code&amp;gt;, deleted redundant line:&lt;br /&gt;
 @participant = AssignmentParticipant.find(params[:id])&lt;br /&gt;
8. In &amp;lt;code&amp;gt;def download&amp;lt;/code&amp;gt;, deleted commented line:&lt;br /&gt;
 #folder_name = FileHelper::sanitize_folder(@current_folder.name)&lt;br /&gt;
&lt;br /&gt;
=Results Screenshot=&lt;br /&gt;
After fixing the bug #483, now the submit files function works.&lt;br /&gt;
&lt;br /&gt;
[[File:ossp2.png]]&lt;br /&gt;
&lt;br /&gt;
The file is stored at:&lt;br /&gt;
&lt;br /&gt;
[[File:ossp3.png]]&lt;br /&gt;
&lt;br /&gt;
= References=&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Pdeng</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015/oss_E1507_DG&amp;diff=96463</id>
		<title>CSC/ECE 517 Spring 2015/oss E1507 DG</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015/oss_E1507_DG&amp;diff=96463"/>
		<updated>2015-04-02T01:38:29Z</updated>

		<summary type="html">&lt;p&gt;Pdeng: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''E1507. Refactoring Review Files Controller &amp;amp; Submitted Content Controller'''&lt;br /&gt;
&lt;br /&gt;
This page provides a description of the Expertiza based OSS project. This project aimed at refactoring the Review Files Controller &amp;amp; Submitted Content Controller as well as fixing the bug [https://github.com/expertiza/expertiza/issues/483 #483]&lt;br /&gt;
&lt;br /&gt;
=What is Expertiza=&lt;br /&gt;
[http://http://expertiza.ncsu.edu/ Expertiza] is a [http://en.wikipedia.org/wiki/Open-source_software Open Source] [http://rubyonrails.org/ Rails] application where students can submit and peer-review learning objects (articles, code, web sites, etc). It is used in select courses at NC State and by professors at several other colleges and universities.  This Open Source application can be cloned from [https://github.com/expertiza/expertiza/ Github], the latest active branch is [https://github.com/expertiza/expertiza/tree/rails4 &amp;quot;Rails 4&amp;quot;].&lt;br /&gt;
&lt;br /&gt;
=Project Desicription&amp;lt;ref&amp;gt;https://docs.google.com/document/d/1J0WUBtYV_MDhpEQ-50z8gXE-OrvVkpEaZxvn_9RCAsM/edit#&amp;lt;/ref&amp;gt;=&lt;br /&gt;
There are 5 major goals for this project:&lt;br /&gt;
&lt;br /&gt;
1. Fix Bug #483&amp;lt;ref&amp;gt;https://github.com/expertiza/expertiza/issues/483&amp;lt;/ref&amp;gt;, which causes some error and prevent users to get access to the submitted_content page.&lt;br /&gt;
&lt;br /&gt;
2.Break up the complex methods such as &amp;lt;code&amp;gt;get_comments&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;show_code_file_diff&amp;lt;/code&amp;gt;. Anything that can be modularized should be modularized (Single Responsibility)&lt;br /&gt;
&lt;br /&gt;
3.While breaking up the complex methods, look out for possible helper functions. If there are any, move them to the &amp;lt;code&amp;gt;review_files_helper.rb&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4.Remove commented out code from the controller&lt;br /&gt;
&lt;br /&gt;
5.Refactor the file based on Global Rules&amp;lt;ref&amp;gt;https://docs.google.com/document/d/1qQD7fcypFk77nq7Jx7ZNyCNpLyt1oXKaq5G-W7zkV3k/edit?usp=sharing&amp;lt;/ref&amp;gt;.&lt;br /&gt;
 &lt;br /&gt;
==Bug #483==&lt;br /&gt;
In &amp;quot;Your works&amp;quot; view, students can only submit links but no files.&lt;br /&gt;
&lt;br /&gt;
[[File:Ossp1.png]]&lt;br /&gt;
&lt;br /&gt;
This is caused by commit [https://github.com/expertiza/expertiza/commit/f313711fee2dd92e324603b9c506d9d5470c3b60 f313711] where the line 13 in [https://github.com/expertiza/expertiza/blob/f313711fee2dd92e324603b9c506d9d5470c3b60/app/views/submitted_content/_main.html.erb submitted_content/_main.html.erb] was commented out.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;%#= render partial: 'submitted_content/submitted_files', locals: {participant: @participant, stage: @stage} %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
But after uncommented line 13 in &amp;lt;code&amp;gt;submitted_content/_main.html.erb&amp;lt;/code&amp;gt; and refresh the page, the Rails Server stopped responding.&lt;br /&gt;
&lt;br /&gt;
==Refactoring Review Files Controller &amp;amp; Submitted Content Controller==&lt;br /&gt;
===What they do===&lt;br /&gt;
This [https://github.com/expertiza/expertiza/blob/rails4/app/controllers/review_files_controller.rb review_files_controller.rb] is responsible for handling the review files of the participants. This controller helps in uploading newer versions of reviews for an assignment and also in displaying all the versions (and diff between versions/code) with the help of [https://github.com/expertiza/expertiza/blob/rails4/app/controllers/submitted_content_controller.rb submitted_content_controller.rb].&lt;br /&gt;
===What’s wrong with them===&lt;br /&gt;
There are quite a few complex functions inside these controllers. These functions can easily be broken up into much more smaller methods with specific functionalities. They also need to be refactored to meet the [https://docs.google.com/document/d/1qQD7fcypFk77nq7Jx7ZNyCNpLyt1oXKaq5G-W7zkV3k/edit Global Rules].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Changes Made=&lt;br /&gt;
==Files involved==&lt;br /&gt;
 review_files_controller.rb&lt;br /&gt;
 submitted_content_controller.rb&lt;br /&gt;
 review_files_helper.rb&lt;br /&gt;
 review_comments_helper.rb&lt;br /&gt;
 submitted_content/_main.html.erb&lt;br /&gt;
 model/assignment.rb&lt;br /&gt;
==For Bug #483 fixing==&lt;br /&gt;
Git log can be viewed in commit [https://github.com/KeleiAzz/expertiza/commit/aa37e2e61d0bf93a9bd0707621cd764017252f58 aa37e2e]&lt;br /&gt;
&lt;br /&gt;
1. In &amp;lt;code&amp;gt;submitted_content_controller.rb&amp;lt;/code&amp;gt;, line 19. &lt;br /&gt;
 if @assignment.max_team_size &amp;gt; 1 &amp;amp;&amp;amp; @participant.team.nil?&lt;br /&gt;
      flash[:error] = &amp;quot;This is a team assignment. Before submitting your work, you must &amp;lt;a style='color: blue;' href='../../student_teams/view/?student_id=#{params[:id]}'&amp;gt;create a team&amp;lt;/a&amp;gt;, &lt;br /&gt;
                      even if you will be the only member of the team&amp;quot;&lt;br /&gt;
      redirect_to controller: 'student_task', action: 'view', id: params[:id]&lt;br /&gt;
 else if @participant.team.nil?&lt;br /&gt;
      #create a new team for current user before submission&lt;br /&gt;
      team = AssignmentTeam.create_team_and_node(@assignment.id)&lt;br /&gt;
      team.add_member(User.find(@participant.user_id),@assignment.id)&lt;br /&gt;
 end&lt;br /&gt;
This &amp;lt;code&amp;gt;else if&amp;lt;/code&amp;gt; must be a mistake, so we changed it to:&lt;br /&gt;
 &amp;lt;code&amp;gt;elsif @participant.team.nil?&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2. In &amp;lt;code&amp;gt;model/assignment.rb&amp;lt;/code&amp;gt;, line 489. &lt;br /&gt;
 &amp;lt;code&amp;gt;Course.find(self.course_id).get_path&amp;lt;/code&amp;gt;&lt;br /&gt;
The &amp;lt;code&amp;gt;Course&amp;lt;/code&amp;gt; model doesn't have an attribute called &amp;lt;code&amp;gt;get_path&amp;lt;/code&amp;gt;, it should be &amp;lt;code&amp;gt;directory_path&amp;lt;/code&amp;gt;, so we changed it to&lt;br /&gt;
 &amp;lt;code&amp;gt;Course.find(self.course_id).directory_path&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3. In &amp;lt;code&amp;gt;submitted_content/_main.html.erb&amp;lt;/code&amp;gt;, line 18.&lt;br /&gt;
 &amp;lt;% if participant.assignment.is_coding_assignment%&amp;gt;&lt;br /&gt;
      &amp;lt;%= link_to &amp;quot;Code Review Dashboard&amp;quot;, :controller =&amp;gt; 'review_files',&lt;br /&gt;
        :action =&amp;gt; 'show_all_submitted_files',&lt;br /&gt;
        :participant_id =&amp;gt; assignment_participant.id,&lt;br /&gt;
        :stage =&amp;gt; stage %&amp;gt;&lt;br /&gt;
    &amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
 &amp;lt;% end %&amp;gt;&lt;br /&gt;
As in this page there doesn't have a parameter called &amp;lt;code&amp;gt;assignment_participant&amp;lt;/code&amp;gt;, as it need to get the participant's id, so we changed this line to:&lt;br /&gt;
 &amp;lt;code&amp;gt;:participant_id =&amp;gt; participant.id&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4. In &amp;lt;code&amp;gt;config/routes.rb&amp;lt;/code&amp;gt;. Added one more routes&lt;br /&gt;
 &amp;lt;code&amp;gt;post :submit_file&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Refactoring &amp;lt;code&amp;gt;review_files_controller.rb&amp;lt;/code&amp;gt;==&lt;br /&gt;
&lt;br /&gt;
1. Changed &amp;lt;code&amp;gt;and&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;or&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;&amp;amp;&amp;amp;&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;||&amp;lt;/code&amp;gt; to meet the requirements in the [https://docs.google.com/document/d/1qQD7fcypFk77nq7Jx7ZNyCNpLyt1oXKaq5G-W7zkV3k/edit Global Rules].&lt;br /&gt;
&lt;br /&gt;
2. In &amp;lt;code&amp;gt;def get_comments&amp;lt;/code&amp;gt;, deleted unused variable:&lt;br /&gt;
 &amp;lt;code&amp;gt;newobj = ReviewComment.where(review_file_id: params[:file_id])&amp;lt;/code&amp;gt;;&lt;br /&gt;
&lt;br /&gt;
3. In &amp;lt;code&amp;gt;def show_all_submitted_files&amp;lt;/code&amp;gt;, deleted unused variable: &lt;br /&gt;
 file_path = ReviewFile.get_file(code_review_dir, versions.sort.last,base_filename)&lt;br /&gt;
&lt;br /&gt;
4. In &amp;lt;code&amp;gt;def show_all_submitted_files&amp;lt;/code&amp;gt;, deleted unused variable:&lt;br /&gt;
 code_review_dir = ReviewFilesHelper::get_code_review_file_dir(AssignmentParticipant.find(auth[base_filename][versions.sort.last]))&lt;br /&gt;
&lt;br /&gt;
5. The method &amp;lt;code&amp;gt;def get_comments&amp;lt;/code&amp;gt; is too complex, so we modularized part of its code in &amp;lt;code&amp;gt;review_comments_helper.rb&amp;lt;/code&amp;gt;, we created a new method: &amp;lt;code&amp;gt;def self.populate_comments&amp;lt;/code&amp;gt;, which returns &amp;lt;code&amp;gt;handle, comment, authorflag&amp;lt;/code&amp;gt; these three variables.&lt;br /&gt;
  def self.populate_comments(params, authorflag, comment)&lt;br /&gt;
    assignmentparticipant = AssignmentParticipant.find(params[:participant_id])&lt;br /&gt;
    current_participant = AssignmentParticipant.where(parent_id: assignmentparticipant[:parent_id], user_id: session[:user].id).first&lt;br /&gt;
    if current_participant.id.to_s == params[:participant_id]&lt;br /&gt;
      authorflag = 1&lt;br /&gt;
    else&lt;br /&gt;
      authorflag = 0&lt;br /&gt;
    end&lt;br /&gt;
    member = []&lt;br /&gt;
    if assignmentparticipant.assignment.team_assignment&lt;br /&gt;
      assignmentparticipant.team.get_participants.each_with_index {|member1, index|&lt;br /&gt;
        member[index] = member1.id&lt;br /&gt;
      }&lt;br /&gt;
    end&lt;br /&gt;
    if (comment[:reviewer_participant_id] ==  current_participant.id)&lt;br /&gt;
      handle = &amp;quot;Me :&amp;quot;&lt;br /&gt;
      authorflag = 0&lt;br /&gt;
    elsif member.include? comment[:reviewer_participant_id] || comment[:reviewer_participant_id] == assignmentparticipant.id&lt;br /&gt;
      handle = &amp;quot;Author :&amp;quot;&lt;br /&gt;
      authorflag = 0&lt;br /&gt;
    else&lt;br /&gt;
      handle = &amp;quot;Reviewer&amp;quot;+comment[:reviewer_participant_id].to_s&lt;br /&gt;
    end&lt;br /&gt;
    return handle, comment, authorflag&lt;br /&gt;
  end&lt;br /&gt;
6. Rewrited all &amp;lt;code&amp;gt;:key =&amp;gt; value&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;key: value format&amp;lt;/code&amp;gt; according to the requirements in the '''Global Rules'''&amp;lt;ref&amp;gt;https://docs.google.com/document/d/1qQD7fcypFk77nq7Jx7ZNyCNpLyt1oXKaq5G-W7zkV3k/edit&amp;lt;/ref&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
7. The method &amp;lt;code&amp;gt;def show_code_files_diffIn&amp;lt;/code&amp;gt; is too complex, we created a new method: &amp;lt;code&amp;gt;def self.populate_shareObj &amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;review_files_helper.rb&amp;lt;/code&amp;gt; to perform part of the &amp;lt;code&amp;gt;show_code_files_diff&amp;lt;/code&amp;gt;.&lt;br /&gt;
  def self.populate_shareObj(processor)&lt;br /&gt;
    first_line_num = []&lt;br /&gt;
    second_line_num = []&lt;br /&gt;
    first_offset = []&lt;br /&gt;
    second_offset = []&lt;br /&gt;
    offsetswithcomments_file1 = []&lt;br /&gt;
    offsetswithcomments_file2 = []&lt;br /&gt;
    first_offset &amp;lt;&amp;lt; 0&lt;br /&gt;
    second_offset &amp;lt;&amp;lt; 0&lt;br /&gt;
    first_count = 0&lt;br /&gt;
    second_count = 0&lt;br /&gt;
    for i in (0..processor.absolute_line_num)&lt;br /&gt;
      first_offset = ReviewFile.get_first_offset(processor, i, @first_offset)&lt;br /&gt;
      second_offset = ReviewFile.get_second_offset(processor, i, @second_offset)&lt;br /&gt;
      first_line_num_new = Hash.new&lt;br /&gt;
      first_line_num_new = ReviewFile.get_first_line_num(processor, i, first_count)&lt;br /&gt;
      first_line_num &amp;lt;&amp;lt; first_line_num[:first_line_num]&lt;br /&gt;
      first_count = first_line_num[:first_count]&lt;br /&gt;
      second_line_num_new = Hash.new&lt;br /&gt;
      second_line_num_new = ReviewFile.get_second_line_num(processor, i,second_count)&lt;br /&gt;
      second_line_num &amp;lt;&amp;lt; second_line_num[:second_line_num]&lt;br /&gt;
      second_count = second_line_num[:second_count]&lt;br /&gt;
      # Remove newlines at the end of this line of code&lt;br /&gt;
      processor = ReviewFile.get_first_file_array(processor, i)&lt;br /&gt;
      processor = ReviewFile.get_second_file_array(processor, i)&lt;br /&gt;
      shareObj = Hash.new()&lt;br /&gt;
      shareObj['linearray1'] = processor.first_file_array&lt;br /&gt;
      shareObj['linearray2'] = processor.second_file_array&lt;br /&gt;
      shareObj['comparator'] = processor.comparison_array&lt;br /&gt;
      shareObj['linenumarray1'] = first_line_num&lt;br /&gt;
      shareObj['linenumarray2'] = second_line_num&lt;br /&gt;
      shareObj['offsetarray1'] = first_offset&lt;br /&gt;
      shareObj['offsetarray2'] = second_offset&lt;br /&gt;
      return first_line_num, second_line_num, first_count, second_count, shareObj&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
8. In &amp;lt;code&amp;gt;review_files_helper.rb&amp;lt;/code&amp;gt;, created a new method: &amp;lt;code&amp;gt;def self.find_review_files&amp;lt;/code&amp;gt;, which contains some statements in &amp;lt;code&amp;gt;def show_all_submitted_files&amp;lt;/code&amp;gt;.&lt;br /&gt;
  def self.find_review_files(participant) &lt;br /&gt;
    # Find all files over all versions submitted by the team&lt;br /&gt;
    all_review_files = Array.new&lt;br /&gt;
    if participant.assignment.team_assignment&lt;br /&gt;
      participant.team.get_participants.each_with_index { |member,index|&lt;br /&gt;
        all_review_files += ReviewFile.where(author_participant_id: member.id)&lt;br /&gt;
      }&lt;br /&gt;
    else&lt;br /&gt;
      all_review_files = ReviewFile.where(author_participant_id: @participant.id)&lt;br /&gt;
    end&lt;br /&gt;
    all_review_files&lt;br /&gt;
  end&lt;br /&gt;
9. In &amp;lt;code&amp;gt;review_files_helper.rb&amp;lt;/code&amp;gt;, created a new method: &amp;lt;code&amp;gt;def self.find_review_versions&amp;lt;/code&amp;gt;, which contains some statements in &amp;lt;code&amp;gt;def show_all_submitted_files&amp;lt;/code&amp;gt;.&lt;br /&gt;
  def self.find_review_versions(all_review_files) &lt;br /&gt;
    file_version_map = Hash.new&lt;br /&gt;
    all_review_files.each_with_index do |each_file,index|&lt;br /&gt;
      file_version_map[File.basename(each_file.filepath)] = Array.new unless&lt;br /&gt;
      file_version_map[File.basename(each_file.filepath)]&lt;br /&gt;
      file_version_map[File.basename(each_file.filepath)] &amp;lt;&amp;lt; each_file.version_number&lt;br /&gt;
    end&lt;br /&gt;
    return file_version_map&lt;br /&gt;
  end&lt;br /&gt;
==Refactoring &amp;lt;code&amp;gt;submitted_content_controller.rb&amp;lt;/code&amp;gt;==&lt;br /&gt;
1. Changed &amp;lt;code&amp;gt;and&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;or&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;&amp;amp;&amp;amp;&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;||&amp;lt;/code&amp;gt; to meet the requirements in the [https://docs.google.com/document/d/1qQD7fcypFk77nq7Jx7ZNyCNpLyt1oXKaq5G-W7zkV3k/edit Global Rules].&lt;br /&gt;
&lt;br /&gt;
2. Rewrited all &amp;lt;code&amp;gt;:key =&amp;gt; value&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;key: value format&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
3. Rewrited all param['string'] to params[:string].&lt;br /&gt;
&lt;br /&gt;
4. Added one more routes &amp;lt;code&amp;gt;post :folder_action&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;config/routes.rb&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
5. Changed all &amp;lt;code&amp;gt;array.size == 0&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;array.zero?&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
6. Changed all &amp;lt;code&amp;gt;find_by_x(val)&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;where(&amp;quot;x=val&amp;quot;)&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;where(x: val)&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
7. In &amp;lt;code&amp;gt;def remove_hyperlink&amp;lt;/code&amp;gt;, deleted redundant line:&lt;br /&gt;
 @participant = AssignmentParticipant.find(params[:id])&lt;br /&gt;
8. In &amp;lt;code&amp;gt;def download&amp;lt;/code&amp;gt;, deleted commented line:&lt;br /&gt;
 #folder_name = FileHelper::sanitize_folder(@current_folder.name)&lt;br /&gt;
&lt;br /&gt;
=Results Screenshot=&lt;br /&gt;
After fixing the bug #483, now the submit files function works.&lt;br /&gt;
&lt;br /&gt;
[[File:ossp2.png]]&lt;br /&gt;
&lt;br /&gt;
The file is stored at:&lt;br /&gt;
&lt;br /&gt;
[[File:ossp3.png]]&lt;br /&gt;
&lt;br /&gt;
= References=&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Pdeng</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015/oss_E1507_DG&amp;diff=96462</id>
		<title>CSC/ECE 517 Spring 2015/oss E1507 DG</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015/oss_E1507_DG&amp;diff=96462"/>
		<updated>2015-04-02T01:38:08Z</updated>

		<summary type="html">&lt;p&gt;Pdeng: /* Project Desicriptionhttps://docs.google.com/document/d/1J0WUBtYV_MDhpEQ-50z8gXE-OrvVkpEaZxvn_9RCAsM/edit# */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''E1507. Refactoring Review Files Controller &amp;amp; Submitted Content Controller'''&lt;br /&gt;
&lt;br /&gt;
This page provides a description of the Expertiza based OSS project. This project aimed at refactoring the Review Files Controller &amp;amp; Submitted Content Controller as well as fixing the bug [https://github.com/expertiza/expertiza/issues/483 #483]&lt;br /&gt;
&lt;br /&gt;
=What is Expertiza=&lt;br /&gt;
[http://http://expertiza.ncsu.edu/ Expertiza] is a [http://en.wikipedia.org/wiki/Open-source_software Open Source] [http://rubyonrails.org/ Rails] application where students can submit and peer-review learning objects (articles, code, web sites, etc). It is used in select courses at NC State and by professors at several other colleges and universities.  This Open Source application can be cloned from [https://github.com/expertiza/expertiza/ Github], the latest active branch is [https://github.com/expertiza/expertiza/tree/rails4 &amp;quot;Rails 4&amp;quot;].&lt;br /&gt;
&lt;br /&gt;
=Project Desicription&amp;lt;ref&amp;gt;https://docs.google.com/document/d/1J0WUBtYV_MDhpEQ-50z8gXE-OrvVkpEaZxvn_9RCAsM/edit#&amp;lt;/ref&amp;gt;=&lt;br /&gt;
There are 5 major goals for this project:&lt;br /&gt;
&lt;br /&gt;
1. Fix Bug #483&amp;lt;ref&amp;gt;https://github.com/expertiza/expertiza/issues/483&amp;lt;/ref&amp;gt;, which causes some error and prevent users to get access to the submitted_content page.&lt;br /&gt;
&lt;br /&gt;
2.Break up the complex methods such as &amp;lt;code&amp;gt;get_comments&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;show_code_file_diff&amp;lt;/code&amp;gt;. Anything that can be modularized should be modularized (Single Responsibility)&lt;br /&gt;
&lt;br /&gt;
3.While breaking up the complex methods, look out for possible helper functions. If there are any, move them to the &amp;lt;code&amp;gt;review_files_helper.rb&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4.Remove commented out code from the controller&lt;br /&gt;
&lt;br /&gt;
5.Refactor the file based on Global Rules&amp;lt;ref&amp;gt;https://docs.google.com/document/d/1qQD7fcypFk77nq7Jx7ZNyCNpLyt1oXKaq5G-W7zkV3k/edit?usp=sharing&amp;lt;/ref&amp;gt;.&lt;br /&gt;
 &lt;br /&gt;
==Bug #483==&lt;br /&gt;
In &amp;quot;Your works&amp;quot; view, students can only submit links but no files.&lt;br /&gt;
&lt;br /&gt;
[[File:Ossp1.png]]&lt;br /&gt;
&lt;br /&gt;
This is caused by commit [https://github.com/expertiza/expertiza/commit/f313711fee2dd92e324603b9c506d9d5470c3b60 f313711] where the line 13 in [https://github.com/expertiza/expertiza/blob/f313711fee2dd92e324603b9c506d9d5470c3b60/app/views/submitted_content/_main.html.erb submitted_content/_main.html.erb] was commented out.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;%#= render partial: 'submitted_content/submitted_files', locals: {participant: @participant, stage: @stage} %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
But after uncommented line 13 in &amp;lt;code&amp;gt;submitted_content/_main.html.erb&amp;lt;/code&amp;gt; and refresh the page, the Rails Server stopped responding.&lt;br /&gt;
&lt;br /&gt;
==Refactoring Review Files Controller &amp;amp; Submitted Content Controller==&lt;br /&gt;
===What they do===&lt;br /&gt;
This [https://github.com/expertiza/expertiza/blob/rails4/app/controllers/review_files_controller.rb review_files_controller.rb] is responsible for handling the review files of the participants. This controller helps in uploading newer versions of reviews for an assignment and also in displaying all the versions (and diff between versions/code) with the help of [https://github.com/expertiza/expertiza/blob/rails4/app/controllers/submitted_content_controller.rb submitted_content_controller.rb].&lt;br /&gt;
===What’s wrong with them===&lt;br /&gt;
There are quite a few complex functions inside these controllers. These functions can easily be broken up into much more smaller methods with specific functionalities. They also need to be refactored to meet the [https://docs.google.com/document/d/1qQD7fcypFk77nq7Jx7ZNyCNpLyt1oXKaq5G-W7zkV3k/edit Global Rules].&lt;br /&gt;
&lt;br /&gt;
=Changes Made=&lt;br /&gt;
==Files involved==&lt;br /&gt;
 review_files_controller.rb&lt;br /&gt;
 submitted_content_controller.rb&lt;br /&gt;
 review_files_helper.rb&lt;br /&gt;
 review_comments_helper.rb&lt;br /&gt;
 submitted_content/_main.html.erb&lt;br /&gt;
 model/assignment.rb&lt;br /&gt;
==For Bug #483 fixing==&lt;br /&gt;
Git log can be viewed in commit [https://github.com/KeleiAzz/expertiza/commit/aa37e2e61d0bf93a9bd0707621cd764017252f58 aa37e2e]&lt;br /&gt;
&lt;br /&gt;
1. In &amp;lt;code&amp;gt;submitted_content_controller.rb&amp;lt;/code&amp;gt;, line 19. &lt;br /&gt;
 if @assignment.max_team_size &amp;gt; 1 &amp;amp;&amp;amp; @participant.team.nil?&lt;br /&gt;
      flash[:error] = &amp;quot;This is a team assignment. Before submitting your work, you must &amp;lt;a style='color: blue;' href='../../student_teams/view/?student_id=#{params[:id]}'&amp;gt;create a team&amp;lt;/a&amp;gt;, &lt;br /&gt;
                      even if you will be the only member of the team&amp;quot;&lt;br /&gt;
      redirect_to controller: 'student_task', action: 'view', id: params[:id]&lt;br /&gt;
 else if @participant.team.nil?&lt;br /&gt;
      #create a new team for current user before submission&lt;br /&gt;
      team = AssignmentTeam.create_team_and_node(@assignment.id)&lt;br /&gt;
      team.add_member(User.find(@participant.user_id),@assignment.id)&lt;br /&gt;
 end&lt;br /&gt;
This &amp;lt;code&amp;gt;else if&amp;lt;/code&amp;gt; must be a mistake, so we changed it to:&lt;br /&gt;
 &amp;lt;code&amp;gt;elsif @participant.team.nil?&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2. In &amp;lt;code&amp;gt;model/assignment.rb&amp;lt;/code&amp;gt;, line 489. &lt;br /&gt;
 &amp;lt;code&amp;gt;Course.find(self.course_id).get_path&amp;lt;/code&amp;gt;&lt;br /&gt;
The &amp;lt;code&amp;gt;Course&amp;lt;/code&amp;gt; model doesn't have an attribute called &amp;lt;code&amp;gt;get_path&amp;lt;/code&amp;gt;, it should be &amp;lt;code&amp;gt;directory_path&amp;lt;/code&amp;gt;, so we changed it to&lt;br /&gt;
 &amp;lt;code&amp;gt;Course.find(self.course_id).directory_path&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3. In &amp;lt;code&amp;gt;submitted_content/_main.html.erb&amp;lt;/code&amp;gt;, line 18.&lt;br /&gt;
 &amp;lt;% if participant.assignment.is_coding_assignment%&amp;gt;&lt;br /&gt;
      &amp;lt;%= link_to &amp;quot;Code Review Dashboard&amp;quot;, :controller =&amp;gt; 'review_files',&lt;br /&gt;
        :action =&amp;gt; 'show_all_submitted_files',&lt;br /&gt;
        :participant_id =&amp;gt; assignment_participant.id,&lt;br /&gt;
        :stage =&amp;gt; stage %&amp;gt;&lt;br /&gt;
    &amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
 &amp;lt;% end %&amp;gt;&lt;br /&gt;
As in this page there doesn't have a parameter called &amp;lt;code&amp;gt;assignment_participant&amp;lt;/code&amp;gt;, as it need to get the participant's id, so we changed this line to:&lt;br /&gt;
 &amp;lt;code&amp;gt;:participant_id =&amp;gt; participant.id&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4. In &amp;lt;code&amp;gt;config/routes.rb&amp;lt;/code&amp;gt;. Added one more routes&lt;br /&gt;
 &amp;lt;code&amp;gt;post :submit_file&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Refactoring &amp;lt;code&amp;gt;review_files_controller.rb&amp;lt;/code&amp;gt;==&lt;br /&gt;
&lt;br /&gt;
1. Changed &amp;lt;code&amp;gt;and&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;or&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;&amp;amp;&amp;amp;&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;||&amp;lt;/code&amp;gt; to meet the requirements in the [https://docs.google.com/document/d/1qQD7fcypFk77nq7Jx7ZNyCNpLyt1oXKaq5G-W7zkV3k/edit Global Rules].&lt;br /&gt;
&lt;br /&gt;
2. In &amp;lt;code&amp;gt;def get_comments&amp;lt;/code&amp;gt;, deleted unused variable:&lt;br /&gt;
 &amp;lt;code&amp;gt;newobj = ReviewComment.where(review_file_id: params[:file_id])&amp;lt;/code&amp;gt;;&lt;br /&gt;
&lt;br /&gt;
3. In &amp;lt;code&amp;gt;def show_all_submitted_files&amp;lt;/code&amp;gt;, deleted unused variable: &lt;br /&gt;
 file_path = ReviewFile.get_file(code_review_dir, versions.sort.last,base_filename)&lt;br /&gt;
&lt;br /&gt;
4. In &amp;lt;code&amp;gt;def show_all_submitted_files&amp;lt;/code&amp;gt;, deleted unused variable:&lt;br /&gt;
 code_review_dir = ReviewFilesHelper::get_code_review_file_dir(AssignmentParticipant.find(auth[base_filename][versions.sort.last]))&lt;br /&gt;
&lt;br /&gt;
5. The method &amp;lt;code&amp;gt;def get_comments&amp;lt;/code&amp;gt; is too complex, so we modularized part of its code in &amp;lt;code&amp;gt;review_comments_helper.rb&amp;lt;/code&amp;gt;, we created a new method: &amp;lt;code&amp;gt;def self.populate_comments&amp;lt;/code&amp;gt;, which returns &amp;lt;code&amp;gt;handle, comment, authorflag&amp;lt;/code&amp;gt; these three variables.&lt;br /&gt;
  def self.populate_comments(params, authorflag, comment)&lt;br /&gt;
    assignmentparticipant = AssignmentParticipant.find(params[:participant_id])&lt;br /&gt;
    current_participant = AssignmentParticipant.where(parent_id: assignmentparticipant[:parent_id], user_id: session[:user].id).first&lt;br /&gt;
    if current_participant.id.to_s == params[:participant_id]&lt;br /&gt;
      authorflag = 1&lt;br /&gt;
    else&lt;br /&gt;
      authorflag = 0&lt;br /&gt;
    end&lt;br /&gt;
    member = []&lt;br /&gt;
    if assignmentparticipant.assignment.team_assignment&lt;br /&gt;
      assignmentparticipant.team.get_participants.each_with_index {|member1, index|&lt;br /&gt;
        member[index] = member1.id&lt;br /&gt;
      }&lt;br /&gt;
    end&lt;br /&gt;
    if (comment[:reviewer_participant_id] ==  current_participant.id)&lt;br /&gt;
      handle = &amp;quot;Me :&amp;quot;&lt;br /&gt;
      authorflag = 0&lt;br /&gt;
    elsif member.include? comment[:reviewer_participant_id] || comment[:reviewer_participant_id] == assignmentparticipant.id&lt;br /&gt;
      handle = &amp;quot;Author :&amp;quot;&lt;br /&gt;
      authorflag = 0&lt;br /&gt;
    else&lt;br /&gt;
      handle = &amp;quot;Reviewer&amp;quot;+comment[:reviewer_participant_id].to_s&lt;br /&gt;
    end&lt;br /&gt;
    return handle, comment, authorflag&lt;br /&gt;
  end&lt;br /&gt;
6. Rewrited all &amp;lt;code&amp;gt;:key =&amp;gt; value&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;key: value format&amp;lt;/code&amp;gt; according to the requirements in the '''Global Rules'''&amp;lt;ref&amp;gt;https://docs.google.com/document/d/1qQD7fcypFk77nq7Jx7ZNyCNpLyt1oXKaq5G-W7zkV3k/edit&amp;lt;/ref&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
7. The method &amp;lt;code&amp;gt;def show_code_files_diffIn&amp;lt;/code&amp;gt; is too complex, we created a new method: &amp;lt;code&amp;gt;def self.populate_shareObj &amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;review_files_helper.rb&amp;lt;/code&amp;gt; to perform part of the &amp;lt;code&amp;gt;show_code_files_diff&amp;lt;/code&amp;gt;.&lt;br /&gt;
  def self.populate_shareObj(processor)&lt;br /&gt;
    first_line_num = []&lt;br /&gt;
    second_line_num = []&lt;br /&gt;
    first_offset = []&lt;br /&gt;
    second_offset = []&lt;br /&gt;
    offsetswithcomments_file1 = []&lt;br /&gt;
    offsetswithcomments_file2 = []&lt;br /&gt;
    first_offset &amp;lt;&amp;lt; 0&lt;br /&gt;
    second_offset &amp;lt;&amp;lt; 0&lt;br /&gt;
    first_count = 0&lt;br /&gt;
    second_count = 0&lt;br /&gt;
    for i in (0..processor.absolute_line_num)&lt;br /&gt;
      first_offset = ReviewFile.get_first_offset(processor, i, @first_offset)&lt;br /&gt;
      second_offset = ReviewFile.get_second_offset(processor, i, @second_offset)&lt;br /&gt;
      first_line_num_new = Hash.new&lt;br /&gt;
      first_line_num_new = ReviewFile.get_first_line_num(processor, i, first_count)&lt;br /&gt;
      first_line_num &amp;lt;&amp;lt; first_line_num[:first_line_num]&lt;br /&gt;
      first_count = first_line_num[:first_count]&lt;br /&gt;
      second_line_num_new = Hash.new&lt;br /&gt;
      second_line_num_new = ReviewFile.get_second_line_num(processor, i,second_count)&lt;br /&gt;
      second_line_num &amp;lt;&amp;lt; second_line_num[:second_line_num]&lt;br /&gt;
      second_count = second_line_num[:second_count]&lt;br /&gt;
      # Remove newlines at the end of this line of code&lt;br /&gt;
      processor = ReviewFile.get_first_file_array(processor, i)&lt;br /&gt;
      processor = ReviewFile.get_second_file_array(processor, i)&lt;br /&gt;
      shareObj = Hash.new()&lt;br /&gt;
      shareObj['linearray1'] = processor.first_file_array&lt;br /&gt;
      shareObj['linearray2'] = processor.second_file_array&lt;br /&gt;
      shareObj['comparator'] = processor.comparison_array&lt;br /&gt;
      shareObj['linenumarray1'] = first_line_num&lt;br /&gt;
      shareObj['linenumarray2'] = second_line_num&lt;br /&gt;
      shareObj['offsetarray1'] = first_offset&lt;br /&gt;
      shareObj['offsetarray2'] = second_offset&lt;br /&gt;
      return first_line_num, second_line_num, first_count, second_count, shareObj&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
8. In &amp;lt;code&amp;gt;review_files_helper.rb&amp;lt;/code&amp;gt;, created a new method: &amp;lt;code&amp;gt;def self.find_review_files&amp;lt;/code&amp;gt;, which contains some statements in &amp;lt;code&amp;gt;def show_all_submitted_files&amp;lt;/code&amp;gt;.&lt;br /&gt;
  def self.find_review_files(participant) &lt;br /&gt;
    # Find all files over all versions submitted by the team&lt;br /&gt;
    all_review_files = Array.new&lt;br /&gt;
    if participant.assignment.team_assignment&lt;br /&gt;
      participant.team.get_participants.each_with_index { |member,index|&lt;br /&gt;
        all_review_files += ReviewFile.where(author_participant_id: member.id)&lt;br /&gt;
      }&lt;br /&gt;
    else&lt;br /&gt;
      all_review_files = ReviewFile.where(author_participant_id: @participant.id)&lt;br /&gt;
    end&lt;br /&gt;
    all_review_files&lt;br /&gt;
  end&lt;br /&gt;
9. In &amp;lt;code&amp;gt;review_files_helper.rb&amp;lt;/code&amp;gt;, created a new method: &amp;lt;code&amp;gt;def self.find_review_versions&amp;lt;/code&amp;gt;, which contains some statements in &amp;lt;code&amp;gt;def show_all_submitted_files&amp;lt;/code&amp;gt;.&lt;br /&gt;
  def self.find_review_versions(all_review_files) &lt;br /&gt;
    file_version_map = Hash.new&lt;br /&gt;
    all_review_files.each_with_index do |each_file,index|&lt;br /&gt;
      file_version_map[File.basename(each_file.filepath)] = Array.new unless&lt;br /&gt;
      file_version_map[File.basename(each_file.filepath)]&lt;br /&gt;
      file_version_map[File.basename(each_file.filepath)] &amp;lt;&amp;lt; each_file.version_number&lt;br /&gt;
    end&lt;br /&gt;
    return file_version_map&lt;br /&gt;
  end&lt;br /&gt;
==Refactoring &amp;lt;code&amp;gt;submitted_content_controller.rb&amp;lt;/code&amp;gt;==&lt;br /&gt;
1. Changed &amp;lt;code&amp;gt;and&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;or&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;&amp;amp;&amp;amp;&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;||&amp;lt;/code&amp;gt; to meet the requirements in the [https://docs.google.com/document/d/1qQD7fcypFk77nq7Jx7ZNyCNpLyt1oXKaq5G-W7zkV3k/edit Global Rules].&lt;br /&gt;
&lt;br /&gt;
2. Rewrited all &amp;lt;code&amp;gt;:key =&amp;gt; value&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;key: value format&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
3. Rewrited all param['string'] to params[:string].&lt;br /&gt;
&lt;br /&gt;
4. Added one more routes &amp;lt;code&amp;gt;post :folder_action&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;config/routes.rb&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
5. Changed all &amp;lt;code&amp;gt;array.size == 0&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;array.zero?&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
6. Changed all &amp;lt;code&amp;gt;find_by_x(val)&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;where(&amp;quot;x=val&amp;quot;)&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;where(x: val)&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
7. In &amp;lt;code&amp;gt;def remove_hyperlink&amp;lt;/code&amp;gt;, deleted redundant line:&lt;br /&gt;
 @participant = AssignmentParticipant.find(params[:id])&lt;br /&gt;
8. In &amp;lt;code&amp;gt;def download&amp;lt;/code&amp;gt;, deleted commented line:&lt;br /&gt;
 #folder_name = FileHelper::sanitize_folder(@current_folder.name)&lt;br /&gt;
&lt;br /&gt;
=Results Screenshot=&lt;br /&gt;
After fixing the bug #483, now the submit files function works.&lt;br /&gt;
&lt;br /&gt;
[[File:ossp2.png]]&lt;br /&gt;
&lt;br /&gt;
The file is stored at:&lt;br /&gt;
&lt;br /&gt;
[[File:ossp3.png]]&lt;br /&gt;
&lt;br /&gt;
= References=&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Pdeng</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015/oss_E1507_DG&amp;diff=96461</id>
		<title>CSC/ECE 517 Spring 2015/oss E1507 DG</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015/oss_E1507_DG&amp;diff=96461"/>
		<updated>2015-04-02T01:37:52Z</updated>

		<summary type="html">&lt;p&gt;Pdeng: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''E1507. Refactoring Review Files Controller &amp;amp; Submitted Content Controller'''&lt;br /&gt;
&lt;br /&gt;
This page provides a description of the Expertiza based OSS project. This project aimed at refactoring the Review Files Controller &amp;amp; Submitted Content Controller as well as fixing the bug [https://github.com/expertiza/expertiza/issues/483 #483]&lt;br /&gt;
&lt;br /&gt;
=What is Expertiza=&lt;br /&gt;
[http://http://expertiza.ncsu.edu/ Expertiza] is a [http://en.wikipedia.org/wiki/Open-source_software Open Source] [http://rubyonrails.org/ Rails] application where students can submit and peer-review learning objects (articles, code, web sites, etc). It is used in select courses at NC State and by professors at several other colleges and universities.  This Open Source application can be cloned from [https://github.com/expertiza/expertiza/ Github], the latest active branch is [https://github.com/expertiza/expertiza/tree/rails4 &amp;quot;Rails 4&amp;quot;].&lt;br /&gt;
&lt;br /&gt;
=Project Desicription&amp;lt;ref&amp;gt;https://docs.google.com/document/d/1J0WUBtYV_MDhpEQ-50z8gXE-OrvVkpEaZxvn_9RCAsM/edit#&amp;lt;/ref&amp;gt;=&lt;br /&gt;
There are 5 major goals for this project:&lt;br /&gt;
&lt;br /&gt;
1. Fix Bug #483&amp;lt;ref&amp;gt;https://github.com/expertiza/expertiza/issues/483&amp;lt;/ref&amp;gt;, which causes some error and prevent users to get access to the submitted_content page.&lt;br /&gt;
&lt;br /&gt;
2.Break up the complex methods such as &amp;lt;code&amp;gt;get_comments&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;show_code_file_diff&amp;lt;/code&amp;gt;. Anything that can be modularized should be modularized (Single Responsibility)&lt;br /&gt;
&lt;br /&gt;
3.While breaking up the complex methods, look out for possible helper functions. If there are any, move them to the &amp;lt;code&amp;gt;review_files_helper.rb&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4.Remove commented out code from the controller&lt;br /&gt;
&lt;br /&gt;
5.Refactor the file based on Global Rules&amp;lt;ref&amp;gt;https://docs.google.com/document/d/1qQD7fcypFk77nq7Jx7ZNyCNpLyt1oXKaq5G-W7zkV3k/edit?usp=sharing&amp;lt;/ref&amp;gt;.&lt;br /&gt;
 &lt;br /&gt;
==Bug #483==&lt;br /&gt;
In &amp;quot;Your works&amp;quot; view, students can only submit links but no files.&lt;br /&gt;
&lt;br /&gt;
[[File:Ossp1.png]]&lt;br /&gt;
&lt;br /&gt;
This is caused by commit [https://github.com/expertiza/expertiza/commit/f313711fee2dd92e324603b9c506d9d5470c3b60 f313711] where the line 13 in [https://github.com/expertiza/expertiza/blob/f313711fee2dd92e324603b9c506d9d5470c3b60/app/views/submitted_content/_main.html.erb submitted_content/_main.html.erb] was commented out.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;%#= render partial: 'submitted_content/submitted_files', locals: {participant: @participant, stage: @stage} %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
But after uncommented line 13 in &amp;lt;code&amp;gt;submitted_content/_main.html.erb&amp;lt;/code&amp;gt; and refresh the page, the Rails Server stopped responding.&lt;br /&gt;
&lt;br /&gt;
==Refactoring Review Files Controller &amp;amp; Submitted Content Controller==&lt;br /&gt;
===What they do===&lt;br /&gt;
This [https://github.com/expertiza/expertiza/blob/rails4/app/controllers/review_files_controller.rb review_files_controller.rb] is responsible for handling the review files of the participants. This controller helps in uploading newer versions of reviews for an assignment and also in displaying all the versions (and diff between versions/code) with the help of [https://github.com/expertiza/expertiza/blob/rails4/app/controllers/submitted_content_controller.rb submitted_content_controller.rb].&lt;br /&gt;
===What’s wrong with them===&lt;br /&gt;
There are quite a few complex functions inside these controllers. These functions can easily be broken up into much more smaller methods with specific functionalities. They also need to be refactored to meet the [https://docs.google.com/document/d/1qQD7fcypFk77nq7Jx7ZNyCNpLyt1oXKaq5G-W7zkV3k/edit Global Rules].&lt;br /&gt;
&lt;br /&gt;
==What needs to be done==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Changes Made=&lt;br /&gt;
==Files involved==&lt;br /&gt;
 review_files_controller.rb&lt;br /&gt;
 submitted_content_controller.rb&lt;br /&gt;
 review_files_helper.rb&lt;br /&gt;
 review_comments_helper.rb&lt;br /&gt;
 submitted_content/_main.html.erb&lt;br /&gt;
 model/assignment.rb&lt;br /&gt;
==For Bug #483 fixing==&lt;br /&gt;
Git log can be viewed in commit [https://github.com/KeleiAzz/expertiza/commit/aa37e2e61d0bf93a9bd0707621cd764017252f58 aa37e2e]&lt;br /&gt;
&lt;br /&gt;
1. In &amp;lt;code&amp;gt;submitted_content_controller.rb&amp;lt;/code&amp;gt;, line 19. &lt;br /&gt;
 if @assignment.max_team_size &amp;gt; 1 &amp;amp;&amp;amp; @participant.team.nil?&lt;br /&gt;
      flash[:error] = &amp;quot;This is a team assignment. Before submitting your work, you must &amp;lt;a style='color: blue;' href='../../student_teams/view/?student_id=#{params[:id]}'&amp;gt;create a team&amp;lt;/a&amp;gt;, &lt;br /&gt;
                      even if you will be the only member of the team&amp;quot;&lt;br /&gt;
      redirect_to controller: 'student_task', action: 'view', id: params[:id]&lt;br /&gt;
 else if @participant.team.nil?&lt;br /&gt;
      #create a new team for current user before submission&lt;br /&gt;
      team = AssignmentTeam.create_team_and_node(@assignment.id)&lt;br /&gt;
      team.add_member(User.find(@participant.user_id),@assignment.id)&lt;br /&gt;
 end&lt;br /&gt;
This &amp;lt;code&amp;gt;else if&amp;lt;/code&amp;gt; must be a mistake, so we changed it to:&lt;br /&gt;
 &amp;lt;code&amp;gt;elsif @participant.team.nil?&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2. In &amp;lt;code&amp;gt;model/assignment.rb&amp;lt;/code&amp;gt;, line 489. &lt;br /&gt;
 &amp;lt;code&amp;gt;Course.find(self.course_id).get_path&amp;lt;/code&amp;gt;&lt;br /&gt;
The &amp;lt;code&amp;gt;Course&amp;lt;/code&amp;gt; model doesn't have an attribute called &amp;lt;code&amp;gt;get_path&amp;lt;/code&amp;gt;, it should be &amp;lt;code&amp;gt;directory_path&amp;lt;/code&amp;gt;, so we changed it to&lt;br /&gt;
 &amp;lt;code&amp;gt;Course.find(self.course_id).directory_path&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3. In &amp;lt;code&amp;gt;submitted_content/_main.html.erb&amp;lt;/code&amp;gt;, line 18.&lt;br /&gt;
 &amp;lt;% if participant.assignment.is_coding_assignment%&amp;gt;&lt;br /&gt;
      &amp;lt;%= link_to &amp;quot;Code Review Dashboard&amp;quot;, :controller =&amp;gt; 'review_files',&lt;br /&gt;
        :action =&amp;gt; 'show_all_submitted_files',&lt;br /&gt;
        :participant_id =&amp;gt; assignment_participant.id,&lt;br /&gt;
        :stage =&amp;gt; stage %&amp;gt;&lt;br /&gt;
    &amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
 &amp;lt;% end %&amp;gt;&lt;br /&gt;
As in this page there doesn't have a parameter called &amp;lt;code&amp;gt;assignment_participant&amp;lt;/code&amp;gt;, as it need to get the participant's id, so we changed this line to:&lt;br /&gt;
 &amp;lt;code&amp;gt;:participant_id =&amp;gt; participant.id&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4. In &amp;lt;code&amp;gt;config/routes.rb&amp;lt;/code&amp;gt;. Added one more routes&lt;br /&gt;
 &amp;lt;code&amp;gt;post :submit_file&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Refactoring &amp;lt;code&amp;gt;review_files_controller.rb&amp;lt;/code&amp;gt;==&lt;br /&gt;
&lt;br /&gt;
1. Changed &amp;lt;code&amp;gt;and&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;or&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;&amp;amp;&amp;amp;&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;||&amp;lt;/code&amp;gt; to meet the requirements in the [https://docs.google.com/document/d/1qQD7fcypFk77nq7Jx7ZNyCNpLyt1oXKaq5G-W7zkV3k/edit Global Rules].&lt;br /&gt;
&lt;br /&gt;
2. In &amp;lt;code&amp;gt;def get_comments&amp;lt;/code&amp;gt;, deleted unused variable:&lt;br /&gt;
 &amp;lt;code&amp;gt;newobj = ReviewComment.where(review_file_id: params[:file_id])&amp;lt;/code&amp;gt;;&lt;br /&gt;
&lt;br /&gt;
3. In &amp;lt;code&amp;gt;def show_all_submitted_files&amp;lt;/code&amp;gt;, deleted unused variable: &lt;br /&gt;
 file_path = ReviewFile.get_file(code_review_dir, versions.sort.last,base_filename)&lt;br /&gt;
&lt;br /&gt;
4. In &amp;lt;code&amp;gt;def show_all_submitted_files&amp;lt;/code&amp;gt;, deleted unused variable:&lt;br /&gt;
 code_review_dir = ReviewFilesHelper::get_code_review_file_dir(AssignmentParticipant.find(auth[base_filename][versions.sort.last]))&lt;br /&gt;
&lt;br /&gt;
5. The method &amp;lt;code&amp;gt;def get_comments&amp;lt;/code&amp;gt; is too complex, so we modularized part of its code in &amp;lt;code&amp;gt;review_comments_helper.rb&amp;lt;/code&amp;gt;, we created a new method: &amp;lt;code&amp;gt;def self.populate_comments&amp;lt;/code&amp;gt;, which returns &amp;lt;code&amp;gt;handle, comment, authorflag&amp;lt;/code&amp;gt; these three variables.&lt;br /&gt;
  def self.populate_comments(params, authorflag, comment)&lt;br /&gt;
    assignmentparticipant = AssignmentParticipant.find(params[:participant_id])&lt;br /&gt;
    current_participant = AssignmentParticipant.where(parent_id: assignmentparticipant[:parent_id], user_id: session[:user].id).first&lt;br /&gt;
    if current_participant.id.to_s == params[:participant_id]&lt;br /&gt;
      authorflag = 1&lt;br /&gt;
    else&lt;br /&gt;
      authorflag = 0&lt;br /&gt;
    end&lt;br /&gt;
    member = []&lt;br /&gt;
    if assignmentparticipant.assignment.team_assignment&lt;br /&gt;
      assignmentparticipant.team.get_participants.each_with_index {|member1, index|&lt;br /&gt;
        member[index] = member1.id&lt;br /&gt;
      }&lt;br /&gt;
    end&lt;br /&gt;
    if (comment[:reviewer_participant_id] ==  current_participant.id)&lt;br /&gt;
      handle = &amp;quot;Me :&amp;quot;&lt;br /&gt;
      authorflag = 0&lt;br /&gt;
    elsif member.include? comment[:reviewer_participant_id] || comment[:reviewer_participant_id] == assignmentparticipant.id&lt;br /&gt;
      handle = &amp;quot;Author :&amp;quot;&lt;br /&gt;
      authorflag = 0&lt;br /&gt;
    else&lt;br /&gt;
      handle = &amp;quot;Reviewer&amp;quot;+comment[:reviewer_participant_id].to_s&lt;br /&gt;
    end&lt;br /&gt;
    return handle, comment, authorflag&lt;br /&gt;
  end&lt;br /&gt;
6. Rewrited all &amp;lt;code&amp;gt;:key =&amp;gt; value&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;key: value format&amp;lt;/code&amp;gt; according to the requirements in the '''Global Rules'''&amp;lt;ref&amp;gt;https://docs.google.com/document/d/1qQD7fcypFk77nq7Jx7ZNyCNpLyt1oXKaq5G-W7zkV3k/edit&amp;lt;/ref&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
7. The method &amp;lt;code&amp;gt;def show_code_files_diffIn&amp;lt;/code&amp;gt; is too complex, we created a new method: &amp;lt;code&amp;gt;def self.populate_shareObj &amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;review_files_helper.rb&amp;lt;/code&amp;gt; to perform part of the &amp;lt;code&amp;gt;show_code_files_diff&amp;lt;/code&amp;gt;.&lt;br /&gt;
  def self.populate_shareObj(processor)&lt;br /&gt;
    first_line_num = []&lt;br /&gt;
    second_line_num = []&lt;br /&gt;
    first_offset = []&lt;br /&gt;
    second_offset = []&lt;br /&gt;
    offsetswithcomments_file1 = []&lt;br /&gt;
    offsetswithcomments_file2 = []&lt;br /&gt;
    first_offset &amp;lt;&amp;lt; 0&lt;br /&gt;
    second_offset &amp;lt;&amp;lt; 0&lt;br /&gt;
    first_count = 0&lt;br /&gt;
    second_count = 0&lt;br /&gt;
    for i in (0..processor.absolute_line_num)&lt;br /&gt;
      first_offset = ReviewFile.get_first_offset(processor, i, @first_offset)&lt;br /&gt;
      second_offset = ReviewFile.get_second_offset(processor, i, @second_offset)&lt;br /&gt;
      first_line_num_new = Hash.new&lt;br /&gt;
      first_line_num_new = ReviewFile.get_first_line_num(processor, i, first_count)&lt;br /&gt;
      first_line_num &amp;lt;&amp;lt; first_line_num[:first_line_num]&lt;br /&gt;
      first_count = first_line_num[:first_count]&lt;br /&gt;
      second_line_num_new = Hash.new&lt;br /&gt;
      second_line_num_new = ReviewFile.get_second_line_num(processor, i,second_count)&lt;br /&gt;
      second_line_num &amp;lt;&amp;lt; second_line_num[:second_line_num]&lt;br /&gt;
      second_count = second_line_num[:second_count]&lt;br /&gt;
      # Remove newlines at the end of this line of code&lt;br /&gt;
      processor = ReviewFile.get_first_file_array(processor, i)&lt;br /&gt;
      processor = ReviewFile.get_second_file_array(processor, i)&lt;br /&gt;
      shareObj = Hash.new()&lt;br /&gt;
      shareObj['linearray1'] = processor.first_file_array&lt;br /&gt;
      shareObj['linearray2'] = processor.second_file_array&lt;br /&gt;
      shareObj['comparator'] = processor.comparison_array&lt;br /&gt;
      shareObj['linenumarray1'] = first_line_num&lt;br /&gt;
      shareObj['linenumarray2'] = second_line_num&lt;br /&gt;
      shareObj['offsetarray1'] = first_offset&lt;br /&gt;
      shareObj['offsetarray2'] = second_offset&lt;br /&gt;
      return first_line_num, second_line_num, first_count, second_count, shareObj&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
8. In &amp;lt;code&amp;gt;review_files_helper.rb&amp;lt;/code&amp;gt;, created a new method: &amp;lt;code&amp;gt;def self.find_review_files&amp;lt;/code&amp;gt;, which contains some statements in &amp;lt;code&amp;gt;def show_all_submitted_files&amp;lt;/code&amp;gt;.&lt;br /&gt;
  def self.find_review_files(participant) &lt;br /&gt;
    # Find all files over all versions submitted by the team&lt;br /&gt;
    all_review_files = Array.new&lt;br /&gt;
    if participant.assignment.team_assignment&lt;br /&gt;
      participant.team.get_participants.each_with_index { |member,index|&lt;br /&gt;
        all_review_files += ReviewFile.where(author_participant_id: member.id)&lt;br /&gt;
      }&lt;br /&gt;
    else&lt;br /&gt;
      all_review_files = ReviewFile.where(author_participant_id: @participant.id)&lt;br /&gt;
    end&lt;br /&gt;
    all_review_files&lt;br /&gt;
  end&lt;br /&gt;
9. In &amp;lt;code&amp;gt;review_files_helper.rb&amp;lt;/code&amp;gt;, created a new method: &amp;lt;code&amp;gt;def self.find_review_versions&amp;lt;/code&amp;gt;, which contains some statements in &amp;lt;code&amp;gt;def show_all_submitted_files&amp;lt;/code&amp;gt;.&lt;br /&gt;
  def self.find_review_versions(all_review_files) &lt;br /&gt;
    file_version_map = Hash.new&lt;br /&gt;
    all_review_files.each_with_index do |each_file,index|&lt;br /&gt;
      file_version_map[File.basename(each_file.filepath)] = Array.new unless&lt;br /&gt;
      file_version_map[File.basename(each_file.filepath)]&lt;br /&gt;
      file_version_map[File.basename(each_file.filepath)] &amp;lt;&amp;lt; each_file.version_number&lt;br /&gt;
    end&lt;br /&gt;
    return file_version_map&lt;br /&gt;
  end&lt;br /&gt;
==Refactoring &amp;lt;code&amp;gt;submitted_content_controller.rb&amp;lt;/code&amp;gt;==&lt;br /&gt;
1. Changed &amp;lt;code&amp;gt;and&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;or&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;&amp;amp;&amp;amp;&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;||&amp;lt;/code&amp;gt; to meet the requirements in the [https://docs.google.com/document/d/1qQD7fcypFk77nq7Jx7ZNyCNpLyt1oXKaq5G-W7zkV3k/edit Global Rules].&lt;br /&gt;
&lt;br /&gt;
2. Rewrited all &amp;lt;code&amp;gt;:key =&amp;gt; value&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;key: value format&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
3. Rewrited all param['string'] to params[:string].&lt;br /&gt;
&lt;br /&gt;
4. Added one more routes &amp;lt;code&amp;gt;post :folder_action&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;config/routes.rb&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
5. Changed all &amp;lt;code&amp;gt;array.size == 0&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;array.zero?&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
6. Changed all &amp;lt;code&amp;gt;find_by_x(val)&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;where(&amp;quot;x=val&amp;quot;)&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;where(x: val)&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
7. In &amp;lt;code&amp;gt;def remove_hyperlink&amp;lt;/code&amp;gt;, deleted redundant line:&lt;br /&gt;
 @participant = AssignmentParticipant.find(params[:id])&lt;br /&gt;
8. In &amp;lt;code&amp;gt;def download&amp;lt;/code&amp;gt;, deleted commented line:&lt;br /&gt;
 #folder_name = FileHelper::sanitize_folder(@current_folder.name)&lt;br /&gt;
&lt;br /&gt;
=Results Screenshot=&lt;br /&gt;
After fixing the bug #483, now the submit files function works.&lt;br /&gt;
&lt;br /&gt;
[[File:ossp2.png]]&lt;br /&gt;
&lt;br /&gt;
The file is stored at:&lt;br /&gt;
&lt;br /&gt;
[[File:ossp3.png]]&lt;br /&gt;
&lt;br /&gt;
= References=&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Pdeng</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015/oss_E1507_DG&amp;diff=96460</id>
		<title>CSC/ECE 517 Spring 2015/oss E1507 DG</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015/oss_E1507_DG&amp;diff=96460"/>
		<updated>2015-04-02T01:35:33Z</updated>

		<summary type="html">&lt;p&gt;Pdeng: /* Project Desicriptionhttps://docs.google.com/document/d/1J0WUBtYV_MDhpEQ-50z8gXE-OrvVkpEaZxvn_9RCAsM/edit# */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''E1507. Refactoring Review Files Controller &amp;amp; Submitted Content Controller'''&lt;br /&gt;
&lt;br /&gt;
This page provides a description of the Expertiza based OSS project. This project aimed at refactoring the Review Files Controller &amp;amp; Submitted Content Controller as well as fixing the bug [https://github.com/expertiza/expertiza/issues/483 #483]&lt;br /&gt;
&lt;br /&gt;
=What is Expertiza=&lt;br /&gt;
[http://http://expertiza.ncsu.edu/ Expertiza] is a [http://en.wikipedia.org/wiki/Open-source_software Open Source] [http://rubyonrails.org/ Rails] application where students can submit and peer-review learning objects (articles, code, web sites, etc). It is used in select courses at NC State and by professors at several other colleges and universities.  This Open Source application can be cloned from [https://github.com/expertiza/expertiza/ Github], the latest active branch is [https://github.com/expertiza/expertiza/tree/rails4 &amp;quot;Rails 4&amp;quot;].&lt;br /&gt;
&lt;br /&gt;
=Project Desicription&amp;lt;ref&amp;gt;https://docs.google.com/document/d/1J0WUBtYV_MDhpEQ-50z8gXE-OrvVkpEaZxvn_9RCAsM/edit#&amp;lt;/ref&amp;gt;=&lt;br /&gt;
There are 3 major objects for this project:&lt;br /&gt;
&lt;br /&gt;
1. Fix Bug #483&amp;lt;ref&amp;gt;https://github.com/expertiza/expertiza/issues/483&amp;lt;/ref&amp;gt;, which causes some error and prevent users to get access to the submitted_content page.&lt;br /&gt;
&lt;br /&gt;
2. Refactor Review file controller and Submitted content controller, so that large methods can be divided into smaller methods and make the code more readable and understandable.&lt;br /&gt;
&lt;br /&gt;
3. Replace some statements based on Global Rules&amp;lt;ref&amp;gt;https://docs.google.com/document/d/1qQD7fcypFk77nq7Jx7ZNyCNpLyt1oXKaq5G-W7zkV3k/edit?usp=sharing&amp;lt;/ref&amp;gt;, for the uniformity of the whole project.&lt;br /&gt;
 &lt;br /&gt;
==Bug #483==&lt;br /&gt;
In &amp;quot;Your works&amp;quot; view, students can only submit links but no files.&lt;br /&gt;
&lt;br /&gt;
[[File:Ossp1.png]]&lt;br /&gt;
&lt;br /&gt;
This is caused by commit [https://github.com/expertiza/expertiza/commit/f313711fee2dd92e324603b9c506d9d5470c3b60 f313711] where the line 13 in [https://github.com/expertiza/expertiza/blob/f313711fee2dd92e324603b9c506d9d5470c3b60/app/views/submitted_content/_main.html.erb submitted_content/_main.html.erb] was commented out.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;%#= render partial: 'submitted_content/submitted_files', locals: {participant: @participant, stage: @stage} %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
But after uncommented line 13 in &amp;lt;code&amp;gt;submitted_content/_main.html.erb&amp;lt;/code&amp;gt; and refresh the page, the Rails Server stopped responding.&lt;br /&gt;
&lt;br /&gt;
==Refactoring Review Files Controller &amp;amp; Submitted Content Controller==&lt;br /&gt;
===What they do===&lt;br /&gt;
This [https://github.com/expertiza/expertiza/blob/rails4/app/controllers/review_files_controller.rb review_files_controller.rb] is responsible for handling the review files of the participants. This controller helps in uploading newer versions of reviews for an assignment and also in displaying all the versions (and diff between versions/code) with the help of [https://github.com/expertiza/expertiza/blob/rails4/app/controllers/submitted_content_controller.rb submitted_content_controller.rb].&lt;br /&gt;
===What’s wrong with them===&lt;br /&gt;
There are quite a few complex functions inside these controllers. These functions can easily be broken up into much more smaller methods with specific functionalities. They also need to be refactored to meet the [https://docs.google.com/document/d/1qQD7fcypFk77nq7Jx7ZNyCNpLyt1oXKaq5G-W7zkV3k/edit Global Rules].&lt;br /&gt;
&lt;br /&gt;
==What needs to be done==&lt;br /&gt;
1.Fix this bug #483&lt;br /&gt;
&lt;br /&gt;
2.Break up the complex methods such as &amp;lt;code&amp;gt;get_comments&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;show_code_file_diff&amp;lt;/code&amp;gt;. Anything that can be modularized should be modularized (Single Responsibility)&lt;br /&gt;
&lt;br /&gt;
3.While breaking up the complex methods, look out for possible helper functions. If there are any, move them to the &amp;lt;code&amp;gt;review_files_helper.rb&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4.Remove commented out code from the controller&lt;br /&gt;
&lt;br /&gt;
5.Refactor the file based on Global Rules provided at the top of this document&lt;br /&gt;
&lt;br /&gt;
=Changes Made=&lt;br /&gt;
==Files involved==&lt;br /&gt;
 review_files_controller.rb&lt;br /&gt;
 submitted_content_controller.rb&lt;br /&gt;
 review_files_helper.rb&lt;br /&gt;
 review_comments_helper.rb&lt;br /&gt;
 submitted_content/_main.html.erb&lt;br /&gt;
 model/assignment.rb&lt;br /&gt;
==For Bug #483 fixing==&lt;br /&gt;
Git log can be viewed in commit [https://github.com/KeleiAzz/expertiza/commit/aa37e2e61d0bf93a9bd0707621cd764017252f58 aa37e2e]&lt;br /&gt;
&lt;br /&gt;
1. In &amp;lt;code&amp;gt;submitted_content_controller.rb&amp;lt;/code&amp;gt;, line 19. &lt;br /&gt;
 if @assignment.max_team_size &amp;gt; 1 &amp;amp;&amp;amp; @participant.team.nil?&lt;br /&gt;
      flash[:error] = &amp;quot;This is a team assignment. Before submitting your work, you must &amp;lt;a style='color: blue;' href='../../student_teams/view/?student_id=#{params[:id]}'&amp;gt;create a team&amp;lt;/a&amp;gt;, &lt;br /&gt;
                      even if you will be the only member of the team&amp;quot;&lt;br /&gt;
      redirect_to controller: 'student_task', action: 'view', id: params[:id]&lt;br /&gt;
 else if @participant.team.nil?&lt;br /&gt;
      #create a new team for current user before submission&lt;br /&gt;
      team = AssignmentTeam.create_team_and_node(@assignment.id)&lt;br /&gt;
      team.add_member(User.find(@participant.user_id),@assignment.id)&lt;br /&gt;
 end&lt;br /&gt;
This &amp;lt;code&amp;gt;else if&amp;lt;/code&amp;gt; must be a mistake, so we changed it to:&lt;br /&gt;
 &amp;lt;code&amp;gt;elsif @participant.team.nil?&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2. In &amp;lt;code&amp;gt;model/assignment.rb&amp;lt;/code&amp;gt;, line 489. &lt;br /&gt;
 &amp;lt;code&amp;gt;Course.find(self.course_id).get_path&amp;lt;/code&amp;gt;&lt;br /&gt;
The &amp;lt;code&amp;gt;Course&amp;lt;/code&amp;gt; model doesn't have an attribute called &amp;lt;code&amp;gt;get_path&amp;lt;/code&amp;gt;, it should be &amp;lt;code&amp;gt;directory_path&amp;lt;/code&amp;gt;, so we changed it to&lt;br /&gt;
 &amp;lt;code&amp;gt;Course.find(self.course_id).directory_path&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3. In &amp;lt;code&amp;gt;submitted_content/_main.html.erb&amp;lt;/code&amp;gt;, line 18.&lt;br /&gt;
 &amp;lt;% if participant.assignment.is_coding_assignment%&amp;gt;&lt;br /&gt;
      &amp;lt;%= link_to &amp;quot;Code Review Dashboard&amp;quot;, :controller =&amp;gt; 'review_files',&lt;br /&gt;
        :action =&amp;gt; 'show_all_submitted_files',&lt;br /&gt;
        :participant_id =&amp;gt; assignment_participant.id,&lt;br /&gt;
        :stage =&amp;gt; stage %&amp;gt;&lt;br /&gt;
    &amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
 &amp;lt;% end %&amp;gt;&lt;br /&gt;
As in this page there doesn't have a parameter called &amp;lt;code&amp;gt;assignment_participant&amp;lt;/code&amp;gt;, as it need to get the participant's id, so we changed this line to:&lt;br /&gt;
 &amp;lt;code&amp;gt;:participant_id =&amp;gt; participant.id&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4. In &amp;lt;code&amp;gt;config/routes.rb&amp;lt;/code&amp;gt;. Added one more routes&lt;br /&gt;
 &amp;lt;code&amp;gt;post :submit_file&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Refactoring &amp;lt;code&amp;gt;review_files_controller.rb&amp;lt;/code&amp;gt;==&lt;br /&gt;
&lt;br /&gt;
1. Changed &amp;lt;code&amp;gt;and&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;or&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;&amp;amp;&amp;amp;&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;||&amp;lt;/code&amp;gt; to meet the requirements in the [https://docs.google.com/document/d/1qQD7fcypFk77nq7Jx7ZNyCNpLyt1oXKaq5G-W7zkV3k/edit Global Rules].&lt;br /&gt;
&lt;br /&gt;
2. In &amp;lt;code&amp;gt;def get_comments&amp;lt;/code&amp;gt;, deleted unused variable:&lt;br /&gt;
 &amp;lt;code&amp;gt;newobj = ReviewComment.where(review_file_id: params[:file_id])&amp;lt;/code&amp;gt;;&lt;br /&gt;
&lt;br /&gt;
3. In &amp;lt;code&amp;gt;def show_all_submitted_files&amp;lt;/code&amp;gt;, deleted unused variable: &lt;br /&gt;
 file_path = ReviewFile.get_file(code_review_dir, versions.sort.last,base_filename)&lt;br /&gt;
&lt;br /&gt;
4. In &amp;lt;code&amp;gt;def show_all_submitted_files&amp;lt;/code&amp;gt;, deleted unused variable:&lt;br /&gt;
 code_review_dir = ReviewFilesHelper::get_code_review_file_dir(AssignmentParticipant.find(auth[base_filename][versions.sort.last]))&lt;br /&gt;
&lt;br /&gt;
5. The method &amp;lt;code&amp;gt;def get_comments&amp;lt;/code&amp;gt; is too complex, so we modularized part of its code in &amp;lt;code&amp;gt;review_comments_helper.rb&amp;lt;/code&amp;gt;, we created a new method: &amp;lt;code&amp;gt;def self.populate_comments&amp;lt;/code&amp;gt;, which returns &amp;lt;code&amp;gt;handle, comment, authorflag&amp;lt;/code&amp;gt; these three variables.&lt;br /&gt;
  def self.populate_comments(params, authorflag, comment)&lt;br /&gt;
    assignmentparticipant = AssignmentParticipant.find(params[:participant_id])&lt;br /&gt;
    current_participant = AssignmentParticipant.where(parent_id: assignmentparticipant[:parent_id], user_id: session[:user].id).first&lt;br /&gt;
    if current_participant.id.to_s == params[:participant_id]&lt;br /&gt;
      authorflag = 1&lt;br /&gt;
    else&lt;br /&gt;
      authorflag = 0&lt;br /&gt;
    end&lt;br /&gt;
    member = []&lt;br /&gt;
    if assignmentparticipant.assignment.team_assignment&lt;br /&gt;
      assignmentparticipant.team.get_participants.each_with_index {|member1, index|&lt;br /&gt;
        member[index] = member1.id&lt;br /&gt;
      }&lt;br /&gt;
    end&lt;br /&gt;
    if (comment[:reviewer_participant_id] ==  current_participant.id)&lt;br /&gt;
      handle = &amp;quot;Me :&amp;quot;&lt;br /&gt;
      authorflag = 0&lt;br /&gt;
    elsif member.include? comment[:reviewer_participant_id] || comment[:reviewer_participant_id] == assignmentparticipant.id&lt;br /&gt;
      handle = &amp;quot;Author :&amp;quot;&lt;br /&gt;
      authorflag = 0&lt;br /&gt;
    else&lt;br /&gt;
      handle = &amp;quot;Reviewer&amp;quot;+comment[:reviewer_participant_id].to_s&lt;br /&gt;
    end&lt;br /&gt;
    return handle, comment, authorflag&lt;br /&gt;
  end&lt;br /&gt;
6. Rewrited all &amp;lt;code&amp;gt;:key =&amp;gt; value&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;key: value format&amp;lt;/code&amp;gt; according to the requirements in the '''Global Rules'''&amp;lt;ref&amp;gt;https://docs.google.com/document/d/1qQD7fcypFk77nq7Jx7ZNyCNpLyt1oXKaq5G-W7zkV3k/edit&amp;lt;/ref&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
7. The method &amp;lt;code&amp;gt;def show_code_files_diffIn&amp;lt;/code&amp;gt; is too complex, we created a new method: &amp;lt;code&amp;gt;def self.populate_shareObj &amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;review_files_helper.rb&amp;lt;/code&amp;gt; to perform part of the &amp;lt;code&amp;gt;show_code_files_diff&amp;lt;/code&amp;gt;.&lt;br /&gt;
  def self.populate_shareObj(processor)&lt;br /&gt;
    first_line_num = []&lt;br /&gt;
    second_line_num = []&lt;br /&gt;
    first_offset = []&lt;br /&gt;
    second_offset = []&lt;br /&gt;
    offsetswithcomments_file1 = []&lt;br /&gt;
    offsetswithcomments_file2 = []&lt;br /&gt;
    first_offset &amp;lt;&amp;lt; 0&lt;br /&gt;
    second_offset &amp;lt;&amp;lt; 0&lt;br /&gt;
    first_count = 0&lt;br /&gt;
    second_count = 0&lt;br /&gt;
    for i in (0..processor.absolute_line_num)&lt;br /&gt;
      first_offset = ReviewFile.get_first_offset(processor, i, @first_offset)&lt;br /&gt;
      second_offset = ReviewFile.get_second_offset(processor, i, @second_offset)&lt;br /&gt;
      first_line_num_new = Hash.new&lt;br /&gt;
      first_line_num_new = ReviewFile.get_first_line_num(processor, i, first_count)&lt;br /&gt;
      first_line_num &amp;lt;&amp;lt; first_line_num[:first_line_num]&lt;br /&gt;
      first_count = first_line_num[:first_count]&lt;br /&gt;
      second_line_num_new = Hash.new&lt;br /&gt;
      second_line_num_new = ReviewFile.get_second_line_num(processor, i,second_count)&lt;br /&gt;
      second_line_num &amp;lt;&amp;lt; second_line_num[:second_line_num]&lt;br /&gt;
      second_count = second_line_num[:second_count]&lt;br /&gt;
      # Remove newlines at the end of this line of code&lt;br /&gt;
      processor = ReviewFile.get_first_file_array(processor, i)&lt;br /&gt;
      processor = ReviewFile.get_second_file_array(processor, i)&lt;br /&gt;
      shareObj = Hash.new()&lt;br /&gt;
      shareObj['linearray1'] = processor.first_file_array&lt;br /&gt;
      shareObj['linearray2'] = processor.second_file_array&lt;br /&gt;
      shareObj['comparator'] = processor.comparison_array&lt;br /&gt;
      shareObj['linenumarray1'] = first_line_num&lt;br /&gt;
      shareObj['linenumarray2'] = second_line_num&lt;br /&gt;
      shareObj['offsetarray1'] = first_offset&lt;br /&gt;
      shareObj['offsetarray2'] = second_offset&lt;br /&gt;
      return first_line_num, second_line_num, first_count, second_count, shareObj&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
8. In &amp;lt;code&amp;gt;review_files_helper.rb&amp;lt;/code&amp;gt;, created a new method: &amp;lt;code&amp;gt;def self.find_review_files&amp;lt;/code&amp;gt;, which contains some statements in &amp;lt;code&amp;gt;def show_all_submitted_files&amp;lt;/code&amp;gt;.&lt;br /&gt;
  def self.find_review_files(participant) &lt;br /&gt;
    # Find all files over all versions submitted by the team&lt;br /&gt;
    all_review_files = Array.new&lt;br /&gt;
    if participant.assignment.team_assignment&lt;br /&gt;
      participant.team.get_participants.each_with_index { |member,index|&lt;br /&gt;
        all_review_files += ReviewFile.where(author_participant_id: member.id)&lt;br /&gt;
      }&lt;br /&gt;
    else&lt;br /&gt;
      all_review_files = ReviewFile.where(author_participant_id: @participant.id)&lt;br /&gt;
    end&lt;br /&gt;
    all_review_files&lt;br /&gt;
  end&lt;br /&gt;
9. In &amp;lt;code&amp;gt;review_files_helper.rb&amp;lt;/code&amp;gt;, created a new method: &amp;lt;code&amp;gt;def self.find_review_versions&amp;lt;/code&amp;gt;, which contains some statements in &amp;lt;code&amp;gt;def show_all_submitted_files&amp;lt;/code&amp;gt;.&lt;br /&gt;
  def self.find_review_versions(all_review_files) &lt;br /&gt;
    file_version_map = Hash.new&lt;br /&gt;
    all_review_files.each_with_index do |each_file,index|&lt;br /&gt;
      file_version_map[File.basename(each_file.filepath)] = Array.new unless&lt;br /&gt;
      file_version_map[File.basename(each_file.filepath)]&lt;br /&gt;
      file_version_map[File.basename(each_file.filepath)] &amp;lt;&amp;lt; each_file.version_number&lt;br /&gt;
    end&lt;br /&gt;
    return file_version_map&lt;br /&gt;
  end&lt;br /&gt;
==Refactoring &amp;lt;code&amp;gt;submitted_content_controller.rb&amp;lt;/code&amp;gt;==&lt;br /&gt;
1. Changed &amp;lt;code&amp;gt;and&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;or&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;&amp;amp;&amp;amp;&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;||&amp;lt;/code&amp;gt; to meet the requirements in the [https://docs.google.com/document/d/1qQD7fcypFk77nq7Jx7ZNyCNpLyt1oXKaq5G-W7zkV3k/edit Global Rules].&lt;br /&gt;
&lt;br /&gt;
2. Rewrited all &amp;lt;code&amp;gt;:key =&amp;gt; value&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;key: value format&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
3. Rewrited all param['string'] to params[:string].&lt;br /&gt;
&lt;br /&gt;
4. Added one more routes &amp;lt;code&amp;gt;post :folder_action&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;config/routes.rb&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
5. Changed all &amp;lt;code&amp;gt;array.size == 0&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;array.zero?&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
6. Changed all &amp;lt;code&amp;gt;find_by_x(val)&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;where(&amp;quot;x=val&amp;quot;)&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;where(x: val)&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
7. In &amp;lt;code&amp;gt;def remove_hyperlink&amp;lt;/code&amp;gt;, deleted redundant line:&lt;br /&gt;
 @participant = AssignmentParticipant.find(params[:id])&lt;br /&gt;
8. In &amp;lt;code&amp;gt;def download&amp;lt;/code&amp;gt;, deleted commented line:&lt;br /&gt;
 #folder_name = FileHelper::sanitize_folder(@current_folder.name)&lt;br /&gt;
&lt;br /&gt;
=Results Screenshot=&lt;br /&gt;
After fixing the bug #483, now the submit files function works.&lt;br /&gt;
&lt;br /&gt;
[[File:ossp2.png]]&lt;br /&gt;
&lt;br /&gt;
The file is stored at:&lt;br /&gt;
&lt;br /&gt;
[[File:ossp3.png]]&lt;br /&gt;
&lt;br /&gt;
= References=&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Pdeng</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015/oss_E1507_DG&amp;diff=96459</id>
		<title>CSC/ECE 517 Spring 2015/oss E1507 DG</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015/oss_E1507_DG&amp;diff=96459"/>
		<updated>2015-04-02T01:33:49Z</updated>

		<summary type="html">&lt;p&gt;Pdeng: /* Project Desicriptionhttps://docs.google.com/document/d/1J0WUBtYV_MDhpEQ-50z8gXE-OrvVkpEaZxvn_9RCAsM/edit# */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''E1507. Refactoring Review Files Controller &amp;amp; Submitted Content Controller'''&lt;br /&gt;
&lt;br /&gt;
This page provides a description of the Expertiza based OSS project. This project aimed at refactoring the Review Files Controller &amp;amp; Submitted Content Controller as well as fixing the bug [https://github.com/expertiza/expertiza/issues/483 #483]&lt;br /&gt;
&lt;br /&gt;
=What is Expertiza=&lt;br /&gt;
[http://http://expertiza.ncsu.edu/ Expertiza] is a [http://en.wikipedia.org/wiki/Open-source_software Open Source] [http://rubyonrails.org/ Rails] application where students can submit and peer-review learning objects (articles, code, web sites, etc). It is used in select courses at NC State and by professors at several other colleges and universities.  This Open Source application can be cloned from [https://github.com/expertiza/expertiza/ Github], the latest active branch is [https://github.com/expertiza/expertiza/tree/rails4 &amp;quot;Rails 4&amp;quot;].&lt;br /&gt;
&lt;br /&gt;
=Project Desicription&amp;lt;ref&amp;gt;https://docs.google.com/document/d/1J0WUBtYV_MDhpEQ-50z8gXE-OrvVkpEaZxvn_9RCAsM/edit#&amp;lt;/ref&amp;gt;=&lt;br /&gt;
There are 3 major objects for this project:&lt;br /&gt;
&lt;br /&gt;
1. Fix Bug #483&amp;lt;ref&amp;gt;https://github.com/expertiza/expertiza/issues/483&amp;lt;/ref&amp;gt;, which causes some error and prevent users to get access to the submitted_content page.&lt;br /&gt;
&lt;br /&gt;
2. Refactor Review file controller and Submitted content controller, so that large methods can be divided into smaller methods and make the code more readable and understandable.&lt;br /&gt;
&lt;br /&gt;
3. Replace some codes based on Global Rules&amp;lt;ref&amp;gt;https://docs.google.com/document/d/1qQD7fcypFk77nq7Jx7ZNyCNpLyt1oXKaq5G-W7zkV3k/edit?usp=sharing&amp;lt;/ref&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
==Bug #483==&lt;br /&gt;
In &amp;quot;Your works&amp;quot; view, students can only submit links but no files.&lt;br /&gt;
&lt;br /&gt;
[[File:Ossp1.png]]&lt;br /&gt;
&lt;br /&gt;
This is caused by commit [https://github.com/expertiza/expertiza/commit/f313711fee2dd92e324603b9c506d9d5470c3b60 f313711] where the line 13 in [https://github.com/expertiza/expertiza/blob/f313711fee2dd92e324603b9c506d9d5470c3b60/app/views/submitted_content/_main.html.erb submitted_content/_main.html.erb] was commented out.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;%#= render partial: 'submitted_content/submitted_files', locals: {participant: @participant, stage: @stage} %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
But after uncommented line 13 in &amp;lt;code&amp;gt;submitted_content/_main.html.erb&amp;lt;/code&amp;gt; and refresh the page, the Rails Server stopped responding.&lt;br /&gt;
&lt;br /&gt;
==Refactoring Review Files Controller &amp;amp; Submitted Content Controller==&lt;br /&gt;
===What they do===&lt;br /&gt;
This [https://github.com/expertiza/expertiza/blob/rails4/app/controllers/review_files_controller.rb review_files_controller.rb] is responsible for handling the review files of the participants. This controller helps in uploading newer versions of reviews for an assignment and also in displaying all the versions (and diff between versions/code) with the help of [https://github.com/expertiza/expertiza/blob/rails4/app/controllers/submitted_content_controller.rb submitted_content_controller.rb].&lt;br /&gt;
===What’s wrong with them===&lt;br /&gt;
There are quite a few complex functions inside these controllers. These functions can easily be broken up into much more smaller methods with specific functionalities. They also need to be refactored to meet the [https://docs.google.com/document/d/1qQD7fcypFk77nq7Jx7ZNyCNpLyt1oXKaq5G-W7zkV3k/edit Global Rules].&lt;br /&gt;
&lt;br /&gt;
==What needs to be done==&lt;br /&gt;
1.Fix this bug #483&lt;br /&gt;
&lt;br /&gt;
2.Break up the complex methods such as &amp;lt;code&amp;gt;get_comments&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;show_code_file_diff&amp;lt;/code&amp;gt;. Anything that can be modularized should be modularized (Single Responsibility)&lt;br /&gt;
&lt;br /&gt;
3.While breaking up the complex methods, look out for possible helper functions. If there are any, move them to the &amp;lt;code&amp;gt;review_files_helper.rb&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4.Remove commented out code from the controller&lt;br /&gt;
&lt;br /&gt;
5.Refactor the file based on Global Rules provided at the top of this document&lt;br /&gt;
&lt;br /&gt;
=Changes Made=&lt;br /&gt;
==Files involved==&lt;br /&gt;
 review_files_controller.rb&lt;br /&gt;
 submitted_content_controller.rb&lt;br /&gt;
 review_files_helper.rb&lt;br /&gt;
 review_comments_helper.rb&lt;br /&gt;
 submitted_content/_main.html.erb&lt;br /&gt;
 model/assignment.rb&lt;br /&gt;
==For Bug #483 fixing==&lt;br /&gt;
Git log can be viewed in commit [https://github.com/KeleiAzz/expertiza/commit/aa37e2e61d0bf93a9bd0707621cd764017252f58 aa37e2e]&lt;br /&gt;
&lt;br /&gt;
1. In &amp;lt;code&amp;gt;submitted_content_controller.rb&amp;lt;/code&amp;gt;, line 19. &lt;br /&gt;
 if @assignment.max_team_size &amp;gt; 1 &amp;amp;&amp;amp; @participant.team.nil?&lt;br /&gt;
      flash[:error] = &amp;quot;This is a team assignment. Before submitting your work, you must &amp;lt;a style='color: blue;' href='../../student_teams/view/?student_id=#{params[:id]}'&amp;gt;create a team&amp;lt;/a&amp;gt;, &lt;br /&gt;
                      even if you will be the only member of the team&amp;quot;&lt;br /&gt;
      redirect_to controller: 'student_task', action: 'view', id: params[:id]&lt;br /&gt;
 else if @participant.team.nil?&lt;br /&gt;
      #create a new team for current user before submission&lt;br /&gt;
      team = AssignmentTeam.create_team_and_node(@assignment.id)&lt;br /&gt;
      team.add_member(User.find(@participant.user_id),@assignment.id)&lt;br /&gt;
 end&lt;br /&gt;
This &amp;lt;code&amp;gt;else if&amp;lt;/code&amp;gt; must be a mistake, so we changed it to:&lt;br /&gt;
 &amp;lt;code&amp;gt;elsif @participant.team.nil?&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2. In &amp;lt;code&amp;gt;model/assignment.rb&amp;lt;/code&amp;gt;, line 489. &lt;br /&gt;
 &amp;lt;code&amp;gt;Course.find(self.course_id).get_path&amp;lt;/code&amp;gt;&lt;br /&gt;
The &amp;lt;code&amp;gt;Course&amp;lt;/code&amp;gt; model doesn't have an attribute called &amp;lt;code&amp;gt;get_path&amp;lt;/code&amp;gt;, it should be &amp;lt;code&amp;gt;directory_path&amp;lt;/code&amp;gt;, so we changed it to&lt;br /&gt;
 &amp;lt;code&amp;gt;Course.find(self.course_id).directory_path&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3. In &amp;lt;code&amp;gt;submitted_content/_main.html.erb&amp;lt;/code&amp;gt;, line 18.&lt;br /&gt;
 &amp;lt;% if participant.assignment.is_coding_assignment%&amp;gt;&lt;br /&gt;
      &amp;lt;%= link_to &amp;quot;Code Review Dashboard&amp;quot;, :controller =&amp;gt; 'review_files',&lt;br /&gt;
        :action =&amp;gt; 'show_all_submitted_files',&lt;br /&gt;
        :participant_id =&amp;gt; assignment_participant.id,&lt;br /&gt;
        :stage =&amp;gt; stage %&amp;gt;&lt;br /&gt;
    &amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
 &amp;lt;% end %&amp;gt;&lt;br /&gt;
As in this page there doesn't have a parameter called &amp;lt;code&amp;gt;assignment_participant&amp;lt;/code&amp;gt;, as it need to get the participant's id, so we changed this line to:&lt;br /&gt;
 &amp;lt;code&amp;gt;:participant_id =&amp;gt; participant.id&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4. In &amp;lt;code&amp;gt;config/routes.rb&amp;lt;/code&amp;gt;. Added one more routes&lt;br /&gt;
 &amp;lt;code&amp;gt;post :submit_file&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Refactoring &amp;lt;code&amp;gt;review_files_controller.rb&amp;lt;/code&amp;gt;==&lt;br /&gt;
&lt;br /&gt;
1. Changed &amp;lt;code&amp;gt;and&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;or&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;&amp;amp;&amp;amp;&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;||&amp;lt;/code&amp;gt; to meet the requirements in the [https://docs.google.com/document/d/1qQD7fcypFk77nq7Jx7ZNyCNpLyt1oXKaq5G-W7zkV3k/edit Global Rules].&lt;br /&gt;
&lt;br /&gt;
2. In &amp;lt;code&amp;gt;def get_comments&amp;lt;/code&amp;gt;, deleted unused variable:&lt;br /&gt;
 &amp;lt;code&amp;gt;newobj = ReviewComment.where(review_file_id: params[:file_id])&amp;lt;/code&amp;gt;;&lt;br /&gt;
&lt;br /&gt;
3. In &amp;lt;code&amp;gt;def show_all_submitted_files&amp;lt;/code&amp;gt;, deleted unused variable: &lt;br /&gt;
 file_path = ReviewFile.get_file(code_review_dir, versions.sort.last,base_filename)&lt;br /&gt;
&lt;br /&gt;
4. In &amp;lt;code&amp;gt;def show_all_submitted_files&amp;lt;/code&amp;gt;, deleted unused variable:&lt;br /&gt;
 code_review_dir = ReviewFilesHelper::get_code_review_file_dir(AssignmentParticipant.find(auth[base_filename][versions.sort.last]))&lt;br /&gt;
&lt;br /&gt;
5. The method &amp;lt;code&amp;gt;def get_comments&amp;lt;/code&amp;gt; is too complex, so we modularized part of its code in &amp;lt;code&amp;gt;review_comments_helper.rb&amp;lt;/code&amp;gt;, we created a new method: &amp;lt;code&amp;gt;def self.populate_comments&amp;lt;/code&amp;gt;, which returns &amp;lt;code&amp;gt;handle, comment, authorflag&amp;lt;/code&amp;gt; these three variables.&lt;br /&gt;
  def self.populate_comments(params, authorflag, comment)&lt;br /&gt;
    assignmentparticipant = AssignmentParticipant.find(params[:participant_id])&lt;br /&gt;
    current_participant = AssignmentParticipant.where(parent_id: assignmentparticipant[:parent_id], user_id: session[:user].id).first&lt;br /&gt;
    if current_participant.id.to_s == params[:participant_id]&lt;br /&gt;
      authorflag = 1&lt;br /&gt;
    else&lt;br /&gt;
      authorflag = 0&lt;br /&gt;
    end&lt;br /&gt;
    member = []&lt;br /&gt;
    if assignmentparticipant.assignment.team_assignment&lt;br /&gt;
      assignmentparticipant.team.get_participants.each_with_index {|member1, index|&lt;br /&gt;
        member[index] = member1.id&lt;br /&gt;
      }&lt;br /&gt;
    end&lt;br /&gt;
    if (comment[:reviewer_participant_id] ==  current_participant.id)&lt;br /&gt;
      handle = &amp;quot;Me :&amp;quot;&lt;br /&gt;
      authorflag = 0&lt;br /&gt;
    elsif member.include? comment[:reviewer_participant_id] || comment[:reviewer_participant_id] == assignmentparticipant.id&lt;br /&gt;
      handle = &amp;quot;Author :&amp;quot;&lt;br /&gt;
      authorflag = 0&lt;br /&gt;
    else&lt;br /&gt;
      handle = &amp;quot;Reviewer&amp;quot;+comment[:reviewer_participant_id].to_s&lt;br /&gt;
    end&lt;br /&gt;
    return handle, comment, authorflag&lt;br /&gt;
  end&lt;br /&gt;
6. Rewrited all &amp;lt;code&amp;gt;:key =&amp;gt; value&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;key: value format&amp;lt;/code&amp;gt; according to the requirements in the '''Global Rules'''&amp;lt;ref&amp;gt;https://docs.google.com/document/d/1qQD7fcypFk77nq7Jx7ZNyCNpLyt1oXKaq5G-W7zkV3k/edit&amp;lt;/ref&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
7. The method &amp;lt;code&amp;gt;def show_code_files_diffIn&amp;lt;/code&amp;gt; is too complex, we created a new method: &amp;lt;code&amp;gt;def self.populate_shareObj &amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;review_files_helper.rb&amp;lt;/code&amp;gt; to perform part of the &amp;lt;code&amp;gt;show_code_files_diff&amp;lt;/code&amp;gt;.&lt;br /&gt;
  def self.populate_shareObj(processor)&lt;br /&gt;
    first_line_num = []&lt;br /&gt;
    second_line_num = []&lt;br /&gt;
    first_offset = []&lt;br /&gt;
    second_offset = []&lt;br /&gt;
    offsetswithcomments_file1 = []&lt;br /&gt;
    offsetswithcomments_file2 = []&lt;br /&gt;
    first_offset &amp;lt;&amp;lt; 0&lt;br /&gt;
    second_offset &amp;lt;&amp;lt; 0&lt;br /&gt;
    first_count = 0&lt;br /&gt;
    second_count = 0&lt;br /&gt;
    for i in (0..processor.absolute_line_num)&lt;br /&gt;
      first_offset = ReviewFile.get_first_offset(processor, i, @first_offset)&lt;br /&gt;
      second_offset = ReviewFile.get_second_offset(processor, i, @second_offset)&lt;br /&gt;
      first_line_num_new = Hash.new&lt;br /&gt;
      first_line_num_new = ReviewFile.get_first_line_num(processor, i, first_count)&lt;br /&gt;
      first_line_num &amp;lt;&amp;lt; first_line_num[:first_line_num]&lt;br /&gt;
      first_count = first_line_num[:first_count]&lt;br /&gt;
      second_line_num_new = Hash.new&lt;br /&gt;
      second_line_num_new = ReviewFile.get_second_line_num(processor, i,second_count)&lt;br /&gt;
      second_line_num &amp;lt;&amp;lt; second_line_num[:second_line_num]&lt;br /&gt;
      second_count = second_line_num[:second_count]&lt;br /&gt;
      # Remove newlines at the end of this line of code&lt;br /&gt;
      processor = ReviewFile.get_first_file_array(processor, i)&lt;br /&gt;
      processor = ReviewFile.get_second_file_array(processor, i)&lt;br /&gt;
      shareObj = Hash.new()&lt;br /&gt;
      shareObj['linearray1'] = processor.first_file_array&lt;br /&gt;
      shareObj['linearray2'] = processor.second_file_array&lt;br /&gt;
      shareObj['comparator'] = processor.comparison_array&lt;br /&gt;
      shareObj['linenumarray1'] = first_line_num&lt;br /&gt;
      shareObj['linenumarray2'] = second_line_num&lt;br /&gt;
      shareObj['offsetarray1'] = first_offset&lt;br /&gt;
      shareObj['offsetarray2'] = second_offset&lt;br /&gt;
      return first_line_num, second_line_num, first_count, second_count, shareObj&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
8. In &amp;lt;code&amp;gt;review_files_helper.rb&amp;lt;/code&amp;gt;, created a new method: &amp;lt;code&amp;gt;def self.find_review_files&amp;lt;/code&amp;gt;, which contains some statements in &amp;lt;code&amp;gt;def show_all_submitted_files&amp;lt;/code&amp;gt;.&lt;br /&gt;
  def self.find_review_files(participant) &lt;br /&gt;
    # Find all files over all versions submitted by the team&lt;br /&gt;
    all_review_files = Array.new&lt;br /&gt;
    if participant.assignment.team_assignment&lt;br /&gt;
      participant.team.get_participants.each_with_index { |member,index|&lt;br /&gt;
        all_review_files += ReviewFile.where(author_participant_id: member.id)&lt;br /&gt;
      }&lt;br /&gt;
    else&lt;br /&gt;
      all_review_files = ReviewFile.where(author_participant_id: @participant.id)&lt;br /&gt;
    end&lt;br /&gt;
    all_review_files&lt;br /&gt;
  end&lt;br /&gt;
9. In &amp;lt;code&amp;gt;review_files_helper.rb&amp;lt;/code&amp;gt;, created a new method: &amp;lt;code&amp;gt;def self.find_review_versions&amp;lt;/code&amp;gt;, which contains some statements in &amp;lt;code&amp;gt;def show_all_submitted_files&amp;lt;/code&amp;gt;.&lt;br /&gt;
  def self.find_review_versions(all_review_files) &lt;br /&gt;
    file_version_map = Hash.new&lt;br /&gt;
    all_review_files.each_with_index do |each_file,index|&lt;br /&gt;
      file_version_map[File.basename(each_file.filepath)] = Array.new unless&lt;br /&gt;
      file_version_map[File.basename(each_file.filepath)]&lt;br /&gt;
      file_version_map[File.basename(each_file.filepath)] &amp;lt;&amp;lt; each_file.version_number&lt;br /&gt;
    end&lt;br /&gt;
    return file_version_map&lt;br /&gt;
  end&lt;br /&gt;
==Refactoring &amp;lt;code&amp;gt;submitted_content_controller.rb&amp;lt;/code&amp;gt;==&lt;br /&gt;
1. Changed &amp;lt;code&amp;gt;and&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;or&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;&amp;amp;&amp;amp;&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;||&amp;lt;/code&amp;gt; to meet the requirements in the [https://docs.google.com/document/d/1qQD7fcypFk77nq7Jx7ZNyCNpLyt1oXKaq5G-W7zkV3k/edit Global Rules].&lt;br /&gt;
&lt;br /&gt;
2. Rewrited all &amp;lt;code&amp;gt;:key =&amp;gt; value&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;key: value format&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
3. Rewrited all param['string'] to params[:string].&lt;br /&gt;
&lt;br /&gt;
4. Added one more routes &amp;lt;code&amp;gt;post :folder_action&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;config/routes.rb&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
5. Changed all &amp;lt;code&amp;gt;array.size == 0&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;array.zero?&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
6. Changed all &amp;lt;code&amp;gt;find_by_x(val)&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;where(&amp;quot;x=val&amp;quot;)&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;where(x: val)&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
7. In &amp;lt;code&amp;gt;def remove_hyperlink&amp;lt;/code&amp;gt;, deleted redundant line:&lt;br /&gt;
 @participant = AssignmentParticipant.find(params[:id])&lt;br /&gt;
8. In &amp;lt;code&amp;gt;def download&amp;lt;/code&amp;gt;, deleted commented line:&lt;br /&gt;
 #folder_name = FileHelper::sanitize_folder(@current_folder.name)&lt;br /&gt;
&lt;br /&gt;
=Results Screenshot=&lt;br /&gt;
After fixing the bug #483, now the submit files function works.&lt;br /&gt;
&lt;br /&gt;
[[File:ossp2.png]]&lt;br /&gt;
&lt;br /&gt;
The file is stored at:&lt;br /&gt;
&lt;br /&gt;
[[File:ossp3.png]]&lt;br /&gt;
&lt;br /&gt;
= References=&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Pdeng</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015_E1526_MPRI&amp;diff=96396</id>
		<title>CSC/ECE 517 Spring 2015 E1526 MPRI</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015_E1526_MPRI&amp;diff=96396"/>
		<updated>2015-04-01T05:28:36Z</updated>

		<summary type="html">&lt;p&gt;Pdeng: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;font size=&amp;quot;5&amp;quot;&amp;gt;&amp;lt;b&amp;gt;E1526. Responsive web design for Expertiza&amp;lt;/b&amp;gt;&amp;lt;/font&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
= Introduction to Expertiza =&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is a large project developed as a combined effort of students and faculty using the [http://rubyonrails.org/ Ruby on Rails] framework. The main advantage of using Expertiza, in an educational environment, is for the instructor to introduce peer reviewing among the students. Expertiza allows the instructor to create and customize assignments, create a list of topics the students can sign up for, have students work on teams and then review each other's assignments at the end. Expertiza supports submission of almost any document type, including the URLs and wiki pages.&lt;br /&gt;
&lt;br /&gt;
Expertiza is supported by National Science Foundation under Grant No. 0536558. Additional funding from the [http://www.ncsu.edu/ NCSU] [http://litre.ncsu.edu/ Learning in a Technology-Rich Environment] (LITRE) program, the NCSU [http://ofd.ncsu.edu/teaching-learning/ Faculty Center for Teaching and Learning], the NCSU [http://stem.ncsu.edu/ STEM] Initiative, and the Center for Advanced Computing and Communication.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
= Problem Statement =&lt;br /&gt;
&lt;br /&gt;
Despite an amazing set of functionality Expertiza offers, there are numerous parts of it that could use of a more stylish look and an improved user experience. The goal of this project is to use both Bootstrap and AngularJS to improve the look of the entire Expertiza including the representations of buttons, tables, and other elements. Certain changes in design will also improve the efficiency of the web app when it comes to the amount of time it takes for a page to be loaded.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
= Explanation of Tasks =&lt;br /&gt;
Below are detailed explanations to the tasks listed in the description documentation.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 1. Replace Buttons and Links to Bootstrap styled Buttons ==&lt;br /&gt;
Now, many elements, like 'back', are hyperlink rather than buttons, and it will be much better to replace these plain styled text to Bootstrap buttons.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 2. Create new theme ==&lt;br /&gt;
The theme of Expertiza looks primitive now, a new theme with fix menu on the top is much prefered.&lt;br /&gt;
&lt;br /&gt;
For example, the theme with fixed-top navigation bar on Virgin American website&lt;br /&gt;
&lt;br /&gt;
[[File:Picture4-2.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 3. Auto hides contents on the dashboard for instructors ==&lt;br /&gt;
Please refer to the later part of this article: [[#Manage-Course page|Manage-Course page]] for viewing the current design&lt;br /&gt;
&lt;br /&gt;
Now, when trying to open manage-courses, all records are loaded before rendering them onto the page, which takes too long time to load and is not responsive at all.&lt;br /&gt;
&lt;br /&gt;
Better practice is on Virgin American’s website: https://www.virginamerica.com/book/rt/a1/sfo_bos/20150401_20150402&lt;br /&gt;
&lt;br /&gt;
When the website is representing the calendar, the price for each day is not actually loaded. But the skeleton of the page, which is the calendar in this case, can be displayed first.&lt;br /&gt;
&lt;br /&gt;
[[File:Picture5.png]]&lt;br /&gt;
&lt;br /&gt;
So in Expertiza, we can create several buttons for course semesters in the page. After clicking on Fall 2014, the courses for Fall 2014 will come out. &lt;br /&gt;
&lt;br /&gt;
And if the list is still too long and takes a long time load, we can use a ‘show more’ button ,or automatically load more data when the scroll bar reaching the end of the page, to minimize the content we need to load after one single mouse click. &lt;br /&gt;
&lt;br /&gt;
[[File:Picture6.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 4. Simplify Action Panel ==&lt;br /&gt;
We will need to reduce the number of buttons. For example, the first row are actions for assignments and the second row is for participant. So we can replace them to 5 buttons with responsive design, that is, no redirecting happens after clicking on the buttons.&lt;br /&gt;
&lt;br /&gt;
[[File:Picture7.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 5. Offer Better UI for Managing Users ==&lt;br /&gt;
&lt;br /&gt;
Please refer to the later part of this article: [[#Manage-User page|Manage-User page]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 6. Make grades_view Responsive with Better Design ==&lt;br /&gt;
&lt;br /&gt;
Similar to the previous tasks, we will need to make it responsive. &lt;br /&gt;
&lt;br /&gt;
After clicking on ‘Your scores’, all reviews are loaded before rendering the page now. That takes a long time to load and the length of review list is too long.&lt;br /&gt;
&lt;br /&gt;
[[File:Picture8.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Pages To Be Modified =&lt;br /&gt;
For this project, it is difficult to re-design all webpages and make them responsive. After discussing with the contact person, we will be focusing only on these 3 pages:&lt;br /&gt;
&lt;br /&gt;
=='''Login Page'''==&lt;br /&gt;
[[File:Picture1.png]]&lt;br /&gt;
&lt;br /&gt;
=== What's wrong with it ===&lt;br /&gt;
1. Now it takes more than 15 seconds to even login to the admin's home page with the sample development database. This is definitely not good enough for a daily used web application. &lt;br /&gt;
&lt;br /&gt;
The cause for the long rendering time is that it will be redirected to 'tree_display/list', which needs to fetch all questionnaires, courses and assignments before page rendering.&lt;br /&gt;
&lt;br /&gt;
2. The webpage looks primitive.&lt;br /&gt;
&lt;br /&gt;
=== What changes need to be made ===&lt;br /&gt;
1. Actually it is unnecessary to fetch all data at the very beginning; if there is too much data to present, the list will be extremely long and it is quite hard for users to locate a specific course. &lt;br /&gt;
&lt;br /&gt;
So, we will use AngularJS and jQuery to make a asynchronous webpage that delays the database query until all the basic html elements are correctly rendered, or until the user explicitly asks for that part of data.&lt;br /&gt;
&lt;br /&gt;
2. Bootstrap will be applied for better user interfaces.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Manage-Course page'''==&lt;br /&gt;
[[File:Picture2.png]]&lt;br /&gt;
&lt;br /&gt;
=== What's wrong with it ===&lt;br /&gt;
As illustrated above, now the displaying list is too long and it takes too long to scroll to the end, which makes locating a specific course quite difficult.&lt;br /&gt;
&lt;br /&gt;
Also, loading time can be reduced.&lt;br /&gt;
&lt;br /&gt;
=== What changes need to be made ===&lt;br /&gt;
1. Create several buttons for different time intervals, for example, after clicking on the button '2013-2014', only courses for 2013 to 2014 are presenting, and there is no redirection during this process.&lt;br /&gt;
&lt;br /&gt;
2. The database should not be executed before the user clicks on the button. Only parts of databased is fetched when each button is clicked.&lt;br /&gt;
&lt;br /&gt;
3. Bootstrap will be applied for better user interfaces.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Manage-User page'''==&lt;br /&gt;
[[File:Picture3.png]]&lt;br /&gt;
&lt;br /&gt;
=== What's wrong with it ===&lt;br /&gt;
1. The list is too long: if there are 20k users in the database, there will be 20k rows in this table in a one page!&lt;br /&gt;
&lt;br /&gt;
2. When clicking on the letter A-Z, redirections happen and the whole page is reloaded.&lt;br /&gt;
&lt;br /&gt;
=== What changes need to be made ===&lt;br /&gt;
1. Load only a given number of records to the view, such as 100 records, when accessing into this page for the first time.&lt;br /&gt;
&lt;br /&gt;
2. Using AngularJS to eliminate the redirections and page reloading for better UI performance.&lt;/div&gt;</summary>
		<author><name>Pdeng</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015_E1526_MPRI&amp;diff=96395</id>
		<title>CSC/ECE 517 Spring 2015 E1526 MPRI</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015_E1526_MPRI&amp;diff=96395"/>
		<updated>2015-04-01T05:27:56Z</updated>

		<summary type="html">&lt;p&gt;Pdeng: /* Explanation of Tasks */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;font size=&amp;quot;5&amp;quot;&amp;gt;&amp;lt;b&amp;gt;E1526. Responsive web design for Expertiza&amp;lt;/b&amp;gt;&amp;lt;/font&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
= Introduction to Expertiza =&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is a large project developed as a combined effort of students and faculty using the [http://rubyonrails.org/ Ruby on Rails] framework. The main advantage of using Expertiza, in an educational environment, is for the instructor to introduce peer reviewing among the students. Expertiza allows the instructor to create and customize assignments, create a list of topics the students can sign up for, have students work on teams and then review each other's assignments at the end. Expertiza supports submission of almost any document type, including the URLs and wiki pages.&lt;br /&gt;
&lt;br /&gt;
Expertiza is supported by National Science Foundation under Grant No. 0536558. Additional funding from the [http://www.ncsu.edu/ NCSU] [http://litre.ncsu.edu/ Learning in a Technology-Rich Environment] (LITRE) program, the NCSU [http://ofd.ncsu.edu/teaching-learning/ Faculty Center for Teaching and Learning], the NCSU [http://stem.ncsu.edu/ STEM] Initiative, and the Center for Advanced Computing and Communication.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
= Problem Statement =&lt;br /&gt;
&lt;br /&gt;
Despite an amazing set of functionality Expertiza offers, there are numerous parts of it that could use of a more stylish look and an improved user experience. The goal of this project is to use both Bootstrap and AngularJS to improve the look of the entire Expertiza including the representations of buttons, tables, and other elements. Certain changes in design will also improve the efficiency of the web app when it comes to the amount of time it takes for a page to be loaded.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
= Explanation of Tasks =&lt;br /&gt;
Below are detailed explanations to the tasks listed in the description documentation.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 1. Replace Buttons and Links to Bootstrap styled Buttons ==&lt;br /&gt;
Now, many elements, like 'back', are hyperlink rather than buttons, and it will be much better to replace these plain styled text to Bootstrap buttons.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 2. Create new theme ==&lt;br /&gt;
The theme of Expertiza looks primitive now, a new theme with fix menu on the top is much prefered.&lt;br /&gt;
&lt;br /&gt;
For example, the theme with fixed-top navigation bar on Virgin American website&lt;br /&gt;
&lt;br /&gt;
[[File:Picture4-2.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 3. Auto hides contents on the dashboard for instructors ==&lt;br /&gt;
Please refer to the later part of this article: [[#Manage-Course page|Manage-Course page]] for viewing the current design&lt;br /&gt;
&lt;br /&gt;
Now, when trying to open manage-courses, all records are loaded before rendering them onto the page, which takes too long time to load and is not responsive at all.&lt;br /&gt;
&lt;br /&gt;
Better practice is on Virgin American’s website: https://www.virginamerica.com/book/rt/a1/sfo_bos/20150401_20150402&lt;br /&gt;
&lt;br /&gt;
When the website is representing the calendar, the price for each day is not actually loaded. But the skeleton of the page, which is the calendar in this case, can be displayed first.&lt;br /&gt;
&lt;br /&gt;
[[File:Picture5.png]]&lt;br /&gt;
&lt;br /&gt;
So in Expertiza, we can create several buttons for course semesters in the page. After clicking on Fall 2014, the courses for Fall 2014 will come out. &lt;br /&gt;
&lt;br /&gt;
And if the list is still too long and takes a long time load, we can use a ‘show more’ button ,or automatically load more data when the scroll bar reaching the end of the page, to minimize the content we need to load after one single mouse click. &lt;br /&gt;
&lt;br /&gt;
[[File:Picture6.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 4. Simplify Action Panel ==&lt;br /&gt;
We will need to reduce the number of buttons. For example, the first row are actions for assignments and the second row is for participant. So we can replace them to 5 buttons with responsive design, that is, no redirecting happens after clicking on the buttons.&lt;br /&gt;
&lt;br /&gt;
[[File:Picture7.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 5. Offer Better UI for Managing Users ==&lt;br /&gt;
&lt;br /&gt;
Please refer to the later part of this article: [[#Manage-User page|Manage-User page]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 6. Make grades_view Responsive with Better Design ==&lt;br /&gt;
&lt;br /&gt;
Similar to the previous tasks, we will need to make it responsive. &lt;br /&gt;
&lt;br /&gt;
After clicking on ‘Your scores’, all reviews are loaded before rendering the page now. That takes a long time to load and the length of review list is too long.&lt;br /&gt;
&lt;br /&gt;
[[File:Picture8.png]]&lt;br /&gt;
&lt;br /&gt;
= Pages To Be Modified =&lt;br /&gt;
For this project, it is difficult to re-design all webpages and make them responsive. After discussing with the contact person, we will be focusing only on these 3 pages:&lt;br /&gt;
&lt;br /&gt;
=='''Login Page'''==&lt;br /&gt;
[[File:Picture1.png]]&lt;br /&gt;
&lt;br /&gt;
=== What's wrong with it ===&lt;br /&gt;
1. Now it takes more than 15 seconds to even login to the admin's home page with the sample development database. This is definitely not good enough for a daily used web application. &lt;br /&gt;
&lt;br /&gt;
The cause for the long rendering time is that it will be redirected to 'tree_display/list', which needs to fetch all questionnaires, courses and assignments before page rendering.&lt;br /&gt;
&lt;br /&gt;
2. The webpage looks primitive.&lt;br /&gt;
&lt;br /&gt;
=== What changes need to be made ===&lt;br /&gt;
1. Actually it is unnecessary to fetch all data at the very beginning; if there is too much data to present, the list will be extremely long and it is quite hard for users to locate a specific course. &lt;br /&gt;
&lt;br /&gt;
So, we will use AngularJS and jQuery to make a asynchronous webpage that delays the database query until all the basic html elements are correctly rendered, or until the user explicitly asks for that part of data.&lt;br /&gt;
&lt;br /&gt;
2. Bootstrap will be applied for better user interfaces.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Manage-Course page'''==&lt;br /&gt;
[[File:Picture2.png]]&lt;br /&gt;
&lt;br /&gt;
=== What's wrong with it ===&lt;br /&gt;
As illustrated above, now the displaying list is too long and it takes too long to scroll to the end, which makes locating a specific course quite difficult.&lt;br /&gt;
&lt;br /&gt;
Also, loading time can be reduced.&lt;br /&gt;
&lt;br /&gt;
=== What changes need to be made ===&lt;br /&gt;
1. Create several buttons for different time intervals, for example, after clicking on the button '2013-2014', only courses for 2013 to 2014 are presenting, and there is no redirection during this process.&lt;br /&gt;
&lt;br /&gt;
2. The database should not be executed before the user clicks on the button. Only parts of databased is fetched when each button is clicked.&lt;br /&gt;
&lt;br /&gt;
3. Bootstrap will be applied for better user interfaces.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Manage-User page'''==&lt;br /&gt;
[[File:Picture3.png]]&lt;br /&gt;
&lt;br /&gt;
=== What's wrong with it ===&lt;br /&gt;
1. The list is too long: if there are 20k users in the database, there will be 20k rows in this table in a one page!&lt;br /&gt;
&lt;br /&gt;
2. When clicking on the letter A-Z, redirections happen and the whole page is reloaded.&lt;br /&gt;
&lt;br /&gt;
=== What changes need to be made ===&lt;br /&gt;
1. Load only a given number of records to the view, such as 100 records, when accessing into this page for the first time.&lt;br /&gt;
&lt;br /&gt;
2. Using AngularJS to eliminate the redirections and page reloading for better UI performance.&lt;/div&gt;</summary>
		<author><name>Pdeng</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015_E1526_MPRI&amp;diff=96394</id>
		<title>CSC/ECE 517 Spring 2015 E1526 MPRI</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015_E1526_MPRI&amp;diff=96394"/>
		<updated>2015-04-01T05:27:26Z</updated>

		<summary type="html">&lt;p&gt;Pdeng: /* 4. Simplify Action Panel */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;font size=&amp;quot;5&amp;quot;&amp;gt;&amp;lt;b&amp;gt;E1526. Responsive web design for Expertiza&amp;lt;/b&amp;gt;&amp;lt;/font&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
= Introduction to Expertiza =&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is a large project developed as a combined effort of students and faculty using the [http://rubyonrails.org/ Ruby on Rails] framework. The main advantage of using Expertiza, in an educational environment, is for the instructor to introduce peer reviewing among the students. Expertiza allows the instructor to create and customize assignments, create a list of topics the students can sign up for, have students work on teams and then review each other's assignments at the end. Expertiza supports submission of almost any document type, including the URLs and wiki pages.&lt;br /&gt;
&lt;br /&gt;
Expertiza is supported by National Science Foundation under Grant No. 0536558. Additional funding from the [http://www.ncsu.edu/ NCSU] [http://litre.ncsu.edu/ Learning in a Technology-Rich Environment] (LITRE) program, the NCSU [http://ofd.ncsu.edu/teaching-learning/ Faculty Center for Teaching and Learning], the NCSU [http://stem.ncsu.edu/ STEM] Initiative, and the Center for Advanced Computing and Communication.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
= Problem Statement =&lt;br /&gt;
&lt;br /&gt;
Despite an amazing set of functionality Expertiza offers, there are numerous parts of it that could use of a more stylish look and an improved user experience. The goal of this project is to use both Bootstrap and AngularJS to improve the look of the entire Expertiza including the representations of buttons, tables, and other elements. Certain changes in design will also improve the efficiency of the web app when it comes to the amount of time it takes for a page to be loaded.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
= Explanation of Tasks =&lt;br /&gt;
Below are detailed explanations to the tasks listed in the description documentation.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 1. Replace Buttons and Links to Bootstrap styled Buttons ==&lt;br /&gt;
Now, many elements, like 'back', are hyperlink rather than buttons, and it will be much better to replace these plain styled text to Bootstrap buttons.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 2. Create new theme ==&lt;br /&gt;
The theme of Expertiza looks primitive now, a new theme with fix menu on the top is much prefered.&lt;br /&gt;
&lt;br /&gt;
For example, the theme with fixed-top navigation bar on Virgin American website&lt;br /&gt;
&lt;br /&gt;
[[File:Picture4-2.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 3. Auto hides contents on the dashboard for instructors ==&lt;br /&gt;
Please refer to the later part of this article: [[#Manage-Course page|Manage-Course page]] for viewing the current design&lt;br /&gt;
&lt;br /&gt;
Now, when trying to open manage-courses, all records are loaded before rendering them onto the page, which takes too long time to load and is not responsive at all.&lt;br /&gt;
&lt;br /&gt;
Better practice is on Virgin American’s website: https://www.virginamerica.com/book/rt/a1/sfo_bos/20150401_20150402&lt;br /&gt;
&lt;br /&gt;
When the website is representing the calendar, the price for each day is not actually loaded. But the skeleton of the page, which is the calendar in this case, can be displayed first.&lt;br /&gt;
&lt;br /&gt;
[[File:Picture5.png]]&lt;br /&gt;
&lt;br /&gt;
So in Expertiza, we can create several buttons for course semesters in the page. After clicking on Fall 2014, the courses for Fall 2014 will come out. &lt;br /&gt;
&lt;br /&gt;
And if the list is still too long and takes a long time load, we can use a ‘show more’ button ,or automatically load more data when the scroll bar reaching the end of the page, to minimize the content we need to load after one single mouse click. &lt;br /&gt;
&lt;br /&gt;
[[File:Picture6.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 4. Simplify Action Panel ==&lt;br /&gt;
We will need to reduce the number of buttons. For example, the first row are actions for assignments and the second row is for participant. So we can replace them to 5 buttons with responsive design, that is, no redirecting happens after clicking on the buttons.&lt;br /&gt;
&lt;br /&gt;
[[File:Picture7.png]]&lt;br /&gt;
&lt;br /&gt;
== 5. Offer Better UI for Managing Users ==&lt;br /&gt;
&lt;br /&gt;
Please refer to the later part of this article: [[#Manage-User page|Manage-User page]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 6. Make grades_view Responsive with Better Design ==&lt;br /&gt;
&lt;br /&gt;
Similar to the previous tasks, we will need to make it responsive. &lt;br /&gt;
&lt;br /&gt;
After clicking on ‘Your scores’, all reviews are loaded before rendering the page now. That takes a long time to load and the length of review list is too long.&lt;br /&gt;
&lt;br /&gt;
[[File:Picture8.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Pages To Be Modified =&lt;br /&gt;
For this project, it is difficult to re-design all webpages and make them responsive. After discussing with the contact person, we will be focusing only on these 3 pages:&lt;br /&gt;
&lt;br /&gt;
=='''Login Page'''==&lt;br /&gt;
[[File:Picture1.png]]&lt;br /&gt;
&lt;br /&gt;
=== What's wrong with it ===&lt;br /&gt;
1. Now it takes more than 15 seconds to even login to the admin's home page with the sample development database. This is definitely not good enough for a daily used web application. &lt;br /&gt;
&lt;br /&gt;
The cause for the long rendering time is that it will be redirected to 'tree_display/list', which needs to fetch all questionnaires, courses and assignments before page rendering.&lt;br /&gt;
&lt;br /&gt;
2. The webpage looks primitive.&lt;br /&gt;
&lt;br /&gt;
=== What changes need to be made ===&lt;br /&gt;
1. Actually it is unnecessary to fetch all data at the very beginning; if there is too much data to present, the list will be extremely long and it is quite hard for users to locate a specific course. &lt;br /&gt;
&lt;br /&gt;
So, we will use AngularJS and jQuery to make a asynchronous webpage that delays the database query until all the basic html elements are correctly rendered, or until the user explicitly asks for that part of data.&lt;br /&gt;
&lt;br /&gt;
2. Bootstrap will be applied for better user interfaces.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Manage-Course page'''==&lt;br /&gt;
[[File:Picture2.png]]&lt;br /&gt;
&lt;br /&gt;
=== What's wrong with it ===&lt;br /&gt;
As illustrated above, now the displaying list is too long and it takes too long to scroll to the end, which makes locating a specific course quite difficult.&lt;br /&gt;
&lt;br /&gt;
Also, loading time can be reduced.&lt;br /&gt;
&lt;br /&gt;
=== What changes need to be made ===&lt;br /&gt;
1. Create several buttons for different time intervals, for example, after clicking on the button '2013-2014', only courses for 2013 to 2014 are presenting, and there is no redirection during this process.&lt;br /&gt;
&lt;br /&gt;
2. The database should not be executed before the user clicks on the button. Only parts of databased is fetched when each button is clicked.&lt;br /&gt;
&lt;br /&gt;
3. Bootstrap will be applied for better user interfaces.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Manage-User page'''==&lt;br /&gt;
[[File:Picture3.png]]&lt;br /&gt;
&lt;br /&gt;
=== What's wrong with it ===&lt;br /&gt;
1. The list is too long: if there are 20k users in the database, there will be 20k rows in this table in a one page!&lt;br /&gt;
&lt;br /&gt;
2. When clicking on the letter A-Z, redirections happen and the whole page is reloaded.&lt;br /&gt;
&lt;br /&gt;
=== What changes need to be made ===&lt;br /&gt;
1. Load only a given number of records to the view, such as 100 records, when accessing into this page for the first time.&lt;br /&gt;
&lt;br /&gt;
2. Using AngularJS to eliminate the redirections and page reloading for better UI performance.&lt;/div&gt;</summary>
		<author><name>Pdeng</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015_E1526_MPRI&amp;diff=96393</id>
		<title>CSC/ECE 517 Spring 2015 E1526 MPRI</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015_E1526_MPRI&amp;diff=96393"/>
		<updated>2015-04-01T05:27:01Z</updated>

		<summary type="html">&lt;p&gt;Pdeng: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;font size=&amp;quot;5&amp;quot;&amp;gt;&amp;lt;b&amp;gt;E1526. Responsive web design for Expertiza&amp;lt;/b&amp;gt;&amp;lt;/font&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
= Introduction to Expertiza =&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is a large project developed as a combined effort of students and faculty using the [http://rubyonrails.org/ Ruby on Rails] framework. The main advantage of using Expertiza, in an educational environment, is for the instructor to introduce peer reviewing among the students. Expertiza allows the instructor to create and customize assignments, create a list of topics the students can sign up for, have students work on teams and then review each other's assignments at the end. Expertiza supports submission of almost any document type, including the URLs and wiki pages.&lt;br /&gt;
&lt;br /&gt;
Expertiza is supported by National Science Foundation under Grant No. 0536558. Additional funding from the [http://www.ncsu.edu/ NCSU] [http://litre.ncsu.edu/ Learning in a Technology-Rich Environment] (LITRE) program, the NCSU [http://ofd.ncsu.edu/teaching-learning/ Faculty Center for Teaching and Learning], the NCSU [http://stem.ncsu.edu/ STEM] Initiative, and the Center for Advanced Computing and Communication.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
= Problem Statement =&lt;br /&gt;
&lt;br /&gt;
Despite an amazing set of functionality Expertiza offers, there are numerous parts of it that could use of a more stylish look and an improved user experience. The goal of this project is to use both Bootstrap and AngularJS to improve the look of the entire Expertiza including the representations of buttons, tables, and other elements. Certain changes in design will also improve the efficiency of the web app when it comes to the amount of time it takes for a page to be loaded.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
= Explanation of Tasks =&lt;br /&gt;
Below are detailed explanations to the tasks listed in the description documentation.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 1. Replace Buttons and Links to Bootstrap styled Buttons ==&lt;br /&gt;
Now, many elements, like 'back', are hyperlink rather than buttons, and it will be much better to replace these plain styled text to Bootstrap buttons.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 2. Create new theme ==&lt;br /&gt;
The theme of Expertiza looks primitive now, a new theme with fix menu on the top is much prefered.&lt;br /&gt;
&lt;br /&gt;
For example, the theme with fixed-top navigation bar on Virgin American website&lt;br /&gt;
&lt;br /&gt;
[[File:Picture4-2.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 3. Auto hides contents on the dashboard for instructors ==&lt;br /&gt;
Please refer to the later part of this article: [[#Manage-Course page|Manage-Course page]] for viewing the current design&lt;br /&gt;
&lt;br /&gt;
Now, when trying to open manage-courses, all records are loaded before rendering them onto the page, which takes too long time to load and is not responsive at all.&lt;br /&gt;
&lt;br /&gt;
Better practice is on Virgin American’s website: https://www.virginamerica.com/book/rt/a1/sfo_bos/20150401_20150402&lt;br /&gt;
&lt;br /&gt;
When the website is representing the calendar, the price for each day is not actually loaded. But the skeleton of the page, which is the calendar in this case, can be displayed first.&lt;br /&gt;
&lt;br /&gt;
[[File:Picture5.png]]&lt;br /&gt;
&lt;br /&gt;
So in Expertiza, we can create several buttons for course semesters in the page. After clicking on Fall 2014, the courses for Fall 2014 will come out. &lt;br /&gt;
&lt;br /&gt;
And if the list is still too long and takes a long time load, we can use a ‘show more’ button ,or automatically load more data when the scroll bar reaching the end of the page, to minimize the content we need to load after one single mouse click. &lt;br /&gt;
&lt;br /&gt;
[[File:Picture6.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 4. Simplify Action Panel ==&lt;br /&gt;
We will need to reduce the number of buttons. For example, the first row are actions for assignments. The second row is for participant. So we can replace them to 5 buttons with responsive design, that is, no redirecting happens after clicking on the buttons.&lt;br /&gt;
&lt;br /&gt;
[[File:Picture7.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 5. Offer Better UI for Managing Users ==&lt;br /&gt;
&lt;br /&gt;
Please refer to the later part of this article: [[#Manage-User page|Manage-User page]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 6. Make grades_view Responsive with Better Design ==&lt;br /&gt;
&lt;br /&gt;
Similar to the previous tasks, we will need to make it responsive. &lt;br /&gt;
&lt;br /&gt;
After clicking on ‘Your scores’, all reviews are loaded before rendering the page now. That takes a long time to load and the length of review list is too long.&lt;br /&gt;
&lt;br /&gt;
[[File:Picture8.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Pages To Be Modified =&lt;br /&gt;
For this project, it is difficult to re-design all webpages and make them responsive. After discussing with the contact person, we will be focusing only on these 3 pages:&lt;br /&gt;
&lt;br /&gt;
=='''Login Page'''==&lt;br /&gt;
[[File:Picture1.png]]&lt;br /&gt;
&lt;br /&gt;
=== What's wrong with it ===&lt;br /&gt;
1. Now it takes more than 15 seconds to even login to the admin's home page with the sample development database. This is definitely not good enough for a daily used web application. &lt;br /&gt;
&lt;br /&gt;
The cause for the long rendering time is that it will be redirected to 'tree_display/list', which needs to fetch all questionnaires, courses and assignments before page rendering.&lt;br /&gt;
&lt;br /&gt;
2. The webpage looks primitive.&lt;br /&gt;
&lt;br /&gt;
=== What changes need to be made ===&lt;br /&gt;
1. Actually it is unnecessary to fetch all data at the very beginning; if there is too much data to present, the list will be extremely long and it is quite hard for users to locate a specific course. &lt;br /&gt;
&lt;br /&gt;
So, we will use AngularJS and jQuery to make a asynchronous webpage that delays the database query until all the basic html elements are correctly rendered, or until the user explicitly asks for that part of data.&lt;br /&gt;
&lt;br /&gt;
2. Bootstrap will be applied for better user interfaces.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Manage-Course page'''==&lt;br /&gt;
[[File:Picture2.png]]&lt;br /&gt;
&lt;br /&gt;
=== What's wrong with it ===&lt;br /&gt;
As illustrated above, now the displaying list is too long and it takes too long to scroll to the end, which makes locating a specific course quite difficult.&lt;br /&gt;
&lt;br /&gt;
Also, loading time can be reduced.&lt;br /&gt;
&lt;br /&gt;
=== What changes need to be made ===&lt;br /&gt;
1. Create several buttons for different time intervals, for example, after clicking on the button '2013-2014', only courses for 2013 to 2014 are presenting, and there is no redirection during this process.&lt;br /&gt;
&lt;br /&gt;
2. The database should not be executed before the user clicks on the button. Only parts of databased is fetched when each button is clicked.&lt;br /&gt;
&lt;br /&gt;
3. Bootstrap will be applied for better user interfaces.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Manage-User page'''==&lt;br /&gt;
[[File:Picture3.png]]&lt;br /&gt;
&lt;br /&gt;
=== What's wrong with it ===&lt;br /&gt;
1. The list is too long: if there are 20k users in the database, there will be 20k rows in this table in a one page!&lt;br /&gt;
&lt;br /&gt;
2. When clicking on the letter A-Z, redirections happen and the whole page is reloaded.&lt;br /&gt;
&lt;br /&gt;
=== What changes need to be made ===&lt;br /&gt;
1. Load only a given number of records to the view, such as 100 records, when accessing into this page for the first time.&lt;br /&gt;
&lt;br /&gt;
2. Using AngularJS to eliminate the redirections and page reloading for better UI performance.&lt;/div&gt;</summary>
		<author><name>Pdeng</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015_E1526_MPRI&amp;diff=96392</id>
		<title>CSC/ECE 517 Spring 2015 E1526 MPRI</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015_E1526_MPRI&amp;diff=96392"/>
		<updated>2015-04-01T05:26:26Z</updated>

		<summary type="html">&lt;p&gt;Pdeng: /* 4. Simplify Action Panel */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;font size=&amp;quot;5&amp;quot;&amp;gt;&amp;lt;b&amp;gt;E1526. Responsive web design for Expertiza&amp;lt;/b&amp;gt;&amp;lt;/font&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
= Introduction to Expertiza =&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is a large project developed as a combined effort of students and faculty using the [http://rubyonrails.org/ Ruby on Rails] framework. The main advantage of using Expertiza, in an educational environment, is for the instructor to introduce peer reviewing among the students. Expertiza allows the instructor to create and customize assignments, create a list of topics the students can sign up for, have students work on teams and then review each other's assignments at the end. Expertiza supports submission of almost any document type, including the URLs and wiki pages.&lt;br /&gt;
&lt;br /&gt;
Expertiza is supported by National Science Foundation under Grant No. 0536558. Additional funding from the [http://www.ncsu.edu/ NCSU] [http://litre.ncsu.edu/ Learning in a Technology-Rich Environment] (LITRE) program, the NCSU [http://ofd.ncsu.edu/teaching-learning/ Faculty Center for Teaching and Learning], the NCSU [http://stem.ncsu.edu/ STEM] Initiative, and the Center for Advanced Computing and Communication.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
= Problem Statement =&lt;br /&gt;
&lt;br /&gt;
Despite an amazing set of functionality Expertiza offers, there are numerous parts of it that could use of a more stylish look and an improved user experience. The goal of this project is to use both Bootstrap and AngularJS to improve the look of the entire Expertiza including the representations of buttons, tables, and other elements. Certain changes in design will also improve the efficiency of the web app when it comes to the amount of time it takes for a page to be loaded.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
= Explanation of Tasks =&lt;br /&gt;
Below are detailed explanations to the tasks listed in the description documentation.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 1. Replace Buttons and Links to Bootstrap styled Buttons ==&lt;br /&gt;
Now, many elements, like 'back', are hyperlink rather than buttons, and it will be much better to replace these plain styled text to Bootstrap buttons.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 2. Create new theme ==&lt;br /&gt;
The theme of Expertiza looks primitive now, a new theme with fix menu on the top is much prefered.&lt;br /&gt;
&lt;br /&gt;
For example, the theme with fixed-top navigation bar on Virgin American website&lt;br /&gt;
&lt;br /&gt;
[[File:Picture4-2.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 3. Auto hides contents on the dashboard for instructors ==&lt;br /&gt;
Please refer to the later part of this article: [[#Manage-Course page|Manage-Course page]] for viewing the current design&lt;br /&gt;
&lt;br /&gt;
Now, when trying to open manage-courses, all records are loaded before rendering them onto the page, which takes too long time to load and is not responsive at all.&lt;br /&gt;
&lt;br /&gt;
Better practice is on Virgin American’s website: https://www.virginamerica.com/book/rt/a1/sfo_bos/20150401_20150402&lt;br /&gt;
&lt;br /&gt;
When the website is representing the calendar, the price for each day is not actually loaded. But the skeleton of the page, which is the calendar in this case, can be displayed first.&lt;br /&gt;
&lt;br /&gt;
[[File:Picture5.png]]&lt;br /&gt;
&lt;br /&gt;
So in Expertiza, we can create several buttons for course semesters in the page. After clicking on Fall 2014, the courses for Fall 2014 will come out. &lt;br /&gt;
&lt;br /&gt;
And if the list is still too long and takes a long time load, we can use a ‘show more’ button ,or automatically load more data when the scroll bar reaching the end of the page, to minimize the content we need to load after one single mouse click. &lt;br /&gt;
&lt;br /&gt;
[[File:Picture6.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 4. Simplify Action Panel ==&lt;br /&gt;
We will need to reduce the number of buttons. For example, the first row are actions for assignments. The second row is for participant. So we can replace them to 5 buttons with responsive design, that is, no redirecting happens after clicking on the buttons.&lt;br /&gt;
&lt;br /&gt;
[[File:Picture7.png]]&lt;br /&gt;
&lt;br /&gt;
== 5. Offer Better UI for Managing Users ==&lt;br /&gt;
&lt;br /&gt;
Please refer to the later part of this article: [[#Manage-User page|Manage-User page]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 6. Make grades_view Responsive with Better Design ==&lt;br /&gt;
&lt;br /&gt;
Similar to the previous tasks, we will need to make it responsive. &lt;br /&gt;
&lt;br /&gt;
After clicking on ‘Your scores’, all reviews are loaded before rendering the page now. That takes a long time to load and the length of review list is too long.&lt;br /&gt;
&lt;br /&gt;
[[File:Picture8.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Pages To Be Modified =&lt;br /&gt;
For this project, it is difficult to re-design all webpages and make them responsive. After discussing with the contact person, we will be focusing only on these 3 pages:&lt;br /&gt;
&lt;br /&gt;
=='''Login Page'''==&lt;br /&gt;
[[File:Picture1.png]]&lt;br /&gt;
&lt;br /&gt;
=== What's wrong with it ===&lt;br /&gt;
1. Now it takes more than 15 seconds to even login to the admin's home page with the sample development database. This is definitely not good enough for a daily used web application. &lt;br /&gt;
&lt;br /&gt;
The cause for the long rendering time is that it will be redirected to 'tree_display/list', which needs to fetch all questionnaires, courses and assignments before page rendering.&lt;br /&gt;
&lt;br /&gt;
2. The webpage looks primitive.&lt;br /&gt;
&lt;br /&gt;
=== What changes need to be made ===&lt;br /&gt;
1. Actually it is unnecessary to fetch all data at the very beginning; if there is too much data to present, the list will be extremely long and it is quite hard for users to locate a specific course. &lt;br /&gt;
&lt;br /&gt;
So, we will use AngularJS and jQuery to make a asynchronous webpage that delays the database query until all the basic html elements are correctly rendered, or until the user explicitly asks for that part of data.&lt;br /&gt;
&lt;br /&gt;
2. Bootstrap will be applied for better user interfaces.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Manage-Course page'''==&lt;br /&gt;
[[File:Picture2.png]]&lt;br /&gt;
&lt;br /&gt;
=== What's wrong with it ===&lt;br /&gt;
As illustrated above, now the displaying list is too long and it takes too long to scroll to the end, which makes locating a specific course quite difficult.&lt;br /&gt;
&lt;br /&gt;
Also, loading time can be reduced.&lt;br /&gt;
&lt;br /&gt;
=== What changes need to be made ===&lt;br /&gt;
1. Create several buttons for different time intervals, for example, after clicking on the button '2013-2014', only courses for 2013 to 2014 are presenting, and there is no redirection during this process.&lt;br /&gt;
&lt;br /&gt;
2. The database should not be executed before the user clicks on the button. Only parts of databased is fetched when each button is clicked.&lt;br /&gt;
&lt;br /&gt;
3. Bootstrap will be applied for better user interfaces.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Manage-User page'''==&lt;br /&gt;
[[File:Picture3.png]]&lt;br /&gt;
&lt;br /&gt;
=== What's wrong with it ===&lt;br /&gt;
1. The list is too long: if there are 20k users in the database, there will be 20k rows in this table in a one page!&lt;br /&gt;
&lt;br /&gt;
2. When clicking on the letter A-Z, redirections happen and the whole page is reloaded.&lt;br /&gt;
&lt;br /&gt;
=== What changes need to be made ===&lt;br /&gt;
1. Load only a given number of records to the view, such as 100 records, when accessing into this page for the first time.&lt;br /&gt;
&lt;br /&gt;
2. Using AngularJS to eliminate the redirections and page reloading for better UI performance.&lt;/div&gt;</summary>
		<author><name>Pdeng</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015_E1526_MPRI&amp;diff=96391</id>
		<title>CSC/ECE 517 Spring 2015 E1526 MPRI</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015_E1526_MPRI&amp;diff=96391"/>
		<updated>2015-04-01T05:24:47Z</updated>

		<summary type="html">&lt;p&gt;Pdeng: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;font size=&amp;quot;5&amp;quot;&amp;gt;&amp;lt;b&amp;gt;E1526. Responsive web design for Expertiza&amp;lt;/b&amp;gt;&amp;lt;/font&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
= Introduction to Expertiza =&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is a large project developed as a combined effort of students and faculty using the [http://rubyonrails.org/ Ruby on Rails] framework. The main advantage of using Expertiza, in an educational environment, is for the instructor to introduce peer reviewing among the students. Expertiza allows the instructor to create and customize assignments, create a list of topics the students can sign up for, have students work on teams and then review each other's assignments at the end. Expertiza supports submission of almost any document type, including the URLs and wiki pages.&lt;br /&gt;
&lt;br /&gt;
Expertiza is supported by National Science Foundation under Grant No. 0536558. Additional funding from the [http://www.ncsu.edu/ NCSU] [http://litre.ncsu.edu/ Learning in a Technology-Rich Environment] (LITRE) program, the NCSU [http://ofd.ncsu.edu/teaching-learning/ Faculty Center for Teaching and Learning], the NCSU [http://stem.ncsu.edu/ STEM] Initiative, and the Center for Advanced Computing and Communication.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
= Problem Statement =&lt;br /&gt;
&lt;br /&gt;
Despite an amazing set of functionality Expertiza offers, there are numerous parts of it that could use of a more stylish look and an improved user experience. The goal of this project is to use both Bootstrap and AngularJS to improve the look of the entire Expertiza including the representations of buttons, tables, and other elements. Certain changes in design will also improve the efficiency of the web app when it comes to the amount of time it takes for a page to be loaded.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
= Explanation of Tasks =&lt;br /&gt;
Below are detailed explanations to the tasks listed in the description documentation.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 1. Replace Buttons and Links to Bootstrap styled Buttons ==&lt;br /&gt;
Now, many elements, like 'back', are hyperlink rather than buttons, and it will be much better to replace these plain styled text to Bootstrap buttons.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 2. Create new theme ==&lt;br /&gt;
The theme of Expertiza looks primitive now, a new theme with fix menu on the top is much prefered.&lt;br /&gt;
&lt;br /&gt;
For example, the theme with fixed-top navigation bar on Virgin American website&lt;br /&gt;
&lt;br /&gt;
[[File:Picture4-2.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 3. Auto hides contents on the dashboard for instructors ==&lt;br /&gt;
Please refer to the later part of this article: [[#Manage-Course page|Manage-Course page]] for viewing the current design&lt;br /&gt;
&lt;br /&gt;
Now, when trying to open manage-courses, all records are loaded before rendering them onto the page, which takes too long time to load and is not responsive at all.&lt;br /&gt;
&lt;br /&gt;
Better practice is on Virgin American’s website: https://www.virginamerica.com/book/rt/a1/sfo_bos/20150401_20150402&lt;br /&gt;
&lt;br /&gt;
When the website is representing the calendar, the price for each day is not actually loaded. But the skeleton of the page, which is the calendar in this case, can be displayed first.&lt;br /&gt;
&lt;br /&gt;
[[File:Picture5.png]]&lt;br /&gt;
&lt;br /&gt;
So in Expertiza, we can create several buttons for course semesters in the page. After clicking on Fall 2014, the courses for Fall 2014 will come out. &lt;br /&gt;
&lt;br /&gt;
And if the list is still too long and takes a long time load, we can use a ‘show more’ button ,or automatically load more data when the scroll bar reaching the end of the page, to minimize the content we need to load after one single mouse click. &lt;br /&gt;
&lt;br /&gt;
[[File:Picture6.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 4. Simplify Action Panel ==&lt;br /&gt;
We will need to reduce the number of buttons. For example, the first row are actions for assignments. The second row is for participant.So we can change it to 5 buttons with responsive design, that is, no redirection after clicking on the buttons.&lt;br /&gt;
&lt;br /&gt;
We will need to design better UI so that it is possible to add users to expertiza, to search a user and change roles.&lt;br /&gt;
&lt;br /&gt;
[[File:Picture7.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 5. Offer Better UI for Managing Users ==&lt;br /&gt;
&lt;br /&gt;
Please refer to the later part of this article: [[#Manage-User page|Manage-User page]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 6. Make grades_view Responsive with Better Design ==&lt;br /&gt;
&lt;br /&gt;
Similar to the previous tasks, we will need to make it responsive. &lt;br /&gt;
&lt;br /&gt;
After clicking on ‘Your scores’, all reviews are loaded before rendering the page now. That takes a long time to load and the length of review list is too long.&lt;br /&gt;
&lt;br /&gt;
[[File:Picture8.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Pages To Be Modified =&lt;br /&gt;
For this project, it is difficult to re-design all webpages and make them responsive. After discussing with the contact person, we will be focusing only on these 3 pages:&lt;br /&gt;
&lt;br /&gt;
=='''Login Page'''==&lt;br /&gt;
[[File:Picture1.png]]&lt;br /&gt;
&lt;br /&gt;
=== What's wrong with it ===&lt;br /&gt;
1. Now it takes more than 15 seconds to even login to the admin's home page with the sample development database. This is definitely not good enough for a daily used web application. &lt;br /&gt;
&lt;br /&gt;
The cause for the long rendering time is that it will be redirected to 'tree_display/list', which needs to fetch all questionnaires, courses and assignments before page rendering.&lt;br /&gt;
&lt;br /&gt;
2. The webpage looks primitive.&lt;br /&gt;
&lt;br /&gt;
=== What changes need to be made ===&lt;br /&gt;
1. Actually it is unnecessary to fetch all data at the very beginning; if there is too much data to present, the list will be extremely long and it is quite hard for users to locate a specific course. &lt;br /&gt;
&lt;br /&gt;
So, we will use AngularJS and jQuery to make a asynchronous webpage that delays the database query until all the basic html elements are correctly rendered, or until the user explicitly asks for that part of data.&lt;br /&gt;
&lt;br /&gt;
2. Bootstrap will be applied for better user interfaces.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Manage-Course page'''==&lt;br /&gt;
[[File:Picture2.png]]&lt;br /&gt;
&lt;br /&gt;
=== What's wrong with it ===&lt;br /&gt;
As illustrated above, now the displaying list is too long and it takes too long to scroll to the end, which makes locating a specific course quite difficult.&lt;br /&gt;
&lt;br /&gt;
Also, loading time can be reduced.&lt;br /&gt;
&lt;br /&gt;
=== What changes need to be made ===&lt;br /&gt;
1. Create several buttons for different time intervals, for example, after clicking on the button '2013-2014', only courses for 2013 to 2014 are presenting, and there is no redirection during this process.&lt;br /&gt;
&lt;br /&gt;
2. The database should not be executed before the user clicks on the button. Only parts of databased is fetched when each button is clicked.&lt;br /&gt;
&lt;br /&gt;
3. Bootstrap will be applied for better user interfaces.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Manage-User page'''==&lt;br /&gt;
[[File:Picture3.png]]&lt;br /&gt;
&lt;br /&gt;
=== What's wrong with it ===&lt;br /&gt;
1. The list is too long: if there are 20k users in the database, there will be 20k rows in this table in a one page!&lt;br /&gt;
&lt;br /&gt;
2. When clicking on the letter A-Z, redirections happen and the whole page is reloaded.&lt;br /&gt;
&lt;br /&gt;
=== What changes need to be made ===&lt;br /&gt;
1. Load only a given number of records to the view, such as 100 records, when accessing into this page for the first time.&lt;br /&gt;
&lt;br /&gt;
2. Using AngularJS to eliminate the redirections and page reloading for better UI performance.&lt;/div&gt;</summary>
		<author><name>Pdeng</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015_E1526_MPRI&amp;diff=96390</id>
		<title>CSC/ECE 517 Spring 2015 E1526 MPRI</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015_E1526_MPRI&amp;diff=96390"/>
		<updated>2015-04-01T05:24:27Z</updated>

		<summary type="html">&lt;p&gt;Pdeng: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;font size=&amp;quot;5&amp;quot;&amp;gt;&amp;lt;b&amp;gt;'E1526. Responsive web design for Expertiza&amp;lt;/b&amp;gt;&amp;lt;/font&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
= Introduction to Expertiza =&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is a large project developed as a combined effort of students and faculty using the [http://rubyonrails.org/ Ruby on Rails] framework. The main advantage of using Expertiza, in an educational environment, is for the instructor to introduce peer reviewing among the students. Expertiza allows the instructor to create and customize assignments, create a list of topics the students can sign up for, have students work on teams and then review each other's assignments at the end. Expertiza supports submission of almost any document type, including the URLs and wiki pages.&lt;br /&gt;
&lt;br /&gt;
Expertiza is supported by National Science Foundation under Grant No. 0536558. Additional funding from the [http://www.ncsu.edu/ NCSU] [http://litre.ncsu.edu/ Learning in a Technology-Rich Environment] (LITRE) program, the NCSU [http://ofd.ncsu.edu/teaching-learning/ Faculty Center for Teaching and Learning], the NCSU [http://stem.ncsu.edu/ STEM] Initiative, and the Center for Advanced Computing and Communication.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
= Problem Statement =&lt;br /&gt;
&lt;br /&gt;
Despite an amazing set of functionality Expertiza offers, there are numerous parts of it that could use of a more stylish look and an improved user experience. The goal of this project is to use both Bootstrap and AngularJS to improve the look of the entire Expertiza including the representations of buttons, tables, and other elements. Certain changes in design will also improve the efficiency of the web app when it comes to the amount of time it takes for a page to be loaded.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
= Explanation of Tasks =&lt;br /&gt;
Below are detailed explanations to the tasks listed in the description documentation.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 1. Replace Buttons and Links to Bootstrap styled Buttons ==&lt;br /&gt;
Now, many elements, like 'back', are hyperlink rather than buttons, and it will be much better to replace these plain styled text to Bootstrap buttons.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 2. Create new theme ==&lt;br /&gt;
The theme of Expertiza looks primitive now, a new theme with fix menu on the top is much prefered.&lt;br /&gt;
&lt;br /&gt;
For example, the theme with fixed-top navigation bar on Virgin American website&lt;br /&gt;
&lt;br /&gt;
[[File:Picture4-2.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 3. Auto hides contents on the dashboard for instructors ==&lt;br /&gt;
Please refer to the later part of this article: [[#Manage-Course page|Manage-Course page]] for viewing the current design&lt;br /&gt;
&lt;br /&gt;
Now, when trying to open manage-courses, all records are loaded before rendering them onto the page, which takes too long time to load and is not responsive at all.&lt;br /&gt;
&lt;br /&gt;
Better practice is on Virgin American’s website: https://www.virginamerica.com/book/rt/a1/sfo_bos/20150401_20150402&lt;br /&gt;
&lt;br /&gt;
When the website is representing the calendar, the price for each day is not actually loaded. But the skeleton of the page, which is the calendar in this case, can be displayed first.&lt;br /&gt;
&lt;br /&gt;
[[File:Picture5.png]]&lt;br /&gt;
&lt;br /&gt;
So in Expertiza, we can create several buttons for course semesters in the page. After clicking on Fall 2014, the courses for Fall 2014 will come out. &lt;br /&gt;
&lt;br /&gt;
And if the list is still too long and takes a long time load, we can use a ‘show more’ button ,or automatically load more data when the scroll bar reaching the end of the page, to minimize the content we need to load after one single mouse click. &lt;br /&gt;
&lt;br /&gt;
[[File:Picture6.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 4. Simplify Action Panel ==&lt;br /&gt;
We will need to reduce the number of buttons. For example, the first row are actions for assignments. The second row is for participant.So we can change it to 5 buttons with responsive design, that is, no redirection after clicking on the buttons.&lt;br /&gt;
&lt;br /&gt;
We will need to design better UI so that it is possible to add users to expertiza, to search a user and change roles.&lt;br /&gt;
&lt;br /&gt;
[[File:Picture7.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 5. Offer Better UI for Managing Users ==&lt;br /&gt;
&lt;br /&gt;
Please refer to the later part of this article: [[#Manage-User page|Manage-User page]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 6. Make grades_view Responsive with Better Design ==&lt;br /&gt;
&lt;br /&gt;
Similar to the previous tasks, we will need to make it responsive. &lt;br /&gt;
&lt;br /&gt;
After clicking on ‘Your scores’, all reviews are loaded before rendering the page now. That takes a long time to load and the length of review list is too long.&lt;br /&gt;
&lt;br /&gt;
[[File:Picture8.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Pages To Be Modified =&lt;br /&gt;
For this project, it is difficult to re-design all webpages and make them responsive. After discussing with the contact person, we will be focusing only on these 3 pages:&lt;br /&gt;
&lt;br /&gt;
=='''Login Page'''==&lt;br /&gt;
[[File:Picture1.png]]&lt;br /&gt;
&lt;br /&gt;
=== What's wrong with it ===&lt;br /&gt;
1. Now it takes more than 15 seconds to even login to the admin's home page with the sample development database. This is definitely not good enough for a daily used web application. &lt;br /&gt;
&lt;br /&gt;
The cause for the long rendering time is that it will be redirected to 'tree_display/list', which needs to fetch all questionnaires, courses and assignments before page rendering.&lt;br /&gt;
&lt;br /&gt;
2. The webpage looks primitive.&lt;br /&gt;
&lt;br /&gt;
=== What changes need to be made ===&lt;br /&gt;
1. Actually it is unnecessary to fetch all data at the very beginning; if there is too much data to present, the list will be extremely long and it is quite hard for users to locate a specific course. &lt;br /&gt;
&lt;br /&gt;
So, we will use AngularJS and jQuery to make a asynchronous webpage that delays the database query until all the basic html elements are correctly rendered, or until the user explicitly asks for that part of data.&lt;br /&gt;
&lt;br /&gt;
2. Bootstrap will be applied for better user interfaces.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Manage-Course page'''==&lt;br /&gt;
[[File:Picture2.png]]&lt;br /&gt;
&lt;br /&gt;
=== What's wrong with it ===&lt;br /&gt;
As illustrated above, now the displaying list is too long and it takes too long to scroll to the end, which makes locating a specific course quite difficult.&lt;br /&gt;
&lt;br /&gt;
Also, loading time can be reduced.&lt;br /&gt;
&lt;br /&gt;
=== What changes need to be made ===&lt;br /&gt;
1. Create several buttons for different time intervals, for example, after clicking on the button '2013-2014', only courses for 2013 to 2014 are presenting, and there is no redirection during this process.&lt;br /&gt;
&lt;br /&gt;
2. The database should not be executed before the user clicks on the button. Only parts of databased is fetched when each button is clicked.&lt;br /&gt;
&lt;br /&gt;
3. Bootstrap will be applied for better user interfaces.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Manage-User page'''==&lt;br /&gt;
[[File:Picture3.png]]&lt;br /&gt;
&lt;br /&gt;
=== What's wrong with it ===&lt;br /&gt;
1. The list is too long: if there are 20k users in the database, there will be 20k rows in this table in a one page!&lt;br /&gt;
&lt;br /&gt;
2. When clicking on the letter A-Z, redirections happen and the whole page is reloaded.&lt;br /&gt;
&lt;br /&gt;
=== What changes need to be made ===&lt;br /&gt;
1. Load only a given number of records to the view, such as 100 records, when accessing into this page for the first time.&lt;br /&gt;
&lt;br /&gt;
2. Using AngularJS to eliminate the redirections and page reloading for better UI performance.&lt;/div&gt;</summary>
		<author><name>Pdeng</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015_E1526_MPRI&amp;diff=96389</id>
		<title>CSC/ECE 517 Spring 2015 E1526 MPRI</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015_E1526_MPRI&amp;diff=96389"/>
		<updated>2015-04-01T05:23:01Z</updated>

		<summary type="html">&lt;p&gt;Pdeng: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''E1526. Responsive web design for Expertiza '''&lt;br /&gt;
&lt;br /&gt;
= Introduction to Expertiza =&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is a large project developed as a combined effort of students and faculty using the [http://rubyonrails.org/ Ruby on Rails] framework. The main advantage of using Expertiza, in an educational environment, is for the instructor to introduce peer reviewing among the students. Expertiza allows the instructor to create and customize assignments, create a list of topics the students can sign up for, have students work on teams and then review each other's assignments at the end. Expertiza supports submission of almost any document type, including the URLs and wiki pages.&lt;br /&gt;
&lt;br /&gt;
Expertiza is supported by National Science Foundation under Grant No. 0536558. Additional funding from the [http://www.ncsu.edu/ NCSU] [http://litre.ncsu.edu/ Learning in a Technology-Rich Environment] (LITRE) program, the NCSU [http://ofd.ncsu.edu/teaching-learning/ Faculty Center for Teaching and Learning], the NCSU [http://stem.ncsu.edu/ STEM] Initiative, and the Center for Advanced Computing and Communication.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
= Problem Statement =&lt;br /&gt;
&lt;br /&gt;
Despite an amazing set of functionality Expertiza offers, there are numerous parts of it that could use of a more stylish look and an improved user experience. The goal of this project is to use both Bootstrap and AngularJS to improve the look of the entire Expertiza including the representations of buttons, tables, and other elements. Certain changes in design will also improve the efficiency of the web app when it comes to the amount of time it takes for a page to be loaded.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
= Explanation of Tasks =&lt;br /&gt;
Below are detailed explanations to the tasks listed in the description documentation.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 1. Replace Buttons and Links to Bootstrap styled Buttons ==&lt;br /&gt;
Now, many elements, like 'back', are hyperlink rather than buttons, and it will be much better to replace these plain styled text to Bootstrap buttons.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 2. Create new theme ==&lt;br /&gt;
The theme of Expertiza looks primitive now, a new theme with fix menu on the top is much prefered.&lt;br /&gt;
&lt;br /&gt;
For example, the theme with fixed-top navigation bar on Virgin American website&lt;br /&gt;
&lt;br /&gt;
[[File:Picture4-2.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 3. Auto hides contents on the dashboard for instructors ==&lt;br /&gt;
Please refer to the later part of this article: [[#Manage-Course page|Manage-Course page]] for viewing the current design&lt;br /&gt;
&lt;br /&gt;
Now, when trying to open manage-courses, all records are loaded before rendering them onto the page, which takes too long time to load and is not responsive at all.&lt;br /&gt;
&lt;br /&gt;
Better practice is on Virgin American’s website: https://www.virginamerica.com/book/rt/a1/sfo_bos/20150401_20150402&lt;br /&gt;
&lt;br /&gt;
When the website is representing the calendar, the price for each day is not actually loaded. But the skeleton of the page, which is the calendar in this case, can be displayed first.&lt;br /&gt;
&lt;br /&gt;
[[File:Picture5.png]]&lt;br /&gt;
&lt;br /&gt;
So in Expertiza, we can create several buttons for course semesters in the page. After clicking on Fall 2014, the courses for Fall 2014 will come out. &lt;br /&gt;
&lt;br /&gt;
And if the list is still too long and takes a long time load, we can use a ‘show more’ button ,or automatically load more data when the scroll bar reaching the end of the page, to minimize the content we need to load after one single mouse click. &lt;br /&gt;
&lt;br /&gt;
[[File:Picture6.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 4. Simplify Action Panel ==&lt;br /&gt;
We will need to reduce the number of buttons. For example, the first row are actions for assignments. The second row is for participant.So we can change it to 5 buttons with responsive design, that is, no redirection after clicking on the buttons.&lt;br /&gt;
&lt;br /&gt;
We will need to design better UI so that it is possible to add users to expertiza, to search a user and change roles.&lt;br /&gt;
&lt;br /&gt;
[[File:Picture7.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 5. Offer Better UI for Managing Users ==&lt;br /&gt;
&lt;br /&gt;
Please refer to the later part of this article: [[#Manage-User page|Manage-User page]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 6. Make grades_view Responsive with Better Design ==&lt;br /&gt;
&lt;br /&gt;
Similar to the previous tasks, we will need to make it responsive. &lt;br /&gt;
&lt;br /&gt;
After clicking on ‘Your scores’, all reviews are loaded before rendering the page now. That takes a long time to load and the length of review list is too long.&lt;br /&gt;
&lt;br /&gt;
[[File:Picture8.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Pages To Be Modified =&lt;br /&gt;
For this project, it is difficult to re-design all webpages and make them responsive. After discussing with the contact person, we will be focusing only on these 3 pages:&lt;br /&gt;
&lt;br /&gt;
=='''Login Page'''==&lt;br /&gt;
[[File:Picture1.png]]&lt;br /&gt;
&lt;br /&gt;
=== What's wrong with it ===&lt;br /&gt;
1. Now it takes more than 15 seconds to even login to the admin's home page with the sample development database. This is definitely not good enough for a daily used web application. &lt;br /&gt;
&lt;br /&gt;
The cause for the long rendering time is that it will be redirected to 'tree_display/list', which needs to fetch all questionnaires, courses and assignments before page rendering.&lt;br /&gt;
&lt;br /&gt;
2. The webpage looks primitive.&lt;br /&gt;
&lt;br /&gt;
=== What changes need to be made ===&lt;br /&gt;
1. Actually it is unnecessary to fetch all data at the very beginning; if there is too much data to present, the list will be extremely long and it is quite hard for users to locate a specific course. &lt;br /&gt;
&lt;br /&gt;
So, we will use AngularJS and jQuery to make a asynchronous webpage that delays the database query until all the basic html elements are correctly rendered, or until the user explicitly asks for that part of data.&lt;br /&gt;
&lt;br /&gt;
2. Bootstrap will be applied for better user interfaces.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Manage-Course page'''==&lt;br /&gt;
[[File:Picture2.png]]&lt;br /&gt;
&lt;br /&gt;
=== What's wrong with it ===&lt;br /&gt;
As illustrated above, now the displaying list is too long and it takes too long to scroll to the end, which makes locating a specific course quite difficult.&lt;br /&gt;
&lt;br /&gt;
Also, loading time can be reduced.&lt;br /&gt;
&lt;br /&gt;
=== What changes need to be made ===&lt;br /&gt;
1. Create several buttons for different time intervals, for example, after clicking on the button '2013-2014', only courses for 2013 to 2014 are presenting, and there is no redirection during this process.&lt;br /&gt;
&lt;br /&gt;
2. The database should not be executed before the user clicks on the button. Only parts of databased is fetched when each button is clicked.&lt;br /&gt;
&lt;br /&gt;
3. Bootstrap will be applied for better user interfaces.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Manage-User page'''==&lt;br /&gt;
[[File:Picture3.png]]&lt;br /&gt;
&lt;br /&gt;
=== What's wrong with it ===&lt;br /&gt;
1. The list is too long: if there are 20k users in the database, there will be 20k rows in this table in a one page!&lt;br /&gt;
&lt;br /&gt;
2. When clicking on the letter A-Z, redirections happen and the whole page is reloaded.&lt;br /&gt;
&lt;br /&gt;
=== What changes need to be made ===&lt;br /&gt;
1. Load only a given number of records to the view, such as 100 records, when accessing into this page for the first time.&lt;br /&gt;
&lt;br /&gt;
2. Using AngularJS to eliminate the redirections and page reloading for better UI performance.&lt;/div&gt;</summary>
		<author><name>Pdeng</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015_E1526_MPRI&amp;diff=96387</id>
		<title>CSC/ECE 517 Spring 2015 E1526 MPRI</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015_E1526_MPRI&amp;diff=96387"/>
		<updated>2015-04-01T04:55:24Z</updated>

		<summary type="html">&lt;p&gt;Pdeng: /* Explanation of Tasks */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''E1526. Responsive web design for Expertiza '''&lt;br /&gt;
&lt;br /&gt;
'''Introduction to Expertiza'''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is a large project developed as a combined effort of students and faculty using the [http://rubyonrails.org/ Ruby on Rails] framework. The main advantage of using Expertiza, in an educational environment, is for the instructor to introduce peer reviewing among the students. Expertiza allows the instructor to create and customize assignments, create a list of topics the students can sign up for, have students work on teams and then review each other's assignments at the end. Expertiza supports submission of almost any document type, including the URLs and wiki pages.&lt;br /&gt;
&lt;br /&gt;
Expertiza is supported by National Science Foundation under Grant No. 0536558. Additional funding from the [http://www.ncsu.edu/ NCSU] [http://litre.ncsu.edu/ Learning in a Technology-Rich Environment] (LITRE) program, the NCSU [http://ofd.ncsu.edu/teaching-learning/ Faculty Center for Teaching and Learning], the NCSU [http://stem.ncsu.edu/ STEM] Initiative, and the Center for Advanced Computing and Communication.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
= Problem Statement =&lt;br /&gt;
&lt;br /&gt;
Despite an amazing set of functionality Expertiza offers, there are numerous parts of it that could use of a more stylish look and an improved user experience. The goal of this project is to use both Bootstrap and AngularJS to improve the look of the entire Expertiza including the representations of buttons, tables, and other elements. Certain changes in design will also improve the efficiency of the web app when it comes to the amount of time it takes for a page to be loaded.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=='''Explanation of Tasks'''==&lt;br /&gt;
&lt;br /&gt;
=== Upgrading all buttons to Bootstrap ===&lt;br /&gt;
Now, many elements like 'back' is only the hyperlink, and it will be much better to replace these plain styled text to Bootstrap buttons.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Creating new theme ===&lt;br /&gt;
The theme of Expertiza looks primitive now, a new theme with fix menu on the top is much prefered.&lt;br /&gt;
For example, the navigation bar of Virgin American website:&lt;br /&gt;
[[File:Picture4-2.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Auto hides contents on the dashboard for instructors ===&lt;br /&gt;
Now, when trying to open manage-courses, all records are loaded before rendering them onto the page, which takes too long time to load and is not responsive at all.&lt;br /&gt;
Better practice is on Virgin American’s website: https://www.virginamerica.com/book/rt/a1/sfo_bos/20150401_20150402&lt;br /&gt;
When the website is representing the calendar, the price for each day is not actually loaded. But the skeleton of the page, which is the calendar in this case, can be displayed first.&lt;br /&gt;
&lt;br /&gt;
[[File:Picture5.png]]&lt;br /&gt;
&lt;br /&gt;
So in Expertiza, we can create several buttons for course semesters in the page. After clicking on Fall 2014, the courses for Fall 2014 will come out. And if the list is still too long and takes a long time load, we can use a ‘show more’ button ,or automatically load more data when the scroll bar reaching the end of the page, to minimize the content we need to load after one single mouse click. &lt;br /&gt;
&lt;br /&gt;
[[File:Picture6.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Simplify Action Panel ===&lt;br /&gt;
We will need to reduce the number of buttons. For example, the first row are actions for assignments. The second row is for participant.So we can change it to 5 buttons with responsive design, that is, no redirection after clicking on the buttons.&lt;br /&gt;
We will need to design better UI so that it is possible to add users to expertiza, to search a user and change roles.&lt;br /&gt;
&lt;br /&gt;
[[File:Picture7.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Better UI for managing users ===&lt;br /&gt;
&lt;br /&gt;
===Making grades_view Responsive with Better Design===&lt;br /&gt;
&lt;br /&gt;
Similar to the previous tasks, we will need to make it responsive. Also, when clicking on the letter A-Z, no redirections should happen and only the form content should be replaced rather than the whole page.&lt;br /&gt;
Upgrading gradesheet (grades_view) and review mapping something which webassign uses. &lt;br /&gt;
&lt;br /&gt;
After clicking on ‘Your scores’, all reviews are loaded before rendering the page now. That takes a long time to load and the length of review list is too long.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Picture8.png]]&lt;br /&gt;
&lt;br /&gt;
===Task 5===&lt;br /&gt;
&lt;br /&gt;
View student score to be updated to show review on clicks rather than one below another.&lt;br /&gt;
	Same as task 5&lt;br /&gt;
Better score table using bootstrap.&lt;br /&gt;
No need to explain&lt;br /&gt;
&lt;br /&gt;
= Pages To Be Modified =&lt;br /&gt;
For this project, it is difficult to re-design all webpages and make them responsive. After discussing with the contact person, we will be focusing only on these 3 pages:&lt;br /&gt;
&lt;br /&gt;
=='''Login Page'''==&lt;br /&gt;
[[File:Picture1.png]]&lt;br /&gt;
&lt;br /&gt;
=== What's wrong with it ===&lt;br /&gt;
1. Now it takes more than 15 seconds to even login to the admin's home page with the sample development database. This is definitely not good enough for a daily used web application. The cause for the long rendering time is that it will be redirected to 'tree_display/list', which needs to fetch all questionnaires, courses and assignments before page rendering.&lt;br /&gt;
&lt;br /&gt;
2. The webpage looks primitive.&lt;br /&gt;
&lt;br /&gt;
=== What changes need to be made ===&lt;br /&gt;
1. Actually it is unnecessary to fetch all data at the very beginning; if there is too much data to present, the list will be extremely long and it is quite hard for users to locate a specific course. So, we will use AngularJS and jQuery to make a asynchronous webpage that delays the database query until all the basic html elements are correctly rendered, or until the user explicitly asks for that part of data.&lt;br /&gt;
&lt;br /&gt;
2. Bootstrap will be applied for better user interfaces.&lt;br /&gt;
&lt;br /&gt;
=='''Manage-Course page'''==&lt;br /&gt;
[[File:Picture2.png]]&lt;br /&gt;
&lt;br /&gt;
=== What's wrong with it ===&lt;br /&gt;
As illustrated above, now the displaying list is too long and it takes too long to scroll to the end, which makes locating a specific course quite difficult.&lt;br /&gt;
&lt;br /&gt;
Also, the loading time can be reduced.&lt;br /&gt;
&lt;br /&gt;
=== What changes need to be made ===&lt;br /&gt;
&lt;br /&gt;
1. Create several buttons for different time intervals, for example, after clicking on the button '2013-2014', only courses for 2013 to 2014 are presenting, and there is no redirection during this process.&lt;br /&gt;
&lt;br /&gt;
2. The database should not be executed before the user clicks on the button. Only parts of databased is fetched when each button is clicked.&lt;br /&gt;
&lt;br /&gt;
3. Bootstrap will be applied for better user interfaces.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Manage-User page'''==&lt;br /&gt;
[[File:Picture3.png]]&lt;br /&gt;
&lt;br /&gt;
=== What's wrong with it ===&lt;br /&gt;
The list is too long&lt;/div&gt;</summary>
		<author><name>Pdeng</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015_E1526_MPRI&amp;diff=96381</id>
		<title>CSC/ECE 517 Spring 2015 E1526 MPRI</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015_E1526_MPRI&amp;diff=96381"/>
		<updated>2015-04-01T03:47:27Z</updated>

		<summary type="html">&lt;p&gt;Pdeng: /* Pages To Be Modified */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''E1526. Responsive web design for Expertiza '''&lt;br /&gt;
&lt;br /&gt;
'''Introduction to Expertiza'''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is a large project developed as a combined effort of students and faculty using the [http://rubyonrails.org/ Ruby on Rails] framework. The main advantage of using Expertiza, in an educational environment, is for the instructor to introduce peer reviewing among the students. Expertiza allows the instructor to create and customize assignments, create a list of topics the students can sign up for, have students work on teams and then review each other's assignments at the end. Expertiza supports submission of almost any document type, including the URLs and wiki pages.&lt;br /&gt;
&lt;br /&gt;
Expertiza is supported by National Science Foundation under Grant No. 0536558. Additional funding from the [http://www.ncsu.edu/ NCSU] [http://litre.ncsu.edu/ Learning in a Technology-Rich Environment] (LITRE) program, the NCSU [http://ofd.ncsu.edu/teaching-learning/ Faculty Center for Teaching and Learning], the NCSU [http://stem.ncsu.edu/ STEM] Initiative, and the Center for Advanced Computing and Communication.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
= Problem Statement =&lt;br /&gt;
&lt;br /&gt;
Despite an amazing set of functionality Expertiza offers, there are numerous parts of it that could use of a more stylish look and an improved user experience. The goal of this project is to use both Bootstrap and AngularJS to improve the look of the entire Expertiza including the representations of buttons, tables, and other elements. Certain changes in design will also improve the efficiency of the web app when it comes to the amount of time it takes for a page to be loaded.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=='''Explanation of Tasks'''==&lt;br /&gt;
&lt;br /&gt;
Auto hides contents on the dashboard for instructors. Updating action buttons with a responsive layout.&lt;br /&gt;
Now, when trying to open manage-courses, all records are loaded before rendering them onto the page, which takes too long time to load and is not responsive at all.&lt;br /&gt;
Better practice is on Virgin American’s website: https://www.virginamerica.com/book/rt/a1/sfo_bos/20150401_20150402&lt;br /&gt;
When the website is representing the calendar, the price for each day is not actually loaded. But the skeleton of the page, which is the calendar in this case, can be displayed first.&lt;br /&gt;
&lt;br /&gt;
So in Expertiza, we can create several buttons for course semesters in the page. After clicking on Fall 2014, the courses for Fall 2014 will come out. And if it is still too long and takes a long time load, we can use a ‘show more’ button ,or automatically load more data when the scroll bar reaching the end of the page, to minimize the content we need to load after one single mouse click. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Picture4-2.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Picture5.png]]&lt;br /&gt;
[[File:Picture6.png]]&lt;br /&gt;
&lt;br /&gt;
===Action panel too complex===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We will need to reduce the number of buttons. For example, the first row are actions for assignments. The second row is for participant.So we can change it to 5 buttons with responsive design, that is, no redirection after clicking on the buttons.&lt;br /&gt;
We will need to design better UI so that it is possible to add users to expertiza, to search a user and change roles.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Picture7.png]]&lt;br /&gt;
&lt;br /&gt;
===Making grades_view responsive and fast===&lt;br /&gt;
&lt;br /&gt;
Same as task 3, we will need to make it responsive. Also, when clicking on the letter A-Z, no redirections should happen and only the form content should be replaced rather than the whole page.&lt;br /&gt;
Upgrading gradesheet (grades_view) and review mapping something which webassign uses. &lt;br /&gt;
	After clicking on ‘Your scores’, all reviews are loaded before rendering the page now.&lt;br /&gt;
	That takes a long time to load and the length of review list is too long.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Picture8.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Task 5===&lt;br /&gt;
&lt;br /&gt;
View student score to be updated to show review on clicks rather than one below another.&lt;br /&gt;
	Same as task 5&lt;br /&gt;
Better score table using bootstrap.&lt;br /&gt;
No need to explain&lt;br /&gt;
&lt;br /&gt;
= Pages To Be Modified =&lt;br /&gt;
For this project, it is unrealistic to re-design all webpages and make them responsive. After discussing with the contact person, our job is mainly focusing on these 3 pages:&lt;br /&gt;
&lt;br /&gt;
=='''Login Page'''==&lt;br /&gt;
[[File:Picture1.png]]&lt;br /&gt;
&lt;br /&gt;
=== What's wrong with it ===&lt;br /&gt;
1. Now it takes more than 15 seconds to even login to the admin's home page with the sample development database. This is definitely not good enough for a daily used web application. The cause for the long rendering time is that it will be redirected to 'tree_display/list', which needs to fetch all questionnaires, courses and assignments before page rendering.&lt;br /&gt;
&lt;br /&gt;
2. The webpage look primitive.&lt;br /&gt;
&lt;br /&gt;
=== What changes need to be made ===&lt;br /&gt;
1. Actually it is unnecessary to fetch all data at the very beginning; if there are too much data to present, the list will be extremely long and it is quite hard for users to locate a specific course. So, we will use AngularJS and jQuery to make a asynchronous webpage that delays the database query until all the basic html elements are correctly rendered, or until the user explicitly asks for that part of data.&lt;br /&gt;
&lt;br /&gt;
2. Bootstrap will be applied for better user interfaces.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Manage-Course page'''==&lt;br /&gt;
[[File:Picture2.png]]&lt;br /&gt;
&lt;br /&gt;
=== What's wrong with it ===&lt;br /&gt;
As illustrated above, now the displaying list is too long and it takes too long to scroll to the end, which makes locating a specific course quite difficult.&lt;br /&gt;
&lt;br /&gt;
Also, the loading time can be reduced.&lt;br /&gt;
&lt;br /&gt;
=== What changes need to be made ===&lt;br /&gt;
&lt;br /&gt;
1. Create several buttons for different time intervals, for example, after clicking on the button '2013-2014', only courses for 2013 to 2014 are presenting, and there is no redirection during this process.&lt;br /&gt;
&lt;br /&gt;
2. The database should not be executed before the user clicks on the button. Only parts of databased is fetched when each button is clicked.&lt;br /&gt;
&lt;br /&gt;
3. Bootstrap will be applied for better user interfaces.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Manage-User page'''==&lt;br /&gt;
[[File:Picture3.png]]&lt;br /&gt;
&lt;br /&gt;
=== What's wrong with it ===&lt;br /&gt;
The list is too long&lt;/div&gt;</summary>
		<author><name>Pdeng</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015_E1526_MPRI&amp;diff=96380</id>
		<title>CSC/ECE 517 Spring 2015 E1526 MPRI</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015_E1526_MPRI&amp;diff=96380"/>
		<updated>2015-04-01T03:47:01Z</updated>

		<summary type="html">&lt;p&gt;Pdeng: /* Pages To Be Modified */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''E1526. Responsive web design for Expertiza '''&lt;br /&gt;
&lt;br /&gt;
'''Introduction to Expertiza'''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is a large project developed as a combined effort of students and faculty using the [http://rubyonrails.org/ Ruby on Rails] framework. The main advantage of using Expertiza, in an educational environment, is for the instructor to introduce peer reviewing among the students. Expertiza allows the instructor to create and customize assignments, create a list of topics the students can sign up for, have students work on teams and then review each other's assignments at the end. Expertiza supports submission of almost any document type, including the URLs and wiki pages.&lt;br /&gt;
&lt;br /&gt;
Expertiza is supported by National Science Foundation under Grant No. 0536558. Additional funding from the [http://www.ncsu.edu/ NCSU] [http://litre.ncsu.edu/ Learning in a Technology-Rich Environment] (LITRE) program, the NCSU [http://ofd.ncsu.edu/teaching-learning/ Faculty Center for Teaching and Learning], the NCSU [http://stem.ncsu.edu/ STEM] Initiative, and the Center for Advanced Computing and Communication.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
= Problem Statement =&lt;br /&gt;
&lt;br /&gt;
Despite an amazing set of functionality Expertiza offers, there are numerous parts of it that could use of a more stylish look and an improved user experience. The goal of this project is to use both Bootstrap and AngularJS to improve the look of the entire Expertiza including the representations of buttons, tables, and other elements. Certain changes in design will also improve the efficiency of the web app when it comes to the amount of time it takes for a page to be loaded.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=='''Explanation of Tasks'''==&lt;br /&gt;
&lt;br /&gt;
Auto hides contents on the dashboard for instructors. Updating action buttons with a responsive layout.&lt;br /&gt;
Now, when trying to open manage-courses, all records are loaded before rendering them onto the page, which takes too long time to load and is not responsive at all.&lt;br /&gt;
Better practice is on Virgin American’s website: https://www.virginamerica.com/book/rt/a1/sfo_bos/20150401_20150402&lt;br /&gt;
When the website is representing the calendar, the price for each day is not actually loaded. But the skeleton of the page, which is the calendar in this case, can be displayed first.&lt;br /&gt;
&lt;br /&gt;
So in Expertiza, we can create several buttons for course semesters in the page. After clicking on Fall 2014, the courses for Fall 2014 will come out. And if it is still too long and takes a long time load, we can use a ‘show more’ button ,or automatically load more data when the scroll bar reaching the end of the page, to minimize the content we need to load after one single mouse click. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Picture4-2.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Picture5.png]]&lt;br /&gt;
[[File:Picture6.png]]&lt;br /&gt;
&lt;br /&gt;
===Action panel too complex===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We will need to reduce the number of buttons. For example, the first row are actions for assignments. The second row is for participant.So we can change it to 5 buttons with responsive design, that is, no redirection after clicking on the buttons.&lt;br /&gt;
We will need to design better UI so that it is possible to add users to expertiza, to search a user and change roles.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Picture7.png]]&lt;br /&gt;
&lt;br /&gt;
===Making grades_view responsive and fast===&lt;br /&gt;
&lt;br /&gt;
Same as task 3, we will need to make it responsive. Also, when clicking on the letter A-Z, no redirections should happen and only the form content should be replaced rather than the whole page.&lt;br /&gt;
Upgrading gradesheet (grades_view) and review mapping something which webassign uses. &lt;br /&gt;
	After clicking on ‘Your scores’, all reviews are loaded before rendering the page now.&lt;br /&gt;
	That takes a long time to load and the length of review list is too long.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Picture8.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Task 5===&lt;br /&gt;
&lt;br /&gt;
View student score to be updated to show review on clicks rather than one below another.&lt;br /&gt;
	Same as task 5&lt;br /&gt;
Better score table using bootstrap.&lt;br /&gt;
No need to explain&lt;br /&gt;
&lt;br /&gt;
= Pages To Be Modified =&lt;br /&gt;
For this project, it is unrealistic to re-design all webpages and make them responsive. After discussing with the contact person, our job is mainly focusing on these 3 pages:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Login Page'''==&lt;br /&gt;
[[File:Picture1.png]]&lt;br /&gt;
&lt;br /&gt;
=== What's wrong with it ===&lt;br /&gt;
1. Now it takes more than 15 seconds to even login to the admin's home page with the sample development database. This is definitely not good enough for a daily used web application. The cause for the long rendering time is that it will be redirected to 'tree_display/list', which needs to fetch all questionnaires, courses and assignments before page rendering.&lt;br /&gt;
&lt;br /&gt;
2. The webpage look primitive.&lt;br /&gt;
&lt;br /&gt;
=== What changes need to be made ===&lt;br /&gt;
1. Actually it is unnecessary to fetch all data at the very beginning; if there are too much data to present, the list will be extremely long and it is quite hard for users to locate a specific course. So, we will use AngularJS and jQuery to make a asynchronous webpage that delays the database query until all the basic html elements are correctly rendered, or until the user explicitly asks for that part of data.&lt;br /&gt;
&lt;br /&gt;
2. Bootstrap will be applied for better user interfaces.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Manage-Course page'''==&lt;br /&gt;
[[File:Picture2.png]]&lt;br /&gt;
&lt;br /&gt;
=== What's wrong with it ===&lt;br /&gt;
As illustrated above, now the displaying list is too long and it takes too long to scroll to the end, which makes locating a specific course quite difficult.&lt;br /&gt;
&lt;br /&gt;
Also, the loading time can be reduced.&lt;br /&gt;
&lt;br /&gt;
=== What changes need to be made ===&lt;br /&gt;
&lt;br /&gt;
1. Create several buttons for different time intervals, for example, after clicking on the button '2013-2014', only courses for 2013 to 2014 are presenting, and there is no redirection during this process.&lt;br /&gt;
&lt;br /&gt;
2. The database should not be executed before the user clicks on the button. Only parts of databased is fetched when each button is clicked.&lt;br /&gt;
&lt;br /&gt;
3. Bootstrap will be applied for better user interfaces.&lt;br /&gt;
&lt;br /&gt;
=='''Manage-User page'''==&lt;br /&gt;
[[File:Picture3.png]]&lt;br /&gt;
&lt;br /&gt;
=== What's wrong with it ===&lt;br /&gt;
The list is too long&lt;/div&gt;</summary>
		<author><name>Pdeng</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015_E1526_MPRI&amp;diff=96376</id>
		<title>CSC/ECE 517 Spring 2015 E1526 MPRI</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015_E1526_MPRI&amp;diff=96376"/>
		<updated>2015-04-01T03:22:59Z</updated>

		<summary type="html">&lt;p&gt;Pdeng: /* Pages To Be Modified */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''E1526. Responsive web design for Expertiza '''&lt;br /&gt;
&lt;br /&gt;
'''Introduction to Expertiza'''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is a large project developed as a combined effort of students and faculty using the [http://rubyonrails.org/ Ruby on Rails] framework. The main advantage of using Expertiza, in an educational environment, is for the instructor to introduce peer reviewing among the students. Expertiza allows the instructor to create and customize assignments, create a list of topics the students can sign up for, have students work on teams and then review each other's assignments at the end. Expertiza supports submission of almost any document type, including the URLs and wiki pages.&lt;br /&gt;
&lt;br /&gt;
Expertiza is supported by National Science Foundation under Grant No. 0536558. Additional funding from the [http://www.ncsu.edu/ NCSU] [http://litre.ncsu.edu/ Learning in a Technology-Rich Environment] (LITRE) program, the NCSU [http://ofd.ncsu.edu/teaching-learning/ Faculty Center for Teaching and Learning], the NCSU [http://stem.ncsu.edu/ STEM] Initiative, and the Center for Advanced Computing and Communication.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
= Problem Statement =&lt;br /&gt;
&lt;br /&gt;
Despite an amazing set of functionality Expertiza offers, there are numerous parts of it that could use a more stylish look and an improved user experience. The goal of this project is to use both Bootstrap and AngularJS to improve the look of the entire Expertiza including the representations of buttons, tables, and other elements. Certain changes in design will also improve the efficiency of the web app when it comes to the amount of time it takes for a page to be loaded.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=='''Explanation of Tasks'''==&lt;br /&gt;
&lt;br /&gt;
Auto hides contents on the dashboard for instructors. Updating action buttons with a responsive layout.&lt;br /&gt;
Now, when trying to open manage-courses, all records are loaded before rendering them onto the page, which takes too long time to load and is not responsive at all.&lt;br /&gt;
Better practice is on Virgin American’s website: https://www.virginamerica.com/book/rt/a1/sfo_bos/20150401_20150402&lt;br /&gt;
When the website is representing the calendar, the price for each day is not actually loaded. But the skeleton of the page, which is the calendar in this case, can be displayed first.&lt;br /&gt;
&lt;br /&gt;
So in Expertiza, we can create several buttons for course semesters in the page. After clicking on Fall 2014, the courses for Fall 2014 will come out. And if it is still too long and takes a long time load, we can use a ‘show more’ button ,or automatically load more data when the scroll bar reaching the end of the page, to minimize the content we need to load after one single mouse click. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Picture4-2.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Picture5.png]]&lt;br /&gt;
[[File:Picture6.png]]&lt;br /&gt;
&lt;br /&gt;
===Action panel too complex===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We will need to reduce the number of buttons. For example, the first row are actions for assignments. The second row is for participant...So we can change it to 5 buttons with responsive design, that is, no redirection after clicking on the buttons.&lt;br /&gt;
Better UI to add users to expertiza, search a user, change it roles.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Picture7.png]]&lt;br /&gt;
&lt;br /&gt;
===Making grades_view responsive and fast===&lt;br /&gt;
&lt;br /&gt;
Same as task 3, we will need to make it responsive. Also, when clicking on the letter A-Z, no redirections should happen and only the form content should be replaced rather than the whole page.&lt;br /&gt;
Upgrading gradesheet (grades_view) and review mapping something which webassign uses. &lt;br /&gt;
	After clicking on ‘Your scores’, all reviews are loaded before rendering the page now.&lt;br /&gt;
	That takes a long time to load and the length of review list is too long.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Picture8.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Task 5===&lt;br /&gt;
&lt;br /&gt;
View student score to be updated to show review on clicks rather than one below another.&lt;br /&gt;
	Same as task 5&lt;br /&gt;
Better score table using bootstrap.&lt;br /&gt;
No need to explain&lt;br /&gt;
&lt;br /&gt;
= Pages To Be Modified =&lt;br /&gt;
For this project, it is unrealistic to re-design all webpages and make them responsive. After discussing with the contact person, our job is mainly focusing on these 3 pages:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Login Page'''==&lt;br /&gt;
[[File:Picture1.png]]&lt;br /&gt;
&lt;br /&gt;
=== What's wrong with it ===&lt;br /&gt;
Now it takes more than 15 seconds to even login to the admin's home page with the sample development database. This is definitely not good enough for a daily used web application.&lt;br /&gt;
&lt;br /&gt;
The cause for the long rendering time is that it will be redirected to 'tree_display/list', which needs to fetch all questionnaires, courses and assignments before page rendering.&lt;br /&gt;
&lt;br /&gt;
=== What changes need to be made ===&lt;br /&gt;
Actually it is unnecessary to fetch all data at the very beginning; if there are too much data to present, the list will be extremely long and it is quite hard for users to locate a specific course.&lt;br /&gt;
&lt;br /&gt;
So, we will use AngularJS and jQuery to make a asynchronous webpage that delays the database query until all the basic html elements are correctly rendered, or until the user explicitly asks for that part of data.&lt;br /&gt;
&lt;br /&gt;
=='''Manage-Course page'''==&lt;br /&gt;
[[File:Picture2.png]]&lt;br /&gt;
&lt;br /&gt;
=='''Manage-User page'''==&lt;br /&gt;
[[File:Picture3.png]]&lt;/div&gt;</summary>
		<author><name>Pdeng</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015_E1526_MPRI&amp;diff=96369</id>
		<title>CSC/ECE 517 Spring 2015 E1526 MPRI</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015_E1526_MPRI&amp;diff=96369"/>
		<updated>2015-04-01T03:18:56Z</updated>

		<summary type="html">&lt;p&gt;Pdeng: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''E1526. Responsive web design for Expertiza '''&lt;br /&gt;
&lt;br /&gt;
'''Introduction to Expertiza'''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is a large project developed as a combined effort of students and faculty using the [http://rubyonrails.org/ Ruby on Rails] framework. The main advantage of using Expertiza, in an educational environment, is for the instructor to introduce peer reviewing among the students. Expertiza allows the instructor to create and customize assignments, create a list of topics the students can sign up for, have students work on teams and then review each other's assignments at the end. Expertiza supports submission of almost any document type, including the URLs and wiki pages.&lt;br /&gt;
&lt;br /&gt;
Expertiza is supported by National Science Foundation under Grant No. 0536558. Additional funding from the [http://www.ncsu.edu/ NCSU] [http://litre.ncsu.edu/ Learning in a Technology-Rich Environment] (LITRE) program, the NCSU [http://ofd.ncsu.edu/teaching-learning/ Faculty Center for Teaching and Learning], the NCSU [http://stem.ncsu.edu/ STEM] Initiative, and the Center for Advanced Computing and Communication.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
= Problem Statement =&lt;br /&gt;
&lt;br /&gt;
Despite an amazing set of functionality Expertiza offers, there are numerous parts of it that could use a more stylish look and an improved user experience. The goal of this project is to use both Bootstrap and AngularJS to improve the look of the entire Expertiza including the representations of buttons, tables, and other elements. Certain changes in design will also improve the efficiency of the web app when it comes to the amount of time it takes for a page to be loaded.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=='''Explanation of Tasks'''==&lt;br /&gt;
&lt;br /&gt;
Auto hides contents on the dashboard for instructors. Updating action buttons with a responsive layout.&lt;br /&gt;
Now, when trying to open manage-courses, all records are loaded before rendering them onto the page, which takes too long time to load and is not responsive at all.&lt;br /&gt;
Better practice is on Virgin American’s website: https://www.virginamerica.com/book/rt/a1/sfo_bos/20150401_20150402&lt;br /&gt;
When the website is representing the calendar, the price for each day is not actually loaded. But the skeleton of the page, which is the calendar in this case, can be displayed first.&lt;br /&gt;
&lt;br /&gt;
So in Expertiza, we can create several buttons for course semesters in the page. After clicking on Fall 2014, the courses for Fall 2014 will come out. And if it is still too long and takes a long time load, we can use a ‘show more’ button ,or automatically load more data when the scroll bar reaching the end of the page, to minimize the content we need to load after one single mouse click. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Picture4-2.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Picture5.png]]&lt;br /&gt;
[[File:Picture6.png]]&lt;br /&gt;
&lt;br /&gt;
===Action panel too complex===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We will need to reduce the number of buttons. For example, the first row are actions for assignments. The second row is for participant...So we can change it to 5 buttons with responsive design, that is, no redirection after clicking on the buttons.&lt;br /&gt;
Better UI to add users to expertiza, search a user, change it roles.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Picture7.png]]&lt;br /&gt;
&lt;br /&gt;
===Making grades_view responsive and fast===&lt;br /&gt;
&lt;br /&gt;
Same as task 3, we will need to make it responsive. Also, when clicking on the letter A-Z, no redirections should happen and only the form content should be replaced rather than the whole page.&lt;br /&gt;
Upgrading gradesheet (grades_view) and review mapping something which webassign uses. &lt;br /&gt;
	After clicking on ‘Your scores’, all reviews are loaded before rendering the page now.&lt;br /&gt;
	That takes a long time to load and the length of review list is too long.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Picture8.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Task 5===&lt;br /&gt;
&lt;br /&gt;
View student score to be updated to show review on clicks rather than one below another.&lt;br /&gt;
	Same as task 5&lt;br /&gt;
Better score table using bootstrap.&lt;br /&gt;
No need to explain&lt;br /&gt;
&lt;br /&gt;
= Pages To Be Modified =&lt;br /&gt;
&lt;br /&gt;
=='''Login Page'''==&lt;br /&gt;
[[File:Picture1.png]]&lt;br /&gt;
&lt;br /&gt;
=== What's wrong with it ===&lt;br /&gt;
Now it takes more than 15 seconds to even login to the admin's home page with the sample development database. This is definitely not good enough for a daily used web application.&lt;br /&gt;
&lt;br /&gt;
The cause for the long rendering time is that it will be redirected to 'tree_display/list', which needs to fetch all questionnaires, courses and assignments before page rendering.&lt;br /&gt;
&lt;br /&gt;
=== What changes need to be made ===&lt;br /&gt;
Actually it is unnecessary to fetch all data at the very beginning; if there are too much data to present, the list will be extremely long and it is quite hard for users to locate a specific course.&lt;br /&gt;
&lt;br /&gt;
So, we will use AngularJS and jQuery to make a asynchronous webpage that delays the database query until all the basic html elements are correctly rendered, or until the user explicitly asks for that part of data.&lt;br /&gt;
&lt;br /&gt;
=='''Manage-Course page'''==&lt;br /&gt;
[[File:Picture2.png]]&lt;br /&gt;
&lt;br /&gt;
=='''Manage-User page'''==&lt;br /&gt;
[[File:Picture3.png]]&lt;/div&gt;</summary>
		<author><name>Pdeng</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015_E1526_MPRI&amp;diff=96367</id>
		<title>CSC/ECE 517 Spring 2015 E1526 MPRI</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015_E1526_MPRI&amp;diff=96367"/>
		<updated>2015-04-01T03:17:42Z</updated>

		<summary type="html">&lt;p&gt;Pdeng: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''E1526. Responsive web design for Expertiza '''&lt;br /&gt;
&lt;br /&gt;
'''Introduction to Expertiza'''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is a large project developed as a combined effort of students and faculty using the [http://rubyonrails.org/ Ruby on Rails] framework. The main advantage of using Expertiza, in an educational environment, is for the instructor to introduce peer reviewing among the students. Expertiza allows the instructor to create and customize assignments, create a list of topics the students can sign up for, have students work on teams and then review each other's assignments at the end. Expertiza supports submission of almost any document type, including the URLs and wiki pages.&lt;br /&gt;
&lt;br /&gt;
Expertiza is supported by National Science Foundation under Grant No. 0536558. Additional funding from the [http://www.ncsu.edu/ NCSU] [http://litre.ncsu.edu/ Learning in a Technology-Rich Environment] (LITRE) program, the NCSU [http://ofd.ncsu.edu/teaching-learning/ Faculty Center for Teaching and Learning], the NCSU [http://stem.ncsu.edu/ STEM] Initiative, and the Center for Advanced Computing and Communication.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
= Problem Statement =&lt;br /&gt;
&lt;br /&gt;
Despite an amazing set of functionality Expertiza offers, there are numerous parts of it that could use a more stylish look and an improved user experience. The goal of this project is to use both Bootstrap and AngularJS to improve the look of the entire Expertiza including the representations of buttons, tables, and other elements. Certain changes in design will also improve the efficiency of the web app when it comes to the amount of time it takes for a page to be loaded.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=='''Explanation of Tasks'''==&lt;br /&gt;
&lt;br /&gt;
Auto hides contents on the dashboard for instructors. Updating action buttons with a responsive layout.&lt;br /&gt;
Now, when trying to open manage-courses, all records are loaded before rendering them onto the page, which takes too long time to load and is not responsive at all.&lt;br /&gt;
Better practice is on Virgin American’s website: https://www.virginamerica.com/book/rt/a1/sfo_bos/20150401_20150402&lt;br /&gt;
When the website is representing the calendar, the price for each day is not actually loaded. But the skeleton of the page, which is the calendar in this case, can be displayed first.&lt;br /&gt;
&lt;br /&gt;
So in Expertiza, we can create several buttons for course semesters in the page. After clicking on Fall 2014, the courses for Fall 2014 will come out. And if it is still too long and takes a long time load, we can use a ‘show more’ button ,or automatically load more data when the scroll bar reaching the end of the page, to minimize the content we need to load after one single mouse click. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Picture4-2.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Picture5.png]]&lt;br /&gt;
[[File:Picture6.png]]&lt;br /&gt;
&lt;br /&gt;
===Action panel too complex===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We will need to reduce the number of buttons. For example, the first row are actions for assignments. The second row is for participant...So we can change it to 5 buttons with responsive design, that is, no redirection after clicking on the buttons.&lt;br /&gt;
Better UI to add users to expertiza, search a user, change it roles.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Picture7.png]]&lt;br /&gt;
&lt;br /&gt;
===Making grades_view responsive and fast===&lt;br /&gt;
&lt;br /&gt;
Same as task 3, we will need to make it responsive. Also, when clicking on the letter A-Z, no redirections should happen and only the form content should be replaced rather than the whole page.&lt;br /&gt;
Upgrading gradesheet (grades_view) and review mapping something which webassign uses. &lt;br /&gt;
	After clicking on ‘Your scores’, all reviews are loaded before rendering the page now.&lt;br /&gt;
	That takes a long time to load and the length of review list is too long.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Picture8.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Task 5===&lt;br /&gt;
&lt;br /&gt;
View student score to be updated to show review on clicks rather than one below another.&lt;br /&gt;
	Same as task 5&lt;br /&gt;
Better score table using bootstrap.&lt;br /&gt;
No need to explain&lt;br /&gt;
&lt;br /&gt;
= To Be Modified Pages =&lt;br /&gt;
&lt;br /&gt;
=='''Login Page'''==&lt;br /&gt;
[[File:Picture1.png]]&lt;br /&gt;
&lt;br /&gt;
=== What's wrong with it ===&lt;br /&gt;
Now it takes more than 15 seconds to even login to the admin's home page with the sample development database. This is definitely not good enough for a daily used web application.&lt;br /&gt;
&lt;br /&gt;
The cause for the long rendering time is that it will be redirected to 'tree_display/list', which needs to fetch all questionnaires, courses and assignments before page rendering.&lt;br /&gt;
&lt;br /&gt;
=== What changes need to be made ===&lt;br /&gt;
Actually it is unnecessary to fetch all data at the very beginning; if there are too much data to present, the list will be extremely long and it is quite hard for users to locate a specific course.&lt;br /&gt;
&lt;br /&gt;
So, we will use AngularJS and jQuery to make a asynchronous webpage that delays the database query until all the basic html elements are correctly rendered, or until the user explicitly asks for that part of data.&lt;br /&gt;
&lt;br /&gt;
=='''Manage-Course page'''==&lt;br /&gt;
[[File:Picture2.png]]&lt;br /&gt;
&lt;br /&gt;
=='''Manage-User page'''==&lt;br /&gt;
[[File:Picture3.png]]&lt;/div&gt;</summary>
		<author><name>Pdeng</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015_E1526_MPRI&amp;diff=96364</id>
		<title>CSC/ECE 517 Spring 2015 E1526 MPRI</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015_E1526_MPRI&amp;diff=96364"/>
		<updated>2015-04-01T03:13:27Z</updated>

		<summary type="html">&lt;p&gt;Pdeng: /* Login Page */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''E1526. Responsive web design for Expertiza '''&lt;br /&gt;
&lt;br /&gt;
'''Introduction to Expertiza'''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is a large project developed as a combined effort of students and faculty using the [http://rubyonrails.org/ Ruby on Rails] framework. The main advantage of using Expertiza, in an educational environment, is for the instructor to introduce peer reviewing among the students. Expertiza allows the instructor to create and customize assignments, create a list of topics the students can sign up for, have students work on teams and then review each other's assignments at the end. Expertiza supports submission of almost any document type, including the URLs and wiki pages.&lt;br /&gt;
&lt;br /&gt;
Expertiza is supported by National Science Foundation under Grant No. 0536558. Additional funding from the [http://www.ncsu.edu/ NCSU] [http://litre.ncsu.edu/ Learning in a Technology-Rich Environment] (LITRE) program, the NCSU [http://ofd.ncsu.edu/teaching-learning/ Faculty Center for Teaching and Learning], the NCSU [http://stem.ncsu.edu/ STEM] Initiative, and the Center for Advanced Computing and Communication.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
= Problem Statement =&lt;br /&gt;
&lt;br /&gt;
Despite an amazing set of functionality Expertiza offers, there are numerous parts of it that could use a more stylish look and an improved user experience. The goal of this project is to use both Bootstrap and AngularJS to improve the look of the entire Expertiza including the representations of buttons, tables, and other elements. Certain changes in design will also improve the efficiency of the web app when it comes to the amount of time it takes for a page to be loaded.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=='''Explanation of Tasks'''==&lt;br /&gt;
&lt;br /&gt;
Auto hides contents on the dashboard for instructors. Updating action buttons with a responsive layout.&lt;br /&gt;
Now, when trying to open manage-courses, all records are loaded before rendering them onto the page, which takes too long time to load and is not responsive at all.&lt;br /&gt;
Better practice is on Virgin American’s website: https://www.virginamerica.com/book/rt/a1/sfo_bos/20150401_20150402&lt;br /&gt;
When the website is representing the calendar, the price for each day is not actually loaded. But the skeleton of the page, which is the calendar in this case, can be displayed first.&lt;br /&gt;
&lt;br /&gt;
So in Expertiza, we can create several buttons for course semesters in the page. After clicking on Fall 2014, the courses for Fall 2014 will come out. And if it is still too long and takes a long time load, we can use a ‘show more’ button ,or automatically load more data when the scroll bar reaching the end of the page, to minimize the content we need to load after one single mouse click. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Picture4-2.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Picture5.png]]&lt;br /&gt;
[[File:Picture6.png]]&lt;br /&gt;
&lt;br /&gt;
===Action panel too complex===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We will need to reduce the number of buttons. For example, the first row are actions for assignments. The second row is for participant...So we can change it to 5 buttons with responsive design, that is, no redirection after clicking on the buttons.&lt;br /&gt;
Better UI to add users to expertiza, search a user, change it roles.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Picture7.png]]&lt;br /&gt;
&lt;br /&gt;
===Making grades_view responsive and fast===&lt;br /&gt;
&lt;br /&gt;
Same as task 3, we will need to make it responsive. Also, when clicking on the letter A-Z, no redirections should happen and only the form content should be replaced rather than the whole page.&lt;br /&gt;
Upgrading gradesheet (grades_view) and review mapping something which webassign uses. &lt;br /&gt;
	After clicking on ‘Your scores’, all reviews are loaded before rendering the page now.&lt;br /&gt;
	That takes a long time to load and the length of review list is too long.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Picture8.png]]&lt;br /&gt;
&lt;br /&gt;
Explanation to the task listed in the decription decumentation:&lt;br /&gt;
Updrading all buttons to Bootstrap (http://angular-ui.github.io/bootstrap/)&lt;br /&gt;
	No explanation needed&lt;br /&gt;
Creation of new theme which locks menu on the top for easy navigation.&lt;br /&gt;
	Example: https://www.virginamerica.com/&lt;br /&gt;
	When the page scrolls down, the menu is fixed on the top&lt;br /&gt;
&lt;br /&gt;
Auto hides contents on the dashboard for instructors. Updating action buttons with a responsive layout.&lt;br /&gt;
Now, when trying to open manage-courses, all records are loaded before rendering them onto the page, which takes too long time to load and is not responsive at all.&lt;br /&gt;
Better practice is on Virgin American’s website: https://www.virginamerica.com/book/rt/a1/sfo_bos/20150401_20150402&lt;br /&gt;
When the website is representing the calendar, the price for each day is not actually loaded. But the skeleton of the page, which is the calendar in this case, can be displayed first.&lt;br /&gt;
&lt;br /&gt;
So in Expertiza, we can create several buttons for course semesters in the page. After clicking on Fall 2014, the courses for Fall 2014 will come out. And if it is still too long and takes a long time load, we can use a ‘show more’ button ,or automatically load more data when the scroll bar reaching the end of the page, to minimize the content we need to load after one single mouse click. &lt;br /&gt;
&lt;br /&gt;
We will need to reduce the number of buttons. For example, the first row are actions for assignments. The second row is for participant...So we can change it to 5 buttons with responsive design, that is, no redirection after clicking on the buttons.&lt;br /&gt;
Better UI to add users to expertiza, search a user, change it roles.&lt;br /&gt;
Same as task 3, we will need to make it responsive. Also, when clicking on the letter A-Z, no redirections should happen and only the form content should be replaced rather than the whole page.&lt;br /&gt;
Upgrading gradesheet (grades_view) and review mapping something which webassign uses. &lt;br /&gt;
	After clicking on ‘Your scores’, all reviews are loaded before rendering the page now.&lt;br /&gt;
	That takes a long time to load and the length of review list is too long.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
View student score to be updated to show review on clicks rather than one below another.&lt;br /&gt;
	Same as task 5&lt;br /&gt;
Better score table using bootstrap.&lt;br /&gt;
No need to explain&lt;br /&gt;
&lt;br /&gt;
=='''Login Page'''==&lt;br /&gt;
[[File:Picture1.png]]&lt;br /&gt;
&lt;br /&gt;
=== What's wrong with it ===&lt;br /&gt;
Now it takes more than 15 seconds to even login to the admin's home page with the sample development database. This is definitely not good enough for a daily used web application.&lt;br /&gt;
&lt;br /&gt;
The cause for the long rendering time is that it will be redirected to 'tree_display/list', which needs to fetch all questionnaires, courses and assignments before page rendering.&lt;br /&gt;
&lt;br /&gt;
=== What changes need to be made ===&lt;br /&gt;
Actually it is unnecessary to fetch all data at the very beginning; if there are too much data to present, the list will be extremely long and it is quite hard for users to locate a specific course.&lt;br /&gt;
&lt;br /&gt;
So, we will use AngularJS and jQuery to make a asynchronous webpage that delays the database query until all the basic html elements are correctly rendered, or until the user explicitly asks for that part of data.&lt;br /&gt;
&lt;br /&gt;
=='''Manage-Course page'''==&lt;br /&gt;
[[File:Picture2.png]]&lt;br /&gt;
&lt;br /&gt;
=='''Manage-User page'''==&lt;br /&gt;
[[File:Picture3.png]]&lt;/div&gt;</summary>
		<author><name>Pdeng</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015_E1526_MPRI&amp;diff=96342</id>
		<title>CSC/ECE 517 Spring 2015 E1526 MPRI</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015_E1526_MPRI&amp;diff=96342"/>
		<updated>2015-04-01T02:52:01Z</updated>

		<summary type="html">&lt;p&gt;Pdeng: /* Explanation of Tasks */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''E1526. Responsive web design for Expertiza '''&lt;br /&gt;
&lt;br /&gt;
'''Introduction to Expertiza'''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is a large project developed as a combined effort of students and faculty using the [http://rubyonrails.org/ Ruby on Rails] framework. The main advantage of using Expertiza, in an educational environment, is for the instructor to introduce peer reviewing among the students. Expertiza allows the instructor to create and customize assignments, create a list of topics the students can sign up for, have students work on teams and then review each other's assignments at the end. Expertiza supports submission of almost any document type, including the URLs and wiki pages.&lt;br /&gt;
&lt;br /&gt;
Expertiza is supported by National Science Foundation under Grant No. 0536558. Additional funding from the [http://www.ncsu.edu/ NCSU] [http://litre.ncsu.edu/ Learning in a Technology-Rich Environment] (LITRE) program, the NCSU [http://ofd.ncsu.edu/teaching-learning/ Faculty Center for Teaching and Learning], the NCSU [http://stem.ncsu.edu/ STEM] Initiative, and the Center for Advanced Computing and Communication.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
= Problem Statement =&lt;br /&gt;
&lt;br /&gt;
Despite an amazing set of functionality Expertiza offers, there are numerous parts of it that could use a more stylish look and an improved user experience. The goal of this project is to use both Bootstrap and AngularJS to improve the look of the entire Expertiza including the representations of buttons, tables, and other elements. Certain changes in design will also improve the efficiency of the web app when it comes to the amount of time it takes for a page to be loaded.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=='''Explanation of Tasks'''==&lt;br /&gt;
[[File:Picture4-2.png]]&lt;br /&gt;
[[File:Picture5.png]]&lt;br /&gt;
[[File:Picture6.png]]&lt;br /&gt;
[[File:Picture7.png]]&lt;br /&gt;
[[File:Picture8.png]]&lt;br /&gt;
Explanation to the task listed in the decription decumentation:&lt;br /&gt;
Updrading all buttons to Bootstrap (http://angular-ui.github.io/bootstrap/)&lt;br /&gt;
	No explanation needed&lt;br /&gt;
Creation of new theme which locks menu on the top for easy navigation.&lt;br /&gt;
	Example: https://www.virginamerica.com/&lt;br /&gt;
	When the page scrolls down, the menu is fixed on the top&lt;br /&gt;
&lt;br /&gt;
Auto hides contents on the dashboard for instructors. Updating action buttons with a responsive layout.&lt;br /&gt;
Now, when trying to open manage-courses, all records are loaded before rendering them onto the page, which takes too long time to load and is not responsive at all.&lt;br /&gt;
Better practice is on Virgin American’s website: https://www.virginamerica.com/book/rt/a1/sfo_bos/20150401_20150402&lt;br /&gt;
When the website is representing the calendar, the price for each day is not actually loaded. But the skeleton of the page, which is the calendar in this case, can be displayed first.&lt;br /&gt;
&lt;br /&gt;
So in Expertiza, we can create several buttons for course semesters in the page. After clicking on Fall 2014, the courses for Fall 2014 will come out. And if it is still too long and takes a long time load, we can use a ‘show more’ button ,or automatically load more data when the scroll bar reaching the end of the page, to minimize the content we need to load after one single mouse click. &lt;br /&gt;
&lt;br /&gt;
We will need to reduce the number of buttons. For example, the first row are actions for assignments. The second row is for participant...So we can change it to 5 buttons with responsive design, that is, no redirection after clicking on the buttons.&lt;br /&gt;
Better UI to add users to expertiza, search a user, change it roles.&lt;br /&gt;
Same as task 3, we will need to make it responsive. Also, when clicking on the letter A-Z, no redirections should happen and only the form content should be replaced rather than the whole page.&lt;br /&gt;
Upgrading gradesheet (grades_view) and review mapping something which webassign uses. &lt;br /&gt;
	After clicking on ‘Your scores’, all reviews are loaded before rendering the page now.&lt;br /&gt;
	That takes a long time to load and the length of review list is too long.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
View student score to be updated to show review on clicks rather than one below another.&lt;br /&gt;
	Same as task 5&lt;br /&gt;
Better score table using bootstrap.&lt;br /&gt;
No need to explain&lt;br /&gt;
&lt;br /&gt;
=='''Login Page'''==&lt;br /&gt;
[[File:Picture1.png]]&lt;br /&gt;
&lt;br /&gt;
=='''Manage-Course page'''==&lt;br /&gt;
[[File:Picture2.png]]&lt;br /&gt;
&lt;br /&gt;
=='''Manage-User page'''==&lt;br /&gt;
[[File:Picture3.png]]&lt;/div&gt;</summary>
		<author><name>Pdeng</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015_E1526_MPRI&amp;diff=96340</id>
		<title>CSC/ECE 517 Spring 2015 E1526 MPRI</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015_E1526_MPRI&amp;diff=96340"/>
		<updated>2015-04-01T02:51:10Z</updated>

		<summary type="html">&lt;p&gt;Pdeng: /* Manage-User page */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''E1526. Responsive web design for Expertiza '''&lt;br /&gt;
&lt;br /&gt;
'''Introduction to Expertiza'''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is a large project developed as a combined effort of students and faculty using the [http://rubyonrails.org/ Ruby on Rails] framework. The main advantage of using Expertiza, in an educational environment, is for the instructor to introduce peer reviewing among the students. Expertiza allows the instructor to create and customize assignments, create a list of topics the students can sign up for, have students work on teams and then review each other's assignments at the end. Expertiza supports submission of almost any document type, including the URLs and wiki pages.&lt;br /&gt;
&lt;br /&gt;
Expertiza is supported by National Science Foundation under Grant No. 0536558. Additional funding from the [http://www.ncsu.edu/ NCSU] [http://litre.ncsu.edu/ Learning in a Technology-Rich Environment] (LITRE) program, the NCSU [http://ofd.ncsu.edu/teaching-learning/ Faculty Center for Teaching and Learning], the NCSU [http://stem.ncsu.edu/ STEM] Initiative, and the Center for Advanced Computing and Communication.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
= Problem Statement =&lt;br /&gt;
&lt;br /&gt;
Despite an amazing set of functionality Expertiza offers, there are numerous parts of it that could use a more stylish look and an improved user experience. The goal of this project is to use both Bootstrap and AngularJS to improve the look of the entire Expertiza including the representations of buttons, tables, and other elements. Certain changes in design will also improve the efficiency of the web app when it comes to the amount of time it takes for a page to be loaded.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=='''Explanation of Tasks'''==&lt;br /&gt;
&lt;br /&gt;
Explanation to the task listed in the decription decumentation:&lt;br /&gt;
Updrading all buttons to Bootstrap (http://angular-ui.github.io/bootstrap/)&lt;br /&gt;
	No explanation needed&lt;br /&gt;
Creation of new theme which locks menu on the top for easy navigation.&lt;br /&gt;
	Example: https://www.virginamerica.com/&lt;br /&gt;
	When the page scrolls down, the menu is fixed on the top&lt;br /&gt;
&lt;br /&gt;
Auto hides contents on the dashboard for instructors. Updating action buttons with a responsive layout.&lt;br /&gt;
Now, when trying to open manage-courses, all records are loaded before rendering them onto the page, which takes too long time to load and is not responsive at all.&lt;br /&gt;
Better practice is on Virgin American’s website: https://www.virginamerica.com/book/rt/a1/sfo_bos/20150401_20150402&lt;br /&gt;
When the website is representing the calendar, the price for each day is not actually loaded. But the skeleton of the page, which is the calendar in this case, can be displayed first.&lt;br /&gt;
&lt;br /&gt;
So in Expertiza, we can create several buttons for course semesters in the page. After clicking on Fall 2014, the courses for Fall 2014 will come out. And if it is still too long and takes a long time load, we can use a ‘show more’ button ,or automatically load more data when the scroll bar reaching the end of the page, to minimize the content we need to load after one single mouse click. &lt;br /&gt;
&lt;br /&gt;
We will need to reduce the number of buttons. For example, the first row are actions for assignments. The second row is for participant...So we can change it to 5 buttons with responsive design, that is, no redirection after clicking on the buttons.&lt;br /&gt;
Better UI to add users to expertiza, search a user, change it roles.&lt;br /&gt;
Same as task 3, we will need to make it responsive. Also, when clicking on the letter A-Z, no redirections should happen and only the form content should be replaced rather than the whole page.&lt;br /&gt;
Upgrading gradesheet (grades_view) and review mapping something which webassign uses. &lt;br /&gt;
	After clicking on ‘Your scores’, all reviews are loaded before rendering the page now.&lt;br /&gt;
	That takes a long time to load and the length of review list is too long.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
View student score to be updated to show review on clicks rather than one below another.&lt;br /&gt;
	Same as task 5&lt;br /&gt;
Better score table using bootstrap.&lt;br /&gt;
No need to explain&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Login Page'''==&lt;br /&gt;
[[File:Picture1.png]]&lt;br /&gt;
&lt;br /&gt;
=='''Manage-Course page'''==&lt;br /&gt;
[[File:Picture2.png]]&lt;br /&gt;
&lt;br /&gt;
=='''Manage-User page'''==&lt;br /&gt;
[[File:Picture3.png]]&lt;/div&gt;</summary>
		<author><name>Pdeng</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015_E1526_MPRI&amp;diff=96339</id>
		<title>CSC/ECE 517 Spring 2015 E1526 MPRI</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015_E1526_MPRI&amp;diff=96339"/>
		<updated>2015-04-01T02:51:00Z</updated>

		<summary type="html">&lt;p&gt;Pdeng: /* Manage-Course page */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''E1526. Responsive web design for Expertiza '''&lt;br /&gt;
&lt;br /&gt;
'''Introduction to Expertiza'''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is a large project developed as a combined effort of students and faculty using the [http://rubyonrails.org/ Ruby on Rails] framework. The main advantage of using Expertiza, in an educational environment, is for the instructor to introduce peer reviewing among the students. Expertiza allows the instructor to create and customize assignments, create a list of topics the students can sign up for, have students work on teams and then review each other's assignments at the end. Expertiza supports submission of almost any document type, including the URLs and wiki pages.&lt;br /&gt;
&lt;br /&gt;
Expertiza is supported by National Science Foundation under Grant No. 0536558. Additional funding from the [http://www.ncsu.edu/ NCSU] [http://litre.ncsu.edu/ Learning in a Technology-Rich Environment] (LITRE) program, the NCSU [http://ofd.ncsu.edu/teaching-learning/ Faculty Center for Teaching and Learning], the NCSU [http://stem.ncsu.edu/ STEM] Initiative, and the Center for Advanced Computing and Communication.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
= Problem Statement =&lt;br /&gt;
&lt;br /&gt;
Despite an amazing set of functionality Expertiza offers, there are numerous parts of it that could use a more stylish look and an improved user experience. The goal of this project is to use both Bootstrap and AngularJS to improve the look of the entire Expertiza including the representations of buttons, tables, and other elements. Certain changes in design will also improve the efficiency of the web app when it comes to the amount of time it takes for a page to be loaded.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=='''Explanation of Tasks'''==&lt;br /&gt;
&lt;br /&gt;
Explanation to the task listed in the decription decumentation:&lt;br /&gt;
Updrading all buttons to Bootstrap (http://angular-ui.github.io/bootstrap/)&lt;br /&gt;
	No explanation needed&lt;br /&gt;
Creation of new theme which locks menu on the top for easy navigation.&lt;br /&gt;
	Example: https://www.virginamerica.com/&lt;br /&gt;
	When the page scrolls down, the menu is fixed on the top&lt;br /&gt;
&lt;br /&gt;
Auto hides contents on the dashboard for instructors. Updating action buttons with a responsive layout.&lt;br /&gt;
Now, when trying to open manage-courses, all records are loaded before rendering them onto the page, which takes too long time to load and is not responsive at all.&lt;br /&gt;
Better practice is on Virgin American’s website: https://www.virginamerica.com/book/rt/a1/sfo_bos/20150401_20150402&lt;br /&gt;
When the website is representing the calendar, the price for each day is not actually loaded. But the skeleton of the page, which is the calendar in this case, can be displayed first.&lt;br /&gt;
&lt;br /&gt;
So in Expertiza, we can create several buttons for course semesters in the page. After clicking on Fall 2014, the courses for Fall 2014 will come out. And if it is still too long and takes a long time load, we can use a ‘show more’ button ,or automatically load more data when the scroll bar reaching the end of the page, to minimize the content we need to load after one single mouse click. &lt;br /&gt;
&lt;br /&gt;
We will need to reduce the number of buttons. For example, the first row are actions for assignments. The second row is for participant...So we can change it to 5 buttons with responsive design, that is, no redirection after clicking on the buttons.&lt;br /&gt;
Better UI to add users to expertiza, search a user, change it roles.&lt;br /&gt;
Same as task 3, we will need to make it responsive. Also, when clicking on the letter A-Z, no redirections should happen and only the form content should be replaced rather than the whole page.&lt;br /&gt;
Upgrading gradesheet (grades_view) and review mapping something which webassign uses. &lt;br /&gt;
	After clicking on ‘Your scores’, all reviews are loaded before rendering the page now.&lt;br /&gt;
	That takes a long time to load and the length of review list is too long.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
View student score to be updated to show review on clicks rather than one below another.&lt;br /&gt;
	Same as task 5&lt;br /&gt;
Better score table using bootstrap.&lt;br /&gt;
No need to explain&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Login Page'''==&lt;br /&gt;
[[File:Picture1.png]]&lt;br /&gt;
&lt;br /&gt;
=='''Manage-Course page'''==&lt;br /&gt;
[[File:Picture2.png]]&lt;br /&gt;
&lt;br /&gt;
=='''Manage-User page'''==&lt;/div&gt;</summary>
		<author><name>Pdeng</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015_E1526_MPRI&amp;diff=96338</id>
		<title>CSC/ECE 517 Spring 2015 E1526 MPRI</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015_E1526_MPRI&amp;diff=96338"/>
		<updated>2015-04-01T02:50:49Z</updated>

		<summary type="html">&lt;p&gt;Pdeng: /* Login Page */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''E1526. Responsive web design for Expertiza '''&lt;br /&gt;
&lt;br /&gt;
'''Introduction to Expertiza'''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is a large project developed as a combined effort of students and faculty using the [http://rubyonrails.org/ Ruby on Rails] framework. The main advantage of using Expertiza, in an educational environment, is for the instructor to introduce peer reviewing among the students. Expertiza allows the instructor to create and customize assignments, create a list of topics the students can sign up for, have students work on teams and then review each other's assignments at the end. Expertiza supports submission of almost any document type, including the URLs and wiki pages.&lt;br /&gt;
&lt;br /&gt;
Expertiza is supported by National Science Foundation under Grant No. 0536558. Additional funding from the [http://www.ncsu.edu/ NCSU] [http://litre.ncsu.edu/ Learning in a Technology-Rich Environment] (LITRE) program, the NCSU [http://ofd.ncsu.edu/teaching-learning/ Faculty Center for Teaching and Learning], the NCSU [http://stem.ncsu.edu/ STEM] Initiative, and the Center for Advanced Computing and Communication.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
= Problem Statement =&lt;br /&gt;
&lt;br /&gt;
Despite an amazing set of functionality Expertiza offers, there are numerous parts of it that could use a more stylish look and an improved user experience. The goal of this project is to use both Bootstrap and AngularJS to improve the look of the entire Expertiza including the representations of buttons, tables, and other elements. Certain changes in design will also improve the efficiency of the web app when it comes to the amount of time it takes for a page to be loaded.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=='''Explanation of Tasks'''==&lt;br /&gt;
&lt;br /&gt;
Explanation to the task listed in the decription decumentation:&lt;br /&gt;
Updrading all buttons to Bootstrap (http://angular-ui.github.io/bootstrap/)&lt;br /&gt;
	No explanation needed&lt;br /&gt;
Creation of new theme which locks menu on the top for easy navigation.&lt;br /&gt;
	Example: https://www.virginamerica.com/&lt;br /&gt;
	When the page scrolls down, the menu is fixed on the top&lt;br /&gt;
&lt;br /&gt;
Auto hides contents on the dashboard for instructors. Updating action buttons with a responsive layout.&lt;br /&gt;
Now, when trying to open manage-courses, all records are loaded before rendering them onto the page, which takes too long time to load and is not responsive at all.&lt;br /&gt;
Better practice is on Virgin American’s website: https://www.virginamerica.com/book/rt/a1/sfo_bos/20150401_20150402&lt;br /&gt;
When the website is representing the calendar, the price for each day is not actually loaded. But the skeleton of the page, which is the calendar in this case, can be displayed first.&lt;br /&gt;
&lt;br /&gt;
So in Expertiza, we can create several buttons for course semesters in the page. After clicking on Fall 2014, the courses for Fall 2014 will come out. And if it is still too long and takes a long time load, we can use a ‘show more’ button ,or automatically load more data when the scroll bar reaching the end of the page, to minimize the content we need to load after one single mouse click. &lt;br /&gt;
&lt;br /&gt;
We will need to reduce the number of buttons. For example, the first row are actions for assignments. The second row is for participant...So we can change it to 5 buttons with responsive design, that is, no redirection after clicking on the buttons.&lt;br /&gt;
Better UI to add users to expertiza, search a user, change it roles.&lt;br /&gt;
Same as task 3, we will need to make it responsive. Also, when clicking on the letter A-Z, no redirections should happen and only the form content should be replaced rather than the whole page.&lt;br /&gt;
Upgrading gradesheet (grades_view) and review mapping something which webassign uses. &lt;br /&gt;
	After clicking on ‘Your scores’, all reviews are loaded before rendering the page now.&lt;br /&gt;
	That takes a long time to load and the length of review list is too long.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
View student score to be updated to show review on clicks rather than one below another.&lt;br /&gt;
	Same as task 5&lt;br /&gt;
Better score table using bootstrap.&lt;br /&gt;
No need to explain&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Login Page'''==&lt;br /&gt;
[[File:Picture1.png]]&lt;br /&gt;
&lt;br /&gt;
=='''Manage-Course page'''==&lt;br /&gt;
&lt;br /&gt;
=='''Manage-User page'''==&lt;/div&gt;</summary>
		<author><name>Pdeng</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Picture8.png&amp;diff=96337</id>
		<title>File:Picture8.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Picture8.png&amp;diff=96337"/>
		<updated>2015-04-01T02:49:39Z</updated>

		<summary type="html">&lt;p&gt;Pdeng: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Pdeng</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Picture7.png&amp;diff=96336</id>
		<title>File:Picture7.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Picture7.png&amp;diff=96336"/>
		<updated>2015-04-01T02:49:24Z</updated>

		<summary type="html">&lt;p&gt;Pdeng: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Pdeng</name></author>
	</entry>
</feed>