CSC/ECE 517 Fall 2015/oss E1565 AAJ: Difference between revisions
Jump to navigation
Jump to search
Line 53: | Line 53: | ||
| Added this method to Admin Controller. | | Added this method to Admin Controller. | ||
| This method helps in destroying a super_admin. | | This method helps in destroying a super_admin. | ||
|} | |||
=== Institution Controller === | |||
{| class="wikitable" | |||
|- | |||
! style="width:13%;"|Method Name | |||
! style="width:33%;"|Changes Made | |||
! style="width:43%;"|Reason For Change | |||
|- style="vertical-align:top;" | |||
| create | |||
| Changed line @institution = Institution.new(params[:institution]) to @institution = Institution.new(:name => params[:institution][:name]) | |||
| Was throwing error | |||
|} | |||
===User Controller=== | |||
{| class="wikitable" | |||
|- | |||
! style="width:13%;"|Method Name | |||
! style="width:33%;"|Changes Made | |||
! style="width:43%;"|Reason For Change | |||
|- style="vertical-align:top;" | |||
| create | |||
| Added the line @user.institutions_id=params[:users][:institutions_id] | |||
| To include institution for newly created users | |||
|- | |||
| user_params | |||
| Added the parameter institutions ID. | |||
| To include institution for newly created users. | |||
|} | |} | ||
===Views=== | ===Views=== | ||
Line 61: | Line 88: | ||
! style="width:43%;"|Reason For Change | ! style="width:43%;"|Reason For Change | ||
|- style="vertical-align:top;" | |- style="vertical-align:top;" | ||
| list_administrators.html.erb | | views/admin/list_administrators.html.erb | ||
| Removed the text field next to New Administrator button | | Removed the text field next to New Administrator button | ||
| The button redirects to a new user page and passes a hidden field with role:administrator | | The button redirects to a new user page and passes a hidden field with role:administrator | ||
|- | |- | ||
| list_administrators.html.erb | | views/admin/list_administrators.html.erb | ||
| Changed line 7 to <%= link_to user.name, :action => 'show_admin',:id => user.id %> | | Changed line 7 to <%= link_to user.name, :action => 'show_admin',:id => user.id %> | ||
| There is no show method in Admin Controller | | There is no show method in Admin Controller | ||
|- | |- | ||
| list_instructors.html.erb | | views/admin/list_instructors.html.erb | ||
| Removed the text field next to New Instructor button | | Removed the text field next to New Instructor button | ||
| The button redirects to a new user page and passes a hidden field with role:Instructor | | The button redirects to a new user page and passes a hidden field with role:Instructor | ||
|- | |- | ||
| list_super_administrators.html.erb | | views/admin/list_super_administrators.html.erb | ||
| Changed line 7 to <%= link_to user.name, :action => 'show_super_admin',:id => user.id %> | | Changed line 7 to <%= link_to user.name, :action => 'show_super_admin',:id => user.id %> | ||
| There is no show method in Admin Controller. | | There is no show method in Admin Controller. | ||
|- | |- | ||
| list_super_administrators.html.erb | | views/admin/list_super_administrators.html.erb | ||
| Removed the Parent column from line 4 | | Removed the Parent column from line 4 | ||
| Super admins don't have any parents. | | Super admins don't have any parents. | ||
|- | |- | ||
| list_super_administrators.html.erb | | views/admin/list_super_administrators.html.erb | ||
| Removed <%= link_to 'New Super administrator', :action => 'new' %> | | Removed <%= link_to 'New Super administrator', :action => 'new' %> | ||
| There can be only one super admin. | | There can be only one super admin. | ||
|- | |- | ||
| show_admin.html.erb | | views/admin/show_admin.html.erb | ||
| Added this file. | | Added this file. | ||
| show_admin lists out all the administrator. | | show_admin lists out all the administrator. | ||
|- | |- | ||
| show_super_admin.html.erb | | views/admin/show_super_admin.html.erb | ||
| Added this file. | | Added this file. | ||
| Lists out the super administrator. | | Lists out the super administrator. | ||
Line 108: | Line 135: | ||
| Default role is selected in new user creation form. | | Default role is selected in new user creation form. | ||
| So that if new administrator is clicked the user creation form will have admin as the pre selected role. | | So that if new administrator is clicked the user creation form will have admin as the pre selected role. | ||
|} | |} |
Revision as of 01:49, 1 November 2015
E1565: Refactoring Admin Controller and Course Controller
This page provides a description of the Expertiza based OSS project aimed at refactoring Admin Controller and Course Controller.
In order to run our code visit the link 152.46.16.123:3000 and use the following credentials - username: admin, password: admin.
Introduction to Expertiza
Expertiza is a web 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.
Problem Statement
Files involved
admin_controller.rb views in app/views/admin folder user_controller
What they do:
The admin controller defines the changes that can be done on other types of users by super-admin and provides the view accordingly.
What needs to be done:
- The text field for adding a new admin/instructor has to be removed, leaving only the button.
- When the button is clicked, it should be redirected to new user creation view making the role (super-admin, admin or instructor) selected as default.
- Make sure that user creation works for super-admin/admin/instructor.
- Associate the users with the institution table
- Add a drop down to the view of creating users so that new account creator can select the institute and save it.
Changes Made
Admin Controller
Method Name | Changes Made | Reason For Change |
---|---|---|
show_super_admin | Added this method to controller | This method helps in displaying the specified super_admin |
show_admin | Added this method to Admin Controller | This method helps in displaying the specified admin |
remove_instructor | Added this method to Admin Controller | This method helps in destroying an instructor. |
remove_administrator | Added this method to Admin Controller | This method helps in destroying an administrator. |
remove_super_administrator | Added this method to Admin Controller. | This method helps in destroying a super_admin. |
Institution Controller
Method Name | Changes Made | Reason For Change |
---|---|---|
create | Changed line @institution = Institution.new(params[:institution]) to @institution = Institution.new(:name => params[:institution][:name]) | Was throwing error |
User Controller
Method Name | Changes Made | Reason For Change |
---|---|---|
create | Added the line @user.institutions_id=params[:users][:institutions_id] | To include institution for newly created users |
user_params | Added the parameter institutions ID. | To include institution for newly created users. |
Views
Method Name | Changes Made | Reason For Change |
---|---|---|
views/admin/list_administrators.html.erb | Removed the text field next to New Administrator button | The button redirects to a new user page and passes a hidden field with role:administrator |
views/admin/list_administrators.html.erb | Changed line 7 to <%= link_to user.name, :action => 'show_admin',:id => user.id %> | There is no show method in Admin Controller |
views/admin/list_instructors.html.erb | Removed the text field next to New Instructor button | The button redirects to a new user page and passes a hidden field with role:Instructor |
views/admin/list_super_administrators.html.erb | Changed line 7 to <%= link_to user.name, :action => 'show_super_admin',:id => user.id %> | There is no show method in Admin Controller. |
views/admin/list_super_administrators.html.erb | Removed the Parent column from line 4 | Super admins don't have any parents. |
views/admin/list_super_administrators.html.erb | Removed <%= link_to 'New Super administrator', :action => 'new' %> | There can be only one super admin. |
views/admin/show_admin.html.erb | Added this file. | show_admin lists out all the administrator. |
views/admin/show_super_admin.html.erb | Added this file. | Lists out the super administrator. |
views/users/_institutions.html.erb | Added this file | To add institution drop down menu in the new user creation form. |
views/users/_user.html.erb | Added line <%= render :partial => 'users/institutions' %> | To select the institution. |
views/users/list.html.erb | Sending role:student as the default role for new user creation form | Was throwing an error |
views/users/new.html | Default role is selected in new user creation form. | So that if new administrator is clicked the user creation form will have admin as the pre selected role. |