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