Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

- Secured School Reports

- Fixed bug between CanCan and datatables-jquery
- Fixed email bug
  • Loading branch information...
commit 236b3855b1be9f714ddf59113266b55107550d2d 1 parent e733d58
@AhmerArif authored
View
11 Gemfile.lock
@@ -1,10 +1,3 @@
-GIT
- remote: git@github.com:kclair/jquery-datatables-rails.git
- revision: e87633f62c1aa63ad46fde804e22c9b6c62bcace
- specs:
- jquery-datatables-rails (0.1.0)
- railties (~> 3.0)
-
GEM
remote: https://rubygems.org/
specs:
@@ -76,6 +69,8 @@ GEM
hike (1.2.1)
i18n (0.6.0)
journey (1.0.3)
+ jquery-datatables-rails (0.1.0)
+ jquery-rails
jquery-rails (2.0.1)
railties (>= 3.2.0, < 5.0)
thor (~> 0.14)
@@ -173,7 +168,7 @@ DEPENDENCIES
gmaps4rails
google_visualr (= 2.1.2)
high_voltage
- jquery-datatables-rails!
+ jquery-datatables-rails
jquery-rails
mysql2
paperclip
View
4 app/controllers/clusters_controller.rb
@@ -13,9 +13,9 @@ def school_report
end
unless @cluster.nil?
- authorize! :view_school_reports, @cluster
- @schools = @cluster.schools_with_statistics(@start_time,@end_time,@cluster.schools.order("school_name ASC"))
@district = @cluster.district
+ authorize! :view_school_reports, @district
+ @schools = @cluster.schools_with_statistics(@start_time,@end_time,@cluster.schools.order("school_name ASC"))
@assessment_indicators = Assessment.indicators([@cluster.assessment_statistics(@start_time,@end_time,@schools),@district.assessment_statistics((@start_time),(@end_time))])
@mentoring_indicators = Mentoring.indicators([@district.mentoring_statistics(@start_time,@end_time,@clusters),@district.mentoring_statistics((@start_time),(@end_time))])
View
2  app/controllers/districts_controller.rb
@@ -23,7 +23,7 @@ def compliance_report
end
unless @district.nil?
- authorize! :view_compliance_reports, @district
+ authorize! :view_school_reports, @district
@visitors = @district.visitors
@temp_expectation_visits = 7
@temp_expectation_pd = 1
View
9 app/controllers/schools_controller.rb
@@ -12,16 +12,17 @@ def show
end
unless @school.nil?
- authorize! :view_school_reports, @school
+
+ @district = @school.district
+ @cluster = @school.cluster
+
+ authorize! :view_school_reports, @district
@school_assessment_averages = @school.assessment_statistics(@start_time, @end_time)[0]
@school_mentoring_averages = @school.mentoring_statistics(@start_time, @end_time)[0]
- puts @school_mentoring_averages.to_yaml
@latest_assessment = @school.assessments.order("start_time DESC").first.try(:detail)
@latest_mentoring = @school.mentorings.order("start_time DESC").first.try(:detail)
- @district = @school.district
- @cluster = @school.cluster
@assessment_indicators_by_month = Assessment.indicators([@school.assessment_statistics,@cluster.assessment_statistics])
@mentoring_indicators_by_month = Mentoring.indicators([@school.mentoring_statistics,@cluster.mentoring_statistics])
View
4 app/controllers/users/registrations_controller.rb
@@ -17,10 +17,6 @@ def new
# POST /resource - overriding devise
def create
- if params[:user][:email].blank?
- params[:user][:email] = "no.account@pmiu.gov"
- end
-
build_resource
if resource.save
View
8 app/controllers/users_controller.rb
@@ -28,7 +28,7 @@ def edit
def disable_account
@user.disable
- flash[:warning] = "#{@user.email} has been disabled."
+ flash[:warning] = "#{@user.username} has been disabled."
respond_to do |format|
format.json { render :json => @user }
format.xml { render :xml => @user }
@@ -40,7 +40,7 @@ def disable_account
def enable_account
@user.enable
- flash[:warning] = "#{@user.email} has been enabled."
+ flash[:warning] = "#{@user.username} has been enabled."
respond_to do |format|
format.json { render :json => @user }
format.xml { render :xml => @user }
@@ -63,10 +63,6 @@ def update
params[:user][:role_ids] = params[:user][:role_ids] + [Role.where(:name=>"Super Administrator").first.id]
end
- if params[:user][:email].blank?
- params[:user][:email] = "no.account@dsd.gov"
- end
-
respond_to do |format|
if @user.errors[:base].empty? and @user.update_attributes(params[:user])
flash[:notice] = "Your account has been updated"
View
2  app/models/ability.rb
@@ -32,7 +32,7 @@ def initialize(user)
if user.role? "District Manager"
can :view_compliance_reports, District, :id => user.district_ids
- can :view_school_reports, :all
+ can :view_school_reports, District, :id => user.district_ids
end
end
View
4 app/models/user.rb
@@ -9,7 +9,9 @@ class User < ActiveRecord::Base
# Setup accessible (or protected) attributes for your model
attr_accessible :username,:email, :password, :password_confirmation, :remember_me, :district_ids, :name, :district_id, :role_ids
validates :username, :length => { :minimum => 4, :message => "Must be at least 4 letters long." }
-
+ def email_required?
+ false
+ end
#this method is called by devise to check for "active" state of the model
def active_for_authentication?
View
2  app/views/clusters/_cluster_assessments_table.html.erb
@@ -40,9 +40,7 @@
<td class = "center">
<%= school.tasks_identified_average %>
</td>
- <% if can? :view_school_reports, school %>
<td class = "center"><%= link_to "View Details", school_path(school), :class => 'btn' %></td>
- <% end %>
</div>
</tr>
<% end %>
View
2  app/views/clusters/_cluster_mentorings_table.html.erb
@@ -47,9 +47,7 @@
<td class="center">
<%= school.report_cards_issued_average ? school.report_cards_issued_average.to_s.concat('%') : nil %>
</td>
- <% if can? :view_school_reports, school %>
<td><%= link_to "View Details", school_path(school), :class => 'btn' %> </td>
- <% end %>
</tr>
<% end %>
</tbody>
View
2  app/views/districts/_district_assessments_table.html.erb
@@ -40,9 +40,7 @@
<td class = "center">
<%= cluster.tasks_identified_average %>
</td>
- <% if can? :view_school_reports, cluster %>
<td class = "center"><%= link_to "View Details", school_report_cluster_path(cluster), :class => 'btn' %></td>
- <% end %>
</div>
</tr>
<% end %>
View
2  app/views/districts/_district_mentorings_table.html.erb
@@ -47,9 +47,7 @@
<td class="center">
<%= cluster.report_cards_issued_average ? cluster.report_cards_issued_average.to_s.concat('%') : nil %>
</td>
- <% if can? :view_school_reports, cluster %>
<td><%= link_to "View Details", school_report_cluster_path(cluster), :class => 'btn' %> </td>
- <% end %>
</tr>
<% end %>
</tbody>
View
4 app/views/districts/_districts_activities_table.html.erb
@@ -29,9 +29,11 @@
<td class="center"><%= district.mentorings.where(:start_time=>(@start_time..@end_time.end_of_day)).count%> </td>
<td class="center"><%= district.pd_psts.where(:start_time=>(@start_time..@end_time.end_of_day)).count%> </td>
<td class="center"><%= district.pd_dtes.where(:start_time=>(@start_time..@end_time.end_of_day)).count%> </td>
+ <td class="center">
<% if can? :view_compliance_reports, district %>
- <td class="center"><%= link_to "View Details", compliance_report_district_path(district), :class => 'btn' %> </td>
+ <%= link_to "View Details", compliance_report_district_path(district), :class => 'btn' %>
<% end %>
+ </td>
</tr>
<% end %>
</tbody>
View
4 app/views/districts/_overall_assessments_table.html.erb
@@ -36,9 +36,11 @@
<td class="center">
<%= district.tasks_identified_average %>
</td>
+ <td class="center">
<% if can? :view_school_reports, district %>
- <td class="center"><%= link_to "View Details", school_report_district_path(district), :class => 'btn' %> </td>
+ <%= link_to "View Details", school_report_district_path(district), :class => 'btn' %>
<% end %>
+ </td>
</tr>
<% end %>
</tbody>
View
4 app/views/districts/_overall_mentorings_table.html.erb
@@ -47,9 +47,11 @@
<td class="center">
<%= district.report_cards_issued_average.to_s.concat('%') %>
</td>
+ <td class="center">
<% if can? :view_school_reports, district %>
- <td class="center"><%= link_to "View Details", school_report_district_path(district), :class => 'btn' %> </td>
+ <%= link_to "View Details", school_report_district_path(district), :class => 'btn' %>
<% end %>
+ </td>
</tr>
<% end %>
</tbody>
View
2  app/views/layouts/application.html.erb
@@ -110,7 +110,7 @@
</li>
<% end %>
- <li> <%= link_to "Logout ("+current_user.email+")", destroy_user_session_path, :method => :delete %> </li>
+ <li> <%= link_to "Logout ("+current_user.username+")", destroy_user_session_path, :method => :delete %> </li>
<% else %>
<li><%= link_to "Not signed in?", new_user_session_path, :method => :get %></li>
<% end %>
Please sign in to comment.
Something went wrong with that request. Please try again.