Giter Site home page Giter Site logo

snips's Introduction

Snips
=====

Super::Simple::Content::Management

Note if you are viewing this in plain text - please ignore the <pre> tags around the code snippets

Install
---


* Add the following to your layouts

<pre>
  <% if session[:snips] != nil %>
  <%= stylesheet_link_tag '/snips/stylesheets/snips' %>
  <%= javascript_include_tag '/snips/javascripts/jquery', '/snips/javascripts/form' ,'/snips/javascripts/snips' %>
  <% end %>
</pre>

* run a migration with following:

<pre>
  create_table "snips", :force => true do |t|
    t.string   "path"
    t.text     "raw_text"
    t.datetime "created_at"
    t.datetime "updated_at"
    t.string   "layout"
    t.string   "render_type", :limit => 50
  end
</pre>

* Start your server

Login
---

* Go to /snips
* If you've set up authentication, you will be asked for your credentials
* Once logged in you can add/edit snips
* You can also edit the site inline once logged in - just click on the <div class="snip_edit" style="display: inline; position: relative">edit โœ‚ </div>


Authentication
----

* To protect the snips admin add the following to environment.rb:

<pre>
::Snips.protect _username_, _password_
</pre>

Wiring up the root directory
------

* Add the following to your routes (above the map.snips)

<pre>
map.root :controller => "snips", :action => "render_snip", :path => "my-index-page"
</pre>

Render types
---

Snips supports the following

* Plain text/HTML
* Markdown/Textile via Redcloth3
* ERB
* HAML

Be aware that ERB and HAML can run arbitrary ruby. 

This can be very useful, but also be aware of the security implications.


Advanced
===

Referencing other snips
---

You can reference other snips inside snips using the notation 

<pre>{{snip-path}}</pre>

* Be careful of cyclic references which will be fatal!

Rendering a snip in your own code
---

You can simply do <pre>@snip.render_text</pre>

snips's People

Contributors

weepy avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

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.