From e7327860e4dee34464d6bfe453e3b5eb7ea232d8 Mon Sep 17 00:00:00 2001 From: Alberto Garcia Cabeza Date: Wed, 14 Dec 2016 13:51:39 +0100 Subject: [PATCH 1/5] improves headings and html structure --- app/assets/stylesheets/admin.scss | 7 +++++++ app/views/admin/_menu.html.erb | 4 ++-- app/views/layouts/_admin_header.html.erb | 16 +++++++++------- app/views/layouts/admin.html.erb | 4 ++-- 4 files changed, 20 insertions(+), 11 deletions(-) diff --git a/app/assets/stylesheets/admin.scss b/app/assets/stylesheets/admin.scss index c349a1c9c..cc11557c5 100644 --- a/app/assets/stylesheets/admin.scss +++ b/app/assets/stylesheets/admin.scss @@ -32,6 +32,13 @@ body.admin { height: auto; } + .top-bar-title { + + h1 { + margin-bottom: 0; + } + } + form { .button { diff --git a/app/views/admin/_menu.html.erb b/app/views/admin/_menu.html.erb index f7b0a2ac5..b2f4eb5d8 100644 --- a/app/views/admin/_menu.html.erb +++ b/app/views/admin/_menu.html.erb @@ -1,4 +1,4 @@ - + diff --git a/app/views/layouts/_admin_header.html.erb b/app/views/layouts/_admin_header.html.erb index d8dfe9d23..5fa3bc58f 100644 --- a/app/views/layouts/_admin_header.html.erb +++ b/app/views/layouts/_admin_header.html.erb @@ -1,11 +1,11 @@
- +
@@ -19,11 +19,13 @@
- <%= 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'] %> -  | <%= t("admin.dashboard.index.title") %> - <% end %> +

+ <%= 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'] %> +  | <%= t("admin.dashboard.index.title") %> + <% end %> +

diff --git a/app/views/layouts/admin.html.erb b/app/views/layouts/admin.html.erb index e5741086a..198bf3adf 100644 --- a/app/views/layouts/admin.html.erb +++ b/app/views/layouts/admin.html.erb @@ -30,7 +30,7 @@
<%= render 'layouts/admin_header' %> -
+
@@ -46,7 +46,7 @@ <%= render 'layouts/flash' %> <%= yield %>
-
+
From 6498d1c34dc1fd1ff16844ace5aedd46b9689969 Mon Sep 17 00:00:00 2001 From: Alberto Garcia Cabeza Date: Wed, 14 Dec 2016 13:52:18 +0100 Subject: [PATCH 2/5] improves styles for admin polls views --- app/assets/stylesheets/admin.scss | 5 ++ app/views/admin/poll/polls/_booths.html.erb | 69 +++++++++---------- .../admin/poll/polls/_filter_subnav.html.erb | 50 ++++++-------- app/views/admin/poll/polls/_officers.html.erb | 57 +++++++-------- .../admin/poll/polls/_questions.html.erb | 49 ++++++------- 5 files changed, 105 insertions(+), 125 deletions(-) diff --git a/app/assets/stylesheets/admin.scss b/app/assets/stylesheets/admin.scss index cc11557c5..5c7aab0fc 100644 --- a/app/assets/stylesheets/admin.scss +++ b/app/assets/stylesheets/admin.scss @@ -155,6 +155,11 @@ body.admin { } } +.admin .tabs-panel { + padding-left: 0; + padding-right: 0; +} + // 02. Sidebar // ----------- diff --git a/app/views/admin/poll/polls/_booths.html.erb b/app/views/admin/poll/polls/_booths.html.erb index ae6d28abe..4d52d8a74 100644 --- a/app/views/admin/poll/polls/_booths.html.erb +++ b/app/views/admin/poll/polls/_booths.html.erb @@ -1,39 +1,34 @@ -
-
- <% if @poll.booths.empty? %> -
- <%= t("admin.polls.show.no_booths") %> -
- <% else %> +

<%= t("admin.polls.show.booths_title") %>

-

<%= t("admin.polls.show.booths_title") %>

- - - - - - - - - <% @poll.booths.each do |booth| %> - - - - - - <% end %> - -
<%= t("admin.polls.show.name") %><%= t("admin.polls.show.location") %> 
- - <%= link_to booth.name, admin_booth_path(booth) %> - - - <%= booth.location %> - - <%= link_to t("admin.polls.show.remove_booth"), - "#", - class: "button hollow alert" %> -
- <% end %> +<% if @poll.booths.empty? %> +
+ <%= t("admin.polls.show.no_booths") %>
-
\ No newline at end of file +<% else %> + + + + + + + + <% @poll.booths.each do |booth| %> + + + + + + <% end %> + +
<%= t("admin.polls.show.name") %><%= t("admin.polls.show.location") %> 
+ + <%= link_to booth.name, admin_booth_path(booth) %> + + + <%= booth.location %> + + <%= link_to t("admin.polls.show.remove_booth"), + "#", + class: "button hollow alert" %> +
+<% end %> diff --git a/app/views/admin/poll/polls/_filter_subnav.html.erb b/app/views/admin/poll/polls/_filter_subnav.html.erb index d92cf7235..e55e52f63 100644 --- a/app/views/admin/poll/polls/_filter_subnav.html.erb +++ b/app/views/admin/poll/polls/_filter_subnav.html.erb @@ -1,30 +1,20 @@ -
-
-
    -
  • - <%= link_to "#tab-questions" do %> -

    - <%= t("admin.polls.show.questions_tab") %> - (<%= @poll.questions.count %>) -

    - <% end %> -
  • -
  • - <%= link_to "#tab-booths" do %> -

    - <%= t("admin.polls.show.booths_tab") %> - (<%= @poll.booths.count %>) -

    - <% end %> -
  • -
  • - <%= link_to "#tab-officers" do %> -

    - <%= t("admin.polls.show.officers_tab") %> - (<%= @poll.officers.count %>) -

    - <% end %> -
  • -
-
-
\ No newline at end of file +
    +
  • + <%= link_to "#tab-questions" do %> + <%= t("admin.polls.show.questions_tab") %> + (<%= @poll.questions.count %>) + <% end %> +
  • +
  • + <%= link_to "#tab-booths" do %> + <%= t("admin.polls.show.booths_tab") %> + (<%= @poll.booths.count %>) + <% end %> +
  • +
  • + <%= link_to "#tab-officers" do %> + <%= t("admin.polls.show.officers_tab") %> + (<%= @poll.officers.count %>) + <% end %> +
  • +
diff --git a/app/views/admin/poll/polls/_officers.html.erb b/app/views/admin/poll/polls/_officers.html.erb index 240eb7b1c..11b4cce50 100644 --- a/app/views/admin/poll/polls/_officers.html.erb +++ b/app/views/admin/poll/polls/_officers.html.erb @@ -1,33 +1,28 @@ -
-
- <% if @poll.officers.empty? %> -
- <%= t("admin.polls.show.no_officers") %> -
- <% else %> +

<%= t("admin.polls.show.officers_title") %>

-

<%= t("admin.polls.show.officers_title") %>

- - - - - - - - <% @poll.officers.each do |officer| %> - - - - - <% end %> - -
<%= t("admin.polls.show.name") %><%= t("admin.polls.show.email") %>
- - <%= officer.name %> - - - <%= officer.email %> -
- <% end %> +<% if @poll.officers.empty? %> +
+ <%= t("admin.polls.show.no_officers") %>
-
\ No newline at end of file +<% else %> + + + + + + + <% @poll.officers.each do |officer| %> + + + + + <% end %> + +
<%= t("admin.polls.show.name") %><%= t("admin.polls.show.email") %>
+ + <%= officer.name %> + + + <%= officer.email %> +
+<% end %> diff --git a/app/views/admin/poll/polls/_questions.html.erb b/app/views/admin/poll/polls/_questions.html.erb index 91f33196c..08b094ddf 100644 --- a/app/views/admin/poll/polls/_questions.html.erb +++ b/app/views/admin/poll/polls/_questions.html.erb @@ -1,29 +1,24 @@ -
-
- <% if @poll.questions.empty? %> -
- <%= t('admin.polls.show.no_questions') %> -
- <% else %> +

<%= t("admin.polls.show.questions_title") %>

-

<%= t("admin.polls.show.questions_title") %>

- - - <% @poll.questions.each do |question| %> - - - - - <% end %> -
<%= link_to question.title, admin_question_path(question) %> - <%= link_to t('shared.edit'), - edit_admin_question_path(question), - class: "button hollow" %> - <%= link_to t('shared.delete'), - admin_question_path(question), - class: "button hollow alert", - method: :delete %> -
- <% end %> +<% if @poll.questions.empty? %> +
+ <%= t('admin.polls.show.no_questions') %>
-
\ No newline at end of file +<% else %> + + <% @poll.questions.each do |question| %> + + + + + <% end %> +
<%= link_to question.title, admin_question_path(question) %> + <%= link_to t('shared.edit'), + edit_admin_question_path(question), + class: "button hollow" %> + <%= link_to t('shared.delete'), + admin_question_path(question), + class: "button hollow alert", + method: :delete %> +
+<% end %> From cbbc3ed1bef50c08dddb284cf28a16705de1ef3b Mon Sep 17 00:00:00 2001 From: Alberto Garcia Cabeza Date: Wed, 14 Dec 2016 17:58:21 +0100 Subject: [PATCH 3/5] improves styles for admin questions views --- app/assets/stylesheets/admin.scss | 13 ++++++++++--- app/views/admin/poll/questions/_filter.html.erb | 15 +++++++-------- app/views/admin/poll/questions/_form.html.erb | 14 +++++++++----- app/views/admin/poll/questions/_search.html.erb | 14 ++++++-------- app/views/admin/poll/questions/index.html.erb | 13 ++++++++++--- config/locales/admin.en.yml | 3 +++ config/locales/admin.es.yml | 5 ++++- 7 files changed, 49 insertions(+), 28 deletions(-) diff --git a/app/assets/stylesheets/admin.scss b/app/assets/stylesheets/admin.scss index 5c7aab0fc..adc166d96 100644 --- a/app/assets/stylesheets/admin.scss +++ b/app/assets/stylesheets/admin.scss @@ -84,6 +84,11 @@ body.admin { color: $admin-color; } + .tabs-panel { + padding-left: 0; + padding-right: 0; + } + #proposals { width: 100% !important; } @@ -155,9 +160,11 @@ body.admin { } } -.admin .tabs-panel { - padding-left: 0; - padding-right: 0; +.input-group { + + .input-group-button { + padding-bottom: rem-calc(16); + } } // 02. Sidebar diff --git a/app/views/admin/poll/questions/_filter.html.erb b/app/views/admin/poll/questions/_filter.html.erb index c12c62f2d..0fd800067 100644 --- a/app/views/admin/poll/questions/_filter.html.erb +++ b/app/views/admin/poll/questions/_filter.html.erb @@ -1,8 +1,7 @@ -
- <%= form_tag '', method: :get do %> - <%= select_tag "poll_id", - poll_select_options(true), - prompt: t("admin.questions.index.select_poll"), - class: "js-location-changer" %> - <% end %> -
\ No newline at end of file +<%= form_tag '', method: :get do %> + <%= label_tag :poll_id, t("admin.questions.index.filter_poll") %> + <%= select_tag "poll_id", + poll_select_options(true), + prompt: t("admin.questions.index.select_poll"), + class: "js-location-changer" %> +<% end %> diff --git a/app/views/admin/poll/questions/_form.html.erb b/app/views/admin/poll/questions/_form.html.erb index f9362995b..dbc8883e3 100644 --- a/app/views/admin/poll/questions/_form.html.erb +++ b/app/views/admin/poll/questions/_form.html.erb @@ -7,15 +7,19 @@
-
- <%= f.select :poll_id, - options_for_select(Poll.pluck(:name, :id)), - prompt: t("admin.questions.index.select_poll") %> +
+ <%= f.select :poll_id, + options_for_select(Poll.pluck(:name, :id)), + prompt: t("admin.questions.index.select_poll"), + label: t("admin.questions.new.poll_label") %>
<%= f.text_field :title, maxlength: Poll::Question.title_max_length %> - <%= f.text_field :valid_answers %> + <%= f.label :valid_answers %> +

<%= t("admin.questions.new.valid_answers_note") %>

+ <%= f.text_field :valid_answers, label: false %> + <%= f.text_area :summary, rows: 4, maxlength: 200 %> diff --git a/app/views/admin/poll/questions/_search.html.erb b/app/views/admin/poll/questions/_search.html.erb index 30cf0d6e5..7ee1308f7 100644 --- a/app/views/admin/poll/questions/_search.html.erb +++ b/app/views/admin/poll/questions/_search.html.erb @@ -1,12 +1,10 @@ <%= form_tag(admin_questions_path, method: :get) do |f| %> -
-
- <%= text_field_tag :search, - @search, - placeholder: t("admin.shared.spending_proposal_search.placeholder") %> -
-
+
+ <%= text_field_tag :search, + @search, + placeholder: t("admin.shared.spending_proposal_search.placeholder") %> +
<%= submit_tag t("admin.shared.spending_proposal_search.button"), class: "button" %>
-<% end %> \ No newline at end of file +<% end %> diff --git a/app/views/admin/poll/questions/index.html.erb b/app/views/admin/poll/questions/index.html.erb index 2aef2b6e5..77772fbf7 100644 --- a/app/views/admin/poll/questions/index.html.erb +++ b/app/views/admin/poll/questions/index.html.erb @@ -3,11 +3,18 @@ <%= link_to t('admin.questions.index.create'), new_admin_question_path, class: "button success float-right" %> -<%= render 'filter' %> -<%= render 'search' %> +
+
+ <%= render 'search' %> +
+
+ +
+ <%= render 'filter' %> +
<% if @questions.count == 0 %> -
+
<%= t('admin.questions.index.no_questions') %>
<% else %> diff --git a/config/locales/admin.en.yml b/config/locales/admin.en.yml index 4c498a280..09f5e16fb 100755 --- a/config/locales/admin.en.yml +++ b/config/locales/admin.en.yml @@ -194,11 +194,14 @@ en: title: "Questions" create: "Create question" no_questions: "There are no questions." + filter_poll: Filter by Poll select_poll: Select Poll edit: title: "Edit Question" new: title: "Create Question" + poll_label: "Poll" + valid_answers_note: "Enter the answers separated by commas (,)" show: proposal: Original proposal author: Author diff --git a/config/locales/admin.es.yml b/config/locales/admin.es.yml index 2e294147a..f96d2d815 100644 --- a/config/locales/admin.es.yml +++ b/config/locales/admin.es.yml @@ -194,11 +194,14 @@ es: title: "Preguntas ciudadanas" create: "Crear pregunta ciudadana" no_questions: "No hay ninguna pregunta ciudadana." - select_poll: Seleccionar votación + filter_poll: "Filtrar por votación" + select_poll: "Seleccionar votación" edit: title: "Editar pregunta ciudadana" new: title: "Crear pregunta ciudadana" + poll_label: "Votación" + valid_answers_note: "Escribe las respuestas separadas por comas (,)" show: proposal: Propuesta ciudadana original author: Autor From b290a776dd20f4b8df66d961201e7ad337da0eda Mon Sep 17 00:00:00 2001 From: Alberto Garcia Cabeza Date: Wed, 14 Dec 2016 18:13:33 +0100 Subject: [PATCH 4/5] improves styles for admin officers views --- .../admin/poll/officers/_officer.html.erb | 56 ++++++++++--------- .../admin/poll/officers/_search.html.erb | 9 +++ app/views/admin/poll/officers/index.html.erb | 25 +++++---- config/locales/admin.en.yml | 3 + config/locales/admin.es.yml | 3 + 5 files changed, 60 insertions(+), 36 deletions(-) create mode 100644 app/views/admin/poll/officers/_search.html.erb diff --git a/app/views/admin/poll/officers/_officer.html.erb b/app/views/admin/poll/officers/_officer.html.erb index c9251548d..80434f385 100644 --- a/app/views/admin/poll/officers/_officer.html.erb +++ b/app/views/admin/poll/officers/_officer.html.erb @@ -1,26 +1,30 @@ -
- - - - - - - - -
- <%= officer.name %> - - <%= officer.email %> - - <% if officer.persisted? %> - <%= link_to t('admin.poll_officers.officer.delete'), - admin_poll_officer_path(officer), - method: :delete, - class: "button hollow alert" %> - <% else %> - <%= link_to t('admin.poll_officers.officer.add'),{ controller: "admin/poll/officers", action: :create, user_id: officer.user_id }, - method: :post, - class: "button success" %> - <% end %> -
-
+ + + + + + + + + + + + + + +
<%= t('admin.poll_officers.officer.name') %><%= t('admin.poll_officers.officer.email') %>
+ <%= officer.name %> + + <%= officer.email %> + + <% if officer.persisted? %> + <%= link_to t('admin.poll_officers.officer.delete'), + admin_poll_officer_path(officer), + method: :delete, + class: "button hollow alert" %> + <% else %> + <%= link_to t('admin.poll_officers.officer.add'),{ controller: "admin/poll/officers", action: :create, user_id: officer.user_id }, + method: :post, + class: "button success" %> + <% end %> +
diff --git a/app/views/admin/poll/officers/_search.html.erb b/app/views/admin/poll/officers/_search.html.erb new file mode 100644 index 000000000..dda22dee2 --- /dev/null +++ b/app/views/admin/poll/officers/_search.html.erb @@ -0,0 +1,9 @@ +<%= form_tag search_admin_officers_path, method: :get, remote: true do %> +
+ <%= text_field_tag :email, '', + placeholder: t("admin.poll_officers.search.email_placeholder") %> +
+ <%= submit_tag t("admin.poll_officers.search.search"), class: "button" %> +
+
+<% end %> diff --git a/app/views/admin/poll/officers/index.html.erb b/app/views/admin/poll/officers/index.html.erb index cc6393204..d6e11682b 100644 --- a/app/views/admin/poll/officers/index.html.erb +++ b/app/views/admin/poll/officers/index.html.erb @@ -1,21 +1,25 @@

<%= t("admin.poll_officers.index.title") %>

- <%= form_tag search_admin_officers_path, method: :get, remote: true do %> -
- <%= text_field_tag :email, '', placeholder: t('admin.poll_officers.search.email_placeholder') %> -
-
- <%= submit_tag t('admin.poll_officers.search.search'), class: 'button' %> -
- <% end %> +
+ <%= render 'search' %> +
-
+
-

<%= page_entries_info @officers %>

+

+ <%= page_entries_info @officers, entry_name: t('admin.poll_officers.officer.entry_name') %> +

+ + + + + + + <% @officers.each do |officer| %> <% end %> +
<%= t('admin.poll_officers.officer.name') %><%= t('admin.poll_officers.officer.email') %>
@@ -41,6 +45,7 @@
<%= paginate @officers %> diff --git a/config/locales/admin.en.yml b/config/locales/admin.en.yml index 09f5e16fb..fa5fb528f 100755 --- a/config/locales/admin.en.yml +++ b/config/locales/admin.en.yml @@ -154,6 +154,9 @@ en: officer: add: Add delete: Delete + name: Name + email: Email + entry_name: officer search: email_placeholder: Search user by email search: Search diff --git a/config/locales/admin.es.yml b/config/locales/admin.es.yml index f96d2d815..11cfe8d2a 100644 --- a/config/locales/admin.es.yml +++ b/config/locales/admin.es.yml @@ -154,6 +154,9 @@ es: officer: add: Añadir como Presidente de mesa delete: Borrar + name: Nombre + email: Email + entry_name: presidente de mesa search: email_placeholder: Buscar usuario por email search: Buscar From d5f9bb1d11302ebb10c1864919bdfabe1bc7e074 Mon Sep 17 00:00:00 2001 From: Alberto Garcia Cabeza Date: Wed, 14 Dec 2016 18:37:38 +0100 Subject: [PATCH 5/5] improves styles for admin booths views --- app/views/admin/poll/booths/index.html.erb | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/app/views/admin/poll/booths/index.html.erb b/app/views/admin/poll/booths/index.html.erb index d61c67ed1..9618aec59 100644 --- a/app/views/admin/poll/booths/index.html.erb +++ b/app/views/admin/poll/booths/index.html.erb @@ -1,4 +1,7 @@ -

<%= t("admin.booths.index.title") %>

+

<%= t("admin.booths.index.title") %>

+ +<%= link_to t("admin.booths.index.add_booth"), new_admin_booth_path, + class: "button success float-right" %> <% if @booths.empty? %>
@@ -6,10 +9,6 @@
<% end %> -<%= link_to t("admin.booths.index.add_booth"), - new_admin_booth_path, - class: "button success" %> - <% if @booths.any? %>

<%= page_entries_info @booths %>