Merge pull request #3334 from consul/admin-polish
Improve UX on admin section
This commit is contained in:
@@ -7,13 +7,11 @@ App.Banners =
|
||||
$(selector).removeClass($(selector).attr("class"), true)
|
||||
.addClass(style, true)
|
||||
|
||||
update_background_color: (selector, text_selector, background_color) ->
|
||||
update_background_color: (selector, background_color) ->
|
||||
$(selector).css("background-color", background_color)
|
||||
$(text_selector).val(background_color)
|
||||
|
||||
update_font_color: (selector, text_selector, font_color) ->
|
||||
update_font_color: (selector, font_color) ->
|
||||
$(selector).css("color", font_color)
|
||||
$(text_selector).val(font_color)
|
||||
|
||||
initialize: ->
|
||||
$("[data-js-banner-title]").on
|
||||
@@ -24,20 +22,11 @@ App.Banners =
|
||||
change: ->
|
||||
App.Banners.update_banner("#js-banner-description", $(this).val())
|
||||
|
||||
$("#banner_background_color_picker").on
|
||||
$("[name='banner[background_color]']").on
|
||||
change: ->
|
||||
App.Banners.update_background_color("#js-banner-background", "#banner_background_color", $(this).val())
|
||||
App.Banners.update_background_color("#js-banner-background", $(this).val())
|
||||
|
||||
$("#banner_background_color").on
|
||||
$("[name='banner[font_color]']").on
|
||||
change: ->
|
||||
App.Banners.update_background_color("#js-banner-background", "#banner_background_color_picker", $(this).val())
|
||||
|
||||
$("#banner_font_color_picker").on
|
||||
change: ->
|
||||
App.Banners.update_font_color("#js-banner-title", "#banner_font_color", $(this).val())
|
||||
App.Banners.update_font_color("#js-banner-description", "#banner_font_color", $(this).val())
|
||||
|
||||
$("#banner_font_color").on
|
||||
change: ->
|
||||
App.Banners.update_font_color("#js-banner-title", "#banner_font_color_picker", $(this).val())
|
||||
App.Banners.update_font_color("#js-banner-description", "#banner_font_color_picker", $(this).val())
|
||||
App.Banners.update_font_color("#js-banner-title", $(this).val())
|
||||
App.Banners.update_font_color("#js-banner-description", $(this).val())
|
||||
|
||||
@@ -26,9 +26,11 @@ App.Forms =
|
||||
synchronizeInputs: ->
|
||||
progress_bar = "[name='progress_bar[percentage]']"
|
||||
process_background = "[name='legislation_process[background_color]']"
|
||||
process_font = "[name='legislation_process[font_color]']"
|
||||
process_font = ", [name='legislation_process[font_color]']"
|
||||
processes = process_background + process_font
|
||||
banners = "[name='banner[background_color]'], [name='banner[font_color]']"
|
||||
|
||||
inputs = $("#{progress_bar}, #{process_background}, #{process_font}")
|
||||
inputs = $("#{progress_bar}, #{processes}, #{banners}")
|
||||
inputs.on
|
||||
input: ->
|
||||
$("[name='#{this.name}']").val($(this).val())
|
||||
|
||||
@@ -2766,15 +2766,15 @@ table {
|
||||
display: inline-block;
|
||||
height: rem-calc(120);
|
||||
overflow: hidden;
|
||||
width: 100%;
|
||||
|
||||
@include breakpoint(medium) {
|
||||
height: rem-calc(96);
|
||||
}
|
||||
|
||||
img {
|
||||
margin-left: rem-calc(-15);
|
||||
max-width: none;
|
||||
width: rem-calc(120);
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -37,12 +37,9 @@ module AdminHelper
|
||||
["spending_proposals"].include?(controller_name)
|
||||
end
|
||||
|
||||
def menu_poll?
|
||||
%w[polls active_polls recounts results].include?(controller_name)
|
||||
end
|
||||
|
||||
def menu_polls?
|
||||
menu_poll? || %w[questions answers].include?(controller_name)
|
||||
%w[polls active_polls recounts results questions answers].include?(controller_name) ||
|
||||
controller.class.parent == Admin::Poll::Questions::Answers
|
||||
end
|
||||
|
||||
def menu_booths?
|
||||
@@ -54,7 +51,8 @@ module AdminHelper
|
||||
end
|
||||
|
||||
def menu_settings?
|
||||
["settings", "tags", "geozones", "images", "content_blocks"].include?(controller_name)
|
||||
["settings", "tags", "geozones", "images", "content_blocks"].include?(controller_name) &&
|
||||
controller.class.parent != Admin::Poll::Questions::Answers
|
||||
end
|
||||
|
||||
def menu_customization?
|
||||
|
||||
@@ -4,4 +4,20 @@ module BannersHelper
|
||||
@banners.present? && @banners.count > 0
|
||||
end
|
||||
|
||||
def banner_default_bg_color
|
||||
"#e7f2fc"
|
||||
end
|
||||
|
||||
def banner_default_font_color
|
||||
"#222222"
|
||||
end
|
||||
|
||||
def banner_bg_color_or_default
|
||||
@banner.background_color.present? ? @banner.background_color : banner_default_bg_color
|
||||
end
|
||||
|
||||
def banner_font_color_or_default
|
||||
@banner.font_color.present? ? @banner.font_color : banner_default_font_color
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -10,21 +10,11 @@
|
||||
<% end %>
|
||||
|
||||
<% if feature?(:polls) %>
|
||||
<li class="section-title">
|
||||
<a href="#">
|
||||
<li class="section-title <%= "is-active" if menu_polls? %>">
|
||||
<%= link_to admin_polls_path do %>
|
||||
<span class="icon-checkmark-circle"></span>
|
||||
<strong><%= t("admin.menu.title_polls") %></strong>
|
||||
</a>
|
||||
<ul id="polls_menu" <%= "class=is-active" if menu_polls? || controller.class.parent == Admin::Poll::Questions::Answers %>>
|
||||
<li <%= "class=is-active" if menu_poll? %>>
|
||||
<%= link_to t("admin.menu.polls"), admin_polls_path %>
|
||||
</li>
|
||||
|
||||
<li <%= "class=is-active" if %w(questions answers).include?(controller_name) ||
|
||||
controller.class.parent == Admin::Poll::Questions::Answers %>>
|
||||
<%= link_to t("admin.menu.poll_questions"), admin_questions_path %>
|
||||
</li>
|
||||
</ul>
|
||||
<strong><%= t("admin.menu.polls") %></strong>
|
||||
<% end %>
|
||||
</li>
|
||||
<% end %>
|
||||
|
||||
@@ -75,6 +65,15 @@
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
<% if feature?(:signature_sheets) %>
|
||||
<li class="section-title <%= "is-active" if controller_name == "signature_sheets" %>">
|
||||
<%= link_to admin_signature_sheets_path do %>
|
||||
<span class="icon-file-text-o"></span>
|
||||
<strong><%= t("admin.menu.signature_sheets") %></strong>
|
||||
<% end %>
|
||||
</li>
|
||||
<% end %>
|
||||
|
||||
<% if feature?(:spending_proposals) %>
|
||||
<li class="section-title">
|
||||
<a href="#">
|
||||
@@ -138,15 +137,6 @@
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
<% if feature?(:signature_sheets) %>
|
||||
<li class="section-title <%= "is-active" if controller_name == "signature_sheets" %>">
|
||||
<%= link_to admin_signature_sheets_path do %>
|
||||
<span class="icon-file-text-o"></span>
|
||||
<strong><%= t("admin.menu.signature_sheets") %></strong>
|
||||
<% end %>
|
||||
</li>
|
||||
<% end %>
|
||||
|
||||
<li class="section-title">
|
||||
<a href="#">
|
||||
<span class="icon-eye"></span>
|
||||
|
||||
@@ -64,15 +64,32 @@
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="small-3 column">
|
||||
<%= f.label :sections, t("admin.banners.banner.background_color") %>
|
||||
<%= color_field(:banner, :background_color, id: 'banner_background_color_picker') %>
|
||||
<%= f.text_field :background_color, label: false %>
|
||||
<div class="small-12 medium-6 large-3 column">
|
||||
<%= f.label :background_color, nil, for: "background_color_input" %>
|
||||
<p class="help-text"><%= t("admin.shared.color_help") %></p>
|
||||
<div class="row collapse">
|
||||
<div class="small-12 medium-6 column">
|
||||
<%= f.text_field :background_color, label: false, type: :color,
|
||||
value: banner_bg_color_or_default %>
|
||||
</div>
|
||||
<div class="small-12 medium-6 column">
|
||||
<%= f.text_field :background_color, label: false, id: "background_color_input" %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="small-3 column end">
|
||||
<%= f.label :sections, t("admin.banners.banner.font_color") %>
|
||||
<%= color_field(:banner, :font_color, id: 'banner_font_color_picker') %>
|
||||
<%= f.text_field :font_color, label: false %>
|
||||
|
||||
<div class="small-12 medium-6 large-3 column end">
|
||||
<%= f.label :font_color, nil, for: "font_color_input" %>
|
||||
<p class="help-text"><%= t("admin.shared.color_help") %></p>
|
||||
<div class="row collapse">
|
||||
<div class="small-12 medium-6 column">
|
||||
<%= f.text_field :font_color, label: false, type: :color,
|
||||
value: banner_font_color_or_default %>
|
||||
</div>
|
||||
<div class="small-12 medium-6 column">
|
||||
<%= f.text_field :font_color, label: false, id: "font_color_input" %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -80,11 +97,15 @@
|
||||
<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-background" class="banner" style="background-color:<%= @banner.background_color %>">
|
||||
<%= link_to @banner.target_url do %>
|
||||
<h2 id="js-banner-title" style="color:<%= @banner.font_color %>"><%= @banner.title %></h2>
|
||||
<h3 id="js-banner-description" style="color:<%= @banner.font_color %>"><%= @banner.description %></h3>
|
||||
<% end %>
|
||||
|
||||
<div id="js-banner-background" class="banner clear"
|
||||
style="background-color:<%= @banner.background_color %>">
|
||||
<%= link_to @banner.target_url do %>
|
||||
<h2 id="js-banner-title" style="color:<%= @banner.font_color %>"><%= @banner.title %></h2>
|
||||
<h3 id="js-banner-description" style="color:<%= @banner.font_color %>">
|
||||
<%= @banner.description %>
|
||||
</h3>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
@@ -1,25 +1,33 @@
|
||||
<%= form_for [:admin, @geozone] do |f| %>
|
||||
|
||||
<%= render 'errors' %>
|
||||
<%= render "errors" %>
|
||||
|
||||
<div class="small-12 medium-6 large-4 column">
|
||||
<%= f.label :name, t("admin.geozones.geozone.name") %>
|
||||
<%= f.text_field :name, label: false %>
|
||||
<div class="small-12 large-8 column">
|
||||
<%= f.text_field :name %>
|
||||
</div>
|
||||
<div class="small-12 medium-6 large-4 column">
|
||||
<%= f.label :html_map_coordinates, t("admin.geozones.geozone.coordinates") %>
|
||||
|
||||
<div class="clear">
|
||||
<div class="small-12 medium-6 large-4 column">
|
||||
<%= f.label :census_code %>
|
||||
<p class="help-text"><%= t("admin.geozones.geozone.code_help") %></p>
|
||||
<%= f.text_field :census_code, label: false %>
|
||||
</div>
|
||||
|
||||
<div class="small-12 medium-6 large-4 column end">
|
||||
<%= f.label :external_code %>
|
||||
<p class="help-text"><%= t("admin.geozones.geozone.code_help") %></p>
|
||||
<%= f.text_field :external_code, label: false %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="small-12 large-8 column">
|
||||
<%= f.label :html_map_coordinates %>
|
||||
<p class="help-text"><%= t("admin.geozones.geozone.coordinates_help") %></p>
|
||||
<%= f.text_field :html_map_coordinates, label: false %>
|
||||
</div>
|
||||
<div class="small-12 medium-6 large-2 column">
|
||||
<%= f.label :external_code, t("admin.geozones.geozone.external_code") %>
|
||||
<%= f.text_field :external_code, label: false %>
|
||||
</div>
|
||||
<div class="small-12 medium-6 large-2 column">
|
||||
<%= f.label :census_code, t("admin.geozones.geozone.census_code") %>
|
||||
<%= f.text_field :census_code, label: false %>
|
||||
</div>
|
||||
|
||||
<div class="small-12 large-3 medium-3 column end">
|
||||
<%= f.submit(class: "button success expanded", value: t("admin.geozones.edit.form.submit_button")) %>
|
||||
<div class="small-12 column">
|
||||
<%= f.submit(value: t("admin.geozones.edit.form.submit_button"),
|
||||
class: "button success") %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
@@ -193,7 +193,7 @@
|
||||
|
||||
<div class="small-6 large-3 column">
|
||||
<%= f.label :background_color, nil, for: "background_color_input" %>
|
||||
<p class="help-text"><%= t("admin.legislation.processes.form.color_help") %></p>
|
||||
<p class="help-text"><%= t("admin.shared.color_help") %></p>
|
||||
<div class="row collapse">
|
||||
<div class="small-12 medium-6 column">
|
||||
<%= f.text_field :background_color, label: false, type: :color,
|
||||
@@ -207,7 +207,7 @@
|
||||
|
||||
<div class="small-6 large-3 column end">
|
||||
<%= f.label :font_color, nil, for: "font_color_input" %>
|
||||
<p class="help-text"><%= t("admin.legislation.processes.form.color_help") %></p>
|
||||
<p class="help-text"><%= t("admin.shared.color_help") %></p>
|
||||
<div class="row collapse">
|
||||
<div class="small-12 medium-6 column">
|
||||
<%= f.text_field :font_color, label: false, type: :color, value: font_color_or_default %>
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<h2><%= t("admin.officials.index.title") %></h2>
|
||||
<p><%= t("admin.officials.index.help") %></p>
|
||||
|
||||
<%= render 'admin/shared/user_search', url: search_admin_officials_path %>
|
||||
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
<h3><%= t("admin.polls.show.questions_title") %></h3>
|
||||
<h3 class="inline-block"><%= t("admin.polls.show.questions_title") %></h3>
|
||||
|
||||
<%= link_to t("admin.questions.index.create"), new_admin_question_path(poll_id: @poll.id),
|
||||
class: "button float-right" %>
|
||||
|
||||
<% if @poll.questions.empty? %>
|
||||
<div class="callout primary margin-top">
|
||||
@@ -9,6 +12,7 @@
|
||||
<thead>
|
||||
<tr>
|
||||
<th><%= t("admin.polls.show.table_title") %></th>
|
||||
<th class="small-6"><%= t("admin.actions.actions") %></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<% @poll.questions.each do |question| %>
|
||||
@@ -17,6 +21,28 @@
|
||||
<strong>
|
||||
<%= link_to question.title, admin_question_path(question) %>
|
||||
</strong>
|
||||
<% if question.proposal.present? %>
|
||||
<small>
|
||||
<%= link_to t("admin.polls.show.see_proposal"),
|
||||
proposal_path(question.proposal),
|
||||
target: "_blank" %>
|
||||
</small>
|
||||
<% end %>
|
||||
</td>
|
||||
<td>
|
||||
<div class="small-4 column">
|
||||
<%= link_to t("admin.polls.show.edit_answers"), admin_question_path(question),
|
||||
class: "button hollow expanded" %>
|
||||
</div>
|
||||
<div class="small-4 column">
|
||||
<%= link_to t("shared.edit"), edit_admin_question_path(question),
|
||||
class: "button hollow expanded" %>
|
||||
</div>
|
||||
<div class="small-4 column">
|
||||
<%= link_to t("shared.delete"), admin_question_path(question),
|
||||
class: "button hollow alert expanded",
|
||||
method: :delete %>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
|
||||
@@ -7,13 +7,19 @@
|
||||
<%= f.hidden_field :proposal_id %>
|
||||
|
||||
<div class="small-12">
|
||||
<div class="small-12 medium-6 large-4">
|
||||
<% select_options = Poll.all.map { |p| [p.name, p.id] } %>
|
||||
<%= f.select :poll_id,
|
||||
options_for_select(select_options),
|
||||
prompt: t("admin.questions.index.select_poll"),
|
||||
label: t("admin.questions.new.poll_label") %>
|
||||
</div>
|
||||
<% if @poll.present? %>
|
||||
<%= f.hidden_field :poll_id, value: @poll.id %>
|
||||
<% elsif @question.poll.present? %>
|
||||
<%= f.hidden_field :poll_id, value: @question.poll.id %>
|
||||
<% else %>
|
||||
<div class="small-12 medium-6 large-4">
|
||||
<% select_options = Poll.all.map { |p| [p.name, p.id] } %>
|
||||
<%= f.select :poll_id,
|
||||
options_for_select(select_options),
|
||||
prompt: t("admin.questions.index.select_poll"),
|
||||
label: t("admin.questions.new.poll_label") %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<%= f.translatable_fields do |translations_form| %>
|
||||
<%= translations_form.text_field :title %>
|
||||
|
||||
@@ -1,6 +1,12 @@
|
||||
<%= back_link_to %>
|
||||
|
||||
<h2 class="margin-top"><%= t("admin.questions.new.title") %></h2>
|
||||
<h2 class="margin-top">
|
||||
<% if @poll.present? %>
|
||||
<%= t("admin.questions.new.title", poll: @poll.name) %>
|
||||
<% else %>
|
||||
<%= t("admin.questions.new.title_proposal") %>
|
||||
<% end %>
|
||||
</h2>
|
||||
|
||||
<div class="poll-question-form">
|
||||
<%= render "form", form_url: admin_questions_path %>
|
||||
|
||||
@@ -3,18 +3,24 @@
|
||||
<% end %>
|
||||
|
||||
<div class="proposal-show">
|
||||
<h2><%= @proposal.title %></h2>
|
||||
<h2 class="inline-block"><%= @proposal.title %></h2>
|
||||
|
||||
<% if @proposal.successful? %>
|
||||
<div class="callout success">
|
||||
<%= t("proposals.proposal.successful") %>
|
||||
|
||||
<div class="float-right">
|
||||
<%= link_to t("poll_questions.create_question"),
|
||||
<%= link_to t("admin.proposals.show.create_question"),
|
||||
new_admin_question_path(proposal_id: @proposal.id),
|
||||
class: "button medium" %>
|
||||
</div>
|
||||
</div>
|
||||
<% else %>
|
||||
<div class="float-right">
|
||||
<%= link_to t("admin.proposals.show.create_question"),
|
||||
new_admin_question_path(proposal_id: @proposal.id),
|
||||
class: "button hollow medium" %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<%= render "proposals/info", proposal: @proposal %>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<% banner = @banners.sample %>
|
||||
<div class="banner" style="background-color:<%= banner.background_color %>">
|
||||
<div class="banner" style="background-color:<%= banner.background_color %>;">
|
||||
<%= link_to banner.target_url do %>
|
||||
<h2 style="color:<%= banner.font_color %>"><%=banner.title %></h2>
|
||||
<h3 style="color:<%= banner.font_color %>"><%=banner.description %></h3>
|
||||
<h2 style="color:<%= banner.font_color %>;"><%= banner.title %></h2>
|
||||
<h3 style="color:<%= banner.font_color %>;"><%= banner.description %></h3>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
@@ -46,9 +46,7 @@
|
||||
|
||||
<ul>
|
||||
<li>
|
||||
<%= t("verification.letter.new.office",
|
||||
office: link_to(t("verification.letter.new.offices"), setting['verification_offices_url'],
|
||||
target: "blank")).html_safe %>
|
||||
<%= t("verification.letter.new.office") %>
|
||||
</li>
|
||||
<li>
|
||||
<%= link_to t("verification.letter.new.send_letter"), letter_path, method: :post %>
|
||||
|
||||
@@ -7,12 +7,7 @@
|
||||
<h1><%= t("verification.letter.edit.title") %></h1>
|
||||
|
||||
<div data-alert class="callout success">
|
||||
<%= t("verification.letter.create.flash.success_html",
|
||||
offices: link_to(t("verification.letter.create.flash.offices"),
|
||||
setting['verification_offices_url'],
|
||||
title: t('shared.target_blank_html'),
|
||||
target: "_blank")).html_safe
|
||||
%>
|
||||
<%= t("verification.letter.create.flash.success_html") %>
|
||||
</div>
|
||||
|
||||
<%= link_to t("verification.letter.edit.see_all"), proposals_path, class: "button warning" %>
|
||||
|
||||
@@ -4,9 +4,7 @@
|
||||
<button class="close-button" aria-label="<%= t("application.close") %>" type="button" data-close>
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
<%= t("verification.residence.new.error_verifying_census",
|
||||
offices: link_to( t("verification.residence.new.error_verifying_census_offices"),
|
||||
setting['verification_offices_url'], title: t('shared.target_blank_html'), target: "_blank")).html_safe %>
|
||||
<%= t("verification.residence.new.error_verifying_census") %>
|
||||
</div>
|
||||
|
||||
<% else %>
|
||||
|
||||
@@ -9,6 +9,11 @@
|
||||
|
||||
<% feed.items.each do |item| %>
|
||||
<div class="<%= item.class.to_s.parameterize('_') %> row">
|
||||
<div class="feed-description small-12 column
|
||||
<%= 'medium-6 large-9' if item.image.present? %>">
|
||||
<strong><%= link_to item.title, url_for(item) %></strong><br>
|
||||
<p><%= item.summary %></p>
|
||||
</div>
|
||||
<% if item.image.present? %>
|
||||
<div class="small-12 medium-6 large-3 column">
|
||||
<div class="feed-image">
|
||||
@@ -17,11 +22,6 @@
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<div class="feed-description small-12 medium-6 large-9 column
|
||||
<%= item.image.present? ? '' : 'medium-offset-6 large-offset-3' %>">
|
||||
<strong><%= link_to item.title, url_for(item) %></strong><br>
|
||||
<p><%= item.summary %></p>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user