Code Monkey home page Code Monkey logo

tota's People

Contributors

surfinzap avatar vit-svoboda avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

tota's Issues

Skip generating HTML in interpolated string, when element is empty

Example

Theatre plays have optional elements that won't be filled out in every instance. For example, in 'Jurko a Poklad' there is no 'Autor skladieb' (author_of_songs)
image

Problem

HTML template for the given component (TheatrePlayInfo) is written as interpolated string. I'm not sure what would be the best way to write conditionals for some of the elements so they are not shown at the front-end.

Related files

models/TheatrePlayInfo.js

Add a 'definition list' resolver in a Rich-text

Context

  • theatre plays (e.g. this one) have list of roles/actors, that vary from play to play in terms of length (number of items in definition list), definition terms (roles), definition data (actors)
  • this kind of list should be rendered in the following html:
<dl>
	<dt>Role 1</dt>
	<dd>Actor 1</dd>
	<dt>Role 2</dt>
	<dd>Actor 2</dd>
</dl>

Problem

Kentico Kontent does not have native structure for definition lists (

), so we need to find workarounds. I'm not sure what is possible to implement, so I'm presenting two workaround to consider.

Workaround 1 → Definition list as a table

Example response (Any by ste ne viryly)

Solution proposal

change the rendering of table into definition list

Pros/cons

  • 💚 table has a nice compact view within Kentico Kontent interface
  • ⛔ no easy reordering of terms within a table
  • ⛔ we'll lock out the use of tables in the future

Workaround 2 → Definition list as a component

Example response (Any by ste ne viryly)

###Structure
→ 'definition_list' is included as a component in a Rich-text
→→ 'definition_term' is included within the Rich-text element of 'definition_list'
→→→ 'definition_term' itself includes 'definition_term' and 'definition_data'

Solution proposal

Solution in this case is similar as in #2; with that difference, that we have to resolve Rich-text within Rich-text

Pros/cons

  • ⛔ definition list of 10 terms is 1000000 pixels long in Kentico Kontent
  • 💚 easy reordering of terms within a table
  • 💚 we can keep tables for other purpose in the future

Comment

Despite the fact it looks not very user-friendly within content, I'd lean more towards Workaround 2.

Add a rich text resolver for image in a Rich-text

Current state

Kontent JS SDK render an image with following code

<figure>
	<img>
</figure>

Desired state

Override a rendered output with a following template

<figure>
	<img>
	<figcation>
<figure>

Notes

  • image is placed as image in Rich-text
  • I've reached out to Richard Sustek on LinkedIn if that's possible. When I got the response, I'll update the issue
  • If it won't be possible, we'll probably workaroud it with a image as a component

Add a cookie consent message

Context

We need to inform a user, that some cookies are being stored. Simple message + link to privacy policy + button to dismiss cookies

Problem

This (and other packages) need to be executed at client, so they can store a cookie, that consent has been dismissed, so it isn't shown on the web indefinitely.
When you go through step-by-step guide to config the cookieconsent, you'll end up with an easy solution:
image

However, I don't know where to place the code in Nuxt app. Let me elaborate

Load script/style in the Head

<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/cookieconsent@3/build/cookieconsent.min.css" />

  • this is not an issue, since the package can be also installed (npm install cookieconsent --save)
  • or it can be placed as an external resource in config.nuxt.js

Place js config somewhere

The problem is where to place this:

<script src="https://cdn.jsdelivr.net/npm/cookieconsent@3/build/cookieconsent.min.js" data-cfasync="false"></script>
<script>
window.cookieconsent.initialise({
  "palette": {
    "popup": {
      "background": "#edeff5",
      "text": "#838391"
    },
    "button": {
      "background": "#4b81e8"
    }
  },
  "theme": "classic",
  "content": {
    "message": "TBD custom cookies msg to go here.",
    "href": "https://tota.sk/podmienky-pouzivania"
  }
});
</script>

The problem is that this should be executed at client, not at a server as the templates are usually executed in Nuxt. Here's a very slight hint on what can be done about it in Nuxt Docs

Add a rich text resolver for 'online_resellers_list' content type

This one can be a bit tricky, because components needs to be resolved at more levels.

How it looks at current website

https://tota.sk/projekt/any-by-ste-ne-viryly → take a look at 'Internetové obchody'

How it is modelled in Kentico Kontent

sample response via delivery sdk
Structure
→ 'online_reseller_list' is included as a component in a Rich-text
→→ 1–n 'online_reseller_of_item' is included as linked item in a 'online_reseller_list'
→→→ 1 'online_reseller' is included in 'online_reseller_of_item'

Todo

Write a resolver that would render the list of 1–n online resellers

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.