Skip to content

Instantly share code, notes, and snippets.

@kibaekr
Created February 7, 2013 22:47
Show Gist options
  • Save kibaekr/4734916 to your computer and use it in GitHub Desktop.
Save kibaekr/4734916 to your computer and use it in GitHub Desktop.
<header class="masthead" id="header">
<div class="container">
<div class="row">
<div id="header-img" class="span4 pull-left">
<%= link_to(account_logo(@current_account), root_path) %>
</div>
<% if @is_admin %>
<div class="domain-info span8 offset4 pull-right">
<div class="row">
<%= form_for WatchedDomain.new do |f| %>
<%= link_to content_tag(:span, "", class: "flag #{locale_flag_class(@current_account)}", id: 'new_domain_locale'),
'#change_locale', class: 'inline-localebox', id: 'change-locale-link' %>
<%= f.text_field :url, placeholder: 'Add a Domain' %>
<%= f.hidden_field :locale_id, value: @current_account.locale_id %>
<%= f.submit 'Add', class: 'btn' %>
<% end %>
</div>
<div class="row">
Currently tracking <%= keywords_detail @current_account %> <b>keywords</b>
across <%= domains_detail @current_account %> <b>domains</b>
</div>
</div>
<% end %>
</div>
</div>
</header>
<div style='display:none'>
<div id="change_locale">
<div class="modal-head">
Change Domain's Locale
</div>
<div class="modal-content">
<div class="clearfix">
<div class="row">
<div class="span12 pull-left locale-container" id="locales-list">
<% @locales = Locale.order(:description).all unless instance_variable_get('@locales') %>
<h4><%= @locales.count %> Countries/Language combinations available</h4>
<p><i>Search by Country, Language, or supported search engine (Google, Yahoo! or Bing).</i></p>
<%= text_field_tag :locales_search, nil, placeholder: 'Search locales', class: 'search' %>
<%= render partial: 'shared/locale_picker', locals: { button_class: 'locale-picker' } %>
</div>
</div>
</div>
</div>
</div>
</div>
$(document).on "click", ".locale-picker", (event) ->
locale = $(this).val()
first = $(this).parents().find("#first-domain-steps:visible")
if $('#add-first-watched-domain').length is 0
console.log('second here')
$("#watched_domain_locale_id").val locale
$("#new_domain_locale").removeClass().addClass($("#locale_#{locale}").attr('class'))
$('a.inline-localebox').colorbox.close()
else if first.size() is 0
$("#watched_domain_locale_id").val locale
$("#new_domain_locale").removeClass().addClass($("#locale_#{locale}").attr('class'))
$('a.inline-localebox').colorbox.close()
else
console.log('else here')
$("#add_first_watched_domain_locale_id").val locale
$("#add-first-domain-locale").removeClass().addClass($("#locale_#{locale}").attr('class'))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment