changed the way to display city and stuff
This commit is contained in:
parent
c3f317e282
commit
a35db2bd35
|
@ -4,10 +4,24 @@ class MemberCounselorsController < CUserController
|
|||
|
||||
def index
|
||||
idx = 0
|
||||
params = OrbitHelper.params
|
||||
pcity = nil
|
||||
page = Page.where(:page_id => params[:page_id]).first
|
||||
cities = HpsCity.all.collect do |city|
|
||||
total = 0
|
||||
total = city.hps_files.count
|
||||
pcity = city if idx == 0
|
||||
idx = idx + 1
|
||||
schools = city.hps_schools.collect do |school|
|
||||
{
|
||||
"name" => city.name,
|
||||
"total" => total,
|
||||
"url" => "/" + I18n.locale.to_s + page.url + "?city_id=#{city.id.to_s}"
|
||||
}
|
||||
end
|
||||
if params[:city_id].present?
|
||||
pcity = HpsCity.find(params[:city_id])
|
||||
end
|
||||
total = 0
|
||||
schools = pcity.hps_schools.collect do |school|
|
||||
members = HpsMember.where(:hps_school_id => school.id.to_s).pluck(:id)
|
||||
count = HpsFile.where(:hps_member_id.in => members).count
|
||||
total = count + total
|
||||
|
@ -17,15 +31,9 @@ class MemberCounselorsController < CUserController
|
|||
"count" => count
|
||||
}
|
||||
end
|
||||
{
|
||||
"name" => city.name,
|
||||
"total" => total,
|
||||
"id" => "tab#{idx}",
|
||||
"schools" => schools
|
||||
}
|
||||
end
|
||||
{
|
||||
"cities" => cities,
|
||||
"schools" => schools,
|
||||
"extras" => {}
|
||||
}
|
||||
end
|
||||
|
@ -104,6 +112,8 @@ class MemberCounselorsController < CUserController
|
|||
def file_upload
|
||||
hpsfile = HpsFile.new(hps_file_params)
|
||||
hpsfile.hps_member = current_counselor_user
|
||||
city = HpsCity.find(current_counselor_user.hps_city_id)
|
||||
hpsfile.hps_city = city
|
||||
hpsfile.save
|
||||
redirect_to member_dash_path(current_counselor_user.account)
|
||||
end
|
||||
|
|
|
@ -49,7 +49,10 @@
|
|||
</tr>
|
||||
<tr>
|
||||
<th> </th>
|
||||
<td><%= f.submit "Submit", :class => "btn btn-primary" %><a href="<%= member_dash_path(current_counselor_user.account) %>" class="btn btn-default">Back</a></td>
|
||||
<td>
|
||||
<%= f.submit "Submit", :class => "btn btn-primary" %>
|
||||
<a href="<%= member_dash_path(current_counselor_user.account) %>" class="btn btn-default">Back</a>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
|
|
Loading…
Reference in New Issue