[bbb-greenlight: 31/39] Updated language dropdown to look nicer (#2171)
- From: Bartłomiej Piotrowski <bpiotrowski src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [bbb-greenlight: 31/39] Updated language dropdown to look nicer (#2171)
- Date: Thu, 15 Oct 2020 07:11:23 +0000 (UTC)
commit bc9867566c299163c0d330f0669eafdad2c3c612
Author: Ahmad Farhat <ahmad af farhat gmail com>
Date: Wed Oct 7 16:26:38 2020 -0400
Updated language dropdown to look nicer (#2171)
app/assets/javascripts/user_edit.js | 10 ++++++++++
app/views/users/components/_account.html.erb | 8 +++++++-
2 files changed, 17 insertions(+), 1 deletion(-)
---
diff --git a/app/assets/javascripts/user_edit.js b/app/assets/javascripts/user_edit.js
index eca04cb..706e92f 100644
--- a/app/assets/javascripts/user_edit.js
+++ b/app/assets/javascripts/user_edit.js
@@ -32,5 +32,15 @@ $(document).on('turbolinks:load', function(){
$("#role-dropdown").on("changed.bs.select", function(){
$("#user_role_id").val($("#role-dropdown").selectpicker('val'))
})
+
+ // Update hidden field with new value
+ // $("#language-dropdown").on("show.bs.select", function(){
+ // $("#language-dropdown").selectpicker('val', $("#user_language").val())
+ // })
+
+ // Update hidden field with new value
+ $("#language-dropdown").on("changed.bs.select", function(){
+ $("#user_language").val($("#language-dropdown").selectpicker('val'))
+ })
}
})
\ No newline at end of file
diff --git a/app/views/users/components/_account.html.erb b/app/views/users/components/_account.html.erb
index 0b5f733..7226831 100644
--- a/app/views/users/components/_account.html.erb
+++ b/app/views/users/components/_account.html.erb
@@ -36,7 +36,13 @@
<%= f.text_field :provider, class: "form-control", readonly: "" %>
<br>
<%= f.label :language, t("settings.account.language"), class: "form-label" %>
- <%= f.select :language, language_options, {}, { class: "form-control custom-select" } %>
+ <select id="language-dropdown" class="selectpicker show-tick w-50">
+ <% language_options.each do |lang| %>
+ <option value="<%=lang[1]%>" <%= 'selected' if lang[1] == @user.language %>><%= lang[0] %></option>
+ <% end %>
+ </select>
+ <%= f.hidden_field :language, id: "user_language", value: @user.language %>
+
<%= f.label :roles, t("settings.account.roles"), class: "form-label mt-5" %>
<% if current_user.role.get_permission("can_manage_users") %>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]