change to idiomatic use of layouts versus regular views

no functional change here, but familiar Rails users will see view files in the
locations they expect. this also slightly simplifies controller code

there is one attendant change in the wiki at `rails_3/A1-SQL-Injection-Interpolation.md`
that I'm happy to make after the PR is merged.
This commit is contained in:
Joseph Mastey
2017-09-27 19:22:44 -05:00
parent b7db890f51
commit d3fce41e60
10 changed files with 6 additions and 7 deletions
+2 -3
View File
@@ -17,19 +17,18 @@ class AdminController < ApplicationController
else else
@analytics = Analytics.all @analytics = Analytics.all
end end
render "layouts/admin/_analytics"
end end
def get_all_users def get_all_users
@users = User.all @users = User.all
render :partial => "layouts/admin/get_all_users" render layout: false
end end
def get_user def get_user
@user = User.find_by_id(params[:admin_id].to_s) @user = User.find_by_id(params[:admin_id].to_s)
arr = ["true", "false"] arr = ["true", "false"]
@admin_select = @user.admin ? arr : arr.reverse @admin_select = @user.admin ? arr : arr.reverse
render :partial => "layouts/admin/get_user" render layout: false
end end
def update_user def update_user
+2 -2
View File
@@ -15,12 +15,12 @@ class DashboardController < ApplicationController
end end
def bar_graph def bar_graph
render :partial => "layouts/dashboard/bar_graph" render :bar_graph, layout: false
end end
def pie_charts def pie_charts
@user = current_user @user = current_user
render :partial => "layouts/dashboard/dashboard_stats" render :dashboard_stats, layout: false
end end
end end
+1 -1
View File
@@ -3,7 +3,7 @@ class TutorialsController < ApplicationController
skip_before_action :authenticated skip_before_action :authenticated
def credentials def credentials
render :partial => "layouts/tutorial/credentials/creds" render layout: false
end end
end end
+1 -1
View File
@@ -21,7 +21,7 @@
<!-- End Title Buttons--> <!-- End Title Buttons-->
</div> </div>
<div id="charts_body" class="widget-body"> <div id="charts_body" class="widget-body">
<%#= render :partial => "layouts/dashboard/dashboard_stats"%> <%#= render partial: "dashboard_stats" %>
</div> </div>
<div class="clearfix"> <div class="clearfix">
</div> </div>