Giter VIP home page Giter VIP logo

catima's Introduction

CATIMA

Master: ci

Development: ci

Introduction

CATIMA is a Web app to create easily and quickly online catalogs of structured documents, by defining the data schema of the documents.

Each document is described by several data fields and represents a specific object. Many different types of objects can be created. The content of the document is used to make links between the different objects. CATIMA has also an integrated search option to search for different documents, as well as list views for each object type.

For some applications, CATIMA can be a replacement for databases such as FileMaker, but without offering many of the more advanced features. CATIMA is inteded to just work out of the box after defining the structure of the documents. CATIMA offers by purpose only relatively few personalization options. It still allows for creating custom content pages along with the catalog content.

Documentation

CATIMA is a Rails 7.1 app.

This README describes the purpose of this repository and how to set up a development environment. Other sources of documentation are as follows:

Getting started locally

Prerequisites

This project requires:

  • Ruby 3.2.2, preferably managed using rbenv
  • PostgreSQL 15 must be installed and accepting connections
  • Node 20.x (brew install nvm, ...)
  • Redis must be installed and running on localhost with the default port
  • Imagemagick must be installed (brew install imagemagick, sudo apt install imagemagick, ...)
  • Sodium must be installed (brew install libsodium, ...)
  • Chrome (for testing with Selenium)

bin/setup

Run the bin/setup script. This script will:

  • Check you have the required Ruby version
  • Install ruby gems using Bundler
  • Install js dependencies using Yarn
  • Create local copies of .env, database.yml, domains.yml and geo_layers.yml
  • Create, migrate, and seed the database

Run it!

  1. Install NPM packages using yarn install
  2. Install foreman with gem install foreman
  3. Run foreman start -f Procfile.dev to start the Rails app.

Getting started with docker

Prerequisites

A working Docker installation is mandatory.

Docker environment file

Please make sure to copy & rename the example.env file to .env.

cp docker/example.env docker/.env

You can replace the values if needed, but the default ones should work.

Edit hosts file

Edit hosts file to point catima.lan to your docker host.

Environment installation & configuration

Run the following docker command from the project root directory.

Build & run all the containers for this project.

docker-compose up (add -d if you want to run in the background and silence the logs)

Now you just have to wait for all containers to be created and ready to accept connections (Puma should be started and listening). The setup script will configure the application automatically.

Data for the redis, and postgres services are persisted using docker named volumes. You can see what volumes are currently present with:

docker volume ls

If you want to remove a volume (e.g. to start with a fresh database), you can use the following command.

docker volume rm volume_name

Frontend

To access the main application please use the following link.

http://catima.lan:8383

MailHog

To access mails please use the following link.

http://catima.lan:8028

Or to get the messages in JSON format.

http://catima.lan:8028/api/v2/messages

Tests & API specs

Local

  • To run the full suite, run rails test
  • To run a single test, specify the line with rails test path/to/file:line_number
  • To view the integration tests running in the browser prepend HEADLESS=0 to the commands above
  • To run API requests specs and generate API doc rails swag:run. The API doc is not versioned and should be added to the project during deployment

Docker

  • To run the full suite, run docker exec -it -e NO_COVERAGE=1 catima-app bin/rails test
  • To run a single test, specify the line with docker exec -it -e NO_COVERAGE=1 catima-app bin/rails test path/to/file:line_number
  • To run without coverage (improve performances), add -e NO_COVERAGE=1 to docker exec args
  • To view the integration tests running in the browser, add -e HEADLESS=0 to docker exec args, then connect to the VNC server vnc://catima.lan:5900 with "secret" as password. Or go to http://catima.lan:4444, click on Sessions, you should see a line corresponding to the running tests and a camera icon next to it, click on it to open a VNC viewer
  • To run API requests specs and generate API doc docker exec -it catima-app rails swag:run. The API doc is not versioned and should be added to the project during deployment

catima's People

Contributors

abstracts33d avatar christiankaiser avatar daviserez avatar dependabot-preview[bot] avatar dependabot[bot] avatar gcalmels avatar giachen avatar gwillmann avatar jurtn avatar lucaguindani avatar mattbrictson avatar oboiria avatar skyporter avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

catima's Issues

[Issue] Same "display name" setting, different output between two items

Description

Two item types with same "display name" setting (each are "item-abbr" + "item-name") have different outputs.

Both items types' fields are similar (ie text fields)-

Item type university (correct behavior) :

Setting

image

Output (correct):

image

Item type library (incorrect behavior) :

Setting

image

Output (incorrect)

image

TemplateEditor

Cannot add field variables in the item type template editor.

Uncaught TypeError: Cannot read property 'invoke' of undefined
at HTMLUListElement.click (TemplateEditor.jsx:89)
at HTMLUListElement.dispatch (Control.Layers.js:345)
at HTMLUListElement.elemData.handle (Control.js:164)

[Translation] New item's button translated incorrectly

In a catalog's data section, adding an item in French is translated incorrectly.

Current translation : "Nouveau type de fiche ".
New translation proposal : "Nouvelle fiche <item type name"" .

English version
image

French version (incorrect)
image

Better visual representation of category fields belonging to a choice set

Currently, category fields are treated the same as ordinary fields in the representation of an item. However, very often, category fields are linked to the choice set making the category fields visible. So there should be a visual link in the UI that the category fields belong together and that they are linked to the choice set.

Items cache worker

Sidekiq is returning a lot of errors related to the items cache worker.

NoMethodError: undefined method browse_similar_items_link for #<ItemView:0x007fccb1abef70>

Timestamp (CET) context server.host trace.exception.message trace.extra queue request.params.args request.params.class request.params.created_at request.params.enqueued_at request.params.failed_at request.params.jid request.params.queue request.params.retried_at request.params.retry request.params.retry_count server.pid
2018-10-30 09:55 ItemsCacheWorker catima undefined method `browse_similar_items_link' for #ItemView:0x007fcd09064f68 {} default ["catmanual2", "library", 5704] ItemsCacheWorker 1540454123.3827996 1540889762.9143982 1540454123.4425192 41187746d2a27c259bda7aa0 default 1540784424.904313 true 18 10277

and

NoMethodError: undefined method item_display_name for #<ItemView:0x007fcd0ed6bcc0> Did you mean? item_type_id

Timestamp (CET) context server.host trace.exception.message trace.extra queue request.params.args request.params.class request.params.created_at request.params.enqueued_at request.params.failed_at request.params.jid request.params.queue request.params.retried_at request.params.retry request.params.retry_count server.pid
2018-10-30 10:00 ItemsCacheWorker catima undefined method `item_display_name' for #ItemView:0x007fccdfc2da18Did you mean? item_type_id {} default ["catmanual2", "university"] ItemsCacheWorker 1540454753.2349875 1540890040.1863875 1540454753.628588 22db11f811422a9489b0326c default 1540784949.7473009 true 18 10277

Forms errors

Error not shown to the user on "reference" type fields (e.g. a required field not filled in).

Formatted Text validation missing visual feedback

Formatted text fields do not display feedback to the user when they do not validate (for instance if field is required but user kept it empty). This issue happens only with multi language FormattedText fields !

Advanced search on choice-set field returns all data

Issue

When a choice-set has been assigned a category (See "choice-set config"), an advanced search on the choice-set field with a selected value returns all existing data. This include data without a corresponding value, but also data with other values (see example)

Expected

An advanced search should return only corresponding results

Example

Item type example

https://catima.unil.ch/doctech/fr/admin/dossier

Choice-set config example

image

Category config:

image

Data:

image

Advanced search input:

image

Advanced search results:

image

Language selection not taken into account when changing link

Selecting a language via the dropdown menu in the "site" section applies language correctly when navigating the site (ie through item types).

However, only first link of data / setup keeps language parameter (for example ?locale=fr). Further browsing to other links (ie to other item type) looses this parameter. Adding for example ?locale=fr to URL fixes this translation problem.

[Data Edition] Data from "Reference field" not displayed after edition

Editing data can cause data display problem, if forementioned data is from a reference field.

Example below shows edition of a "Bibliothèque".

After saving changes, if the field "Université" has not been changed (normal case), it's data are not displayed either in DATA mode or in SITE mode, even though edited fields are taken into account.

Current solution consists in changing, the value to a temporary one and coming back to the previous (aka initial desired) value.

image

image

Delete choices sets

Currently, it is not possible to delete a choices set once created.

It would be great to be able to do it instead of only deactivate it. This would allow users to test different choices sets and then clean the choices sets page in Set Up to keep only the useful ones.

Categories' items displayed when not supposed to

Issue description

Categories' items are displayed when not supposed to (i.e. when choice-set config does not specify it).

NB : Mistakenly displayed items are displayed without their title.

Expected behaviour

Categories' items are supposed to be displayed only if choice-set config specifies it in the "Category" field.

Example

Below example shows a field which should be displayed only if category's choice-set is set to yes (see config below) and mistakenly displayed when choice-set is set to no.

Choice set = yes (correct behaviour)

image

Choice set = no (wrong behaviour)

image

Choice-set config

image

Advanced search on date field within a category

We have an issue with the advanced search on the "date" field type within a category (sous-fiche).

If we use the the "exact search" option we get the following error.

NoMethodError: undefined method `keys' for nil:NilClass (Most recent call first)
File /app/models/search/date_time_strategy.rb line 16 in search
File /app/models/search/choice_set_strategy.rb line 38 in search
File /app/models/item_list/advanced_search_result.rb line 115 in block in build_complex_fields_relations
File /app/models/item_list/advanced_search_result.rb line 110 in each
File /app/models/item_list/advanced_search_result.rb line 110 in build_complex_fields_relations
File /app/models/item_list/advanced_search_result.rb line 95 in block in build_items_strategies
File /app/models/item_list/advanced_search_result.rb line 81 in each
File /app/models/item_list/advanced_search_result.rb line 81 in build_items_strategies
File /app/models/item_list/advanced_search_result.rb line 57 in unpaginaged_items
File /app/models/item_list.rb line 41 in items
File /app/models/item_list.rb line 9 in total_count
File /app/views/advanced_searches/show.html.erb line 3 in block in _app_views_advanced_searches_show_html_erb___3704402415595658482_47352707121080
Show 4 non-project frames
File /app/views/advanced_searches/show.html.erb line 1 in _app_views_advanced_searches_show_html_erb___3704402415595658482_47352707121080

Thumb images not displayed

In setup mode, disabling "edition mode" ("Include this field in edition list view") for image fields prevents "thumb" images displays in "item lists" and search results" thumb" mode.

"Edition mode" enabled for image field
image ==>

image

"Edition mode" disabled for image field
image

Test URL : https://catima.unil.ch/catmanual2/fr/univ

Field names translation missing + field name clarification

When a new field has been added in an item type, types are not displayed according to the chosen interface language.

Moreoever, it might be interesting to clarify the field "champ géographique", and especially it's english equivalent "Geometry" as it might not seem very clear that it refers to a JSON input field.

image

Advanced search : set default logical operator to "OR" when adding new line

Current situation
In an advanced search, default behaviour of adding a new line of "reference" or "choice sets" fields, is an "AND" operator associated to the new line, resulting in too often default empty results list.

Suggestion
Setting default logical operator "OR" for new lines might avoid unsucessful searches for unexperimented users. Furthermore, "the AND" operator option should be completely removed for "reference" and "choice sets" new lines (no added value compared to "OR").

Navigation arrows do not always display correctly

Issue

The navigation arrows on the top right of an item do not always display correctly when the item is accessed from a list. It seems to randomly show 0, 1 or both navigation arrows.

image
Here, CASES - Cas: Sciences, Ethique et Société is not the last item of it's type. It is expected to be able to go to the item before and the one after but it is not possible.

  • This behaviour doesn't happen when navigating through the items with the arrows. CASES - Cas: Sciences, Ethique et Société will have both navigation arrows when accessed from the item before (or after).
  • I couldn't find any pattern about why an item would display 0, 1 or both arrows but it seems that a specific item is always going to display the same number of arrows.

Adding new choice in data "choice set" field deletes previously added choice(s)

Steps to reproduce problem :

  1. Choose an item type containing a "Choice Set "
  2. Select a choice from "choice set" or add a new one with (+) button
  3. Add another, different, choice to "choice set" with (+) button
  4. Any first added choice(s) has/have been deleted from field, but newly created choices are still in database

Reference field in a category

We have a bug with reference components when they are in a category (sous-fiche).

The components are not loading correctly and we get console errors. It's happening either way when creating or editing en item.

It could be related to the issue #113.

capture d ecran 2019-01-30 a 14 43 28
capture d ecran 2019-01-30 a 14 44 10

HTML editor : improve "add video" when adding HVA links

Current situation

Currently, using the "add a video" button of catima html editor (page edition) with an HVA* link does not work.

Example generated code (not working):
<p><video controls="" src="http://av.unil.ch/hva/1742/e-portfolio-720p_hd.mp4" class="note-video-clip" width="640" height="360"></video></p>

Result is : "No video with supported format and MIME type found" error"

image
*UNIL's video plateform "Html Video Automator"

Enhancement

HVA video integration works with a slight adaptation of generated code, by removing the http: part of the source URL.

Example working code :

<p><video controls="" src="//av.unil.ch/hva/1742/e-portfolio-720p_hd.mp4" class="note-video-clip" width="640" height="360"></video></p>

Result is : working video player
image

Admin dashboard: catalog links with rails default locale

Admin dashboard catalog links do not take the default catalog locale preference. For instance, a catalog with "french" as a language preference (with no other language supported) would be still linked as "en" from the admin dashboard. The catalog links seems to take the default rails locale and not the catalog default.

Rails.application.config.i18n.default_locale = :en

This will create issues when trying to work in the catalog admin interface if the user do not correct manually the locale in the url.

[Suggestion] Opening a new catalog redirects to list of users

After sys admin has created a new catalog, accessing the catalog for the first time (and until an item type has been created) redirects to the list of users (Menu "Users") which might be a bit confusing.

We suggest redirecting to another page, such as "Settings" (allowing to change catalog's name) or to a generic "Welcome to Catima" page.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.