Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HTML model and viewer plugin #1354

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion BrainPortal/app/assets/stylesheets/cbrain.css.erb
Original file line number Diff line number Diff line change
Expand Up @@ -679,7 +679,11 @@ a {
border: 1px solid #E4E4E4;
}


.bigiframe {
position: relative;
height: 100%;
width: 100%;
}

/* % ######################################################### */
/* % General box layouts for account information */
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@

#
# CBRAIN Project
#
# Copyright (C) 2008-2023
# The Royal Institution for the Advancement of Learning
# McGill University
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#

# This model represents a single HTML file
class HtmlFile < TextFile

Revision_info=CbrainFileRevision[__FILE__] #:nodoc:

has_viewer :name => 'HTML', :partial => :html, :if => :is_locally_synced?

def self.file_name_pattern #:nodoc:
/\.x?html?\z/i
end

def self.pretty_type #:nodoc:
"HTML File"
end

end
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@

<%
#
# CBRAIN Project
#
# Copyright (C) 2008-2023
# The Royal Institution for the Advancement of Learning
# McGill University
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
%>



<%= link_to h("Open in a separate tab"), url_for(:controller => :userfiles, :id => @userfile.id, :action => :display, :viewer => :html, :content_viewer => "on", :file_name => @userfile.name), :target => "_blank" if params[:action] == "show" %>

<iframe sandbox
src="<%= stream_userfile_path(@userfile, :disposition => 'inline')%>"
class="bigiframe"
style="width:100%; height: 100%;"
>
HTML Viewer
</iframe>
HTML was sandboxed and filtered for greter safety
<%= link_to h("Show as is in a separate tab, without any safety filters"), stream_userfile_path(@userfile, :disposition => 'inline'), :target => "_blank" %>




Loading