Add link_to_edit for frontend
This commit is contained in:
parent
951be509e5
commit
f45ea12490
|
@ -58,7 +58,7 @@ class Admin::FaqsController < OrbitAdminController
|
||||||
@qa.create_user_id = current_user.id
|
@qa.create_user_id = current_user.id
|
||||||
@qa.update_user_id = current_user.id
|
@qa.update_user_id = current_user.id
|
||||||
@qa.save
|
@qa.save
|
||||||
redirect_to admin_faqs_path
|
redirect_to params['referer_url']
|
||||||
end
|
end
|
||||||
|
|
||||||
def edit
|
def edit
|
||||||
|
@ -76,7 +76,7 @@ class Admin::FaqsController < OrbitAdminController
|
||||||
@qa.update_attributes(create_params)
|
@qa.update_attributes(create_params)
|
||||||
@qa.update_user_id = current_user.id
|
@qa.update_user_id = current_user.id
|
||||||
@qa.save
|
@qa.save
|
||||||
redirect_to admin_faqs_path
|
redirect_to params['referer_url']
|
||||||
end
|
end
|
||||||
|
|
||||||
def destroy
|
def destroy
|
||||||
|
|
|
@ -24,6 +24,9 @@ class FaqsController < ApplicationController
|
||||||
def show
|
def show
|
||||||
params = OrbitHelper.params
|
params = OrbitHelper.params
|
||||||
faq = Qa.can_display.find_by_param(params[:uid])
|
faq = Qa.can_display.find_by_param(params[:uid])
|
||||||
|
|
||||||
|
url_to_edit = OrbitHelper.user_can_edit?(faq) ? "/admin/faqs/#{faq.id.to_s}/edit" : ""
|
||||||
|
|
||||||
faqs_files = faq.qa_files.collect do |f|
|
faqs_files = faq.qa_files.collect do |f|
|
||||||
{
|
{
|
||||||
"file_url" => f.file.url,
|
"file_url" => f.file.url,
|
||||||
|
@ -41,7 +44,8 @@ class FaqsController < ApplicationController
|
||||||
"extras" => {"question" => faq.title,"answer" => faq.answer},
|
"extras" => {"question" => faq.title,"answer" => faq.answer},
|
||||||
"faqs_links" => faqs_links,
|
"faqs_links" => faqs_links,
|
||||||
"faqs_files" => faqs_files,
|
"faqs_files" => faqs_files,
|
||||||
"tags" => tags
|
"tags" => tags,
|
||||||
|
"url_to_edit" => url_to_edit
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -170,9 +170,8 @@
|
||||||
</div>
|
</div>
|
||||||
<!-- Form Actions -->
|
<!-- Form Actions -->
|
||||||
<div class="form-actions">
|
<div class="form-actions">
|
||||||
|
<input type="hidden" name="referer_url" value="<%= request.referer %>">
|
||||||
<%= f.submit t('submit'), class: 'btn btn-primary' %>
|
<%= f.submit t('submit'), class: 'btn btn-primary' %>
|
||||||
<%#= button_tag t("preview"), id: "button_for_preview", name: "commit", class: 'btn post_preview', type: :button, url: preview_panel_announcement_back_end_bulletins_path %>
|
|
||||||
<%#= link_to t('cancel'), get_go_back, :class=>"btn" %>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
|
Loading…
Reference in New Issue