Code Monkey home page Code Monkey logo

Comments (6)

calumgunn avatar calumgunn commented on September 13, 2024

Hi @darcemac!

That sounds strange - if you've followed the instructions at https://github.com/withassociates/slices/wiki/Creating-Slices all should be well - note that you need to restart your Rails server after creating a new Slice for it to show up!

Do you have some code from your problem Slices that you could share?

from slices.

darcemac avatar darcemac commented on September 13, 2024

Hey @calumgunn!

Thanks for the response, I appreciate it! I'm new to rails having mostly developed in php/wordpress and a couple of sites in jekyll so I made a rookie mistake of not thinking about the server restart, thanks for pointing that out. I'm able to add slices to the 'containers' easy now, its a great system, much easier than my experience with WP plugin Advanced Custom Fields.

I have another question sorry, I've added a slice called 'Images' using an example I found here - https://github.com/thomasmarshall/example-slices but I cant get the images to appear in the page default page view, results in empty

  • elements. Do I have to setup the asset path?

    Thanks for your help.

  • from slices.

    jgwhite avatar jgwhite commented on September 13, 2024

    Hi @darcemac

    Could you post a snippet of your template?

    from slices.

    darcemac avatar darcemac commented on September 13, 2024

    Hi @jgwhite,

    Ok here is the main layout and the image slice view, template etc. I haven't modified them.

    default.html.rb
    <body class="layout-default">
        <section id="main" role="main">
          <%= container "content" %>
        </section>
    </body>
    
    images_slice.rb
    class ImagesSlice < Slice
      include Slices::HasAttachments
      class Image < Attachment
        field :link, type: String
        field :caption, type: String
      end
      has_attachments :images, class_name: 'ImagesSlice::Image'
    end
    
    images.hbs
    <li>
      {{#attachmentComposer field="images"}}
        <textarea name="caption" placeholder="Caption…" rows="8">{{caption}}</textarea>
        <!--<input type="text" name="link" placeholder="Link…" value="{{link}}">-->
      {{/attachmentComposer}}
    </li>
    
    show.html.erb
    <div class="slice images-slice">
      <ul class="images">
        <% slice.images.each do |image| %>
          <li>
            <%= link_image_if_linkable image.link, image.asset, :original %>
            <div class="image-caption"><%= markdown image.caption %></div>
          </li>
        <% end %>
      </ul>
    </div>
    
    Admin home page with images uploaded

    screenshot_59_2015-10-21

    I basically want to use an Open Source Rails CMS with functionality to have multiple custom fields for content and multiple images, blog etc. I really like the way in Slices provides this but it may be a bit beyond me at this point in my Rails journey :)

    I appreciate your help!

    from slices.

    jgwhite avatar jgwhite commented on September 13, 2024

    Hmm… the code all looks correct. Might be best to do a screen share. We have some slots available here: http://pair.withassociates.com

    We can arrange a time that works best for you if none of those suit.

    from slices.

    darcemac avatar darcemac commented on September 13, 2024

    Hi @jgwhite,

    I really don't want to waste your time any further as I'm just having a play to assess another CMS option and I imagine you guys are under the pump doing work.

    It might be that I've installed it wrong... though I followed the README.md on https://github.com/withassociates/slices.

    If you had an example of a base Slices CMS project with images, posts etc. that I could download, I can have at look how its setup...

    Thanks again.

    from slices.

    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.