Permalink
Browse files

twitter bootstrap adjustments

  • Loading branch information...
1 parent 7a880e2 commit 416f052d18602a26ffeef96a8214663c96d79584 @slawosz committed Apr 28, 2012
View
1 .gitignore
@@ -5,3 +5,4 @@ test/dummy/db/*.sqlite3
test/dummy/log/*.log
test/dummy/tmp/
*.swp
+tags
View
4 Gemfile.lock
@@ -5,8 +5,8 @@ PATH
formtastic
formtastic-bootstrap
kaminari
- libv8
rails (~> 3.1.1)
+ therubyracer
twitter-bootstrap-rails
GEM
@@ -118,6 +118,8 @@ GEM
rack (~> 1.0)
tilt (~> 1.1, != 1.3.0)
sqlite3 (1.3.5)
+ therubyracer (0.10.1)
+ libv8 (~> 3.3.10)
thor (0.14.6)
tilt (1.3.3)
treetop (1.4.10)
View
0 app/assets/javascripts/application.js
No changes.
View
2 app/assets/javascripts/rails_panel/application.js
@@ -8,4 +8,4 @@
//= require jquery_ujs
//= require jquery-ui
//= require twitter/bootstrap
-//= require_tree ../appliaction
+//= require ../application
View
24 app/helpers/rails_panel/link_helper.rb
@@ -1,23 +1,39 @@
module RailsPanel
module LinkHelper
def link_to_index
- link_to 'Back to index', url_for_index
+ link_to desc('Back to index','list'), url_for_index, :class => classes
end
def link_to_show(resource, anchor = '')
link_to (anchor == '' ? resource._name : anchor), url_for_show(resource)
end
def link_to_new
- link_to "New", url_for_new
+ link_to desc('Add new','plus'), url_for_new, :class => classes
end
def link_to_edit(resource)
- link_to 'Edit', url_for_edit(resource)
+ link_to desc('Edit resource','pencil'), url_for_edit(resource), :class => classes
end
def link_to_destroy(resource)
- link_to 'Destroy', url_for_destroy(resource), :confirm => 'Are you sure?', :method => :delete
+ link_to desc('Destroy resource','exclamation-sign'),
+ url_for_destroy(resource),
+ :confirm => 'Are you sure?',
+ :method => :delete,
+ :class => 'btn btn-danger'
+ end
+
+ def desc(label, icon_name)
+ "#{icon(icon_name)} #{label}".html_safe
+ end
+
+ def icon(name)
+ "<i class='icon-#{name} icon-white'></i>"
+ end
+
+ def classes
+ 'btn btn-primary'
end
end
end
View
5 app/helpers/rails_panel/resources_helper.rb
@@ -5,9 +5,10 @@ module ResourcesHelper
def render_resources_menu
return if @resources_menu.nil?
- html = '<ul class="pills">'
+ html = '<ul class="nav nav-pills">'
@resources_menu.each do |title, path|
- html << "<li>" + link_to(title, path) + "</li>"
+ css_class = (path == request.fullpath || request.fullpath[/(.*)\/.*/,1] == path) ? 'active' : ''
+ html << "<li class='#{css_class}'>" + link_to(title, path) + "</li>"
end
html << "</ul>"
html.html_safe
View
29 app/views/layouts/rails_panel/twitter_bootstrap.html.erb
@@ -42,21 +42,26 @@
<div class="container">
<div class="content">
+ <%= render_resources_menu %>
+ <h1><%= yield :title %> <small><%= yield :subtitle %></small></h1>
<div class="row">
- <div class="span9">
+ <div class="span10">
+ <%= render :partial => 'shared/notices' %>
<%= yield %>
</div>
- <div class="span3">
- <div class="well sidebar-nav">
- <h3>Sidebar</h3>
- <ul class="nav nav-list">
- <li class="nav-header">Sidebar</li>
- <li><%= link_to "Link1", "/path1" %></li>
- <li><%= link_to "Link2", "/path2" %></li>
- <li><%= link_to "Link3", "/path3" %></li>
- </ul>
- </div><!--/.well -->
- </div><!--/span-->
+ <% if false %>
+ <div class="span2">
+ <div class="well sidebar-nav">
+ <h3>Sidebar</h3>
+ <ul class="nav nav-list">
+ <li class="nav-header">Sidebar</li>
+ <li><%= link_to "Link1", "/path1" %></li>
+ <li><%= link_to "Link2", "/path2" %></li>
+ <li><%= link_to "Link3", "/path3" %></li>
+ </ul>
+ </div><!--/.well -->
+ </div><!--/span-->
+ <% end %>
</div><!--/row-->
</div><!--/content-->
View
2 app/views/rails_panel/resources/_has_many.html.erb
@@ -4,7 +4,7 @@
<ul class='input-list'>
<% form_data.call.each do |associated_record| %>
<li>
- <%= check_box_tag "#{current_model_params_key}[#{form_field.to_s.pluralize}][]", associated_record.id, current_resource.send(association).include?(associated_record) %>
+ <%= check_box_tag "#{model_representer_params_key}[#{form_field.to_s.pluralize}][]", associated_record.id, current_resource.send(association).include?(associated_record) %>
<span><%= associated_record._name %></span>
</li>
<% end %>
View
10 app/views/rails_panel/resources/_index.html.erb
@@ -1,10 +1,14 @@
<%= paginate current_resources, :theme => 'rails_panel' %>
-<%= link_to_new %>
-<table class='condensed-table'>
+<div class="well">
+ <%= link_to_new %> <b>Currently <%= pluralize(@resources.count, 'resource') %></b>
+</div>
+<table class='table table-striped'>
<%= render 'resource_header' %>
<% @resources.each do |resource| %>
<%= render :partial => 'resource_row', :locals => {:resource => resource} %>
<% end %>
<table>
-<%= link_to_new %>
+<div class="well">
+ <%= link_to_new %>
+</div>
<%= paginate current_resources, :theme => 'rails_panel' %>
View
2 app/views/rails_panel/resources/_resource_header.html.erb
@@ -1,6 +1,6 @@
<tr>
<% table_attributes_keys.each do |key| %>
- <th><%= key %></th>
+ <th><%= key.to_s.titleize %></th>
<% end %>
<th></th>
<th></th>
View
6 app/views/shared/_notices.html.erb
@@ -1,10 +1,12 @@
<% if flash[:notice] %>
- <div class='alert-message success'>
+ <div class='alert alert-success'>
+ <button class="close" data-dismiss="alert">×</button>
<%= flash[:notice] %>
</div>
<% end %>
<% if flash[:alert] %>
- <div class='alert-message error'>
+ <div class='alert alert-error'>
+ <button class="close" data-dismiss="alert">×</button>
<%= flash[:alert] %>
</div>
<% end %>
View
1 lib/rails_panel.rb
@@ -1,4 +1,5 @@
require "rails_panel/engine"
+require "twitter-bootstrap-rails"
module RailsPanel
mattr_accessor :controllers_without_model_mappings
View
2 rails_panel.gemspec
@@ -21,7 +21,7 @@ Gem::Specification.new do |s|
s.add_dependency "formtastic-bootstrap"
s.add_dependency "kaminari"
s.add_dependency "twitter-bootstrap-rails"
- s.add_dependency "libv8"
+ s.add_dependency "therubyracer"
s.add_development_dependency "sqlite3"
s.add_development_dependency "rspec-rails"

0 comments on commit 416f052

Please sign in to comment.