mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-01-01 13:13:22 +08:00
Add favicon url to iframe
This commit is contained in:
parent
3bc683be8f
commit
ed8df3cc62
4 changed files with 50 additions and 49 deletions
|
@ -68,12 +68,14 @@ class AssetsController < ApplicationController
|
||||||
|
|
||||||
def edit
|
def edit
|
||||||
@action_url = @asset.get_action_url(current_user, 'edit', false)
|
@action_url = @asset.get_action_url(current_user, 'edit', false)
|
||||||
|
@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
|
||||||
end
|
end
|
||||||
|
|
||||||
def view
|
def view
|
||||||
@action_url = @asset.get_action_url(current_user, 'view', false)
|
@action_url = @asset.get_action_url(current_user, 'view', false)
|
||||||
|
@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
|
||||||
end
|
end
|
||||||
|
|
|
@ -335,6 +335,12 @@ class Asset < ActiveRecord::Base
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def favicon_url(action)
|
||||||
|
file_ext = file_file_name.split('.').last
|
||||||
|
action = get_action(file_ext, action)
|
||||||
|
action.wopi_app.icon if action.wopi_app
|
||||||
|
end
|
||||||
|
|
||||||
# locked?, lock_asset and refresh_lock rely on the asset
|
# locked?, lock_asset and refresh_lock rely on the asset
|
||||||
# being locked in the database to prevent race conditions
|
# being locked in the database to prevent race conditions
|
||||||
def locked?
|
def locked?
|
||||||
|
|
|
@ -11,8 +11,7 @@
|
||||||
<meta name="viewport"
|
<meta name="viewport"
|
||||||
content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no">
|
content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no">
|
||||||
|
|
||||||
<link rel="shortcut icon"
|
<link rel="shortcut icon" href='<%= @favicon_url %>' />
|
||||||
href="" />
|
|
||||||
|
|
||||||
<style type="text/css">
|
<style type="text/css">
|
||||||
body {
|
body {
|
||||||
|
@ -36,29 +35,26 @@
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
<form id='office_form' name='office_form' target='office_frame'
|
||||||
|
action='<%= @action_url %>' method='post'>
|
||||||
|
<input name='access_token' value='<%= @token %>' type='hidden'/>
|
||||||
|
<input name='access_token_ttl' value='<%= @ttl %>' type='hidden'/>
|
||||||
|
</form>
|
||||||
|
|
||||||
<form id="office_form" name="office_form" target="office_frame"
|
<span id="frameholder"></span>
|
||||||
action=<%=@action_url %>
|
|
||||||
method="post">
|
|
||||||
<input name="access_token" value=<%= @token%> type="hidden"/>
|
|
||||||
<input name="access_token_ttl" value= <%= @ttl %> type="hidden"/>
|
|
||||||
</form>
|
|
||||||
|
|
||||||
<span id="frameholder"></span>
|
<script type="text/javascript">
|
||||||
|
var frameholder = document.getElementById('frameholder');
|
||||||
<script type="text/javascript">
|
var office_frame = document.createElement('iframe');
|
||||||
var frameholder = document.getElementById('frameholder');
|
office_frame.name = 'office_frame';
|
||||||
var office_frame = document.createElement('iframe');
|
office_frame.id ='office_frame';
|
||||||
office_frame.name = 'office_frame';
|
// The title should be set for accessibility
|
||||||
office_frame.id ='office_frame';
|
office_frame.title = 'Office Online Frame';
|
||||||
// The title should be set for accessibility
|
// This attribute allows true fullscreen mode in slideshow view
|
||||||
office_frame.title = 'Office Online Frame';
|
// when using PowerPoint Online's 'view' action.
|
||||||
// This attribute allows true fullscreen mode in slideshow view
|
office_frame.setAttribute('allowfullscreen', 'true');
|
||||||
// when using PowerPoint Online's 'view' action.
|
frameholder.appendChild(office_frame);
|
||||||
office_frame.setAttribute('allowfullscreen', 'true');
|
document.getElementById('office_form').submit();
|
||||||
frameholder.appendChild(office_frame);
|
</script>
|
||||||
document.getElementById('office_form').submit();
|
</body>
|
||||||
</script>
|
|
||||||
|
|
||||||
</body>
|
|
||||||
</html>
|
</html>
|
||||||
|
|
|
@ -11,8 +11,7 @@
|
||||||
<meta name="viewport"
|
<meta name="viewport"
|
||||||
content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no">
|
content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no">
|
||||||
|
|
||||||
<link rel="shortcut icon"
|
<link rel="shortcut icon" href='<%= @favicon_url %>' />
|
||||||
href="" />
|
|
||||||
|
|
||||||
<style type="text/css">
|
<style type="text/css">
|
||||||
body {
|
body {
|
||||||
|
@ -36,29 +35,27 @@
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
<form id='office_form' name='office_form' target='office_frame'
|
||||||
|
action='<%= @action_url %>' method='post'>
|
||||||
|
<input name='access_token' value='<%= @token %>' type='hidden'/>
|
||||||
|
<input name='access_token_ttl' value='<%= @ttl %>' type='hidden'/>
|
||||||
|
</form>
|
||||||
|
|
||||||
<form id="office_form" name="office_form" target="office_frame"
|
<span id="frameholder"></span>
|
||||||
action=<%=@action_url %>
|
|
||||||
method="post">
|
|
||||||
<input name="access_token" value=<%= @token%> type="hidden"/>
|
|
||||||
<input name="access_token_ttl" value= <%= @ttl %> type="hidden"/>
|
|
||||||
</form>
|
|
||||||
|
|
||||||
<span id="frameholder"></span>
|
<script type="text/javascript">
|
||||||
|
var frameholder = document.getElementById('frameholder');
|
||||||
|
var office_frame = document.createElement('iframe');
|
||||||
|
office_frame.name = 'office_frame';
|
||||||
|
office_frame.id ='office_frame';
|
||||||
|
// The title should be set for accessibility
|
||||||
|
office_frame.title = 'Office Online Frame';
|
||||||
|
// This attribute allows true fullscreen mode in slideshow view
|
||||||
|
// when using PowerPoint Online's 'view' action.
|
||||||
|
office_frame.setAttribute('allowfullscreen', 'true');
|
||||||
|
frameholder.appendChild(office_frame);
|
||||||
|
document.getElementById('office_form').submit();
|
||||||
|
</script>
|
||||||
|
|
||||||
<script type="text/javascript">
|
</body>
|
||||||
var frameholder = document.getElementById('frameholder');
|
|
||||||
var office_frame = document.createElement('iframe');
|
|
||||||
office_frame.name = 'office_frame';
|
|
||||||
office_frame.id ='office_frame';
|
|
||||||
// The title should be set for accessibility
|
|
||||||
office_frame.title = 'Office Online Frame';
|
|
||||||
// This attribute allows true fullscreen mode in slideshow view
|
|
||||||
// when using PowerPoint Online's 'view' action.
|
|
||||||
office_frame.setAttribute('allowfullscreen', 'true');
|
|
||||||
frameholder.appendChild(office_frame);
|
|
||||||
document.getElementById('office_form').submit();
|
|
||||||
</script>
|
|
||||||
|
|
||||||
</body>
|
|
||||||
</html>
|
</html>
|
||||||
|
|
Loading…
Reference in a new issue