Skip to content

Starter application with authentication, themes and mobile views

Notifications You must be signed in to change notification settings

swistaczek/BaseApp2

 
 

Repository files navigation

BaseApp2

Fork information

This fork supports polish language and works with ruby 1.9.2.
Fork author: http://ernest.bzdury.pl

Changes
h3. Localization

rails g i18n_translation localeCode

Localized paths

First, declare a localized resources in your routes.rb :

localized do resources :users end

Then, translate your resources in your locales files (if you are using the simple Backend, or anywhere else depending on your I18n backend):

fr: resources: users: ‘utilisateurs’

After that, when you will use any users route helpers in your app, it will transparently use the correct route path depending on your current locale.

$ rails console ruby-1.8.7-p249 > I18n.locale = :en => :en ruby-1.8.7-p249 > app.users_path => “/users” ruby-1.8.7-p249 > I18n.locale = :fr => :fr ruby-1.8.7-p249 > app.users_path => “/utilisateurs” ruby-1.8.7-p249 >

Simple enum

Add this to a model:

class User < ActiveRecord::Base as_enum :gender, :female => 1, :male => 0 end

Then create the new column using migrations:

class AddGenderColumnToUser < ActiveRecord::Migration def self.up add_column :users, :gender_cd, :integer end def self.down remove_column :users, :gender_cd end end

Done. Now it’s possible to pull some neat tricks on the new column, yet the original db column (gender_cd) is still intact and not touched by any fancy metaclass or similar.

jane = User.new jane.gender = :female jane.female? # => true jane.male? # => false jane.gender # => :female jane.gender_cd # => 1 Easily switch to another value using the bang methods. joe = User.new joe.male! # => :male joe.gender # => :male joe.gender_cd # => 0

There are even some neat tricks at class level, which might be useful when creating queries, displaying option elements or similar:

User.genders # => { :male => 0, :female => 1 } User.genders(:male) # => 0, same as User.male User.female # => 1 User.genders.female # => 1, same as User.female or User.genders(:female)

https://github.com/lwe/simple_enum

Requirements

Rails 3.1

Features

- Layout
- Tabs
- Global links
- Optional sidebar
- Notice, warning and error flash messages
- Both a default stylesheet as well as a ‘clean’ one are included for easy layout development.
- Default dashboard page
- Administration panel where you can:
Manage users (add, delete, purge, suspend, activate, send new passwords)
- Manage settings
- Manage site wide timed announcements
- Post-Commit Hooks ready to roll for Campfire, Basecamp, FriendFeed, Twitter and custom URL.
- User authentication, with password recovery and login recovery and account activation (by email)
- User Profiles:
Location, Website, Full name fields by default, easily extendible.
Gravatar for avatar support
- Mobile Ready
- Auto detect mobile users/visitors and display different views.
- Based on the JQTouch framework, making it easy to theme.
- Devise
- Declarative Authorization

Configatron vs. Settings

Previously, site settings were stored in the database. Now, you have two options for storing configuration settings.

1. Configatron config/config.yml

All default configuration options that are not ‘user changeable’ should go in config/config.yml. This uses the Configatron gem (frozen in vendor/gems).

To retrieve the site name you may use ‘configatron.site_name’ everywhere in your code.

2. Settings in database

It’s still possible to store user changeable settings in the database model Setting.

Note: As long as there are no Settings in the database, the ‘Settings’ tab for the administrator is hidden. Once you add a Setting to the database through a migration (or otherwise), the Settings tab will show up.

Getting Started

1. At the command prompt:

  • bundle install
  • rake db:migrate
  • rails s

2. Go to http://localhost:3000/

3. Administration username and password are as follows:

  • admin
  • baseapp

Collaborators

  • dannymcc
  • rorcraft
  • rposborne
  • sanchitg
  • t0d0r

About

Starter application with authentication, themes and mobile views

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Ruby 57.5%
  • JavaScript 42.5%