Improves all pages for admin section

This commit is contained in:
Alberto Garcia Cabeza
2016-06-01 13:23:57 +02:00
parent 00fd9da0f9
commit fb6dbdf2f9
31 changed files with 529 additions and 387 deletions

View File

@@ -1,40 +1,20 @@
<%= form_for [:admin, @banner] do |f| %>
<%= render 'errors' %>
<div class="row">
<div class="small-3 column">
<div class="small-12 medium-6 large-3 column">
<%= f.label :style, t("admin.banners.banner.style") %>
<%= f.select :style, options_for_select(@banner_styles, @banner.style),:include_blank => '-',
label: false,placeholder: t("admin.banners.banner.style") %>
</div>
<div class="small-3 column">
<div class="small-12 medium-6 large-3 column">
<%= f.label :image, t("admin.banners.banner.image") %>
<%= f.select :image, options_for_select(@banner_imgs, @banner.image),:include_blank => '-',
label: false, placeholder: t("admin.banners.banner.image") %>
</div>
<div class="small-12 column">
<%= f.label :title, t("admin.banners.banner.title") %>
<%= f.text_field :title, placeholder: t("admin.banners.banner.title"), label: false,
data: {js_banner_title: "js_banner_title"} %>
</div>
<div class="small-12 column">
<%= f.label :description, t("admin.banners.banner.description") %>
<%= f.text_field :description,
label: false,
data: {js_banner_description: "js_banner_description"},
placeholder: t("admin.banners.banner.description") %>
</div>
<div class="small-12 column">
<%= f.label :target_url, t("admin.banners.banner.target_url") %>
<%= f.text_field :target_url,
label: false,
placeholder: t("admin.banners.banner.target_url") %>
</div>
<% date_started_at = @banner.post_started_at.present? ? I18n.localize(@banner.post_started_at) : "" %>
<div class="small-3 column">
<div class="small-12 medium-6 large-3 column">
<%= f.label :post_started_at, t("admin.banners.banner.post_started_at") %>
<%= f.text_field :post_started_at,
label: false,
@@ -44,7 +24,7 @@
id: "post_started_at" %>
</div>
<% date_ended_at = @banner.post_ended_at.present? ? I18n.localize(@banner.post_ended_at) : ""%>
<div class="small-3 column">
<div class="small-12 medium-6 large-3 column">
<%= f.label :post_ended_at, t("admin.banners.banner.post_ended_at") %>
<%= f.text_field :post_ended_at,
label: false,
@@ -53,9 +33,36 @@
class: "js-calendar-full",
id: "post_ended_at" %>
</div>
</div>
<div class="actions small-12 column">
<%= f.submit(class: "button", value: t("admin.banners.edit.form.submit_button")) %>
<div class="row">
<div class="small-12 medium-6 column">
<%= f.label :title, t("admin.banners.banner.title") %>
<%= f.text_field :title, placeholder: t("admin.banners.banner.title"), label: false,
data: {js_banner_title: "js_banner_title"} %>
</div>
<div class="small-12 medium-6 column">
<%= f.label :target_url, t("admin.banners.banner.target_url") %>
<%= f.text_field :target_url,
label: false,
placeholder: t("admin.banners.banner.target_url") %>
</div>
</div>
<div class="row">
<div class="small-12 column">
<%= f.label :description, t("admin.banners.banner.description") %>
<%= f.text_field :description,
label: false,
data: {js_banner_description: "js_banner_description"},
placeholder: t("admin.banners.banner.description") %>
</div>
</div>
<div class="row">
<div class="actions small-12 medium-3 column">
<%= f.submit(class: "button expanded", value: t("admin.banners.edit.form.submit_button")) %>
</div>
</div>
<div id="js-banner-style" class="<%= @banner.style %>">

View File

@@ -1,5 +1,5 @@
<%= link_to t("admin.banners.index.create"),
new_admin_banner_path, class: "button large success float-right" %>
new_admin_banner_path, class: "button success float-right" %>
<h2 class="inline-block"><%= t("admin.banners.index.title") %></h2>
@@ -11,6 +11,12 @@
<% @banners.each do |banner| %>
<tr id="<%= dom_id(banner) %>">
<td class="small-12 medium-9">
<small>
<%= t("admin.banners.banner.post_started_at")%> <strong><%= banner.post_started_at %></strong>
&nbsp;|&nbsp;
<%= t("admin.banners.banner.post_ended_at")%> <strong><%= banner.post_ended_at%></strong>
</small>
<div class="<%= banner.style %>">
<div class="<%= banner.image %>">
<%= link_to banner.target_url do %>
@@ -19,24 +25,15 @@
<% end %>
</div>
</div>
<%= t("admin.banners.banner.post_started_at")%> <strong><%= banner.post_started_at %></strong>
&nbsp;|&nbsp;
<%= t("admin.banners.banner.post_ended_at")%> <strong><%= banner.post_ended_at%></strong>
</td>
<td class="text-center">
<%= link_to edit_admin_banner_path(banner),
class: 'edit-banner button' do %>
<span class="icon-edit"></span>
<%= t("admin.banners.index.edit") %>
<% end %>
</td>
<td>
<%= link_to admin_banner_path(banner), method: :delete,
class: 'delete' do %>
<span class="icon-delete"></span>
<%= t("admin.banners.index.delete") %>
<% end %>
<td class="text-right">
<%= link_to t("admin.banners.index.edit"), edit_admin_banner_path(banner),
class: 'edit-banner button hollow' %>
<%= link_to t("admin.banners.index.delete"), admin_banner_path(banner),
method: :delete,
class: 'button hollow alert' %>
</td>
</tr>
<% end %>