fix for experience without name
This commit is contained in:
parent
8aa42bd5a1
commit
3ee52f175e
|
@ -1,6 +1,7 @@
|
||||||
class Admin::ExperiencesController < OrbitMemberController
|
class Admin::ExperiencesController < OrbitMemberController
|
||||||
layout "member_plugin"
|
layout "member_plugin"
|
||||||
|
|
||||||
|
before_action :set_experience, only: [:show, :edit , :update, :destroy]
|
||||||
before_action :set_plugin
|
before_action :set_plugin
|
||||||
before_action :get_settings,:only => [:new, :edit, :setting]
|
before_action :get_settings,:only => [:new, :edit, :setting]
|
||||||
|
|
||||||
|
@ -24,20 +25,17 @@ class Admin::ExperiencesController < OrbitMemberController
|
||||||
end
|
end
|
||||||
|
|
||||||
def edit
|
def edit
|
||||||
@member = MemberProfile.find_by(:uid=>params['uid']) rescue nil
|
@member = @experience.member_profile rescue nil
|
||||||
@experience = Experience.find(params[:id])
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def update
|
def update
|
||||||
@member = MemberProfile.find(experience_params['member_profile_id']) rescue nil
|
@member = @experience.member_profile rescue nil
|
||||||
@experience = Experience.find(params[:id])
|
|
||||||
@experience.update_attributes(experience_params)
|
@experience.update_attributes(experience_params)
|
||||||
@experience.save
|
@experience.save
|
||||||
redirect_to params['referer_url']
|
redirect_to params['referer_url']
|
||||||
end
|
end
|
||||||
|
|
||||||
def destroy
|
def destroy
|
||||||
@experience = Experience.find(params[:id])
|
|
||||||
@experience.destroy
|
@experience.destroy
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -82,6 +80,18 @@ class Admin::ExperiencesController < OrbitMemberController
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
|
def set_experience
|
||||||
|
path = request.path.split('/')
|
||||||
|
if path.last.include? '-'
|
||||||
|
uid = path[-1].split("-").last
|
||||||
|
uid = uid.split("?").first
|
||||||
|
else
|
||||||
|
uid = path[-2].split("-").last
|
||||||
|
uid = uid.split("?").first
|
||||||
|
end
|
||||||
|
@experience = Experience.find_by(:uid => uid) rescue Experience.find("53c4fd3548345219f04c0000")
|
||||||
|
end
|
||||||
|
|
||||||
def experience_params
|
def experience_params
|
||||||
params.require(:experience).permit! rescue nil
|
params.require(:experience).permit! rescue nil
|
||||||
end
|
end
|
||||||
|
|
|
@ -5,8 +5,8 @@
|
||||||
<%= link_to experience.organizationt_title, OrbitHelper.url_to_plugin_show(experience.to_param,'personal_experience'), target: "blank"%>
|
<%= link_to experience.organizationt_title, OrbitHelper.url_to_plugin_show(experience.to_param,'personal_experience'), target: "blank"%>
|
||||||
<div class="quick-edit">
|
<div class="quick-edit">
|
||||||
<ul class="nav nav-pills hide">
|
<ul class="nav nav-pills hide">
|
||||||
<li><%= link_to t('edit'), '/admin/members/'+experience.member_profile.to_param+'/experiences/'+experience.id+'/edit' %></li>
|
<li><%= link_to t('edit'), edit_admin_experience_path(experience) %></li>
|
||||||
<li><%= link_to t(:delete_), admin_experience_path(id: experience.id, member_profile_id: experience.member_profile.id), method: :delete, remote: true, data: { confirm: t('sure?') } %></li>
|
<li><%= link_to t(:delete_), admin_experience_path(id: experience.id), method: :delete, remote: true, data: { confirm: 'Are you sure?' } %></li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
|
|
Loading…
Reference in New Issue