3
app/assets/javascripts/proposals_dashboard.coffee
Normal file
3
app/assets/javascripts/proposals_dashboard.coffee
Normal file
@@ -0,0 +1,3 @@
|
||||
# Place all the behaviors and hooks related to the matching controller here.
|
||||
# All this logic will automatically be available in application.js.
|
||||
# You can use CoffeeScript in this file: http://coffeescript.org/
|
||||
@@ -8,6 +8,7 @@
|
||||
@import 'participation';
|
||||
@import 'pages';
|
||||
@import 'proposal';
|
||||
@import 'proposals_dashboard';
|
||||
@import 'legislation';
|
||||
@import 'legislation_process';
|
||||
@import 'community';
|
||||
|
||||
132
app/assets/stylesheets/proposals_dashboard.scss
Normal file
132
app/assets/stylesheets/proposals_dashboard.scss
Normal file
@@ -0,0 +1,132 @@
|
||||
.proposals-dashboard {
|
||||
display: flex;
|
||||
// flex-flow: row nowrap;
|
||||
// justify-content: flex-start;
|
||||
// align-items: flex-start;
|
||||
flex-direction: column;
|
||||
margin-top: -1.5rem;
|
||||
|
||||
.column-wrapper {
|
||||
flex: 2;
|
||||
display: flex;
|
||||
|
||||
.left-column {
|
||||
flex: 0 0 150pt;
|
||||
background: lightgray;
|
||||
margin-right: 5px;
|
||||
// width: 150pt;
|
||||
padding: 5pt;
|
||||
// min-height: 775px;
|
||||
|
||||
.state-box {
|
||||
.logo {
|
||||
height: 100pt;
|
||||
width: 100pt;
|
||||
margin-left: 20pt;
|
||||
margin-right: 20pt;
|
||||
border-radius: 50pt;
|
||||
background-color: #fff3cb;
|
||||
border: 2pt solid white;
|
||||
}
|
||||
|
||||
.status {
|
||||
height: 25pt;
|
||||
width: 100pt;
|
||||
margin-left: 20pt;
|
||||
margin-right: 20pt;
|
||||
padding-top: 3pt;
|
||||
color: #055392;
|
||||
font-weight: bold;
|
||||
text-align: center;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.draft {
|
||||
background-color: #ffe699;
|
||||
}
|
||||
|
||||
.published {
|
||||
background-color: #d3ebd2;
|
||||
}
|
||||
}
|
||||
|
||||
.menu {
|
||||
color: #a9a9a9;
|
||||
font-size: 16pt;
|
||||
|
||||
.menu-title {
|
||||
margin-top: 10pt;
|
||||
}
|
||||
|
||||
.menu-entry {
|
||||
color: #a9a9a9;
|
||||
padding-left: 25pt;
|
||||
line-height: 30pt;
|
||||
vertical-align: middle;
|
||||
display: block;
|
||||
}
|
||||
|
||||
.menu-entry:focus, .menu-entry:active, .menu-entry:hover {
|
||||
outline: 0;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.selected {
|
||||
font-weight: bold;
|
||||
color: #454545;
|
||||
}
|
||||
|
||||
.menu-entry.selected {
|
||||
text-decoration: underline #a9a9a9;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.right-column {
|
||||
background: lightgray;
|
||||
flex: 1 1;
|
||||
padding: 5pt;
|
||||
//min-height: 775px;
|
||||
|
||||
.progress-info {
|
||||
display: flex;
|
||||
flex-flow: row wrap;
|
||||
justify-content: flex-start;
|
||||
align-items: center;
|
||||
align-content: stretch;
|
||||
width: 1440px;
|
||||
}
|
||||
|
||||
.cell-data {
|
||||
flex-grow: 1;
|
||||
width: 33%;
|
||||
font-size: 16pt;
|
||||
font-weight: bold;
|
||||
line-height: 32pt;
|
||||
vertical-align: middle;
|
||||
padding-left: 42pt;
|
||||
|
||||
.caption {
|
||||
width: 150pt;
|
||||
float: left;
|
||||
}
|
||||
|
||||
.value {
|
||||
width: 50pt;
|
||||
float: left;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.value:after {
|
||||
clear: both;
|
||||
}
|
||||
}
|
||||
|
||||
.body {
|
||||
background-color: white;
|
||||
height: 500px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
20
app/controllers/proposals_dashboard_controller.rb
Normal file
20
app/controllers/proposals_dashboard_controller.rb
Normal file
@@ -0,0 +1,20 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
# Proposals dashboard
|
||||
class ProposalsDashboardController < ApplicationController
|
||||
before_action :authenticate_user!
|
||||
|
||||
helper_method :proposal
|
||||
respond_to :html
|
||||
layout 'proposals_dashboard'
|
||||
|
||||
def index
|
||||
authorize! :dashboard, proposal
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def proposal
|
||||
@proposal ||= Proposal.find(params[:proposal_id])
|
||||
end
|
||||
end
|
||||
2
app/helpers/proposals_dashboard_helper.rb
Normal file
2
app/helpers/proposals_dashboard_helper.rb
Normal file
@@ -0,0 +1,2 @@
|
||||
module ProposalsDashboardHelper
|
||||
end
|
||||
@@ -19,6 +19,9 @@ module Abilities
|
||||
can :publish, Proposal do |proposal|
|
||||
proposal.draft? && proposal.author.id == user.id
|
||||
end
|
||||
can :dashboard, Proposal do |proposal|
|
||||
proposal.author.id == user.id
|
||||
end
|
||||
|
||||
can [:retire_form, :retire], Proposal, author_id: user.id
|
||||
|
||||
|
||||
63
app/views/layouts/proposals_dashboard.html.erb
Normal file
63
app/views/layouts/proposals_dashboard.html.erb
Normal file
@@ -0,0 +1,63 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="<%= I18n.locale %>" data-current-user-id="<%= current_user.try(:id) %>">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||
<%= render "layouts/tracking_data" %>
|
||||
<%= render "layouts/meta_tags" %>
|
||||
<title><%= content_for?(:title) ? yield(:title) : setting['org_name'] %></title>
|
||||
<%= content_for :canonical %>
|
||||
<%= stylesheet_link_tag "application" %>
|
||||
<!--[if lt IE 9]>
|
||||
<%= stylesheet_link_tag "ie" %>
|
||||
<![endif]-->
|
||||
<%= javascript_include_tag "application", 'data-turbolinks-track' => true %>
|
||||
<%= csrf_meta_tags %>
|
||||
<%= favicon_link_tag "favicon.ico" %>
|
||||
<%= favicon_link_tag image_path_for("apple-touch-icon-200.png"),
|
||||
rel: "icon apple-touch-icon",
|
||||
sizes: "200x200",
|
||||
type: "image/png" %>
|
||||
<%= content_for :social_media_meta_tags %>
|
||||
|
||||
<%= setting['per_page_code_head'].try(:html_safe) %>
|
||||
</head>
|
||||
<body class="<%= yield (:body_class) %>">
|
||||
<%= setting['per_page_code_body'].try(:html_safe) %>
|
||||
|
||||
<h1 class="show-for-sr"><%= setting['org_name'] %></h1>
|
||||
|
||||
<div class="wrapper <%= yield (:wrapper_class) %>">
|
||||
<%= render 'layouts/header' %>
|
||||
|
||||
<!--[if lt IE 9]>
|
||||
<% if browser.ie? && cookies['ie_alert_closed'] != 'true' %>
|
||||
<div data-alert class="callout primary ie-callout" data-closable>
|
||||
<button class="close-button ie-callout-close-js"
|
||||
aria-label="<%= t("application.close") %>" type="button" data-close>
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
<h2><%= t("layouts.application.ie_title") %></h2>
|
||||
<p>
|
||||
<%= t("layouts.application.ie",
|
||||
chrome: link_to(
|
||||
t("layouts.application.chrome"), "https://www.google.com/chrome/browser/desktop/", title: t("shared.target_blank_html"), target: "_blank"),
|
||||
firefox: link_to(
|
||||
t("layouts.application.firefox"), "https://www.mozilla.org/firefox", title: t("shared.target_blank_html"), target: "_blank")
|
||||
).html_safe %>
|
||||
</p>
|
||||
</div>
|
||||
<% end %>
|
||||
<![endif]-->
|
||||
|
||||
<%= render 'layouts/flash' %>
|
||||
|
||||
<%= yield %>
|
||||
<div class="push"></div>
|
||||
</div>
|
||||
</body>
|
||||
<!--[if lt IE 9]>
|
||||
<%= javascript_include_tag "ie_lt9" %>
|
||||
<![endif]-->
|
||||
</html>
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
<%= raw t '.motivation' %>
|
||||
|
||||
<%= link_to t('.dashboard'), '#', class: 'button' %>
|
||||
<%= link_to t('.dashboard'), proposal_dashboard_index_path(@proposal), class: 'button' if can? :dashboard, @proposal %>
|
||||
<%= link_to t('.publish'), publish_proposal_path(@proposal), method: :patch, class: 'button' if can? :publish, @proposal %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -27,14 +27,16 @@
|
||||
description: @proposal.summary
|
||||
} %>
|
||||
|
||||
<% if can? :dashboard, @proposal %>
|
||||
<div class="callout light">
|
||||
<p class="centered">
|
||||
<strong><%= t '.improve_it' %></strong>
|
||||
</p>
|
||||
<div class="centered">
|
||||
<%= link_to t('.dashboard'), '#', class: 'button' %>
|
||||
<%= link_to t('.dashboard'), proposal_dashboard_index_path(@proposal), class: 'button' %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<% if @proposal_improvement_path.present? %>
|
||||
<div class="callout highlight margin-top text-center">
|
||||
|
||||
68
app/views/proposals_dashboard/index.html.erb
Normal file
68
app/views/proposals_dashboard/index.html.erb
Normal file
@@ -0,0 +1,68 @@
|
||||
<div class="proposals-dashboard">
|
||||
<div class="column-wrapper">
|
||||
<div class="left-column">
|
||||
<div class="state-box">
|
||||
<div class="logo"></div>
|
||||
<% if proposal.published? %>
|
||||
<div class="status published"><%= t '.published' %></div>
|
||||
<% end %>
|
||||
|
||||
<% if proposal.draft? %>
|
||||
<div class="status draft"><%= t '.draft' %></div>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="menu">
|
||||
<!--
|
||||
<div class="menu-title"><span class="icon-user"></span> Progreso</div>
|
||||
<a href='#' class="menu-entry">Meta actual</a>
|
||||
<a href='#' class="menu-entry">Acciones</a>
|
||||
<a href='#' class="menu-entry">Feed</a>
|
||||
<a href='#' class="menu-entry">Ruta</a>
|
||||
|
||||
<div class="menu-title selected"><span class="icon-user"></span> Recursos</div>
|
||||
<a href='#' class="menu-entry selected">Kit de difusión</a>
|
||||
<a href='#' class="menu-entry">Encuestas</a>
|
||||
<a href='#' class="menu-entry">Testimonios</a>
|
||||
<a href='#' class="menu-entry">Widget</a>
|
||||
|
||||
<div class="menu-title"><span class="icon-user"></span> Comunidad</div>
|
||||
<a href='#' class="menu-entry">Equipo impulsor</a>
|
||||
<a href='#' class="menu-entry">Mensajes</a>
|
||||
<a href='#' class="menu-entry">Temas</a>
|
||||
-->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="right-column">
|
||||
<!--
|
||||
<div class="progress-info">
|
||||
<div class="cell-data">
|
||||
<div class="caption">Apoyos</div>
|
||||
<div class="value">5.300</div>
|
||||
</div>
|
||||
<div class="cell-data">
|
||||
<div class="caption">Acciones realizadas</div>
|
||||
<div class="value">3/4</div>
|
||||
</div>
|
||||
<div class="cell-data">
|
||||
<div class="caption">Seguidores</div>
|
||||
<div class="value">3.403</div>
|
||||
</div>
|
||||
<div class="cell-data">
|
||||
<div class="caption">Meta actual</div>
|
||||
<div class="value">10.000</div>
|
||||
</div>
|
||||
<div class="cell-data">
|
||||
<div class="caption">Recursos activos</div>
|
||||
<div class="value">5/10</div>
|
||||
</div>
|
||||
<div class="cell-data">
|
||||
<div class="caption">Notificaciones</div>
|
||||
<div class="value">3</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="body">body</div>
|
||||
-->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -486,6 +486,10 @@ en:
|
||||
update:
|
||||
form:
|
||||
submit_button: Save changes
|
||||
proposals_dashboard:
|
||||
index:
|
||||
draft: Draft
|
||||
published: Published
|
||||
polls:
|
||||
all: "All"
|
||||
no_dates: "no date assigned"
|
||||
|
||||
@@ -486,6 +486,10 @@ es:
|
||||
update:
|
||||
form:
|
||||
submit_button: Guardar cambios
|
||||
proposals_dashboard:
|
||||
index:
|
||||
draft: Borrador
|
||||
published: Publicada
|
||||
polls:
|
||||
all: "Todas"
|
||||
no_dates: "sin fecha asignada"
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
resources :proposals do
|
||||
resources :proposals_dashboard, as: :dashboard, path: :dashboard, only: %i[index]
|
||||
|
||||
member do
|
||||
post :vote
|
||||
post :vote_featured
|
||||
|
||||
Reference in New Issue
Block a user