Class: LocaleNinja::BranchesController

Inherits:
ApplicationController show all
Defined in:
app/controllers/locale_ninja/branches_controller.rb

Instance Method Summary collapse

Instance Method Details

#indexObject



7
8
9
# File 'app/controllers/locale_ninja/branches_controller.rb', line 7

def index
  redirect_to(branch_path(@client.default_branch))
end

#selectObject



11
12
13
# File 'app/controllers/locale_ninja/branches_controller.rb', line 11

def select
  redirect_to(branch_path(params[:branch_id]))
end

#showObject



15
16
17
18
19
20
21
22
23
24
# File 'app/controllers/locale_ninja/branches_controller.rb', line 15

def show
  @branches = @client.public_branch_names
  @branch_name = params[:id]
  locales = LocaleHelper.locales(@client)
  all_translations = LocaleHelper.all_keys_for_locales(@client, locales, branch: @branch_name)

  @completion_by_locale = locales.zip(all_translations).to_h do |locale, translations|
    [locale, 100 * translations.values.count(&:present?) / translations.count]
  end
end