Add wd* params to iframe action url

This commit is contained in:
Jure Grabnar 2016-10-04 18:00:08 +02:00
parent 0c7cd52dba
commit 3e74c96085

View file

@ -69,7 +69,8 @@ class AssetsController < ApplicationController
end end
def edit def edit
@action_url = @asset.get_action_url(current_user, 'edit', false) @action_url = append_wd_params(@asset
.get_action_url(current_user, 'edit', false))
@favicon_url = @asset.favicon_url('edit') @favicon_url = @asset.favicon_url('edit')
@token = current_user.get_wopi_token @token = current_user.get_wopi_token
@ttl = (current_user.wopi_token_ttl * 1000).to_s @ttl = (current_user.wopi_token_ttl * 1000).to_s
@ -79,7 +80,8 @@ class AssetsController < ApplicationController
end end
def view def view
@action_url = @asset.get_action_url(current_user, 'view', false) @action_url = append_wd_params(@asset
.get_action_url(current_user, 'view', false))
@favicon_url = @asset.favicon_url('view') @favicon_url = @asset.favicon_url('view')
@token = current_user.get_wopi_token @token = current_user.get_wopi_token
@ttl = (current_user.wopi_token_ttl * 1000).to_s @ttl = (current_user.wopi_token_ttl * 1000).to_s
@ -166,6 +168,15 @@ class AssetsController < ApplicationController
posts posts
end end
def append_wd_params(url)
wd_params = ''
params.keys.select { |i| i[/^wd.*/] }.each do |wd|
next if wd == 'wdPreviousSession' || wd == 'wdPreviousCorrelation'
wd_params += "&#{wd}=#{params[wd]}"
end
url + wd_params
end
def asset_params def asset_params
params.permit( params.permit(
:file :file