How to add class to html element with Deface?

Erwin Rooijakkers

I have not worked yet with the Deface gem and have read Spree tutorial on Deface and skipped through the Spree/Deface explanation on Github.I cannot get the following issue working though:

In my Spree stable-2-1 with Rails 4 I have this element <li id="locale-select" data-hook="" style="float: right; margin-right: 10px;"> which is generated by the I18N gem and is available in the _main_nav_bar.html.erb on every page.

I want to add to this <li> element a class="dropdown-menu" element. The data-hook is empty. I have no idea how to accomplish this with Deface and am wondering if it is even possible.

I hope someone here can provide me more information on Deface and explain how to accomplish this task. (Maybe I am following the wrong path and should just find the element in the I18N and override it.)

Dimiter Shalvardjiev

Faced with the same problem, I read through https://github.com/spree/deface, and it appears once you select the proper element, you may use the :add_to_attributes action to insert HTML attributes.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

How to add CSS class dynamically to html element

From Dev

OM how to add class to html element

From Dev

How to add html class to above element

From Dev

How to add a logo to the header using deface

From Dev

How to add CSS class to the HTML5 picture element

From Dev

How to add class to html element in django-bootstrap3 template

From Dev

How to add HTML class based on the contents of another element?

From Dev

How to add a class to an element with CSS

From Java

How to add "class" to host element?

From Dev

How to add a class to a given element?

From Dev

How to add a class to element if another element is empty?

From Dev

Add a calculated class to an HTML element in angular

From Dev

how to add to an HTML time element

From Dev

How to add a class to html tag?

From Dev

How to add a class to an element when another element gets a class in angular?

From Dev

How to add class to the third <li> element in javascript

From Dev

How to add a class to parent element when there are several

From Dev

How to add the `active` class on click of `li` element

From Java

How do I add a class to a given element?

From Dev

how to add class to element from its id?

From Dev

JQUERY How to add class with text inside element

From Dev

How to add an element to a null Set<class>?

From Dev

How to add | remove css class in angular element?

From Dev

How to add a "modified" class for an element in SCSS

From Dev

How add a class to a label element with Symfony forms?

From Dev

How to add Html element to dynamic list in jquery

From Dev

How to add attribute to HTML element using javascript

From Dev

How to add Html element to dynamic list in jquery

From Dev

How to add an element on top of an image in HTML?

Related Related

  1. 1

    How to add CSS class dynamically to html element

  2. 2

    OM how to add class to html element

  3. 3

    How to add html class to above element

  4. 4

    How to add a logo to the header using deface

  5. 5

    How to add CSS class to the HTML5 picture element

  6. 6

    How to add class to html element in django-bootstrap3 template

  7. 7

    How to add HTML class based on the contents of another element?

  8. 8

    How to add a class to an element with CSS

  9. 9

    How to add "class" to host element?

  10. 10

    How to add a class to a given element?

  11. 11

    How to add a class to element if another element is empty?

  12. 12

    Add a calculated class to an HTML element in angular

  13. 13

    how to add to an HTML time element

  14. 14

    How to add a class to html tag?

  15. 15

    How to add a class to an element when another element gets a class in angular?

  16. 16

    How to add class to the third <li> element in javascript

  17. 17

    How to add a class to parent element when there are several

  18. 18

    How to add the `active` class on click of `li` element

  19. 19

    How do I add a class to a given element?

  20. 20

    how to add class to element from its id?

  21. 21

    JQUERY How to add class with text inside element

  22. 22

    How to add an element to a null Set<class>?

  23. 23

    How to add | remove css class in angular element?

  24. 24

    How to add a "modified" class for an element in SCSS

  25. 25

    How add a class to a label element with Symfony forms?

  26. 26

    How to add Html element to dynamic list in jquery

  27. 27

    How to add attribute to HTML element using javascript

  28. 28

    How to add Html element to dynamic list in jquery

  29. 29

    How to add an element on top of an image in HTML?

HotTag

Archive