Permalink
Browse files

add images and css files, update readme and init file

  • Loading branch information...
1 parent 3914af0 commit a3c14ccf6dbefb2e538d2d5fc3cdbb807b7f87e0 @vanntastic committed Jun 11, 2009
View
@@ -1,2 +1,4 @@
*.svn
+.DS_Store
+
View
@@ -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
View
@@ -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 */
+}
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
@@ -1 +1,4 @@
# Include hook code here
+require 'pretty_buttons'
+
+ActionView::Base.send :include, PrettyButtons
View
@@ -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
@@ -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.