mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-12-29 11:45:18 +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
|
||||
@action_url = @asset.get_action_url(current_user, 'edit', false)
|
||||
@favicon_url = @asset.favicon_url('edit')
|
||||
@token = current_user.get_wopi_token
|
||||
@ttl = (current_user.wopi_token_ttl * 1000).to_s
|
||||
end
|
||||
|
||||
def view
|
||||
@action_url = @asset.get_action_url(current_user, 'view', false)
|
||||
@favicon_url = @asset.favicon_url('view')
|
||||
@token = current_user.get_wopi_token
|
||||
@ttl = (current_user.wopi_token_ttl * 1000).to_s
|
||||
end
|
||||
|
|
|
@ -335,6 +335,12 @@ class Asset < ActiveRecord::Base
|
|||
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
|
||||
# being locked in the database to prevent race conditions
|
||||
def locked?
|
||||
|
|
|
@ -11,8 +11,7 @@
|
|||
<meta name="viewport"
|
||||
content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no">
|
||||
|
||||
<link rel="shortcut icon"
|
||||
href="" />
|
||||
<link rel="shortcut icon" href='<%= @favicon_url %>' />
|
||||
|
||||
<style type="text/css">
|
||||
body {
|
||||
|
@ -36,29 +35,26 @@
|
|||
</style>
|
||||
</head>
|
||||
<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"
|
||||
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>
|
||||
|
||||
<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>
|
||||
|
||||
</body>
|
||||
<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>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -11,8 +11,7 @@
|
|||
<meta name="viewport"
|
||||
content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no">
|
||||
|
||||
<link rel="shortcut icon"
|
||||
href="" />
|
||||
<link rel="shortcut icon" href='<%= @favicon_url %>' />
|
||||
|
||||
<style type="text/css">
|
||||
body {
|
||||
|
@ -36,29 +35,27 @@
|
|||
</style>
|
||||
</head>
|
||||
<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"
|
||||
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>
|
||||
|
||||
<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">
|
||||
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>
|
||||
</body>
|
||||
</html>
|
||||
|
|
Loading…
Reference in a new issue