Skip to content

Commit 17de61f

Browse files
committed
stylesheets
1 parent 51a0999 commit 17de61f

File tree

9 files changed

+189
-11
lines changed

9 files changed

+189
-11
lines changed

app/assets/javascripts/application.js

+1
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,5 @@
1313
//= require jquery
1414
//= require jquery_ujs
1515
//= require turbolinks
16+
//= require bootstrap
1617
//= require_tree .

app/assets/stylesheets/application.css app/assets/stylesheets/application.css.scss

+11
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,14 @@
1111
*= require_self
1212
*= require_tree .
1313
*/
14+
.content {
15+
background-color: #eee;
16+
padding: 20px;
17+
margin: 0 -20px;
18+
-webkit-border-radius: 0 0 6px 6px;
19+
-moz-border-radius: 0 0 6px 6px;
20+
border-radius: 0 0 6px 6px;
21+
-webkit-box-shadow: 0 1px 2px rgba(0,0,0,.15);
22+
-moz-box-shadow: 0 1px 2px rgba(0,0,0,.15);
23+
box-shadow: 0 1px 2px rgba(0,0,0,.15);
24+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
@import "bootstrap";
2+
body { padding-top: 60px; }
3+
@import "bootstrap-responsive";

app/views/layouts/_messages.html.erb

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<% flash.each do |name, msg| %>
2+
<% if msg.is_a?(String) %>
3+
<div class="alert alert-<%= name == :notice ? "success" : "error" %>">
4+
<a class="close" data-dismiss="alert">&#215;</a>
5+
<%= content_tag :div, msg, :id => "flash_#{name}" %>
6+
</div>
7+
<% end %>
8+
<% end %>
+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<ul class="nav">
2+
<li><%= link_to 'Home', root_path %></li>
3+
<li><%= link_to 'About', page_path('about') %></li>
4+
<li><%= link_to 'Contact', page_path('contact') %></li>
5+
</ul>
+31-11
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,34 @@
11
<!DOCTYPE html>
22
<html>
3-
<head>
4-
<title>LearnRails</title>
5-
<%= stylesheet_link_tag "application", media: "all", "data-turbolinks-track" => true %>
6-
<%= javascript_include_tag "application", "data-turbolinks-track" => true %>
7-
<%= csrf_meta_tags %>
8-
</head>
9-
<body>
10-
11-
<%= yield %>
12-
13-
</body>
3+
<head>
4+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
5+
<title><%= content_for?(:title) ? yield(:title) : "Learning Rails" %></title>
6+
<meta name="description" content="<%= content_for?(:description) ? yield(:description) : "Learning Rails" %>">
7+
<%= stylesheet_link_tag "application", :media => "all" %>
8+
<%= javascript_include_tag "application" %>
9+
<%= csrf_meta_tags %>
10+
</head>
11+
<body>
12+
<header class="navbar navbar-fixed-top">
13+
<nav class="navbar-inner">
14+
<div class="container">
15+
<%= render 'layouts/navigation' %>
16+
</div>
17+
</nav>
18+
</header>
19+
<main role="main">
20+
<div class="container">
21+
<div class="content">
22+
<div class="row">
23+
<div class="span12">
24+
<%= render 'layouts/messages' %>
25+
<%= yield %>
26+
</div>
27+
</div>
28+
<footer>
29+
</footer>
30+
</div>
31+
</div>
32+
</main>
33+
</body>
1434
</html>

config/initializers/simple_form.rb

+93
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
# Use this setup block to configure all options available in SimpleForm.
2+
SimpleForm.setup do |config|
3+
# Components used by the form builder to generate a complete input. You can remove
4+
# any of them, change the order, or even add your own components to the stack.
5+
# config.components = [ :placeholder, :label_input, :hint, :error ]
6+
7+
# Default tag used on hints.
8+
# config.hint_tag = :span
9+
10+
# CSS class to add to all hint tags.
11+
# config.hint_class = :hint
12+
13+
# CSS class used on errors.
14+
# config.error_class = :error
15+
16+
# Default tag used on errors.
17+
# config.error_tag = :span
18+
19+
# Method used to tidy up errors.
20+
# config.error_method = :first
21+
22+
# Default tag used for error notification helper.
23+
# config.error_notification_tag = :p
24+
25+
# CSS class to add for error notification helper.
26+
# config.error_notification_class = :error_notification
27+
28+
# ID to add for error notification helper.
29+
# config.error_notification_id = nil
30+
31+
# You can wrap all inputs in a pre-defined tag.
32+
# config.wrapper_tag = :div
33+
34+
# CSS class to add to all wrapper tags.
35+
# config.wrapper_class = :input
36+
37+
# CSS class to add to the wrapper if the field has errors.
38+
# config.wrapper_error_class = :field_with_errors
39+
40+
# You can wrap a collection of radio/check boxes in a pre-defined tag, defaulting to none.
41+
# config.collection_wrapper_tag = nil
42+
43+
# You can wrap each item in a collection of radio/check boxes with a tag, defaulting to span.
44+
# config.item_wrapper_tag = :span
45+
46+
# Series of attempts to detect a default label method for collection.
47+
# config.collection_label_methods = [ :to_label, :name, :title, :to_s ]
48+
49+
# Series of attempts to detect a default value method for collection.
50+
# config.collection_value_methods = [ :id, :to_s ]
51+
52+
# How the label text should be generated altogether with the required text.
53+
# config.label_text = lambda { |label, required| "#{required} #{label}" }
54+
55+
# You can define the class to use on all labels. Default is nil.
56+
# config.label_class = nil
57+
58+
# You can define the class to use on all forms. Default is simple_form.
59+
# config.form_class = :simple_form
60+
61+
# Whether attributes are required by default (or not). Default is true.
62+
# config.required_by_default = true
63+
64+
# Tell browsers whether to use default HTML5 validations (novalidate option).
65+
# Default is enabled.
66+
# config.browser_validations = true
67+
68+
# Determines whether HTML5 types (:email, :url, :search, :tel) and attributes
69+
# (e.g. required) are used or not. True by default.
70+
# Having this on in non-HTML5 compliant sites can cause odd behavior in
71+
# HTML5-aware browsers such as Chrome.
72+
# config.html5 = true
73+
74+
# Custom mappings for input types. This should be a hash containing a regexp
75+
# to match as key, and the input type that will be used when the field name
76+
# matches the regexp as value.
77+
# config.input_mappings = { /count/ => :integer }
78+
79+
# Collection of methods to detect if a file type was given.
80+
# config.file_methods = [ :mounted_as, :file?, :public_filename ]
81+
82+
# Default priority for time_zone inputs.
83+
# config.time_zone_priority = nil
84+
85+
# Default priority for country inputs.
86+
# config.country_priority = nil
87+
88+
# Default size for text inputs.
89+
# config.default_input_size = 50
90+
91+
# When false, do not use translations for labels, hints or placeholders.
92+
# config.translate = true
93+
end

config/locales/simple_form.en.yml

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
en:
2+
simple_form:
3+
"yes": 'Yes'
4+
"no": 'No'
5+
required:
6+
text: 'required'
7+
mark: '*'
8+
# You can uncomment the line below if you need to overwrite the whole required html.
9+
# When using html, text and mark won't be used.
10+
# html: '<abbr title="required">*</abbr>'
11+
error_notification:
12+
default_message: "Some errors were found, please take a look:"
13+
# Labels and hints examples
14+
# labels:
15+
# password: 'Password'
16+
# user:
17+
# new:
18+
# email: 'E-mail para efetuar o sign in.'
19+
# edit:
20+
# email: 'E-mail.'
21+
# hints:
22+
# username: 'User name to sign in.'
23+
# password: 'No special characters, please.'
24+
+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<%%= simple_form_for(@<%= singular_table_name %>) do |f| %>
2+
<%%= f.error_notification %>
3+
4+
<div class="inputs">
5+
<%- attributes.each do |attribute| -%>
6+
<%%= f.<%= attribute.reference? ? :association : :input %> :<%= attribute.name %> %>
7+
<%- end -%>
8+
</div>
9+
10+
<div class="actions">
11+
<%%= f.button :submit %>
12+
</div>
13+
<%% end %>

0 commit comments

Comments
 (0)