mirror of
https://github.com/ENSL/ensl.org.git
synced 2024-12-26 12:30:48 +00:00
Added categories pages styling
This commit is contained in:
parent
1f695f7c84
commit
8ad126f15f
6 changed files with 71 additions and 66 deletions
|
@ -48,6 +48,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@import "pages/news";
|
@import "pages/news";
|
||||||
|
@import "pages/categories";
|
||||||
@import "pages/contests";
|
@import "pages/contests";
|
||||||
@import "pages/forums";
|
@import "pages/forums";
|
||||||
@import "pages/teams";
|
@import "pages/teams";
|
||||||
|
|
18
app/assets/stylesheets/pages/_categories.scss
Normal file
18
app/assets/stylesheets/pages/_categories.scss
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
/*
|
||||||
|
Categories List
|
||||||
|
*/
|
||||||
|
|
||||||
|
.categories {
|
||||||
|
|
||||||
|
table.categories {
|
||||||
|
|
||||||
|
.actions {
|
||||||
|
width: 20%;
|
||||||
|
text-align: right;
|
||||||
|
|
||||||
|
i {
|
||||||
|
margin-left: em(5);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -30,6 +30,8 @@ class CategoriesController < ApplicationController
|
||||||
@category.update_attribute :sort, @category.id
|
@category.update_attribute :sort, @category.id
|
||||||
flash[:notice] = t(:articles_category)
|
flash[:notice] = t(:articles_category)
|
||||||
redirect_to :categories
|
redirect_to :categories
|
||||||
|
else
|
||||||
|
render action: :new
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -1,21 +1,14 @@
|
||||||
<h1>Editing category</h1>
|
<h1>Editing Category</h1>
|
||||||
|
|
||||||
<%= form_for @category do |f| %>
|
<%= form_for @category, html: { class: 'square' } do |f| %>
|
||||||
<div id="error_explanation">
|
<%= render 'shared/errors', messages: @category.errors.full_messages %>
|
||||||
<ul>
|
|
||||||
<% @category.errors.full_messages.each do |msg| %>
|
<div class="fields horizontal">
|
||||||
<li><%= msg %></li>
|
<%= f.label :name %>
|
||||||
<% end %>
|
<%= f.text_field :name %>
|
||||||
</ul>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<p>
|
<div class="controls">
|
||||||
<%= f.label :name %><br />
|
<%= f.submit 'Update Category' %>
|
||||||
<%= f.text_field :name %>
|
</div>
|
||||||
</p>
|
|
||||||
<p>
|
|
||||||
<%= f.submit 'Update' %>
|
|
||||||
</p>
|
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<%= link_to 'Back', categories_path %>
|
|
|
@ -1,24 +1,23 @@
|
||||||
<h1>Listing categories</h1>
|
<div class="categories">
|
||||||
|
<h1 class="title">Listing Categories</h1>
|
||||||
|
|
||||||
<% Category.new.domains.each do |key, domain| %>
|
<% Category.new.domains.each do |key, domain| %>
|
||||||
<h3 class="center">
|
<h3 class="title"><%=h domain %></h3>
|
||||||
<%= h domain %>
|
|
||||||
</h3>
|
|
||||||
|
|
||||||
<table class="data">
|
<table class="categories striped">
|
||||||
<tr>
|
<tr>
|
||||||
<th width="70%">Name</th>
|
<th class="name">Name</th>
|
||||||
<th width="30%">Options</th>
|
<th class="actions"></th>
|
||||||
</tr>
|
</tr>
|
||||||
<% @categories.each do |category| %>
|
<% @categories.each do |category| %>
|
||||||
<% if category.domain == key %>
|
<% if category.domain == key %>
|
||||||
<tr>
|
<tr>
|
||||||
<td><%=h category.name %></td>
|
<td><%=h category.name %></td>
|
||||||
<td>
|
<td class="actions">
|
||||||
<%= link_to 'Edit', edit_category_path(category) %>
|
<%= link_to icon('chevron-up'), controller: :categories, action: "up", id: category.id %>
|
||||||
<%= link_to 'Up', :controller => :categories, :action => "up", :id => category.id %>
|
<%= link_to icon('chevron-down'), controller: :categories, action: "down", id: category.id %>
|
||||||
<%= link_to 'Down', :controller => :categories, :action => "down", :id => category.id %>
|
<%= link_to icon('pencil'), edit_category_path(category) %>
|
||||||
<%= link_to 'Delete', category, :confirm => 'Are you sure?', :method => :delete %>
|
<%= link_to icon('times'), category, :confirm => 'Are you sure?', :method => :delete %>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
@ -26,4 +25,6 @@
|
||||||
</table>
|
</table>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<%= link_to 'New category', new_category_path %>
|
<%= link_to 'New Category', new_category_path, class: 'button' %>
|
||||||
|
</div>
|
||||||
|
|
|
@ -1,27 +1,17 @@
|
||||||
<h1>New Category</h1>
|
<h1>New Category</h1>
|
||||||
|
|
||||||
<div class="wide box">
|
<%= form_for(@category, html: { class: 'square' }) do |f| %>
|
||||||
<%= form_for(@category) do |f| %>
|
<%= render 'shared/errors', messages: @category.errors.full_messages %>
|
||||||
<div id="error_explanation">
|
|
||||||
<ul>
|
|
||||||
<% @category.errors.full_messages.each do |msg| %>
|
|
||||||
<li><%= msg %></li>
|
|
||||||
<% end %>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<p>
|
<div class="fields horizontal">
|
||||||
<%= f.label :name %><br />
|
<%= f.label :name %>
|
||||||
<%= f.text_field :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>
|
</div>
|
||||||
|
<div class="fields horizontal">
|
||||||
<%= link_to 'Back', categories_path %>
|
<%= f.label :domain %>
|
||||||
|
<%= f.select :domain, @category.domains.invert %>
|
||||||
|
</div>
|
||||||
|
<div class="controls">
|
||||||
|
<%= f.submit 'Create Category' %>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
|
Loading…
Reference in a new issue