mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-02-24 07:44:46 +08:00
Merge pull request #2222 from aignatov-bio/ai-sci-update-structure-to-team-settings
Update CSS for team preferences and enable draft restore
This commit is contained in:
commit
33a4cb93c7
6 changed files with 44 additions and 51 deletions
app
assets
javascripts
stylesheets
views
28
app/assets/javascripts/sitewide/tiny_mce.js
vendored
28
app/assets/javascripts/sitewide/tiny_mce.js
vendored
|
@ -33,26 +33,22 @@ var TinyMCE = (function() {
|
|||
var prefix = getAutoSavePrefix(editor);
|
||||
var lastDraftTime = parseInt(tinyMCE.util.LocalStorage.getItem(prefix + 'time'), 10);
|
||||
var lastUpdated = $(selector).data('last-updated');
|
||||
|
||||
var restoreBtn = $('<button class="btn restore-draft-btn pull-right">Restore Draft</button>');
|
||||
var cancelBtn = $(`<div class="tinymce-cancel-notification-button pull-right">
|
||||
<button type="button">
|
||||
<span class="fas fa-times"></span>
|
||||
</button>
|
||||
</div>`);
|
||||
var notificationBar;
|
||||
var restoreBtn = $('<button class="btn restore-draft-btn">Restore Draft</button>');
|
||||
var cancelBtn = $('<span class="fas fa-times"></span>');
|
||||
|
||||
// Check whether we have draft stored
|
||||
if (editor.plugins.autosave.hasDraft()) {
|
||||
var notificationBar = $('<div class="restore-draft-notification"></div>');
|
||||
notificationBar = $('<div class="restore-draft-notification"></div>');
|
||||
|
||||
if (lastDraftTime < lastUpdated) {
|
||||
notificationBar.text(I18n.t('tiny_mce.older_version_available'));
|
||||
notificationBar.html(`<span class="notification-text">${I18n.t('tiny_mce.older_version_available')}</span>`);
|
||||
} else {
|
||||
notificationBar.text(I18n.t('tiny_mce.newer_version_available'));
|
||||
notificationBar.html(`<span class="notification-text">${I18n.t('tiny_mce.newer_version_available')}</span>`);
|
||||
}
|
||||
|
||||
// Add notification bar
|
||||
$(notificationBar).append(cancelBtn).append(restoreBtn);
|
||||
$(notificationBar).append(restoreBtn).append(cancelBtn);
|
||||
$(editor.contentAreaContainer).before(notificationBar);
|
||||
|
||||
$(restoreBtn).click(function() {
|
||||
|
@ -115,7 +111,7 @@ var TinyMCE = (function() {
|
|||
selector: selector,
|
||||
convert_urls: false,
|
||||
menubar: 'file edit view insert format',
|
||||
toolbar: 'undo redo restoredraft | insert | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link | forecolor backcolor | customimageuploader marvinjsplugin | codesample',
|
||||
toolbar: 'undo redo | insert | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link | forecolor backcolor | customimageuploader marvinjsplugin | codesample',
|
||||
plugins: plugins,
|
||||
autoresize_bottom_margin: 20,
|
||||
codesample_languages: [
|
||||
|
@ -136,7 +132,8 @@ var TinyMCE = (function() {
|
|||
browser_spellcheck: true,
|
||||
branding: false,
|
||||
fixed_toolbar_container: '#mytoolbar',
|
||||
autosave_interval: '15s',
|
||||
autosave_restore_when_empty: false,
|
||||
autosave_interval: '1s',
|
||||
autosave_retention: '1440m',
|
||||
removed_menuitems: 'newdocument',
|
||||
object_resizing: true,
|
||||
|
@ -254,6 +251,7 @@ var TinyMCE = (function() {
|
|||
editorForm.find('.tinymce-status-badge').removeClass('hidden');
|
||||
editor.remove();
|
||||
editorForm.find('.tinymce-view').html(data.html).removeClass('hidden');
|
||||
editor.plugins.autosave.removeDraft();
|
||||
if (onSaveCallback) { onSaveCallback(); }
|
||||
}).on('ajax:error', function(ev, data) {
|
||||
var model = editor.getElement().dataset.objectType;
|
||||
|
@ -326,9 +324,9 @@ var TinyMCE = (function() {
|
|||
}, 0);
|
||||
});
|
||||
|
||||
/* editor.on('init', function(e) {
|
||||
editor.on('init', function(e) {
|
||||
restoreDraftNotification(selector, editor);
|
||||
});*/
|
||||
});
|
||||
},
|
||||
codesample_content_css: $(selector).data('highlightjs-path')
|
||||
});
|
||||
|
|
|
@ -46,7 +46,7 @@ tinymce.PluginManager.add('placeholder', function(editor) {
|
|||
label.hide();
|
||||
}
|
||||
|
||||
// calculatePlaceholderPosition();
|
||||
calculatePlaceholderPosition();
|
||||
}
|
||||
|
||||
function onKeydown() {
|
||||
|
|
|
@ -26,29 +26,20 @@
|
|||
}
|
||||
|
||||
.team-metadata {
|
||||
align-items: center;
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fill, minmax(300px, 2fr));
|
||||
grid-gap: 20px;
|
||||
font-size: 14px;
|
||||
min-height: 40px;
|
||||
margin-bottom: 20px;
|
||||
|
||||
.created-at,
|
||||
.created-by,
|
||||
.space-usage {
|
||||
flex-grow: 1;
|
||||
line-height: 40px;
|
||||
.grid-block {
|
||||
|
||||
.fas {
|
||||
color: $color-silver;
|
||||
margin-right: 10px;
|
||||
margin-right: 5px;
|
||||
}
|
||||
}
|
||||
|
||||
.created-at,
|
||||
.created-by {
|
||||
margin-right: 20px
|
||||
}
|
||||
|
||||
.created-by {
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
|
|
|
@ -67,29 +67,33 @@
|
|||
background: $color-white !important;
|
||||
}
|
||||
|
||||
.tinymce-cancel-notification-button {
|
||||
cursor: pointer;
|
||||
|
||||
.fas {
|
||||
color: $color-silver-chalice;
|
||||
font-family: 'Font Awesome 5 Free';
|
||||
font-weight: 501;
|
||||
margin-left: 10px;
|
||||
margin-top: 4px;
|
||||
}
|
||||
}
|
||||
|
||||
.restore-draft-notification {
|
||||
align-items: center;
|
||||
background: $state-info-bg !important;
|
||||
height: 25px !important;
|
||||
padding: 5px 10px 0 !important;
|
||||
display: flex;
|
||||
height: 30px !important;
|
||||
padding: 0 10px !important;
|
||||
|
||||
.notification-text {
|
||||
flex-grow: 1;
|
||||
}
|
||||
|
||||
.restore-draft-btn {
|
||||
border: 1px solid $color-silver-chalice;
|
||||
cursor: pointer;
|
||||
font-size: 12px;
|
||||
margin-top: -2px;
|
||||
padding: 3px 10px 3px 10px;
|
||||
}
|
||||
|
||||
.fas {
|
||||
color: $color-silver-chalice;
|
||||
cursor: pointer;
|
||||
font-family: 'Font Awesome 5 Free';
|
||||
font-weight: 501;
|
||||
margin-left: 10px;
|
||||
}
|
||||
}
|
||||
|
||||
.mce-stack-layout {
|
||||
|
|
|
@ -10,11 +10,13 @@ elsif my_module.is_overdue?
|
|||
end
|
||||
%>
|
||||
<span class="date-text <%= date_class %>">
|
||||
<span class="view-block"><%= l(my_module.due_date.utc, format: :full) %></span>
|
||||
<span class="view-block">
|
||||
<%= my_module.due_date ? l(my_module.due_date.utc, format: :full) : t("experiments.canvas.full_zoom.no_due_date") %>
|
||||
</span>
|
||||
<%= render partial: "global_activities/date_picker.html.erb", locals: {
|
||||
id: 'due-date',
|
||||
use_current: 'false',
|
||||
setDate: l(my_module.due_date.utc, format: :full),
|
||||
setDate: my_module.due_date ? l(my_module.due_date.utc, format: :full) : '',
|
||||
placeholder: t("experiments.canvas.full_zoom.no_due_date"),
|
||||
label: nil
|
||||
} %>
|
||||
|
|
|
@ -35,27 +35,25 @@
|
|||
<!-- HEADER -->
|
||||
<div class="team-metadata">
|
||||
|
||||
<div class="created-at">
|
||||
<div class="created-at grid-block">
|
||||
<span class="fas fa-calendar-alt"></span>
|
||||
<span class="hidden-xs hidden-sm"><%= t("users.settings.teams.edit.header_created_at") %></span>
|
||||
<b><%= l(@team.created_at, format: :full_date) %></b>
|
||||
</div>
|
||||
|
||||
<div class="created-by">
|
||||
<div class="created-by grid-block">
|
||||
<span class="fas fa-user fa-lg"></span>
|
||||
<span class="hidden-xs hidden-sm"><%= t("users.settings.teams.edit.header_created_by") %></span>
|
||||
<b><%= t("users.settings.teams.edit.header_created_by_name_email", name: team_created_by(@team).name, email: team_created_by(@team).email) %></b>
|
||||
</div>
|
||||
|
||||
<div class="space-usage">
|
||||
<div class="space-usage grid-block">
|
||||
<span class="fas fa-hdd"></span>
|
||||
<span class="hidden-xs hidden-sm"><%= t("users.settings.teams.edit.header_space_taken") %></span>
|
||||
<b data-hook="team-space-taken"><%= "#{number_to_human_size(@team.space_taken)}" %></b>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div data-hook="team-header-second-row"></div>
|
||||
|
||||
<div class="team-description">
|
||||
<%= render partial: "shared/tiny_mce_editor.html.erb",
|
||||
locals: {
|
||||
|
|
Loading…
Reference in a new issue