Skip to content

Commit

Permalink
add images and css files, update readme and init file
Browse files Browse the repository at this point in the history
  • Loading branch information
vann committed Jun 11, 2009
1 parent 3914af0 commit a3c14cc
Show file tree
Hide file tree
Showing 8 changed files with 102 additions and 9 deletions.
2 changes: 2 additions & 0 deletions .gitignore
@@ -1,2 +1,4 @@
*.svn
.DS_Store


32 changes: 28 additions & 4 deletions README.markdown
@@ -1,13 +1,37 @@
PrettyButtons
=============

Introduction goes here.
Pretty Buttons is another button plugin that allows you to use pretty buttons like the ones shown by Oscar Alexander at :

http://www.oscaralexander.com/tutorials/how-to-make-sexy-buttons-with-css.html


Installation
============

# run:

rake pretty_buttons:install

# add this to your layout file

<%= include_pretty_buttons %>

Usage
=====

pretty_button "click me", path, options={}
------------------------------------------

The pretty_button method takes the same options as link_to

Example
=======
-------

Example goes here.
<%= pretty_button "Sign up!", signup_path %>


Copyright (c) 2009 Vann Ek, released under the MIT license
Original Concept by Oscar Alexander:

Copyright (c) 2009 [name of plugin creator], released under the MIT license
http://www.oscaralexander.com/tutorials/how-to-make-sexy-buttons-with-css.html
34 changes: 34 additions & 0 deletions css/buttons.css
@@ -0,0 +1,34 @@
.clear { /* generic container (i.e. div) for floating buttons */
overflow: hidden;
width: 100%;
}

a.button {
background: transparent url('../images/buttons/bg_button_a.gif') no-repeat scroll top right;
color: #444;
display: block;
float: left;
font: normal 12px arial, sans-serif;
height: 24px;
margin-right: 6px;
padding-right: 18px; /* sliding doors padding */
text-decoration: none;
}

a.button span {
background: transparent url('../images/buttons/bg_button_span.gif') no-repeat;
display: block;
line-height: 14px;
padding: 5px 0 5px 18px;
}

a.button:active {
background-position: bottom right;
color: #000;
outline: none; /* hide dotted outline in Firefox */
}

a.button:active span {
background-position: bottom left;
padding: 6px 0 4px 18px; /* push text down 1px */
}
Binary file added images/bg_button_a.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/bg_button_span.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions init.rb
@@ -1 +1,4 @@
# Include hook code here
require 'pretty_buttons'

ActionView::Base.send :include, PrettyButtons
14 changes: 13 additions & 1 deletion lib/pretty_buttons.rb
@@ -1 +1,13 @@
# PrettyButtons
module PrettyButtons

def include_pretty_buttons
stylesheet_link_tag 'buttons'
end


def pretty_button(content, path, options={})
options[:class] = options[:class].nil? ? "button" : "button " << options[:class]
link_to "<span>#{content}</span>", path, options
end

end
26 changes: 22 additions & 4 deletions tasks/pretty_buttons_tasks.rake
@@ -1,4 +1,22 @@
# desc "Explaining what the task does"
# task :pretty_buttons do
# # Task goes here
# end
require 'fileutils'

PUBLIC_CSS = File.join(RAILS_ROOT,"public","stylesheets")
PUBLIC_IMGS = File.join(RAILS_ROOT,"public","images")
PLUGIN_PATH = File.join(RAILS_ROOT, "vendor/plugins/pretty_buttons")

namespace :pretty_buttons do
desc 'Installs all the files for the buttons'
task :install do
css_path = Dir.glob File.join(PLUGIN_PATH, "css", "*.css")
imgs_path = Dir.glob File.join(PLUGIN_PATH, "images", "*.gif")

btn_dir = Dir.mkdir File.join(PUBLIC_IMGS,"buttons")

FileUtils.cp_r imgs_path, File.join(PUBLIC_IMGS, "buttons")
FileUtils.cp_r css_path, PUBLIC_CSS

puts "Pretty Buttons installed!"
puts "--"
puts "Just add <%= include_pretty_buttons %> in your layout file"
end
end

0 comments on commit a3c14cc

Please sign in to comment.