Commit e4eb57bf authored by o's avatar o

allow filter by ismailbox

parent 921e28a0
This diff is collapsed.
function action() {
document.forms[0].submit()
}
function loadActions() {
document.getElementById('only_mailbox').addEventListener("change", action)
}
window.addEventListener("load", loadActions)
# Place all the behaviors and hooks related to the matching controller here.
# All this logic will automatically be available in application.js.
# You can use CoffeeScript in this file: http://coffeescript.org/
//= require userlist
......@@ -94,8 +94,10 @@ module ApiBackend
get(["check_valid_new_email"], {'email' => email})
end
def self.list(filter = nil, domain = nil)
get(["list"], {'filter' => filter, 'domain' => domain})
def self.list(filter = nil, domain = nil, mailbox = nil)
get(["list"], {'filter' => filter,
'domain' => domain,
'mailbox' => mailbox})
end
def self.list_public_domains
......
class UsersController < AdminController
def show
@only_mailbox = (params['only_mailbox'] == 'true') || nil
begin
res = ApiBackend::list((if params[:filter] != "" then params[:filter] else nil end),
(if params[:domain] != "" then params[:domain] else nil end))
(if params[:domain] != "" then params[:domain] else nil end),
@only_mailbox)
@users = res['users']
rescue
end
......
......@@ -58,7 +58,7 @@
<% if @the_user['login_method'] == 'trees' %>
<h4> PW Reset </h4>
Recover secret box with:
<input type='text' value="./trees-cli.rb recover --keyring master.kring --token '<%= if @the_user['trees_recovery_token'] then @the_user['trees_recovery_token'] else 'token' end%>' --pass 'pass' --account '<%= @the_user['email'] %>">
<input type='text' value="./trees-cli.rb recover --keyring master.kring --token '<%= if @the_user['trees_recovery_token'] then @the_user['trees_recovery_token'] else 'token' end%>' --pass 'pass' --account '<%= @the_user['email'] %>'">
<table><tr><td>
<%= form_tag(@post_path, method: "post") do %>
<%= label_tag(:trees_secret_box, (t :trees_secret_box)) %>
......
......@@ -3,6 +3,9 @@
<%= form_tag("/users", method: "get") do %>
<%= t(:filter) %> <%= text_field_tag(:filter, params[:filter]) %>
<%= t(:domain) %> <%= text_field_tag(:domain, params[:domain]) %>
<input type="checkbox" id="only_mailbox" name="only_mailbox" value="true"
<%= if @only_mailbox then 'checked="checked"' else '' end %>/>
<%= t :mailbox %>
<%= submit_tag("filter") %>
<% end %>
......
......@@ -11,4 +11,4 @@ Rails.application.config.assets.paths << Rails.root.join('node_modules')
# Precompile additional assets.
# application.js, application.css, and all non-JS/CSS in the app/assets
# folder are already added.
Rails.application.config.assets.precompile += %w( sessions.js password.js signup.js )
Rails.application.config.assets.precompile += %w( sessions.js password.js signup.js users.js)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment