Skip to content
This repository has been archived by the owner on Jul 7, 2020. It is now read-only.

Commit

Permalink
Apply Twitter bootstrap
Browse files Browse the repository at this point in the history
  • Loading branch information
iain committed Nov 5, 2011
1 parent 4a847ef commit 0a9f5a8
Show file tree
Hide file tree
Showing 35 changed files with 2,719 additions and 1,096 deletions.
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ end
gem 'therubyracer'
gem 'jquery-rails'

gem 'simple_form'
gem 'simple_form', :git => 'git://github.com/plataformatec/simple_form.git'
gem 'inherited_resources'
gem 'kaminari'
gem 'has_scope', git: 'git://github.com/plataformatec/has_scope.git'
Expand Down
13 changes: 9 additions & 4 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@ GIT
specs:
has_scope (0.5.1)

GIT
remote: git://github.com/plataformatec/simple_form.git
revision: 6c283ec3d29eb13a3b4014cc8fac25a655733786
specs:
simple_form (2.0.0.dev)
actionpack (~> 3.0)
activemodel (~> 3.0)

GEM
remote: http://rubygems.org/
specs:
Expand Down Expand Up @@ -106,9 +114,6 @@ GEM
sass (>= 3.1.4)
sprockets (~> 2.0.0)
tilt (~> 1.3.2)
simple_form (1.5.2)
actionpack (~> 3.0)
activemodel (~> 3.0)
sprockets (2.0.3)
hike (~> 1.2)
rack (~> 1.0)
Expand Down Expand Up @@ -141,7 +146,7 @@ DEPENDENCIES
pg
rails (= 3.1.1)
sass-rails (~> 3.1.0)
simple_form
simple_form!
therubyracer
turn
uglifier
6 changes: 4 additions & 2 deletions app/assets/stylesheets/application.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
* This is a manifest file that'll automatically include all the stylesheets available in this directory
* and any sub-directories. You're free to add application-wide styles to this file and they'll appear at
* the top of the compiled file, but it's generally better to create a new file per style scope.
*= require bootstrap
*= require_self
*= require_tree .
*/
*/

body { padding: 20px; }
6 changes: 0 additions & 6 deletions app/assets/stylesheets/backend.css

This file was deleted.

45 changes: 45 additions & 0 deletions app/assets/stylesheets/backend.css.sass
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
//= require bootstrap
html, body
background-color: #eee

body
padding-top: 40px

.container > footer p
text-align: center

.container
width: 820px


.content
background-color: white
padding: 20px
margin: 0 -20px
-webkit-border-radius: 0 0 6px 6px
-moz-border-radius: 0 0 6px 6px
border-radius: 0 0 6px 6px
-webkit-box-shadow: 0 1px 2px rgba(0,0,0,.15)
-moz-box-shadow: 0 1px 2px rgba(0,0,0,.15)
box-shadow: 0 1px 2px rgba(0,0,0,.15)

.page-header
background: #f5f5f5
padding: 20px 20px 10px
margin: -20px -20px 20px

.content
.span10, .span4
min-height: 500px

.span4
margin-left: 10px
padding-left: 9px
border-left: 1px solid #eee

.alert-message
margin-left: 20px

.row-actions
text-align: right
9 changes: 0 additions & 9 deletions app/assets/stylesheets/backend/definition_lists.css.sass

This file was deleted.

50 changes: 0 additions & 50 deletions app/assets/stylesheets/backend/forms.css.sass

This file was deleted.

11 changes: 7 additions & 4 deletions app/views/backend/products/_form.html.haml
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
= simple_form_for resource do |f|
- attributes.each do |attr|
= f.input attr
= f.submit
= simple_form_for resource, :wrapper => :inline do |f|
%fieldset
- attributes.each do |attr|
= f.input attr
.actions
= f.submit :class => "btn primary"
%button.btn{:type => "reset"} Cancel
10 changes: 6 additions & 4 deletions app/views/backend/resource/_form.html.haml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
= simple_form_for [ :backend, resource ] do |f|
- attributes.each do |attr|
= f.input attr
= f.submit
= simple_form_for [ :backend, resource ], :wrapper => :inline do |f|
%fieldset
%legend Fields
- attributes.each do |attr|
= f.input attr
= f.submit :class => "primary"
52 changes: 24 additions & 28 deletions app/views/backend/resource/_index.html.haml
Original file line number Diff line number Diff line change
@@ -1,30 +1,26 @@
.block
.content
%h2= resource_class.model_name.human(count: 2)
.inner
%table.table
%thead
%tr
- attributes.each do |attr|
%th= resource_class.human_attribute_name(attr)
%th  
%tbody
- collection.each do |resource|
%tr[resource]{odd_or_even}
- attributes.each do |attr|
%td= resource.public_send(attr).to_s.truncate(20)
%td
= link_to 'show', resource_path(resource)
|
= link_to 'edit', edit_resource_path(resource)
|
= link_to 'destroy', resource_path(resource), method: :delete, confirm: "Are you sure?"
- content_for :header do
%h1= resource_class.model_name.human(count: 2)

.actions-bar.wat-cf
= paginate collection
%ul.tabs
%li.active= link_to "Index", "#"
%li= link_to "New", new_resource_path

= content_for :sidebar do
.block
%h3 Navigation
%ul.navigation
%li= link_to "New #{resource_class.model_name.human}", new_resource_path
%table.zebra-striped
%thead
%tr
- attributes.each do |attr|
%th= resource_class.human_attribute_name(attr)
%th  
%tbody
- collection.each do |resource|
%tr[resource]{odd_or_even}
- attributes.each do |attr|
%td= resource.public_send(attr).to_s.truncate(20)
%td.row-actions
= link_to 'show', resource_path(resource)
|
= link_to 'edit', edit_resource_path(resource)
|
= link_to 'destroy', resource_path(resource), method: :delete, confirm: "Are you sure?"

= paginate collection
19 changes: 9 additions & 10 deletions app/views/backend/resource/edit.html.haml
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
.block
.content
%h2 Edit #{resource_class.model_name.human}
- content_for :header do
%h1 Edit #{resource_class.model_name.human}

.inner
= render "form", attributes: attributes
%ul.tabs
%li= link_to "Index", collection_path
%li= link_to "New", new_resource_path
%li= link_to "Show", resource_path
%li.active= link_to "Edit", "#"
%li= link_to "Destroy", resource_path, method: :delete, confirm: "Are you sure?"

= content_for :sidebar do
.block
%h3 Navigation
%ul.navigation
%li= link_to "Back", resource_path
= render "form", attributes: attributes
18 changes: 7 additions & 11 deletions app/views/backend/resource/new.html.haml
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
.block
.content
%h2 New #{resource_class.model_name.human}
- content_for :header do
%h1 New #{resource_class.model_name.human}

.inner
- attributes = resource_class.attribute_names - %w(id created_at updated_at)
= render "form", attributes: attributes
%ul.tabs
%li= link_to "Index", collection_path
%li.active= link_to "New", "#"

= content_for :sidebar do
.block
%h3 Navigation
%ul.navigation
%li= link_to "Back", collection_path
- attributes = resource_class.attribute_names - %w(id created_at updated_at)
= render "form", attributes: attributes
23 changes: 10 additions & 13 deletions app/views/backend/resource/show.html.haml
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
.block
.content
%h2= resource_class.model_name.human
.inner
= render "show"
- content_for :header do
%h1= resource_class.model_name.human

= content_for :sidebar do
.block
%h3 Navigation
%ul.navigation
%li= link_to "Back", collection_path
%li= link_to "Edit", edit_resource_path
%li= link_to "Destroy", resource_path, method: :delete, confirm: "Are you sure?"
= yield :actions
%ul.tabs
%li= link_to "Index", collection_path
%li= link_to "New", new_resource_path
%li.active= link_to 'Show', '#'
%li= link_to "Edit", edit_resource_path
%li= link_to "Destroy", resource_path, method: :delete, confirm: "Are you sure?"

= render "show"
14 changes: 9 additions & 5 deletions app/views/backend/widgets/_form.html.haml
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
= simple_form_for [ :backend, resource ] do |f|
= f.input :name
= f.association :product
= f.input :active
= f.submit
= simple_form_for [ :backend, resource ], :wrapper => :inline do |f|
%fieldset
%legend Please enter some widget info
= f.input :name
= f.association :product
= f.input :active
.actions
= f.submit :class => "btn primary"
%button.btn{:type => "reset"} Cancel
2 changes: 2 additions & 0 deletions app/views/kaminari/_first_page.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,6 @@
per_page: number of items to fetch per page
remote: data-remote
-%>
<li>
<%= link_to_unless current_page.first?, raw(t 'views.pagination.first'), url, :remote => remote %>
</li>
4 changes: 3 additions & 1 deletion app/views/kaminari/_gap.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,6 @@
per_page: number of items to fetch per page
remote: data-remote
-%>
<span class="page gap"><%= raw(t 'views.pagination.truncate') %></span>
<li class="disabled">
<a href="#"><%= raw(t 'views.pagination.truncate') %></a>
</li>
2 changes: 2 additions & 0 deletions app/views/kaminari/_last_page.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,6 @@
per_page: number of items to fetch per page
remote: data-remote
-%>
<li>
<%= link_to_unless current_page.last?, raw(t 'views.pagination.last'), url, {:remote => remote} %>
</li>
2 changes: 2 additions & 0 deletions app/views/kaminari/_next_page.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,6 @@
per_page: number of items to fetch per page
remote: data-remote
-%>
<li>
<%= link_to_unless current_page.last?, raw(t 'views.pagination.next'), url, :rel => 'next', :remote => remote %>
</li>
4 changes: 2 additions & 2 deletions app/views/kaminari/_page.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
remote: data-remote
-%>
<% if page.current? %>
<span class="current"><%= page %></span>
<li class="active"><a href="#"><%= page %></a></li>
<% else %>
<%= link_to_unless page.current?, page, url, opts = {:remote => remote, :rel => page.next? ? 'next' : page.prev? ? 'prev' : nil} %>
<li><%= link_to_unless page.current?, page, url, opts = {:remote => remote, :rel => page.next? ? 'next' : page.prev? ? 'prev' : nil} %></li>
<% end %>
22 changes: 12 additions & 10 deletions app/views/kaminari/_paginator.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,18 @@
-%>
<%= paginator.render do -%>
<nav class="pagination">
<%= first_page_tag unless current_page.first? %>
<%= prev_page_tag unless current_page.first? %>
<% each_page do |page| -%>
<% if page.left_outer? || page.right_outer? || page.inside_window? -%>
<%= page_tag page %>
<% elsif !page.was_truncated? -%>
<%= gap_tag %>
<ul>
<%= first_page_tag unless current_page.first? %>
<%= prev_page_tag unless current_page.first? %>
<% each_page do |page| -%>
<% if page.left_outer? || page.right_outer? || page.inside_window? -%>
<%= page_tag page %>
<% elsif !page.was_truncated? -%>
<%= gap_tag %>
<% end -%>
<% end -%>
<% end -%>
<%= next_page_tag unless current_page.last? %>
<%= last_page_tag unless current_page.last? %>
<%= next_page_tag unless current_page.last? %>
<%= last_page_tag unless current_page.last? %>
</ul>
</nav>
<% end -%>
Loading

0 comments on commit 0a9f5a8

Please sign in to comment.