Merge branch 'master' into budget

This commit is contained in:
Juanjo Bazán
2016-06-02 12:35:44 +02:00
88 changed files with 1519 additions and 598 deletions

View File

@@ -1 +1 @@
2.2.3
2.3.0

View File

@@ -74,9 +74,9 @@ GEM
bcrypt (3.1.11)
browser (2.1.0)
builder (3.2.2)
bullet (5.0.0)
bullet (5.1.0)
activesupport (>= 3.0.0)
uniform_notifier (~> 1.9.0)
uniform_notifier (~> 1.10.0)
byebug (9.0.4)
cancancan (1.14.0)
capistrano (3.4.1)
@@ -228,9 +228,9 @@ GEM
nokogiri (>= 1.5.9)
mail (2.6.4)
mime-types (>= 1.16, < 4)
mime-types (3.0)
mime-types (3.1)
mime-types-data (~> 3.2015)
mime-types-data (3.2016.0221)
mime-types-data (3.2016.0521)
mini_portile2 (2.0.0)
minitest (5.9.0)
multi_json (1.12.1)
@@ -275,7 +275,7 @@ GEM
parser (2.3.0.6)
ast (~> 2.2)
pg (0.18.4)
pg_search (1.0.5)
pg_search (1.0.6)
activerecord (>= 3.1)
activesupport (>= 3.1)
arel
@@ -413,7 +413,7 @@ GEM
unicorn (5.1.0)
kgio (~> 2.6)
raindrops (~> 0.7)
uniform_notifier (1.9.0)
uniform_notifier (1.10.0)
user_agent_parser (2.3.0)
uuidtools (2.1.5)
warden (1.2.6)

View File

@@ -39,7 +39,7 @@ cp config/secrets.yml.example config/secrets.yml
rake db:create
bin/rake db:setup
bin/rake db:dev_seed
RAILS_ENV=test bin/rake db:setup
RAILS_ENV=test rake db:setup
```
Run the app locally:

View File

@@ -39,7 +39,7 @@ cp config/secrets.yml.example config/secrets.yml
rake db:create
bin/rake db:setup
bin/rake db:dev_seed
RAILS_ENV=test bin/rake db:setup
RAILS_ENV=test rake db:setup
```
Para ejecutar la aplicación en local:

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

View File

@@ -23,6 +23,8 @@ App.AdvancedSearch =
$('.js-calendar').datepicker
regional: locale
maxDate: "+0d"
$('.js-calendar-full').datepicker
regional: locale
initialize: ->
App.AdvancedSearch.init_calendar()

View File

@@ -44,6 +44,7 @@
//= require tracks
//= require valuation_spending_proposal_form
//= require embed_video
//= require banners
var initialize_modules = function() {
App.Comments.initialize();
@@ -63,6 +64,7 @@ var initialize_modules = function() {
App.Tracks.initialize();
App.ValuationSpendingProposalForm.initialize();
App.EmbedVideo.initialize();
App.Banners.initialize();
};
$(function(){

View File

@@ -0,0 +1,25 @@
App.Banners =
update_banner: (selector, text) ->
$(selector).html(text)
update_style: (selector, style) ->
$(selector).removeClass($(selector).attr("class"), true)
.addClass(style, true)
initialize: ->
$('[data-js-banner-title]').on
change: ->
App.Banners.update_banner("#js-banner-title", $(this).val())
$('[data-js-banner-description]').on
change: ->
App.Banners.update_banner("#js-banner-description", $(this).val())
$("#banner_style").on
change: ->
App.Banners.update_style("#js-banner-style", $(this).val())
$("#banner_image").on
change: ->
App.Banners.update_style("#js-banner-image", $(this).val())

View File

@@ -8,11 +8,27 @@
//
// 01. Global styles
// - - - - - - - - - - - - - - - - - - - - - - - - -
// -----------------
$admin-color: #CF3638;
body.admin {
header {
border: 0;
.top-links {
background: darken($admin-color, 15%);
}
}
.top-bar {
background: $admin-color !important;
height: auto;
}
form {
.button {
margin-top: 0;
}
@@ -27,48 +43,40 @@ body.admin {
table {
th {
text-align: left;
}
tr {
background: #f4f4f4;
background: white;
border: 1px solid $border;
&:nth-child(odd) {
background: white;
}
&:nth-child(even) {
background: #f0f0f0;
&:hover {
background: #f3f6f7;
}
}
td.small {
font-size: $small-font-size;
input[type="submit"] ~ a, a ~ a {
margin-left: $line-height/2;
margin-right: $line-height/2;
}
}
hr {
max-width: none;
}
.menu.simple li.active {
border-bottom: 2px solid $admin-color;
color: $admin-color;
}
#proposals {
width: 100% !important;
}
.dashboard {
margin-bottom: rem-calc(48);
ul, ol {
margin-left: rem-calc(12);
li {
font-size: rem-calc(15);
line-height: rem-calc(30);
margin-bottom: rem-calc(12);
}
}
p {
font-size: rem-calc(15);
line-height: rem-calc(30);
}
h3 {
font-weight: bold;
}
.accordion-title {
font-size: $base-font-size;
}
.button.secondary {
@@ -99,17 +107,37 @@ body.admin {
display: none;
}
.admin-content {
padding: $line-height !important;
}
@include breakpoint(medium) {
tr {
.on-hover {
display: none;
}
&:hover .on-hover {
display: inline;
}
}
}
// 02. Sidebar
// - - - - - - - - - - - - - - - - - - - - - - - - -
// -----------
.admin-sidebar {
border-right: 1px solid $border;
a {
color: white\9 !important;
@include breakpoint(medium) {
padding-bottom: $line-height*3;
}
ul {
list-style-type: none;
margin-bottom: 0;
margin-left: 0;
padding: 0;
@@ -120,83 +148,44 @@ body.admin {
padding-top: rem-calc(4);
padding-left: 12px\9 !important;
padding-right: 12px\9 !important;
vertical-align: middle;
}
li {
background: #2E343F;
border-bottom: 1px solid #292f39;
border-top: 1px solid #353c49;
background: white;
margin: 0;
outline: 0;
&:first-child {
&.active a {
background: #f3f6f7;
color: $admin-color;
font-weight: bold;
text-transform: uppercase;
}
&.active{
background: #373D47;
a:not(.button) {
color: white;
}
}
}
li a:not(.button) {
color: rgba(255,255,255,0.3);
li.section {
border-bottom: 1px dotted #d5d5d5;
border-top: 1px dotted #d5d5d5;
height: $line-height/2;
}
li a {
color: $text;
display: block;
line-height: rem-calc(48);
padding-left: rem-calc(12);
vertical-align: top;
&:hover {
color: white;
background: #f3f6f7;
text-decoration: none;
}
}
}
}
// 03. List elements
// - - - - - - - - - - - - - - - - - - - - - - - - -
.admin-list {
list-style-type: none;
margin: 0;
margin-bottom: rem-calc(48);
form {
clear: both;
.checkbox {
font-size: $small-font-size;
}
}
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;
@@ -239,14 +228,9 @@ body.admin {
font-style: italic;
}
.level {
font-size: rem-calc(12);
}
.official {
background-color: #e7e7e7;
border-radius: rem-calc(3);
font-size: rem-calc(12);
font-weight: normal;
padding: rem-calc(6) rem-calc(12);
}
@@ -262,13 +246,10 @@ body.admin {
.moderation-description {
max-height: rem-calc(65);
overflow: hidden;
max-width: rem-calc(590);
max-width: rem-calc(700);
&:hover {
cursor: text;
max-height: rem-calc(1000);
outline: 3px solid #ffbf47;
padding: rem-calc(12);
transition: max-height 0.9s;
-moz-transition: max-height 0.9s;
-webkit-transition: max-height 0.9s;
@@ -276,7 +257,7 @@ body.admin {
}
// 04. Stats
// - - - - - - - - - - - - - - - - - - - - - - - - -
// ---------
.stats {
background: white;
@@ -304,7 +285,7 @@ body.admin {
}
// 05. Management
// - - - - - - - - - - - - - - - - - - - - - - - - -
// --------------
.user-permissions {
@@ -337,8 +318,8 @@ body.admin {
border-radius: rem-calc(3);
font-size: rem-calc(16);
font-weight: normal;
margin-bottom: rem-calc(12);
padding: rem-calc(6) rem-calc(12);
margin: $line-height;
padding: $line-height/2;
strong {
font-size: rem-calc(18);

View File

@@ -51,7 +51,7 @@
border-right: 1px solid $dark;
tr th {
color: white;
color: $dark;
}
}

View File

@@ -17,6 +17,7 @@
// 15. Comments
// 16. Flags
// 17. Activity
// 18. Banners
//
// 01. Global styles
@@ -218,6 +219,10 @@ a {
float: left;
}
.no-max-width {
max-width: none;
}
// 02. Header
// ----------
@@ -1686,3 +1691,69 @@ table {
}
}
}
// 18. Banners
// -----------
.banner-style-one {
background-color: $brand;
}
.banner-style-two {
background-color: $budget;
}
.banner-style-three {
background-color: #33DADF;
}
@include breakpoint(large) {
.banner-img-one {
background-image: image-url('banners/banner1.png');
}
.banner-img-two {
background-image: image-url('banners/banner2.png');
}
.banner-img-three {
background-image: image-url('banners/banner3.png');
}
}
.banner-img-one, .banner-img-two, .banner-img-three {
background-position: bottom right;
background-repeat: no-repeat;
}
.banner-style-one, .banner-style-two, .banner-style-three {
margin: 0;
margin-bottom: $line-height;
h2, h3, a {
color: #eaeaf2;
}
h2 {
padding: $line-height/2;
padding-bottom: 0;
}
h3 {
padding: $line-height/2;
padding-top: 0;
}
a:hover h2, a:hover h3 {
color: #eaeaf2 !important;
text-decoration: none;
}
@include breakpoint(large) {
h3 {
width: 80%;
}
}
}

View File

@@ -8,6 +8,7 @@
@mixin logo {
color: white;
display: inline-block;
font-family: 'Lato' !important;
font-size: rem-calc(24);
font-weight: lighter;

View File

@@ -12,6 +12,8 @@
#print_link { display: none !important; }
#responsive-menu { display: none !important; }
.admin-sidebar { display: none !important; }
img.left { display: none !important; }

View File

@@ -0,0 +1,56 @@
class Admin::BannersController < Admin::BaseController
has_filters %w{all with_active with_inactive}, only: :index
before_action :find_banner, only: [:edit, :update, :destroy]
before_action :banner_styles, only: [:edit, :new, :create, :update]
before_action :banner_imgs, only: [:edit, :new, :create, :update]
respond_to :html, :js
load_and_authorize_resource
def index
@banners = Banner.send(@current_filter).page(params[:page])
end
def create
@banner = Banner.new(banner_params)
if @banner.save
redirect_to admin_banners_path
else
render :new
end
end
def update
@banner.assign_attributes(banner_params)
if @banner.update(banner_params)
redirect_to admin_banners_path
else
render :edit
end
end
def destroy
@banner.destroy
redirect_to admin_banners_path
end
private
def banner_params
params.require(:banner).permit(:title, :description, :target_url, :style, :image, :post_started_at, :post_ended_at)
end
def find_banner
@banner = Banner.find(params[:id])
end
def banner_styles
@banner_styles = Setting.all.banner_style.map { |banner_style| [banner_style.value, banner_style.key.split('.')[1]] }
end
def banner_imgs
@banner_imgs = Setting.all.banner_img.map { |banner_img| [banner_img.value, banner_img.key.split('.')[1]] }
end
end

View File

@@ -1,9 +1,11 @@
class Admin::SettingsController < Admin::BaseController
def index
all_settings = (Setting.all).group_by { |s| s.feature_flag? }
@settings = all_settings[false]
@feature_flags = all_settings[true]
all_settings = (Setting.all).group_by { |s| s.type }
@settings = all_settings['common']
@feature_flags = all_settings['feature']
@banner_styles = all_settings['banner-style']
@banner_imgs = all_settings['banner-img']
end
def update

View File

@@ -11,6 +11,8 @@ module CommentableActions
index_customization if index_customization.present?
@tag_cloud = tag_cloud
@banners = Banner.with_active
set_resource_votes(@resources)
set_resources_instance
end

View File

@@ -0,0 +1,5 @@
module BannersHelper
def has_banners
@banners.count > 0
end
end

View File

@@ -46,6 +46,8 @@ module Abilities
can [:hide, :update], Budget::Investment
can :valuate, Budget::Investment, budget: { valuating: true }
can :create, Budget::ValuatorAssignment
can [:search, :edit, :update, :create, :index, :destroy], Banner
end
end
end

20
app/models/banner.rb Normal file
View File

@@ -0,0 +1,20 @@
class Banner < ActiveRecord::Base
acts_as_paranoid column: :hidden_at
include ActsAsParanoidAliases
validates :title, presence: true,
length: { minimum: 2 }
validates :description, presence: true
validates :target_url, presence: true
validates :style, presence: true
validates :image, presence: true
validates :post_started_at, presence: true
validates :post_ended_at, presence: true
scope :with_active, -> {where("post_started_at <= ?", Time.now).
where("post_ended_at >= ?", Time.now) }
scope :with_inactive,-> {where("post_started_at > ? or post_ended_at < ?", Time.now, Time.now) }
end

View File

@@ -2,6 +2,20 @@ class Setting < ActiveRecord::Base
validates :key, presence: true, uniqueness: true
default_scope { order(id: :asc) }
scope :banner_style, -> { where("key ilike ?", "banner-style.%")}
scope :banner_img, -> { where("key ilike ?", "banner-img.%")}
def type
if feature_flag?
'feature'
elsif banner_style?
'banner-style'
elsif banner_img?
'banner-img'
else
'common'
end
end
def feature_flag?
key.start_with?('feature.')
@@ -11,6 +25,14 @@ class Setting < ActiveRecord::Base
feature_flag? && value.present?
end
def banner_style?
key.start_with?('banner-style.')
end
def banner_img?
key.start_with?('banner-img.')
end
class << self
def [](key)
where(key: key).pluck(:value).first.presence

View File

@@ -1,115 +1,103 @@
<nav class="admin-sidebar">
<ul id="admin_menu">
<li>
<%= link_to t("admin.dashboard.index.title"), admin_root_path %>
</li>
<li <%= "class=active" if controller_name == "tags" %>>
<%= link_to admin_tags_path do %>
<span class="icon-tag"></span>
<%= t("admin.menu.debate_topics") %>
<span class="icon-tag"></span><%= t("admin.menu.debate_topics") %>
<% end %>
</li>
<li <%= "class=active" if controller_name == "proposals" %>>
<%= link_to admin_proposals_path do %>
<span class="icon-proposals"></span>
<%= t("admin.menu.hidden_proposals") %>
<span class="icon-proposals"></span><%= t("admin.menu.hidden_proposals") %>
<% end %>
</li>
<% if feature?(:debates) %>
<li <%= "class=active" if controller_name == "debates" %>>
<%= link_to admin_debates_path do %>
<span class="icon-debates"></span>
<%= t("admin.menu.hidden_debates") %>
<span class="icon-debates"></span><%= t("admin.menu.hidden_debates") %>
<% end %>
</li>
<% end %>
<li <%= "class=active" if controller_name == "comments" %>>
<%= link_to admin_comments_path do %>
<span class="icon-comments"></span>
<%= t("admin.menu.hidden_comments") %>
<span class="icon-comments"></span><%= t("admin.menu.hidden_comments") %>
<% end %>
</li>
<% if feature?(:spending_proposals) %>
<li <%= "class=active" if controller_name == "spending_proposals" %>>
<%= link_to admin_spending_proposals_path do %>
<span class="icon-budget"></span>
<%= t("admin.menu.spending_proposals") %>
<span class="icon-budget"></span><%= t("admin.menu.spending_proposals") %>
<% end %>
</li>
<% end %>
<li <%= "class=active" if controller_name == "banners" %>>
<%= link_to admin_banners_path do %>
<span class="icon-eye"></span><%= t("admin.menu.banner") %>
<% end %>
</li>
<li <%= "class=active" if controller_name == "users" %>>
<%= link_to admin_users_path do %>
<span class="icon-eye"></span>
<%= t("admin.menu.hidden_users") %>
<span class="icon-eye"></span><%= t("admin.menu.hidden_users") %>
<% end %>
</li>
<li <%= "class=active" if controller_name == "verifications" %>>
<%= link_to admin_verifications_path do %>
<span class="icon-eye"></span>
<%= t("admin.menu.incomplete_verifications") %>
<span class="icon-eye"></span><%= t("admin.menu.incomplete_verifications") %>
<% end %>
</li>
<li <%= "class=active" if controller_name == "organizations" %>>
<%= link_to admin_organizations_path do %>
<span class="icon-organizations"></span>
<%= t("admin.menu.organizations") %>
<span class="icon-organizations"></span><%= t("admin.menu.organizations") %>
<% end %>
</li>
<li <%= "class=active" if controller_name == "officials" %>>
<%= link_to admin_officials_path do %>
<span class="icon-user"></span>
<%= t("admin.menu.officials") %>
<span class="icon-user"></span><%= t("admin.menu.officials") %>
<% end %>
</li>
<li <%= 'class=active' if controller_name == 'moderators' %>>
<%= link_to admin_moderators_path do %>
<span class="icon-user"></span>
<%= t('admin.menu.moderators') %>
<span class="icon-user"></span><%= t('admin.menu.moderators') %>
<% end %>
</li>
<li <%= 'class=active' if controller_name == 'valuators' %>>
<%= link_to admin_valuators_path do %>
<span class="icon-user"></span>
<%= t('admin.menu.valuators') %>
<span class="icon-user"></span><%= t('admin.menu.valuators') %>
<% end %>
</li>
<li <%= 'class=active' if controller_name == 'managers' %>>
<%= link_to admin_managers_path do %>
<span class="icon-user"></span>
<%= t('admin.menu.managers') %>
<span class="icon-user"></span><%= t('admin.menu.managers') %>
<% end %>
</li>
<li <%= 'class=active' if controller_name == 'activity' %>>
<%= link_to admin_activity_path do %>
<span class="icon-eye"></span>
<%= t('admin.menu.activity') %>
<span class="icon-eye"></span><%= t('admin.menu.activity') %>
<% end %>
</li>
<li <%= 'class=active' if controller_name == 'settings' %>>
<%= link_to admin_settings_path do %>
<span class="icon-settings"></span>
<%= t("admin.menu.settings") %>
<span class="icon-settings"></span><%= t("admin.menu.settings") %>
<% end %>
</li>
<li <%= "class=active" if controller_name == "stats" %>>
<%= link_to admin_stats_path do %>
<span class="icon-stats"></span>
<%= t("admin.menu.stats") %>
<span class="icon-stats"></span><%= t("admin.menu.stats") %>
<% end %>
</li>
</ul>

View File

@@ -8,7 +8,7 @@
<tr>
<th><%= t("admin.activity.show.type") %></th>
<th><%= t("admin.activity.show.action") %></th>
<th> </th>
<th class="text-left"><%= t("admin.activity.show.content") %></th>
<th><%= t("admin.activity.show.by") %></th>
</tr>
<% @activity.each do |activity| %>

View File

@@ -0,0 +1,15 @@
<% if @banner.errors.any? %>
<div id="error_explanation" data-alert class="callout alert" data-closable>
<button class="close-button" aria-label="<%= t("application.close") %>" type="button" data-close>
<span aria-hidden="true">&times;</span>
</button>
<strong>
<%= @banner.errors.count %>
<%= t("admin.banners.errors.form.error", count: @banner.errors.count) %>
</strong>
</div>
<% end %>

View File

@@ -0,0 +1,76 @@
<%= form_for [:admin, @banner] do |f| %>
<%= render 'errors' %>
<div class="row">
<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-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>
<% date_started_at = @banner.post_started_at.present? ? I18n.localize(@banner.post_started_at) : "" %>
<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,
placeholder: t("admin.banners.banner.post_started_at"),
value: date_started_at,
class: "js-calendar-full",
id: "post_started_at" %>
</div>
<% date_ended_at = @banner.post_ended_at.present? ? I18n.localize(@banner.post_ended_at) : ""%>
<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,
placeholder: t("admin.banners.banner.post_ended_at"),
value: date_ended_at,
class: "js-calendar-full",
id: "post_ended_at" %>
</div>
</div>
<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 %>">
<div id="js-banner-image" class="<%= @banner.image %>">
<%= link_to @banner.target_url do %>
<h2 id="js-banner-title"><%= @banner.title %></h2>
<h3 id="js-banner-description"><%= @banner.description %></h3>
<% end %>
</div>
</div>
<% end %>

View File

@@ -0,0 +1,13 @@
<div class="banner-edit row">
<div class="small-12 column">
<%= link_to admin_banners_path, class: "back" do %>
<span class="icon-angle-left"></span>
<%= t("admin.banners.edit.back") %>
<% end %>
<h1><%= t("admin.banners.edit.editing") %></h1>
<%= render "form" %>
</div>
</div>

View File

@@ -0,0 +1,42 @@
<%= link_to t("admin.banners.index.create"),
new_admin_banner_path, class: "button success float-right" %>
<h2 class="inline-block"><%= t("admin.banners.index.title") %></h2>
<%= render 'shared/filter_subnav', i18n_namespace: "admin.banners.index" %>
<h3><%= page_entries_info @banners %></h3>
<table>
<% @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 %>
<h2><%= banner.title %></h2>
<h3><%= banner.description %></h3>
<% end %>
</div>
</div>
</td>
<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 %>
</table>
<%= paginate @banners %>

View File

@@ -0,0 +1,13 @@
<div class="banner-new row">
<div class="small-12 column">
<%= link_to admin_banners_path, class: "back" do %>
<span class="icon-angle-left"></span>
<%= t("admin.banners.new.back") %>
<% end %>
<h1><%= t("admin.banners.new.creating") %></h1>
<%= render "form" %>
</div>
</div>

View File

@@ -4,34 +4,32 @@
<h3><%= page_entries_info @comments %></h3>
<ul class="admin-list">
<table>
<% @comments.each do |comment| %>
<li id="<%= dom_id(comment) %>">
<div class="row">
<div class="small-12 medium-8 column">
<%= text_with_links comment.body %><br>
<% if comment.commentable.hidden? %>
(<%= t("admin.comments.index.hidden_#{comment.commentable_type.downcase}") %>: <%= comment.commentable.title %>)
<% else %>
<%= link_to comment.commentable.title, comment.commentable %>
<% end %>
</div>
<div class="small-6 medium-4 column text-right">
<%= link_to t("admin.actions.restore"),
restore_admin_comment_path(comment, request.query_parameters),
<tr id="<%= dom_id(comment) %>">
<td>
<%= text_with_links comment.body %><br>
<% if comment.commentable.hidden? %>
(<%= t("admin.comments.index.hidden_#{comment.commentable_type.downcase}") %>: <%= comment.commentable.title %>)
<% else %>
<%= link_to comment.commentable.title, comment.commentable %>
<% end %>
</td>
<td class="text-right">
<%= link_to t("admin.actions.restore"),
restore_admin_comment_path(comment, request.query_parameters),
method: :put,
data: { confirm: t("admin.actions.confirm") },
class: "button hollow on-hover" %>
<% unless comment.confirmed_hide? %>
<%= link_to t("admin.actions.confirm_hide"),
confirm_hide_admin_comment_path(comment, request.query_parameters),
method: :put,
data: { confirm: t("admin.actions.confirm") },
class: "button small success float-right" %>
<% unless comment.confirmed_hide? %>
<%= link_to t("admin.actions.confirm_hide"),
confirm_hide_admin_comment_path(comment, request.query_parameters),
method: :put,
class: "button small warning float-right" %>
<% end %>
</div>
</div>
</li>
class: "button hollow warning on-hover" %>
<% end %>
</td>
</tr>
<% end %>
</ul>
</table>
<%= paginate @comments %>

View File

@@ -1,51 +1,91 @@
<div class="dashboard">
<h2><%= t("admin.dashboard.index.title") %></h2>
<%= link_to t("admin.dashboard.index.back") + " " + Setting['org_name'], root_path, class: "button float-right" %>
<p>Desde aquí puedes administrar el sistema, a través de las siguientes acciones:</p>
<h2 class="inline-block"><%= t("admin.dashboard.index.title") %></h2>
<h3>Temas de debate</h3>
<p>Los temas (también llamadas tags, o etiquetas) de debate son palabras que definen los usuarios al crear debates, para catalogarlos (ej: sanidad, movilidad, arganzuela, ...). Aquí se pueden eliminar temas inapropiados, o <strong>marcarlos para ser propuestos al crear debates</strong> (cada usuario puede definir los que quiera, pero se le sugieren algunos que nos parecen útiles como catalogación por defecto; aquí se puede cambiar cuáles se sugieren)</p>
<p>Desde aquí puedes administrar el sistema, a través de las siguientes acciones:</p>
<h3>Propuestas/Debates/Comentarios ocultos</h3>
<p>Cuando un moderador o un administrador oculta una Propuesta/Debate/Comentario aparecerá en esta lista. De esta forma los administradores pueden revisar que se ha ocultado el elemento adecuado.</p>
<div class="small-12 medium-9">
<ul class="accordion" data-accordion data-multi-expand="true" data-allow-all-closed="true">
<ul>
<li>Al pulsar <strong>Confirmar</strong> se acepta el que se haya ocultado, se considera que se ha hecho correctamente.</li>
<li>Al pulsar <strong>Volver a mostrar</strong> se revierte la acción de ocultar y vuelve a ser una Propuesta/Debate/Comentario visible, en el caso de que se considere
que ha sido una acción errónea el haberlo ocultado.</li>
<li class="accordion-item" data-accordion-item>
<a href="#" class="accordion-title">Temas de debate</a>
<div class="accordion-content" data-tab-content>
<p>Los temas (también llamadas tags, o etiquetas) de debate son palabras que definen los usuarios al crear debates, para catalogarlos (ej: sanidad, movilidad, arganzuela, ...). Aquí se pueden eliminar temas inapropiados, o <strong>marcarlos para ser propuestos al crear debates</strong> (cada usuario puede definir los que quiera, pero se le sugieren algunos que nos parecen útiles como catalogación por defecto; aquí se puede cambiar cuáles se sugieren)</p>
</div>
</li>
<li class="accordion-item" data-accordion-item>
<a href="#" class="accordion-title">Propuestas/Debates/Comentarios ocultos</a>
<div class="accordion-content" data-tab-content>
<p>Cuando un moderador o un administrador oculta una Propuesta/Debate/Comentario aparecerá en esta lista. De esta forma los administradores pueden revisar que se ha ocultado el elemento adecuado.</p>
<ul>
<li>Al pulsar <strong>Confirmar</strong> se acepta el que se haya ocultado, se considera que se ha hecho correctamente.</li>
<li>Al pulsar <strong>Volver a mostrar</strong> se revierte la acción de ocultar y vuelve a ser una Propuesta/Debate/Comentario visible, en el caso de que se considere
que ha sido una acción errónea el haberlo ocultado.</li>
</ul>
<p>Para facilitar la gestión, arriba encontramos un <strong>filtro</strong> con las secciones: "pendientes" (los elementos sobre los que todavía no se ha pulsado "confirmar" o "volver a mostrar", que deberían ser revisados todavía), "confirmados" y "todos".</p>
<p><em>Es recomendable revisar regularmente la sección "pendientes".</em></p>
</div>
</li>
<li class="accordion-item" data-accordion-item>
<a href="#" class="accordion-title">Usuarios bloqueados</a>
<div class="accordion-content" data-tab-content>
<p>Cuando un moderador o un administrador bloquea a un usuario aparecerá en esta lista. Al <strong>bloquear a un usuario, éste deja de poder utilizarlo para ninguna acción de la web</strong>. Los administradores pueden desbloquearlos pulsando el botón al lado del nombre del usuario en la lista.</p>
</div>
</li>
<li class="accordion-item" data-accordion-item>
<a href="#" class="accordion-title">Organizaciones</a>
<div class="accordion-content" data-tab-content>
<p>En la web hay dos tipos de usuarios: individuales y organizaciones. Cualquier persona puede crear usuarios de un tipo o de otro en la propia web. Los usuarios de organizaciones pueden ser verificados por parte de los administradores, confirmando que quien gestiona el usuario efectivamente representa a esa organización. Una vez se haya realizado el proceso de verificación, por el proceso externo a la web que se haya definido para ello, se pulsa el botón <strong>"Verificar"</strong> para confimarlo; lo que hará que al lado del nombre de la organización aparezca una etiqueta señalando que es una organización verificada.</p>
<p>En caso de que el proceso de verificación haya sido negativo, se pulsa el botón <strong>"Rechazar"</strong>. Para editar alguno de los datos de la organización, se pulsa el botón <strong>"Editar"</strong>.</p>
<p>En caso de que el proceso de verificación haya sido negativo, se pulsa el botón <strong>"Rechazar"</strong>. Para editar alguno de los datos de la organización, se pulsa el botón <strong>"Editar"</strong>.</p>
<p>Las organizaciones que no aparecen en la lista pueden ser encontradas para actuar sobre ellas por medio del buscador en la parte superior. Para facilitar la gestión, arriba
encontramos un <strong>filtro</strong> con las secciones: "pendientes" (las organizaciones que todavía no han sido verificadas o rechazadas), "verificadas", "rechazadas" y "todas".</p>
<p><em>Es recomendable revisar regularmente la sección "pendientes".</em></p>
</div>
</li>
<li class="accordion-item" data-accordion-item>
<a href="#" class="accordion-title">Cargos Públicos</a>
<div class="accordion-content" data-tab-content>
<p>En la web, los usuarios individuales pueden ser usuarios normales, o cargos públicos. Estos últimos se diferencian de los primeros únicamente en que al lado de sus nombres aparece una <strong>etiqueta que les identifica</strong>, y cambia ligeramente el estilo de sus comentarios. Esto permite que los usuarios les identifiquen más fácilmente. Al lado de cada usuario vemos la identificación que aparece en su etiqueta, y <strong>su nivel</strong> (la manera que internamente usa la web para diferenciar entre un tipo de cargos y otros). Pulsando el botón <strong>"Editar"</strong> al lado del usuario, se puede modificar su información. Los cargos públicos que no aparecen en la lista pueden ser encontrados para actuar sobre ellos por medio del buscador en la parte superior.</p>
</div>
</li>
<li class="accordion-item" data-accordion-item>
<a href="#" class="accordion-title">Moderadores</a>
<div class="accordion-content" data-tab-content>
<p>Mediante el buscador de la parte superior se pueden buscar usuarios, para activarlos o desactivarlos como moderadores de la web. Los moderadores al acceder a la web con su usuario ven en la parte superior una nueva sección llamada <strong>"Moderar"</strong></p>
</div>
</li>
<li class="accordion-item" data-accordion-item>
<a href="#" class="accordion-title">Actividad de moderadores</a>
<div class="accordion-content" data-tab-content>
<p>En esta sección se va guardando <strong>todas las acciones que realizan los moderadores o los administradores respecto a la moderación</strong>: ocultar/mostrar Propuestas/Debates/Comentarios y bloquear usuarios. En la columna <strong>"Acción"</strong> comprobamos si la acción corresponde con ocultar o con volver a mostrar (restaurar) elementos o con bloquear usuarios. En las demás columnas tenemos el tipo de elemento, el contenido del elemento y el moderador o administrador que ha realizado la acción. Esta sección permite que los administradores detecten comportamientos irregulares por parte de moderadores específicos y que por lo tanto puedan corregirlos.</p>
</div>
</li>
<li class="accordion-item" data-accordion-item>
<a href="#" class="accordion-title">Configuración Global</a>
<div class="accordion-content" data-tab-content>
<p>Opciones generales de configuración del sistema.</p>
</div>
</li>
<li class="accordion-item" data-accordion-item>
<a href="#" class="accordion-title">Estadísticas</a>
<div class="accordion-content" data-tab-content>
<p>Estadísticas generales del sistema.</p>
</div>
</li>
</ul>
<p>Para facilitar la gestión, arriba encontramos un <strong>filtro</strong> con las secciones: "pendientes" (los elementos sobre los que todavía no se ha pulsado "confirmar" o "volver a mostrar", que deberían ser revisados todavía), "confirmados" y "todos".</p>
<p><em>Es recomendable revisar regularmente la sección "pendientes".</em></p>
<h3>Usuarios bloqueados</h3>
<p>Cuando un moderador o un administrador bloquea a un usuario aparecerá en esta lista. Al <strong>bloquear a un usuario, éste deja de poder utilizarlo para ninguna acción de la web</strong>. Los administradores pueden desbloquearlos pulsando el botón al lado del nombre del usuario en la lista.</p>
<h3>Organizaciones</h3>
<p>En la web hay dos tipos de usuarios: individuales y organizaciones. Cualquier persona puede crear usuarios de un tipo o de otro en la propia web. Los usuarios de organizaciones pueden ser verificados por parte de los administradores, confirmando que quien gestiona el usuario efectivamente representa a esa organización. Una vez se haya realizado el proceso de verificación, por el proceso externo a la web que se haya definido para ello, se pulsa el botón <strong>"Verificar"</strong> para confimarlo; lo que hará que al lado del nombre de la organización aparezca una etiqueta señalando que es una organización verificada.</p>
<p>En caso de que el proceso de verificación haya sido negativo, se pulsa el botón <strong>"Rechazar"</strong>. Para editar alguno de los datos de la organización, se pulsa el botón <strong>"Editar"</strong>.</p>
<p>Las organizaciones que no aparecen en la lista pueden ser encontradas para actuar sobre ellas por medio del buscador en la parte superior. Para facilitar la gestión, arriba
encontramos un <strong>filtro</strong> con las secciones: "pendientes" (las organizaciones que todavía no han sido verificadas o rechazadas), "verificadas", "rechazadas" y "todas".</p>
<p><em>Es recomendable revisar regularmente la sección "pendientes".</em></p>
<h3>Cargos Públicos</h3>
<p>En la web, los usuarios individuales pueden ser usuarios normales, o cargos públicos. Estos últimos se diferencian de los primeros únicamente en que al lado de sus nombres aparece una <strong>etiqueta que les identifica</strong>, y cambia ligeramente el estilo de sus comentarios. Esto permite que los usuarios les identifiquen más fácilmente. Al lado de cada usuario vemos la identificación que aparece en su etiqueta, y <strong>su nivel</strong> (la manera que internamente usa la web para diferenciar entre un tipo de cargos y otros). Pulsando el botón <strong>"Editar"</strong> al lado del usuario, se puede modificar su información. Los cargos públicos que no aparecen en la lista pueden ser encontrados para actuar sobre ellos por medio del buscador en la parte superior.</p>
<h3>Moderadores</h3>
<p>Mediante el buscador de la parte superior se pueden buscar usuarios, para activarlos o desactivarlos como moderadores de la web. Los moderadores al acceder a la web con su usuario ven en la parte
superior una nueva sección llamada <strong>"Moderar"</strong></p>
<h3>Actividad de moderadores</h3>
<p>En esta sección se va guardando <strong>todas las acciones que realizan los moderadores o los administradores respecto a la moderación</strong>: ocultar/mostrar Propuestas/Debates/Comentarios y bloquear usuarios. En la columna <strong>"Acción"</strong> comprobamos si la acción corresponde con ocultar o con volver a mostrar (restaurar) elementos o con bloquear usuarios. En las demás columnas tenemos el tipo de elemento, el contenido del elemento y el moderador o administrador que ha realizado la acción. Esta sección permite que los administradores detecten comportamientos irregulares por parte de moderadores específicos y que por lo tanto puedan corregirlos.</p>
<h3>Configuración Global</h3>
<p>Opciones generales de configuración del sistema.</p>
<h3>Estadísticas</h3>
<p>Estadísticas generales del sistema.</p>
</div>

View File

@@ -14,19 +14,17 @@
<%= debate.description %>
</div>
</td>
<td>
<td class="text-right">
<%= link_to t("admin.actions.restore"),
restore_admin_debate_path(debate, request.query_parameters),
method: :put,
data: { confirm: t("admin.actions.confirm") },
class: "button small success no-margin" %>
</td>
<td>
class: "button hollow on-hover" %>
<% unless debate.confirmed_hide? %>
<%= link_to t("admin.actions.confirm_hide"),
confirm_hide_admin_debate_path(debate, request.query_parameters),
method: :put,
class: "button small warning float-right" %>
class: "button hollow warning on-hover" %>
<% end %>
</td>
</tr>

View File

@@ -1,13 +1,24 @@
<span><%= manager.name %></span>
<span class="bullet">&nbsp;&bull;&nbsp;</span>
<span><%= manager.email %></span>
<% if manager.persisted? %>
<%= link_to t('admin.managers.manager.delete'),
admin_manager_path(manager),
method: :delete,
class: "button small alert float-right"
%>
<% else %>
<%= link_to t('admin.managers.manager.add'),{ controller: "admin/managers", action: :create, user_id: manager.user_id },
method: :post, class: "button small success float-right" %>
<% end %>
<div class="small-12 column">
<table>
<tr>
<td>
<%= manager.name %>
</td>
<td>
<%= manager.email %>
</td>
<td class="text-right">
<% if manager.persisted? %>
<%= link_to t('admin.managers.manager.delete'),
admin_manager_path(manager),
method: :delete,
class: "button hollow alert"
%>
<% else %>
<%= link_to t('admin.managers.manager.add'),{ controller: "admin/managers", action: :create, user_id: manager.user_id },
method: :post, class: "button success" %>
<% end %>
</td>
</tr>
</table>
</div>

View File

@@ -1,24 +1,43 @@
<h2><%= t("admin.managers.index.title") %></h2>
<div class="row">
<div class="column">
<%= form_tag search_admin_managers_path, method: :get, remote: true do %>
<div class="small-12 medium-6 column">
<%= text_field_tag :email, '', placeholder: t('admin.managers.search.email_placeholder') %>
</div>
<div class="small-12 medium-6 column">
<%= submit_tag t('admin.managers.search.search'), class: 'button' %>
</div>
<% end %>
</div>
</div>
<div id="search-result" class="row small"></div>
<h3><%= page_entries_info @managers %></h3>
<ul id="managers" class="admin-list">
<% @managers.each do |manager| %>
<li>
<%= render 'manager', manager: manager %>
</li>
<%= form_tag search_admin_managers_path, method: :get, remote: true do %>
<div class="small-12 medium-6 column">
<%= text_field_tag :email, '', placeholder: t('admin.managers.search.email_placeholder') %>
</div>
<div class="small-12 medium-6 column">
<%= submit_tag t('admin.managers.search.search'), class: 'button' %>
</div>
<% end %>
</ul>
</div>
<div id="search-result" class="row"></div>
<h3><%= page_entries_info @managers %></h3>
<table id="managers">
<% @managers.each do |manager| %>
<tr>
<td>
<%= manager.name %>
</td>
<td>
<%= manager.email %>
</td>
<td class="text-right">
<% if manager.persisted? %>
<%= link_to t('admin.managers.manager.delete'),
admin_manager_path(manager),
method: :delete,
class: "button hollow alert"
%>
<% else %>
<%= link_to t('admin.managers.manager.add'),{ controller: "admin/managers", action: :create, user_id: manager.user_id },
method: :post, class: "button success" %>
<% end %>
</td>
</tr>
<% end %>
</table>
<%= paginate @managers %>

View File

@@ -1 +1 @@
$("#search-result").html("<div class=\"panel column\"><%= j render 'manager', manager: @manager %></div>");
$("#search-result").html("<%= j render 'manager', manager: @manager %>");

View File

@@ -1 +1 @@
$("#search-result").html("<div class=\"panel column\"><%= j t('admin.managers.search.user_not_found') %></div>");
$("#search-result").html("<div class=\"small-12 column\"><div class=\"callout alert\"><%= j t('admin.managers.search.user_not_found') %></div></div>");

View File

@@ -1,13 +1,26 @@
<span><%= moderator.name %></span>
<span class="bullet">&nbsp;&bull;&nbsp;</span>
<span><%= moderator.email %></span>
<% if moderator.persisted? %>
<%= link_to t('admin.moderators.moderator.delete'),
admin_moderator_path(moderator),
method: :delete,
class: "button small alert float-right"
%>
<% else %>
<%= link_to t('admin.moderators.moderator.add'),{ controller: "admin/moderators", action: :create, user_id: moderator.user_id },
method: :post, class: "button small success float-right" %>
<% end %>
<div class="small-12 column">
<table>
<tbody>
<tr>
<td>
<%= moderator.name %>
</td>
<td>
<%= moderator.email %>
</td>
<td class="text-right">
<% if moderator.persisted? %>
<%= link_to t('admin.moderators.moderator.delete'),
admin_moderator_path(moderator),
method: :delete,
class: "button hollow alert" %>
<% else %>
<%= link_to t('admin.moderators.moderator.add'),{ controller: "admin/moderators", action: :create, user_id: moderator.user_id },
method: :post,
class: "button success" %>
<% end %>
</td>
</tr>
</tbody>
</table>
</div>

View File

@@ -1,24 +1,46 @@
<h2><%= t("admin.moderators.index.title") %></h2>
<div class="row">
<div class="column">
<%= form_tag search_admin_moderators_path, method: :get, remote: true do %>
<div class="small-12 medium-6 column">
<%= text_field_tag :email, '', placeholder: t('admin.moderators.search.email_placeholder') %>
</div>
<div class="small-12 medium-6 column">
<%= submit_tag t('admin.moderators.search.search'), class: 'button' %>
</div>
<% end %>
</div>
</div>
<div id="search-result" class="row small"></div>
<h3><%= page_entries_info @moderators %></h3>
<ul id="moderators" class="admin-list">
<% @moderators.each do |moderator| %>
<li>
<%= render 'moderator', moderator: moderator %>
</li>
<%= form_tag search_admin_moderators_path, method: :get, remote: true do %>
<div class="small-12 medium-6 column">
<%= text_field_tag :email, '', placeholder: t('admin.moderators.search.email_placeholder') %>
</div>
<div class="small-12 medium-6 column">
<%= submit_tag t('admin.moderators.search.search'), class: 'button' %>
</div>
<% end %>
</ul>
</div>
<div id="search-result" class="row"></div>
<h3><%= page_entries_info @moderators %></h3>
<table id="moderators">
<% @moderators.each do |moderator| %>
<tr>
<td>
<%= moderator.name %>
</td>
<td>
<%= moderator.email %>
</td>
<td class="text-right">
<% if moderator.persisted? %>
<%= link_to t('admin.moderators.moderator.delete'),
admin_moderator_path(moderator),
method: :delete,
class: "button hollow alert"
%>
<% else %>
<%= link_to t('admin.moderators.moderator.add'),
{ controller: "admin/moderators", action: :create,
user_id: moderator.user_id },
method: :post,
class: "button success" %>
<% end %>
</td>
</tr>
<% end %>
</table>
<%= paginate @moderators %>

View File

@@ -1 +1 @@
$("#search-result").html("<div class=\"panel column\"><%= j render 'moderator', moderator: @moderator %></div>");
$("#search-result").html("<%= j render 'moderator', moderator: @moderator %>");

View File

@@ -1 +1 @@
$("#search-result").html("<div class=\"panel column\"><%= j t('admin.moderators.search.user_not_found') %></div>");
$("#search-result").html("<div class=\"small-12 column\"><div class=\"callout alert\"><%= j t('admin.moderators.search.user_not_found') %></div></div>");

View File

@@ -1,15 +1,20 @@
<h2>
<%= t("admin.officials.edit.title") %>
<span class="official float-right"><strong><%= @user.name %></strong> (<%= @user.email %>)</span>
</h2>
<%= render 'shared/back_link' %>
<%= form_for @user, url: admin_official_path(@user) do |f| %>
<%= f.text_field :official_position %>
<%= f.select :official_level, official_level_options %>
<%= link_to t("admin.officials.edit.back"), admin_officials_path, class: "button small secondary" %>
<%= f.submit %>
<div class="clear"></div>
<% if @user.official? %>
<%= link_to t("admin.officials.edit.destroy"), admin_official_path(@user), method: :delete, class: 'delete' %>
<div class="official float-right"><strong><%= @user.name %></strong> (<%= @user.email %>)</div>
<h2 class="inline-block"><%= t("admin.officials.edit.title") %></h2>
<div class="row">
<div class="small-12 medium-6 column end">
<%= form_for @user, url: admin_official_path(@user) do |f| %>
<%= f.text_field :official_position %>
<%= f.select :official_level, official_level_options %>
<% if @user.official? %>
<%= link_to t("admin.officials.edit.destroy"), admin_official_path(@user), method: :delete, class: 'button hollow alert' %>
<% end %>
<%= f.submit class: "button hollow" %>
<% end %>
<% end %>
</div>
</div>

View File

@@ -4,20 +4,24 @@
<h3><%= page_entries_info @officials %></h3>
<ul class="admin-list">
<% @officials.each do |official| %>
<li>
<%= link_to official.name, edit_admin_official_path(official) %>
<span class="bullet">&nbsp;&bull;&nbsp;</span>
<span class="level"><%= t("admin.officials.level_#{official.official_level}") %></span>
<span class="bullet">&nbsp;&bull;&nbsp;</span>
<span class="label round level-<%= official.official_level %>">
<%= official.official_position %>
</span>
<%= link_to official.official? ? t("admin.officials.search.edit_official") : t("admin.officials.search.make_official"), edit_admin_official_path(official), class: "button small float-right" %>
</li>
<% end %>
</ul>
<table>
<% @officials.each do |official| %>
<tr>
<td>
<%= link_to official.name, edit_admin_official_path(official) %>
</td>
<td>
<span class="label round level-<%= official.official_level %>">
<%= official.official_position %>
</span>
(<%= t("admin.officials.level_#{official.official_level}") %>)
</td>
<td class="text-right">
<%= link_to official.official? ? t("admin.officials.search.edit_official") : t("admin.officials.search.make_official"),
edit_admin_official_path(official), class: "button hollow" %>
</td>
</tr>
<% end %>
</table>
<%= paginate @officials %>

View File

@@ -4,18 +4,22 @@
<h3><%= page_entries_info @users %></h3>
<ul class="admin-list">
<table>
<% @users.each do |user| %>
<li>
<%= link_to user.name, edit_admin_official_path(user) %>
<span class="bullet">&nbsp;&bull;&nbsp;</span>
<span class="label round level-<%= user.official_level %>">
<%= user.official_position %>
</span>
<span class="bullet">&nbsp;&bull;&nbsp;</span>
<span class="level"><%= t("admin.officials.level_#{user.official_level}") %></span>
<%= link_to user.official? ? t("admin.officials.search.edit_official") : t("admin.officials.search.make_official"), edit_admin_official_path(user), class: "button small float-right" %>
</li>
<tr>
<td>
<%= link_to user.name, edit_admin_official_path(user) %>
</td>
<td>
<span class="label round level-<%= user.official_level %>">
<%= user.official_position %>
</span>
(<%= t("admin.officials.level_#{user.official_level}") %>)
</td>
<td class="text-right">
<%= link_to user.official? ? t("admin.officials.search.edit_official") : t("admin.officials.search.make_official"),
edit_admin_official_path(user), class: "button hollow" %>
</td>
</tr>
<% end %>
</ul>
</table>

View File

@@ -22,12 +22,12 @@
<% @organizations.each do |organization| %>
<% hidden += 1 and next if organization.user.nil? || organization.user.hidden? %>
<tr id="<%= dom_id(organization) %>">
<td><%= organization.name %></td>
<td><%= organization.email %></td>
<td><%= organization.phone_number %></td>
<td><%= organization.responsible_name %></td>
<td><p><%= organization.name %></p></td>
<td><p><%= organization.email %></p></td>
<td><p><%= organization.phone_number %></p></td>
<td><p><%= organization.responsible_name %></p></td>
<% if organization.verified? %>
<td class="verified">
<td class="verified text-center">
<span class="icon-check"></span>
<%= t("admin.organizations.index.verified") %>
</td>
@@ -36,27 +36,32 @@
<td>
<%= link_to t("admin.organizations.index.verify"),
verify_admin_organization_path(organization, request.query_parameters),
method: :put, class: "button small success"
method: :put, class: "button success expanded"
%>
</td>
<% end %>
<% if organization.rejected? %>
<td class="rejected">
<td class="rejected text-center">
<span class="icon-x"></span>
<%= t("admin.organizations.index.rejected") %>
</td>
<% end %>
<% if can? :reject, organization %>
<td><%= link_to t("admin.organizations.index.reject"),
<td>
<%= link_to t("admin.organizations.index.reject"),
reject_admin_organization_path(organization, request.query_parameters),
method: :put, class: "button small alert"
%>
method: :put, class: "button hollow alert expanded"
%>
</td>
<% end %>
</tr>
<% end %>
</table>
<%= t("admin.organizations.index.hidden_count", count: hidden) if hidden > 0 %>
<% if hidden > 0 %>
<div class="callout primary">
<%= t("admin.organizations.index.hidden_count_html", count: hidden) %>
</div>
<% end %>
<%= paginate @organizations %>

View File

@@ -18,12 +18,12 @@
<table id="search-results">
<% @organizations.each do |organization| %>
<tr>
<td><%= organization.name %></td>
<td><%= organization.email %></td>
<td><%= organization.phone_number %></td>
<td><%= organization.responsible_name %></td>
<td><p><%= organization.name %></p></td>
<td><p><%= organization.email %></p></td>
<td><p><%= organization.phone_number %></p></td>
<td><p><%= organization.responsible_name %></p></td>
<% if organization.verified? %>
<td class="verified">
<td class="verified text-center">
<span class="icon-check"></span>
<%= t("admin.organizations.index.verified") %>
</td>
@@ -32,12 +32,12 @@
<td>
<%= link_to t("admin.organizations.index.verify"),
verify_admin_organization_path(organization, request.query_parameters),
method: :put, class: "button small success"
method: :put, class: "button success expanded"
%>
</td>
<% end %>
<% if organization.rejected? %>
<td class="rejected">
<td class="rejected text-center">
<span class="icon-x"></span>
<%= t("admin.organizations.index.rejected") %>
</td>
@@ -45,7 +45,7 @@
<% if can? :reject, organization %>
<td><%= link_to t("admin.organizations.index.reject"),
reject_admin_organization_path(organization, request.query_parameters),
method: :put, class: "button small alert"
method: :put, class: "button hollow alert expanded"
%>
</td>
<% end %>

View File

@@ -22,19 +22,17 @@
<p><%= proposal.question %></p>
</div>
</td>
<td>
<td class="text-right">
<%= link_to t("admin.actions.restore"),
restore_admin_proposal_path(proposal, request.query_parameters),
method: :put,
data: { confirm: t("admin.actions.confirm") },
class: "button small success no-margin" %>
</td>
<td>
class: "button hollow on-hover" %>
<% unless proposal.confirmed_hide? %>
<%= link_to t("admin.actions.confirm_hide"),
confirm_hide_admin_proposal_path(proposal, request.query_parameters),
method: :put,
class: "button small warning float-right" %>
class: "button hollow warning on-hover" %>
<% end %>
</td>
</tr>

View File

@@ -1,34 +1,97 @@
<h2><%= t("admin.settings.index.title") %></h2>
<ul class="admin-list">
<% @settings.each do |setting| %>
<li>
<strong><%= t("settings.#{setting.key}") %></strong>
<%= form_for(setting, url: admin_setting_path(setting), html: { id: "edit_#{dom_id(setting)}"}) do |f| %>
<%= f.text_area :value, label: false, id: dom_id(setting), lines: 1 %>
<%= f.submit(t('admin.settings.index.update_setting'), class: "button small success") %>
<% end %>
</li>
<% end %>
</ul>
<table>
<tbody>
<% @settings.each do |setting| %>
<tr>
<td class="small-12 medium-4">
<strong><%= t("settings.#{setting.key}") %></strong>
</td>
<td class="small-12 medium-8">
<%= form_for(setting, url: admin_setting_path(setting), html: { id: "edit_#{dom_id(setting)}"}) do |f| %>
<div class="small-12 medium-6 large-9 column">
<%= f.text_area :value, label: false, id: dom_id(setting), lines: 1 %>
</div>
<div class="small-12 medium-6 large-3 column">
<%= f.submit(t('admin.settings.index.update_setting'), class: "button hollow expanded") %>
</div>
<% end %>
</td>
</tr>
<% end %>
</tbody>
</table>
<h2><%= t("admin.settings.index.feature_flags") %></h2>
<ul class="admin-list">
<% @feature_flags.each do |feature_flag| %>
<li>
<strong><%= t("settings.#{feature_flag.key}") %></strong>
<table>
<tbody>
<% @feature_flags.each do |feature_flag| %>
<tr>
<td>
<strong><%= t("settings.#{feature_flag.key}") %></strong>
</td>
<div>
<%= feature_flag.enabled? ? t("admin.settings.index.features.enabled") : t("admin.settings.index.features.disabled") %>
<div>
<td>
<%= feature_flag.enabled? ? t("admin.settings.index.features.enabled") : t("admin.settings.index.features.disabled") %>
</td>
<%= form_for(feature_flag, url: admin_setting_path(feature_flag), html: { id: "edit_#{dom_id(feature_flag)}"}) do |f| %>
<td class="text-right">
<%= form_for(feature_flag, url: admin_setting_path(feature_flag), html: { id: "edit_#{dom_id(feature_flag)}"}) do |f| %>
<%= f.hidden_field :value, id: dom_id(feature_flag), value: (feature_flag.enabled? ? "" : "active") %>
<%= f.submit(t("admin.settings.index.features.#{feature_flag.enabled? ? 'disable' : 'enable'}"), class: "button small #{feature_flag.enabled? ? 'warning' : 'success'}", data: {confirm: t("admin.actions.confirm")}) %>
<%= f.hidden_field :value, id: dom_id(feature_flag), value: (feature_flag.enabled? ? "" : "active") %>
<%= f.submit(t("admin.settings.index.features.#{feature_flag.enabled? ? 'disable' : 'enable'}"),
class: "button expanded #{feature_flag.enabled? ? 'hollow alert' : 'success'}",
data: {confirm: t("admin.actions.confirm")}) %>
<% end %>
</td>
</tr>
<% end %>
</tbody>
</table>
<% if @banner_styles.present? %>
<h2><%= t("admin.settings.index.banners") %></h2>
<table>
<tbody>
<% @banner_styles.each do |setting| %>
<tr>
<td>
<strong><%= t("settings.#{setting.key}") %></strong>
</td>
<td>
<%= form_for(setting, url: admin_setting_path(setting), html: { id: "edit_#{dom_id(setting)}"}) do |f| %>
<%= f.text_area :value, label: false, id: dom_id(setting), lines: 1 %>
<%= f.submit(t('admin.settings.index.update_setting'), class: "button hollow") %>
<% end %>
</td>
</tr>
<% end %>
</li>
<% end %>
</ul>
</tbody>
</table>
<% end %>
<% if @banner_imgs.present?%>
<h2><%= t("admin.settings.index.banner_imgs") %></h2>
<table>
<tbody>
<% @banner_imgs.each do |setting| %>
<tr>
<td>
<strong><%= t("settings.#{setting.key}") %></strong>
</td>
<td>
<%= form_for(setting, url: admin_setting_path(setting), html: { id: "edit_#{dom_id(setting)}"}) do |f| %>
<%= f.text_area :value, label: false, id: dom_id(setting), lines: 1 %>
<%= f.submit(t('admin.settings.index.update_setting'), class: "button small success") %>
<% end %>
</td>
</tr>
<% end %>
</tbody>
</table>
<% end %>

View File

@@ -4,7 +4,7 @@
<%= text_field_tag :search, "", placeholder: t("admin.shared.proposal_search.placeholder") %>
</div>
<div class="form-inline small-12 medium-6 column">
<%= f.submit t("admin.shared.proposal_search.button"), class: "button success" %>
<%= f.submit t("admin.shared.proposal_search.button"), class: "button" %>
</div>
</div>
<% end %>

View File

@@ -4,7 +4,7 @@
<%= text_field_tag :search, "", placeholder: t("admin.shared.spending_proposal_search.placeholder") %>
</div>
<div class="form-inline small-12 medium-3 column end">
<%= f.submit t("admin.shared.spending_proposal_search.button"), class: "button success expanded" %>
<%= f.submit t("admin.shared.spending_proposal_search.button"), class: "button" %>
</div>
</div>
<% end %>

View File

@@ -22,29 +22,29 @@
<h3><%= t("admin.tags.index.title") %>: <%= page_entries_info @tags %></h3>
<ul class="admin-list">
<table>
<% @tags.each do |tag| %>
<li>
<span class="tag"><%= tag.name %></span>
<tr>
<td>
<%= form_for(tag,
url: admin_tag_path(tag),
as: :tag,
html: { id: "edit_tag_#{tag.id}", class: "text-right"}) do |f| %>
<%= form_for(tag,
url: admin_tag_path(tag),
as: :tag,
html: { id: "edit_tag_#{tag.id}", class: "text-right"}) do |f| %>
<span class="float-left text-left">
<strong><%= tag.name %></strong>
<%= f.label "featured_#{tag.id}" do %>
<%= f.check_box :featured, title: t('admin.tags.mark_as_featured'), label: false, id: "tag_featured_#{tag.id}", class: "inline-block" %>
<span class="checkbox inline-block"><%= t("admin.tags.mark_as_featured") %></span>
<% end %>
</span>
<span class="float-left">
<%= f.label "featured_#{tag.id}" do %>
<%= f.check_box :featured, title: t('admin.tags.mark_as_featured'), label: false, id: "tag_featured_#{tag.id}", class: "inline-block" %>
<span class="checkbox inline-block"><%= t("admin.tags.mark_as_featured") %></span>
<% end %>
</span>
<%= f.submit(t("admin.tags.update"), class: "button small success") %>
<%= link_to t("admin.tags.destroy"), admin_tag_path(tag), method: :delete, class: "delete" %>
<% end %>
</li>
<%= f.submit(t("admin.tags.update"), class: "button hollow on-hover") %>
<%= link_to t("admin.tags.destroy"), admin_tag_path(tag), method: :delete, class: "button hollow alert on-hover" %>
<% end %>
</td>
</tr>
<% end %>
</ul>
</table>
<%= paginate @tags %>

View File

@@ -4,25 +4,29 @@
<h3><%= page_entries_info @users %></h3>
<ul class="admin-list">
<table>
<% @users.each do |user| %>
<li id="<%= dom_id(user) %>">
<%= link_to user.name, admin_user_path(user) %>
<tr id="<%= dom_id(user) %>">
<td>
<p><%= link_to user.name, admin_user_path(user) %></p>
</td>
<%= link_to t("admin.actions.restore"),
restore_admin_user_path(user, request.query_parameters),
method: :put,
data: { confirm: t("admin.actions.confirm") },
class: "button small success float-right" %>
<% unless user.confirmed_hide? %>
<%= link_to t("admin.actions.confirm_hide"),
confirm_hide_admin_user_path(user, request.query_parameters),
method: :put,
class: "button small warning float-right" %>
<% end %>
</li>
<td class="text-right">
<%= link_to t("admin.actions.restore"),
restore_admin_user_path(user, request.query_parameters),
method: :put,
data: { confirm: t("admin.actions.confirm") },
class: "button hollow on-hover" %>
<% unless user.confirmed_hide? %>
<%= link_to t("admin.actions.confirm_hide"),
confirm_hide_admin_user_path(user, request.query_parameters),
method: :put,
class: "button hollow warning on-hover" %>
<% end %>
</td>
</tr>
<% end %>
</ul>
</table>
<%= paginate @users %>

View File

@@ -1,3 +1,5 @@
<%= render 'shared/back_link' %>
<h2><%= t("admin.users.show.title", user: @user.name) %></h2>
<p>
@@ -5,37 +7,33 @@
<strong><%= t("admin.users.show.registered_at") %></strong> <%= @user.confirmed_at %> |
<strong><%= t("admin.users.show.hidden_at") %></strong> <%= @user.hidden_at %>
</p>
<p>
<%= link_to t("admin.users.show.back"), admin_users_path,
class: "button small secondary" %>
</p>
<% if @debates.present? %>
<h3><%= page_entries_info @debates %></h3>
<% end %>
<ul class="admin-list">
<% @debates.each do |debate| %>
<li>
<%= link_to debate.title, debate_path(debate) %>
</li>
<% end %>
</ul>
<table>
<% @debates.each do |debate| %>
<tr>
<td>
<%= link_to debate.title, debate_path(debate) %>
</td>
</tr>
<% end %>
</table>
<% if @comments.present? %>
<h3><%= page_entries_info @comments %></h3>
<% end %>
<ul class="admin-list">
<% @comments.each do |comment| %>
<li id="<%= dom_id(comment) %>">
<div class="row">
<div class="small-12 medium-10 column">
<%= text_with_links comment.body %>
</div>
</div>
</li>
<% end %>
</ul>
<table>
<% @comments.each do |comment| %>
<tr id="<%= dom_id(comment) %>">
<td>
<%= text_with_links comment.body %>
</td>
</tr>
<% end %>
</table>
<%= paginate [@debates, @comments].sort_by {|x| x.size}.last %>

View File

@@ -1,12 +1,16 @@
<h3><%= t('admin.valuators.valuator.user_found') %>:</h3>
<div class="row">
<div class="small-12 medium-12 column">
<h4>
<%= valuator.name %>
<span class="bullet">&nbsp;&bull;&nbsp;</span>
<%= valuator.email %>
</h4>
</div>
<div class="small-12 column">
<h3><%= t('admin.valuators.valuator.user_found') %></h3>
<table>
<tr>
<td>
<%= valuator.name %>
</td>
<td>
<%= valuator.email %>
</td>
</tr>
</table>
<% unless @valuator.persisted? %>
<%= form_for @valuator, url: admin_valuators_path do |f| %>
@@ -21,4 +25,4 @@
</div>
<% end %>
<% end %>
</div>
</div>

View File

@@ -1,30 +1,36 @@
<h2><%= t("admin.valuators.index.title") %></h2>
<div class="row">
<div class="column">
<%= form_tag search_admin_valuators_path, method: :get, remote: true do %>
<div class="small-12 medium-6 column">
<%= text_field_tag :email, '', placeholder: t('admin.valuators.search.email_placeholder') %>
</div>
<div class="small-12 medium-6 column">
<%= submit_tag t('admin.valuators.search.search'), class: 'button radius' %>
</div>
<% end %>
</div>
</div>
<div id="search-result" class="row small"></div>
<h3><%= page_entries_info @valuators %></h3>
<ul id="valuators" class="admin-list">
<% @valuators.each do |valuator| %>
<li>
<span><%= valuator.name %></span>
<span class="bullet">&nbsp;&bull;&nbsp;</span>
<span><%= valuator.email %></span>
<% if valuator.description.present? %>
<span class="bullet">&nbsp;&bull;&nbsp;</span>
<span><%= valuator.description %></span>
<% end %>
</li>
<%= form_tag search_admin_valuators_path, method: :get, remote: true do %>
<div class="small-12 medium-6 column">
<%= text_field_tag :email, '', placeholder: t('admin.valuators.search.email_placeholder') %>
</div>
<div class="small-12 medium-6 column">
<%= submit_tag t('admin.valuators.search.search'), class: 'button radius' %>
</div>
<% end %>
</ul>
</div>
<div id="search-result" class="row"></div>
<h3><%= page_entries_info @valuators %></h3>
<table id="valuators">
<% @valuators.each do |valuator| %>
<tr>
<td>
<%= valuator.name %>
</td>
<td>
<%= valuator.email %>
</td>
<td>
<% if valuator.description.present? %>
<%= valuator.description %>
<% end %>
</td>
</tr>
<% end %>
</table>
<%= paginate @valuators %>

View File

@@ -1,7 +1,4 @@
<%= link_to admin_spending_proposals_path, class: "back" do %>
<span class="icon-angle-left"></span>
<%= t("shared.back") %>
<% end %>
<%= render 'shared/back_link' %>
<h2><%= t("admin.valuators.summary.title") %></h2>

View File

@@ -1 +1 @@
$("#search-result").html("<h4><%= j t('admin.valuators.search.user_not_found') %></h4>");
$("#search-result").html("<div class=\"small-12 column\"><div class=\"callout alert\"><%= j t('admin.valuators.search.user_not_found') %></div></div>");

View File

@@ -4,13 +4,17 @@
<h3><%= page_entries_info @users %></h3>
<ul class="admin-list">
<% @users.each do |user| %>
<li id="<%= dom_id(user) %>">
<%= link_to user.name, admin_user_path(user) %>
<%= render "pending_step", user: user %>
</li>
<% end %>
</ul>
<table>
<% @users.each do |user| %>
<tr id="<%= dom_id(user) %>">
<td>
<%= link_to user.name, admin_user_path(user) %>
</td>
<td>
<%= render "pending_step", user: user %>
</td>
</tr>
<% end %>
</table>
<%= paginate @users %>

View File

@@ -25,6 +25,10 @@
<% end %>
</div>
<% if has_banners %>
<%= render "shared/banner" %>
<% end %>
<% unless @tag_filter || @search_terms || !has_featured? %>
<%= render "featured_debates" %>
<% end %>

View File

@@ -1,14 +1,14 @@
<header>
<section class="top-links">
<div class="row">
<div class="expanded row">
<%= render 'shared/locale_switcher' %>
</div>
</section>
<div class="row">
<div class="expanded row">
<div class="top-bar">
<%= link_to Setting['org_name'], root_path, class: "logo show-for-small-only" %>
<%= link_to Setting['org_name'], admin_root_path, class: "logo show-for-small-only" %>
<span data-responsive-toggle="responsive-menu" data-hide-for="medium" class="float-right">
<span class="menu-icon dark" data-toggle></span>
@@ -17,7 +17,7 @@
<div id="responsive-menu">
<div class="top-bar-title">
<%= link_to root_path, class: "hide-for-small-only" do %>
<%= link_to admin_root_path, class: "hide-for-small-only" do %>
<%= image_tag('logo_header.png', class: 'hide-for-small-only float-left', size: '80x80', alt: t("layouts.header.logo")) %>
<%= Setting['org_name'] %>
&nbsp;|&nbsp;<%= t("admin.dashboard.index.title") %>

View File

@@ -14,21 +14,41 @@
</head>
<body class="admin">
<%= render 'layouts/admin_header' %>
<div class="off-canvas-wrapper">
<div class="off-canvas-wrapper-inner" data-off-canvas-wrapper>
<div class="off-canvas position-left" id="offCanvas" data-off-canvas>
<div class="row expanded">
<main>
<div class="small-12 medium-3 column">
<%= side_menu %>
<button class="close-button" aria-label="Close menu" type="button" data-close>
<span aria-hidden="true">&times;</span>
</button>
<div class="show-for-small-only">
<%= side_menu %>
</div>
</div>
<div class="admin-content small-12 medium-9 column">
<div class="off-canvas-content" data-off-canvas-content>
<%= render 'layouts/admin_header' %>
<%= render 'layouts/flash' %>
<main class="no-margin-top row no-max-width collapse">
<div class="small-12 medium-3 column">
<%= yield %>
<div class="show-for-small-only">
<button type="button" class="button hollow expanded" data-toggle="offCanvas"><%= t("admin.menu.admin") %></button>
</div>
<div id="side_menu" class="hide-for-small-only">
<%= side_menu %>
</div>
</div>
<div class="admin-content small-12 medium-9 column">
<%= render 'layouts/flash' %>
<%= yield %>
</div>
</main>
</div>
</main>
</div>
</div>
</body>
</html>

View File

@@ -17,12 +17,12 @@
<body class="admin">
<header>
<section class="top-links">
<div class="row">
<div class="expanded row">
<%= render 'shared/locale_switcher' %>
</div>
</section>
<div class="row">
<div class="expanded row">
<div class="top-bar">
<%= link_to Setting['org_name'], management_root_path, class: "logo show-for-small-only" %>
@@ -45,21 +45,18 @@
</div>
</header>
<div class="row expanded">
<main>
<div class="small-12 medium-3 column">
<%= render "/management/menu" %>
</div>
<main class="no-margin-top row no-max-width collapse">
<div class="small-12 medium-3 column">
<%= render "/management/menu" %>
</div>
<%= render "management/account_info" %>
<%= render "management/account_info" %>
<div class="admin-content small-12 medium-9 column">
<div class="admin-content small-12 medium-9 column">
<%= render 'layouts/flash' %>
<%= yield %>
</div>
</main>
<%= render 'layouts/flash' %>
<%= yield %>
</div>
</main>
</div>
</body>
</html>

View File

@@ -1,5 +1,5 @@
<% if managed_user.document_number.present? %>
<section class="small-12 medium-9 column">
<section class="small-12 medium-9 large-10 column">
<div class="account-info">
<%= link_to(t("management.account_info.change_user"), logout_management_users_path, method: :delete, class: 'float-right change-user') %>

View File

@@ -19,7 +19,7 @@
label: t("management.document_number")
%>
</div>
<%= f.submit t("management.check") %>
<%= f.submit t("management.check"), class: "button" %>
<% end %>
</div>
</div>

View File

@@ -15,7 +15,7 @@
<%= f.hidden_field :document_number %>
<%= f.text_field :email, label: false, placeholder: t('management.email_verifications.email_placeholder') %>
<%= f.submit t("management.email_verifications.send_email"), class: "button success" %>
<%= f.submit t("management.email_verifications.send_email"), class: "button hollow" %>
<% end %>
</li>
@@ -23,7 +23,7 @@
<strong><%= t("management.email_verifications.if_no_existing_account") %></strong>
<p class="margin-top">
<%= link_to t('management.users.create_user'), new_management_user_path(user: params[:email_verification]), class: "button warning" %>
<%= link_to t('management.users.create_user'), new_management_user_path(user: params[:email_verification]), class: "button success" %>
</p>
</li>
</ul>

View File

@@ -1,8 +1,10 @@
<div class="proposal-new row">
<div class="proposal-new">
<%= render '/shared/print' %>
<div class="clear float-right">
<%= render '/shared/print' %>
</div>
<div class="small-12 medium-9 column">
<div class="small-12 medium-9 column end">
<h1 class=""><%= t("management.proposals.create_proposal") %></h1>
<%= render "proposals/form", form_url: management_proposals_url %>
</div>

View File

@@ -1,8 +1,10 @@
<div class="spending-proposal-new row">
<div class="spending-proposal-new">
<%= render '/shared/print' %>
<div class="clear float-right">
<%= render '/shared/print' %>
</div>
<div class="small-12 medium-9 column">
<div class="small-12 medium-9 column end">
<h1 class=""><%= t("management.spending_proposals.create") %></h1>
<%= render "spending_proposals/form", form_url: management_spending_proposals_url %>
</div>

View File

@@ -1,9 +1,9 @@
<%= link_to t("management.users.erase_account_link"), "#", class: "delete js-toggle-link", data: { "toggle-selector" => "#erase-account-form" } %>
<%= link_to t("management.users.erase_account_link"), "#", class: "button hollow alert js-toggle-link", data: { "toggle-selector" => "#erase-account-form" } %>
<div id="erase-account-form" style="display:none">
<div class="callout alert medium-6">
<%= t("management.users.erase_warning") %>
</div>
<%= link_to t("management.users.erase_submit"), erase_management_users_path, method: :delete, class: "button alert", data: { confirm: t("management.users.erase_account_confirm") } %>
<%= link_to t("management.users.erase_submit"), erase_management_users_path, method: :delete, class: "button hollow alert", data: { confirm: t("management.users.erase_account_confirm") } %>
</div>

View File

@@ -5,7 +5,7 @@
permissions: [:debates, :create_proposals, :support_proposals, :vote_proposals] %>
<div class="row">
<div class="small-12 medium-9 column">
<div class="small-12 medium-6 column">
<%= form_for @user, url: management_users_path do |f| %>
<%= f.hidden_field :document_type %>
<%= f.hidden_field :document_number %>

View File

@@ -13,7 +13,7 @@
</div>
<%= form_tag moderate_moderation_comments_path(request.query_parameters), method: :put do %>
<p class="float-right js-check">
<p class="js-check">
<%= t('shared.check') %>:
<%= link_to t('shared.check_all'), '#', data: {check_all: "comment_ids[]"} %>
|
@@ -55,19 +55,19 @@
<%= submit_tag t('moderation.comments.index.block_authors'),
name: "block_authors",
class: "button alert",
class: "button hollow alert",
data: {confirm: t('moderation.comments.index.confirm')}
%>
<div class="float-right">
<%= submit_tag t('moderation.comments.index.hide_comments'),
name: "hide_comments",
class: "button alert",
class: "button hollow alert",
data: {confirm: t('moderation.comments.index.confirm')}
%>
<%= submit_tag t('moderation.comments.index.ignore_flags'),
name: "ignore_flags",
class: "button success",
class: "button hollow",
data: {confirm: t('moderation.comments.index.confirm')}
%>
</div>

View File

@@ -1,33 +1,42 @@
<div class="dashboard">
<h2><%= t("moderation.dashboard.index.title") %></h2>
<%= link_to t("admin.dashboard.index.back") + " " + Setting['org_name'], root_path, class: "button float-right" %>
<p>Desde aquí puedes moderar el sistema, a través de las siguientes acciones:<p>
<h2 class="inline-block"><%= t("moderation.dashboard.index.title") %></h2>
<h3>Propuestas / Debates / Comentarios</h3>
<p>Desde aquí puedes moderar el sistema, a través de las siguientes acciones:<p>
<p>Cuando un usuario marca en una Propuesta/Debate/Comentario la opción de "denunciar como inapropiado", aparecerá en esta lista. Respecto a cada uno aparecerá el <em>título, fecha, número de denuncias</em> (cuántos usuarios diferentes han marcado la opción de denuncia) y el <em>texto de la Propuesta/Debate/Comentario</em>.</p>
<div class="small-12 medium-9">
<ul class="accordion" data-accordion data-multi-expand="true" data-allow-all-closed="true">
<p>A la derecha de cada elemento aparece una caja que podemos marcar para seleccionar todos los que queramos de la lista. Una vez seleccionados uno o varios, encontramos al final de la página <strong>tres botones para realizar acciones</strong> sobre ellos:</p>
<li class="accordion-item" data-accordion-item>
<a href="#" class="accordion-title">Propuestas / Debates / Comentarios</a>
<div class="accordion-content" data-tab-content>
<p>Cuando un usuario marca en una Propuesta/Debate/Comentario la opción de "denunciar como inapropiado", aparecerá en esta lista. Respecto a cada uno aparecerá el <em>título, fecha, número de denuncias</em> (cuántos usuarios diferentes han marcado la opción de denuncia) y el <em>texto de la Propuesta/Debate/Comentario</em>.</p>
<ul>
<li><strong>Ocultar</strong>: hará que esos elementos dejen de mostrarse en la web.</li>
<li><strong>Bloquear autores</strong>: hará que el autor de ese elemento deje de poder acceder a la web, y que además todos las Propuestas/Debates/Comentarios de ese usuario dejen de mostrarse en la web.</li>
<li><strong>Marcar como revisados</strong> cuando consideramos que esos elementos no deben ser moderados, que su contenido es correcto, y que por lo tanto deben dejar de ser mostrados en esta lista de elementos inapropiados.</li>
<p>A la derecha de cada elemento aparece una caja que podemos marcar para seleccionar todos los que queramos de la lista. Una vez seleccionados uno o varios, encontramos al final de la página <strong>tres botones para realizar acciones</strong> sobre ellos:</p>
<ul>
<li><strong>Ocultar</strong>: hará que esos elementos dejen de mostrarse en la web.</li>
<li><strong>Bloquear autores</strong>: hará que el autor de ese elemento deje de poder acceder a la web, y que además todos las Propuestas/Debates/Comentarios de ese usuario dejen de mostrarse en la web.</li>
<li><strong>Marcar como revisados</strong> cuando consideramos que esos elementos no deben ser moderados, que su contenido es correcto, y que por lo tanto deben dejar de ser mostrados en esta lista de elementos inapropiados.</li>
</ul>
<p>Para facilitar la gestión, arriba encontramos un <strong>filtro</strong> con las secciones:</p>
<ul>
<li><strong>Pendientes</strong>: las Propuestas/Debates/Comentarios sobre los que todavía no se ha pulsado "ocultar", "bloquear" o "marcar como revisados", y que por lo tanto deberían ser revisados todavía</li>
<li><strong>Todos</strong>: mostrando todos las Propuestas/Debates/Comentarios de la web, y no sólo los marcados como inapropiados.</li>
<li><strong>Marcados como revisados</strong>: los que algún moderador ha marcado como revisados y por lo tanto parecen correctos.</li>
</ul>
<p><em>Es recomendable revisar regularmente la sección "pendientes".</em></p>
</div>
</li>
<li class="accordion-item" data-accordion-item>
<a href="#" class="accordion-title">Bloquear usuarios</a>
<div class="accordion-content" data-tab-content>
<p>Un buscador nos permite encontrar cualquier usuario introduciendo su <em>nombre de usuario o correo electrónico</em>, y bloquearlo una vez encontrado. Al bloquearlo, <strong>el usuario no podrá volver a acceder a la web</strong>, y todas sus Propuestas/Debates/Comentarios serán ocultados y dejarán de ser visibles en la web.</p>
</div>
</li>
</ul>
<p>Para facilitar la gestión, arriba encontramos un <strong>filtro</strong> con las secciones:</p>
<ul>
<li><strong>Pendientes</strong>: las Propuestas/Debates/Comentarios sobre los que todavía no se ha pulsado "ocultar", "bloquear" o "marcar como revisados", y que por lo tanto deberían ser revisados todavía</li>
<li><strong>Todos</strong>: mostrando todos las Propuestas/Debates/Comentarios de la web, y no sólo los marcados como inapropiados.</li>
<li><strong>Marcados como revisados</strong>: los que algún moderador ha marcado como revisados y por lo tanto parecen correctos.</li>
</ul>
<p><em>Es recomendable revisar regularmente la sección "pendientes".</em></p>
<h3>Bloquear usuarios</h3>
<p>Un buscador nos permite encontrar cualquier usuario introduciendo su <em>nombre de usuario o correo electrónico</em>, y bloquearlo una vez encontrado. Al bloquearlo, <strong>el usuario no podrá volver a
acceder a la web</strong>, y todas sus Propuestas/Debates/Comentarios serán ocultados y dejarán de ser visibles en la web.</p>
</div>

View File

@@ -13,7 +13,7 @@
</div>
<%= form_tag moderate_moderation_proposals_path(request.query_parameters), method: :put do %>
<p class="float-left js-check">
<p class="js-check">
<%= t('shared.check') %>:
<%= link_to t('shared.check_all'), '#', data: {check_all: "proposal_ids[]"} %>
|
@@ -53,19 +53,19 @@
<%= submit_tag t('moderation.proposals.index.block_authors'),
name: "block_authors",
class: "button alert",
class: "button hollow alert",
data: {confirm: t('moderation.proposals.index.confirm')}
%>
<div class="float-right">
<%= submit_tag t('moderation.proposals.index.hide_proposals'),
name: "hide_proposals",
class: "button alert",
class: "button hollow alert",
data: {confirm: t('moderation.proposals.index.confirm')}
%>
<%= submit_tag t('moderation.proposals.index.ignore_flags'),
name: "ignore_flags",
class: "button success",
class: "button hollow",
data: {confirm: t('moderation.proposals.index.confirm')}
%>
</div>

View File

@@ -15,18 +15,24 @@
<h3><%= page_entries_info @users %></h3>
<% end %>
<ul class="admin-list">
<% @users.each do |user| %>
<li>
<%= user.name %>
<span class="bullet">&nbsp;&bull;&nbsp;</span>
<% if user.hidden? %>
<%= t("moderation.users.index.hidden") %>
<% else %>
<%= link_to t("moderation.users.index.hide"), hide_in_moderation_screen_moderation_user_path(user, request.query_parameters), method: :put, class: "delete" %>
<table id="moderation_users">
<tbody>
<% @users.each do |user| %>
<tr>
<td>
<%= user.name %>
</td>
<td class="text-right">
<% if user.hidden? %>
<%= t("moderation.users.index.hidden") %>
<% else %>
<%= link_to t("moderation.users.index.hide"), hide_in_moderation_screen_moderation_user_path(user, request.query_parameters),
method: :put, class: "button hollow alert" %>
</td>
<% end %>
</li>
<% end %>
</ul>
</tr>
<% end %>
</tbody>
</table>
<%= paginate @users %>

View File

@@ -27,6 +27,10 @@
<% end %>
</div>
<% if has_banners %>
<%= render "shared/banner" %>
<% end %>
<% if @featured_proposals.present? %>
<div id="featured-proposals" class="row featured-proposals">
<div class="small-12 column">

View File

@@ -0,0 +1,9 @@
<% banner = @banners.sample%>
<div class="<%= banner.style %>">
<div class="<%= banner.image %>">
<%= link_to banner.target_url do %>
<h2><%=banner.title%></h2>
<h3><%=banner.description%></h3>
<% end %>
</div>
</div>

View File

@@ -107,6 +107,7 @@ ignore_unused:
- 'unauthorized.*'
- 'admin.officials.level_*'
- 'admin.comments.index.filter*'
- 'admin.banners.index.filters.*'
- 'admin.debates.index.filter*'
- 'admin.proposals.index.filter*'
- 'admin.spending_proposals.index.filter*'

View File

@@ -9,6 +9,39 @@ en:
restore: Restore
mark_featured: Featured
unmark_featured: Unmark featured
banners:
index:
title: Banners
create: Create banner
edit: Edit banner
delete: Delete banner
filters:
all: All
with_active: Active
with_inactive: Inactive
banner:
title: Title
description: Description
target_url: Link
style: Style
image: Image
post_started_at: Post started at
post_ended_at: Post ended at
edit:
back: Back
editing: Edit banner
form:
submit_button: Save changes
errors:
form:
errors:
form:
error:
one: "prevented this banner from being saved"
other: 'prevented this banner from being saved'
new:
back: Back
creating: Create banner
activity:
show:
action: Action
@@ -17,6 +50,7 @@ en:
hide: Hidden
restore: Restored
by: Moderated by
content: Content
filter: Show
filters:
all: All
@@ -38,6 +72,7 @@ en:
title: Hidden comments
dashboard:
index:
back: Go back to
title: Administration
debates:
index:
@@ -59,6 +94,8 @@ en:
user_not_found: User not found
menu:
activity: Moderator activity
admin: Admin menu
banner: Manage banners
debate_topics: Debate topics
hidden_comments: Hidden comments
hidden_debates: Hidden debates
@@ -105,7 +142,6 @@ en:
cost: Cost
officials:
edit:
back: Back
destroy: Remove 'Official' status
title: 'Officials: Edit user'
flash:
@@ -131,9 +167,9 @@ en:
pending: Pending
rejected: Rejected
verified: Verified
hidden_count:
one: There is also one organisation with no users or with a hidden user
other: There are %{count} organisations with no users or with a hidden user
hidden_count_html:
one: There is also <strong>one organisation</strong> with no users or with a hidden user.
other: There are <strong>%{count} organisations</strong> with no users or with a hidden user.
reject: Reject
rejected: Rejected
search: Search
@@ -155,6 +191,8 @@ en:
flash:
updated: Value updated
index:
banners: Estilos de banners
banner_imgs: Imágenes para los banners
title: Configuration settings
update_setting: Update
feature_flags: Features
@@ -269,11 +307,10 @@ en:
without_confirmed_hide: Pending
title: Hidden users
show:
back: Back
email: 'Email:'
hidden_at: 'Hidden at:'
registered_at: 'Registered at:'
title: Activity of user %{user}
title: Activity of user (%{user})
verifications:
index:
phone_not_given: Phone not given

View File

@@ -9,6 +9,37 @@ es:
restore: Volver a mostrar
mark_featured: Destacar
unmark_featured: Quitar destacado
banners:
index:
title: Banners
create: Crear un banner
edit: Editar banner
delete: Eliminar banner
filters:
all: Todos
with_active: Activos
with_inactive: Inactivos
banner:
title: Título
description: Descripción
target_url: Enlace
style: Estilo
image: Imagen
post_started_at: Inicio de publicación
post_ended_at: Fin de publicación
edit:
back: Volver
editing: Editar el banner
form:
submit_button: Guardar Cambios
errors:
form:
error:
one: "error impidió guardar el banner"
other: "errores impidieron guardar el banner."
new:
back: Volver
creating: Crear banner
activity:
show:
action: Acción
@@ -17,6 +48,7 @@ es:
hide: Ocultado
restore: Restaurado
by: Moderado por
content: Contenido
filter: Mostrar
filters:
all: Todo
@@ -38,6 +70,7 @@ es:
title: Comentarios ocultos
dashboard:
index:
back: Volver a
title: Administración
debates:
index:
@@ -59,6 +92,8 @@ es:
user_not_found: Usuario no encontrado
menu:
activity: Actividad de moderadores
admin: Menú de administración
banner: Gestionar banners
debate_topics: Temas de debate
hidden_comments: Comentarios ocultos
hidden_debates: Debates ocultos
@@ -105,7 +140,6 @@ es:
cost: Coste total
officials:
edit:
back: Volver
destroy: Eliminar condición de 'Cargo Público'
title: 'Cargos Públicos: Editar usuario'
flash:
@@ -131,9 +165,9 @@ es:
pending: Pendientes
rejected: Rechazadas
verified: Verificadas
hidden_count:
one: Hay además una organización sin usuario o con el usuario bloqueado
other: Hay %{count} organizaciones sin usuario o con el usuario bloqueado
hidden_count_html:
one: Hay además <strong>una organización</strong> sin usuario o con el usuario bloqueado.
other: Hay <strong>%{count} organizaciones</strong> sin usuario o con el usuario bloqueado.
reject: Rechazar
rejected: Rechazada
search: Buscar
@@ -150,11 +184,13 @@ es:
all: Todas
with_confirmed_hide: Confirmadas
without_confirmed_hide: Pendientes
title: Propuestas ocultos
title: Propuestas ocultas
settings:
flash:
updated: Valor actualizado
index:
banners: Banner style
banner_imgs: Banner images
title: Configuración global
update_setting: Actualizar
feature_flags: Funcionalidades
@@ -269,11 +305,10 @@ es:
without_confirmed_hide: Pendientes
title: Usuarios bloqueados
show:
back: Volver
email: 'Email:'
hidden_at: 'Bloqueado:'
registered_at: 'Fecha de alta:'
title: Actividad del usuario %{user}
title: Actividad del usuario (%{user})
verifications:
index:
phone_not_given: No ha dado su teléfono

View File

@@ -143,6 +143,10 @@ Rails.application.routes.draw do
get :summary, on: :collection
end
resources :banners, only: [:index, :new, :create, :edit, :update, :destroy] do
collection { get :search}
end
resources :comments, only: :index do
member do
put :restore

View File

@@ -370,3 +370,21 @@ puts "Confirming hiding in debates, comments & proposals"
Comment.only_hidden.flagged.reorder("RANDOM()").limit(10).each(&:confirm_hide)
Debate.only_hidden.flagged.reorder("RANDOM()").limit(5).each(&:confirm_hide)
Proposal.only_hidden.flagged.reorder("RANDOM()").limit(5).each(&:confirm_hide)
puts "Creating banners"
Proposal.last(3).each do |proposal|
title = Faker::Lorem.sentence(word_count = 3)
description = Faker::Lorem.sentence(word_count = 12)
banner = Banner.create!(title: title,
description: description,
style: ["banner-style banner-style-one", "banner-style banner-style-two",
"banner-style banner-style-three"].sample,
image: ["banner-img banner-img-one", "banner-img banner-img-two",
"banner-img banner-img-three"].sample,
target_url: Rails.application.routes.url_helpers.proposal_path(proposal),
post_started_at: rand((Time.now - 1.week) .. (Time.now - 1.day)),
post_ended_at: rand((Time.now - 1.day) .. (Time.now + 1.week)),
created_at: rand((Time.now - 1.week) .. Time.now))
puts " #{banner.title}"
end

View File

@@ -0,0 +1,19 @@
class CreateBanners < ActiveRecord::Migration
def change
create_table :banners do |t|
t.string :title, limit: 80
t.string :description
t.string :target_url
t.string :style
t.string :image
t.date :post_started_at
t.date :post_ended_at
t.datetime :hidden_at
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end
add_index :banners, :hidden_at
end
end

View File

@@ -144,6 +144,21 @@ ActiveRecord::Schema.define(version: 20160531102008) do
t.integer "price"
end
create_table "banners", force: :cascade do |t|
t.string "title", limit: 80
t.string "description"
t.string "target_url"
t.string "style"
t.string "image"
t.date "post_started_at"
t.date "post_ended_at"
t.datetime "hidden_at"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end
add_index "banners", ["hidden_at"], name: "index_banners_on_hidden_at", using: :btree
create_table "campaigns", force: :cascade do |t|
t.string "name"
t.string "track_id"

View File

@@ -64,3 +64,13 @@ Setting['feature.public_stats'] = true
# Spending proposals feature flags
Setting['feature.spending_proposal_features.voting_allowed'] = true
# Banner styles
Setting['banner-style.banner-style-one'] = "Banner style 1"
Setting['banner-style.banner-style-two'] = "Banner style 2"
Setting['banner-style.banner-style-three'] = "Banner style 3"
# Banner images
Setting['banner-img.banner-img-one'] = "Banner image 1"
Setting['banner-img.banner-img-two'] = "Banner image 2"
Setting['banner-img.banner-img-three'] = "Banner image 3"

View File

@@ -377,5 +377,14 @@ FactoryGirl.define do
census_code { '01' }
end
factory :banner do
sequence(:title) { |n| "Banner title #{n}" }
sequence(:description) { |n| "This is the text of Banner #{n}" }
style {["banner-style-one", "banner-style-two", "banner-style-three"].sample}
image {["banner.banner-img-one", "banner.banner-img-two", "banner.banner-img-three"].sample}
target_url {["/proposals", "/debates" ].sample}
post_started_at Time.now - 7.days
post_ended_at Time.now + 7.days
end
end

View File

@@ -220,7 +220,7 @@ feature 'Admin activity' do
visit moderation_users_path(name_or_email: user.username)
within(".admin-list") do
within("#moderation_users") do
click_link 'Block'
end

View File

@@ -0,0 +1,163 @@
require 'rails_helper'
feature 'Admin banners magement' do
background do
login_as(create(:administrator).user)
end
context "Index" do
background do
@banner1 = create(:banner, title: "Banner number one",
description: "This is the text of banner number one and is not active yet",
target_url: "http://www.url.com",
style: "banner-style.banner-one",
image: "banner-img.banner-one",
post_started_at: (Time.now + 4.days),
post_ended_at: (Time.now + 10.days))
@banner2 = create(:banner, title: "Banner number two",
description: "This is the text of banner number two and is not longer active",
target_url: "http://www.url.com",
style: "banner-style.banner-two",
image: "banner-img.banner-two",
post_started_at: (Time.now - 10.days),
post_ended_at: (Time.now - 3.days))
@banner3 = create(:banner, title: "Banner number three",
description: "This is the text of banner number three and has style banner-three",
target_url: "http://www.url.com",
style: "banner-style.banner-three",
image: "banner-img.banner-three",
post_started_at: (Time.now - 1.days),
post_ended_at: (Time.now + 10.days))
@banner4 = create(:banner, title: "Banner number four",
description: "This is the text of banner number four and has style banner-one",
target_url: "http://www.url.com",
style: "banner-style.banner-one",
image: "banner-img.banner-one",
post_started_at: (DateTime.now - 10.days),
post_ended_at: (DateTime.now + 10.days))
@banner5 = create(:banner, title: "Banner number five",
description: "This is the text of banner number five and has style banner-two",
target_url: "http://www.url.com",
style: "banner-style.banner-one",
image: "banner-img.banner-one",
post_started_at: (DateTime.now - 10.days),
post_ended_at: (DateTime.now + 10.days))
end
scenario 'Index show active banners' do
visit admin_banners_path(filter: 'with_active')
expect(page).to have_content("There are 3 banners")
end
scenario 'Index show inactive banners' do
visit admin_banners_path(filter: 'with_inactive')
expect(page).to have_content("There are 2 banners")
end
scenario 'Index show all banners' do
visit admin_banners_path
expect(page).to have_content("There are 5 banners")
end
end
scenario 'Banners publication is listed on admin menu' do
visit admin_root_path
within('#side_menu') do
expect(page).to have_link "Manage banners"
end
end
scenario 'Publish a banner' do
visit admin_root_path
within('#side_menu') do
click_link "Manage banners"
end
click_link "Create banner"
select 'Banner style 1', from: 'banner_style'
select 'Banner image 2', from: 'banner_image'
fill_in 'banner_title', with: 'Such banner'
fill_in 'banner_description', with: 'many text wow link'
fill_in 'banner_target_url', with: 'https://decide.madrid.es'
last_week = Time.now - 7.days
next_week = Time.now + 7.days
fill_in 'post_started_at', with: last_week.strftime("%d/%m/%Y")
fill_in 'post_ended_at', with: next_week.strftime("%d/%m/%Y")
click_button 'Save changes'
expect(page).to have_content 'Such banner'
visit proposals_path
expect(page).to have_content 'Such banner'
expect(page).to have_link 'Such banner many text wow link', href: 'https://decide.madrid.es'
end
scenario 'Edit banner with live refresh', :js do
banner1 = create(:banner, title: 'Hello',
description: 'Wrong text',
target_url: 'http://www.url.com',
style: 'banner-style.banner-one',
image: 'banner-img.banner-one',
post_started_at: (Time.now + 4.days),
post_ended_at: (Time.now + 10.days))
visit admin_root_path
within('#side_menu') do
click_link "Manage banners"
end
click_link "Edit banner"
select 'Banner style 1', from: 'banner_style'
select 'Banner image 2', from: 'banner_image'
fill_in 'banner_title', with: 'Modified title'
fill_in 'banner_description', with: 'Edited text'
within('div#js-banner-style') do
expect(page).to have_selector('h2', :text => 'Modified title')
expect(page).to have_selector('h3', :text => 'Edited text')
end
click_button 'Save changes'
visit admin_banners_path
expect(page).to have_content 'Modified title'
expect(page).to have_content 'Edited text'
expect(page).to_not have_content 'Hello'
expect(page).to_not have_content 'Wrong text'
end
scenario 'Delete a banner' do
banner1 = create(:banner, title: 'Ugly banner',
description: 'Bad text',
target_url: 'http://www.url.com',
style: 'banner-style.banner-one',
image: 'banner-img.banner-one',
post_started_at: (Time.now + 4.days),
post_ended_at: (Time.now + 10.days))
visit admin_root_path
within("#side_menu") do
click_link "Manage banners"
end
expect(page).to have_content 'Ugly banner'
click_link "Delete banner"
visit admin_root_path
expect(page).to_not have_content 'Ugly banner'
end
end

View File

@@ -9,7 +9,7 @@ feature 'Admin feature flags' do
scenario 'Enabled features are listed on menu' do
visit admin_root_path
within('#admin_menu') do
within('#side_menu') do
expect(page).to have_link "Spending proposals"
expect(page).to have_link "Hidden debates"
end
@@ -28,7 +28,7 @@ feature 'Admin feature flags' do
visit admin_root_path
within('#admin_menu') do
within('#side_menu') do
expect(page).not_to have_link "Spending proposals"
end
@@ -42,7 +42,7 @@ feature 'Admin feature flags' do
visit admin_root_path
within('#admin_menu') do
within('#side_menu') do
expect(page).not_to have_link "Spending proposals"
end
@@ -56,7 +56,7 @@ feature 'Admin feature flags' do
visit admin_root_path
within('#admin_menu') do
within('#side_menu') do
expect(page).to have_link "Spending proposals"
end
end

View File

@@ -62,13 +62,13 @@ feature 'Moderate users' do
fill_in 'name_or_email', with: 'Wanda'
click_button 'Search'
within(".admin-list") do
within("#moderation_users") do
expect(page).to have_content citizen.name
expect(page).not_to have_content "Blocked"
click_link 'Block'
end
within(".admin-list") do
within("#moderation_users") do
expect(page).to have_content citizen.name
expect(page).to have_content "Blocked"
end

View File

@@ -54,4 +54,28 @@ describe Setting do
expect(setting.enabled?).to eq false
end
end
describe "#banner_style?" do
it "should be true if key starts with 'banner-style.'" do
setting = Setting.create(key: 'banner-style.whatever')
expect(setting.banner_style?).to eq true
end
it "should be false if key does not start with 'banner-style.'" do
setting = Setting.create(key: 'whatever')
expect(setting.banner_style?).to eq false
end
end
describe "#banner_img?" do
it "should be true if key starts with 'banner-img.'" do
setting = Setting.create(key: 'banner-img.whatever')
expect(setting.banner_img?).to eq true
end
it "should be false if key does not start with 'banner-img.'" do
setting = Setting.create(key: 'whatever')
expect(setting.banner_img?).to eq false
end
end
end