Page Menu
Home
GRNET
Search
Configure Global Search
Log In
Files
F886142
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Fri, Aug 8, 8:44 PM
Size
4 KB
Mime Type
text/x-diff
Expires
Sun, Aug 10, 8:44 PM (15 h, 18 m)
Engine
blob
Format
Raw Data
Handle
246087
Attached To
rARCHIVING archiving
View Options
diff --git a/app/controllers/admin/faqs_controller.rb b/app/controllers/admin/faqs_controller.rb
index 9854b72..017dc14 100644
--- a/app/controllers/admin/faqs_controller.rb
+++ b/app/controllers/admin/faqs_controller.rb
@@ -1,63 +1,63 @@
class Admin::FaqsController < Admin::BaseController
before_action :fetch_faq, only: [:show, :edit, :update, :destroy]
# GET /admin/faqs
def index
@faqs = Faq.all
end
# GET /admin/faqs/:id
def show; end
# GET /admin/faqs/new
def new
@faq = Faq.new
end
# GET /admin/faqs/:id/edit
def edit; end
# POST /admin/faqs
def create
@faq = Faq.new(fetch_params)
if @faq.save
flash[:success] = 'FAQ created successfuly'
redirect_to admin_faqs_path
else
flash[:error] = 'FAQ not created'
render :new
end
end
# PUT/PATCH /admin/faqs/:id/update
def update
if @faq.update_attributes(fetch_params)
flash[:success] = 'FAQ updated successfuly'
redirect_to admin_faq_path(@faq)
else
flash[:error] = 'FAQ not updated'
render :edit
end
end
# DELETE /admin/faqs/:id/destroy
def destroy
if @faq.destroy
flash[:success] = 'FAQ destroyed'
else
flash[:error] = 'FAQ not destroyed'
end
redirect_to admin_faqs_path
end
private
def fetch_faq
@faq = Faq.find(params[:id])
end
def fetch_params
- params.require(:faq).permit(:title, :body)
+ params.require(:faq).permit(:title, :body, :priority)
end
end
diff --git a/app/views/admin/faqs/_form.html.erb b/app/views/admin/faqs/_form.html.erb
index cb78c2c..6dfddd3 100644
--- a/app/views/admin/faqs/_form.html.erb
+++ b/app/views/admin/faqs/_form.html.erb
@@ -1,16 +1,16 @@
<%= bootstrap_form_for([:admin, @faq], layout: :horizontal, label_col: 'col-xs-3',
control_col: 'col-xs-8') do |f| %>
<%= f.text_field :title, required: true %>
<%= f.number_field :priority %>
<%= f.text_area :body, cols: 20, rows: 10, required: true %>
<div class="form-group">
<div class="col-xs-offset-3 col-xs-2">
<%= link_to 'Cancel', admin_faqs_path, class: 'btn btn-default' %>
</div>
- <div class="col-xs-offset-2 col-xs-2">
+ <div class="col-xs-offset-5 col-xs-2">
<%= f.submit class: 'btn btn-success' %>
</div>
</div>
<% end %>
diff --git a/app/views/admin/faqs/edit.html.erb b/app/views/admin/faqs/edit.html.erb
index 84fc9b0..105e698 100644
--- a/app/views/admin/faqs/edit.html.erb
+++ b/app/views/admin/faqs/edit.html.erb
@@ -1,11 +1,12 @@
<div class="row">
- <div class="col-xs-10">
+ <div class="col-xs-10 col-xs-offset-1">
<div class="panel panel-default">
<div class="panel-heading">
<h4>Edit FAQ</h4>
</div>
- <br />
- <%= render partial: 'form' %>
+ <div class="panel-body">
+ <%= render partial: 'form' %>
+ </div>
</div>
</div>
</div>
diff --git a/app/views/admin/faqs/new.html.erb b/app/views/admin/faqs/new.html.erb
index 50735e2..31c03e0 100644
--- a/app/views/admin/faqs/new.html.erb
+++ b/app/views/admin/faqs/new.html.erb
@@ -1,11 +1,12 @@
<div class="row">
- <div class="col-xs-10">
+ <div class="col-xs-10 col-xs-offset-1">
<div class="panel panel-default">
<div class="panel-heading">
<h4>New FAQ entry</h4>
</div>
- <br />
- <%= render partial: 'form' %>
+ <div class="panel-body">
+ <%= render partial: 'form' %>
+ </div>
</div>
</div>
</div>
diff --git a/app/views/admin/faqs/show.html.erb b/app/views/admin/faqs/show.html.erb
index e237ea0..df0b686 100644
--- a/app/views/admin/faqs/show.html.erb
+++ b/app/views/admin/faqs/show.html.erb
@@ -1,26 +1,22 @@
<div class="col-xs-10">
<div class="panel panel-default">
<div class="panel-heading">
<h4><%= @faq.title %></h4>
</div>
- <br/>
-
- <p>
+ <div class="panel-body">
<%= @faq.pretty_body %>
- </p>
+ </div>
</div>
- <%= link_to 'Back to FAQ', admin_faqs_path %>
-
<%= link_to edit_admin_faq_path(@faq), class: 'btn btn-default' do %>
<label class="glyphicon glyphicon-edit text-primary"></label>
Edit
<% end %>
<%= link_to admin_faq_path(@faq), method: :delete,
data: { confirm: 'FAQ entry will be deleted' }, class: 'btn btn-default right' do %>
<label class="glyphicon glyphicon-remove text-danger"></label>
Delete
<% end %>
</div>
Event Timeline
Log In to Comment