Adds styles and missing i18n for admin homepage
This commit is contained in:
@@ -279,7 +279,7 @@ $sidebar-active: #f4fcd0;
|
||||
}
|
||||
|
||||
.no-margin-bottom {
|
||||
margin-bottom: 0 !important;
|
||||
margin-bottom: 0 !important;
|
||||
}
|
||||
|
||||
// 02. Sidebar
|
||||
|
||||
@@ -319,7 +319,8 @@
|
||||
.legislation-process-new,
|
||||
.legislation-process-edit,
|
||||
.milestone-new,
|
||||
.milestone-edit {
|
||||
.milestone-edit,
|
||||
.image-form {
|
||||
@include direct-uploads;
|
||||
}
|
||||
|
||||
|
||||
@@ -37,7 +37,11 @@ module AdminHelper
|
||||
end
|
||||
|
||||
def menu_customization?
|
||||
["pages", "images", "content_blocks"].include?(controller_name)
|
||||
["pages", "images", "content_blocks"].include?(controller_name) || menu_homepage?
|
||||
end
|
||||
|
||||
def menu_homepage?
|
||||
["homepage", "cards"].include?(controller_name)
|
||||
end
|
||||
|
||||
def official_level_options
|
||||
|
||||
@@ -167,10 +167,10 @@
|
||||
</a>
|
||||
<ul <%= "class=is-active" if menu_customization? &&
|
||||
controller.class.parent != Admin::Poll::Questions::Answers %>>
|
||||
<li <%= "class=active" if controller_name == "homepage" %>>
|
||||
<%= link_to "Homepage", admin_homepage_path %>
|
||||
<li <%= "class=active" if menu_homepage? %>>
|
||||
<%= link_to t("admin.menu.site_customization.homepage"), admin_homepage_path %>
|
||||
</li>
|
||||
|
||||
|
||||
<li <%= "class=active" if controller_name == "pages" %>>
|
||||
<%= link_to t("admin.menu.site_customization.pages"), admin_site_customization_pages_path %>
|
||||
</li>
|
||||
@@ -183,7 +183,7 @@
|
||||
<li <%= "class=active" if controller_name == "content_blocks" %>>
|
||||
<%= link_to t("admin.menu.site_customization.content_blocks"), admin_site_customization_content_blocks_path%>
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
|
||||
@@ -1,22 +1,27 @@
|
||||
<tr id="<%= dom_id(card) %>" class="card">
|
||||
<td><%= card.title %></td>
|
||||
<td><%= card.description %></td>
|
||||
<td><%= card.link_text %></td>
|
||||
<td><%= card.link_url %></td>
|
||||
|
||||
<!-- remove conditional once specs have image validations -->
|
||||
<td><% if card.image.present? %>
|
||||
<%= image_tag(card.image_url(:thumb),
|
||||
class: "margin",
|
||||
alt: card.image.title) %>
|
||||
<% end %></td>
|
||||
<td>
|
||||
<div>
|
||||
<%= link_to "Edit", edit_admin_widget_card_path(card) %>
|
||||
<div>
|
||||
<%= link_to "Remove", admin_widget_card_path(card),
|
||||
method: :delete,
|
||||
data: { confirm: t('admin.actions.confirm') } %>
|
||||
<div>
|
||||
<%= card.link_text %><br>
|
||||
<%= card.link_url %>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<!-- remove conditional once specs have image validations -->
|
||||
<td>
|
||||
<% if card.image.present? %>
|
||||
<%= link_to t("admin.shared.show_image"), card.image_url(:large),
|
||||
title: card.image.title, target: "_blank" %>
|
||||
<% end %>
|
||||
</td>
|
||||
<td>
|
||||
<%= link_to t("admin.actions.edit"),
|
||||
edit_admin_widget_card_path(card),
|
||||
class: "button hollow" %>
|
||||
|
||||
<%= link_to t("admin.actions.delete"),
|
||||
admin_widget_card_path(card),
|
||||
method: :delete,
|
||||
data: { confirm: t('admin.actions.confirm') },
|
||||
class: "button hollow alert" %>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -1,13 +1,16 @@
|
||||
<table>
|
||||
<tr>
|
||||
<th>title</th>
|
||||
<th>text</th>
|
||||
<th>link text</th>
|
||||
<th>link</th>
|
||||
<th>image</th>
|
||||
<th>actions</th>
|
||||
</tr>
|
||||
<% cards.each do |card| %>
|
||||
<%= render "card", card: card %>
|
||||
<% end %>
|
||||
</table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th><%= t("admin.homepage.cards.title") %></th>
|
||||
<th class="small-4"><%= t("admin.homepage.cards.description") %></th>
|
||||
<th><%= t("admin.homepage.cards.link_text") %> / <%= t("admin.homepage.cards.link_url") %></th>
|
||||
<th><%= t("admin.shared.image") %></th>
|
||||
<th><%= t("admin.shared.actions") %></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% cards.each do |card| %>
|
||||
<%= render "card", card: card %>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
<div id="<%= dom_id(setting) %>">
|
||||
<%= form_for(setting, url: admin_setting_path(setting), method: :put) do |f| %>
|
||||
|
||||
<%= f.hidden_field :value,
|
||||
value: (setting.enabled? ? "" : "active") %>
|
||||
|
||||
<%= f.hidden_field :value,
|
||||
value: (setting.enabled? ? "" : "active") %>
|
||||
|
||||
<%= f.submit(t("admin.settings.index.features.#{setting.enabled? ? 'disable' : 'enable'}"),
|
||||
class: "button expanded #{setting.enabled? ? 'hollow alert' : 'success'}",
|
||||
class: "button #{setting.enabled? ? 'hollow alert' : 'success'}",
|
||||
data: {confirm: t("admin.actions.confirm")}) %>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,35 +1,48 @@
|
||||
<h1>Homepage</h1>
|
||||
<h2><%= t("admin.homepage.title") %></h2>
|
||||
|
||||
<p>The active modules appear in the homepage in the same order as here.</p>
|
||||
<p><%= t("admin.homepage.description") %></p>
|
||||
|
||||
<div id="header">
|
||||
<% if @header.present? %>
|
||||
<%= render "cards", cards: @header %>
|
||||
<% end %>
|
||||
</div>
|
||||
<h3 class="inline-block"><%= t("admin.homepage.header_title") %></h3>
|
||||
|
||||
<h2>Cards</h2>
|
||||
|
||||
<div>
|
||||
<%= link_to "Create header", new_admin_widget_card_path(header_card: true) %>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<%= link_to "Create card", new_admin_widget_card_path %>
|
||||
</div>
|
||||
|
||||
<div id="cards">
|
||||
<% if @cards.present? %>
|
||||
<%= render "cards", cards: @cards %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
|
||||
<% @settings.each do |setting| %>
|
||||
|
||||
<div>
|
||||
<strong><%= t("settings.#{setting.key}") %></strong>
|
||||
<div class="float-right">
|
||||
<%= link_to t("admin.homepage.create_header"), new_admin_widget_card_path(header_card: true), class: "button" %>
|
||||
</div>
|
||||
|
||||
<%= render "setting", setting: setting %>
|
||||
<% end %>
|
||||
<% if @header.present? %>
|
||||
<%= render "cards", cards: @header %>
|
||||
<% else %>
|
||||
<div class="callout primary clear">
|
||||
<%= t("admin.homepage.no_header") %>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<hr>
|
||||
|
||||
<div id="cards">
|
||||
<h3 class="inline-block"><%= t("admin.homepage.cards_title") %></h3>
|
||||
|
||||
<div class="float-right">
|
||||
<%= link_to t("admin.homepage.create_card"), new_admin_widget_card_path, class: "button" %>
|
||||
</div>
|
||||
|
||||
<% if @cards.present? %>
|
||||
<%= render "cards", cards: @cards %>
|
||||
<% else %>
|
||||
<div class="callout primary clear">
|
||||
<%= t("admin.homepage.no_cards") %>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<hr>
|
||||
|
||||
<% @settings.each do |setting| %>
|
||||
<div class="callout">
|
||||
<h3 class="inline-block"><%= t("settings.#{setting.key}") %></h3>
|
||||
<div class="float-right">
|
||||
<%= render "setting", setting: setting %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
@@ -1,11 +1,23 @@
|
||||
<%= form_for [:admin, @card] do |f| %>
|
||||
<%= f.text_field :title %>
|
||||
<%= f.text_area :description %>
|
||||
<%= f.text_field :link_text %>
|
||||
<%= f.text_field :link_url %>
|
||||
<%= f.hidden_field :header, value: @card.header? %>
|
||||
<div class="images small-12 column">
|
||||
<%= render 'images/nested_image', imageable: @card, f: f %>
|
||||
|
||||
<%= f.text_area :description, rows: 5 %>
|
||||
|
||||
<div class="small-12 medium-6">
|
||||
<%= f.text_field :link_text %>
|
||||
</div>
|
||||
<%= f.submit %>
|
||||
<% end %>
|
||||
|
||||
<div class="small-12 medium-6">
|
||||
<%= f.text_field :link_url %>
|
||||
</div>
|
||||
|
||||
<%= f.hidden_field :header, value: @card.header? %>
|
||||
|
||||
<div class="image-form">
|
||||
<div class="image small-12 column">
|
||||
<%= render 'images/nested_image', imageable: @card, f: f %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<%= f.submit(t("admin.homepage.#{action_name}.#{@card.header? ? 'submit_header' : 'submit_card'}"), class: "button success") %>
|
||||
<% end %>
|
||||
|
||||
@@ -1,2 +1,9 @@
|
||||
Edit
|
||||
<h2>
|
||||
<% if @card.header? %>
|
||||
<%= t("admin.homepage.edit.header_title") %>
|
||||
<% else %>
|
||||
<%= t("admin.homepage.edit.card_title") %>
|
||||
<% end %>
|
||||
</h2>
|
||||
|
||||
<%= render "form" %>
|
||||
@@ -1,2 +1,9 @@
|
||||
New
|
||||
<%= render "form" %>
|
||||
<h2>
|
||||
<% if @card.header? %>
|
||||
<%= t("admin.homepage.new.header_title") %>
|
||||
<% else %>
|
||||
<%= t("admin.homepage.new.card_title") %>
|
||||
<% end %>
|
||||
</h2>
|
||||
|
||||
<%= render "form" %>
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
<div class="top-bar-title">
|
||||
<h1>
|
||||
<%= link_to namespaced_root_path do %>
|
||||
<%= link_to admin_root_path do %>
|
||||
<%= setting['org_name'] %>
|
||||
<br><small><%= namespaced_header_title %></small>
|
||||
<% end %>
|
||||
|
||||
Reference in New Issue
Block a user