diff --git a/Gemfile b/Gemfile index 4563b472786745f9eede8517a6ec878d6e4dce01..c28ecb2d6d2ddb82c8cbd78e90e2c59f24607352 100644 --- a/Gemfile +++ b/Gemfile @@ -61,7 +61,7 @@ gem "simple_form" gem "simple_form_bs5_file_input"#, path: "../simple_form_bs5_file_input" gem "simple_form_password_with_hints"#, path: "../simple_form_password_with_hints" gem "sprockets-rails", "~> 3.4" -gem "summernote-rails", git: "https://github.com/noesya/summernote-rails.git", branch: "feature/cleaner" +gem "summernote-rails", git: "https://github.com/noesya/summernote-rails.git" # gem "summernote-rails", path: "../summernote-rails" gem "two_factor_authentication", git: "https://github.com/noesya/two_factor_authentication.git" # gem "two_factor_authentication", path: "../two_factor_authentication" diff --git a/Gemfile.lock b/Gemfile.lock index 0e9871c0f06fe9521de550c740743bea2411e847..10a3a71f782a71c32c4a4705020b5f6f6c7a6408 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,6 @@ GIT remote: https://github.com/noesya/summernote-rails.git - revision: 26889491557e607cedade7590b18ae28161215ec - branch: feature/cleaner + revision: 32fd182c929cdcacaa6e3bd3569871bd025fa669 specs: summernote-rails (0.8.20.1) nokogiri @@ -21,47 +20,47 @@ GIT GEM remote: https://rubygems.org/ specs: - actioncable (7.0.4.2) - actionpack (= 7.0.4.2) - activesupport (= 7.0.4.2) + actioncable (7.0.4.3) + actionpack (= 7.0.4.3) + activesupport (= 7.0.4.3) nio4r (~> 2.0) websocket-driver (>= 0.6.1) - actionmailbox (7.0.4.2) - actionpack (= 7.0.4.2) - activejob (= 7.0.4.2) - activerecord (= 7.0.4.2) - activestorage (= 7.0.4.2) - activesupport (= 7.0.4.2) + actionmailbox (7.0.4.3) + actionpack (= 7.0.4.3) + activejob (= 7.0.4.3) + activerecord (= 7.0.4.3) + activestorage (= 7.0.4.3) + activesupport (= 7.0.4.3) mail (>= 2.7.1) net-imap net-pop net-smtp - actionmailer (7.0.4.2) - actionpack (= 7.0.4.2) - actionview (= 7.0.4.2) - activejob (= 7.0.4.2) - activesupport (= 7.0.4.2) + actionmailer (7.0.4.3) + actionpack (= 7.0.4.3) + actionview (= 7.0.4.3) + activejob (= 7.0.4.3) + activesupport (= 7.0.4.3) mail (~> 2.5, >= 2.5.4) net-imap net-pop net-smtp rails-dom-testing (~> 2.0) - actionpack (7.0.4.2) - actionview (= 7.0.4.2) - activesupport (= 7.0.4.2) + actionpack (7.0.4.3) + actionview (= 7.0.4.3) + activesupport (= 7.0.4.3) rack (~> 2.0, >= 2.2.0) rack-test (>= 0.6.3) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.2.0) - actiontext (7.0.4.2) - actionpack (= 7.0.4.2) - activerecord (= 7.0.4.2) - activestorage (= 7.0.4.2) - activesupport (= 7.0.4.2) + actiontext (7.0.4.3) + actionpack (= 7.0.4.3) + activerecord (= 7.0.4.3) + activestorage (= 7.0.4.3) + activesupport (= 7.0.4.3) globalid (>= 0.6.0) nokogiri (>= 1.8.5) - actionview (7.0.4.2) - activesupport (= 7.0.4.2) + actionview (7.0.4.3) + activesupport (= 7.0.4.3) builder (~> 3.1) erubi (~> 1.4) rails-dom-testing (~> 2.0) @@ -71,25 +70,25 @@ GEM activemodel (>= 5.2.0) activestorage (>= 5.2.0) activesupport (>= 5.2.0) - activejob (7.0.4.2) - activesupport (= 7.0.4.2) + activejob (7.0.4.3) + activesupport (= 7.0.4.3) globalid (>= 0.3.6) - activemodel (7.0.4.2) - activesupport (= 7.0.4.2) - activerecord (7.0.4.2) - activemodel (= 7.0.4.2) - activesupport (= 7.0.4.2) - activestorage (7.0.4.2) - actionpack (= 7.0.4.2) - activejob (= 7.0.4.2) - activerecord (= 7.0.4.2) - activesupport (= 7.0.4.2) + activemodel (7.0.4.3) + activesupport (= 7.0.4.3) + activerecord (7.0.4.3) + activemodel (= 7.0.4.3) + activesupport (= 7.0.4.3) + activestorage (7.0.4.3) + actionpack (= 7.0.4.3) + activejob (= 7.0.4.3) + activerecord (= 7.0.4.3) + activesupport (= 7.0.4.3) marcel (~> 1.0) mini_mime (>= 1.1.0) activestorage-scaleway-service (1.0.1) activestorage aws-sdk-s3 - activesupport (7.0.4.2) + activesupport (7.0.4.3) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (>= 1.6, < 2) minitest (>= 5.1) @@ -103,7 +102,7 @@ GEM autoprefixer-rails (10.4.13.0) execjs (~> 2) aws-eventstream (1.2.0) - aws-partitions (1.725.0) + aws-partitions (1.726.0) aws-sdk-core (3.170.0) aws-eventstream (~> 1, >= 1.0.2) aws-partitions (~> 1, >= 1.651.0) @@ -387,27 +386,27 @@ GEM puma (6.1.1) nio4r (~> 2.0) racc (1.6.2) - rack (2.2.6.3) + rack (2.2.6.4) rack-mini-profiler (2.3.4) rack (>= 1.2.0) rack-protection (3.0.5) rack rack-test (2.0.2) rack (>= 1.3) - rails (7.0.4.2) - actioncable (= 7.0.4.2) - actionmailbox (= 7.0.4.2) - actionmailer (= 7.0.4.2) - actionpack (= 7.0.4.2) - actiontext (= 7.0.4.2) - actionview (= 7.0.4.2) - activejob (= 7.0.4.2) - activemodel (= 7.0.4.2) - activerecord (= 7.0.4.2) - activestorage (= 7.0.4.2) - activesupport (= 7.0.4.2) + rails (7.0.4.3) + actioncable (= 7.0.4.3) + actionmailbox (= 7.0.4.3) + actionmailer (= 7.0.4.3) + actionpack (= 7.0.4.3) + actiontext (= 7.0.4.3) + actionview (= 7.0.4.3) + activejob (= 7.0.4.3) + activemodel (= 7.0.4.3) + activerecord (= 7.0.4.3) + activestorage (= 7.0.4.3) + activesupport (= 7.0.4.3) bundler (>= 1.15.0) - railties (= 7.0.4.2) + railties (= 7.0.4.3) rails-autocomplete (2.0.1) rails (>= 4.0) rails-dom-testing (2.0.3) @@ -418,9 +417,9 @@ GEM rails-i18n (7.0.6) i18n (>= 0.7, < 2) railties (>= 6.0.0, < 8) - railties (7.0.4.2) - actionpack (= 7.0.4.2) - activesupport (= 7.0.4.2) + railties (7.0.4.3) + actionpack (= 7.0.4.3) + activesupport (= 7.0.4.3) method_source rake (>= 12.2) thor (~> 1.0) diff --git a/app/assets/javascripts/application/plugins/summernote.js b/app/assets/javascripts/application/plugins/summernote.js index 97027abf497ff990b0dd33ead9d3328912d8c93e..4f512e2da3e29deab77ab5fbf517c036a8291217 100644 --- a/app/assets/javascripts/application/plugins/summernote.js +++ b/app/assets/javascripts/application/plugins/summernote.js @@ -1,4 +1,4 @@ -/*global $, SummernoteAttachmentUpload */ +/*global $ */ $(function () { 'use strict'; @@ -37,11 +37,6 @@ $(function () { configs['full'] = { - popover: { - image: [ - ['remove', ['removeMedia']] - ] - }, toolbar: [ ['style', ['style']], ['font', ['bold', 'italic']], @@ -60,31 +55,11 @@ $(function () { 'h4' ], followingToolbar: true, - disableDragAndDrop: true, - callbacks: { - onImageUpload: function (files) { - var attachmentUpload = new SummernoteAttachmentUpload(this, files[0]); - attachmentUpload.start(); - }, - onMediaDelete: function (_, $editable) { - $.summernote.rails.cleanEmptyAttachments($editable); - }, - onKeyup: function (e) { - var $editable = $(e.currentTarget); - if (e.keyCode === 8) { - $.summernote.rails.cleanEmptyAttachments($editable); - } - } - } + disableDragAndDrop: true }; configs['default'] = { - popover: { - image: [ - ['remove', ['removeMedia']] - ] - }, toolbar: [ ['style', ['style']], ['font', ['bold', 'italic']], @@ -104,11 +79,6 @@ $(function () { disableDragAndDrop: true }; - $.extend($.summernote.lang['en-US'].image, { - dragImageHere: 'Drag file here', - dropImage: 'Drop file' - }); - $('[data-provider="summernote"]').each(function () { var config = $(this).attr('data-summernote-config'), locale = $('#summernote-locale').data('locale'), diff --git a/app/assets/stylesheets/extranet/pages/_posts.sass b/app/assets/stylesheets/extranet/pages/_posts.sass new file mode 100644 index 0000000000000000000000000000000000000000..281026c4ef8673e3fb728f56b16c488bb0f53597 --- /dev/null +++ b/app/assets/stylesheets/extranet/pages/_posts.sass @@ -0,0 +1,30 @@ +.posts-show header figure + display: inline-block + position: relative + figcaption + display: block + font-size: 1rem + left: 0 + position: absolute + right: 0 + text-align: right + z-index: 10 + &::before + content: '©' + padding: 0.5rem + padding-right: 0 + position: absolute + right: 0 + top: 0 + p + display: none + font-weight: 400 + padding: 0.5rem + padding-right: 1rem + a + text-decoration: underline + &:hover figcaption p + display: block + @include media-breakpoint-down(md) + figcaption p + display: block diff --git a/app/controllers/admin/research/journals/volumes_controller.rb b/app/controllers/admin/research/journals/volumes_controller.rb index 654fabf5e3b604648c3b381c4657adffcb2b9b49..7a8d0ce2e10c87ff64b5ebb96e736239c1941445 100644 --- a/app/controllers/admin/research/journals/volumes_controller.rb +++ b/app/controllers/admin/research/journals/volumes_controller.rb @@ -69,7 +69,7 @@ class Admin::Research::Journals::VolumesController < Admin::Research::Journals:: params.require(:research_journal_volume) .permit( :title, :slug, :number, :keywords, :published, :published_at, :meta_description, :summary, :text, - :featured_image, :featured_image_infos, :featured_image_delete, :featured_image_alt, :featured_image_credit + :featured_image, :featured_image_delete, :featured_image_infos, :featured_image_alt, :featured_image_credit ) .merge(university_id: current_university.id) end diff --git a/app/models/communication/extranet.rb b/app/models/communication/extranet.rb index 512e868626c3d62ed8a076f0704b921f1148bd15..c99daf122abc88d0f162d495cacdae7a82b36e3b 100644 --- a/app/models/communication/extranet.rb +++ b/app/models/communication/extranet.rb @@ -2,35 +2,34 @@ # # Table name: communication_extranets # -# id :uuid not null, primary key -# about_type :string indexed => [about_id] -# allow_experiences_modification :boolean default(TRUE) -# color :string -# cookies_policy :text -# css :text -# feature_alumni :boolean default(FALSE) -# feature_contacts :boolean default(FALSE) -# feature_jobs :boolean default(FALSE) -# feature_library :boolean default(FALSE) -# feature_posts :boolean default(FALSE) -# has_sso :boolean default(FALSE) -# home_sentence :text -# host :string -# name :string -# privacy_policy :text -# registration_contact :string -# sass :text -# sso_button_label :string -# sso_cert :text -# sso_mapping :jsonb -# sso_name_identifier_format :string -# sso_provider :integer default("saml") -# sso_target_url :string -# terms :text -# created_at :datetime not null -# updated_at :datetime not null -# about_id :uuid indexed => [about_type] -# university_id :uuid not null, indexed +# id :uuid not null, primary key +# about_type :string indexed => [about_id] +# color :string +# cookies_policy :text +# css :text +# feature_alumni :boolean default(FALSE) +# feature_contacts :boolean default(FALSE) +# feature_jobs :boolean default(FALSE) +# feature_library :boolean default(FALSE) +# feature_posts :boolean default(FALSE) +# has_sso :boolean default(FALSE) +# home_sentence :text +# host :string +# name :string +# privacy_policy :text +# registration_contact :string +# sass :text +# sso_button_label :string +# sso_cert :text +# sso_mapping :jsonb +# sso_name_identifier_format :string +# sso_provider :integer default("saml") +# sso_target_url :string +# terms :text +# created_at :datetime not null +# updated_at :datetime not null +# about_id :uuid indexed => [about_type] +# university_id :uuid not null, indexed # # Indexes # diff --git a/app/views/admin/application/featured_image/_edit.html.erb b/app/views/admin/application/featured_image/_edit.html.erb index d06e8ba72065e3fcdcdf4116c398d63daf58f695..1556607a8fb993739690c336d49c009cbabc2af2 100644 --- a/app/views/admin/application/featured_image/_edit.html.erb +++ b/app/views/admin/application/featured_image/_edit.html.erb @@ -5,7 +5,8 @@ label: false, hint: '.jpg, .jpeg, .png, .svg', input_html: { accept: '.jpg,.jpeg,.png,.svg' }, - preview: true %> + preview: true, + resize: true %> <%= f.input :featured_image_alt, label: t('featured_image.alt.label'), hint: t('featured_image.alt.hint') %> diff --git a/app/views/extranet/posts/posts/show.html.erb b/app/views/extranet/posts/posts/show.html.erb index 8f3410964550a0c559909163a89113c92d96c499..2849467f1b745a4832454d59f27d6dd6d0642f06 100644 --- a/app/views/extranet/posts/posts/show.html.erb +++ b/app/views/extranet/posts/posts/show.html.erb @@ -2,7 +2,14 @@ <% content_for :header_right do %> <% if @post.featured_image.attached? %> - <%= kamifusen_tag @post.featured_image, class: 'img-fluid', width: 300 %> + <figure> + <%= kamifusen_tag @post.featured_image, class: 'img-fluid', width: 300 %> + <% if !@post.featured_image_credit.blank? %> + <figcaption tabindex="0"> + <%= sanitize @post.featured_image_credit %> + </figcaption> + <% end %> + </figure> <% end %> <% end %> diff --git a/test/fixtures/communication/extranets.yml b/test/fixtures/communication/extranets.yml index 5b00f559b78ac19b9a3871e2736923e92e325c4b..c4a72564511a4905256b44eff1b90d9ad95d76db 100644 --- a/test/fixtures/communication/extranets.yml +++ b/test/fixtures/communication/extranets.yml @@ -2,35 +2,34 @@ # # Table name: communication_extranets # -# id :uuid not null, primary key -# about_type :string indexed => [about_id] -# allow_experiences_modification :boolean default(TRUE) -# color :string -# cookies_policy :text -# css :text -# feature_alumni :boolean default(FALSE) -# feature_contacts :boolean default(FALSE) -# feature_jobs :boolean default(FALSE) -# feature_library :boolean default(FALSE) -# feature_posts :boolean default(FALSE) -# has_sso :boolean default(FALSE) -# home_sentence :text -# host :string -# name :string -# privacy_policy :text -# registration_contact :string -# sass :text -# sso_button_label :string -# sso_cert :text -# sso_mapping :jsonb -# sso_name_identifier_format :string -# sso_provider :integer default("saml") -# sso_target_url :string -# terms :text -# created_at :datetime not null -# updated_at :datetime not null -# about_id :uuid indexed => [about_type] -# university_id :uuid not null, indexed +# id :uuid not null, primary key +# about_type :string indexed => [about_id] +# color :string +# cookies_policy :text +# css :text +# feature_alumni :boolean default(FALSE) +# feature_contacts :boolean default(FALSE) +# feature_jobs :boolean default(FALSE) +# feature_library :boolean default(FALSE) +# feature_posts :boolean default(FALSE) +# has_sso :boolean default(FALSE) +# home_sentence :text +# host :string +# name :string +# privacy_policy :text +# registration_contact :string +# sass :text +# sso_button_label :string +# sso_cert :text +# sso_mapping :jsonb +# sso_name_identifier_format :string +# sso_provider :integer default("saml") +# sso_target_url :string +# terms :text +# created_at :datetime not null +# updated_at :datetime not null +# about_id :uuid indexed => [about_type] +# university_id :uuid not null, indexed # # Indexes # diff --git a/test/models/communication/extranet_test.rb b/test/models/communication/extranet_test.rb index 0fbfb1c43e253bdc46da936417e5b507126faf56..72be11939515c0927e5c3266698692eae000ee5a 100644 --- a/test/models/communication/extranet_test.rb +++ b/test/models/communication/extranet_test.rb @@ -2,35 +2,34 @@ # # Table name: communication_extranets # -# id :uuid not null, primary key -# about_type :string indexed => [about_id] -# allow_experiences_modification :boolean default(TRUE) -# color :string -# cookies_policy :text -# css :text -# feature_alumni :boolean default(FALSE) -# feature_contacts :boolean default(FALSE) -# feature_jobs :boolean default(FALSE) -# feature_library :boolean default(FALSE) -# feature_posts :boolean default(FALSE) -# has_sso :boolean default(FALSE) -# home_sentence :text -# host :string -# name :string -# privacy_policy :text -# registration_contact :string -# sass :text -# sso_button_label :string -# sso_cert :text -# sso_mapping :jsonb -# sso_name_identifier_format :string -# sso_provider :integer default("saml") -# sso_target_url :string -# terms :text -# created_at :datetime not null -# updated_at :datetime not null -# about_id :uuid indexed => [about_type] -# university_id :uuid not null, indexed +# id :uuid not null, primary key +# about_type :string indexed => [about_id] +# color :string +# cookies_policy :text +# css :text +# feature_alumni :boolean default(FALSE) +# feature_contacts :boolean default(FALSE) +# feature_jobs :boolean default(FALSE) +# feature_library :boolean default(FALSE) +# feature_posts :boolean default(FALSE) +# has_sso :boolean default(FALSE) +# home_sentence :text +# host :string +# name :string +# privacy_policy :text +# registration_contact :string +# sass :text +# sso_button_label :string +# sso_cert :text +# sso_mapping :jsonb +# sso_name_identifier_format :string +# sso_provider :integer default("saml") +# sso_target_url :string +# terms :text +# created_at :datetime not null +# updated_at :datetime not null +# about_id :uuid indexed => [about_type] +# university_id :uuid not null, indexed # # Indexes #