Git Product home page Git Product logo

Comments (21)

apotonick avatar apotonick commented on August 16, 2024

Hi Steve,

what's your cell's class name (full constant path, please)? Maybe paste the entire cell class file here, along with where it's stored.

from cells.

sath01 avatar sath01 commented on August 16, 2024

Hey Nick - thanks for the quick response.

Cell is:

module User::Cell
  class Index < Trailblazer::Cell
    def no_items
      return "No Users" if model.size == 0
    end
  end
end

And lives in: app/concepts/user/cell/index.rb
Hope that's what you wanted to know.

from cells.

apotonick avatar apotonick commented on August 16, 2024

Yepp, looks correct, and now, show me how you invoke that cell.

from cells.

sath01 avatar sath01 commented on August 16, 2024

From the UsersController ...

def index
    run User::Index
    render cell(User::Cell::Index, result["model"]), layout: false
end

I have tried different layout options as well.

result["model"] is ...

#<ActiveRecord::Relation [#<User id: 1, email: "[email protected]", other_attributes_here>]>

There is only one user at the moment.

from cells.

apotonick avatar apotonick commented on August 16, 2024

So where does the view template name come from? 🤔 Because User::Cell::Index, being a TRB::Cell, will try to render app/concepts/user/view/index.haml per default.

It must be a problem in that view, can you paste it?

from cells.

sath01 avatar sath01 commented on August 16, 2024

Yep, view template is in: app/concepts/user/view/index.haml
and is standard haml ...

- @title = "Listing Users"

- content_for :description do
  %p Users registered on this site.

- content_for :actions do
  = action_page_header new_user_path, 'Add User', 'plus'

.row
  .col-xs-12.col-sm-12.col-md-12.col-lg-12
    .sheet.sheet-condensed
      .sheet-inner
        %table.table
          %thead
            %tr
              %th Email
              %th
          %tbody
            etc ...

from cells.

apotonick avatar apotonick commented on August 16, 2024

Ok, so first of all, setting @instance variables is a no-go. That's just so wrong. Second, content_for is not supported in Cells, because it breaks with the idea of encapsulation.

What happens when you just say "hello!" in that template?

from cells.

sath01 avatar sath01 commented on August 16, 2024

Fair enough.

Changed index.haml to:

- %h1 Hello World

Same error.

from cells.

apotonick avatar apotonick commented on August 16, 2024

Correct me if I'm wrong, but is - %h1 ... valid HAML?

from cells.

sath01 avatar sath01 commented on August 16, 2024

Oops. Your quite right - slip of the keyboard.
Changed the template to ...

%h1 Hello World

Same issue.

from cells.

sath01 avatar sath01 commented on August 16, 2024

As I said, I also cloned your own sample app, bundled with a fresh install and got the same error, with your templates. Seems to be more than the haml template structure or location?

Just not sure why I'm the only one getting it.

from cells.

apotonick avatar apotonick commented on August 16, 2024

Hi! Which app did you clone?

from cells.

sath01 avatar sath01 commented on August 16, 2024

from cells.

sath01 avatar sath01 commented on August 16, 2024

Hey Nick. Any thoughts for me on this error. I'd love to use cells, but I guess I can just use normal rails renderer.

from cells.

apotonick avatar apotonick commented on August 16, 2024

The example app works for me, just checked. Is it maybe that the example app is using Slim while you're trying to use Haml? Have you tried with .slim?

from cells.

sath01 avatar sath01 commented on August 16, 2024

from cells.

apotonick avatar apotonick commented on August 16, 2024

If you want to use Haml, remove cells-slim from the Gemfile and replace with cells-haml (http://trailblazer.to/gems/cells/api.html#template-formats). Don't worry, we'll get you on da cells.

from cells.

sath01 avatar sath01 commented on August 16, 2024

Yep, have done that. As per previous comment ...

Here is my gem setup ...
rails (5.1.4)
cells (4.1.7)
cells-haml (0.0.10)
cells-rails (0.0.6)
reform-rails (0.1.7)
trailblazer-rails (1.0.4)
haml-rails (1.0.0)

I might try slim and hamlit as well - see if they make a difference. I'll let you know.

from cells.

sath01 avatar sath01 commented on August 16, 2024

from cells.

apotonick avatar apotonick commented on August 16, 2024

🤘

from cells.

Bahanix avatar Bahanix commented on August 16, 2024

Hi people! I encountered the same issue with Cells (Template missing: view: * prefixes: *) and my search engine brought me there. I just had to rm -rf tmp/cache/ to fix the issue. Have a nice day!

from cells.

Related Issues (20)

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.