Skip to content

Commit

Permalink
Merge branch 'master' into wrong-events-index-title
Browse files Browse the repository at this point in the history
  • Loading branch information
taitus committed Dec 18, 2017
2 parents 07c1cba + bfab71e commit 0d6a45d
Show file tree
Hide file tree
Showing 10 changed files with 163 additions and 85 deletions.
105 changes: 99 additions & 6 deletions app/assets/stylesheets/all.css.scss
Original file line number Diff line number Diff line change
Expand Up @@ -7032,12 +7032,15 @@ header{
line-height: 48px;
font-family: 'Open Sans';
display: block;
margin-bottom: 50px; }

}
@media only screen and (max-width: 40em) {
.title-l {
font-size: 26px;
line-height: 28px;
margin-bottom: 20px; } }
margin-bottom: 20px;
}
}

.title-m {
font-size: 28px;
Expand Down Expand Up @@ -7285,7 +7288,7 @@ button, a {
}
.title-l {
font-weight: 700;
margin-bottom: 70px;
// margin-bottom: 70px;
}
select {
height: 3.1125rem;
Expand Down Expand Up @@ -7343,12 +7346,10 @@ select {

.top_bar_box {
padding: 35px 0 100px;
//background: #004A83;
background: #003df6;
padding: 0;
}
.sub_top_bar_box{
// background: #0363a7;
background: #0000e1;
ul{
margin-bottom:0;
Expand All @@ -7366,7 +7367,6 @@ select {
}
}
}

.header-title{
background: #f5f7f8;
text-align: center;
Expand Down Expand Up @@ -7627,3 +7627,96 @@ header .top-bar{
margin-top: 1.8rem;
}
}

.visit-organizations-list{
select {
height: 2.8rem;
}

.button.small{
padding-left: 1rem;
padding-right: 1rem;
}
.result-l{
font-weight: normal;
}
.result-l,
.export {
margin-top: 1.3rem;
}

.export{
a{
margin-top:0.6rem;
span{
display: inline-block;
font-size: 13px;
margin-left:3px;
margin-right:3px;
}
}
}
.list-organizations{
padding: 0;
}
.box .post{
border-bottom: 0;
margin-bottom:0;
padding: 1.6rem 1rem;
}

article{
&:nth-child(odd){
background: #f8f8f8;
}
&:nth-child(even){
background: #f1f1f1;
}
}
}

.no-padding{
padding: 0;
}

@media only screen and (min-width: 40.0625em) {
.visit-organizations-list{
.title-s{
font-size: 13px;
}
.order-select{
padding: 0;
}
}
}

@media screen and (min-width: 40em) {
.buttons-action{
padding: 0;
}
}

@media screen and (min-width: 40em) and (max-width: 63.9375em) {
.visit-organizations-list{
.title-s{
font-size: 12px;
}
.buttons-action{
text-align: right;
.button.small {
padding-left: 0.8rem;
padding-right: 0.8rem;
}
}
.result-l{
font-size: 1.4rem;
}
}
}

@media screen and (max-width: 39.9375em) {
.order-select{
padding: 0;
margin-bottom:0;
}
}
2 changes: 1 addition & 1 deletion app/controllers/organizations_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def search(params)
fulltext(params[:keyword], :fields => [:agent_second_surname]) if params[:keyword].present?
end
order_by :created_at, :desc
paginate page: params[:format].present? ? 1 : params[:page] || 1, per_page: params[:format].present? ? 1000 : 10
paginate page: params[:format].present? ? 1 : params[:page] || 1, per_page: params[:format].present? ? 1000 : 20
end
end

Expand Down
7 changes: 5 additions & 2 deletions app/helpers/application_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,11 @@ def form_field_errors(form, field)
end

def export_link(url)
link_to url, class: "right dib dn hide-for-small-only" do
content_tag(:span, "", class: "icon icon__export") + t('main.export')
link_to url, class: "right hide-for-small-only" do
content_tag(:div) do
concat(content_tag(:span, "", class: "icon icon__export"))
concat(content_tag(:span, t('main.export')))
end
end
end

Expand Down
7 changes: 4 additions & 3 deletions app/views/organizations/_organization.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@
</h1>
<p>
<%= I18n.l organization.inscription_date, format: :complete %>
<span class="bullet">&nbsp;&bull;&nbsp;</span>
<%= "#{t('organizations.events_as_lobby')}: #{events_as_lobby_by(organization)}" %>

<% if events_as_lobby_by(organization) > 0 %>
<span class="bullet">&nbsp;&bull;&nbsp;</span>
<%= "#{t('organizations.events_as_lobby')}: #{events_as_lobby_by(organization)}" %>
<% end %>
</p>
</article>
33 changes: 14 additions & 19 deletions app/views/organizations/_search_form.html.erb
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
<div class="small-12 large-4 columns">
<p><%= t("organizations.description") %></p>
<br>

<div class="small-12 columns">
<%= form_tag organizations_path, method: :get do %>
<%= hidden_field_tag :order, params[:order] %>
<div class="mb20">

<div class="small-12 medium-12 large-4 columns">
<%= label_tag :area, t("organizations.description"), class: 'title-s' %>
<%= text_field_tag :keyword, params[:keyword], placeholder: t("main.form.keyword") %>
<%= check_box_tag(:lobby_activity, value = "1", checked = check_filter_lobby_activity , id: "lobby_activity")%>
<%= label_tag(:lobby_activity, t("backend.lobby_activity")) %>
</div>

<div class="mb20">
<div class="small-12 medium-6 large-3 columns">
<%= label_tag :area, t('main.form.filter_by_category'), class: 'title-s' %>
<%= select_tag :category,
options_for_select(Category.where(display: true).all.map {
Expand All @@ -19,7 +20,7 @@
class: "dropdown" %>
</div>

<div class="mb20">
<div class="small-12 medium-6 large-3 columns">
<%= label_tag :area, t('main.form.filter_by_interests'), class: 'title-s' %>
<%= select_tag :interests,
options_for_select(Interest.all.map {
Expand All @@ -30,18 +31,12 @@
class: "dropdown" %>
</div>

<div class="row">
<div class="small-1 columns center">
<%= check_box_tag(:lobby_activity, value = "1", checked = check_filter_lobby_activity , id: "lobby_activity")%>
</div>
<div class="small-11 columns right">
<%= label_tag(:lobby_activity, t("backend.lobby_activity")) %>
</div>
</div>

<div class="mb20">
<%= link_to t("main.form.reset"), organizations_path, class: "button secondary" %>
<%= submit_tag t("main.form.search"), class: "button" %>
<div class="small-12 medium-12 large-2 columns buttons-action text-right">
<br />
<%= link_to t("main.form.clear"), organizations_path, class: "button secondary small" %>
<%= submit_tag t("main.form.search"), class: "button small" %>
<br />
</div>
<% end %>
<hr />
</div>
78 changes: 34 additions & 44 deletions app/views/organizations/index.html.erb
Original file line number Diff line number Diff line change
@@ -1,66 +1,56 @@
<% content_for(:body_class) { 'visit-organizations-list' } %>
<div class="row">
<div class="small-12 columns">
<h2 class="title-l"><%= t("organizations.title") %></h2>
<h2 class="small-12 columns title-l mb40">
<%= t("organizations.title") %></h2>
</div>
</div>

<div class="row">
<%= render 'search_form' %>
<div class="small-12 large-7 large-ofsset-1 columns mb40">
<div class="small-12 columns mb40">
<% if params[:keyword].present? %>
<%= render "shared/search_keywords",
collection: @organizations,
keyword: params[:keyword] %>
<% end %>

<div class="row">
<div class="medium-7 columns">
<% unless search_by_filter? %>
<p><strong class="result-l mb20"><%= organizations_index_subtitle %></strong></p>
<p><span class="result-l"><%= organizations_index_subtitle %></span></p>
<% end %>
</div>
<div class="small-12 medium-5 columns order-select">
<div class="small-12 medium-8 columns">
<label for="right-label" class="title-xs">
<%= t("main.form.order_by") %>
</label>
<%= select_tag :order,
options_for_select({
t("main.form.name_asc") => 1,
t("main.form.name_desc") => 2,
t("main.form.inscription_date_asc") => 3,
t("main.form.inscription_date_desc") => 4
}, params[:order]),
include_blank: true,
id: "search-order",
class: "select-sm" %>
</div>

<div class="row">
<div class="tools">
<div class="small-2 columns mb20">
<label for="right-label" class="inline title-xs"><%= t("main.form.order_by") %></label>
</div>
<div class="small-7 columns">
<%= select_tag :order,
options_for_select({
t("main.form.name_asc") => 1,
t("main.form.name_desc") => 2,
t("main.form.inscription_date_asc") => 3,
t("main.form.inscription_date_desc") => 4
}, params[:order]),
include_blank: true,
id: "search-order",
class: "select-sm" %>
</div>
<div class="small-3 columns">
<%= export_link(current_url(format: :csv)) %>
</div>
<div class="small-12 medium-4 columns export no-padding">
<%= export_link(current_url(format: :csv)) %>
</div>
</div>

<div class="row">
<div class="small-12 columns mb20">
<div class="text-left">
<%= paginate @organizations.hits %>
</div>
<div class="small-12 columns mb20">
<div class="text-left">
<%= paginate @organizations.hits %>
</div>
</div>

<% @paginated_organizations.each do |organization| %>
<%= render organization %>
<% end %>
<%= paginate @organizations.hits %>
</div>
</div>

<div class="row">
<div class="small-12 columns mb20">
<div class="text-left">

<div class="small-12 columns mb20 list-organizations">
<% @paginated_organizations.each do |organization| %>
<%= render organization %>
<% end %>
</div>
<div class="small-12 columns">
<%= paginate @organizations.hits %>
</div>
</div>
</div>
Expand Down
5 changes: 0 additions & 5 deletions app/views/visitors/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,6 @@
<%= paginate @events.hits %>
</div>
</div>
<!--
<div class="small-12 large-4 columns">
<p><%= link_to t('main.any_errors'), '' %></p>
</div>
-->
</div>


Expand Down
1 change: 1 addition & 0 deletions config/locales/public.es.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ es:
any: "Todos"
search: "Buscar"
reset: "Cancelar"
clear: "Limpiar"
order_by: "Orden"
scheduled: "Fecha"
score: "Relevancia"
Expand Down
2 changes: 1 addition & 1 deletion db/test_seeds.rb
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@
organization_11 = Organization.create(name: Faker::Name.name, first_surname: Faker::Name.last_name, second_surname: Faker::Name.last_name, entity_type: :federation, inscription_date: Date.yesterday, denied_public_data: false, denied_public_events: false, user: user_lobby_11, category: category_2)

30.times do
Organization.create(name: Faker::Name.name, first_surname: Faker::Name.last_name, second_surname: Faker::Name.last_name, entity_type: :federation, inscription_date: Date.yesterday, denied_public_data: false, denied_public_events: false, user: user_lobby_11, category: category_2)
Organization.create(name: Faker::Name.name, first_surname: Faker::Name.last_name, second_surname: Faker::Name.last_name, entity_type: :lobby, inscription_date: Date.yesterday, denied_public_data: false, denied_public_events: false, user: user_lobby_11, category: category_2)
end

#Legal Representant
Expand Down
8 changes: 4 additions & 4 deletions spec/features/organizations_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,14 @@
expect(page).not_to have_content organization2.name
end

scenario 'Should not show paginator when there are less than 10 results' do
scenario 'Should not show paginator when there are less than 20 results' do
visit organizations_path

expect(page).not_to have_selector ".pagination"
end

scenario 'Should show paginator when there are more than 11 results', :search do
create_list(:organization, 11)
scenario 'Should show paginator when there are more than 20 results', :search do
create_list(:organization, 21)
Organization.reindex

visit organizations_path
Expand Down Expand Up @@ -117,7 +117,7 @@
fill_in :keyword, with: "Fulanito"
expect(find('#keyword').value).to eq "Fulanito"
click_on "Buscar"
click_on "Cancelar"
click_on "Limpiar"

expect(find('#keyword').value).to eq nil
end
Expand Down

0 comments on commit 0d6a45d

Please sign in to comment.