We're using different controls depending on the number of available
locales.
When there are only a few locales, the solution is obvious: radio
buttons to select the default language, and checkboxes to select the
available ones are simple and intuitive.
With many languages, showing two consecutive lists of 30 languages could
be confusing, though, particularly on small devices, where scrolling
through both lists could be hard.
So, in this case, we're rendering a <select> to choose the default
language. For selecting the available languages, however, we're sticking
to checkboxes because all the other existing options (like multiple
selects) are hard to use. We think it's OK because the form doesn't have
any additional fields, and there's only one big list of options to
scroll through.
While testing the application, we noticed that if we use the
`admin-fieldset-separator` styles when there's only one fieldset, it's
harder to notice that there's an additional field to select the default
language. So we're only using the `admin-fieldset-separator` styles when
all the fields are grouped in fieldsets.
Regarding the help text for the fieldset, if we leave the help text
outside the <legend> tag, people using screen readers won't hear about
this content. However, if we include it inside the <legend> tag, some
screen readers might read it every time they move to a different
checkbox (or radio button), which can be annoying. Since I don't think
these help messages are really essential, I'm leaving them out of the
<legend> tag. It's also easier to style them if they're outside the
<legend> tag.
Note we're using `display: table` for the labels, for the reasons
mentioned in commit 923c2a7ee.
Also note that, when there's only one available locale, this section is
useless. In this case, we aren't disabling it for now because there's a
chance people see it in the official Consul Democracy demo and then
wonder why it isn't available on their installation. We might disable it
in the future, though.
350 lines
9.6 KiB
Ruby
350 lines
9.6 KiB
Ruby
namespace :admin do
|
|
root to: "dashboard#index"
|
|
resources :organizations, only: :index do
|
|
get :search, on: :collection
|
|
member do
|
|
put :verify
|
|
put :reject
|
|
end
|
|
end
|
|
|
|
resources :hidden_users, only: [:index, :show] do
|
|
member do
|
|
put :restore
|
|
put :confirm_hide
|
|
end
|
|
end
|
|
|
|
resources :hidden_budget_investments, only: :index do
|
|
member do
|
|
put :restore
|
|
put :confirm_hide
|
|
end
|
|
end
|
|
|
|
resources :hidden_debates, only: :index do
|
|
member do
|
|
put :restore
|
|
put :confirm_hide
|
|
end
|
|
end
|
|
|
|
resources :debates, only: [:index, :show]
|
|
|
|
resources :proposals, only: [:index, :show, :update] do
|
|
member { patch :toggle_selection }
|
|
resources :milestones, controller: "proposal_milestones"
|
|
resources :progress_bars, except: :show, controller: "proposal_progress_bars"
|
|
end
|
|
|
|
resources :hidden_proposals, only: :index do
|
|
member do
|
|
put :restore
|
|
put :confirm_hide
|
|
end
|
|
end
|
|
|
|
resources :hidden_proposal_notifications, only: :index do
|
|
member do
|
|
put :restore
|
|
put :confirm_hide
|
|
end
|
|
end
|
|
|
|
resources :budgets, except: [:create, :new] do
|
|
member do
|
|
patch :publish
|
|
put :calculate_winners
|
|
end
|
|
|
|
resources :groups, except: [:index, :show], controller: "budget_groups" do
|
|
resources :headings, except: [:index, :show], controller: "budget_headings"
|
|
end
|
|
|
|
resources :budget_investments, only: [:index, :show, :edit, :update] do
|
|
member { patch :toggle_selection }
|
|
|
|
resources :audits, only: :show, controller: "budget_investment_audits"
|
|
resources :milestones, controller: "budget_investment_milestones"
|
|
resources :progress_bars, except: :show, controller: "budget_investment_progress_bars"
|
|
end
|
|
|
|
resources :budget_phases, only: [:edit, :update] do
|
|
member do
|
|
patch :enable
|
|
patch :disable
|
|
end
|
|
end
|
|
end
|
|
|
|
namespace :budgets_wizard do
|
|
resources :budgets, only: [:create, :new, :edit, :update] do
|
|
resources :groups, only: [:index, :create, :edit, :update, :destroy] do
|
|
resources :headings, only: [:index, :create, :edit, :update, :destroy]
|
|
end
|
|
|
|
resources :phases, as: "budget_phases", only: [:index, :edit, :update] do
|
|
member do
|
|
patch :enable
|
|
patch :disable
|
|
end
|
|
end
|
|
end
|
|
end
|
|
|
|
resources :milestone_statuses, only: [:index, :new, :create, :update, :edit, :destroy]
|
|
|
|
resources :signature_sheets, only: [:index, :new, :create, :show]
|
|
|
|
resources :banners, only: [:index, :new, :create, :edit, :update, :destroy] do
|
|
collection { get :search }
|
|
end
|
|
|
|
resources :hidden_comments, only: :index do
|
|
member do
|
|
put :restore
|
|
put :confirm_hide
|
|
end
|
|
end
|
|
|
|
resources :comments, only: :index
|
|
|
|
resources :tags, only: [:index, :create, :update, :destroy]
|
|
|
|
resources :officials, only: [:index, :edit, :update, :destroy] do
|
|
get :search, on: :collection
|
|
end
|
|
|
|
resources :settings, only: [:index, :update]
|
|
put :update_map, to: "settings#update_map"
|
|
put :update_content_types, to: "settings#update_content_types"
|
|
|
|
resources :moderators, only: [:index, :create, :destroy] do
|
|
get :search, on: :collection
|
|
end
|
|
|
|
resources :valuators, only: [:show, :index, :edit, :update, :create, :destroy] do
|
|
get :search, on: :collection
|
|
get :summary, on: :collection
|
|
end
|
|
|
|
resources :valuator_groups
|
|
|
|
resources :managers, only: [:index, :create, :destroy] do
|
|
get :search, on: :collection
|
|
end
|
|
|
|
namespace :sdg do
|
|
resources :managers, only: [:index, :create, :destroy]
|
|
end
|
|
|
|
resources :administrators, only: [:index, :create, :destroy, :edit, :update] do
|
|
get :search, on: :collection
|
|
end
|
|
|
|
resources :users, only: [:index, :show]
|
|
|
|
scope module: :poll do
|
|
resources :polls do
|
|
get :booth_assignments, on: :collection
|
|
|
|
resources :booth_assignments, only: [:index, :show, :create, :destroy] do
|
|
get :search_booths, on: :collection
|
|
get :manage, on: :collection
|
|
end
|
|
|
|
resources :officer_assignments, only: [:index, :create, :destroy] do
|
|
get :search_officers, on: :collection
|
|
get :by_officer, on: :collection
|
|
end
|
|
|
|
resources :recounts, only: :index
|
|
resources :results, only: :index
|
|
end
|
|
|
|
resources :officers, only: [:index, :new, :create, :destroy] do
|
|
get :search, on: :collection
|
|
end
|
|
|
|
resources :booths do
|
|
get :available, on: :collection
|
|
|
|
resources :shifts do
|
|
get :search_officers, on: :collection
|
|
end
|
|
end
|
|
|
|
resources :questions, shallow: true do
|
|
resources :answers, except: [:index, :show], controller: "questions/answers", shallow: false
|
|
resources :answers, only: [], controller: "questions/answers" do
|
|
resources :images, controller: "questions/answers/images"
|
|
resources :videos, controller: "questions/answers/videos", shallow: false
|
|
resources :documents, only: [:index, :create], controller: "questions/answers/documents"
|
|
end
|
|
post "/answers/order_answers", to: "questions/answers#order_answers"
|
|
end
|
|
|
|
resource :active_polls, only: [:create, :edit, :update]
|
|
end
|
|
|
|
resources :verifications, controller: :verifications, only: :index do
|
|
get :search, on: :collection
|
|
end
|
|
|
|
resource :activity, controller: :activity, only: :show
|
|
|
|
resources :newsletters do
|
|
member do
|
|
post :deliver
|
|
end
|
|
get :users, on: :collection
|
|
end
|
|
|
|
resources :admin_notifications do
|
|
member do
|
|
post :deliver
|
|
end
|
|
end
|
|
|
|
resources :system_emails, only: [:index] do
|
|
get :view
|
|
get :preview_pending
|
|
put :moderate_pending
|
|
put :send_pending
|
|
end
|
|
|
|
resources :emails_download, only: :index do
|
|
get :generate_csv, on: :collection
|
|
end
|
|
|
|
resource :stats, only: :show do
|
|
get :graph, on: :member
|
|
get :budgets, on: :collection
|
|
get :budget_supporting, on: :member
|
|
get :budget_balloting, on: :member
|
|
get :proposal_notifications, on: :collection
|
|
get :direct_messages, on: :collection
|
|
get :polls, on: :collection
|
|
get :sdg, on: :collection
|
|
end
|
|
|
|
namespace :legislation do
|
|
resources :processes do
|
|
resources :questions
|
|
resources :proposals do
|
|
member { patch :toggle_selection }
|
|
end
|
|
resources :draft_versions
|
|
resources :milestones
|
|
resources :progress_bars, except: :show
|
|
resource :homepage, only: [:edit, :update]
|
|
end
|
|
end
|
|
|
|
resources :geozones, only: [:index, :new, :create, :edit, :update, :destroy]
|
|
resource :locales, only: [:show, :update]
|
|
|
|
namespace :site_customization do
|
|
resources :pages, except: [:show] do
|
|
resources :cards, except: [:show], as: :widget_cards
|
|
end
|
|
resources :images, only: [:index, :update, :destroy]
|
|
resources :content_blocks, except: [:show]
|
|
delete "/heading_content_blocks/:id", to: "content_blocks#delete_heading_content_block",
|
|
as: "delete_heading_content_block"
|
|
get "/edit_heading_content_blocks/:id", to: "content_blocks#edit_heading_content_block",
|
|
as: "edit_heading_content_block"
|
|
put "/update_heading_content_blocks/:id", to: "content_blocks#update_heading_content_block",
|
|
as: "update_heading_content_block"
|
|
resources :information_texts, only: [:index] do
|
|
post :update, on: :collection
|
|
end
|
|
resources :documents, only: [:index, :new, :create, :destroy]
|
|
end
|
|
|
|
resource :homepage, controller: :homepage, only: [:show]
|
|
|
|
namespace :widget do
|
|
resources :cards
|
|
resources :feeds, only: [:update]
|
|
end
|
|
|
|
namespace :dashboard do
|
|
resources :actions, only: [:index, :new, :create, :edit, :update, :destroy]
|
|
resources :administrator_tasks, only: [:index, :edit, :update]
|
|
end
|
|
|
|
resources :local_census_records
|
|
namespace :local_census_records do
|
|
resources :imports, only: [:new, :create, :show]
|
|
end
|
|
|
|
resource :machine_learning, controller: :machine_learning, only: [:show] do
|
|
post :execute, on: :collection
|
|
delete :cancel, on: :collection
|
|
end
|
|
|
|
resources :tenants, except: [:show, :destroy] do
|
|
member do
|
|
put :hide
|
|
put :restore
|
|
end
|
|
end
|
|
end
|
|
|
|
resolve "Milestone" do |milestone|
|
|
[*resource_hierarchy_for(milestone.milestoneable), milestone]
|
|
end
|
|
|
|
resolve "ProgressBar" do |progress_bar|
|
|
[*resource_hierarchy_for(progress_bar.progressable), progress_bar]
|
|
end
|
|
|
|
resolve "Audit" do |audit|
|
|
[*resource_hierarchy_for(audit.associated || audit.auditable), audit]
|
|
end
|
|
|
|
resolve "Widget::Card" do |card, options|
|
|
[*resource_hierarchy_for(card.cardable), card]
|
|
end
|
|
|
|
resolve "Budget::Group" do |group, options|
|
|
[group.budget, :group, options.merge(id: group)]
|
|
end
|
|
|
|
resolve "Budget::Heading" do |heading, options|
|
|
[heading.budget, :group, :heading, options.merge(group_id: heading.group, id: heading)]
|
|
end
|
|
|
|
resolve "Budget::Phase" do |phase, options|
|
|
[phase.budget, :phase, options.merge(id: phase)]
|
|
end
|
|
|
|
resolve "Poll::Booth" do |booth, options|
|
|
[:booth, options.merge(id: booth)]
|
|
end
|
|
|
|
resolve "Poll::BoothAssignment" do |assignment, options|
|
|
[assignment.poll, :booth_assignment, options.merge(id: assignment)]
|
|
end
|
|
|
|
resolve "Poll::Shift" do |shift, options|
|
|
[:booth, :shift, options.merge(booth_id: shift.booth, id: shift)]
|
|
end
|
|
|
|
resolve "Poll::Officer" do |officer, options|
|
|
[:officer, options.merge(id: officer)]
|
|
end
|
|
|
|
resolve "Poll::Question::Answer" do |answer, options|
|
|
[:question, :answer, options.merge(question_id: answer.question, id: answer)]
|
|
end
|
|
|
|
resolve "Poll::Question::Answer::Video" do |video, options|
|
|
[:answer, :video, options.merge(answer_id: video.answer, id: video)]
|
|
end
|
|
|
|
resolve "Legislation::DraftVersion" do |version, options|
|
|
[version.process, :draft_version, options.merge(id: version)]
|
|
end
|