forked from consuldemocracy/consuldemocracy
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request consuldemocracy#1846 from AyuntamientoMadrid/ods-c…
…ards [Upstream] Add cards to custom pages
- Loading branch information
Showing
24 changed files
with
277 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2736,7 +2736,8 @@ table { | |
// 24. Homepage | ||
// ------------ | ||
|
||
.home-page { | ||
.home-page, | ||
.custom-page { | ||
|
||
a { | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
class Admin::SiteCustomization::CardsController < Admin::SiteCustomization::BaseController | ||
skip_authorization_check | ||
|
||
def index | ||
@page = ::SiteCustomization::Page.find(params[:page_id]) | ||
@cards = @page.cards | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<tr id="<%= dom_id(card) %>" class="homepage-card"> | ||
<td> | ||
<%= card.label %><br> | ||
<%= card.title %> | ||
</td> | ||
<td><%= card.description %></td> | ||
<td> | ||
<%= card.link_text %><br> | ||
<%= card.link_url %> | ||
</td> | ||
|
||
<!-- 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, page_id: params[:page_id]), | ||
class: "button hollow" %> | ||
|
||
<%= link_to t("admin.actions.delete"), | ||
admin_widget_card_path(card, page_id: params[:page_id]), | ||
method: :delete, | ||
data: { confirm: t('admin.actions.confirm') }, | ||
class: "button hollow alert" %> | ||
</td> | ||
</tr> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<table> | ||
<thead> | ||
<tr> | ||
<th><%= t("admin.site_customization.pages.cards.title") %></th> | ||
<th class="small-4"><%= t("admin.site_customization.pages.cards.description") %></th> | ||
<th><%= t("admin.site_customization.pages.cards.link_text") %> / <%= t("admin.site_customization.pages.cards.link_url") %></th> | ||
<th><%= t("admin.shared.image") %></th> | ||
<th class="small-2"><%= t("admin.shared.actions") %></th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
<% cards.each do |card| %> | ||
<%= render "card", card: card %> | ||
<% end %> | ||
</tbody> | ||
</table> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<% provide :title do %> | ||
<%= t("admin.header.title") %> - <%= t("admin.menu.site_customization.pages") %> - <%= @page.title %> | ||
<% end %> | ||
<%= back_link_to admin_site_customization_pages_path %> | ||
<div id="cards"> | ||
<h2 class="inline-block"> | ||
<%= @page.title %> <%= t("admin.site_customization.pages.cards.cards_title") %></h2> | ||
|
||
<div class="float-right"> | ||
<%= link_to t("admin.site_customization.pages.cards.create_card"), | ||
new_admin_widget_card_path(page_id: params[:page_id]), class: "button" %> | ||
</div> | ||
|
||
<% if @cards.present? %> | ||
<%= render "cards", cards: @cards %> | ||
<% else %> | ||
<div class="callout primary clear"> | ||
<%= t("admin.site_customization.pages.cards.no_cards") %> | ||
</div> | ||
<% end %> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<div id="<%= dom_id(card) %>" class="card small-12 medium-6 column margin-bottom end large-4" data-equalizer-watch> | ||
<%= link_to card.link_url do %> | ||
<figure class="figure-card"> | ||
<div class="gradient"></div> | ||
<% if card.image.present? %> | ||
<%= image_tag(card.image_url(:large), alt: card.image.title) %> | ||
<% end %> | ||
<figcaption> | ||
<span><%= card.label %></span><br> | ||
<h3><%= card.title %></h3> | ||
</figcaption> | ||
</figure> | ||
<p class="description"><%= card.description %></p> | ||
<p><%= card.link_text %></p> | ||
<% end %> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<h3 class="title"><%= t("welcome.cards.title") %></h3> | ||
|
||
<div class="row" data-equalizer data-equalizer-on="medium"> | ||
<% @cards.find_each do |card| %> | ||
<%= render "card", card: card %> | ||
<% end %> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
db/migrate/20181218164126_add_site_customization_page_to_widget_cards.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
class AddSiteCustomizationPageToWidgetCards < ActiveRecord::Migration | ||
def change | ||
add_reference :widget_cards, :site_customization_page, index: true | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.