merges master and fixes conflicts

This commit is contained in:
kikito
2015-08-18 09:35:13 +02:00
80 changed files with 18565 additions and 128 deletions

Binary file not shown.

View File

@@ -21,4 +21,5 @@
<glyph unicode="&#108;" d="M477 350c0-7-2-14-8-19l-206-207-39-39c-6-5-12-8-20-8-7 0-14 3-19 8l-142 142c-6 6-8 12-8 20 0 7 2 14 8 19l38 39c6 5 12 8 20 8 7 0 14-3 19-8l84-84 188 188c5 5 12 8 19 8 8 0 14-3 20-8l38-39c6-6 8-12 8-20z"/>
<glyph unicode="&#109;" d="M140 73l26 26-67 67-26-26 0-30 37 0 0-37z m150 265c0 4-2 7-7 7-1 0-3-1-4-2l-155-155c-2-2-2-3-2-5 0-4 2-6 6-6 2 0 4 0 5 2l155 154c1 2 2 3 2 5z m-16 55l119-119-238-237-118 0 0 118z m195-27c0-10-3-19-10-26l-48-47-118 118 47 48c7 7 15 10 26 10 10 0 18-3 26-10l67-67c7-8 10-16 10-26z"/>
<glyph unicode="&#110;" d="M494 327c0-4-3-9-8-14l-103-101 24-143c0-1 0-3 0-5 0-4-1-8-3-10-2-3-4-5-8-5-4 0-8 2-12 4l-128 67-128-67c-4-2-8-4-12-4-4 0-7 2-9 5-2 2-3 6-3 10 0 1 0 3 1 5l24 143-104 101c-4 6-7 10-7 14 0 7 6 12 16 13l144 21 64 130c4 8 8 12 14 12 6 0 10-4 14-12l64-130 144-21c10-1 16-6 16-13z"/>
<glyph unicode="&#112;" d="M256 448c-96 0-208-64-256-192 48-96 144-160 256-160 112 0 208 64 256 160-48 128-160 192-256 192z m0-320c-96 0-176 64-192 128 16 64 96 128 192 128 96 0 176-64 192-128-16-64-96-128-192-128z m0 224c-10 0-19-2-28-5 17-7 28-24 28-43 0-27-21-48-48-48-19 0-36 11-43 28-3-9-5-18-5-28 0-53 43-96 96-96 53 0 96 43 96 96 0 53-43 96-96 96z"/>
</font></defs></svg>

Before

Width:  |  Height:  |  Size: 8.0 KiB

After

Width:  |  Height:  |  Size: 8.3 KiB

Binary file not shown.

Binary file not shown.

View File

@@ -17,6 +17,10 @@
//= require ckeditor/init
//= require social-share-button
//= require initial
//= require ahoy
//= require d3
//= require c3
//= require c3ext
//= require app
//= require_tree .
@@ -25,6 +29,7 @@ var initialize_modules = function() {
App.Users.initialize();
App.Votes.initialize();
App.Tags.initialize();
App.Stats.initialize();
};
$(function(){

View File

@@ -0,0 +1,11 @@
# Helper for generate C3.js graphs
#----------------------------------------------------------------------
buildGraph = (el) ->
url = $(el).data 'graph'
conf = bindto: el, data: {x: 'x', url: url, mimeType: 'json'}, axis: { x: {type: 'timeseries',tick: { format: '%Y-%m-%d' } }}
graph = c3.generate conf
App.Stats =
initialize: ->
buildGraph(g) for g in $("[data-graph]")

View File

@@ -0,0 +1,153 @@
// Table of Contents
//
// 01. Global styles
// 02. Sidebar
// 03. List elements
//
// 01. Global styles
// - - - - - - - - - - - - - - - - - - - - - - - - -
body.admin {
background: white;
h2 {
font-size: rem-calc(24);
font-weight: bold;
}
form {
.button {
margin-top: 0;
}
}
.button.secondary {
margin-right: rem-calc(12);
}
.button.create {
background: #EFD90C;
color: $text;
&:hover {
background: #BDAB09;
}
}
.admin-content {
margin-top: rem-calc(24);
}
.is-featured {
margin-top: rem-calc(36);
}
}
// 02. Sidebar
// - - - - - - - - - - - - - - - - - - - - - - - - -
.admin-sidebar {
margin-left: rem-calc(-15);
margin-top: rem-calc(-48);
ul {
list-style-type: none;
margin-left: 0;
padding: 0;
[class^="icon-"] {
display: inline-block;
font-size: rem-calc(24);
padding-right: rem-calc(24);
padding-top: rem-calc(4);
}
li {
background: #2E343F;
border-bottom: 1px solid #292f39;
border-top: 1px solid #353c49;
margin: 0;
outline: 0;
&:first-child {
background: #2B3139;
color: rgba(255,255,255,0.3);
padding: rem-calc(24) rem-calc(12);
text-transform: uppercase;
}
&.active{
background: #373D47;
a:not(.button) {
color: white;
}
}
}
li a:not(.button) {
color: rgba(255,255,255,0.3);
line-height: rem-calc(48);
padding-left: rem-calc(12);
vertical-align: top;
&:hover {
color: white;
}
}
}
}
// 03. List elements
// - - - - - - - - - - - - - - - - - - - - - - - - -
.admin-list {
list-style-type: none;
margin: 0;
form {
clear: both;
.checkbox {
font-size: rem-calc(12);
}
}
li {
border-bottom: 1px solid #E7E9EC;
font-size: rem-calc(14);
min-height: rem-calc(72);
padding: rem-calc(12);
&:first-child {
border-top: 1px solid #E7E9EC;
}
&:nth-child(odd) {
background: #F0F2F6;
}
}
.tag {
float: left;
font-size: rem-calc(18);
padding: 0;
}
.button {
margin: 0;
}
}
.delete {
border-bottom: 1px dotted #CF2A0E;
color: #F04124;
font-size: rem-calc(11);
margin-right: rem-calc(12);
&:hover, &:active, &:focus {
border: 0;
color: #cf2a0e;
}
}

View File

@@ -6,5 +6,7 @@
@import "fonts";
@import "icons";
@import "variables";
@import "admin";
@import "participacion";
@import "debates";
@import "c3";

View File

@@ -138,10 +138,6 @@
// 02. Index
// - - - - - - - - - - - - - - - - - - - - - - - - -
.featured-debates {
margin-top: rem-calc(23);
}
.debate-featured {
.panel {
@@ -244,7 +240,6 @@
.debates-list {
margin-bottom: rem-calc(48);
margin-top: rem-calc(24);
}
.debate {

View File

@@ -79,3 +79,6 @@
.icon-star:before {
content: "n";
}
.icon-eye:before {
content: "p";
}

View File

@@ -10,6 +10,7 @@
// 08. Forms
// 09. Alerts
// 10. User account
// 11. Filters
//
// 01. Variables
@@ -111,7 +112,6 @@ h1, h2, h3, h4, h5, h6 {
}
.sidebar {
margin-top: rem-calc(24);
margin-bottom: rem-calc(48);
}
@@ -585,3 +585,36 @@ form {
}
}
}
// 11. Filters
// - - - - - - - - - - - - - - - - - - - - - - - - -
.filters {
h2 {
display: inline-block;
font-size: rem-calc(24);
margin: rem-calc(24) 0;
}
select {
height: auto;
margin: rem-calc(24) rem-calc(6);
min-width: rem-calc(180);
outline: 0;
padding: rem-calc(12);
width: auto;
optgroup {
font-size: rem-calc(14);
}
option {
&:after {
content: "a";
font-family: "icons";
}
}
}
}

View File

@@ -0,0 +1,32 @@
class Admin::OfficialsController < Admin::BaseController
def index
@officials = User.officials.page(params[:page])
end
def search
@users = User.with_email(params[:email]).page(params[:page])
end
def edit
@user = User.find(params[:id])
end
def update
@user = User.find(params[:id])
@user.update(user_params)
redirect_to admin_officials_path, notice: t("admin.officials.flash.official_updated")
end
def destroy
@official = User.officials.find(params[:id])
@official.remove_official_position!
redirect_to admin_officials_path, notice: t("admin.officials.flash.official_destroyed")
end
private
def user_params
params.require(:user).permit(:official_position, :official_level)
end
end

View File

@@ -0,0 +1,17 @@
class Admin::SettingsController < Admin::BaseController
def index
@settings = Setting.all
end
def update
@setting = Setting.find(params[:id])
@setting.update(settings_params)
redirect_to admin_settings_path, notice: t("admin.settings.flash.updated")
end
private
def settings_params
params.require(:setting).permit(:value)
end
end

View File

@@ -0,0 +1,13 @@
class Api::ApiController < ApplicationController
before_action :authenticate_user!
protect_from_forgery with: :null_session
skip_authorization_check
before_action :verify_administrator
private
def verify_administrator
raise CanCan::AccessDenied unless current_user.try(:administrator?)
end
end

View File

@@ -0,0 +1,22 @@
class Api::StatsController < Api::ApiController
def show
unless params[:events].present? || params[:visits].present?
return render json: {}, status: :bad_request
end
ds = Ahoy::DataSource.new
if params[:events].present?
event_types = params[:events].split ','
event_types.each do |event|
ds.add event.titleize, Ahoy::Event.where(name: event).group_by_day(:time).count
end
end
if params[:visits].present?
ds.add "Visits", Visit.group_by_day(:started_at).count
end
render json: ds.build
end
end

View File

@@ -26,7 +26,9 @@ class DebatesController < ApplicationController
def create
@debate = Debate.new(debate_params)
@debate.author = current_user
if @debate.save_with_captcha
ahoy.track :debate_created, debate_id: @debate.id
redirect_to @debate, notice: t('flash.actions.create.notice', resource_name: 'Debate')
else
load_featured_tags

View File

@@ -0,0 +1,14 @@
class StatsController < ApplicationController
skip_authorization_check
before_action :verify_administrator
def show
@event_types = Ahoy::Event.select(:name).uniq.pluck(:name)
end
private
def verify_administrator
raise CanCan::AccessDenied unless current_user.try(:administrator?)
end
end

View File

@@ -4,6 +4,14 @@ module AdminHelper
render "/#{namespace}/menu"
end
def official_level_options
options = []
(0..5).each do |i|
options << [[t("admin.officials.level_#{i}"), Setting.value_for("official_level_#{i}_name")].compact.join(': '), i]
end
options
end
private
def namespace

View File

@@ -0,0 +1,16 @@
module StatsHelper
def events_chart_tag(events, opt={})
events = events.join(',') if events.is_a? Array
opt[:data] ||= {}
opt[:data][:graph] = api_stats_path(events: events)
content_tag :div, "", opt
end
def visits_chart_tag(opt={})
events = events.join(',') if events.is_a? Array
opt[:data] ||= {}
opt[:data][:graph] = api_stats_path(visits: true)
content_tag :div, "", opt
end
end

View File

@@ -0,0 +1,49 @@
# This class combines multiple collections with shared keys into a
# hash of collections compatible with C3.js charts
#----------------------------------------------------------------------
module Ahoy
class DataSource
# Adds a collection with the datasource
# Name is the name of the collection and will be showed in the
# chart
def add(name, collection)
collections.push data: collection, name: name
collection.each{ |k,v| add_key k }
end
def build
data = { x: [] }
keys.each do |k|
# Add the key with a valid date format
data[:x].push k.strftime("%Y-%m-%d")
# Add the value for each column, or 0 if not present
collections.each do |col|
data[col[:name]] ||= []
count = col[:data][k] || 0
data[col[:name]].push count
end
end
return data
end
private
def collections
@collections ||= []
end
def keys
@keys ||= []
end
def add_key(key)
keys.push(key) unless keys.include? key
end
end
end

8
app/models/ahoy/event.rb Normal file
View File

@@ -0,0 +1,8 @@
module Ahoy
class Event < ActiveRecord::Base
self.table_name = "ahoy_events"
belongs_to :visit
belongs_to :user
end
end

View File

@@ -22,6 +22,9 @@ class Debate < ActiveRecord::Base
before_validation :sanitize_description
before_validation :sanitize_tag_list
# Ahoy setup
visitable # Ahoy will automatically assign visit_id on create
def self.search(params)
if params[:tag]
tagged_with(params[:tag])

7
app/models/setting.rb Normal file
View File

@@ -0,0 +1,7 @@
class Setting < ActiveRecord::Base
default_scope { order(key: :desc) }
def self.value_for(key)
where(key: key).pluck(:value).first
end
end

View File

@@ -12,6 +12,7 @@ class User < ActiveRecord::Base
validates :first_name, presence: true, if: :use_first_name?
validates :last_name, presence: true, if: :use_last_name?
validates :nickname, presence: true, if: :use_nickname?
validates :official_level, inclusion: {in: 0..5}
validates_associated :organization, message: false
@@ -20,9 +21,7 @@ class User < ActiveRecord::Base
scope :administrators, -> { joins(:administrators) }
scope :moderators, -> { joins(:moderator) }
scope :organizations, -> { joins(:organization) }
attr_accessor :organization_name
attr_accessor :is_organization
scope :officials, -> { where("official_level > 0") }
def name
return nickname if use_nickname?
@@ -47,6 +46,23 @@ class User < ActiveRecord::Base
organization.present?
end
def official?
official_level && official_level > 0
end
def add_official_position!(position, level)
return if position.blank? || level.blank?
update official_position: position, official_level: level.to_i
end
def remove_official_position!
update official_position: nil, official_level: 0
end
def self.with_email(e)
e.present? ? where(email: e) : none
end
private
def use_first_name?
!organization? && !use_nickname?

4
app/models/visit.rb Normal file
View File

@@ -0,0 +1,4 @@
class Visit < ActiveRecord::Base
has_many :ahoy_events, class_name: "Ahoy::Event"
belongs_to :user
end

View File

@@ -1,6 +1,56 @@
<ul id="admin_menu">
<li><%= link_to t('admin.menu.debate_topics'), admin_tags_path %></li>
<li><%= link_to t('admin.menu.hidden_debates'), admin_debates_path %></li>
<li><%= link_to t('admin.menu.hidden_comments'), admin_comments_path %></li>
<li><%= link_to t('admin.menu.organizations'), admin_organizations_path %></li>
</ul>
<nav class="admin-sidebar">
<ul id="admin_menu">
<li>
<%= t("admin.dashboard.index.title") %>
</li>
<li <%= 'class=active' if controller_name == 'tags' %>>
<%= link_to admin_tags_path do %>
<i class="icon-comment-quotes"></i>
<%= t('admin.menu.debate_topics') %>
<% end %>
</li>
<li <%= 'class=active' if controller_name == 'debates' %>>
<%= link_to admin_debates_path do %>
<i class="icon-eye"></i>
<%= t('admin.menu.hidden_debates') %>
<% end %>
</li>
<li <%= 'class=active' if controller_name == 'comments' %>>
<%= link_to admin_comments_path do %>
<i class="icon-chat-bubble-two"></i>
<%= t('admin.menu.hidden_comments') %>
<% end %>
</li>
<li <%= 'class=active' if controller_name == 'organizations' %>>
<%= link_to admin_organizations_path do %>
<i class="icon-comment-quotes"></i>
<%= t('admin.menu.organizations') %>
<% end %>
</li>
<li <%= 'class=active' if controller_name == 'officials' %>>
<%= link_to admin_officials_path do %>
<i class="icon-chat-bubble-two"></i>
<%= t('admin.menu.officials') %>
<% end %>
</li>
<li <%= 'class=active' if controller_name == 'settings' %>>
<%= link_to admin_settings_path do %>
<i class="icon-chat-bubble-two"></i>
<%= t('admin.menu.settings') %>
<% end %>
</li>
<li <%= 'class=active' if controller_name == 'stats' %>>
<%= link_to stats_path do %>
<i class="icon-chat-bubble-two"></i>
<%= t('admin.menu.stats') %>
<% end %>
</li>
</ul>
</nav>

View File

@@ -1,14 +1,18 @@
<div class="left">
<h1><%= t("admin.comments.index.title") %></h1>
<h2><%= t("admin.comments.index.title") %></h2>
<ul>
<% @comments.each do |comment| %>
<li id="<%= dom_id(comment) %>">
<%= comment.body %>
<%= link_to t("admin.actions.restore"), restore_admin_comment_path(comment),
method: :put, data: { confirm: t("admin.actions.confirm") } %>
</li>
<% end %>
</ul>
</div>
<ul class="admin-list">
<% @comments.each do |comment| %>
<li id="<%= dom_id(comment) %>">
<div class="row">
<div class="small-12 medium-10 column">
<%= comment.body %>
</div>
<div class="small-12 medium-2 column">
<%= link_to t("admin.actions.restore"), restore_admin_comment_path(comment),
method: :put, data: { confirm: t("admin.actions.confirm") },
class: "button radius tiny success right" %>
</div>
</div>
</li>
<% end %>
</ul>

View File

@@ -1 +1,5 @@
<h1><%= t("admin.dashboard.index.title") %></h1>
<h2><%= t("admin.dashboard.index.title") %></h2>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.</p>
<p>Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem.</p>

View File

@@ -1,13 +1,13 @@
<div class="left">
<h1><%= t("admin.debates.index.title") %></h1>
<h2><%= t("admin.debates.index.title") %></h2>
<ul>
<% @debates.each do |debate| %>
<%= link_to admin_debate_path(debate) do %>
<li id="<%= dom_id(debate) %>">
<%= link_to debate.title, admin_debate_path(debate) %>
</li>
<% end %>
<% end %>
</ul>
</div>
<ul class="admin-list">
<% @debates.each do |debate| %>
<li id="<%= dom_id(debate) %>">
<%= link_to debate.title, admin_debate_path(debate) %>
<%= link_to t("admin.actions.restore"), restore_admin_debate_path(debate),
method: :put, data: { confirm: t("admin.actions.confirm") },
class: "button radius tiny success right" %>
</li>
<% end %>
</ul>

View File

@@ -1,13 +1,12 @@
<div class="left">
<h1><%= t("admin.debates.index.title") %></h1>
<h2><%= t("admin.debates.index.title") %></h2>
<div>
<div><%= @debate.title %></div>
<div><%= @debate.description %></div>
<h3><%= @debate.title %></h3>
<div>
<%= link_to t('admin.actions.restore'), restore_admin_debate_path(@debate),
method: :put, data: { confirm: t('admin.actions.confirm') } %>
</div>
</div>
</div>
<div><%= @debate.description %></div>
<%= link_to t("admin.debates.show.back"), admin_debates_path,
class: "button radius small secondary" %>
<%= link_to t("admin.actions.restore"), restore_admin_debate_path(@debate),
method: :put, data: { confirm: t("admin.actions.confirm") },
class: "button radius small success" %>

View File

@@ -0,0 +1,14 @@
<h1><%= t("admin.officials.edit.title") %></h1>
<%= @user.name %> (<%= @user.email %>)
<%= form_for @user, url: admin_official_path(@user) do |f| %>
<%= f.text_field :official_position %>
<%= f.select :official_level, official_level_options %>
<%= f.submit %>
<% if @user.official? %>
<%= link_to t("admin.officials.edit.destroy"), admin_official_path(@user), method: :delete, class: 'button tiny alert' %>
<% else %>
<%= link_to t("admin.officials.edit.cancel"), admin_officials_path, class: 'button tiny alert' %>
<% end %>
<% end %>

View File

@@ -0,0 +1,25 @@
<h1><%= t("admin.officials.index.title") %></h1>
<div>
<%= form_for(User.new, url: search_admin_officials_path, as: :user, method: :get) do |f| %>
<%= text_field_tag :email, "", label: false, placeholder: t("admin.officials.index.search_email_placeholder") %>
<%= f.submit t("admin.officials.index.search") %>
<% end %>
</div>
<div>
<%= page_entries_info @officials %>
</div>
<div>
<% @officials.each do |official| %>
<%= link_to official.name, edit_admin_official_path(official) %>
<%= official.official_position %>
<%= t("admin.officials.level_#{official.official_level}") %>
<br/><br/>
<% end %>
</div>
<div>
<%= paginate @officials %>
</div>

View File

@@ -0,0 +1,21 @@
<h1><%= t("admin.officials.search.title") %></h1>
<div>
<%= form_for(User.new, url: search_admin_officials_path, as: :user, method: :get) do |f| %>
<%= text_field_tag :email, "", label: false, placeholder: t("admin.officials.index.search_email_placeholder") %>
<%= f.submit t("admin.officials.search.search") %>
<% end %>
</div>
<div>
<%= page_entries_info @users %>
</div>
<div>
<% @users.each do |user| %>
<%= link_to user.name, edit_admin_official_path(user) %>
<%= user.official_position %>
<%= t("admin.officials.level_#{user.official_level}") %>
<%= link_to user.official? ? t("admin.officials.search.edit_official") : t("admin.officials.search.make_official"), edit_admin_official_path(user) %>
<% end %>
</div>

View File

@@ -0,0 +1,15 @@
<h1><%= t("admin.settings.index.title") %></h1>
<ul>
<% @settings.each do |setting| %>
<li>
<strong><%= setting.key.classify %></strong>
<%= form_for(setting, url: admin_setting_path(setting), html: { id: "edit_#{dom_id(setting)}"}) do |f| %>
<%= f.text_field :value, label: false, id: dom_id(setting) %>
<%= f.submit(class: "button radius tiny") %>
<% end %>
</li>
<% end %>
</ul>

View File

@@ -1,29 +1,46 @@
<div class="left">
<h1><%= t("admin.tags.index.add_tag") %></h1>
<h2><%= t("admin.tags.index.add_tag") %></h2>
<%= form_for(@tag, url: admin_tags_path, as: :tag) do |f| %>
<%= f.text_field :name, placeholder: t("admin.tags.name.placeholder") %>
<%= f.check_box :featured, label: false %>
<%= t("admin.tags.mark_as_featured") %>
<%= f.submit(class: "button radius small") %>
<% end %>
<%= form_for(@tag, url: admin_tags_path, as: :tag) do |f| %>
<div class="row">
<div class="small-12 medium-6 column">
<%= f.label :name, t("admin.tags.name.placeholder") %>
<%= f.text_field :name, placeholder: t("admin.tags.name.placeholder"), label: false %>
</div>
<h1><%= t("admin.tags.index.title") %></h1>
<div class="is-featured small-12 medium-6 column">
<%= f.label :featured do %>
<%= f.check_box :featured, label: false %>
<span class="checkbox"><%= t("admin.tags.mark_as_featured") %></span>
<% end %>
</div>
</div>
<ul>
<% @tags.each do |tag| %>
<li>
<strong><%= tag.name %></strong>
<%= f.submit(class: "button radius create") %>
<%= form_for(tag, url: admin_tag_path(tag), as: :tag, html: { id: "edit_tag_#{tag.id}"}) do |f| %>
<%= f.check_box :featured, label: false, id: "tag_featured_#{tag.id}" %>
<%= t("admin.tags.mark_as_featured") %>
<%= f.submit(class: "button radius tiny") %>
<%= link_to t("admin.tags.destroy"), admin_tag_path(tag), method: :delete, class: 'button tiny alert' %>
<% end %>
<h3><%= t("admin.tags.index.title") %></h3>
<ul class="admin-list">
<% @tags.each do |tag| %>
<li>
<span class="tag"><%= tag.name %></span>
<%= form_for(tag,
url: admin_tag_path(tag),
as: :tag,
html: { id: "edit_tag_#{tag.id}", class: "text-right"}) do |f| %>
<%= f.label "featured_#{tag.id}" do %>
<%= f.check_box :featured, label: false, id: "tag_featured_#{tag.id}", class: "left" %>
<span class="checkbox left"><%= t("admin.tags.mark_as_featured") %></span>
<% end %>
</li>
<% end %>
</ul>
</div>
<%= f.submit(class: "button radius tiny success") %>
<br>
<%= link_to t("admin.tags.destroy"), admin_tag_path(tag), method: :delete, class: "delete" %>
<% end %>
</li>
<% end %>
</ul>

View File

@@ -1,6 +1,79 @@
<section role="main">
<!-- Filters -->
<div class="filters row">
<div class="small-12 column">
<h2><%= t("debates.index.showing") %></h2>
<select class="inline-block">
<option value="filter_debates">
<%= t("debates.index.filter_debates") %>
</option>
<option value="filter_initiatives">
<%= t("debates.index.filter_initiatives") %>
</option>
<option value="filter_debates_and_initiatives">
<%= t("debates.index.filter_debates_and_initiatives") %>
</option>
</select>
<select class="inline-block">
<option value="filter_news">
<%= t("debates.index.filter_news") %>
</option>
<option value="filter_votes">
<%= t("debates.index.filter_votes") %>
</option>
<option value="filter_rated">
<%= t("debates.index.filter_rated") %>
</option>
</select>
</div>
</div>
<!-- /. Filters -->
<!-- Filter topic results -->
<div class="filters row">
<div class="small-12 column">
<h2><%= t("debates.index.showing") %></h2>
<select class="inline-block">
<option value="filter_debates">
<%= t("debates.index.filter_debates") %>
</option>
<option value="filter_initiatives">
<%= t("debates.index.filter_initiatives") %>
</option>
<option value="filter_debates_and_initiatives">
<%= t("debates.index.filter_debates_and_initiatives") %>
</option>
</select>
<select class="inline-block">
<option value="filter_news">
<%= t("debates.index.filter_news") %>
</option>
<option value="filter_votes">
<%= t("debates.index.filter_votes") %>
</option>
<option value="filter_rated">
<%= t("debates.index.filter_rated") %>
</option>
</select>
<h2><%= t("debates.index.tag") %></h2>
<select class="inline-block">
<option value="">Lista de temas</option>
</select>
<h2>(43)</h2>
</div>
</div>
<!-- /. Filter topic results -->
<div class="row">
<div id="debates" class="small-12 medium-9 column debates-list">
<div id="debates" class="debates-list small-12 medium-9 column">
<%= render @debates %>
</div>
<div class="small-12 medium-3 column">
@@ -10,4 +83,4 @@
</aside>
</div>
</div>
</section>
</section>

View File

@@ -10,12 +10,6 @@
<% end %>
]
</div>
<div class="external-links">
<%= link_to t("layouts.header.participation"), root_path, class: "selected" %>&nbsp;|
<%= link_to t("layouts.header.external_link_transparency"), "#" %>&nbsp;|
<%= link_to t("layouts.header.external_link_opendata"), "#" %>&nbsp;|
<%= link_to t("layouts.header.external_link_blog"), "#" %>
</div>
</div>
</section>
@@ -25,7 +19,7 @@
<li class="name">
<%= link_to root_path do %>
<%= image_tag('header_logo_madrid.png', class: 'left', size: '96x96') %>
<%= t("layouts.header.open_gov", open: "<strong>#{t('layouts.header.open')}</strong>").html_safe %> | <span><%= t("layouts.header.participation") %></span>
<%= t("layouts.header.open_gov", open: "<strong>#{t('layouts.header.open')}</strong>").html_safe %> | <span><%= t("admin.dashboard.index.title") %></span>
<% end %>
</li>
<li class="toggle-topbar menu-icon"><a href="#"><span><%= t("layouts.header.menu") %></span></a></li>

View File

@@ -12,22 +12,26 @@
<%= csrf_meta_tags %>
</head>
<body>
<body class="admin">
<%= render 'layouts/admin_header' %>
<% if notice %>
<p class="alert-box success"><%= notice %></p>
<% end %>
<div class="row">
<% if alert %>
<p class="alert-box"><%= alert %></p>
<% end %>
<div class="small-12 medium-3 column">
<%= side_menu %>
</div>
<div class="left" style="padding:50px;">
<%= side_menu %>
<div class="admin-content small-12 medium-9 column">
<% if notice %>
<div class="alert-box radius success"><%= notice %></div>
<% end %>
<% if alert %>
<div class="alert-box radius alert"><%= alert %></div>
<% end %>
<%= yield %>
</div>
</div>
<%= yield %>
</body>
</html>
</html>

View File

@@ -26,4 +26,4 @@
<%= render 'layouts/footer' %>
</body>
</html>
</html>

View File

@@ -0,0 +1,13 @@
<h1>Stats</h1>
<h3>Visits</h3>
<%= visits_chart_tag id: "visits" %>
<h3>Combined</h3>
<%= events_chart_tag @event_types, id: 'combined' %>
<% @event_types.each do |event_type| %>
<h3><%= event_type.titleize %></h3>
<%= events_chart_tag event_type %>
<% end %>

View File

@@ -1,5 +1,10 @@
<section role="main">
<div id="featured-debates" class="featured-debates row">
<div class="filters row">
<div class="small-12 column">
<h2><%= t("welcome.featured_debates") %></h2>
</div>
</div>
<div id="featured-debates" class="row">
<%= render partial: "featured_debate", collection: @featured_debates %>
</div>
</section>
</section>