fix for conference without name
This commit is contained in:
parent
b10d4153a1
commit
8f464a960d
|
@ -1,6 +1,7 @@
|
|||
class Admin::WritingConferencesController < OrbitMemberController
|
||||
layout "member_plugin"
|
||||
|
||||
before_action :set_writing_conference, only: [:show, :edit , :update, :destroy]
|
||||
before_action :set_plugin
|
||||
before_action :get_settings,:only => [:new, :edit, :setting]
|
||||
|
||||
|
@ -24,20 +25,17 @@ class Admin::WritingConferencesController < OrbitMemberController
|
|||
end
|
||||
|
||||
def edit
|
||||
@writing_conference = WritingConference.find(params[:id])
|
||||
@member = @writing_conference.member_profile
|
||||
end
|
||||
|
||||
def update
|
||||
@member = MemberProfile.find(conference_params['member_profile_id']) rescue nil
|
||||
@writing_conference = WritingConference.find(params[:id])
|
||||
@member = @writing_conference.member_profile
|
||||
@writing_conference.update_attributes(conference_params)
|
||||
@writing_conference.save
|
||||
redirect_to params['referer_url']
|
||||
end
|
||||
|
||||
def destroy
|
||||
@writing_conference = WritingConference.find(params[:id])
|
||||
@writing_conference.destroy
|
||||
end
|
||||
|
||||
|
@ -84,6 +82,18 @@ class Admin::WritingConferencesController < OrbitMemberController
|
|||
|
||||
private
|
||||
|
||||
def set_writing_conference
|
||||
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
|
||||
@writing_conference = WritingConference.find_by(:uid => uid) rescue WritingConference.find(params[:id])
|
||||
end
|
||||
|
||||
def conference_params
|
||||
params.require(:writing_conference).permit! rescue nil
|
||||
end
|
||||
|
|
|
@ -10,6 +10,6 @@
|
|||
</ul>
|
||||
</div>
|
||||
</td>
|
||||
<td><%= writing_conference.member_profile.name %></td>
|
||||
<td><%= writing_conference.member_profile.name rescue "" %></td>
|
||||
</tr>
|
||||
<% end %>
|
Loading…
Reference in New Issue