spurs 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/README.rdoc ADDED
@@ -0,0 +1,27 @@
1
+ == Spurs
2
+
3
+
4
+ Rails is a web-application framework that includes everything needed to create
5
+ database-backed web applications according to the Model-View-Control pattern.
6
+
7
+ This pattern splits the view (also called the presentation) into "dumb"
8
+ templates that are primarily responsible for inserting pre-built data in between
9
+ HTML tags. The model contains the "smart" domain objects (such as Account,
10
+ Product, Person, Post) that holds all the business logic and knows how to
11
+ persist themselves to a database. The controller handles the incoming requests
12
+ (such as Save New Account, Update Product, Show Post) by manipulating the model
13
+ and directing data to the view.
14
+
15
+ In Rails, the model is handled by what's called an object-relational mapping
16
+ layer entitled Active Record. This layer allows you to present the data from
17
+ database rows as objects and embellish these data objects with business logic
18
+ methods. You can read more about Active Record in
19
+ link:files/vendor/rails/activerecord/README.html.
20
+
21
+ The controller and view are handled by the Action Pack, which handles both
22
+ layers by its two parts: Action View and Action Controller. These two layers
23
+ are bundled in a single package due to their heavy interdependence. This is
24
+ unlike the relationship between the Active Record and Action Pack that is much
25
+ more separate. Each of these packages can be used independently outside of
26
+ Rails. You can read more about Action Pack in
27
+ link:files/vendor/rails/actionpack/README.html.
@@ -12,7 +12,6 @@
12
12
  //
13
13
  //= require jquery
14
14
  //= require jquery_ujs
15
-
16
15
  //= require ./spurs/vars
17
16
  //= require ./spurs/flashes
18
17
  //= require ./spurs/sections
@@ -0,0 +1,144 @@
1
+ .subnav
2
+ width: 100%
3
+ height: 36px
4
+ background-color: #eeeeee
5
+ //Old browsers
6
+ background-repeat: repeat-x
7
+ // Repeat the gradient
8
+ background-image: -moz-linear-gradient(top, #f5f5f5 0%, #eeeeee 100%)
9
+ // FF3.6+
10
+ background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #f5f5f5), color-stop(100%, #eeeeee))
11
+ // Chrome,Safari4+
12
+ background-image: -webkit-linear-gradient(top, #f5f5f5 0%, #eeeeee 100%)
13
+ // Chrome 10+,Safari 5.1+
14
+ background-image: -ms-linear-gradient(top, #f5f5f5 0%, #eeeeee 100%)
15
+ // IE10+
16
+ background-image: -o-linear-gradient(top, #f5f5f5 0%, #eeeeee 100%)
17
+ // Opera 11.10+
18
+ filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#f5f5f5', endColorstr='#eeeeee',GradientType=0 )
19
+ // IE6-9
20
+ background-image: linear-gradient(top, #f5f5f5 0%, #eeeeee 100%)
21
+ // W3C
22
+ border: 1px solid #e5e5e5
23
+ -webkit-border-radius: 4px
24
+ -moz-border-radius: 4px
25
+ border-radius: 4px
26
+ .nav
27
+ margin-bottom: 0
28
+ >
29
+ li > a
30
+ margin: 0
31
+ padding-top: 11px
32
+ padding-bottom: 11px
33
+ border-left: 1px solid #f5f5f5
34
+ border-right: 1px solid #e5e5e5
35
+ -webkit-border-radius: 0
36
+ -moz-border-radius: 0
37
+ border-radius: 0
38
+ .active > a
39
+ padding-left: 13px
40
+ color: #777
41
+ background-color: #e9e9e9
42
+ border-right-color: #ddd
43
+ border-left: 0
44
+ -webkit-box-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.05)
45
+ -moz-box-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.05)
46
+ box-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.05)
47
+ &:hover
48
+ padding-left: 13px
49
+ color: #777
50
+ background-color: #e9e9e9
51
+ border-right-color: #ddd
52
+ border-left: 0
53
+ -webkit-box-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.05)
54
+ -moz-box-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.05)
55
+ box-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.05)
56
+ .caret, &:hover .caret
57
+ border-top-color: #777
58
+ li
59
+ &:first-child > a
60
+ border-left: 0
61
+ padding-left: 12px
62
+ -webkit-border-radius: 4px 0 0 4px
63
+ -moz-border-radius: 4px 0 0 4px
64
+ border-radius: 4px 0 0 4px
65
+ &:hover
66
+ border-left: 0
67
+ padding-left: 12px
68
+ -webkit-border-radius: 4px 0 0 4px
69
+ -moz-border-radius: 4px 0 0 4px
70
+ border-radius: 4px 0 0 4px
71
+ &:last-child > a
72
+ border-right: 0
73
+ .dropdown-menu
74
+ -webkit-border-radius: 0 0 4px 4px
75
+ -moz-border-radius: 0 0 4px 4px
76
+ border-radius: 0 0 4px 4px
77
+
78
+ // Fixed subnav on scroll, but only for 980px and up (sorry IE!)
79
+ @media (min-width: 980px)
80
+ .subnav-fixed
81
+ position: fixed
82
+ top: 40px
83
+ left: 0
84
+ right: 0
85
+ z-index: 999
86
+ border-color: #d5d5d5
87
+ border-width: 0 0 1px
88
+ // drop the border on the fixed edges
89
+ -webkit-border-radius: 0
90
+ -moz-border-radius: 0
91
+ border-radius: 0
92
+ -webkit-box-shadow: inset 0 1px 0 white, 0 1px 5px rgba(0, 0, 0, 0.1)
93
+ -moz-box-shadow: inset 0 1px 0 white, 0 1px 5px rgba(0, 0, 0, 0.1)
94
+ box-shadow: inset 0 1px 0 white, 0 1px 5px rgba(0, 0, 0, 0.1)
95
+ .nav
96
+ width: 938px
97
+ margin: 0 auto
98
+ padding: 0 1px
99
+ .subnav .nav > li:first-child > a
100
+ -webkit-border-radius: 0
101
+ -moz-border-radius: 0
102
+ border-radius: 0
103
+ &:hover
104
+ -webkit-border-radius: 0
105
+ -moz-border-radius: 0
106
+ border-radius: 0
107
+
108
+ // LARGE DESKTOP SCREENS
109
+ @media (min-width: 1210px)
110
+ // Update subnav container
111
+ .subnav-fixed .nav
112
+ width: 1168px
113
+ // 2px less to account for left/right borders being removed when in fixed mode
114
+
115
+ @media (max-width: 768px)
116
+ .subnav
117
+ margin: 5px
118
+ position: static
119
+ top: auto
120
+ z-index: auto
121
+ width: auto
122
+ height: auto
123
+ background: #fff /* whole background property since we use a background-image for gradient */
124
+ -webkit-box-shadow: none
125
+ -moz-box-shadow: none
126
+ box-shadow: none
127
+ .nav > li
128
+ float: none
129
+ a
130
+ border: 0
131
+ &:first-child > a, &:first-child > a:hover
132
+ -webkit-border-radius: 4px 4px 0 0
133
+ -moz-border-radius: 4px 4px 0 0
134
+ border-radius: 4px 4px 0 0
135
+
136
+ .responsive_nav
137
+ &.nav > li
138
+ float: none
139
+ a
140
+ border: 0
141
+ &:first-child > a, &:first-child > a:hover
142
+ -webkit-border-radius: 4px 4px 0 0
143
+ -moz-border-radius: 4px 4px 0 0
144
+ border-radius: 4px 4px 0 0
@@ -3,6 +3,7 @@
3
3
  display: table
4
4
  position: relative
5
5
  text-align: center
6
+ height: 100%
6
7
  &.full_width
7
8
  width: 100%
8
9
  > .middle
@@ -10,5 +10,6 @@
10
10
  *
11
11
  *= require_self
12
12
  *= require ./spurs/sections
13
+ *= require ./spurs/subnav
13
14
  *= require ./spurs/vcenter
14
15
  */
@@ -14,4 +14,5 @@ $('body')[0].appendChild(modal_container);
14
14
  modal_container.innerHTML = "<%= modal_container_content %>";
15
15
 
16
16
  <%-#activate the modal%>
17
- $(modal_container.children[0]).modal();
17
+ $(modal_container.children[0]).modal();
18
+ window._asd();
@@ -0,0 +1,13 @@
1
+ module Spurs
2
+ module Badge
3
+ module Helper
4
+ def spurs_badge(content, options={})
5
+ class_str ="badge"
6
+ if options[:type]
7
+ class_str.concat(" badge-#{options[:type]}")
8
+ end
9
+ content_tag(:span,content.html_safe,:class => class_str)
10
+ end
11
+ end
12
+ end
13
+ end
@@ -42,6 +42,7 @@ module Spurs
42
42
  content_tag(:div, alert_content.html_safe, :class => "alert alert-block #{extra_class}")
43
43
  end
44
44
 
45
+
45
46
  ##
46
47
  # Generate HTML for flash messages
47
48
  # = Examples
@@ -65,7 +66,7 @@ module Spurs
65
66
  end
66
67
  flash.clear
67
68
 
68
- #Rails.logger.info("MESSAGE HASH >>#{message_hash.to_json}")
69
+ Rails.logger.info("MESSAGE HASH >>#{message_hash.to_json}")
69
70
 
70
71
 
71
72
  #process the message hash now
@@ -10,28 +10,24 @@ module Spurs
10
10
  { :name => :save, :position => :right, :action => :submit_form_and_close_modal, :class => "btn-primary btn-large" },
11
11
  ]
12
12
  }.merge(options)
13
- logger.debug("spawn_form_modal options = #{opts.to_json}")
14
-
15
13
  spawn_modal(title, partial, object, opts)
16
14
  end
17
15
 
18
16
 
19
17
 
20
18
  def spawn_close_modal(title, file, options={ })
21
- opts[:content_options] = options
22
19
  opts = {
23
20
  :actions => [
24
21
  { :name => :cancel, :position => :left, :action => :close_modal, :class => "btn-large" }
25
22
  ]
26
23
  }.merge(options)
27
- logger.debug("spawn_close_modal options = #{opts.to_json}")
28
24
  spawn_modal(title, file, nil, opts)
29
25
  end
30
26
 
31
27
 
32
28
 
33
29
  def spawn_modal(title, partial, object, options={ })
34
- #options[:content_options] = options.clone
30
+
35
31
  opts = {
36
32
  :header => {
37
33
  :title => title.titlecase,
@@ -39,10 +35,10 @@ module Spurs
39
35
  },
40
36
 
41
37
  }.merge(options)
42
- logger.debug("spawn_modal options = #{opts.to_json}")
43
- render :file => "spurs/modals/spawn", :locals => { :modal_file_or_partial => partial,
44
- :modal_object => object,
45
- :modal_options => opts }
38
+
39
+ render :file => "spurs/modals/spawn", :locals => { :modal_file_or_partial => partial,
40
+ :modal_object => object,
41
+ :modal_options => opts }
46
42
  end
47
43
  end
48
44
  end
@@ -10,7 +10,7 @@ module Spurs
10
10
  modal_id = "modal_#{SecureRandom::hex(5)}"
11
11
 
12
12
  options_for_content = options[:content_options] ? options.delete(:content_options) : { }
13
-
13
+ logger.debug "ContentOptions: #{options_for_content}"
14
14
  if object == nil
15
15
  content = render :file => file_or_partial, :locals => options_for_content
16
16
  else
@@ -2,6 +2,8 @@ module Spurs
2
2
  module Nav
3
3
  class Builder
4
4
  include ActionView::Helpers::TagHelper
5
+ include ActionView::Helpers::ControllerHelper
6
+ include ActionView::Helpers::UrlHelper
5
7
 
6
8
  @@default_tab_options = {
7
9
  :icon_only => false
@@ -9,13 +11,15 @@ module Spurs
9
11
 
10
12
  @@default_dropdown_options = {
11
13
  :href => "#",
14
+ :method => :get,
12
15
  :icon_only => false
13
16
  }
14
17
 
15
18
  @args_from_helper
16
19
 
17
- def initialize(opts={ })
20
+ def initialize(controller, opts={ })
18
21
  @args_from_helper = opts.clone
22
+ assign_controller(controller)
19
23
  end
20
24
 
21
25
  # Create a tab
@@ -44,11 +48,13 @@ module Spurs
44
48
 
45
49
  end
46
50
 
47
- private
51
+ private
48
52
 
49
53
  def tab_tag(name, content_inside_a, content_inside_li=nil, options={ })
50
54
 
51
- if options.is_a?(Array) then raise "opts should be a hash! #{opts.to_json}" end
55
+ if options.is_a?(Array) then
56
+ raise "opts should be a hash! #{opts.to_json}"
57
+ end
52
58
 
53
59
  opts = @@default_tab_options.merge(@args_from_helper.merge(options))
54
60
 
@@ -70,18 +76,26 @@ module Spurs
70
76
  { :class => 'dropdown', 'data-dropdown' => :dropdown } :
71
77
  { }
72
78
 
79
+ if li_opts[:class] == nil then
80
+ li_opts[:class] = ""
81
+ end
82
+ if a_opts[:class] == nil then
83
+ a_opts[:class] = ""
84
+ end
85
+
73
86
  ## The icon for this tab
74
87
  if opts[:icon]
75
- display_name = if opts[:icon_only]
76
- content_tag_string(:i, nil, :class => "icon-#{opts[:icon].to_s}")
77
- else
78
- content_tag_string(:i, nil, :class => "icon-#{opts[:icon].to_s}").concat(display_name)
79
- end
88
+ if opts[:icon_only]
89
+ old_dn = display_name.clone
90
+ display_name = content_tag_string(:i, nil, :class => "icon-#{opts[:icon].to_s}")
91
+ #add the tooltip
92
+ li_opts[:class].concat(" has_tooltip ")
93
+ li_opts['data-original-title'] = old_dn
94
+ else
95
+ display_name = content_tag_string(:i, nil, :class => "icon-#{opts[:icon].to_s}").concat(display_name)
96
+ end
80
97
  end
81
98
 
82
- if li_opts[:class] == nil then li_opts[:class] = "" end
83
- if a_opts[:class] == nil then a_opts[:class] = "" end
84
-
85
99
 
86
100
  if opts[:dynamic] && (opts[:dropdown] == nil || opts[:dropdown] == false)
87
101
  a_opts['data-toggle'] = :tab
@@ -91,6 +105,9 @@ module Spurs
91
105
  # Process :href and :onclick
92
106
  if opts[:href] then
93
107
  a_opts[:href] = opts[:href]
108
+ if opts[:method] then
109
+ a_opts[:method] = opts[:method]
110
+ end
94
111
  end
95
112
  if opts[:onclick]
96
113
  a_opts[:onclick] = opts[:onclick]
@@ -98,9 +115,12 @@ module Spurs
98
115
  a_opts[:href] = "#"
99
116
  end
100
117
  end
118
+ if opts[:confirm] then
119
+ a_opts[:confirm] = opts[:confirm]
120
+ end
101
121
 
102
122
 
103
- # process active option
123
+ # process active option
104
124
  if opts[:active] != nil
105
125
  is_active = nil
106
126
  # check to see if many conditions are specified
@@ -114,7 +134,7 @@ module Spurs
114
134
  condition_found = true
115
135
  end
116
136
  else
117
- if process_controller_active_condition(a)
137
+ if process_controller_action_active_condition(a)
118
138
  condition_found = true
119
139
  end
120
140
  end
@@ -150,13 +170,16 @@ module Spurs
150
170
  display_name = display_name.concat(content_inside_a)
151
171
  end
152
172
 
153
- a_content = content_tag_string(:a, display_name.html_safe, a_opts)
154
- #Rails.logger.debug("a_hash #{a_opts}\t#{a_content}")
155
- # the <a> tag goes in the <li>
173
+ link_dest = a_opts[:href] ? a_opts.delete(:href) : "#"
174
+ a_content = link_to(display_name.html_safe, link_dest, a_opts) #content_tag_string(:a, display_name.html_safe, a_opts)
175
+ #Rails.logger.debug("a_hash #{a_opts}\t#{a_content}")
176
+ # the <a> tag goes in the <li>
156
177
  li_content = a_content
157
178
  if content_inside_li # is there extra stuff to throw in there?
158
179
  li_content = li_content.concat(content_inside_li)
159
180
  end
181
+
182
+
160
183
  content_tag_string(:li, li_content, li_opts)
161
184
  end
162
185
 
@@ -166,14 +189,14 @@ module Spurs
166
189
  end
167
190
  menu_items = ""
168
191
  dat.each do |item|
169
- display_name = if item[:label] then
170
- item[:label]
171
- else
172
- item[:id] ? item[:id].to_s.titlecase : "No Name"
173
- end
192
+ display_name = if item[:label] then
193
+ item[:label]
194
+ else
195
+ item[:id] ? item[:id].to_s.titlecase : "No Name"
196
+ end
174
197
  item[:dropdown] = false
175
198
 
176
- menu_items.concat(tab_tag(display_name, nil, nil, item.merge({:toggle => :none})))
199
+ menu_items.concat(tab_tag(display_name, nil, nil, item.merge({ :toggle => :none })))
177
200
  end
178
201
  menu = content_tag_string(:ul, menu_items.html_safe, :class => "dropdown-menu")
179
202
  return menu
@@ -23,7 +23,7 @@ module Spurs
23
23
  opts[:type] = :tabs
24
24
  end
25
25
 
26
- nav_builder = opts[:builder].new(opts_to_pass_to_builder)
26
+ nav_builder = opts[:builder].new(controller,opts_to_pass_to_builder)
27
27
 
28
28
  output = capture(nav_builder, &block)
29
29
 
@@ -12,7 +12,7 @@ module Spurs
12
12
  options_to_pass_to_builder = {}
13
13
  builder = opts[:builder].new(options_to_pass_to_builder)
14
14
  section_content = capture(nil,&block)
15
- builder.build_collapsible_section(title,section_content)
15
+ builder.build_collapsible_section(title.html_safe,section_content.html_safe)
16
16
  end
17
17
 
18
18
  def spurs_vcenter(options={}, &block)
data/lib/spurs/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Spurs
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
data/lib/spurs.rb CHANGED
@@ -16,11 +16,13 @@ require "spurs/flash"
16
16
  require "spurs/nav"
17
17
  require "spurs/section"
18
18
  require "spurs/engine"
19
+ require "spurs/badge"
19
20
 
20
21
  ActionView::Base.send :include, Spurs::Flash::Helper
21
22
  ActionView::Base.send :include, Spurs::Nav::Helper
22
23
  ActionView::Base.send :include, Spurs::Section::Helper
23
24
  ActionView::Base.send :include, Spurs::Modal::Helper
25
+ ActionView::Base.send :include, Spurs::Badge::Helper
24
26
 
25
27
  ActionController::Base.send :include, Spurs::Flash::ControllerMods
26
28
  ActionController::Base.send :include, Spurs::Modal::ControllerMods
File without changes
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spurs
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-05-09 00:00:00.000000000 Z
12
+ date: 2012-05-14 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -96,6 +96,7 @@ files:
96
96
  - app/assets/stylesheets/spurs/jquery_ui_theme/jquery-ui-1.8.16.custom.css
97
97
  - app/assets/stylesheets/spurs/jquery_ui_theme/jquery.ui.1.8.16.ie.css
98
98
  - app/assets/stylesheets/spurs/sections.css.sass
99
+ - app/assets/stylesheets/spurs/subnav.sass
99
100
  - app/assets/stylesheets/spurs/vcenter.css.sass
100
101
  - app/assets/stylesheets/spurs.css
101
102
  - app/controllers/spurs/application_controller.rb
@@ -107,6 +108,7 @@ files:
107
108
  - app/views/spurs/modals/spawn.js.erb
108
109
  - config/locales/en.yml
109
110
  - config/routes.rb
111
+ - lib/spurs/badge.rb
110
112
  - lib/spurs/engine.rb
111
113
  - lib/spurs/flash/builder.rb
112
114
  - lib/spurs/flash/controller_mods.rb
@@ -130,7 +132,7 @@ files:
130
132
  - lib/tasks/spurs_tasks.rake
131
133
  - MIT-LICENSE
132
134
  - Rakefile
133
- - README.markdown
135
+ - README.rdoc
134
136
  - test/dummy/app/assets/javascripts/application.js
135
137
  - test/dummy/app/assets/stylesheets/application.css
136
138
  - test/dummy/app/controllers/application_controller.rb
@@ -152,6 +154,7 @@ files:
152
154
  - test/dummy/config/locales/en.yml
153
155
  - test/dummy/config/routes.rb
154
156
  - test/dummy/config.ru
157
+ - test/dummy/log/test.log
155
158
  - test/dummy/public/404.html
156
159
  - test/dummy/public/422.html
157
160
  - test/dummy/public/500.html
@@ -176,12 +179,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
176
179
  - - ! '>='
177
180
  - !ruby/object:Gem::Version
178
181
  version: '0'
182
+ segments:
183
+ - 0
184
+ hash: 1151912235834294858
179
185
  required_rubygems_version: !ruby/object:Gem::Requirement
180
186
  none: false
181
187
  requirements:
182
188
  - - ! '>='
183
189
  - !ruby/object:Gem::Version
184
190
  version: '0'
191
+ segments:
192
+ - 0
193
+ hash: 1151912235834294858
185
194
  requirements: []
186
195
  rubyforge_project:
187
196
  rubygems_version: 1.8.24
@@ -210,6 +219,7 @@ test_files:
210
219
  - test/dummy/config/locales/en.yml
211
220
  - test/dummy/config/routes.rb
212
221
  - test/dummy/config.ru
222
+ - test/dummy/log/test.log
213
223
  - test/dummy/public/404.html
214
224
  - test/dummy/public/422.html
215
225
  - test/dummy/public/500.html
data/README.markdown DELETED
@@ -1,118 +0,0 @@
1
- # Spurs
2
-
3
- Spurs is a library that adds some bells and whistles to the Twitter Bootstrap GUI framework. I consists mostly of helpers and javascript, and thus is ORM agnostic.
4
-
5
- ## Flash Messages
6
-
7
- Put this in your layout file wherever you want to render the flash messages
8
-
9
- <%= spurs_flash_helper %>
10
-
11
- and flash messages will be automatically rendered on page loads
12
-
13
- ### From the rails side
14
-
15
- By default, you can create four types of messages
16
-
17
- flash_addItem(:notices,"A message about something successfully happening!")
18
- flash_addItem(:warnings, "Something is unusual, but not absolutely critical")
19
- flash_addItem(:errors, "Something critical has happened")
20
- flash_addItem(:infos, "Here's some information")
21
-
22
- You can also create multiple messages for each type
23
-
24
- flash_addItem(:errors, "Problem validating phone number")
25
- flash_addItem(:errors, "Problem validating street address")
26
-
27
- ### From the javascript side
28
-
29
- You can also create matching flash messages via javascript
30
-
31
- spurs.flash.alert("Something has gone wrong!","error");
32
-
33
- for the singular versions of each of the four types above ("info", "warning", "error", "notice")
34
-
35
- ## Navigation
36
-
37
- Spurs makes creation of bootstrap navigation easy!.
38
-
39
- spurs_nav :type => :pills do |nav|
40
-
41
- # a simple nav item as a regular link
42
- nav.tab :user, :icon => :user, :href => "#user"
43
-
44
- # a nav item that runs some javascript
45
- nav.tab :settings, :icon => :cog, :onclick => "alert('hello');"
46
-
47
- # a nav item that only shows its icon (not its name)
48
- nav.tab :secure, :icon => :lock, :icon_only => true
49
-
50
- # a dropdown menu with two actions
51
- nav.dropdown :menu,
52
- :icon => :cog,
53
- :icon_only => true,
54
- :actions => [ {:name => "one", :icon => :plus, :href => "#one"},
55
- {:name => "two", :icon => :minus, :href => "#two"}]
56
-
57
- will generate a menu like this...
58
-
59
- ![image](https://github.com/TrueNorth/spurs/raw/master/docs/img/pic1.png)
60
-
61
- or in HTML...
62
-
63
- <ul class="nav nav-pills ">
64
- <li>
65
- <a href="#user">
66
- <i class="icon-user"></i>User
67
- </a>
68
- </li>
69
- <li>
70
- <a onclick="alert('hello');">
71
- <i class="icon-cog"></i>Settings
72
- </a>
73
- </li>
74
- <li>
75
- <a>
76
- <i class="icon-lock"></i>Secure
77
- </a>
78
- </li>
79
- <li class="dropdown" data-dropdown="dropdown">
80
- <a class="dropdown-toggle" data-toggle="dropdown">
81
- <i class="icon-cog"></i>
82
- <b class="caret"></b>
83
- </a>
84
- <ul class="dropdown-menu">
85
- <li>
86
- <a href="#one">
87
- <i class="icon-plus"></i>No Name
88
- </a>
89
- </li>
90
- <li>
91
- <a href="#two">
92
- <i class="icon-minus"></i>No Name
93
- </a>
94
- </li>
95
- </ul>
96
- </li>
97
- </ul>
98
-
99
- You can specify some active criteria for menu items
100
-
101
- spurs_nav :type => :pills do |nav|
102
-
103
- # force this to be active with a boolean
104
- nav.tab :user, :icon => :user, :href => "#user",
105
- :active => true
106
-
107
- # controller criteria (if controller_name == :settings)
108
- nav.tab :settings, :icon => :cog, :onclick => "alert('hello');",
109
- :active => {:controller => :settings}
110
-
111
- # controller and action criteria (if controller_name == :settings && action_name == ;edit)
112
- nav.tab :settings, :icon => :cog, :onclick => "alert('hello');",
113
- :active => {:controller => :settings, :action => :edit}
114
-
115
- # multiple controller/action criteria (if (controller_name == :settings && action_name == :edit) || (controller_name == :user && action_name == :edit)
116
- nav.tab :settings, :icon => :cog, :onclick => "alert('hello');",
117
- :active => [{:controller => :settings, :action => :edit},
118
- {:controller => :users, :action => :edit}]