As for the views, I think clever_table/lib/clever_table/clever_table.rb, in
#initialize at L:12 is setting the view path to the root app/views and not
including the engine app/views . Try replacing

@view          = ActionView::Base.new('app/views', {},
> @options[:controller])


with

@view          =
> ActionView::Base.new(['app/views'].concat(::CleverTable::Engine.paths['app/views'].existent),
> {}, @options[:controller])


I have a local version that renders the views with a few minor additional
changes but the above change seems to be the important one.

For assets, change javascripts/clever_table/application.js and
stylesheets/clever_table/application.css to use

require ./clever_table


instead of

require clever_table


I had to separately include jQuery and I see JS errors, but none of the
Rails source view/asset variety. I didn't bother running tests after making
the above changes.

Cheers,

Alan

On Wed, Apr 20, 2016 at 9:27 PM, Guyren Howe <[email protected]> wrote:

> I have created a gem, my very first one.
>
> You do this:
>
> @users = UsersView.all
>
> @table = CleverTable::CleverTable.new(@users,
>                          params,
>                          'Firstname' => :first_name,
>                          'Last Name' => :last_name,
>                          'Email'     => :email,
>                          'State'     => :state,
>                          'City'      => :city,
>                          'Role'      => :role,
>                          'Status'    => :status,
>
>                          :per_page   => 50,
>                          :unique     => :id,
>                          :row_link   => ->(x) { user_path(x) },
>                          :controller => self)
>
> and then this:
>
> <div class="panel panel-default">
>   <div class="panel-body">
>     <div class="row">
>       <div class="col-md-12 col-md-offset-1">
>         <%= @table.pagination %>
>       </div>
>     </div>
>     <div class="row">
>       <div class="col-md-10 col-md-offset-1">
>         <%= @table.render %>
>       </div>
>       <div class="row">
>         <div class="col-md-12 col-md-offset-1">
>           <%= @table.pagination %>
>         </div>
>       </div>
>     </div>
>   </div>
> </div>
>
> and you get this great sortable, searchable, paginated view of your data.
> Trust me, it's sweet.
>
> But you're going to have to trust me, because it doesn't work. The reason
> is that the gem's assets are not being included in the application. I can't
> get them to load in the gem's tests, and I can't get them to load in an
> application where I want to use it.
>
> Anyway, it's at:
>
> https://github.com/AirspaceTechnologies/clever_table
>
> I'm sure it's some simple declaration somewhere, but I've spent *way* too
> many hours googling and looking at other gems, and I can't see what I'm
> doing wrong.
>
> --
> --
> SD Ruby mailing list
> [email protected]
> http://groups.google.com/group/sdruby
> ---
> You received this message because you are subscribed to the Google Groups
> "SD Ruby" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.
>

-- 
-- 
SD Ruby mailing list
[email protected]
http://groups.google.com/group/sdruby
--- 
You received this message because you are subscribed to the Google Groups "SD 
Ruby" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to