semantic-ui-sass 0.9.0.0 → 0.9.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 35b3961f69dee7e7f7aa8635590d477209d8a2a7
4
- data.tar.gz: be240fff8f70d9d6dcf9269b73aa5e5ea5f76b83
3
+ metadata.gz: 1f6721e42b2d39acbdb767aba2723c578aa985af
4
+ data.tar.gz: 1a6ef012cb476b5c114fc326efef12b9d3e9984e
5
5
  SHA512:
6
- metadata.gz: 9b12c2710daed2dd83dcaaec689697a8e355ea03a3cbb9a63da710544cad37448ef14aa69999385f6758316a72bfc6dfee7590b57b7858d25e8a2690a0f1feee
7
- data.tar.gz: fc103b3f4a3945dcf9b9f0926da0a899c32385f226d00a417653c0f18e82506106e01c6ffef46095e0f1a99ef1303eb68fae507c4680f7471771a3ef9d05ff7b
6
+ metadata.gz: 535b32680d4654f4682a854518ad75ac1b3c04beeb6e033bfb979e306066e27098410932dda4b2a1a46280b64b08887fc968c34617a93cd9b29eca2bcf4aea31
7
+ data.tar.gz: 4de111fe02303455747eaa037cbb46cdd9c76349d5a334129d224520ac5938081760c3179a1b854d2439ba890fb16a38a1277bb2c45fa8f96f162b72f49007eb
data/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ ## 0.9.1.0
2
+
3
+ * Update Semantic UI to 0.9.1
4
+
5
+ * Add breadcrumbs helper
6
+
1
7
  ## 0.9.0.0
2
8
 
3
9
  * Update Semantic UI to 0.9.0
data/README.md CHANGED
@@ -5,7 +5,7 @@
5
5
  ## Installation and Usage
6
6
 
7
7
  ```ruby
8
- gem 'semantic-ui-sass', '~> 0.9.0.0'
8
+ gem 'semantic-ui-sass', '~> 0.9.1.0'
9
9
  ```
10
10
  or
11
11
 
@@ -83,6 +83,31 @@ compass install semantic-ui
83
83
 
84
84
  # Rails Helpers
85
85
 
86
+ ## Breadcrumbs helper
87
+
88
+ Add breadcrumbs helper `<%= render_breadcrumbs %>` to your layout.
89
+
90
+ ```ruby
91
+ class ApplicationController
92
+ add_breadcrumb :index, :root_path
93
+ end
94
+ ```
95
+
96
+ ```ruby
97
+ class ExamplesController < ApplicationController
98
+ add_breadcrumb :index, :examples_path
99
+
100
+ def index
101
+ end
102
+
103
+ def show
104
+ @example = Example.find params[:id]
105
+ add_breadcrumb @example.name, example_path(@example)
106
+ # add_breadcrumb :show, example_path(@example)
107
+ end
108
+ end
109
+ ```
110
+
86
111
  ## Flash helper
87
112
 
88
113
  Add flash helper `<%= semantic_flash %>` to your layout
@@ -121,7 +121,7 @@ $.fn.accordion = function(parameters) {
121
121
  var
122
122
  $activeTitle = $title.eq(index),
123
123
  $activeContent = $activeTitle.next($content),
124
- $previousTitle = $title.filter('.' + className.active),
124
+ $previousTitle = $activeTitle.siblings(selector.title).filter('.' + className.active),
125
125
  $previousContent = $previousTitle.next($title),
126
126
  contentIsOpen = ($previousTitle.size() > 0)
127
127
  ;
@@ -177,7 +177,7 @@ $.fn.accordion = function(parameters) {
177
177
  $activeTitle = $title.eq(index),
178
178
  $activeContent = $activeTitle.next($content)
179
179
  ;
180
- module.debug('Closing accordion content', $activeTitle);
180
+ module.debug('Closing accordion content', $activeContent);
181
181
  $activeTitle
182
182
  .removeClass(className.active)
183
183
  ;
@@ -15,7 +15,6 @@ $.fn.popup = function(parameters) {
15
15
  var
16
16
  $allModules = $(this),
17
17
  $document = $(document),
18
- $body = $('body'),
19
18
 
20
19
  moduleSelector = $allModules.selector || '',
21
20
 
@@ -45,6 +44,7 @@ $.fn.popup = function(parameters) {
45
44
  moduleNamespace = 'module-' + namespace,
46
45
 
47
46
  $module = $(this),
47
+ $context = $(settings.context),
48
48
  $target = (settings.target)
49
49
  ? $(settings.target)
50
50
  : $module,
@@ -173,7 +173,7 @@ $.fn.popup = function(parameters) {
173
173
  else {
174
174
  module.verbose('Appending popup element to body', $popup);
175
175
  $popup
176
- .appendTo( $body )
176
+ .appendTo( $context )
177
177
  ;
178
178
  }
179
179
  $.proxy(settings.onCreate, $popup)();
@@ -239,7 +239,7 @@ $.fn.popup = function(parameters) {
239
239
  return ( $popup.size() !== 0 );
240
240
  }
241
241
  else {
242
- return ( $popup.parent($body).size() );
242
+ return ( $popup.parent($context).size() );
243
243
  }
244
244
  },
245
245
 
@@ -757,6 +757,7 @@ $.fn.popup.settings = {
757
757
  target : false,
758
758
  closable : true,
759
759
 
760
+ context : 'body',
760
761
  position : 'top center',
761
762
  delay : 150,
762
763
  inline : false,
@@ -13,7 +13,8 @@
13
13
  Accordion
14
14
  *******************************/
15
15
 
16
- .ui.accordion {
16
+ .ui.accordion,
17
+ .ui.accordion .accordion {
17
18
  width: 600px;
18
19
  max-width: 100%;
19
20
  overflow: hidden;
@@ -150,6 +151,7 @@
150
151
  Fluid
151
152
  ---------------*/
152
153
 
153
- .ui.fluid.accordion {
154
+ .ui.fluid.accordion,
155
+ .ui.fluid.accordion .accordion {
154
156
  width: 100%;
155
157
  }
@@ -0,0 +1,10 @@
1
+ module SemanticBreadcrumbsHelper
2
+ def render_breadcrumbs(divider = '/', &block)
3
+ content = render :partial => 'semantic/breadcrumbs', :layout => false, :locals => { :divider => divider }
4
+ if block_given?
5
+ capture(content, &block)
6
+ else
7
+ content
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,12 @@
1
+ <% if @breadcrumbs.present? %>
2
+ <% separator = divider %>
3
+ <div class="ui breadcrumb">
4
+ <% @breadcrumbs[0..-2].each do |crumb| %>
5
+ <%= link_to crumb[:name], crumb[:url], crumb[:options] %>
6
+ <div class="divider"><%= separator %></div>
7
+ <% end %>
8
+ <div class="active section">
9
+ <%= @breadcrumbs.last[:name] %>
10
+ </div>
11
+ </div>
12
+ <% end -%>
@@ -0,0 +1,41 @@
1
+ module Semantic
2
+ module Ui
3
+ module Sass
4
+
5
+ module BreadCrumbs
6
+ def self.included(base)
7
+ base.extend(ClassMethods)
8
+ end
9
+
10
+ module ClassMethods
11
+ def add_breadcrumb(name, url, options = {})
12
+ class_name = self.name
13
+ before_filter options do |controller|
14
+ name = controller.send :translate_breadcrumb, name, class_name if name.is_a?(Symbol)
15
+ controller.send :add_breadcrumb, name, url
16
+ end
17
+ end
18
+ end
19
+
20
+ protected
21
+
22
+ def add_breadcrumb(name, url = '', options = {})
23
+ @breadcrumbs ||= []
24
+ name = translate_breadcrumb(name, self.class.name) if name.is_a?(Symbol)
25
+ url = eval(url.to_s) if url =~ /_path|_url|@/
26
+ @breadcrumbs << {:name => name, :url => url, :options => options}
27
+ end
28
+
29
+ def translate_breadcrumb(name, class_name)
30
+ scope = [:breadcrumbs]
31
+ namespace = class_name.underscore.split('/')
32
+ namespace.last.sub!('_controller', '')
33
+ scope += namespace
34
+
35
+ I18n.t name, :scope => scope
36
+ end
37
+ end
38
+
39
+ end
40
+ end
41
+ end
@@ -1,3 +1,4 @@
1
+ require File.dirname(__FILE__) + '/breadcrumbs.rb'
1
2
  module Semantic
2
3
  module Ui
3
4
  module Sass
@@ -6,6 +7,11 @@ module Semantic
6
7
  initializer "semantic-ui-sass.assets.precompile" do |app|
7
8
  app.config.assets.precompile << %r(semantic-ui\/(basic\.)*icons\.(?:eot|svg|ttf|woff)$)
8
9
  end
10
+ initializer 'semantic-ui-sass.setup_helpers' do |app|
11
+ app.config.to_prepare do
12
+ ActionController::Base.send :include, Semantic::Ui::Sass::BreadCrumbs
13
+ end
14
+ end
9
15
  end
10
16
  end
11
17
  end
@@ -1,8 +1,8 @@
1
1
  module Semantic
2
2
  module Ui
3
3
  module Sass
4
- VERSION = "0.9.0.0"
5
- SEMANTIC_UI_SHA = 'b5e2e6df3b30d23a788217f524fc9a79314776db'
4
+ VERSION = "0.9.1.0"
5
+ SEMANTIC_UI_SHA = '92058016400cece0c515abe3c063d6172e7250f2'
6
6
  end
7
7
  end
8
8
  end
@@ -8,8 +8,8 @@ Gem::Specification.new do |spec|
8
8
  spec.version = Semantic::Ui::Sass::VERSION
9
9
  spec.authors = ["doabit"]
10
10
  spec.email = ["doinsist@gmail.com"]
11
- spec.description = %q{Semantic UI, converted to Sass and ready to drop into Rails.}
12
- spec.summary = %q{Semantic UI, converted to Sass and ready to drop into Rails.}
11
+ spec.description = %q{Semantic UI, converted to Sass and ready to drop into Rails & Compass.}
12
+ spec.summary = %q{Semantic UI, converted to Sass and ready to drop into Rails & Compass.}
13
13
  spec.homepage = "http://github.com/doabit/semantic-ui-sass"
14
14
  spec.license = "MIT"
15
15
 
@@ -0,0 +1,38 @@
1
+ require 'spec_helper'
2
+
3
+ describe SemanticBreadcrumbsHelper do
4
+ describe "semantic_breadcrumbs" do
5
+
6
+ it "should return breadcrumbs" do
7
+ controller.instance_variable_set("@breadcrumbs", [{name: 'Home', url:'/'}])
8
+ expect(render_breadcrumbs).to like_of %Q{
9
+ <div class="ui breadcrumb">
10
+ <div class="active section">Home</div>
11
+ </div>
12
+ }
13
+ end
14
+
15
+ it "should return breadcrumbs with multi params" do
16
+ controller.instance_variable_set("@breadcrumbs", [{name: 'Home', url:'/'}, {name: 'Posts', url: '/posts'}])
17
+ expect(render_breadcrumbs).to like_of %Q{
18
+ <div class="ui breadcrumb">
19
+ <a href="/">Home</a>
20
+ <div class="divider">/</div>
21
+ <div class="active section">Posts</div>
22
+ </div>
23
+ }
24
+ end
25
+
26
+ it "should return breadcrumbs with divider" do
27
+ controller.instance_variable_set("@breadcrumbs", [{name: 'Home', url:'/'}, {name: 'Posts', url: '/posts'}])
28
+ expect(render_breadcrumbs('>')).to like_of %Q{
29
+ <div class="ui breadcrumb">
30
+ <a href="/">Home</a>
31
+ <div class="divider">&gt;</div>
32
+ <div class="active section">Posts</div>
33
+ </div>
34
+ }
35
+ end
36
+
37
+ end
38
+ end
data/spec/spec_helper.rb CHANGED
@@ -4,4 +4,14 @@ require 'rspec/rails'
4
4
  require 'rspec/autorun'
5
5
 
6
6
  RSpec.configure do |config|
7
+ end
8
+
9
+ def normalize(str)
10
+ str.split("\n").map(&:strip).join("")
11
+ end
12
+
13
+ RSpec::Matchers.define :like_of do |expected|
14
+ match do |actual|
15
+ normalize(actual) == normalize(expected)
16
+ end
7
17
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: semantic-ui-sass
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.0.0
4
+ version: 0.9.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - doabit
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-11-06 00:00:00.000000000 Z
11
+ date: 2013-11-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -136,7 +136,7 @@ dependencies:
136
136
  - - '>='
137
137
  - !ruby/object:Gem::Version
138
138
  version: '0'
139
- description: Semantic UI, converted to Sass and ready to drop into Rails.
139
+ description: Semantic UI, converted to Sass and ready to drop into Rails & Compass.
140
140
  email:
141
141
  - doinsist@gmail.com
142
142
  executables: []
@@ -232,9 +232,12 @@ files:
232
232
  - app/assets/stylesheets/semantic-ui/views/_item.scss
233
233
  - app/assets/stylesheets/semantic-ui/views/_list.scss
234
234
  - app/assets/stylesheets/semantic-ui/views/_statistic.scss
235
+ - app/helpers/semantic_breadcrumbs_helper.rb
235
236
  - app/helpers/semantic_flash_helper.rb
236
237
  - app/helpers/semantic_icon_helper.rb
238
+ - app/views/semantic/_breadcrumbs.html.erb
237
239
  - lib/semantic-ui-sass.rb
240
+ - lib/semantic/ui/sass/breadcrumbs.rb
238
241
  - lib/semantic/ui/sass/engine.rb
239
242
  - lib/semantic/ui/sass/version.rb
240
243
  - semantic-ui-sass.gemspec
@@ -275,6 +278,7 @@ files:
275
278
  - spec/dummy/public/422.html
276
279
  - spec/dummy/public/500.html
277
280
  - spec/dummy/public/favicon.ico
281
+ - spec/helpers/semantic_breadcrumbs_helper_spec.rb
278
282
  - spec/helpers/semantic_flash_helper_spec.rb
279
283
  - spec/helpers/semantic_icon_helper_spec.rb
280
284
  - spec/spec_helper.rb
@@ -304,7 +308,7 @@ rubyforge_project:
304
308
  rubygems_version: 2.0.3
305
309
  signing_key:
306
310
  specification_version: 4
307
- summary: Semantic UI, converted to Sass and ready to drop into Rails.
311
+ summary: Semantic UI, converted to Sass and ready to drop into Rails & Compass.
308
312
  test_files:
309
313
  - spec/dummy/README.rdoc
310
314
  - spec/dummy/Rakefile
@@ -343,6 +347,7 @@ test_files:
343
347
  - spec/dummy/public/422.html
344
348
  - spec/dummy/public/500.html
345
349
  - spec/dummy/public/favicon.ico
350
+ - spec/helpers/semantic_breadcrumbs_helper_spec.rb
346
351
  - spec/helpers/semantic_flash_helper_spec.rb
347
352
  - spec/helpers/semantic_icon_helper_spec.rb
348
353
  - spec/spec_helper.rb