Last active
December 27, 2015 05:09
-
-
Save julioprotzek/7272086 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
= simple_form_for(@article) do |f| | |
= f.error_notification | |
.form-inputs | |
= f.input :title | |
= f.input :body | |
= f.input :published_at | |
.form-actions | |
= f.button :submit, class: 'btn btn-primary' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#= require jquery | |
#= require jquery_ujs | |
#= require turbolinks | |
#= require bootstrap |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
doctype html | |
html | |
head | |
meta name="viewport" content="width=device-width, initial-scale=1.0" | |
title Paporeto | |
= stylesheet_link_tag "application", media: "all", "data-turbolinks-track" => true | |
= csrf_meta_tags | |
/[if lt IE 9] | |
= javascript_include_tag "html5shiv", "data-turbolinks-track" => true | |
= javascript_include_tag "respond.min", "data-turbolinks-track" => true | |
body | |
.navbar.navbar-inverse.navbar-fixed-top | |
.container | |
.navbar-header | |
a class="navbar-brand" href="/articles" Paporeto | |
.navbar-collapse | |
ul.nav.navbar-nav | |
li.active | |
a href="/articles" Artigos | |
li | |
a href="/categories" Categorias | |
.container | |
= yield | |
= javascript_include_tag "application", "data-turbolinks-track" => true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require File.expand_path('../boot', __FILE__) | |
require 'rails/all' | |
# Require the gems listed in Gemfile, including any gems | |
# you've limited to :test, :development, or :production. | |
Bundler.require(:default, Rails.env) | |
module Paporeto | |
class Application < Rails::Application | |
config.i18n.default_locale = 'pt-BR' | |
config.time_zone = 'Brasilia' | |
config.generators do |g| | |
g.assets false | |
g.helper false | |
g.test_framework nil | |
end | |
# Settings in config/environments/* take precedence over those specified here. | |
# Application configuration should go into files in config/initializers | |
# -- all .rb files in that directory are automatically loaded. | |
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone. | |
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC. | |
# config.time_zone = 'Central Time (US & Canada)' | |
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded. | |
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s] | |
# config.i18n.default_locale = :de | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@import "bootstrap" | |
body | |
margin-top: 60px | |
textarea.form-control | |
height: 250px | |
select.form-control | |
width: 120px | |
display: inline-block |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
h1 Editar artigo | |
== render 'form' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
source 'https://rubygems.org' | |
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails' | |
gem 'rails', '4.0.0' | |
# Use sqlite3 as the database for Active Record | |
gem 'sqlite3' | |
# Use SCSS for stylesheets | |
gem 'sass-rails', '~> 4.0.0' | |
# Use Uglifier as compressor for JavaScript assets | |
gem 'uglifier', '>= 1.3.0' | |
# Use CoffeeScript for .js.coffee assets and views | |
gem 'coffee-rails', '~> 4.0.0' | |
# See https://github.com/sstephenson/execjs#readme for more supported runtimes | |
# gem 'therubyracer', platforms: :ruby | |
# Use jquery as the JavaScript library | |
gem 'jquery-rails' | |
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks | |
gem 'turbolinks' | |
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder | |
# gem 'jbuilder', '~> 1.2' | |
gem 'simple_form' | |
gem 'slim-rails' | |
gem 'xray-rails', group: :development | |
gem 'start' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
h1 Artigos | |
table.table.table-striped | |
thead | |
tr | |
th Título | |
th Publicado em | |
th | |
tbody | |
- @articles.each do |article| | |
tr | |
td = article.title | |
td = l article.published_at | |
td | |
.btn-group.pull-right | |
= link_to 'Ver', article, class: 'btn btn-default btn-sm' | |
= link_to 'Editar', edit_article_path(article), class: 'btn btn-default btn-sm' | |
= link_to 'Excluir', article, :confirm => 'Tem certeza?', :method => :delete, class: 'btn btn-default btn-sm' | |
br | |
= link_to 'Criar Artigo', new_article_path, class: 'btn btn-primary' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
h1 Novo artigo | |
== render 'form' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- if notice | |
.alert.alert-info.alert-dismissable | |
button type="button" class="close" data-dismiss="alert" aria-hidden="true" × | |
= notice | |
h1 | |
= @article.title | |
.pull-right | |
= link_to 'Edit', edit_article_path(@article), class: 'btn btn-default' | |
hr | |
p = @article.published_at | |
= simple_format @article.body |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Use this setup block to configure all options available in SimpleForm. | |
SimpleForm.setup do |config| | |
config.wrappers :bootstrap, :tag => 'div', :class => 'form-group', :error_class => 'has-error' do |b| | |
b.use :html5 | |
b.use :placeholder | |
b.use :label | |
b.use :input, :wrap_with => { :tag => 'div', :class => 'controls' } | |
b.use :error, :wrap_with => { :tag => 'span', :class => 'help-block' } | |
b.use :hint, :wrap_with => { :tag => 'p', :class => 'help-block' } | |
end | |
config.form_class = "form-vertical" | |
config.input_class = "form-control" | |
config.wrappers :prepend, tag: 'div', class: "control-group", error_class: 'error' do |b| | |
b.use :html5 | |
b.use :placeholder | |
b.use :label | |
b.wrapper tag: 'div', class: 'controls' do |input| | |
input.wrapper tag: 'div', class: 'input-prepend' do |prepend| | |
prepend.use :input | |
end | |
input.use :hint, wrap_with: { tag: 'span', class: 'help-block' } | |
input.use :error, wrap_with: { tag: 'span', class: 'help-inline' } | |
end | |
end | |
config.wrappers :append, tag: 'div', class: "control-group", error_class: 'error' do |b| | |
b.use :html5 | |
b.use :placeholder | |
b.use :label | |
b.wrapper tag: 'div', class: 'controls' do |input| | |
input.wrapper tag: 'div', class: 'input-append' do |append| | |
append.use :input | |
end | |
input.use :hint, wrap_with: { tag: 'span', class: 'help-block' } | |
input.use :error, wrap_with: { tag: 'span', class: 'help-inline' } | |
end | |
end | |
# Wrappers for forms and inputs using the Twitter Bootstrap toolkit. | |
# Check the Bootstrap docs (http://twitter.github.com/bootstrap) | |
# to learn about the different styles for forms and inputs, | |
# buttons and other elements. | |
config.default_wrapper = :bootstrap | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# install gems | |
bundle | |
# server | |
rails s | |
# install simple form | |
rails g simple_form:install --bootstrap | |
# regenerate scaffold | |
rails g scaffold article title body:text published_at:datetime | |
rake db:migrate |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment