Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added subcomponents #477

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Added subcomponents #477

wants to merge 1 commit into from

Conversation

ghost
Copy link

@ghost ghost commented Apr 25, 2015

Hi there, i've extended the component code to allow for defining parts of the component template and then replacing them from within the master template akin to the Django's block/extend
Sample component template

    <div class="panel panel-default">
        <div class="panel-heading">
            <rv-bs-panel-heading>
                <h3 class="panel-title" rv-text="item.title"></h3>
            </rv-bs-panel-heading>
        </div>
        <div class="panel-body">
            <rv-bs-panel-content/>
        </div>
    </div>

Sample master template

    <rv-bs-panel rv-each-i="arr" item="i">
        <rv-bs-panel-content>
            <b rv-text="item.content.param1"></b>: <i rv-text="item.content.param2"></i>
        </rv-bs-panel-content>
    </rv-bs-panel>

    <rv-bs-panel rv-each-i="arr" item="i">
        <rv-bs-panel-heading>
            <h1 rv-text="item.title"></h1>
        </rv-bs-panel-heading>
        <rv-bs-panel-content>
            <b>{item.content.param1}</b> - <i>{item.content.param2}</i>
        </rv-bs-panel-content>
    </rv-bs-panel>

And sample data

{
  "arr": [
    {
      "title": "Test header",
      "content": {
        "param1": "one",
        "param2": "two"
      }
    }, {
      "title": "Testowy naglowek",
      "content": {
        "param1": "jeden",
        "param2": "dwa"
      }
    }
  ]
}

@stalniy
Copy link
Contributor

stalniy commented Jan 29, 2016

@sszelag in order to see this in lib you need to add tests. Also I suggest you to take a look at what I've described in #553

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants