Coder Social home page Coder Social logo

slices's People

Contributors

bensymonds avatar calumgunn avatar erino avatar gma avatar jgwhite avatar jsphm avatar thomasmarshall avatar timharding avatar withops avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

slices's Issues

Create generator script

  • Create project rails _3.2.16_ new project
  • cd project
  • Add gem 'slices' to Gemfile
  • Run bundle install
  • Run rails g slices:install
    • This command will create app/slices with a .gitkeep
    • Ask if you require a mongoid.yml
    • Creates a Slices initializer
    • Creates application layout without shared/head
    • Creates Procfile so we can run Foreman
    • Say 'all done!'
    • Advise on other commands like rake slices:seed and To create a slice, run...

Defaults handlebars helper

I'm proposing a defaults handlebars helper. This could be used in slice templates, page main/meta templates and inside composers etc. Perhaps not a perfect solution – defaults should be defined in the model? – but this works at least. Would be especially useful for select fields which might look selected by default, but aren't.

{{defaults title="Hello world" text="Lorem ipsum dolor sit amet"}}

<input type="text" id="slices-{{id}}-title" placeholder="Title…" value="{{title}}">
<textarea id="slices-{{id}}-text" placeholder="Text…">{{text}}</textarea>
Handlebars.registerHelper('defaults', function(options) {
  _.defaults(this, options.hash);
});

Can't currently host Slices for free on Heroku

Two things on this:

a) The guides are now incorrect, as MongoHQ is no more - MongoLab has taken its place.
b) The Mongo gem is not of a recent enough version to host on MongoLab's free tier (which uses MongoDB 3.0.7) - we'd need to use >= 2.0 to regain that. On paid tiers, you can choose an older version of MongoDB, but I feel there's worth in having a free option!

Link to next and previous page from current page

Please can you advise on how to link to the next or previous page from your current page?

I can use will_paginate for navigation on the set of pages, but I'd like to navigate to the siblings of individual pages.

Apologies for two (not real) issues in a week; outside of the Wiki I'm making quite slow progress. (Inside the Wiki Slices is a dream!)

[RFC] Replace wiki with in-repo guides

Summary

Move the documentation from the wiki to a new directory in the project called doc or guides. Do some spring cleaning in the process.

Motivation

Documentation generated from inline comments is great but there is still value in a set of “guides” organised in a cookbook style. This is the purpose the wiki currently serves. Unfortunately, the wiki has gone untended and has fallen out of sync. In part, this is because the wiki is independent of the codebase and easily ignored. Moving the documentation from the wiki into the repo will help us version the two in lockstep.

Detailed Design

We create a new directory in the project called doc or guides and add in all guides from the wiki that are still relevant/accurate.

With this in place, any PRs that introduce significant new APIs should include relevant patches to the guides.

Drawbacks

This does not change the fact that the guides need attention and maintenance. It does not magically fix the problem of keeping the two in sync, but it will allow people to view the guides as they stood at a particular tag or version.

Alternatives

Leave the wiki in place but pay it more attention.

Unresolved questions

None at this time.

Download multiple assets at once

Select multiple assets in the asset library, and download - maybe a 'Download' button next to the 'Upload' in the top bar?

This is useful for when I don't want to bother Tom about sending me the files already on projects.

[RFC] Allow users to opt-out of Entry templates

Summary

Currently, Entries are forced to use their parent's layout. This can be overridden by defining entry? to false, but this is undocumented and unintuitive.

Motivation

Often, we want to opt-out of Entry templates, as it isn't appropriate for the site in question. We already have the mechanism available to do this, we'd just like to expose this choice to the end user.

Detailed design

To opt-out of Entry templates, define the following in your Set Entry model:

# app/slices/foo_set/foo.rb
class Foo < Page
  def use_parent_layout?
    false
  end
end

When true:

  • Disable layout selection on individual entries
  • Enable Edit entry template and Placeholder slice capability

screen shot 2015-03-30 at 15 18 19

When false:

  • Enable layout selection on individual entries
  • Disable Edit entry template and Placeholder slice capability

screen shot 2015-03-30 at 15 20 44

Generators

The new generated entry model would like something like this:

# app/slices/foo_set/foo.rb
class Foo < Page
  # Set this to `false` to enable arbitrary layouts on individual entries.
  def use_parent_layout?
    true
  end

  def template
    "foo_set/views/show"
  end

  # Uncomment the as_json method if the page defines fields that are
  # shown in the admin UI. Pass a hash to merge() that contains each
  # field.
  #
  # def as_json(options = {})
  #   super.merge(published: published.to_s)
  # end
end

Limit set entries to their set page

In the entries controller we could change the raw_entries method to return just the set page entries, rather than all documents of that type:

def raw_entries
  @page.entries(entry_type)
end

That way we could use the same set slice on multiple set pages. What do you think?

Double render of quick access code in js_head

The double rendering of the _form partial here:

<!--[if !IE]> -->
<%= render 'form' %>
<!-- <![endif]-->

<!--[if gte IE 9]>
<%= render 'form' %>
<![endif]-->

<!--[if lt IE 9]>
  <div class="notice">
    <p>Slices CMS is incompatible with your browser. Please <a href="http://abetterbrowser.org/">upgrade your browser</a>.</p>
  </div>
<![endif]-->

Leads to two event handlers being rendered into :js_head:

<script type="text/javascript">
  $(document).ready(function() {
    $(document).bind("keydown", function(e) {
      if(e.keyCode == 187) {
        window.location = "/admin/auth/google_apps";
      }
    });
    $(document).bind("keydown", function(e) {
      if(e.keyCode == 187) {
        window.location = "/admin/auth/google_apps";
      }
    });
  });
</script>

Not sure if this causes problems yet, but could do with refactoring.

Not really an issue...

Hi guys, not sure if this is the right place to comment but I've installed the Slices CMS, I thought I would check it out as it looks great at http://slices.withassociates.com. I'm struggling to get custom Slices ie. title_body to show in the Admin area, is there more detailed documentation?
Cheers

Upgrade analytics

Should we update the google_analytics_tracking_code method to use the new style tracking code?

def google_analytics_tracking_code(*web_property_ids)
if web_property_ids.first.present? && add_tracking_code?
analytics_que = "['_setAccount', '#{web_property_ids.shift}'], ['_trackPageview'], ['_trackPageLoadTime']"
web_property_ids.each_with_index do |web_property_id, index|
account = (index + 98).chr
analytics_que << ", ['#{account}._setAccount', '#{web_property_id}'], ['#{account}._trackPageview'], ['#{account}._trackPageLoadTime']"
end
javascript_tag <<-JAVASCRIPT
var _gaq = _gaq || [];
_gaq.push(#{analytics_que});
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
JAVASCRIPT
end
end

[RFC] Fragment caching

Summary

Add a class method to slice class allowing easy fragment caching of the entire view

Motivation

To add this currently means wrapping the entire view in a cache block

For example, consider FooSlice:

# app/slices/foo/foo_slice.rb

class FooSlice < Slice
end
<!-- app/slices/foo/views/show.html.erb -->
<div>
  <p>
    <%= some_expensive_method %>
  </p>
</div>

Adding the cache block would give the resulting code, potentially adding an extra level of indentation to most of the file.

<!-- app/slices/foo/views/show.html.erb -->
<% cache slice do %>
  <div>
    <p>
      <%= some_expensive_method %>
    </p>
  </div>
<% end %>

Rather then having to add a cache block to the view, we would prefer to add a class method/macro to the slice to signify that the entire view should be fragment cached.

# app/slices/foo/foo_slice.rb

class FooSlice < Slice
  fragment_cache_view
end

This method could allow the passing of optional extra cache keys:

fragment_cache_view 'addition-key'

Images only rendering at admin size, not original

In an attachments Slice, images only appear if I call for the :admin size. Using the following will only render the caption, and no image.

  <ul class="images">
    <%- slice.images.each do |image| -%>
      <li>
        <%= image_if_present image.asset, :original %>
        <div class="caption"><%= markdown image.caption %></div>
      </li>
    <%- end -%>
  </ul>

I've checked the direct paths for admin and original size images, and they both exist (system/files/.../.../original/file.jpg and system/files/.../.../admin/file.jpg).

Show time zone in date picker

It will be using admin's system time zone, so if they are inputting times for events in a different time zone it may be confusing. E.g. if they are in France and enter 9am, that will end up being 8am UK time. Being clear about the time zone will help with this.

Depending on the use case in the project using Slices, it might make more sense to ignore the admin's time zone and always interpret the time in some other, fixed time zone. E.g. if the events are always in London, then time can be interpreted in that time zone.

Last logged in: never

Some Slices sites seem to be displaying 'last logged in: never' even when we know that users have logged in

2014-07-02 slices2
2014-07-02 slices

[RFC] Slice Linting

Summary

Add linting and/or tests that promote the addition of validation to Slice models.

Motivation

Templates that depend upon data which may not be available is a common source of errors in Slices.

For example, consider FooSlice:

# app/slices/foo/foo_slice.rb

class FooSlice < Slice
  field :bar, type: String
end
<!-- app/slices/foo/views/show.html.erb -->

<p><%= bar.upcase %></p>

If bar is nil (which it will be by default) this will raise a NoMethodError and the entire page will fail to render.

Rather than introduce null checking to templates, we would prefer to enforce these dependencies at the slice-model level:

# app/slices/foo/foo_slice.rb

class FooSlice < Slice
  field :bar, type: String
  validates :bar, presence: true
end

This enforces consistency at a lower level and prevents both full blown render failures and incorrect renders.

Improve recording of exceptions

Out of the box, Slices does this - just rescues exceptions and outputs a single line to the log with request path and params. The exception name and backtrace etc. are lost. In some apps we override the exception handlers to report to some third party error tracking service (Raygun/Sentry/whatever), but it would be nice if, by default, some more information was put in the log.

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.