diff --git a/app/assets/stylesheets/application.css.scss b/app/assets/stylesheets/application.css.scss index 8189629..821c147 100644 --- a/app/assets/stylesheets/application.css.scss +++ b/app/assets/stylesheets/application.css.scss @@ -48,6 +48,7 @@ */ @import "pages/news"; +@import "pages/categories"; @import "pages/contests"; @import "pages/forums"; @import "pages/teams"; diff --git a/app/assets/stylesheets/pages/_categories.scss b/app/assets/stylesheets/pages/_categories.scss new file mode 100644 index 0000000..af41e0d --- /dev/null +++ b/app/assets/stylesheets/pages/_categories.scss @@ -0,0 +1,18 @@ +/* + Categories List +*/ + +.categories { + + table.categories { + + .actions { + width: 20%; + text-align: right; + + i { + margin-left: em(5); + } + } + } +} \ No newline at end of file diff --git a/app/controllers/categories_controller.rb b/app/controllers/categories_controller.rb index 9b4afbc..0fc8be0 100644 --- a/app/controllers/categories_controller.rb +++ b/app/controllers/categories_controller.rb @@ -30,6 +30,8 @@ class CategoriesController < ApplicationController @category.update_attribute :sort, @category.id flash[:notice] = t(:articles_category) redirect_to :categories + else + render action: :new end end diff --git a/app/views/categories/edit.html.erb b/app/views/categories/edit.html.erb index 6cfdf34..b3a31f9 100644 --- a/app/views/categories/edit.html.erb +++ b/app/views/categories/edit.html.erb @@ -1,21 +1,14 @@ -
- <%= f.label :name %>
+
- <%= f.submit 'Update' %> -
+Name | -Options | -
---|---|
<%= h category.name %> | -- <%= link_to 'Edit', edit_category_path(category) %> - <%= link_to 'Up', :controller => :categories, :action => "up", :id => category.id %> - <%= link_to 'Down', :controller => :categories, :action => "down", :id => category.id %> - <%= link_to 'Delete', category, :confirm => 'Are you sure?', :method => :delete %> - | -
Name | ++ |
---|---|
<%=h category.name %> | ++ <%= link_to icon('chevron-up'), controller: :categories, action: "up", id: category.id %> + <%= link_to icon('chevron-down'), controller: :categories, action: "down", id: category.id %> + <%= link_to icon('pencil'), edit_category_path(category) %> + <%= link_to icon('times'), category, :confirm => 'Are you sure?', :method => :delete %> + | +
- <%= f.label :name %>
- <%= f.text_field :name %>
-
- <%= f.label :domain %>
- <%= f.select :domain, @category.domains.invert %>
-
- <%= f.submit 'Create' %> -
- <% end %> -