バグ #1202 » switch_account_to.diff
core/plugin/change_account/change_account.rb | ||
---|---|---|
33 | 33 |
slug = "switch_account_to_#{world.slug}".to_sym |
34 | 34 |
menu[slug] = { |
35 | 35 |
slug: slug, |
36 |
exec: -> options {}, |
|
36 |
exec: -> options { switch_account_to(slug) },
|
|
37 | 37 |
plugin: @name, |
38 | 38 |
name: _('%{title}(%{world}) に切り替える'.freeze) % { |
39 | 39 |
title: world.title, |
40 | 40 |
world: world.class.slug |
41 | 41 |
}, |
42 |
condition: -> options {}, |
|
42 |
condition: -> options { true },
|
|
43 | 43 |
visible: false, |
44 | 44 |
role: :window, |
45 | 45 |
icon: world.icon } end |
... | ... | |
88 | 88 |
} |
89 | 89 |
end |
90 | 90 | |
91 |
def switch_account_to(slug) |
|
92 |
slug_str = slug.to_s.gsub(/^switch_account_to_/, '') |
|
93 |
worlds = Enumerator.new{|y| Plugin.filtering(:worlds, y) }.to_a |
|
94 |
worlds.each_with_index do |world, i| |
|
95 |
if world[:slug].to_s == slug_str |
|
96 |
Plugin.call(:world_change_current, worlds[i]) |
|
97 |
break |
|
98 |
end |
|
99 |
end |
|
100 |
end |
|
101 | ||
91 | 102 |
def delete_world_with_confirm(worlds) |
92 | 103 |
dialog(_("アカウントの削除")){ |
93 | 104 |
label _("以下のアカウントを本当に削除しますか?\n一度削除するともう戻ってこないよ") |