Giter VIP home page Giter VIP logo

pure-admin-rails's Introduction

pure-admin-rails

Build Status

Pure CSS Admin Template for Rails 4+.

Forms work with SimpleForm, breadcrumbs with crumpet.

Installation

Add these lines to your Gemfile

# Admin theme + dependencies
gem 'pure-admin-rails', github: 'blaknite/pure-admin-rails', branch: 'master'
gem 'pure-css-reset-rails', github: 'blaknite/pure-css-reset-rails', branch: 'master'
gem 'exo2-rails', github: 'blaknite/exo2-rails', branch: 'master'
gem 'crummy', github: 'blaknite/crummy', branch: 'master'
gem 'font-awesome-rails'
gem 'select2-rails'
gem 'pure-css-rails'
gem 'simple_form'

Run

rails generate pure_admin:layout
rails generate pure_admin:simple_form

Then edit app/views/layouts/admin.html.erb to your liking.

Dependencies

  • Pure CSS
  • jQuery
  • waypoints.js
  • Select2

Usage

Portlets

Portlets are optionally collapsable containers that can be passed a block, or a source URL.

Simple Portlets

The simplest incarnation of a portlet is,

<%= portlet do %>
  <p>Hello, world</p>
<% end %>

You may also give a title to portlets.

<%= portlet 'Greeting' do %>
  <p>Hello, world</p>
<% end %>

Titles can have icons, too.

<%= portlet 'Greeting', icon: 'hand-peace-o' do %>
  <p>Hello, world</p>
<% end %>

To make a portlet collapsable, add the expand: true option to the portlet method.

<%= portlet 'Greeting', icon: 'hand-peace-o', expand: true do %>
  <p>Hello, world</p>
<% end %>

If you want the portlet to be collapsed by default, simply add expand: false instead.

Any other options that can be passed to Rails' content_tag are respected on the portlet too, for example:

<%= portlet 'Greeting', class: 'is-supported' do %>
...
<%= portlet 'Greeting', data: { attributes: 'are-too' } do %>
...

Source Portlets

Source portlets are given a source URL which, when expanded, will fetch the content at this URL and display it within the portlet body.

Source portlets require a title be given, to give the user somewhere to click to expand.

For this example, the following file was created:

<!-- public/test.html -->
<h2>Congratulations!</h2>
<p>This page was loaded via AJAX.</p>
<%= portlet 'Source Portlet', source: '/test' %>

When the portlet is clicked, the content at the source URL will be retrieved and displayed in the body.

If the AJAX request begins to take too long, the portlet will assume a loading state.

Like Simple Portlets, Source Portlets can be expanded by default. The difference however, is that this loading happens when the document is ready. To enable this, simply add the familiar expand: true to the options.

<%= portlet 'Source Portlet', source: '/test', expand: true %>

You can additionally expand a portlet via the URL string. If you add a class to the portlet you can then target this with a hash at the end of your URL. When this is loaded, a portlet with a class that is the same as the hash will be expanded.

<%= portlet 'Source Portlet', source: '/test', class: 'source-test' %>
http://localhost:3000/{page}#source-test

pure-admin-rails's People

Contributors

blaknite avatar miegs3 avatar ozmullins avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  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.