mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-09-13 00:24:42 +08:00
Add "about" modal, prepare hooks, VERSION system for addons
Also the addon generator is fixed so it properly creates VERSION file for new addons.
This commit is contained in:
parent
16e672b9d8
commit
3e80f761b8
7 changed files with 66 additions and 1 deletions
9
app/assets/javascripts/sitewide/about_modal.js
Normal file
9
app/assets/javascripts/sitewide/about_modal.js
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
(function() {
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
$(document).ready(function() {
|
||||||
|
$("[data-trigger='about-modal']").on('click', function() {
|
||||||
|
$('[data-role=about-modal]').modal('show');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
})();
|
8
app/helpers/addons_helper.rb
Normal file
8
app/helpers/addons_helper.rb
Normal 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
|
|
@ -45,6 +45,9 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<!-- About us modal -->
|
||||||
|
<%= render "shared/about_modal" %>
|
||||||
|
|
||||||
<%= render "shared/navigation" %>
|
<%= render "shared/navigation" %>
|
||||||
|
|
||||||
<div id="notifications">
|
<div id="notifications">
|
||||||
|
|
28
app/views/shared/_about_modal.html.erb
Normal file
28
app/views/shared/_about_modal.html.erb
Normal 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">×</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>
|
|
@ -234,6 +234,12 @@
|
||||||
<li><%= link_to t('nav.help.contact'),
|
<li><%= link_to t('nav.help.contact'),
|
||||||
Constants::CONTACT_URL,
|
Constants::CONTACT_URL,
|
||||||
target: "_blank" %></li>
|
target: "_blank" %></li>
|
||||||
|
<li role="separator" class="divider"></li>
|
||||||
|
<li>
|
||||||
|
<%= link_to '#', data: { trigger: 'about-modal' } do %>
|
||||||
|
<%= t('nav.help.about') %>
|
||||||
|
<% end %>
|
||||||
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
|
|
|
@ -72,6 +72,7 @@ en:
|
||||||
support: "Customer support"
|
support: "Customer support"
|
||||||
premium: "Premium"
|
premium: "Premium"
|
||||||
contact: "Contact us"
|
contact: "Contact us"
|
||||||
|
about: "About sciNote"
|
||||||
activities:
|
activities:
|
||||||
none: "No activities!"
|
none: "No activities!"
|
||||||
label:
|
label:
|
||||||
|
@ -87,6 +88,11 @@ en:
|
||||||
info: "Info"
|
info: "Info"
|
||||||
account: "Account"
|
account: "Account"
|
||||||
|
|
||||||
|
about:
|
||||||
|
modal_title: "About sciNote"
|
||||||
|
core_version: "sciNote core version"
|
||||||
|
addon_versions: "Addon versions"
|
||||||
|
|
||||||
sidebar:
|
sidebar:
|
||||||
title: "Navigation"
|
title: "Navigation"
|
||||||
no_module_group: "No workflow"
|
no_module_group: "No workflow"
|
||||||
|
|
|
@ -114,12 +114,16 @@ class AddonGenerator < Rails::Generators::NamedBase
|
||||||
gsub_file(file_path, '${ADDON_NAME}', @addon_name)
|
gsub_file(file_path, '${ADDON_NAME}', @addon_name)
|
||||||
|
|
||||||
# lib/.../version.rb
|
# lib/.../version.rb
|
||||||
|
dots = @modules.map { '/..' }.join
|
||||||
create_file(
|
create_file(
|
||||||
"addons/#{@addon_name}/lib/" \
|
"addons/#{@addon_name}/lib/" \
|
||||||
"#{@folders_path}/version.rb"
|
"#{@folders_path}/version.rb"
|
||||||
) do
|
) do
|
||||||
embed_into_modules 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
|
||||||
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, '${FULL_UNDERSCORE_NAME}', @full_underscore_name)
|
||||||
gsub_file(file_path, '${NAME}', name)
|
gsub_file(file_path, '${NAME}', name)
|
||||||
gsub_file(file_path, '${FOLDERS_PATH}', @folders_path)
|
gsub_file(file_path, '${FOLDERS_PATH}', @folders_path)
|
||||||
|
create_file("addons/#{@addon_name}/VERSION") { '0.0.1' }
|
||||||
|
|
||||||
# Rakefile
|
# Rakefile
|
||||||
file_path = "addons/#{@addon_name}/Rakefile"
|
file_path = "addons/#{@addon_name}/Rakefile"
|
||||||
|
|
Loading…
Add table
Reference in a new issue