Added categories pages styling

This commit is contained in:
Luke Barratt 2014-04-27 01:47:53 +01:00
parent 1f695f7c84
commit 8ad126f15f
6 changed files with 71 additions and 66 deletions

View file

@ -48,6 +48,7 @@
*/
@import "pages/news";
@import "pages/categories";
@import "pages/contests";
@import "pages/forums";
@import "pages/teams";

View file

@ -0,0 +1,18 @@
/*
Categories List
*/
.categories {
table.categories {
.actions {
width: 20%;
text-align: right;
i {
margin-left: em(5);
}
}
}
}

View file

@ -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

View file

@ -1,21 +1,14 @@
<h1>Editing category</h1>
<h1>Editing Category</h1>
<%= form_for @category do |f| %>
<div id="error_explanation">
<ul>
<% @category.errors.full_messages.each do |msg| %>
<li><%= msg %></li>
<% end %>
</ul>
<%= form_for @category, html: { class: 'square' } do |f| %>
<%= render 'shared/errors', messages: @category.errors.full_messages %>
<div class="fields horizontal">
<%= f.label :name %>
<%= f.text_field :name %>
</div>
<p>
<%= f.label :name %><br />
<%= f.text_field :name %>
</p>
<p>
<%= f.submit 'Update' %>
</p>
<div class="controls">
<%= f.submit 'Update Category' %>
</div>
<% end %>
<%= link_to 'Back', categories_path %>

View file

@ -1,24 +1,23 @@
<h1>Listing categories</h1>
<div class="categories">
<h1 class="title">Listing Categories</h1>
<% Category.new.domains.each do |key, domain| %>
<h3 class="center">
<%= h domain %>
</h3>
<h3 class="title"><%=h domain %></h3>
<table class="data">
<table class="categories striped">
<tr>
<th width="70%">Name</th>
<th width="30%">Options</th>
<th class="name">Name</th>
<th class="actions"></th>
</tr>
<% @categories.each do |category| %>
<% if category.domain == key %>
<tr>
<td><%=h category.name %></td>
<td>
<%= 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 %>
<td class="actions">
<%= 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 %>
</td>
</tr>
<% end %>
@ -26,4 +25,6 @@
</table>
<% end %>
<%= link_to 'New category', new_category_path %>
<%= link_to 'New Category', new_category_path, class: 'button' %>
</div>

View file

@ -1,27 +1,17 @@
<h1>New Category</h1>
<div class="wide box">
<%= form_for(@category) do |f| %>
<div id="error_explanation">
<ul>
<% @category.errors.full_messages.each do |msg| %>
<li><%= msg %></li>
<% end %>
</ul>
</div>
<%= form_for(@category, html: { class: 'square' }) do |f| %>
<%= render 'shared/errors', messages: @category.errors.full_messages %>
<p>
<%= f.label :name %><br />
<div class="fields horizontal">
<%= f.label :name %>
<%= f.text_field :name %>
</p>
<p>
<%= f.label :domain %><br />
<%= f.select :domain, @category.domains.invert %>
</p>
<p>
<%= f.submit 'Create' %>
</p>
<% end %>
</div>
<%= link_to 'Back', categories_path %>
<div class="fields horizontal">
<%= f.label :domain %>
<%= f.select :domain, @category.domains.invert %>
</div>
<div class="controls">
<%= f.submit 'Create Category' %>
</div>
<% end %>