Merge pull request #737 from Ducz0r/lm-sci-1450

Add versioning modal & support to sciNote [SCI-1450]
This commit is contained in:
Luka Murn 2017-07-11 09:47:51 +02:00 committed by GitHub
commit 73a4cd1e4f
11 changed files with 72 additions and 6 deletions

1
VERSION Normal file
View file

@ -0,0 +1 @@
1.12.1

View file

@ -0,0 +1,9 @@
(function() {
'use strict';
$(document).ready(function() {
$("[data-trigger='about-modal']").on('click', function() {
$('[data-role=about-modal]').modal('show');
});
});
})();

View file

@ -82,7 +82,7 @@ class WopiController < ActionController::Base
}
response.headers['X-WOPI-HostEndpoint'] = ENV['WOPI_ENDPOINT_URL']
response.headers['X-WOPI-MachineName'] = ENV['WOPI_ENDPOINT_URL']
response.headers['X-WOPI-ServerVersion'] = Constants::APP_VERSION
response.headers['X-WOPI-ServerVersion'] = Scinote::Application::VERSION
render json: msg and return
end

View file

@ -0,0 +1,8 @@
module AddonsHelper
def list_all_addons
Rails::Engine
.subclasses
.select { |c| c.name.start_with?('Scinote') }
.map(&:parent)
end
end

View file

@ -45,6 +45,9 @@
</div>
</div>
<!-- About us modal -->
<%= render "shared/about_modal" %>
<%= render "shared/navigation" %>
<div id="notifications">

View file

@ -0,0 +1,28 @@
<div class="modal" id="aboutModal" tabindex="-1" role="dialog" aria-labelledby="aboutModal" data-role="about-modal">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title"><%= t('about.modal_title') %></h4>
</div>
<div class="modal-body">
<strong><%= t('about.core_version') %></strong>
<br />
<%= Scinote::Application::VERSION %>
<br />
<br />
<div data-hook="about-modal-addon-versions">
<strong><%= t('about.addon_versions') %></strong>
<br />
<% list_all_addons.each do |addon| %>
<%= "#{addon.name}:" %>
<br />
<%= addon::VERSION %>
<br />
<br />
<% end %>
</div>
</div>
</div>
</div>
</div>

View file

@ -19,7 +19,7 @@
<% if show_version %>
<%= image_tag('/images/logo.png', class: 'with-version', id: 'logo') %>
<span class="version">
<%= Constants::APP_VERSION %>
<%= Scinote::Application::VERSION %>
</span>
<% else %>
<%= image_tag('/images/logo.png', id: 'logo') %>
@ -234,6 +234,12 @@
<li><%= link_to t('nav.help.contact'),
Constants::CONTACT_URL,
target: "_blank" %></li>
<li role="separator" class="divider"></li>
<li>
<%= link_to '#', data: { trigger: 'about-modal' } do %>
<%= t('nav.help.about') %>
<% end %>
</li>
</ul>
</li>

View file

@ -37,5 +37,8 @@ module Scinote
csv: 'text/plain',
wopitest: ['text/plain', 'inode/x-empty']
}
# sciNote Core Application version
VERSION = File.read(Rails.root.join('VERSION')).strip.freeze
end
end

View file

@ -196,9 +196,6 @@ class Constants
# Other
#=============================================================================
# Application version
APP_VERSION = '1.12.1'.freeze
TEXT_EXTRACT_FILE_TYPES = [
'application/pdf',
'application/rtf',

View file

@ -72,6 +72,7 @@ en:
support: "Customer support"
premium: "Premium"
contact: "Contact us"
about: "About sciNote"
activities:
none: "No activities!"
label:
@ -87,6 +88,11 @@ en:
info: "Info"
account: "Account"
about:
modal_title: "About sciNote"
core_version: "sciNote core version"
addon_versions: "Addon versions"
sidebar:
title: "Navigation"
no_module_group: "No workflow"

View file

@ -114,12 +114,16 @@ class AddonGenerator < Rails::Generators::NamedBase
gsub_file(file_path, '${ADDON_NAME}', @addon_name)
# lib/.../version.rb
dots = @modules.map { '/..' }.join
create_file(
"addons/#{@addon_name}/lib/" \
"#{@folders_path}/version.rb"
) do
embed_into_modules do
"VERSION = '0.0.1'.freeze\n"
"VERSION =\n" \
" File.read(\n" \
" \"\#{File.dirname(__FILE__)}#{dots}/../VERSION\"\n" \
" ).strip.freeze\n"
end
end
@ -182,6 +186,7 @@ class AddonGenerator < Rails::Generators::NamedBase
gsub_file(file_path, '${FULL_UNDERSCORE_NAME}', @full_underscore_name)
gsub_file(file_path, '${NAME}', name)
gsub_file(file_path, '${FOLDERS_PATH}', @folders_path)
create_file("addons/#{@addon_name}/VERSION") { '0.0.1' }
# Rakefile
file_path = "addons/#{@addon_name}/Rakefile"