Add link_to_edit for frontend
This commit is contained in:
parent
9fc4bffff3
commit
8467dd3189
|
@ -41,7 +41,7 @@ class Admin::AnnouncementsController < OrbitAdminController
|
||||||
bulletin.update_user_id = current_user.id
|
bulletin.update_user_id = current_user.id
|
||||||
bulletin.save
|
bulletin.save
|
||||||
build_email(bulletin)
|
build_email(bulletin)
|
||||||
redirect_to "/admin/announcements"
|
redirect_to params['referer_url']
|
||||||
end
|
end
|
||||||
|
|
||||||
def edit
|
def edit
|
||||||
|
@ -70,7 +70,7 @@ class Admin::AnnouncementsController < OrbitAdminController
|
||||||
bulletin.update_attributes(bulletin_params)
|
bulletin.update_attributes(bulletin_params)
|
||||||
bulletin.save
|
bulletin.save
|
||||||
build_email(bulletin)
|
build_email(bulletin)
|
||||||
redirect_to "/admin/announcements"
|
redirect_to params['referer_url']
|
||||||
end
|
end
|
||||||
|
|
||||||
def destroy
|
def destroy
|
||||||
|
|
|
@ -60,9 +60,10 @@ class AnnouncementsController < ApplicationController
|
||||||
|
|
||||||
def show
|
def show
|
||||||
params = OrbitHelper.params
|
params = OrbitHelper.params
|
||||||
|
|
||||||
announcement = Bulletin.can_display.find_by(:uid=>params[:uid])
|
announcement = Bulletin.can_display.find_by(:uid=>params[:uid])
|
||||||
|
|
||||||
|
url_to_edit = OrbitHelper.user_can_edit?(announcement) ? "/admin/announcements/#{announcement.id.to_s}/edit" : ""
|
||||||
|
|
||||||
tags = announcement.tags.map{|tag| {
|
tags = announcement.tags.map{|tag| {
|
||||||
"tag" => tag.name ,
|
"tag" => tag.name ,
|
||||||
"url" => OrbitHelper.page_for_tag(tag)
|
"url" => OrbitHelper.page_for_tag(tag)
|
||||||
|
@ -81,7 +82,8 @@ class AnnouncementsController < ApplicationController
|
||||||
"body" =>announcement.text,
|
"body" =>announcement.text,
|
||||||
"image" => announcement.image.url
|
"image" => announcement.image.url
|
||||||
},
|
},
|
||||||
"impressionist" => (announcement.is_preview ? nil : announcement)
|
"impressionist" => (announcement.is_preview ? nil : announcement),
|
||||||
|
"url_to_edit"=>url_to_edit
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -287,6 +287,7 @@
|
||||||
<!-- Form Actions -->
|
<!-- Form Actions -->
|
||||||
<div class="form-actions">
|
<div class="form-actions">
|
||||||
<%= f.submit t('submit'), class: 'btn btn-primary' %>
|
<%= f.submit t('submit'), class: 'btn btn-primary' %>
|
||||||
|
<input type="hidden" name="referer_url" value="<%= request.referer %>">
|
||||||
<%= button_tag t("preview"), id: "button_for_preview", name: "commit", class: 'btn', type: :button %>
|
<%= button_tag t("preview"), id: "button_for_preview", name: "commit", class: 'btn', type: :button %>
|
||||||
<%= link_to t('cancel'), admin_announcements_path, :class=>"btn" %>
|
<%= link_to t('cancel'), admin_announcements_path, :class=>"btn" %>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in New Issue