Skip to content

Instantly share code, notes, and snippets.

@amigrave
Last active August 3, 2019 10:48
Show Gist options
  • Select an option

  • Save amigrave/0cfb622d08cc401adbb8 to your computer and use it in GitHub Desktop.

Select an option

Save amigrave/0cfb622d08cc401adbb8 to your computer and use it in GitHub Desktop.

Revisions

  1. amigrave revised this gist Oct 16, 2014. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions snippet_showcase.md
    Original file line number Diff line number Diff line change
    @@ -49,10 +49,10 @@ Here's an example of how you would change the title of a snippet, the image sour

    <ts ts-jquery="div.o_block_banner_snip" ts-operation="append">
    <div>
    My additional ...
    Additional
    <!-- Of course you can call a snippet from anoter snippet -->
    <ts ts-call="Separator"/>
    ... content
    Content
    </div>
    </ts>
    </ts>
  2. amigrave revised this gist Oct 16, 2014. 1 changed file with 6 additions and 1 deletion.
    7 changes: 6 additions & 1 deletion snippet_showcase.md
    Original file line number Diff line number Diff line change
    @@ -48,7 +48,12 @@ Here's an example of how you would change the title of a snippet, the image sour
    <ts ts-jquery="h3" ts-operation="replace"/>

    <ts ts-jquery="div.o_block_banner_snip" ts-operation="append">
    <div>My additional content</div>
    <div>
    My additional ...
    <!-- Of course you can call a snippet from anoter snippet -->
    <ts ts-call="Separator"/>
    ... content
    </div>
    </ts>
    </ts>

  3. amigrave revised this gist Oct 16, 2014. 1 changed file with 4 additions and 1 deletion.
    5 changes: 4 additions & 1 deletion snippet_showcase.md
    Original file line number Diff line number Diff line change
    @@ -39,10 +39,13 @@ Here's an example of how you would change the title of a snippet, the image sour
    <ts ts-jquery="h1" ts-operation="inner">
    My brand new title
    </ts>

    <ts ts-jquery="img:first" ts-operation="attributes">
    <attribute name="src">/img/test.png</attribute>
    </ts>
    <ts ts-jquery="h3" ts-operation="replace"/> <!-- here we replace by anything, so it's removed -->

    <!-- here we replace by anything, it's how you remove a node -->
    <ts ts-jquery="h3" ts-operation="replace"/>

    <ts ts-jquery="div.o_block_banner_snip" ts-operation="append">
    <div>My additional content</div>
  4. amigrave revised this gist Oct 16, 2014. 1 changed file with 3 additions and 1 deletion.
    4 changes: 3 additions & 1 deletion snippet_showcase.md
    Original file line number Diff line number Diff line change
    @@ -31,7 +31,7 @@ In order to properly showcase your snippets, you most probably want to make some

    This can be achieved using the `ts-extend` directive of QWeb.js.

    Here's an example of how you would change the title of a snippet, the image source and add a div with additional content:
    Here's an example of how you would change the title of a snippet, the image source remove the `<h3>` and add a div with additional content:

    ```xml
    <div id="js_snippets_showcase">
    @@ -42,6 +42,8 @@ Here's an example of how you would change the title of a snippet, the image sour
    <ts ts-jquery="img:first" ts-operation="attributes">
    <attribute name="src">/img/test.png</attribute>
    </ts>
    <ts ts-jquery="h3" ts-operation="replace"/> <!-- here we replace by anything, so it's removed -->

    <ts ts-jquery="div.o_block_banner_snip" ts-operation="append">
    <div>My additional content</div>
    </ts>
  5. amigrave revised this gist Oct 16, 2014. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions snippet_showcase.md
    Original file line number Diff line number Diff line change
    @@ -28,7 +28,9 @@ It means that you can call them like you would do with any other template, eg:
    The previous template would render the `Banner` and `Big Message` templates.

    In order to properly showcase your snippets, you most probably want to make some customization to them.

    This can be achieved using the `ts-extend` directive of QWeb.js.

    Here's an example of how you would change the title of a snippet, the image source and add a div with additional content:

    ```xml
  6. amigrave revised this gist Oct 16, 2014. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion snippet_showcase.md
    Original file line number Diff line number Diff line change
    @@ -28,7 +28,7 @@ It means that you can call them like you would do with any other template, eg:
    The previous template would render the `Banner` and `Big Message` templates.

    In order to properly showcase your snippets, you most probably want to make some customization to them.

    This can be achieved using the `ts-extend` directive of QWeb.js.
    Here's an example of how you would change the title of a snippet, the image source and add a div with additional content:

    ```xml
  7. amigrave revised this gist Oct 16, 2014. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion snippet_showcase.md
    Original file line number Diff line number Diff line change
    @@ -29,7 +29,7 @@ The previous template would render the `Banner` and `Big Message` templates.

    In order to properly showcase your snippets, you most probably want to make some customization to them.

    Here's an example of how you would change the title of a snippet, change the image source and add a div with additional content:
    Here's an example of how you would change the title of a snippet, the image source and add a div with additional content:

    ```xml
    <div id="js_snippets_showcase">
  8. amigrave revised this gist Oct 16, 2014. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions snippet_showcase.md
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,5 @@
    A snippets showcase can be added to any page of your theme but it's intended to be used in the *demo* pages.

    In order to make a snippet showcase, you need a div with the class `js_snippets_showcase`.
    The content of this div will be parsed as a QWeb (client side) document using the prefix `ts`.
    Once parsed, the snippet showcase widget will render the template named `main`.
  9. amigrave revised this gist Oct 16, 2014. 1 changed file with 4 additions and 4 deletions.
    8 changes: 4 additions & 4 deletions snippet_showcase.md
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,5 @@
    In order to make a snippet showcase, you need a div with the class `js_snippets_showcase`.
    The content of this div will be parsed as a QWeb document using the prefix `ts`.
    The content of this div will be parsed as a QWeb (client side) document using the prefix `ts`.
    Once parsed, the snippet showcase widget will render the template named `main`.

    Eg:
    @@ -11,7 +11,7 @@ Eg:
    </div>
    ```

    In the snippets showcase mode, all the snippets are loaded through javascript and transformed to qweb templates.
    In the snippets showcase mode, all the snippets are loaded through javascript and transformed into qweb templates.
    It means that you can call them like you would do with any other template, eg:

    ```xml
    @@ -27,7 +27,7 @@ The previous template would render the `Banner` and `Big Message` templates.

    In order to properly showcase your snippets, you most probably want to make some customization to them.

    Here's an example of how you would change the title of a snippet, change the image and add a div with content:
    Here's an example of how you would change the title of a snippet, change the image source and add a div with additional content:

    ```xml
    <div id="js_snippets_showcase">
    @@ -52,4 +52,4 @@ Here's an example of how you would change the title of a snippet, change the ima
    Here are the different values for the `ts-operation` directive:
    `append`, `prepend`, `before`, `after`, `replace`, `inner`, `attributes`

    **NOTE:** This snippet showcase mode is only meant to make demo page for the themes and shoult NOT be used for production pages
    **NOTE:** This snippet showcase mode is only meant to make demo pages for the themes and should NOT be used for production pages.
  10. amigrave revised this gist Oct 16, 2014. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion snippet_showcase.md
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    In order to make a snippet showcase, you need a div the with class `js_snippets_showcase`.
    In order to make a snippet showcase, you need a div with the class `js_snippets_showcase`.
    The content of this div will be parsed as a QWeb document using the prefix `ts`.
    Once parsed, the snippet showcase widget will render the template named `main`.

  11. amigrave revised this gist Oct 16, 2014. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion snippet_showcase.md
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    In order to make a snippet showcase, you need a div with class `js_snippets_showcase`.
    In order to make a snippet showcase, you need a div the with class `js_snippets_showcase`.
    The content of this div will be parsed as a QWeb document using the prefix `ts`.
    Once parsed, the snippet showcase widget will render the template named `main`.

  12. amigrave revised this gist Oct 16, 2014. 1 changed file with 41 additions and 7 deletions.
    48 changes: 41 additions & 7 deletions snippet_showcase.md
    Original file line number Diff line number Diff line change
    @@ -1,21 +1,55 @@
    Test
    In order to make a snippet showcase, you need a div with class `js_snippets_showcase`.
    The content of this div will be parsed as a QWeb document using the prefix `ts`.
    Once parsed, the snippet showcase widget will render the template named `main`.

    Eg:
    ```xml
    <div id="js_snippets_showcase">
    <ts ts-name="main">
    Hello <b>world</b> !
    </ts>
    </div>
    ```

    In the snippets showcase mode, all the snippets are loaded through javascript and transformed to qweb templates.
    It means that you can call them like you would do with any other template, eg:

    ```xml
    <div id="js_snippets_showcase">
    <ts ts-name="main">
    <ts ts-call="Banner"/>
    <ts ts-call="Big Message"/>
    </ts>
    </div>
    ```

    The previous template would render the `Banner` and `Big Message` templates.

    In order to properly showcase your snippets, you most probably want to make some customization to them.

    Here's an example of how you would change the title of a snippet, change the image and add a div with content:

    ```xml
    <div id="js_snippets_showcase">
    <ts ts-extend="Banner">
    <ts ts-jquery="h1" ts-operation="inner">Example of snippet customisation.</ts>
    <ts ts-jquery="h4" ts-operation="inner">For the theme showcases.</ts>
    <ts ts-jquery="h1" ts-operation="inner">
    My brand new title
    </ts>
    <ts ts-jquery="img:first" ts-operation="attributes">
    <attribute name="src">/img/test.png</attribute>
    </ts>
    <ts ts-jquery="div.o_block_banner_snip" ts-operation="append">
    <div>My additional content</div>
    </ts>
    </ts>

    <ts ts-name="main">
    <ts ts-call="Banner"/>
    <ts ts-call="Big Message"/>
    <ts ts-call="Text Block"/>
    <ts ts-call="Features"/>
    </ts>
    </div>
    ```

    Here are the different values for the `ts-operation` directive:
    `append`, `prepend`, `before`, `after`, `replace`, `inner`, `attributes`
    ```

    **NOTE:** This snippet showcase mode is only meant to make demo page for the themes and shoult NOT be used for production pages
  13. amigrave renamed this gist Oct 16, 2014. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  14. amigrave revised this gist Oct 16, 2014. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions snippet_showcase
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,6 @@
    Test


    ```xml
    <div id="js_snippets_showcase">
    <ts ts-extend="Banner">
  15. amigrave revised this gist Oct 16, 2014. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions snippet_showcase
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,5 @@
    Test

    ```xml
    <div id="js_snippets_showcase">
    <ts ts-extend="Banner">
  16. amigrave created this gist Oct 16, 2014.
    18 changes: 18 additions & 0 deletions snippet_showcase
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,18 @@
    ```xml
    <div id="js_snippets_showcase">
    <ts ts-extend="Banner">
    <ts ts-jquery="h1" ts-operation="inner">Example of snippet customisation.</ts>
    <ts ts-jquery="h4" ts-operation="inner">For the theme showcases.</ts>
    </ts>

    <ts ts-name="main">
    <ts ts-call="Banner"/>
    <ts ts-call="Big Message"/>
    <ts ts-call="Text Block"/>
    <ts ts-call="Features"/>
    </ts>
    </div>
    ```
    Here are the different values for the `ts-operation` directive:
    `append`, `prepend`, `before`, `after`, `replace`, `inner`, `attributes`
    ```