Cleaned up catergory forum
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
class CategoriesController < ApplicationController
|
||||
load_and_authorize_resource :category
|
||||
|
||||
before_filter :check_for_cancel
|
||||
|
||||
def create
|
||||
if @category.save
|
||||
flash[:notice] = "Category was successfully created."
|
||||
@@ -23,4 +25,10 @@ class CategoriesController < ApplicationController
|
||||
redirect_to forums_url
|
||||
end
|
||||
end
|
||||
|
||||
def check_for_cancel
|
||||
if params[:commit] == 'cancel'
|
||||
redirect_to forums_path
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -6,33 +6,17 @@
|
||||
<% if @category.errors.any? %>
|
||||
<% flash.now[:error] = @category.errors.full_messages.join(', and ') %>
|
||||
<% end %>
|
||||
<div class="fieldset">
|
||||
<span class="label indent smaller">
|
||||
<%= f.label :title %><br />
|
||||
<small>(Required)</small>
|
||||
</span>
|
||||
<span class="input indent smaller"><%= f.text_field :title, :size => 75 %></span>
|
||||
<div class="clear"></div>
|
||||
</div>
|
||||
<div class="fieldset">
|
||||
<span class="label indent smaller">
|
||||
<%= f.label :title %>
|
||||
<%= f.text_field :title, :style => "width:98%" %>
|
||||
<%= f.label :position %>
|
||||
</span>
|
||||
<span class="input indent smaller"><%= f.text_field :position %></span>
|
||||
<div class="clear"></div>
|
||||
</div>
|
||||
<div class="fieldset">
|
||||
<span class="label indent smaller"></span>
|
||||
<span class="input indent smaller">
|
||||
<%= f.check_box :state %>
|
||||
<%= f.text_field :position %>
|
||||
<%= f.label :state %>
|
||||
</span>
|
||||
<div class="clear"></div>
|
||||
</div>
|
||||
<%= f.check_box :state %>
|
||||
</div>
|
||||
<div class="module_footer">
|
||||
<div class="fieldset">
|
||||
<span class="input"><%= f.submit "submit" %> or <%= link_to "cancel", forums_path %></span>
|
||||
<%= f.submit "Submit", :class =>"btn btn-primary"%>
|
||||
<%= button_tag "Cancel", :confirm => 'Are you sure? Any changes will be lost.', :class => 'btn', :type => 'submit', :name => 'commit', :value => 'cancel' %>
|
||||
<div class="clear"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user