From aaafe5902a1e10e60e02cdb2ff08f9f483c33c00 Mon Sep 17 00:00:00 2001 From: Simon Mayer <simon.mayer@onb.ac.at> Date: Thu, 17 Nov 2022 16:51:15 +0100 Subject: [PATCH] Fix bug for compound article panel, graphical changes, point to "local" solr core newseye_collection --- app/controllers/concerns/authentication.rb | 10 +++++----- app/javascript/packs/application.scss | 1 + .../packs/controllers/viewer_controller.js | 14 +++++++++----- app/javascript/packs/stylesheets/catalog.scss | 8 ++++++-- .../catalog/_compound_articles_panel.html.erb | 4 ++-- app/views/catalog/_query_filters.html.erb | 6 ++---- app/views/dataset/_datasets_list.html.erb | 4 ++-- config/solr.yml | 2 +- 8 files changed, 28 insertions(+), 21 deletions(-) diff --git a/app/controllers/concerns/authentication.rb b/app/controllers/concerns/authentication.rb index f6de47e..fe69131 100644 --- a/app/controllers/concerns/authentication.rb +++ b/app/controllers/concerns/authentication.rb @@ -11,9 +11,9 @@ module Authentication end def authenticate_user! - user_dict = { "labs_user_id" => decrypt_header(request.headers["X-Auth-Newseye-Token"])[0], - "labs_user_name" => decrypt_header(request.headers["X-Auth-Newseye-Token"])[1] } - # user_dict = { "labs_user_id" => "42", "labs_user_name" => "dummyuser" } + # user_dict = { "labs_user_id" => decrypt_header(request.headers["X-Auth-Newseye-Token"])[0], + # "labs_user_name" => decrypt_header(request.headers["X-Auth-Newseye-Token"])[1] } + user_dict = { "labs_user_id" => "42", "labs_user_name" => "dummyuser" } @user = User.find_by(labs_user_id: user_dict["labs_user_id"]) if @user if !session[:current_user_id] @@ -37,8 +37,8 @@ module Authentication private def current_user - Current.user ||= User.find_by(labs_user_id: decrypt_header(request.headers["X-Auth-Newseye-Token"])[0]) - # Current.user ||= User.find_by(labs_user_id: "42") + # Current.user ||= User.find_by(labs_user_id: decrypt_header(request.headers["X-Auth-Newseye-Token"])[0]) + Current.user ||= User.find_by(labs_user_id: "42") end def decrypt_header(token) diff --git a/app/javascript/packs/application.scss b/app/javascript/packs/application.scss index dc64c74..d3aad5f 100644 --- a/app/javascript/packs/application.scss +++ b/app/javascript/packs/application.scss @@ -13,6 +13,7 @@ $link-color: $labs-green; $link-hover-color: darken($labs-green, 10%) !default; $component-active-bg: $labs-green; $card-color: black; +$border-color: #69737e; $fa-font-path: '../../../node_modules/@fortawesome/fontawesome-free/webfonts'; diff --git a/app/javascript/packs/controllers/viewer_controller.js b/app/javascript/packs/controllers/viewer_controller.js index 598fe9b..f03cad1 100644 --- a/app/javascript/packs/controllers/viewer_controller.js +++ b/app/javascript/packs/controllers/viewer_controller.js @@ -18,10 +18,13 @@ export default class extends Controller { this.selectedArticlesValue = [] if (selectedCompoundParam != null) { const compoundParts = $(`#compound-articles-panel li[data-compound-id="${selectedCompoundParam}"]`).data('parts') - this.selectedCompound = {id: selectedCompoundParam, parts: compoundParts} + const compoundTitle = $(`#compound-articles-panel li[data-compound-id="${selectedCompoundParam}"]`).data('title') + this.selectedCompound = {id: selectedCompoundParam, parts: compoundParts, title: compoundTitle} $(`#compound-articles-panel li[data-compound-id="${selectedCompoundParam}"]`).addClass("active") + this.load_named_entities(this.selectedCompound.parts) + } else { + this.load_named_entities([this.issueIdValue]) } - this.load_named_entities([this.issueIdValue]) } else { this.selectedArticlesValue = [selectedParam] @@ -112,7 +115,7 @@ export default class extends Controller { }) // Compound article selection $("#compound_articles_list").on("click", "li", (event) => { - const elt = $(event.target) + const elt = $(event.currentTarget) if(elt.hasClass("active")) this.unselect_compound_article(elt.data('compoundId')) else @@ -123,7 +126,8 @@ export default class extends Controller { select_compound_article(compoundId) { const compoundParts = $(`#compound-articles-panel li[data-compound-id="${compoundId}"]`).data('parts') - this.selectedCompound = {id: compoundId, parts: compoundParts} + const compoundTitle = $(`#compound-articles-panel li[data-compound-id="${compoundId}"]`).data('title') + this.selectedCompound = {id: compoundId, parts: compoundParts, title: compoundTitle} $("#compound-articles-panel li").removeClass("active") $(`#compound-articles-panel li[data-compound-id="${compoundId}"]`).addClass("active") this.unselectArticles() @@ -264,7 +268,7 @@ export default class extends Controller { const art = this.articlesValue.filter(elt => elt.id == article_id)[0] return art.all_text.replaceAll("\"", "").replaceAll("\\n", "<br/>") }).join("\n") - $(this.selectedArticlePanelTarget).find('h5')[0].innerHTML = "" + $(this.selectedArticlePanelTarget).find('h5')[0].innerHTML = this.selectedCompound.title $(this.selectedArticlePanelTarget).find('p')[0].innerHTML = text } else { diff --git a/app/javascript/packs/stylesheets/catalog.scss b/app/javascript/packs/stylesheets/catalog.scss index 3097b02..1f8e54b 100644 --- a/app/javascript/packs/stylesheets/catalog.scss +++ b/app/javascript/packs/stylesheets/catalog.scss @@ -38,6 +38,10 @@ color: hsl(180, 15%, 30%); } +.accordion-button:not(.collapsed)::after { + background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23212529'%3e%3cpath fill-rule='evenodd' d='M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708z'/%3e%3c/svg%3e"); +} + li.selected_constraint { color: darken(hsl(180, 15%, 30%), 10%); } @@ -179,7 +183,7 @@ li.selected_constraint { ////////////////////// Index Datasets //////////////////// .dataset-item:hover { - background-color: #dfdfdf; + background-color: #EEE; } //////////////////////////////////////////////////////// @@ -188,7 +192,7 @@ li.selected_constraint { padding: 0.5em; } .dataset_document:hover { - background-color: #dfdfdf; + background-color: #EEE; } .dataset_document.selected { border: 2px solid darken(hsl(180, 15%, 30%), 10%); diff --git a/app/views/catalog/_compound_articles_panel.html.erb b/app/views/catalog/_compound_articles_panel.html.erb index dcc4393..ffbceab 100644 --- a/app/views/catalog/_compound_articles_panel.html.erb +++ b/app/views/catalog/_compound_articles_panel.html.erb @@ -7,9 +7,9 @@ <div class="p-0 card-body d-flex align-items-center justify-content-center flex-column"> <ul class="list-group w-100"> <% compound_articles.each do |compound_article| %> - <li class="list-group-item cmpnd-article" data-compound-id="<%= compound_article.id %>" data-parts="<%= compound_article.parts.to_json %>"> + <li class="list-group-item cmpnd-article" data-compound-id="<%= compound_article.id %>" data-parts="<%= compound_article.parts.to_json %>" data-title="<%= compound_article.title %>"> <div class="text_part d-inline"><%= compound_article.title %></div> - <a class="delete_compound_article text-danger float-end" href="#"><span class="fas fa-times"></span></a> + <a class="delete_compound_article text-danger float-end" href="#"><span class="fas fa-trash"></span></a> </li> <% end %> </ul> diff --git a/app/views/catalog/_query_filters.html.erb b/app/views/catalog/_query_filters.html.erb index 4001f25..7d40cd7 100644 --- a/app/views/catalog/_query_filters.html.erb +++ b/app/views/catalog/_query_filters.html.erb @@ -5,7 +5,7 @@ <% search_constraints.each do |constraint| %> <% field = t('newspapers.solr_fields').find { |key,value| value == constraint[:label] }[0].to_s %> <% next if field == "doc_type" %> - <span class="btn-group"> + <span class="btn-group btn-group-sm"> <button class="btn btn-sm btn-outline-primary" disabled> <span class="filter_name"> <%= t("newspapers.human_readable_solr_fields." + field) %> @@ -39,9 +39,7 @@ <% else %> <% new_params[:f][constraint[:label].to_sym].delete(constraint[:value]) %> <% end %> - <a class="btn btn-sm btn-outline-primary" href="<%= url_for new_params %>"> - <i class="fas fa-times"></i> - </a> + <a class="btn btn-sm btn-outline-primary" href="<%= url_for new_params %>"><span class="fas fa-times"></span></a> </span> <% end %> </div> diff --git a/app/views/dataset/_datasets_list.html.erb b/app/views/dataset/_datasets_list.html.erb index 885e6da..8e82b00 100644 --- a/app/views/dataset/_datasets_list.html.erb +++ b/app/views/dataset/_datasets_list.html.erb @@ -16,13 +16,13 @@ </div> <div class="d-inline-flex"> <button type="button" - class="btn btn-sm btn-danger px-2 d-flex align-items-center justify-content-between me-2" + class="btn btn-sm btn-danger text-white px-2 d-flex align-items-center justify-content-between me-2" data-action="click->datasets#deleteDataset"> <i class="me-2 fas fa-trash"></i>Delete </button> <button type="button" data-bs-toggle="modal" data-bs-target="#renameDatasetModal" data-bs-dataset-id="<%= dataset.id %>" - class="btn btn-sm btn-info px-2 d-flex align-items-center justify-content-between"> + class="btn btn-sm btn-info text-white px-2 d-flex align-items-center justify-content-between"> <i class="me-2 fas fa-edit"></i>Rename </button> </div> diff --git a/config/solr.yml b/config/solr.yml index 7f48fec..5018dac 100644 --- a/config/solr.yml +++ b/config/solr.yml @@ -1,6 +1,6 @@ development: # url: http://localhost:8991/solr/hydra-development - url: http://fue-l9.onb.ac.at:8983/solr/newseye_onb + url: http://fue-l9.onb.ac.at:8983/solr/newseye_collection test: url: http://localhost:8991/solr/hydra-development -- GitLab