innetra-easy_generators 1.2 → 1.3

Sign up to get free protection for your applications and to get access to all the features.
data/Manifest CHANGED
@@ -1,10 +1,16 @@
1
1
  Manifest
2
2
  generators/easy_layout/templates/stylesheets/sass/application.sass
3
+ generators/easy_layout/templates/stylesheets/sass/template/init.sass
4
+ generators/easy_layout/templates/stylesheets/sass/template/default.sass
5
+ generators/easy_layout/templates/stylesheets/sass/default.sass
3
6
  generators/easy_layout/templates/helpers/layout_helper.rb
4
7
  generators/easy_layout/templates/helpers/shadowbox_helper.rb
8
+ generators/easy_layout/templates/helpers/search_helper.rb
5
9
  generators/easy_layout/templates/helpers/form_helper.rb
6
- generators/easy_layout/templates/images/body_bg.svg
7
- generators/easy_layout/templates/images/body_bg.png
10
+ generators/easy_layout/templates/design/head-background.svg
11
+ generators/easy_layout/templates/images/1px.gif
12
+ generators/easy_layout/templates/images/innetra-logo-small.png
13
+ generators/easy_layout/templates/images/head-background.png
8
14
  generators/easy_layout/templates/config/initializers/rails_teaks.rb
9
15
  generators/easy_layout/templates/layouts/application.haml
10
16
  generators/easy_layout/easy_layout_generator.rb
data/README.rdoc CHANGED
@@ -18,9 +18,9 @@ Create your application's layout (app/views/layout/application.haml):
18
18
 
19
19
  == Usage
20
20
 
21
- This gem is intended to be used with our base_template (http://gist.github.com/105548)
21
+ This gem is intended to be used with our base_template (http://gist.github.com/105723)
22
22
 
23
- rails -m http://gist.github.com/105548.txt your_app_name
23
+ rails -m http://gist.github.com/105723.txt your_app_name
24
24
 
25
25
  == License
26
26
 
data/Rakefile CHANGED
@@ -2,7 +2,7 @@ require 'rubygems'
2
2
  require 'rake'
3
3
  require 'echoe'
4
4
 
5
- Echoe.new('easy_generators', '1.2') do |e|
5
+ Echoe.new('easy_generators', '1.3') do |e|
6
6
  e.description = "Easy Generators for Rails"
7
7
  e.url = "http://github.com/innetra/haml_layout"
8
8
  e.author = "Ivan Torres"
@@ -2,15 +2,15 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{easy_generators}
5
- s.version = "1.2"
5
+ s.version = "1.3"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Ivan Torres"]
9
- s.date = %q{2009-05-14}
9
+ s.date = %q{2009-05-21}
10
10
  s.description = %q{Easy Generators for Rails}
11
11
  s.email = %q{mexpolk@gmail.com}
12
12
  s.extra_rdoc_files = ["README.rdoc", "lib/easy_generators.rb"]
13
- s.files = ["Manifest", "generators/easy_layout/templates/stylesheets/sass/application.sass", "generators/easy_layout/templates/helpers/layout_helper.rb", "generators/easy_layout/templates/helpers/shadowbox_helper.rb", "generators/easy_layout/templates/helpers/form_helper.rb", "generators/easy_layout/templates/images/body_bg.svg", "generators/easy_layout/templates/images/body_bg.png", "generators/easy_layout/templates/config/initializers/rails_teaks.rb", "generators/easy_layout/templates/layouts/application.haml", "generators/easy_layout/easy_layout_generator.rb", "README.rdoc", "Rakefile", "lib/easy_generators.rb", "easy_generators.gemspec"]
13
+ s.files = ["Manifest", "generators/easy_layout/templates/stylesheets/sass/application.sass", "generators/easy_layout/templates/stylesheets/sass/template/init.sass", "generators/easy_layout/templates/stylesheets/sass/template/default.sass", "generators/easy_layout/templates/stylesheets/sass/default.sass", "generators/easy_layout/templates/helpers/layout_helper.rb", "generators/easy_layout/templates/helpers/shadowbox_helper.rb", "generators/easy_layout/templates/helpers/search_helper.rb", "generators/easy_layout/templates/helpers/form_helper.rb", "generators/easy_layout/templates/design/head-background.svg", "generators/easy_layout/templates/images/1px.gif", "generators/easy_layout/templates/images/innetra-logo-small.png", "generators/easy_layout/templates/images/head-background.png", "generators/easy_layout/templates/config/initializers/rails_teaks.rb", "generators/easy_layout/templates/layouts/application.haml", "generators/easy_layout/easy_layout_generator.rb", "README.rdoc", "Rakefile", "lib/easy_generators.rb", "easy_generators.gemspec"]
14
14
  s.has_rdoc = true
15
15
  s.homepage = %q{http://github.com/innetra/haml_layout}
16
16
  s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Easy_generators", "--main", "README.rdoc"]
@@ -5,13 +5,21 @@ class EasyLayoutGenerator < Rails::Generator::Base
5
5
  # CSS rules for EasyNavigation
6
6
  m.directory("public/stylesheets/sass")
7
7
  m.file "stylesheets/sass/application.sass", "public/stylesheets/sass/application.sass"
8
+ m.file "stylesheets/sass/default.sass", "public/stylesheets/sass/default.sass"
9
+
10
+ m.directory("public/stylesheets/sass/template")
11
+ m.file "stylesheets/sass/template/default.sass", "public/stylesheets/sass/template/default.sass"
12
+ m.file "stylesheets/sass/template/init.sass", "public/stylesheets/sass/template/init.sass"
8
13
 
9
14
  m.directory("public/images")
10
- m.file "images/body_bg.png", "public/images/body_bg.png"
15
+ m.file "images/1px.gif", "public/images/1px.gif"
16
+ m.file "images/innetra-logo-small.png", "public/images/innetra-logo-small.png"
17
+ m.file "images/head-background.png", "public/images/head-background.png"
11
18
 
12
19
  m.directory("app/helpers")
13
20
  m.file "helpers/form_helper.rb", "app/helpers/form_helper.rb"
14
21
  m.file "helpers/layout_helper.rb", "app/helpers/layout_helper.rb"
22
+ m.file "helpers/search_helper.rb", "app/helpers/search_helper.rb"
15
23
  m.file "helpers/shadowbox_helper.rb", "app/helpers/shadowbox_helper.rb"
16
24
 
17
25
  m.directory("app/views/layouts")
@@ -48,3 +48,25 @@ module ActionView::Helpers::ActiveRecordHelper
48
48
  end
49
49
 
50
50
  end
51
+
52
+ # i18n support for form.labels
53
+ module ActionView::Helpers
54
+ class InstanceTag
55
+ def to_label_tag(text = nil, options = {})
56
+ options = options.stringify_keys
57
+ name_and_id = options.dup
58
+ add_default_name_and_id(name_and_id)
59
+ options.delete("index")
60
+ options["for"] ||= name_and_id["id"]
61
+ if text.blank?
62
+ content = method_name.humanize
63
+ if object.class.respond_to?(:human_attribute_name)
64
+ content = object.class.human_attribute_name(method_name)
65
+ end
66
+ else
67
+ content = text.to_s
68
+ end
69
+ label_tag(name_and_id["id"], content, options)
70
+ end
71
+ end
72
+ end
@@ -0,0 +1,223 @@
1
+ <?xml version="1.0" encoding="UTF-8" standalone="no"?>
2
+ <!-- Created with Inkscape (http://www.inkscape.org/) -->
3
+ <svg
4
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
5
+ xmlns:cc="http://creativecommons.org/ns#"
6
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
7
+ xmlns:svg="http://www.w3.org/2000/svg"
8
+ xmlns="http://www.w3.org/2000/svg"
9
+ xmlns:xlink="http://www.w3.org/1999/xlink"
10
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
11
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
12
+ width="744.09448819"
13
+ height="1052.3622047"
14
+ id="svg2"
15
+ sodipodi:version="0.32"
16
+ inkscape:version="0.46"
17
+ sodipodi:docname="head-background.svg"
18
+ inkscape:output_extension="org.inkscape.output.svg.inkscape">
19
+ <defs
20
+ id="defs4">
21
+ <linearGradient
22
+ id="linearGradient3316">
23
+ <stop
24
+ id="stop3318"
25
+ offset="0"
26
+ style="stop-color:#449cbe;stop-opacity:1;" />
27
+ <stop
28
+ id="stop3320"
29
+ offset="1"
30
+ style="stop-color:#257291;stop-opacity:1;" />
31
+ </linearGradient>
32
+ <linearGradient
33
+ id="linearGradient3304">
34
+ <stop
35
+ style="stop-color:#efefdf;stop-opacity:1;"
36
+ offset="0"
37
+ id="stop3306" />
38
+ <stop
39
+ style="stop-color:#ffffff;stop-opacity:1;"
40
+ offset="1"
41
+ id="stop3308" />
42
+ </linearGradient>
43
+ <linearGradient
44
+ id="linearGradient3189">
45
+ <stop
46
+ style="stop-color:#7397b5;stop-opacity:1;"
47
+ offset="0"
48
+ id="stop3191" />
49
+ <stop
50
+ style="stop-color:#3a566e;stop-opacity:1;"
51
+ offset="1"
52
+ id="stop3193" />
53
+ </linearGradient>
54
+ <inkscape:perspective
55
+ sodipodi:type="inkscape:persp3d"
56
+ inkscape:vp_x="0 : 526.18109 : 1"
57
+ inkscape:vp_y="0 : 1000 : 0"
58
+ inkscape:vp_z="744.09448 : 526.18109 : 1"
59
+ inkscape:persp3d-origin="372.04724 : 350.78739 : 1"
60
+ id="perspective10" />
61
+ <linearGradient
62
+ inkscape:collect="always"
63
+ xlink:href="#linearGradient3316"
64
+ id="linearGradient3195"
65
+ x1="-424"
66
+ y1="99.362183"
67
+ x2="-424"
68
+ y2="30.333202"
69
+ gradientUnits="userSpaceOnUse" />
70
+ <linearGradient
71
+ inkscape:collect="always"
72
+ xlink:href="#linearGradient3189"
73
+ id="linearGradient3254"
74
+ gradientUnits="userSpaceOnUse"
75
+ x1="-456.45401"
76
+ y1="13.485125"
77
+ x2="-456.45401"
78
+ y2="113.73999"
79
+ gradientTransform="matrix(6.25e-3,0,0,1,-869.74395,0)" />
80
+ <linearGradient
81
+ inkscape:collect="always"
82
+ xlink:href="#linearGradient3189"
83
+ id="linearGradient3286"
84
+ gradientUnits="userSpaceOnUse"
85
+ gradientTransform="matrix(6.25e-3,0,0,1,-869.74395,0)"
86
+ x1="-456.45401"
87
+ y1="13.485125"
88
+ x2="-456.45401"
89
+ y2="113.73999" />
90
+ <linearGradient
91
+ inkscape:collect="always"
92
+ xlink:href="#linearGradient3189"
93
+ id="linearGradient3290"
94
+ gradientUnits="userSpaceOnUse"
95
+ gradientTransform="matrix(6.25e-3,0,0,1.4,-869.74395,-5.402011)"
96
+ x1="-456.45401"
97
+ y1="13.485125"
98
+ x2="-456.45401"
99
+ y2="113.73999" />
100
+ <linearGradient
101
+ inkscape:collect="always"
102
+ xlink:href="#linearGradient3189"
103
+ id="linearGradient3314"
104
+ gradientUnits="userSpaceOnUse"
105
+ x1="-456.45401"
106
+ y1="13.485125"
107
+ x2="-456.45401"
108
+ y2="113.73999"
109
+ gradientTransform="translate(3,546)" />
110
+ <linearGradient
111
+ inkscape:collect="always"
112
+ xlink:href="#linearGradient3316"
113
+ id="linearGradient3333"
114
+ gradientUnits="userSpaceOnUse"
115
+ x1="-424"
116
+ y1="99.362183"
117
+ x2="-424"
118
+ y2="30.333202"
119
+ gradientTransform="matrix(6.25e-3,0,0,1.4,-916.7607,-0.4020111)" />
120
+ <linearGradient
121
+ inkscape:collect="always"
122
+ xlink:href="#linearGradient3189"
123
+ id="linearGradient3335"
124
+ gradientUnits="userSpaceOnUse"
125
+ gradientTransform="matrix(6.25e-3,0,0,1.4,-869.74395,-5.402011)"
126
+ x1="-456.45401"
127
+ y1="13.485125"
128
+ x2="-456.45401"
129
+ y2="113.73999" />
130
+ <linearGradient
131
+ inkscape:collect="always"
132
+ xlink:href="#linearGradient3189"
133
+ id="linearGradient3339"
134
+ gradientUnits="userSpaceOnUse"
135
+ gradientTransform="matrix(6.25e-3,0,0,1.4,-869.74395,-5.402011)"
136
+ x1="-456.45401"
137
+ y1="13.485125"
138
+ x2="-456.45401"
139
+ y2="113.73999" />
140
+ <linearGradient
141
+ inkscape:collect="always"
142
+ xlink:href="#linearGradient3316"
143
+ id="linearGradient2426"
144
+ gradientUnits="userSpaceOnUse"
145
+ gradientTransform="matrix(6.25e-3,0,0,1.4,-916.7607,-0.4020111)"
146
+ x1="-424"
147
+ y1="99.362183"
148
+ x2="-424"
149
+ y2="30.333202" />
150
+ <linearGradient
151
+ inkscape:collect="always"
152
+ xlink:href="#linearGradient3316"
153
+ id="linearGradient2430"
154
+ gradientUnits="userSpaceOnUse"
155
+ gradientTransform="matrix(1.25e-3,0,0,2,27.933602,8.494972)"
156
+ x1="-424"
157
+ y1="99.362183"
158
+ x2="-424"
159
+ y2="30.333202" />
160
+ </defs>
161
+ <sodipodi:namedview
162
+ id="base"
163
+ pagecolor="#ffffff"
164
+ bordercolor="#666666"
165
+ borderopacity="1.0"
166
+ gridtolerance="10000"
167
+ guidetolerance="10"
168
+ objecttolerance="10"
169
+ inkscape:pageopacity="0.0"
170
+ inkscape:pageshadow="2"
171
+ inkscape:zoom="0.5"
172
+ inkscape:cx="222.19939"
173
+ inkscape:cy="653.19412"
174
+ inkscape:document-units="px"
175
+ inkscape:current-layer="layer1"
176
+ showgrid="false"
177
+ inkscape:window-width="1280"
178
+ inkscape:window-height="725"
179
+ inkscape:window-x="0"
180
+ inkscape:window-y="25" />
181
+ <metadata
182
+ id="metadata7">
183
+ <rdf:RDF>
184
+ <cc:Work
185
+ rdf:about="">
186
+ <dc:format>image/svg+xml</dc:format>
187
+ <dc:type
188
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
189
+ <dc:title>body_bg</dc:title>
190
+ <dc:creator>
191
+ <cc:Agent>
192
+ <dc:title>Ivan Torres</dc:title>
193
+ </cc:Agent>
194
+ </dc:creator>
195
+ <dc:rights>
196
+ <cc:Agent>
197
+ <dc:title>Innetra Consultancy Services, S.C.</dc:title>
198
+ </cc:Agent>
199
+ </dc:rights>
200
+ <dc:publisher>
201
+ <cc:Agent>
202
+ <dc:title>Innetra Consultancy Services, S.C.</dc:title>
203
+ </cc:Agent>
204
+ </dc:publisher>
205
+ </cc:Work>
206
+ </rdf:RDF>
207
+ </metadata>
208
+ <g
209
+ inkscape:label="Layer 1"
210
+ inkscape:groupmode="layer"
211
+ id="layer1">
212
+ <rect
213
+ y="35.505028"
214
+ x="26.857178"
215
+ height="200"
216
+ width="1"
217
+ id="rect3331"
218
+ style="fill:url(#linearGradient2430);fill-opacity:1;stroke:none;stroke-width:5;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
219
+ inkscape:export-xdpi="90"
220
+ inkscape:export-ydpi="90"
221
+ inkscape:export-filename="/home/itorres/code/easy_generators/generators/easy_layout/templates/images/head-background.png" />
222
+ </g>
223
+ </svg>
@@ -5,19 +5,4 @@ module FormHelper
5
5
  content_tag :span, '*', :class => :required
6
6
  end
7
7
 
8
- # Give feedback if flash[:notice] or flash[:error] are present
9
- def feedback
10
- if flash.has_key?(:notice)
11
- shadowbox 'flash' do
12
- content_tag('div', content_tag('p', flash[:notice]), :class => 'notice')
13
- end
14
- end
15
-
16
- if flash.has_key?(:error)
17
- shadowbox 'flash' do
18
- content_tag('div', content_tag('p', flash[:error]), :class => 'error')
19
- end
20
- end
21
- end
22
-
23
8
  end
@@ -1,8 +1,28 @@
1
1
  module LayoutHelper
2
2
 
3
- # Change browsers title
4
- def title(page_title)
5
- content_for(:title) { page_title }
3
+ # Sets page title and browser title
4
+ def title(page_title = nil, &block)
5
+ content_for(:browser_title) { page_title } unless page_title.blank?
6
+ if block_given?
7
+ content_for(:title, capture(&block))
8
+ else
9
+ content_for(:title) { page_title }
10
+ end
11
+ end
12
+
13
+ # Give feedback if flash[:notice] or flash[:error] are present
14
+ def user_feedback()
15
+ message = ''
16
+ if flash.has_key?(:notice)
17
+ message = content_tag('div', content_tag('div', content_tag('p',
18
+ flash[:notice]), :class => 'content'), :id => 'flash')
19
+ elsif flash.has_key?(:error)
20
+ message = content_tag('div', content_tag('div', content_tag('p',
21
+ flash[:error]), :class => 'content'), :id => 'flash', :class => 'error')
22
+ else
23
+ message = content_tag('div', '', :id => 'flash')
24
+ end
25
+ message
6
26
  end
7
27
 
8
28
  end
@@ -0,0 +1,25 @@
1
+ module SearchHelper
2
+
3
+ def show_search_form(message = '', options = {})
4
+
5
+ config = { :controller_name => controller_name, :action_name => action_name, :method => request.request_method }
6
+ config[:controller_name] = options[:controller_name] if options.has_key?(:controller_name)
7
+ config[:action_name] = options[:action_name] if options.has_key?(:action_name)
8
+ config[:method] = options[:method] if options.has_key?(:method)
9
+
10
+ content = content_tag(:span, "Buscar" + tag('br') +
11
+ text_field_tag(:search, nil, :class => 'full_wide'), :class => 'big') + tag('br')
12
+
13
+ content << content_tag(:span, message, :class => 'comment') unless message.empty?
14
+
15
+ search_form = content_tag(:h1, content_tag(:form,
16
+ content_tag(:p, content), :id => 'search_form'))
17
+
18
+ search_form << observe_form('search_form',
19
+ :url => url_for(:controller => config[:controller_name],
20
+ :action => config[:action_name]), :method => config[:method],
21
+ :frequency => 0.5)
22
+
23
+ end
24
+
25
+ end
@@ -2,18 +2,22 @@
2
2
  !!! Strict
3
3
  %html{ :xmlns => "http://www.w3.org/1999/xhtml" }
4
4
  %head
5
- %title= "New Rails App - #{yield :title}"
6
- = stylesheet_link_tag :all, :media => :all
5
+ %title= "New Application - #{yield :browser_title}"
6
+ = stylesheet_link_tag :all
7
7
  = javascript_include_tag :all, :cache => true
8
8
  = yield :head
9
9
  %body
10
10
  #main
11
11
  #head
12
- .wrapper
13
- #toolbar
12
+ #toolbar
13
+ .wrapper
14
14
  = render 'sessions/session'
15
- #logo
16
- #navigation= easy_navigation :default
15
+ #title
16
+ .wrapper
17
+ = image_tag '/images/1px.gif'
18
+ %h1= yield :title
19
+ #navigation
20
+ .wrapper
21
+ = easy_navigation :default
17
22
  #content.wrapper
18
- - feedback
19
23
  = yield