stay_classy 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +14 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +48 -0
- data/Rakefile +2 -0
- data/bin/stay_classy +23 -0
- data/lib/stay_classy/stay_classy_process.rb +158 -0
- data/lib/stay_classy/version.rb +3 -0
- data/lib/stay_classy.rb +89 -0
- data/spec/spec_helper.rb +9 -0
- data/spec/stay_classy_spec.rb +31 -0
- data/spec/test_files/test_file.html.erb +102 -0
- data/stay_classy.gemspec +28 -0
- data/stay_classy.rspec +2 -0
- metadata +134 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 6005e4977c7900b8db97f0932b92070422a44045
|
4
|
+
data.tar.gz: 1b0179e68b35a1a823480695f6c8efecd35030aa
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: ee805309e9861e524d27a559c0e304e276ee440449c7b99e0fbe4cdd75dfcedabdb55e46f6f909ccbb857840a85e0800c9a44ba3bbcd0e7d5647f8c8482da7db
|
7
|
+
data.tar.gz: 85d2c08518b5efbdd8d55eabb642d2f40b57e6721598ac16ed75ddead167972686840b4f63afba993a93f01e916665ffae98e68fca6b09c033b5c5a4c3dcfc92
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2014 Nick Mueller
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,48 @@
|
|
1
|
+
# StayClassy
|
2
|
+
|
3
|
+
Stay Classy adds classes and ids to your html and html.erb files. You defind a prefix and the directories you wish to make classy and Stay Classy will add classes and ids to all of the HTML tags in the directory (unless specified Stay Classy will target every directory in app/views).
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem 'stay_classy'
|
11
|
+
```
|
12
|
+
|
13
|
+
And then execute:
|
14
|
+
|
15
|
+
$ bundle
|
16
|
+
|
17
|
+
Or install it yourself as:
|
18
|
+
|
19
|
+
$ gem install stay_classy
|
20
|
+
|
21
|
+
## Usage
|
22
|
+
|
23
|
+
Start by running the command:
|
24
|
+
```ruby
|
25
|
+
stay_classy
|
26
|
+
```
|
27
|
+
Then enter the prefix you wish to use. For example, a prefix of 'foo' sill produce tags like this inside of a directory named posts:
|
28
|
+
```html
|
29
|
+
<p class="foo_posts_p">Lorem ipsum...</p>
|
30
|
+
```
|
31
|
+
Ids are assigned a unique number along with the prefix and tag name.
|
32
|
+
```html
|
33
|
+
<p id="foo_p_15">Lorem ipsum...</p>
|
34
|
+
```
|
35
|
+
|
36
|
+
Keep in mind that stay_classy only targets plain HTML tags, not embedded Ruby.
|
37
|
+
|
38
|
+
You can also specify the directories you want to target. When prompted to enter the directories you wish to target simply type in the name. For example, to apply stay_classy to only app/views/posts and app/views/shared, type posts shared when asked which directories to target.
|
39
|
+
|
40
|
+
If you don't specify directories within your app/views folder all directories and files within app/views will be targeted by stay_classy
|
41
|
+
|
42
|
+
## Contributing
|
43
|
+
|
44
|
+
1. Fork it ( https://github.com/[my-github-username]/stay_classy/fork )
|
45
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
46
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
47
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
48
|
+
5. Create a new Pull Request
|
data/Rakefile
ADDED
data/bin/stay_classy
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require_relative '../lib/stay_classy'
|
3
|
+
|
4
|
+
puts "Enter the prefix you want to use (e.g. foo for foo_div):"
|
5
|
+
STDOUT.flush
|
6
|
+
|
7
|
+
prefix = gets.chomp
|
8
|
+
|
9
|
+
puts "\nEnter the directories you want to make classy within your views directory\nFor example: users posts orders \n*** If you don't enter a directory stay_classy will target every file in app/views recursively ***"
|
10
|
+
STDOUT.flush
|
11
|
+
|
12
|
+
dirs = gets.chomp
|
13
|
+
directories = dirs.split(' ')
|
14
|
+
|
15
|
+
@stay_classy = StayClassy::Builder.new( options = { :prefix => prefix, :dirs => directories } )
|
16
|
+
|
17
|
+
if @stay_classy && @stay_classy.instance_variable_get( :@view_directories ).count == 0
|
18
|
+
printf "\n No directories found. If you were a man I would punch you! \n".yellow
|
19
|
+
elsif @stay_classy
|
20
|
+
StayClassyProcess.process( @stay_classy )
|
21
|
+
else
|
22
|
+
p "Something has gone terribly wrong"
|
23
|
+
end
|
@@ -0,0 +1,158 @@
|
|
1
|
+
require 'tempfile'
|
2
|
+
require 'fileutils'
|
3
|
+
|
4
|
+
module StayClassyProcess
|
5
|
+
|
6
|
+
# Once you've built an instance of stay_classy, it's time to hand it over to the channel 6 news team.
|
7
|
+
def process( stay_classy )
|
8
|
+
|
9
|
+
# I don't know if you heard me counting but I can do over a thousand
|
10
|
+
@id_counter = 0
|
11
|
+
|
12
|
+
@prefix = stay_classy.instance_variable_get( :@prefix )
|
13
|
+
view_dirs = stay_classy.instance_variable_get( :@view_directories )
|
14
|
+
|
15
|
+
printf "\nDirectories to make classy with prefix #{ @prefix }: \n".colorize( :yellow )
|
16
|
+
view_dirs.map { |vd| printf "#{ vd }\n" }
|
17
|
+
|
18
|
+
# Send the right files to the news team...
|
19
|
+
printf "\nFiles to make classy: \n".colorize( :yellow )
|
20
|
+
view_dirs.each do |vd|
|
21
|
+
Dir.foreach( vd ) do |file|
|
22
|
+
# Send each file in each file in the directory to each member of the news team
|
23
|
+
begin
|
24
|
+
@errors = []
|
25
|
+
|
26
|
+
if file.match( StayClassy::Builder::VIEW_FILE_TYPES_REGEX )
|
27
|
+
|
28
|
+
printf "#{ file }\n"
|
29
|
+
@view_directory = vd
|
30
|
+
|
31
|
+
# Strip the underscore from partials and get a clean file name to add to the classes
|
32
|
+
if file[0] == '_'
|
33
|
+
@file_identifier = file[ 1..-1 ].gsub( '.html', '' ).gsub( '.erb', '' )
|
34
|
+
else
|
35
|
+
@file_identifier = file.gsub( '.html', '' ).gsub( '.erb', '' )
|
36
|
+
end
|
37
|
+
|
38
|
+
# Brian Fantana for Sex Pantherization. He gets @filename for the rest of the team.
|
39
|
+
brian_fantana( file )
|
40
|
+
|
41
|
+
# Champ Kind takes @filename for sex and chicken
|
42
|
+
champ_kind( @filename )
|
43
|
+
|
44
|
+
# Puts @filename in a toaster...fantastic
|
45
|
+
brick_tamland( @filename )
|
46
|
+
|
47
|
+
end
|
48
|
+
|
49
|
+
rescue Exception => e
|
50
|
+
|
51
|
+
# Bark out those errors, Baxter. You know I don't speak Spanish.
|
52
|
+
baxter( e )
|
53
|
+
printf "#{ @errors }\n" if @errors.any?
|
54
|
+
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
end
|
60
|
+
|
61
|
+
############### LADIES AND GENTLEMEN, NEWS TEAM 6 ###############
|
62
|
+
|
63
|
+
|
64
|
+
# Brian Fantana - Get the bits of real panther so you know it's good (it opens the file)
|
65
|
+
def load_file( file )
|
66
|
+
begin
|
67
|
+
@filename = file
|
68
|
+
rescue Exception => e
|
69
|
+
baxter( e )
|
70
|
+
end
|
71
|
+
end
|
72
|
+
alias :brian_fantana :load_file
|
73
|
+
|
74
|
+
|
75
|
+
# Champ Kind - Slap some BBQ sauce on them elements and woo, woo, woo!!!!
|
76
|
+
def add_classes_to_file( filename )
|
77
|
+
|
78
|
+
path = "#{ @view_directory }#{ filename }"
|
79
|
+
temp_file = Tempfile.new( 'foo' )
|
80
|
+
|
81
|
+
begin
|
82
|
+
File.open( path, 'r' ) do |file|
|
83
|
+
file.each_line do |line|
|
84
|
+
temp_file.puts make_classy( line, @file_identifier )
|
85
|
+
end
|
86
|
+
end
|
87
|
+
temp_file.close
|
88
|
+
FileUtils.mv( temp_file.path, path )
|
89
|
+
rescue Exception => e
|
90
|
+
baxter( e )
|
91
|
+
ensure
|
92
|
+
temp_file.close
|
93
|
+
temp_file.unlink
|
94
|
+
end
|
95
|
+
|
96
|
+
end
|
97
|
+
alias :champ_kind :add_classes_to_file
|
98
|
+
|
99
|
+
|
100
|
+
# Brick Tamland - Invite the ids to the pants party
|
101
|
+
def add_ids_to_file( filename )
|
102
|
+
path = "#{ @view_directory }#{ filename }"
|
103
|
+
temp_file = Tempfile.new( 'foo' )
|
104
|
+
|
105
|
+
begin
|
106
|
+
File.open( path, 'r' ) do |file|
|
107
|
+
file.each_line do |line|
|
108
|
+
temp_file.puts show_me_your_id( line )
|
109
|
+
end
|
110
|
+
end
|
111
|
+
temp_file.close
|
112
|
+
FileUtils.mv( temp_file.path, path )
|
113
|
+
rescue Exception => e
|
114
|
+
baxter( e )
|
115
|
+
ensure
|
116
|
+
temp_file.close
|
117
|
+
temp_file.unlink
|
118
|
+
end
|
119
|
+
end
|
120
|
+
alias :brick_tamland :add_ids_to_file
|
121
|
+
|
122
|
+
|
123
|
+
########################### Errors ##############################
|
124
|
+
|
125
|
+
# Really doesn't need to be here. He just barks out errors
|
126
|
+
def error_notifier( exception )
|
127
|
+
@errors << exception
|
128
|
+
end
|
129
|
+
alias :baxter :error_notifier
|
130
|
+
|
131
|
+
|
132
|
+
########## THESE TWO ARE THE BRANS OF THIS OPERATION #############
|
133
|
+
|
134
|
+
def make_classy( line, file_identifier )
|
135
|
+
# TODO: should add file name to end of class
|
136
|
+
StayClassy::Builder::DEFAULT_CLASS_TAGS.each do |tag|
|
137
|
+
if line.include?( "<#{ tag }" ) && !line.include?( "class=" )
|
138
|
+
line = line.gsub( "<#{ tag }", "<#{ tag } class=\"#{ @prefix }#{ tag }_#{ file_identifier }\"" )
|
139
|
+
p line
|
140
|
+
end
|
141
|
+
end
|
142
|
+
return line
|
143
|
+
end
|
144
|
+
|
145
|
+
def show_me_your_id( line )
|
146
|
+
StayClassy::Builder::DEFAULT_ID_TAGS.each do |tag|
|
147
|
+
if line.include?( "<#{ tag }" ) && !line.include?( "id=" )
|
148
|
+
line = line.gsub( "<#{ tag }", "<#{ tag } id=\"#{ @prefix }#{ tag }_#{ @id_counter }\"" )
|
149
|
+
@id_counter += 1
|
150
|
+
p line
|
151
|
+
end
|
152
|
+
end
|
153
|
+
return line
|
154
|
+
end
|
155
|
+
|
156
|
+
###################################################################
|
157
|
+
|
158
|
+
end
|
data/lib/stay_classy.rb
ADDED
@@ -0,0 +1,89 @@
|
|
1
|
+
# require "classy/version"
|
2
|
+
|
3
|
+
#############################################################################
|
4
|
+
#
|
5
|
+
# |
|
6
|
+
# _____ ______ ____ __ __ | __ _ ____ _____ _____ __ __
|
7
|
+
# / ___/| | / || | | | / ]| | / |/ ___// ___/| | |
|
8
|
+
# ( \_ | || o || | |_|__ / / | | | o ( \_( \_ | | |
|
9
|
+
# \__ ||_| |_|| || ~ | | / / | |___ | |\__ |\__ || ~ |
|
10
|
+
# / \ | | | | _ ||___, | |/ \_ | || _ |/ \ |/ \ ||___, |__
|
11
|
+
# \ | | | | | || | |\ || || | |\ |\ || |
|
12
|
+
# \___| |__| |__|__||____/ | \____||_____||__|__| \___| \___||____/
|
13
|
+
# | | |_____ |
|
14
|
+
# ____| | | | San Diego....._________|____
|
15
|
+
# | | | | | | |
|
16
|
+
#############################################################################
|
17
|
+
|
18
|
+
STAY_CLASSY_PATH = File.dirname(__FILE__) + "/stay_classy/"
|
19
|
+
|
20
|
+
require STAY_CLASSY_PATH + "stay_classy_process"
|
21
|
+
require 'colorize'
|
22
|
+
require 'rails'
|
23
|
+
include StayClassyProcess
|
24
|
+
|
25
|
+
VIEWS_DIR = Rails.root.join( 'app', 'views' ).freeze
|
26
|
+
|
27
|
+
module StayClassy
|
28
|
+
class Builder
|
29
|
+
|
30
|
+
######## StayClassy will only look within the rails/app/views directory. Leave the rest to the channel 9 news team ########
|
31
|
+
VIEW_FILE_TYPES_REGEX = Regexp.union( /\.html\.erb$/ , /\.html$/ ).freeze
|
32
|
+
DEFAULT_CLASS_TAGS = %w( h1 h2 h3 h4 h5 h6 div table p li tr td ).freeze
|
33
|
+
DEFAULT_ID_TAGS = %w( p span ul ).freeze
|
34
|
+
|
35
|
+
def initialize( options )
|
36
|
+
begin
|
37
|
+
# Handle user-specified directories here
|
38
|
+
if !options[:dirs].empty?
|
39
|
+
|
40
|
+
directories = options[:dirs]
|
41
|
+
@view_directories = []
|
42
|
+
|
43
|
+
directories.each do |dir|
|
44
|
+
|
45
|
+
# Filter out the not so classy characters. No scotch or ribs for them. Banish them to a whale's vagina
|
46
|
+
dir = dir.gsub( /[^0-9a-z_-]/i, '' )
|
47
|
+
|
48
|
+
# Build an array of valid directories, kind of like a shelf of leather-bound books.
|
49
|
+
if valid_dir?( dir )
|
50
|
+
@view_directories << "#{ VIEWS_DIR }/#{ dir }"
|
51
|
+
else
|
52
|
+
printf "\n#{ VIEWS_DIR }/#{ dir } is not a valid directory. That's bush!\n".colorize( :red )
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
else
|
57
|
+
@view_directories = get_view_directories
|
58
|
+
end
|
59
|
+
|
60
|
+
######## Prefix for all classes/ids ########
|
61
|
+
options[:prefix] ? @prefix = set_prefix( options[:prefix].to_s ) : @prefix = 'classy_'
|
62
|
+
|
63
|
+
if options[:tags]
|
64
|
+
# TODO: Check if valid HTML tag
|
65
|
+
######## Handle tags passed in ########
|
66
|
+
end
|
67
|
+
|
68
|
+
rescue Exception => e
|
69
|
+
raise e
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
# Sixty percent of the time, valid directories will return true every time
|
74
|
+
def valid_dir?( directory )
|
75
|
+
Dir.exists?( "#{ VIEWS_DIR }/#{ directory }" )
|
76
|
+
end
|
77
|
+
|
78
|
+
# If no directories are specified, find every directory in the views folder recursively
|
79
|
+
def get_view_directories
|
80
|
+
Dir.glob( "#{ VIEWS_DIR }**/*/" ).select { |f| File.directory? f }
|
81
|
+
end
|
82
|
+
|
83
|
+
def set_prefix( prefix )
|
84
|
+
starter_string = prefix.gsub( /[^0-9a-z_-]/i, '' )
|
85
|
+
return "#{ starter_string }_"
|
86
|
+
end
|
87
|
+
|
88
|
+
end
|
89
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe "The stay_classy gem" do
|
4
|
+
describe "itself" do
|
5
|
+
it "should return the default stay_classy values if no options are given" do
|
6
|
+
# this should check a folder with a bunch of views
|
7
|
+
stay_classy = StayClassy::Builder.new( options = {} )
|
8
|
+
expect( stay_classy.instance_variable_get( :@view_directories ) ).to eq( [] )
|
9
|
+
end
|
10
|
+
|
11
|
+
it "should validate the directories passed in as options" do
|
12
|
+
stay_classy = StayClassy::Builder.new( options = { :dirs => [ 'home' , 'about();' , '&&contact' , '../../dookie' ] } )
|
13
|
+
expect( stay_classy.instance_variable_get( :@view_directories ) ).to eq( [] )
|
14
|
+
end
|
15
|
+
|
16
|
+
it "should use classy_ as a class prefix unless the user specifies one" do
|
17
|
+
stay_classy = StayClassy::Builder.new( options = {} )
|
18
|
+
expect( stay_classy.instance_variable_get( :@prefix ) ).to eq( 'classy_' )
|
19
|
+
end
|
20
|
+
|
21
|
+
it "should use the user supplied prefix if specified with an added underscore" do
|
22
|
+
stay_classy = StayClassy::Builder.new( options = { :prefix => 'testing_prefix' } )
|
23
|
+
expect( stay_classy.instance_variable_get( :@prefix ) ).to eq( 'testing_prefix_' )
|
24
|
+
end
|
25
|
+
|
26
|
+
it "should return an error message if there are no directories found" do
|
27
|
+
classy = StayClassy::Builder.new( options = { :dirs => [ 'bad_directory_1', '../bad_directory_2', '/home/users' ] } )
|
28
|
+
expect("No directories found. If you were a man I would punch you!")
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,102 @@
|
|
1
|
+
<h1>First header</h1>
|
2
|
+
<h2>Second header</h2>
|
3
|
+
<h3>Third header</h3>
|
4
|
+
<h4>Fourth header</h4>
|
5
|
+
<h5>Fifth header</h5>
|
6
|
+
<h6>Sixth header</h6>
|
7
|
+
<span>Spanny span, the span-tiffic plain</span>
|
8
|
+
<span class="span_class_already_there">Spanny span, the span-tiffic with class</span>
|
9
|
+
<span id="span_id_already_there">Spanny span, the span-tiffic with id</span>
|
10
|
+
|
11
|
+
<span>Spanny span, the span-tiffic<span> embedded span plain</span></span>
|
12
|
+
|
13
|
+
<table class="index">
|
14
|
+
<tbody id='line-items'>
|
15
|
+
<tr>
|
16
|
+
<%= hook :order_details_line_items_headers do %>
|
17
|
+
<th><%= t('item_description') %></th>
|
18
|
+
<th class="price"><%= t('price') %></th>
|
19
|
+
<th class="qty"><%= t('qty') %></th>
|
20
|
+
<th class="total"><span><%= t('total') %></span></th>
|
21
|
+
<% end %>
|
22
|
+
</tr>
|
23
|
+
|
24
|
+
<% @order.line_items.each do |item| %>
|
25
|
+
<tr>
|
26
|
+
<%- locals = {:item => item} %>
|
27
|
+
<%= hook :order_details_line_item_row, locals do %>
|
28
|
+
<td width="300"><%=item.variant.product.name%> <%= "(" + variant_options(item.variant) + ")" unless item.variant .option_values.empty? %></td>
|
29
|
+
<td class="price"><%= number_to_currency item.price %></td>
|
30
|
+
<td class="qty"><%=item.quantity%></td>
|
31
|
+
<td class="total"><span><%= number_to_currency (item.price * item.quantity)%></span></td>
|
32
|
+
<% end %>
|
33
|
+
</tr>
|
34
|
+
<% end if @order %>
|
35
|
+
</tbody>
|
36
|
+
<%= hook :order_details_subtotal do %>
|
37
|
+
<tbody id='subtotal'>
|
38
|
+
<tr class="total" id="subtotal-row">
|
39
|
+
<td colspan="3"><b><%= t('subtotal') %>:</b></td>
|
40
|
+
<td class="total"><span><%= number_to_currency( @order.item_total ) if @order %></span></td>
|
41
|
+
</tr>
|
42
|
+
</tbody>
|
43
|
+
<% end %>
|
44
|
+
<%= hook :order_details_adjustments do %>
|
45
|
+
<tbody id="order-charges">
|
46
|
+
<% @order.adjustments.each do |adjustment| %>
|
47
|
+
<tr class="total">
|
48
|
+
<td colspan="3"><strong><%= adjustment.label %></strong></td>
|
49
|
+
<td class="total"><span><%= number_to_currency adjustment.amount %></span></td>
|
50
|
+
</tr>
|
51
|
+
<% end if @order %>
|
52
|
+
</tbody>
|
53
|
+
<% end %>
|
54
|
+
<%= hook :order_details_total do %>
|
55
|
+
<tbody id='order-total'>
|
56
|
+
<tr class="total">
|
57
|
+
<td colspan="3"><b><%= t('order_total') %>:</b></td>
|
58
|
+
<td class="total"><span id="order_total"><%= number_to_currency( @order.total ) if @order %></span></td>
|
59
|
+
</tr>
|
60
|
+
</tbody>
|
61
|
+
<% end %>
|
62
|
+
</table>
|
63
|
+
|
64
|
+
<h2><%= accurate_title %></h2>
|
65
|
+
|
66
|
+
<div id="order">
|
67
|
+
<% if params.has_key? :checkout_complete %>
|
68
|
+
<h3><%= t('thank_you_for_your_order') %></h3>
|
69
|
+
<% end %>
|
70
|
+
<%= render :partial => 'shared/order_details', :locals => {:order => @order} %>
|
71
|
+
<p>
|
72
|
+
<%= link_to t('back_to_store'), root_path %>
|
73
|
+
<% unless params.has_key? :checkout_complete %>
|
74
|
+
| <%= link_to t('my_account'), account_path if current_user%>
|
75
|
+
<% end %>
|
76
|
+
</p>
|
77
|
+
</div>
|
78
|
+
|
79
|
+
<table>
|
80
|
+
<tr>
|
81
|
+
<td>Title</td>
|
82
|
+
<td><%= f.text_field :name -%></td>
|
83
|
+
</tr>
|
84
|
+
<tr>
|
85
|
+
<td>Description</td>
|
86
|
+
<td><%= f.text_area :description -%></td>
|
87
|
+
</tr>
|
88
|
+
<tr>
|
89
|
+
<td>Icon</td>
|
90
|
+
<td><%= f.file_field :icon -%></td>
|
91
|
+
</tr>
|
92
|
+
<tr>
|
93
|
+
<td>Existing Icon</td>
|
94
|
+
<td>
|
95
|
+
<%= image_tag @brand.icon(:normal) %>
|
96
|
+
</td>
|
97
|
+
</tr>
|
98
|
+
</table>
|
99
|
+
<%= link_to( 'test_link', '/' ) %>
|
100
|
+
<%= link_to( 'test_link', '/', :class => 'test_link_class_already_there' ) %>
|
101
|
+
<%= link_to( 'test_link', '/', class: 'test_link_class_already_there_new_syntax' ) %>
|
102
|
+
<%= link_to( 'test_link', '/', :id => 'test_link_id_already_there' ) %>
|
data/stay_classy.gemspec
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'stay_classy/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "stay_classy"
|
8
|
+
spec.version = '0.1.1'
|
9
|
+
spec.authors = ["Nick Mueller"]
|
10
|
+
spec.email = ["nickmueller@live.com"]
|
11
|
+
spec.summary = %q{Add classes and ids to your rails app}
|
12
|
+
spec.description = %q{This gem adds classes and ids to the view files and partials in your rails application}
|
13
|
+
spec.homepage = "https://github.com/nickmlr/stay_classy"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0")
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.bindir = 'bin'
|
19
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
20
|
+
spec.require_paths = ["lib", "bin"]
|
21
|
+
|
22
|
+
spec.add_dependency 'colorize'
|
23
|
+
spec.add_dependency 'rails'
|
24
|
+
|
25
|
+
spec.add_development_dependency "bundler", "~> 1.7"
|
26
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
27
|
+
spec.add_development_dependency "rspec"
|
28
|
+
end
|
data/stay_classy.rspec
ADDED
metadata
ADDED
@@ -0,0 +1,134 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: stay_classy
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Nick Mueller
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-10-06 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: colorize
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rails
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: bundler
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '1.7'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '1.7'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rake
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '10.0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '10.0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rspec
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
description: This gem adds classes and ids to the view files and partials in your
|
84
|
+
rails application
|
85
|
+
email:
|
86
|
+
- nickmueller@live.com
|
87
|
+
executables:
|
88
|
+
- stay_classy
|
89
|
+
extensions: []
|
90
|
+
extra_rdoc_files: []
|
91
|
+
files:
|
92
|
+
- ".gitignore"
|
93
|
+
- Gemfile
|
94
|
+
- LICENSE.txt
|
95
|
+
- README.md
|
96
|
+
- Rakefile
|
97
|
+
- bin/stay_classy
|
98
|
+
- lib/stay_classy.rb
|
99
|
+
- lib/stay_classy/stay_classy_process.rb
|
100
|
+
- lib/stay_classy/version.rb
|
101
|
+
- spec/spec_helper.rb
|
102
|
+
- spec/stay_classy_spec.rb
|
103
|
+
- spec/test_files/test_file.html.erb
|
104
|
+
- stay_classy.gemspec
|
105
|
+
- stay_classy.rspec
|
106
|
+
homepage: https://github.com/nickmlr/stay_classy
|
107
|
+
licenses:
|
108
|
+
- MIT
|
109
|
+
metadata: {}
|
110
|
+
post_install_message:
|
111
|
+
rdoc_options: []
|
112
|
+
require_paths:
|
113
|
+
- lib
|
114
|
+
- bin
|
115
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
116
|
+
requirements:
|
117
|
+
- - ">="
|
118
|
+
- !ruby/object:Gem::Version
|
119
|
+
version: '0'
|
120
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
125
|
+
requirements: []
|
126
|
+
rubyforge_project:
|
127
|
+
rubygems_version: 2.2.2
|
128
|
+
signing_key:
|
129
|
+
specification_version: 4
|
130
|
+
summary: Add classes and ids to your rails app
|
131
|
+
test_files:
|
132
|
+
- spec/spec_helper.rb
|
133
|
+
- spec/stay_classy_spec.rb
|
134
|
+
- spec/test_files/test_file.html.erb
|