]> git.openstreetmap.org Git - rails.git/blob - app/views/site/_potlatch2.html.erb
fix and improve ability coverage to account for tokens
[rails.git] / app / views / site / _potlatch2.html.erb
1 <%= javascript_include_tag "edit/potlatch2" %>
2
3 <div id="map">
4   <% session[:token] = current_user.tokens.create.token unless session[:token] and UserToken.find_by_token(session[:token]) -%>
5   <% data = { :token => session[:token] } -%>
6   <% data[:lat] = @lat if @lat -%>
7   <% data[:lon] = @lon if @lon -%>
8   <% data[:zoom] = @zoom if @zoom -%>
9   <% if defined? POTLATCH2_KEY %>
10   <% token = current_user.access_token(POTLATCH2_KEY) %>
11   <% data[:token] = token.token -%>
12   <% data[:token_secret] = token.secret -%>
13   <% data[:consumer_key] = token.client_application.key -%>
14   <% data[:consumer_secret] = token.client_application.secret -%>
15   <% end %>
16   <% data[:locale] = Locale.list(Potlatch2::LOCALES.keys).preferred(preferred_languages).to_s -%>
17   <% data[:locale_path] = asset_path("potlatch2/locales/#{Potlatch2::LOCALES[data[:locale]]}.swf") -%>
18   <%= content_tag :div, raw(t("site.edit.flash_player_required")), :id => "potlatch", :data => data %>
19 </div>